123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- // angular-formly-templates-bootstrap version 6.0.0 built with ♥ by Astrism <astrisms@gmail.com>, Kent C. Dodds <kent@doddsfamily.us> (ó ì_í)=óò=(ì_í ò)
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("angular-formly"), require("api-check"), require("angular"));
- else if(typeof define === 'function' && define.amd)
- define(["angular-formly", "api-check", "angular"], factory);
- else if(typeof exports === 'object')
- exports["ngFormlyTemplatesBootstrap"] = factory(require("angular-formly"), require("api-check"), require("angular"));
- else
- root["ngFormlyTemplatesBootstrap"] = factory(root["ngFormly"], root["apiCheck"], root["angular"]);
- })(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_8__) {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId])
- /******/ return installedModules[moduleId].exports;
- /******/
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ exports: {},
- /******/ id: moduleId,
- /******/ loaded: false
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.loaded = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(0);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- module.exports = __webpack_require__(11);
- /***/ },
- /* 1 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.config(addCheckboxType);
-
- function addCheckboxType(formlyConfigProvider) {
- formlyConfigProvider.setType({
- name: 'multiCheckbox',
- template: __webpack_require__(21),
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- apiCheck: function apiCheck(check) {
- return {
- templateOptions: {
- options: check.arrayOf(check.object),
- labelProp: check.string.optional,
- valueProp: check.string.optional
- }
- };
- },
- defaultOptions: {
- noFormControl: false,
- ngModelAttrs: {
- required: {
- attribute: '',
- bound: ''
- }
- }
- },
- controller: /* @ngInject */["$scope", function controller($scope) {
- var to = $scope.to;
- var opts = $scope.options;
- $scope.multiCheckbox = {
- checked: [],
- change: setModel
- };
-
- // initialize the checkboxes check property
- $scope.$watch('model', function modelWatcher(newModelValue) {
- var modelValue, valueProp;
-
- if (Object.keys(newModelValue).length) {
- modelValue = newModelValue[opts.key];
-
- $scope.$watch('to.options', function optionsWatcher(newOptionsValues) {
- if (newOptionsValues && Array.isArray(newOptionsValues) && Array.isArray(modelValue)) {
- valueProp = to.valueProp || 'value';
- for (var index = 0; index < newOptionsValues.length; index++) {
- $scope.multiCheckbox.checked[index] = modelValue.indexOf(newOptionsValues[index][valueProp]) !== -1;
- }
- }
- });
- }
- }, true);
-
- function checkValidity(expressionValue) {
- var valid;
-
- if ($scope.to.required) {
- valid = angular.isArray($scope.model[opts.key]) && $scope.model[opts.key].length > 0 && expressionValue;
-
- $scope.fc.$setValidity('required', valid);
- }
- }
-
- function setModel() {
- $scope.model[opts.key] = [];
- angular.forEach($scope.multiCheckbox.checked, function (checkbox, index) {
- if (checkbox) {
- $scope.model[opts.key].push(to.options[index][to.valueProp || 'value']);
- }
- });
-
- // Must make sure we mark as touched because only the last checkbox due to a bug in angular.
- $scope.fc.$setTouched();
- checkValidity(true);
- }
-
- if (opts.expressionProperties && opts.expressionProperties['templateOptions.required']) {
- $scope.$watch(function () {
- return $scope.to.required;
- }, function (newValue) {
- checkValidity(newValue);
- });
- }
-
- if ($scope.to.required) {
- var unwatchFormControl = $scope.$watch('fc', function (newValue) {
- if (!newValue) {
- return;
- }
- checkValidity(true);
- unwatchFormControl();
- });
- }
- }]
- });
- }
- addCheckboxType.$inject = ["formlyConfigProvider"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 2 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
- /***/ },
- /* 3 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
- /***/ },
- /* 4 */
- /***/ function(module, exports, __webpack_require__) {
- // some versions of angular don't export the angular module properly,
- // so we get it from window in this case.
- 'use strict';
-
- var angular = __webpack_require__(8);
- if (!angular.version) {
- angular = window.angular;
- }
- module.exports = angular;
- /***/ },
- /* 5 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.config(addWrappers);
-
- function addWrappers(formlyConfigProvider) {
- formlyConfigProvider.setWrapper([{
- name: 'bootstrapLabel',
- template: __webpack_require__(17),
- apiCheck: function apiCheck(check) {
- return {
- templateOptions: {
- label: check.string,
- required: check.bool.optional
- }
- };
- }
- }, { name: 'bootstrapHasError', template: __webpack_require__(18) }]);
- }
- addWrappers.$inject = ["formlyConfigProvider"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 6 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- __webpack_require__(10)(ngModule);
- __webpack_require__(1)(ngModule);
- __webpack_require__(12)(ngModule);
- __webpack_require__(9)(ngModule);
- __webpack_require__(13)(ngModule);
- __webpack_require__(14)(ngModule);
- };
-
- module.exports = exports['default'];
- /***/ },
- /* 7 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
- var _addons = __webpack_require__(15);
-
- var _addons2 = _interopRequireDefault(_addons);
-
- var _description = __webpack_require__(16);
-
- var _description2 = _interopRequireDefault(_description);
-
- exports['default'] = function (ngModule) {
- (0, _addons2['default'])(ngModule);
- (0, _description2['default'])(ngModule);
- };
-
- module.exports = exports['default'];
- /***/ },
- /* 8 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_8__;
- /***/ },
- /* 9 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.config(addRadioType);
-
- function addRadioType(formlyConfigProvider) {
- formlyConfigProvider.setType({
- name: 'radio',
- template: __webpack_require__(19),
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: {
- noFormControl: false
- },
- apiCheck: function apiCheck(check) {
- return {
- templateOptions: {
- options: check.arrayOf(check.object),
- labelProp: check.string.optional,
- valueProp: check.string.optional
- }
- };
- }
- });
- }
- addRadioType.$inject = ["formlyConfigProvider"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 10 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.config(addCheckboxType);
-
- function addCheckboxType(formlyConfigProvider) {
- formlyConfigProvider.setType({
- name: 'checkbox',
- template: __webpack_require__(20),
- wrapper: ['bootstrapHasError'],
- apiCheck: function apiCheck(check) {
- return {
- templateOptions: {
- label: check.string
- }
- };
- }
- });
- }
- addCheckboxType.$inject = ["formlyConfigProvider"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 11 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- var ngModuleName = 'formlyBootstrap';
- var angular = __webpack_require__(4);
- var ngModule = angular.module(ngModuleName, [__webpack_require__(2)]);
- ngModule.constant('formlyBootstrapApiCheck', __webpack_require__(3)({
- output: {
- prefix: 'angular-formly-bootstrap'
- }
- }));
- ngModule.constant('formlyBootstrapVersion', ("6.0.0"));
-
- __webpack_require__(5)(ngModule);
- __webpack_require__(6)(ngModule);
- __webpack_require__(7)(ngModule);
-
- exports['default'] = ngModuleName;
- module.exports = exports['default'];
- /***/ },
- /* 12 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.config(addInputType);
-
- function addInputType(formlyConfigProvider) {
- formlyConfigProvider.setType({
- name: 'input',
- template: '<input class="form-control" ng-model="model[options.key]">',
- wrapper: ['bootstrapLabel', 'bootstrapHasError']
- });
- }
- addInputType.$inject = ["formlyConfigProvider"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 13 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- function _defineProperty(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); }
-
- exports['default'] = function (ngModule) {
- ngModule.config(addSelectType);
-
- var template = '<select class="form-control" ng-model="model[options.key]"></select>';
-
- function addSelectType(formlyConfigProvider) {
- formlyConfigProvider.setType({
- name: 'select',
- template: template,
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: function defaultOptions(options) {
- /* jshint maxlen:195 */
- var ngOptions = options.templateOptions.ngOptions || 'option[to.valueProp || \'value\'] as option[to.labelProp || \'name\'] group by option[to.groupProp || \'group\'] for option in to.options';
- return {
- ngModelAttrs: _defineProperty({}, ngOptions, {
- value: 'ng-options'
- })
- };
- },
- apiCheck: function apiCheck(check) {
- return {
- templateOptions: {
- options: check.arrayOf(check.object),
- labelProp: check.string.optional,
- valueProp: check.string.optional,
- groupProp: check.string.optional
- }
- };
- }
- });
- }
- addSelectType.$inject = ["formlyConfigProvider"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 14 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.config(addTextareaType);
-
- function addTextareaType(formlyConfigProvider) {
- formlyConfigProvider.setType({
- name: 'textarea',
- template: '<textarea class="form-control" ng-model="model[options.key]"></textarea>',
- wrapper: ['bootstrapLabel', 'bootstrapHasError'],
- defaultOptions: {
- ngModelAttrs: {
- rows: { attribute: 'rows' },
- cols: { attribute: 'cols' }
- }
- },
- apiCheck: function apiCheck(check) {
- return {
- templateOptions: {
- rows: check.number.optional,
- cols: check.number.optional
- }
- };
- }
- });
- }
- addTextareaType.$inject = ["formlyConfigProvider"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 15 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.run(addAddonsManipulator);
-
- function addAddonsManipulator(formlyConfig, formlyBootstrapApiCheck) {
- var addonTemplate = __webpack_require__(22);
- var addonChecker = formlyBootstrapApiCheck.shape({
- 'class': formlyBootstrapApiCheck.string.optional,
- text: formlyBootstrapApiCheck.string.optional,
- onClick: formlyBootstrapApiCheck.func.optional
- }).strict.optional;
- var api = formlyBootstrapApiCheck.shape({
- templateOptions: formlyBootstrapApiCheck.shape({
- addonLeft: addonChecker,
- addonRight: addonChecker
- })
- });
- formlyConfig.templateManipulators.preWrapper.push(function (template, options) {
- if (!options.templateOptions.addonLeft && !options.templateOptions.addonRight) {
- return template;
- }
- formlyBootstrapApiCheck.warn([api], [options]);
- return addonTemplate.replace('<formly-transclude></formly-transclude>', template);
- });
- }
- addAddonsManipulator.$inject = ["formlyConfig", "formlyBootstrapApiCheck"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 16 */
- /***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- exports['default'] = function (ngModule) {
- ngModule.run(addDescriptionManipulator);
-
- function addDescriptionManipulator(formlyConfig) {
- formlyConfig.templateManipulators.preWrapper.push(function ariaDescribedBy(template, options, scope) {
- if (angular.isDefined(options.templateOptions.description)) {
- var el = document.createElement('div');
- el.appendChild(angular.element(template)[0]);
- el.appendChild(angular.element('<p id="' + scope.id + '_description"' + 'class="help-block"' + 'ng-if="to.description">' + '{{to.description}}' + '</p>')[0]);
- var modelEls = angular.element(el.querySelectorAll('[ng-model]'));
- if (modelEls) {
- modelEls.attr('aria-describedby', scope.id + '_description');
- }
- return el.innerHTML;
- } else {
- return template;
- }
- });
- }
- addDescriptionManipulator.$inject = ["formlyConfig"];
- };
- module.exports = exports['default'];
- /***/ },
- /* 17 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = "<div>\n <label for=\"{{id}}\" class=\"control-label\" ng-if=\"to.label\">\n {{to.label}}\n {{to.required ? '*' : ''}}\n </label>\n <formly-transclude></formly-transclude>\n</div>\n"
- /***/ },
- /* 18 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = "<div class=\"form-group\" ng-class=\"{'has-error': showError}\">\n <formly-transclude></formly-transclude>\n</div>\n"
- /***/ },
- /* 19 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = "<div class=\"radio-group\">\n <div ng-repeat=\"(key, option) in to.options\" class=\"radio\">\n <label>\n <input type=\"radio\"\n id=\"{{id + '_'+ $index}}\"\n tabindex=\"0\"\n ng-value=\"option[to.valueProp || 'value']\"\n ng-model=\"model[options.key]\">\n {{option[to.labelProp || 'name']}}\n </label>\n </div>\n</div>\n"
- /***/ },
- /* 20 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = "<div class=\"checkbox\">\n\t<label>\n\t\t<input type=\"checkbox\"\n class=\"formly-field-checkbox\"\n\t\t ng-model=\"model[options.key]\">\n\t\t{{to.label}}\n\t\t{{to.required ? '*' : ''}}\n\t</label>\n</div>\n"
- /***/ },
- /* 21 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = "<div class=\"radio-group\">\n <div ng-repeat=\"(key, option) in to.options\" class=\"checkbox\">\n <label>\n <input type=\"checkbox\"\n id=\"{{id + '_'+ $index}}\"\n ng-model=\"multiCheckbox.checked[$index]\"\n ng-change=\"multiCheckbox.change()\">\n {{option[to.labelProp || 'name']}}\n </label>\n </div>\n</div>\n"
- /***/ },
- /* 22 */
- /***/ function(module, exports, __webpack_require__) {
- module.exports = "<div ng-class=\"{'input-group': to.addonLeft || to.addonRight}\">\n <div class=\"input-group-addon\"\n ng-if=\"to.addonLeft\"\n ng-style=\"{cursor: to.addonLeft.onClick ? 'pointer' : 'inherit'}\"\n ng-click=\"to.addonLeft.onClick(options, this)\">\n <i class=\"{{to.addonLeft.class}}\" ng-if=\"to.addonLeft.class\"></i>\n <span ng-if=\"to.addonLeft.text\">{{to.addonLeft.text}}</span>\n </div>\n <formly-transclude></formly-transclude>\n <div class=\"input-group-addon\"\n ng-if=\"to.addonRight\"\n ng-style=\"{cursor: to.addonRight.onClick ? 'pointer' : 'inherit'}\"\n ng-click=\"to.addonRight.onClick(options, this)\">\n <i class=\"{{to.addonRight.class}}\" ng-if=\"to.addonRight.class\"></i>\n <span ng-if=\"to.addonRight.text\">{{to.addonRight.text}}</span>\n </div>\n</div>\n"
- /***/ }
- /******/ ])
- });
- ;
- //# sourceMappingURL=angular-formly-templates-bootstrap.js.map
|