angular-formly
Advanced tools
Comparing version 6.26.9 to 7.0.0
@@ -1,4 +0,4 @@ | ||
//! angular-formly version 6.26.9 built with ♥ by Astrism <astrisms@gmail.com>, Kent C. Dodds <kent@doddsfamily.us> (ó ì_í)=óò=(ì_í ò) | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("api-check"),require("angular")):"function"==typeof define&&define.amd?define(["api-check","angular"],t):"object"==typeof exports?exports.ngFormly=t(require("api-check"),require("angular")):e.ngFormly=t(e.apiCheck,e.angular)}(this,function(e,t){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(9),i=n(r);t["default"]=i["default"],e.exports=t["default"]},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(18);n.version||(n=window.angular),t["default"]=n,e.exports=t["default"]},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]="https://github.com/formly-js/angular-formly/blob/6.26.9/other/ERRORS_AND_WARNINGS.md#",e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,o,n,r){return m["default"].isFunction(t)?t(n,o,e,r):e.$eval(t,m["default"].extend({$viewValue:n,$modelValue:o},r))}function i(e,t,o){if(t.id)return t.id;var n=t.type;return!n&&t.template?n="template":!n&&t.templateUrl&&(n="templateUrl"),[e,n,t.key,o].join("_")}function a(e){return m["default"].forEach(arguments,function(t,o){o&&m["default"].forEach(t,function(t,o){m["default"].isDefined(e[o])?l(e[o],t)&&a(e[o],t):e[o]=m["default"].copy(t)})}),e}function l(e,t){return m["default"].isObject(e)&&m["default"].isObject(t)&&Object.getPrototypeOf(e)===Object.getPrototypeOf(t)}function f(e,t){if(e.prop||(e=m["default"].element(e)),e.prop("nodeName")===t.toUpperCase())return e;for(var o=e.children(),n=0;o&&n<o.length;n++){var r=f(o[n],t);if(r)return r}}function s(e){return e&&!m["default"].isArray(e)?e=[e]:e||(e=[]),e}function u(){for(var e=arguments.length,t=Array(e),o=0;e>o;o++)t[o]=arguments[o];return function(){var e=arguments;t.forEach(function(t){return t.apply(null,e)})}}function p(e,t,o){return o&&(e=e[o],t=t[o]),t&&e?(m["default"].forEach(t,function(t){-1===e.indexOf(t)&&e.push(t)}),e):t?t:e}function d(e,t){return m["default"].isString(e)&&m["default"].isString(t)?e.length>=t.length&&e.substring(0,t.length)===t:!1}Object.defineProperty(t,"__esModule",{value:!0});var c=o(1),m=n(c);t["default"]={formlyEval:r,getFieldId:i,reverseDeepMerge:a,findByNodeName:f,arrayify:s,extendFunction:u,extendArray:p,startsWith:d},e.exports=t["default"]},function(t,o){t.exports=e},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,o,n){function r(e){return e&&a["default"].isFunction(e.then)}return{restrict:"A",require:"ngModel",link:function(i,l,f,s){function u(e,t,o){p(t,o),t=a["default"].isObject(t)?t.expression:t,h?d(t,o,e):c(t,o,e)}function p(e,o){var n=e.message;n&&(y.validation.messages[o]=function(){return t.formlyEval(i,n,s.$modelValue,s.$viewValue)})}function d(n,l,f){var u=!a["default"].isString(n),p=u||f?"$asyncValidators":"$validators";e.extras.explicitAsync&&!f&&(p="$validators"),s[p][l]=function(a,l){var s=t.formlyEval(i,n,a,l);return f?s:u&&!e.extras.explicitAsync?r(s)?(m(n,y),s):s?o.when(s):o.reject(s):s}}function c(e,o,n){var a=void 0;s.$parsers.unshift(function(l){var f=t.formlyEval(i,e,s.$modelValue,l);return n||r(f)?(n||m(e,y),s.$pending=s.$pending||{},s.$pending[o]=!0,a=f,f.then(function(){a===f&&s.$setValidity(o,!0)})["catch"](function(){a===f&&s.$setValidity(o,!1)})["finally"](function(){var e=s.$pending||{};1===Object.keys(e).length?delete s.$pending:delete s.$pending[o]})):s.$setValidity(o,f),l})}function m(e,t){-1===v.indexOf(e)&&(v.push(e),n("validators-returning-promises-should-use-asyncvalidators","Validators returning promises should use asyncValidators instead of validators.",t))}var y=i.options,v=[];y.validation.messages=y.validation.messages||{},a["default"].forEach(y.validation.messages,function(e,o){y.validation.messages[o]=function(){return t.formlyEval(i,e,s.$modelValue,s.$viewValue)}});var h=s.hasOwnProperty("$validators")&&!f.hasOwnProperty("useParsers");a["default"].forEach(y.validators,u.bind(null,!1)),a["default"].forEach(y.asyncValidators,u.bind(null,!0))}}}Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,r.$inject=["formlyConfig","formlyUtil","$q","formlyWarn"],e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}function i(e,t,o,n,i,f,u,d,c,m){function y(e,o,n,r,i){function a(){o(function(){var o=e.options,r=l();s["default"].forEach(o.expressionProperties,function(i,a){var l=n(a).assign,f=t.when(d.formlyEval(e,i,r,r));f.then(function(e){l(o,e)})})})}function l(t){return e.model&&e.options.key?(s["default"].isDefined(t)&&(e.model[e.options.key]=t),e.model[e.options.key]):void 0}function u(t){d.reverseDeepMerge(t,{originalModel:t.model,extras:{},data:{},templateOptions:{},validation:{}}),e.to=e.options.templateOptions,e.formOptions=e.formOptions||{}}function p(){if(s["default"].isFunction(f.extras.getFieldId))e.id=f.extras.getFieldId(e.options,e.model,e);else{var t=e.form&&e.form.$name||e.formId;e.id=d.getFieldId(t,e.options,e.index)}e.options.id=e.id,e.name=e.options.name||e.options.id,e.options.name=e.name}function c(){s["default"].isDefined(e.options.defaultValue)&&!s["default"].isDefined(e.model[e.options.key])&&(e.model[e.options.key]=e.options.defaultValue)}function m(){e.options.initialValue=e.model&&e.model[e.options.key]}function y(e,t){t&&v(e,t.defaultOptions);var o=j(e.optionsTypes).reverse();s["default"].forEach(o,function(t){v(e,f.getType(t,!0,e).defaultOptions)})}function v(t,o){o&&(s["default"].isFunction(o)&&(o=o(t,e)),d.reverseDeepMerge(t,o))}function h(e,t){var o=e.key||t||0;s["default"].extend(e,{key:o,value:e.value||l,runExpressions:a,resetModel:b,updateInitialValue:x})}function b(){e.model[e.options.key]=e.options.initialValue,e.options.formControl&&(s["default"].isArray(e.options.formControl)?s["default"].forEach(e.options.formControl,function(e){O(e,!0)}):O(e.options.formControl))}function O(t,o){o||t.$setViewValue(e.model[e.options.key]),t.$render(),t.$setUntouched(),t.$setPristine(),e.$root.$$phase||e.$digest()}function x(){e.options.initialValue=e.model[e.options.key]}function k(e){e.validation.messages=e.validation.messages||{},s["default"].forEach(i.messages,function(t,o){e.validation.messages[o]||(e.validation.messages[o]=function(e,o,n){return d.formlyEval(n,t,o,e)})})}function A(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];s["default"].forEach([o.controller,t.controller],function(t){t&&r(t,{$scope:e})})}function E(){e.options.options=e.options.options||{},e.options.options.formState=e.formState}if(e.options.fieldGroup)return void E();var w=g(e.options);u(e.options),y(e.options,w),h(e.options,e.index),$(e.options),p(),c(),m(),a(),k(e.options),A(e,e.options,w)}function v(e,n,u,p){function c(){w(e.options),n.addClass("formly-field-group");var t="";e.options.elementAttributes&&(t=Object.keys(e.options.elementAttributes).map(function(t){return t+'="'+e.options.elementAttributes[t]+'"'}).join(" "));var o="model";e.options.form=e.form,e.options.key&&(o="model['"+e.options.key+"']"),x('\n <formly-form model="'+o+'"\n fields="options.fieldGroup"\n options="options.options"\n form="options.form"\n class="'+e.options.className+'"\n '+t+"\n is-field-group>\n </formly-form>\n ")}function y(){e.options.elementAttributes&&n.attr(e.options.elementAttributes)}function v(){e.options.className&&n.addClass(e.options.className),e.options.type&&n.addClass("formly-field-"+e.options.type)}function x(t){return n.html(h(t)),o(n.contents())(e),t}function A(t){function o(t){var o=/\{\{(.*?)}}/,r=o.exec(t);r&&(t=i(t)(e)),n(t)}function n(t){e.$watch('form["'+t+'"]',function(t){t&&(F>1?(e.options.formControl||(e.options.formControl=[]),e.options.formControl.push(t)):e.options.formControl=t,e.fc=e.options.formControl,y(),u(),p(),c())})}function u(){y=e.$watch(function(){var t=f.extras.errorExistsAndShouldBeVisibleExpression,o=e.options,n=e.fc;if(n.$invalid){if("boolean"==typeof o.validation.show)return o.validation.show;if(t)return d.formlyEval(e,t,n.$modelValue,n.$viewValue);var r=s["default"].isUndefined(n.$touched)&&n.$dirty;return e.fc.$touched||r}return!1},function(t){e.options.validation.errorExistsAndShouldBeVisible=t,e.showError=t})}function p(){m("parsers")}function c(){m("formatters");var t=e.fc,o=e.form.$pristine;e.options.formatters&&!function(){var n=t.$modelValue;t.$formatters.forEach(function(e){n=e(n)}),t.$setViewValue(n),t.$render(),t.$setPristine(),o&&e.form.$setPristine()}()}function m(t){function o(r){if(!r)return[];s["default"].isString(r)&&(r=f.getType(r,!0,e.options));var i=[];return r["extends"]&&(i=d.extendArray(i,o(r["extends"]))),i=d.extendArray(i,l(r,t,[])),i=d.extendArray(i,n(a(r)))}function n(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=[];return s["default"].forEach(s["default"].copy(j(e)).reverse(),function(e){t=d.extendArray(t,o(e))}),t}function i(t){function o(o){var n=e.options.value();return d.formlyEval(e,t,n,o)}return o[u]=t,o}var u="originalParser";"formatters"===t&&(u="originalFormatter");var p=o(M);p=d.extendArray(p,n(e.options.optionsTypes)),p=d.extendArray(p,e.options[t]),s["default"].forEach(p,function(e,t){p[t]=i(e)});var c=e.fc;s["default"].isArray(c)||(c=[c]),s["default"].forEach(c,function(e){var o;e["$"+t]=(o=e["$"+t]).concat.apply(o,r(p))})}var y=s["default"].noop;if(!e.options.noFormControl){var v=s["default"].element("<div>"+t+"</div>"),h=v[0].querySelectorAll("[ng-model],[data-ng-model]");h.length&&s["default"].forEach(h,function(e){F++,o(e.getAttribute("name"))})}}function E(){M&&M.link&&M.link.apply(_,C),e.options.link&&e.options.link.apply(_,C)}function $(o){return function(n){var r=t.when(n);return s["default"].forEach(o,function(o){r=r.then(function(n){return t.when(o(n,e.options,e)).then(function(e){return s["default"].isString(e)?e:h(e)})})}),r}}if(e.options.fieldGroup)return void c();!p&&e.options.model&&e.$watch("options.model",function(){return e.options.runExpressions()},!0),y(),v();var M=g(e.options),C=arguments,_=this,F=0,T=b(e.options,e.formOptions);O(e.options).then($(T.preWrapper)).then(k(e.options,e.formOptions)).then($(T.postWrapper)).then(x).then(A).then(E)["catch"](function(t){m("there-was-a-problem-setting-the-template-for-this-field","There was a problem setting the template for this field ",e.options,t)})}function h(e){var t=s["default"].element("<a></a>");return t.append(e).html()}function g(e){return e.type&&f.getType(e.type)}function b(e,t){function o(e){var t=e||{},o=t.preWrapper,i=void 0===o?[]:o,a=t.postWrapper,l=void 0===a?[]:a;n=n.concat(i),r=r.concat(l)}var n=[],r=[];return o(e.templateManipulators),o(t.templateManipulators),o(f.templateManipulators),{preWrapper:n,postWrapper:r}}function O(e){function t(t,o){return s["default"].isDefined(e[t])?e[t]:o&&s["default"].isDefined(o[t])?o[t]:void 0}var o=f.getType(e.type,!0,e),n=t("template",o),r=t("templateUrl",o);if(s["default"].isUndefined(n)&&!r)throw c.getFieldError("type-type-has-no-template","Type '"+e.type+"' has no template. On element:",e);return x(r||n,s["default"].isUndefined(n),e)}function x(o,r,i){var a=void 0;if(a=s["default"].isFunction(o)?t.when(o(i)):t.when(o),!r)return a;var l=function(){var t={cache:n};return{v:a.then(function(o){return e.get(o,t)}).then(function(e){return e.data})["catch"](function(e){m("problem-loading-template-for-templateurl","Problem loading template for "+o,e)})}}();return"object"==typeof l?l.v:void 0}function k(e,o){var n=E(e,o);return function(o){if(!n.length)return t.when(o);n.forEach(function(t){c.checkWrapper(t,e),t.validateOptions&&t.validateOptions(e),M(t,e)});var r=n.map(function(e){return x(e.template||e.templateUrl,!e.template)});return t.all(r).then(function(e){e.forEach(function(e,t){c.checkWrapperTemplate(e,n[t])}),e.reverse();var t=e.shift();return e.forEach(function(e){t=A(t,e)}),A(t,o)})}}function A(e,t){var o=s["default"].element("<a></a>");o.append(e);var n=o.find("formly-transclude");return n.length||(n=d.findByNodeName(o,"formly-transclude")),n.replaceWith(t),o.html()}function E(e,t){var o=e.wrapper;if(null===o)return[];o=o?j(o).map(f.getWrapper):j(f.getWrapperByType(e.type));var n=f.getType(e.type,!0,e);if(n&&n.wrapper){var r=j(n.wrapper).map(f.getWrapper);o=o.concat(r)}if(t.wrapper){var i=j(t.wrapper).map(f.getWrapper);o=o.concat(i)}var a=f.getWrapper();return a&&o.push(a),o}function $(e){u["throw"](u.formlyFieldOptions,e,{prefix:"formly-field directive",url:"formly-field-directive-validation-failed"});var t=e.type&&f.getType(e.type);t&&(t.validateOptions&&t.validateOptions(e),M(t,e,!0)),e.expressionProperties&&e.expressionProperties.hide&&m("dont-use-expressionproperties.hide-use-hideexpression-instead","You have specified `hide` in `expressionProperties`. Use `hideExpression` instead",e)}function w(e){u["throw"](u.fieldGroup,e,{prefix:"formly-field directive",url:"formly-field-directive-validation-failed"})}function M(e,t,o){var n=e.apiCheck,r=e.apiCheckInstance,i=e.apiCheckFunction,a=e.apiCheckOptions;C(n,r,i,a,t),o&&t.type&&s["default"].forEach(f.getTypeHeritage(t.type),function(e){C(e.apiCheck,e.apiCheckInstance,e.apiCheckFunction,e.apiCheckOptions,t)})}function C(e,t,o,n,r){if(e){var i=t||f.extras.apiCheckInstance||u;if(!i.config.disabled&&!p["default"].globalConfig.disabled){var a=o||"warn";if(s["default"].isFunction(e)){var l=e(i);s["default"].forEach(l,function(e,t){var o=i.shape(e),l=s["default"].extend({prefix:"formly-field type "+r.type+" for property "+t,url:u.config.output.docsBaseUrl+"formly-field-type-apicheck-failed"},n);i[a](o,r[t],l)})}else{var d=i.shape(e),c=n||{prefix:"formly-field type "+r.type,url:u.config.output.docsBaseUrl+"formly-field-type-apicheck-failed"};i[a](d,r,c)}}}}var j=d.arrayify;return y.$inject=["$scope","$timeout","$parse","$controller","formlyValidationMessages"],{restrict:"AE",transclude:!0,require:"?^formlyForm",scope:{options:"=",model:"=",originalModel:"=?",formId:"@",index:"=?",fields:"=?",formState:"=?",formOptions:"=?",form:"=?"},controller:y,link:v}}function a(e){return l(e,"optionsTypes",[])}function l(e,t,o){return e.defaultOptions&&e.defaultOptions[t]||o}Object.defineProperty(t,"__esModule",{value:!0});var f=o(1),s=n(f),u=o(4),p=n(u);t["default"]=i,i.$inject=["$http","$q","$compile","$templateCache","$interpolate","formlyConfig","formlyApiCheck","formlyUtil","formlyUsability","formlyWarn"],e.exports=t["default"]},function(e,t){"use strict";function o(e,t){return{restrict:"A",link:function(o,n,r){var i=null,a=n[0],l=t[0];r.$observe("formlyFocus",function(t){"true"===t?e(function(){i=l.activeElement,a.focus()},~~r.focusWait):"false"===t&&l.activeElement===a&&(a.blur(),r.hasOwnProperty("refocus")&&i&&i.focus())})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o,o.$inject=["$timeout","$document"],e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}function i(e,t,o,n,i){function l(t,o){function r(){return o.rootEl||"ng-form"}function a(){return o.fieldRootEl||"div"}function l(){return o.hideDirective||n.extras.defaultHideDirective||"ng-if"}function s(){return o.trackBy?"track by "+o.trackBy:""}function u(){var t=h,n=o.bindName;if(n){if(f["default"].version.minor<3)throw e.getFormlyError("bind-name attribute on formly-form not allowed in < angular 1.3");t=i.startSymbol()+"::'formly_' + "+n+i.endSymbol()}return t}function d(){return o.transcludeClass||""}function m(e){var t=["model","form","fields","options","name","role","class","data-model","data-form","data-fields","data-options","data-name"],o=[];return f["default"].forEach(e,function(e){var n=e.nodeName,r=e.value;"undefined"!==n&&-1===t.indexOf(n)&&o.push(p(n)+'="'+r+'"')}),o.join(" ")}var y=r(),v=a(),h="formly_"+c++,g="";return o.hasOwnProperty("isFieldGroup")&&t.parent().parent().hasClass("formly")&&(g=m(t.parent().parent()[0].attributes)),"\n <"+y+' class="formly"\n name="'+u()+'"\n role="form" '+g+">\n <"+v+' formly-field\n ng-repeat="field in fields '+s()+'"\n '+l()+'="!field.hide"\n class="formly-field"\n options="field"\n model="field.model || model"\n original-model="model"\n fields="fields"\n form="theFormlyForm"\n form-id="'+u()+'"\n form-state="options.formState"\n form-options="options"\n index="$index">\n </'+v+'>\n <div ng-transclude class="'+d()+'"></div>\n </'+y+">\n "}function s(t,o,i){function l(){f["default"].forEach(t.fields,function(e,o){var n=e.model||t.model;if(e.runExpressions&&e.runExpressions(),e.hideExpression){var r=n[e.key];e.hide=k(e.hideExpression,r,e,o)}e.extras&&e.extras.validateOnModelChange&&e.formControl&&e.formControl.$validate()})}function s(){t.fields=t.fields||[];var o=t.options.fieldTransform||n.extras.fieldTransform;if(o&&(t.fields=o(t.fields,t.model,t.options,t.form),!t.fields))throw e.getFormlyError("fieldTransform must return an array of fields");m(),f["default"].forEach(t.fields,h),f["default"].forEach(t.fields,g)}function u(){o["throw"]([o.formOptionsApi.optional],[t.options],{prefix:"formly-form options check"}),t.options=t.options||{},t.options.formState=t.options.formState||{},f["default"].extend(t.options,{updateInitialValue:p,resetModel:c})}function p(){f["default"].forEach(t.fields,function(e){d(e)&&e.options?e.options.updateInitialValue():e.updateInitialValue()})}function c(){f["default"].forEach(t.fields,function(e){d(e)&&e.options?e.options.resetModel():e.resetModel&&e.resetModel()})}function m(){var e=[t.model];t.options.formState&&e.push(t.options.formState),f["default"].forEach(t.fields,function(o){var n=y(o);o.model&&n&&-1===e.indexOf(o.model)&&(t.$watch(function(){return o.model},l,!0),e.push(o.model))})}function y(o){var n=!0;if(f["default"].isString(o.model)){var r=o.model,i=t.fields.indexOf(o);if(n=!v(r),o.model=k(r,void 0,o,i),!o.model)throw e.getFieldError("field-model-must-be-initialized","Field model must be initialized. When specifying a model as a string for a field, the result of the expression must have been initialized ahead of time.",o)}return n}function v(e){return["model","formState"].some(function(t){return i.startsWith(e,t+".")||i.startsWith(e,t+"[")})}function h(e,t){d(e)||(e.key=e.key||t||0)}function g(o,n){if(!d(o)&&f["default"].isDefined(o.watcher)){var r=o.watcher;f["default"].isArray(r)||(r=[r]),f["default"].forEach(r,function(r){if(!f["default"].isDefined(r.listener))throw e.getFieldError("all-field-watchers-must-have-a-listener","All field watchers must have a listener",o);var i=b(r,o,n),a=O(r,o,n),l=r.type||"$watch";r.stopWatching=t[l](i,a,r.watchDeep)})}}function b(e,t,o){var n=e.expression||"model['"+t.key+"']";return f["default"].isFunction(n)&&!function(){var i=n;n=function(){var t=x.apply(void 0,[e,o].concat(a.call(arguments)));return i.apply(void 0,r(t))},n.displayName="Formly Watch Expression for field for "+t.key}(),n}function O(e,t,o){var n=e.listener;return f["default"].isFunction(n)&&!function(){var i=n;n=function(){var t=x.apply(void 0,[e,o].concat(a.call(arguments)));return i.apply(void 0,r(t))},n.displayName="Formly Watch Listener for field for "+t.key}(),n}function x(e,o){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;n>i;i++)r[i-2]=arguments[i];return[t.fields[o]].concat(r,[e.stopWatching])}function k(e,o,n,r){var a=A(n,r);return i.formlyEval(t,e,o,o,a)}function A(e,o){return{options:e,index:o,formState:t.options.formState,formId:t.formId}}u(),t.model=t.model||{},s(),t.$watch("model",l,!0),t.options.formState&&t.$watch("options.formState",l,!0)}function u(e,r,i){function a(){var a=i.name;if(e.formId=a,e.theFormlyForm=e[a],i.form){var l=o(i.form),f=l.assign,s=l(e.$parent);s?(e.theFormlyForm=s,e[a]&&e.theFormlyForm.$removeControl(e[a]),r.removeData("$formController")):f(e.$parent,e[a])}e.theFormlyForm||n.disableWarnings||t("formly-form-has-no-formcontroller","Your formly-form does not have a `form` property. Many functions of the form (like validation) may not work",r,e)}function l(){var t=n.extras.removeChromeAutoComplete===!0,o=e.options&&e.options.removeChromeAutoComplete===!1,i=e.options&&e.options.removeChromeAutoComplete===!0;if(t&&!o||i){var a=document.createElement("input");a.setAttribute("autocomplete","address-level4"),a.setAttribute("hidden","true"),r[0].appendChild(a)}}a(),l()}function p(e){return e?e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):""}function d(e){return e&&!!e.fieldGroup}var c=1;return s.$inject=["$scope","formlyApiCheck","formlyUtil"],{restrict:"AE",template:l,replace:!0,transclude:!0,scope:{fields:"=",model:"=",form:"=?",options:"=?"},controller:s,link:u}}Object.defineProperty(t,"__esModule",{value:!0});var a=Array.prototype.slice,l=o(1),f=n(l);t["default"]=i,i.$inject=["formlyUsability","formlyWarn","$parse","formlyConfig","$interpolate"],e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(1),i=n(r),a=o(10),l=n(a),f=o(2),s=n(f),u=o(12),p=n(u),d=o(11),c=n(d),m=o(13),y=n(m),v=o(16),h=n(v),g=o(17),b=n(g),O=o(5),x=n(O),k=o(6),A=n(k),E=o(7),$=n(E),w=o(8),M=n(w),C=o(15),j=n(C),_=o(14),F=n(_),T="formly";t["default"]=T;var W=i["default"].module(T,[]);W.constant("formlyApiCheck",l["default"]),W.constant("formlyErrorAndWarningsUrlPrefix",s["default"]),W.constant("formlyVersion","6.26.9"),W.provider("formlyUsability",p["default"]),W.provider("formlyConfig",c["default"]),W.factory("formlyValidationMessages",y["default"]),W.factory("formlyUtil",h["default"]),W.factory("formlyWarn",b["default"]),W.directive("formlyCustomValidation",x["default"]),W.directive("formlyField",A["default"]),W.directive("formlyFocus",$["default"]),W.directive("formlyForm",M["default"]),W.run(j["default"]),W.run(F["default"]),e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function o(o,r,i,a){var l=a&&a.hasOwnProperty(r),f=e.some(function(e){return a&&a.hasOwnProperty(e)});return f||l?l?t(o,r,i,a):void 0:u.utils.getError(r,i,n)}l["default"].isArray(e)||(e=[e]);var n="specified if these are not specified: `"+e.join(", ")+"` (otherwise it's optional)";return o.type=n,u.utils.checkerHelpers.setupChecker(o)}function i(e){return u.oneOfType([u.oneOf([null]),e])}Object.defineProperty(t,"__esModule",{value:!0});var a=o(1),l=n(a),f=o(4),s=n(f),u=s["default"]({output:{prefix:"angular-formly:",docsBaseUrl:o(2)}}),p=u.oneOfType([u.string,u.func]),d=i(u.typeOrArrayOf(u.string)),c=u.oneOfType([u.func,u.objectOf(u.func)]),m=u.shape.onlyIf("apiCheck",u.func.withProperties({warn:u.func,"throw":u.func,shape:u.func})),y=u.shape.onlyIf("apiCheck",u.oneOf(["throw","warn"])),v=u.shape({name:r("types",u.string).optional,template:u.shape.ifNot("templateUrl",u.string).optional,templateUrl:u.shape.ifNot("template",u.string).optional,types:u.typeOrArrayOf(u.string).optional,overwriteOk:u.bool.optional,validateOptions:u.func.optional,apiCheck:c.optional,apiCheckInstance:m.optional,apiCheckFunction:y.optional,apiCheckOptions:u.object.optional}).strict,h=u.objectOf(u.oneOfType([p,u.shape({expression:p,message:p.optional}).strict])),g=u.oneOfType([u.string,u.object]),b=i(u.shape({preWrapper:i(u.arrayOf(u.func)).optional,postWrapper:i(u.arrayOf(u.func)).optional}).strict),O=u.objectOf(u.oneOfType([p,u.shape({expression:p,message:p.optional}).strict])),x={$$hashKey:u.any.optional,type:u.shape.ifNot(["template","templateUrl"],u.string).optional,template:u.shape.ifNot(["type","templateUrl"],u.oneOfType([u.string,u.func])).optional,templateUrl:u.shape.ifNot(["type","template"],u.oneOfType([u.string,u.func])).optional,key:u.oneOfType([u.string,u.number]).optional,model:g.optional,originalModel:g.optional,className:u.string.optional,id:u.string.optional,name:u.string.optional,expressionProperties:h.optional,extras:u.shape({validateOnModelChange:u.bool.optional,skipNgModelAttrsManipulator:u.oneOfType([u.string,u.bool]).optional}).strict.optional,data:u.object.optional,templateOptions:u.object.optional,wrapper:d.optional,modelOptions:u.shape({updateOn:u.string.optional,debounce:u.oneOfType([u.objectOf(u.number),u.number]).optional,allowInvalid:u.bool.optional,getterSetter:u.bool.optional,timezone:u.string.optional}).optional,watcher:u.typeOrArrayOf(u.shape({expression:p.optional,listener:p})).optional,validators:O.optional,asyncValidators:O.optional,parsers:u.arrayOf(p).optional,formatters:u.arrayOf(p).optional,noFormControl:u.bool.optional,hide:u.bool.optional,hideExpression:p.optional,ngModelElAttrs:u.objectOf(u.string).optional,ngModelAttrs:u.objectOf(u.shape({expression:u.shape.ifNot(["value","attribute","bound","boolean"],u.any).optional,value:u.shape.ifNot("expression",u.any).optional,attribute:u.shape.ifNot("expression",u.any).optional,bound:u.shape.ifNot("expression",u.any).optional,"boolean":u.shape.ifNot("expression",u.any).optional}).strict).optional,elementAttributes:u.objectOf(u.string).optional,optionsTypes:u.typeOrArrayOf(u.string).optional,link:u.func.optional,controller:u.oneOfType([u.string,u.func,u.array]).optional,validation:u.shape({show:i(u.bool).optional,messages:u.objectOf(p).optional,errorExistsAndShouldBeVisible:u.bool.optional}).optional,formControl:u.typeOrArrayOf(u.object).optional,value:u.func.optional,runExpressions:u.func.optional,templateManipulators:b.optional,resetModel:u.func.optional,updateInitialValue:u.func.optional,initialValue:u.any.optional,defaultValue:u.any.optional},k=u.shape(x).strict,A=u.shape({formState:u.object.optional,resetModel:u.func.optional,updateInitialValue:u.func.optional,removeChromeAutoComplete:u.bool.optional,templateManipulators:b.optional,wrapper:d.optional,fieldTransform:u.func.optional,data:u.object.optional}).strict,E=u.shape({$$hashKey:u.any.optional,key:u.oneOfType([u.string,u.number]).optional,fieldGroup:u.arrayOf(u.oneOfType([k,u.object])),className:u.string.optional,options:A.optional,hide:u.bool.optional,hideExpression:p.optional,data:u.object.optional,model:g.optional,form:u.object.optional,elementAttributes:u.objectOf(u.string).optional}).strict,$=l["default"].copy(x);$.key=u.string.optional;var w=u.shape({name:u.string,template:u.shape.ifNot("templateUrl",u.oneOfType([u.string,u.func])).optional,templateUrl:u.shape.ifNot("template",u.oneOfType([u.string,u.func])).optional,controller:u.oneOfType([u.func,u.string,u.array]).optional,link:u.func.optional,defaultOptions:u.oneOfType([u.func,u.shape($)]).optional,"extends":u.string.optional,wrapper:d.optional,data:u.object.optional,validateOptions:u.func.optional,apiCheck:c.optional,apiCheckInstance:m.optional,apiCheckFunction:y.optional,apiCheckOptions:u.object.optional,overwriteOk:u.bool.optional}).strict;l["default"].extend(u,{formlyTypeOptions:w,formlyFieldOptions:k,formlyExpression:p,formlyWrapperType:v,fieldGroup:E,formOptionsApi:A}),t["default"]=u,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}function i(e,t,o){function n(e){if(!l["default"].isArray(e)){if(l["default"].isObject(e))return i(e),e["extends"]&&a(e),j[e.name]=e,j[e.name];throw W("You must provide an object or array for setType. You provided: "+JSON.stringify(arguments))}var t=function(){var t=[];return l["default"].forEach(e,function(e){t.push(n(e))}),{v:t}}();return"object"==typeof t?t.v:void 0}function i(e){o["throw"](o.formlyTypeOptions,e,{prefix:"formlyConfig.setType",url:"settype-validation-failed"}),k(e),e.overwriteOk?e.overwriteOk=void 0:x(e.name,j,e,"types")}function a(e){var t=m(e["extends"],!0,e);u(e,t),p(e,t),d(e,t),c(e,t),s["default"].reverseDeepMerge(e,t),f(e,t)}function f(e,t){e.template&&t.templateUrl?delete e.templateUrl:e.templateUrl&&t.template&&delete e.template}function u(e,t){var o=t.controller;if(l["default"].isDefined(o)){var n=e.controller;l["default"].isDefined(n)?(e.controller=function(e,t){t(o,{$scope:e}),t(n,{$scope:e})},e.controller.$inject=["$scope","$controller"]):e.controller=o}}function p(e,t){var o=t.link;if(l["default"].isDefined(o)){var n=e.link;l["default"].isDefined(n)?e.link=function(){o.apply(void 0,arguments),n.apply(void 0,arguments)}:e.link=o}}function d(e,t){var o=t.validateOptions;if(l["default"].isDefined(o)){var n=e.validateOptions,r=e.defaultOptions;l["default"].isDefined(n)?e.validateOptions=function(e){n(e);var t=l["default"].copy(e),i=r;i&&(l["default"].isFunction(i)&&(i=i(t)),s["default"].reverseDeepMerge(t,i)),o(t)}:e.validateOptions=o}}function c(e,t){var o=t.defaultOptions;if(l["default"].isDefined(o)){var n=e.defaultOptions,r=l["default"].isFunction(n),i=l["default"].isFunction(o);i?e.defaultOptions=function(e,t){var i=o(e,t),a={};s["default"].reverseDeepMerge(a,e,i);var l=n;return r&&(l=l(a,t)),s["default"].reverseDeepMerge(i,l),i}:r&&(e.defaultOptions=function(e,t){var r={};return s["default"].reverseDeepMerge(r,e,o),n(r,t)})}}function m(e,t,o){if(!e)return void 0;var n=j[e];if(n||t!==!0)return n;throw W('There is no type by the name of "'+e+'": '+JSON.stringify(o))}function y(e){var t=[],o=e;for(l["default"].isString(o)&&(o=m(e)),e=o["extends"];e;)o=m(e),t.push(o),e=o["extends"];return t}function v(e,t){for(var o=!0;o;){var n=e,r=t;if(o=!1,l["default"].isArray(n))return n.map(function(e){return v(e)});if(l["default"].isObject(n))return n.types=h(n),n.name=g(n,r),b(n),_[n.name]=n,n;l["default"].isString(n)&&(e={template:n,name:r},t=void 0,o=!0)}}function h(e){return l["default"].isString(e.types)?[e.types]:l["default"].isDefined(e.types)?e.types:[]}function g(e,t){return e.name||t||e.types.join(" ")||F}function b(t){e.checkWrapper(t),t.template&&e.checkWrapperTemplate(t.template,t),k(t),t.overwriteOk?delete t.overwriteOk:x(t.name,_,t,"templateWrappers"),O(t)}function O(e){var t=!l["default"].isArray(e.types)||!e.types.every(l["default"].isString);if(t)throw W("Attempted to create a template wrapper with types that is not a string or an array of strings")}function x(e,t,o,n){t.hasOwnProperty(e)&&M("overwriting-types-or-wrappers",["Attempting to overwrite "+e+" on "+n+" which is currently",JSON.stringify(t[e])+" with "+JSON.stringify(o),'To supress this warning, specify the property "overwriteOk: true"'].join(" "))}function k(e){e.apiCheck&&!l["default"].isFunction(e.apiCheck)&&M("apicheck-as-an-object-deprecated","apiCheck as an object has been deprecated.","Attempted for type: "+e.name,e),e.validateOptions&&M("validateoptions-deprecated","the `validateOptions` property has been deprecated.","Attempted for type: "+e.name,e)}function A(e){return _[e||F]}function E(e){var t=[];for(var o in _)_.hasOwnProperty(o)&&_[o].types&&-1!==_[o].types.indexOf(e)&&t.push(_[o]);return t}function $(e){var t=_[e];return delete _[e],t}function w(e){var t=E(e);return t?l["default"].isArray(t)?(t.forEach(function(e){return $(e.name)}),t):$(t.name):void 0}function M(){if(!T.disableWarnings&&console.warn){var e=Array.prototype.slice.call(arguments),o=e.shift();e.unshift("Formly Warning:"),e.push(""+t+o),console.warn.apply(console,r(e)); | ||
}}var C=this,j={},_={},F="default",T=this,W=e.getFormlyError;l["default"].extend(this,{setType:n,getType:m,getTypeHeritage:y,setWrapper:v,getWrapper:A,getWrapperByType:E,removeWrapperByName:$,removeWrappersForType:w,disableWarnings:!1,extras:{disableNgModelAttrsManipulator:!1,ngModelAttrsManipulatorPreferUnbound:!1,removeChromeAutoComplete:!1,defaultHideDirective:"ng-if",getFieldId:null,explicitAsync:!1},templateManipulators:{preWrapper:[],postWrapper:[]},$get:function(){return C}})}Object.defineProperty(t,"__esModule",{value:!0});var a=o(1),l=n(a),f=o(3),s=n(f);t["default"]=i,i.$inject=["formlyUsabilityProvider","formlyErrorAndWarningsUrlPrefix","formlyApiCheck"],e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function o(e,t,o){return arguments.length<3&&(o=t,t=e,e=null),new Error(r(e,t)+(" Field definition: "+a["default"].toJson(o)))}function n(e,t){return t||(t=e,e=null),new Error(r(e,t))}function r(e,o){var n="";return null!==e&&(n=""+t+e),"Formly Error: "+o+". "+n}function i(t){e["throw"](e.formlyWrapperType,t,{prefix:"formlyConfig.setWrapper",urlSuffix:"setwrapper-validation-failed"})}function l(e,t){var o="<formly-transclude></formly-transclude>";if(-1===e.indexOf(o))throw n('Template wrapper templates must use "'+o+'" somewhere in them. This one does not have "<formly-transclude></formly-transclude>" in it: '+e+"\nAdditional information: "+JSON.stringify(t))}var f=this;a["default"].extend(this,{getFormlyError:n,getFieldError:o,checkWrapper:i,checkWrapperTemplate:l,getErrorMessage:r,$get:function(){return f}})}Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,r.$inject=["formlyApiCheck","formlyErrorAndWarningsUrlPrefix"],e.exports=t["default"]},function(e,t){"use strict";function o(){function e(e,t,r,i,a){n.messages[e]=o(t,r,i,a)}function t(e,t){n.messages[e]=function(){return t}}function o(e,t,o,n){return function(r,i,a){return a.options.templateOptions[e]?t+" "+a.options.templateOptions[e]+" "+o:n}}var n={addTemplateOptionValueMessage:e,addStringMessage:t,messages:{}};return n}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o,e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e){e&&e.get&&!function(){var t=e.get(0),o=t.createElement("div");o.innerHTML="<!--[if lt IE 9]><i></i><![endif]-->";var n=1===o.getElementsByTagName("i").length;if(n){var r=["formly-field","formly-form","formly-custom-validation","formly-focus","formly-transpose"];a["default"].forEach(r,function(e){t.createElement(e)})}}()}Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,r.$inject=["$document"],e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,o){function n(e,o,n){function i(){(a["default"].isDefined(o.validators)||a["default"].isDefined(o.validation.messages))&&p(v,"formly-custom-validation","")}function l(){a["default"].isDefined(o.modelOptions)&&(p(v,"ng-model-options","options.modelOptions"),o.modelOptions.getterSetter&&a["default"].forEach(v,function(e){e.setAttribute("ng-model","options.value")}))}function d(){if(o.templateOptions||o.expressionProperties){var e=o.templateOptions||{},n=o.expressionProperties||{},r=s();a["default"].extend(r,o.ngModelAttrs),a["default"].forEach(r,function(r,i){var l=void 0,f=void 0,s="options.templateOptions['"+i+"']",d=e[i],c=u(n,i),m=a["default"].isDefined(d),y=a["default"].isDefined(c);if(r.value)f=r.value,l=i;else if(r.expression&&m)if(f=r.expression,a["default"].isString(e[i]))l="$eval("+s+")";else{if(!a["default"].isFunction(e[i]))throw new Error("options.templateOptions."+i+" must be a string or function: "+JSON.stringify(o));l=s+"(model[options.key], options, this, $event)"}else r.bound&&y?(f=r.bound,l=s):(r.attribute||r["boolean"])&&y?(f=r.attribute||r["boolean"],l=""+t.startSymbol()+s+t.endSymbol()):r.attribute&&m?(f=r.attribute,l=d):r["boolean"]?m&&!y&&d&&(f=r["boolean"],l=!0):r.bound&&m&&(f=r.bound,l=s);a["default"].isDefined(f)&&a["default"].isDefined(l)&&p(v,f,l)})}}function c(){a["default"].forEach(o.ngModelElAttrs,function(e,t){p(v,t,e)})}var m=document.createElement("div"),y=f(o);if(y===!0)return e;m.innerHTML=e;var v=r(m,y);return v&&v.length?(p(v,"id",n.id),p(v,"name",n.name||n.id),i(),l(),d(),c(),m.innerHTML):e}function r(e,t){var o=a["default"].isString(t)?":not("+t+")":"",n=":not([formly-skip-ng-model-attrs-manipulator])",r="[ng-model]"+o+n+", [data-ng-model]"+o+n;try{return e.querySelectorAll(r)}catch(l){return i(e,t)}}function i(e,t){var o=e.querySelectorAll("[ng-model], [data-ng-model]"),n=[];n.item=function(e){return this[e]};for(var r=0;r<o.length;r++){var i=o[r];i.hasAttribute("formly-skip-ng-model-attrs-manipulator")||a["default"].isString(t)&&l(i,t)||n.push(i)}return n}function l(e,t){var o=document.createElement("div");return o.innerHTML=e.outerHTML,o.querySelector(t)}function f(e){var t=e.extras&&e.extras.skipNgModelAttrsManipulator;return a["default"].isDefined(t)||(t=e.data&&e.data.skipNgModelAttrsManipulator,a["default"].isDefined(t)&&o("skipngmodelattrsmanipulator-moved","The skipNgModelAttrsManipulator property has been moved from the `data` property to the `extras` property",e)),t}function s(){var t={focus:{attribute:"formly-focus"}},o=[],n=["required","disabled"],r=["pattern","minlength"],i=["change","keydown","keyup","keypress","click","focus","blur"],l=["placeholder","min","max","tabindex","type"];return e.extras.ngModelAttrsManipulatorPreferUnbound?r.push("maxlength"):o.push("maxlength"),a["default"].forEach(o,function(e){t[e]={bound:"ng-"+e}}),a["default"].forEach(n,function(e){t[e]={"boolean":e,bound:"ng-"+e}}),a["default"].forEach(r,function(e){t[e]={attribute:e,bound:"ng-"+e}}),a["default"].forEach(i,function(e){var o="on"+e.substr(0,1).toUpperCase()+e.substr(1);t[o]={expression:"ng-"+e}}),a["default"].forEach(l,function(e){t[e]={attribute:e}}),t}function u(e,t){return e["templateOptions."+t]||e["templateOptions['"+t+"']"]||e['templateOptions["'+t+'"]']}function p(e,t,o){a["default"].forEach(e,function(e){e.getAttribute(t)||e.setAttribute(t,o)})}e.extras.disableNgModelAttrsManipulator||e.templateManipulators.preWrapper.push(n)}Object.defineProperty(t,"__esModule",{value:!0});var i=o(1),a=n(i);t["default"]=r,r.$inject=["formlyConfig","$interpolate","formlyWarn"],e.exports=t["default"]},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function r(){return a["default"]}Object.defineProperty(t,"__esModule",{value:!0});var i=o(3),a=n(i);t["default"]=r,e.exports=t["default"]},function(e,t){"use strict";function o(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}function n(e,t,n){return function(){if(!e.disableWarnings){var r=Array.prototype.slice.call(arguments),i=r.shift();r.unshift("Formly Warning:"),r.push(""+t+i),n.warn.apply(n,o(r))}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,n.$inject=["formlyConfig","formlyErrorAndWarningsUrlPrefix","$log"],e.exports=t["default"]},function(e,o){e.exports=t}])}); | ||
//! angular-formly version 7.0.0 built with ♥ by Astrism <astrisms@gmail.com>, Kent C. Dodds <kent@doddsfamily.us> (ó ì_í)=óò=(ì_í ò) | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("api-check"),require("angular")):"function"==typeof define&&define.amd?define(["api-check","angular"],t):"object"==typeof exports?exports.ngFormly=t(require("api-check"),require("angular")):e.ngFormly=t(e.apiCheck,e.angular)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),i=o(r);t["default"]=i["default"],e.exports=t["default"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(18);o.version||(o=window.angular),t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t,n,o,r){return y["default"].isFunction(t)?t(o,n,e,r):e.$eval(t,y["default"].extend({$viewValue:o,$modelValue:n},r))}function i(e,t,n){if(t.id)return t.id;var o=t.type;return!o&&t.template?o="template":!o&&t.templateUrl&&(o="templateUrl"),[e,o,t.key,n].join("_")}function a(e){return y["default"].forEach(arguments,function(t,n){n&&y["default"].forEach(t,function(t,n){y["default"].isDefined(e[n])?l(e[n],t)&&a(e[n],t):e[n]=y["default"].copy(t)})}),e}function l(e,t){return y["default"].isObject(e)&&y["default"].isObject(t)&&Object.getPrototypeOf(e)===Object.getPrototypeOf(t)}function f(e,t){if(e.prop||(e=y["default"].element(e)),e.prop("nodeName")===t.toUpperCase())return e;for(var n=e.children(),o=0;n&&o<n.length;o++){var r=f(n[o],t);if(r)return r}}function s(e){return e&&!y["default"].isArray(e)?e=[e]:e||(e=[]),e}function u(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(){var e=arguments;t.forEach(function(t){return t.apply(null,e)})}}function p(e,t,n){return n&&(e=e[n],t=t[n]),t&&e?(y["default"].forEach(t,function(t){-1===e.indexOf(t)&&e.push(t)}),e):t?t:e}function d(e,t){return y["default"].isString(e)&&y["default"].isString(t)?e.length>=t.length&&e.substring(0,t.length)===t:!1}function c(e,t){return y["default"].isString(e)&&y["default"].isString(t)?e.length>=t.length&&-1!==e.indexOf(t):!1}Object.defineProperty(t,"__esModule",{value:!0});var m=n(1),y=o(m);t["default"]={formlyEval:r,getFieldId:i,reverseDeepMerge:a,findByNodeName:f,arrayify:s,extendFunction:u,extendArray:p,startsWith:d,contains:c},e.exports=t["default"]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]="https://github.com/formly-js/angular-formly/blob/7.0.0/other/ERRORS_AND_WARNINGS.md#",e.exports=t["default"]},function(t,n){t.exports=e},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){return{restrict:"A",require:"ngModel",link:function(t,n,o,r){function i(e,t,n){l(t,n),t=a["default"].isObject(t)?t.expression:t,p?f(t,n,e):s(t,n,e)}function l(n,o){var i=n.message;i&&(u.validation.messages[o]=function(){return e.formlyEval(t,i,r.$modelValue,r.$viewValue)})}function f(n,o,i){var a=i?"$asyncValidators":"$validators";r[a][o]=function(o,r){return e.formlyEval(t,n,o,r)}}function s(n,o,i){var a=void 0;r.$parsers.unshift(function(l){var f=e.formlyEval(t,n,r.$modelValue,l);return i?(r.$pending=r.$pending||{},r.$pending[o]=!0,a=f,f.then(function(){a===f&&r.$setValidity(o,!0)})["catch"](function(){a===f&&r.$setValidity(o,!1)})["finally"](function(){var e=r.$pending||{};1===Object.keys(e).length?delete r.$pending:delete r.$pending[o]})):r.$setValidity(o,f),l})}var u=t.options;u.validation.messages=u.validation.messages||{},a["default"].forEach(u.validation.messages,function(n,o){u.validation.messages[o]=function(){return e.formlyEval(t,n,r.$modelValue,r.$viewValue)}});var p=r.hasOwnProperty("$validators")&&!o.hasOwnProperty("useParsers");a["default"].forEach(u.validators,i.bind(null,!1)),a["default"].forEach(u.asyncValidators,i.bind(null,!0))}}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=o(i);t["default"]=r,r.$inject=["formlyUtil"],e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t,n,o,i,f,u,d,c,m){function y(e,n,o,r,i){function a(){n(function(){var n=e.options,r=l();s["default"].forEach(n.expressionProperties,function(i,a){var l=o(a).assign,f=t.when(d.formlyEval(e,i,r,r));f.then(function(e){l(n,e)})})})}function l(t){return e.model&&e.options.key?(s["default"].isDefined(t)&&(e.model[e.options.key]=t),e.model[e.options.key]):void 0}function u(t){d.reverseDeepMerge(t,{originalModel:t.model,extras:{},data:{},templateOptions:{},validation:{}}),e.to=e.options.templateOptions,e.formOptions=e.formOptions||{}}function p(){if(s["default"].isFunction(f.extras.getFieldId))e.id=f.extras.getFieldId(e.options,e.model,e);else{var t=e.form&&e.form.$name||e.formId;e.id=d.getFieldId(t,e.options,e.index)}e.options.id=e.id,e.name=e.options.name||e.options.id,e.options.name=e.name}function c(){s["default"].isDefined(e.options.defaultValue)&&!s["default"].isDefined(e.model[e.options.key])&&(e.model[e.options.key]=e.options.defaultValue)}function m(){e.options.initialValue=e.model&&e.model[e.options.key]}function y(e,t){t&&h(e,t.defaultOptions);var n=j(e.optionsTypes).reverse();s["default"].forEach(n,function(t){h(e,f.getType(t,!0,e).defaultOptions)})}function h(t,n){n&&(s["default"].isFunction(n)&&(n=n(t,e)),d.reverseDeepMerge(t,n))}function v(e,t){var n=e.key||t||0;s["default"].extend(e,{key:n,value:e.value||l,runExpressions:a,resetModel:b,updateInitialValue:x})}function b(){e.model[e.options.key]=e.options.initialValue,e.options.formControl&&(s["default"].isArray(e.options.formControl)?s["default"].forEach(e.options.formControl,function(e){O(e,!0)}):O(e.options.formControl))}function O(t,n){n||t.$setViewValue(e.model[e.options.key]),t.$render(),t.$setUntouched(),t.$setPristine(),e.$root.$$phase||e.$digest()}function x(){e.options.initialValue=e.model[e.options.key]}function E(e){e.validation.messages=e.validation.messages||{},s["default"].forEach(i.messages,function(t,n){e.validation.messages[n]||(e.validation.messages[n]=function(e,n,o){return d.formlyEval(o,t,n,e)})})}function $(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];s["default"].forEach([n.controller,t.controller],function(t){t&&r(t,{$scope:e})})}function k(){e.options.options=e.options.options||{},e.options.options.formState=e.formState}if(e.options.fieldGroup)return void k();var A=g(e.options);u(e.options),y(e.options,A),v(e.options,e.index),w(e.options),p(),c(),m(),a(),E(e.options),$(e,e.options,A)}function h(e,o,u,p){function c(){A(e.options),o.addClass("formly-field-group");var t="";e.options.elementAttributes&&(t=Object.keys(e.options.elementAttributes).map(function(t){return t+'="'+e.options.elementAttributes[t]+'"'}).join(" "));var n="model";e.options.form=e.form,e.options.key&&(n="model['"+e.options.key+"']"),x('\n <formly-form model="'+n+'"\n fields="options.fieldGroup"\n options="options.options"\n form="options.form"\n class="'+e.options.className+'"\n '+t+"\n is-field-group>\n </formly-form>\n ")}function y(){e.options.elementAttributes&&o.attr(e.options.elementAttributes)}function h(){e.options.className&&o.addClass(e.options.className),e.options.type&&o.addClass("formly-field-"+e.options.type)}function x(t){return o.html(v(t)),n(o.contents())(e),t}function $(t){function n(t){var n=/\{\{(.*?)}}/,r=n.exec(t);r&&(t=i(t)(e)),o(t)}function o(t){e.$watch('form["'+t+'"]',function(t){t&&(T>1?(e.options.formControl||(e.options.formControl=[]),e.options.formControl.push(t)):e.options.formControl=t,e.fc=e.options.formControl,y(),u(),p(),c())})}function u(){y=e.$watch(function(){var t=f.extras.errorExistsAndShouldBeVisibleExpression,n=e.options,o=e.fc;if(o.$invalid){if("boolean"==typeof n.validation.show)return n.validation.show;if(t)return d.formlyEval(e,t,o.$modelValue,o.$viewValue);var r=s["default"].isUndefined(o.$touched)&&o.$dirty;return e.fc.$touched||r}return!1},function(t){e.options.validation.errorExistsAndShouldBeVisible=t,e.showError=t})}function p(){m("parsers")}function c(){m("formatters");var t=e.fc,n=e.form.$pristine;e.options.formatters&&!function(){var o=t.$modelValue;t.$formatters.forEach(function(e){o=e(o)}),t.$setViewValue(o),t.$render(),t.$setPristine(),n&&e.form.$setPristine()}()}function m(t){function n(r){if(!r)return[];s["default"].isString(r)&&(r=f.getType(r,!0,e.options));var i=[];return r["extends"]&&(i=d.extendArray(i,n(r["extends"]))),i=d.extendArray(i,l(r,t,[])),i=d.extendArray(i,o(a(r)))}function o(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=[];return s["default"].forEach(s["default"].copy(j(e)).reverse(),function(e){t=d.extendArray(t,n(e))}),t}function i(t){function n(n){var o=e.options.value();return d.formlyEval(e,t,o,n)}return n[u]=t,n}var u="originalParser";"formatters"===t&&(u="originalFormatter");var p=n(M);p=d.extendArray(p,o(e.options.optionsTypes)),p=d.extendArray(p,e.options[t]),s["default"].forEach(p,function(e,t){p[t]=i(e)});var c=e.fc;s["default"].isArray(c)||(c=[c]),s["default"].forEach(c,function(e){var n;e["$"+t]=(n=e["$"+t]).concat.apply(n,r(p))})}var y=s["default"].noop;if(!e.options.noFormControl){var h=s["default"].element("<div>"+t+"</div>"),v=h[0].querySelectorAll("[ng-model],[data-ng-model]");v.length&&s["default"].forEach(v,function(e){T++,n(e.getAttribute("name"))})}}function k(){M&&M.link&&M.link.apply(_,C),e.options.link&&e.options.link.apply(_,C)}function w(n){return function(o){var r=t.when(o);return s["default"].forEach(n,function(n){r=r.then(function(o){return t.when(n(o,e.options,e)).then(function(e){return s["default"].isString(e)?e:v(e)})})}),r}}if(e.options.fieldGroup)return void c();!p&&e.options.model&&e.$watch("options.model",function(){return e.options.runExpressions()},!0),y(),h();var M=g(e.options),C=arguments,_=this,T=0,F=b(e.options,e.formOptions);O(e.options).then(w(F.preWrapper)).then(E(e.options,e.formOptions)).then(w(F.postWrapper)).then(x).then($).then(k)["catch"](function(t){m("there-was-a-problem-setting-the-template-for-this-field","There was a problem setting the template for this field ",e.options,t)})}function v(e){var t=s["default"].element("<a></a>");return t.append(e).html()}function g(e){return e.type&&f.getType(e.type)}function b(e,t){function n(e){var t=e||{},n=t.preWrapper,i=void 0===n?[]:n,a=t.postWrapper,l=void 0===a?[]:a;o=o.concat(i),r=r.concat(l)}var o=[],r=[];return n(e.templateManipulators),n(t.templateManipulators),n(f.templateManipulators),{preWrapper:o,postWrapper:r}}function O(e){function t(t,n){return s["default"].isDefined(e[t])?e[t]:n&&s["default"].isDefined(n[t])?n[t]:void 0}var n=f.getType(e.type,!0,e),o=t("template",n),r=t("templateUrl",n);if(s["default"].isUndefined(o)&&!r)throw c.getFieldError("type-type-has-no-template","Type '"+e.type+"' has no template. On element:",e);return x(r||o,s["default"].isUndefined(o),e)}function x(n,r,i){var a=void 0;if(a=s["default"].isFunction(n)?t.when(n(i)):t.when(n),!r)return a;var l=function(){var t={cache:o};return{v:a.then(function(n){return e.get(n,t)}).then(function(e){return e.data})["catch"](function(e){m("problem-loading-template-for-templateurl","Problem loading template for "+n,e)})}}();return"object"==typeof l?l.v:void 0}function E(e,n){var o=k(e,n);return function(n){if(!o.length)return t.when(n);o.forEach(function(t){c.checkWrapper(t,e),M(t,e)});var r=o.map(function(e){return x(e.template||e.templateUrl,!e.template)});return t.all(r).then(function(e){e.forEach(function(e,t){c.checkWrapperTemplate(e,o[t])}),e.reverse();var t=e.shift();return e.forEach(function(e){t=$(t,e)}),$(t,n)})}}function $(e,t){var n=s["default"].element("<a></a>");n.append(e);var o=n.find("formly-transclude");return o.length||(o=d.findByNodeName(n,"formly-transclude")),o.replaceWith(t),n.html()}function k(e,t){var n=e.wrapper;if(null===n)return[];n=n?j(n).map(f.getWrapper):j(f.getWrapperByType(e.type));var o=f.getType(e.type,!0,e);if(o&&o.wrapper){var r=j(o.wrapper).map(f.getWrapper);n=n.concat(r)}if(t.wrapper){var i=j(t.wrapper).map(f.getWrapper);n=n.concat(i)}var a=f.getWrapper();return a&&n.push(a),n}function w(e){u["throw"](u.formlyFieldOptions,e,{prefix:"formly-field directive",url:"formly-field-directive-validation-failed"});var t=e.type&&f.getType(e.type);t&&M(t,e,!0),e.expressionProperties&&e.expressionProperties.hide&&m("dont-use-expressionproperties.hide-use-hideexpression-instead","You have specified `hide` in `expressionProperties`. Use `hideExpression` instead",e)}function A(e){u["throw"](u.fieldGroup,e,{prefix:"formly-field directive",url:"formly-field-directive-validation-failed"})}function M(e,t,n){var o=e.apiCheck,r=e.apiCheckInstance,i=e.apiCheckFunction,a=e.apiCheckOptions;C(o,r,i,a,t),n&&t.type&&s["default"].forEach(f.getTypeHeritage(t.type),function(e){C(e.apiCheck,e.apiCheckInstance,e.apiCheckFunction,e.apiCheckOptions,t)})}function C(e,t,n,o,r){if(e){var i=t||f.extras.apiCheckInstance||u;if(!i.config.disabled&&!p["default"].globalConfig.disabled){var a=n||"warn",l=e(i);s["default"].forEach(l,function(e,t){var n=i.shape(e),l=s["default"].extend({prefix:"formly-field type "+r.type+" for property "+t,url:u.config.output.docsBaseUrl+"formly-field-type-apicheck-failed"},o);i[a](n,r[t],l)})}}}var j=d.arrayify;return y.$inject=["$scope","$timeout","$parse","$controller","formlyValidationMessages"],{restrict:"AE",transclude:!0,require:"?^formlyForm",scope:{options:"=",model:"=",originalModel:"=?",formId:"@",index:"=?",fields:"=?",formState:"=?",formOptions:"=?",form:"=?"},controller:y,link:h}}function a(e){return l(e,"optionsTypes",[])}function l(e,t,n){return e.defaultOptions&&e.defaultOptions[t]||n}Object.defineProperty(t,"__esModule",{value:!0});var f=n(1),s=o(f),u=n(4),p=o(u);t["default"]=i,i.$inject=["$http","$q","$compile","$templateCache","$interpolate","formlyConfig","formlyApiCheck","formlyUtil","formlyUsability","formlyWarn"],e.exports=t["default"]},function(e,t){"use strict";function n(e,t){return{restrict:"A",link:function(n,o,r){var i=null,a=o[0],l=t[0];r.$observe("formlyFocus",function(t){"true"===t?e(function(){i=l.activeElement,a.focus()},~~r.focusWait):"false"===t&&l.activeElement===a&&(a.blur(),r.hasOwnProperty("refocus")&&i&&i.focus())})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,n.$inject=["$timeout","$document"],e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t,n,o,i){function l(t,n){function r(){return n.rootEl||"ng-form"}function a(){return n.fieldRootEl||"div"}function l(){return n.hideDirective||o.extras.defaultHideDirective||"ng-if"}function s(){return n.trackBy?"track by "+n.trackBy:""}function u(){var t=v,o=n.bindName;if(o){if(f["default"].version.minor<3)throw e.getFormlyError("bind-name attribute on formly-form not allowed in < angular 1.3");t=i.startSymbol()+"::'formly_' + "+o+i.endSymbol()}return t}function d(){return n.transcludeClass||""}function m(e){var t=["model","form","fields","options","name","role","class","data-model","data-form","data-fields","data-options","data-name"],n=[];return f["default"].forEach(e,function(e){var o=e.nodeName,r=e.value;"undefined"!==o&&-1===t.indexOf(o)&&n.push(p(o)+'="'+r+'"')}),n.join(" ")}var y=r(),h=a(),v="formly_"+c++,g="";return n.hasOwnProperty("isFieldGroup")&&t.parent().parent().hasClass("formly")&&(g=m(t.parent().parent()[0].attributes)),"\n <"+y+' class="formly"\n name="'+u()+'"\n role="form" '+g+">\n <"+h+' formly-field\n ng-repeat="field in fields '+s()+'"\n '+l()+'="!field.hide"\n class="formly-field"\n options="field"\n model="field.model || model"\n original-model="model"\n fields="fields"\n form="theFormlyForm"\n form-id="'+u()+'"\n form-state="options.formState"\n form-options="options"\n index="$index">\n </'+h+'>\n <div ng-transclude class="'+d()+'"></div>\n </'+y+">\n "}function s(t,n,i){function l(){f["default"].forEach(t.fields,function(e,n){var o=e.model||t.model;if(e.runExpressions&&e.runExpressions(),e.hideExpression){var r=o[e.key];e.hide=E(e.hideExpression,r,e,n)}e.extras&&e.extras.validateOnModelChange&&e.formControl&&e.formControl.$validate()})}function s(){t.fields=t.fields||[];var n=t.options.fieldTransform||o.extras.fieldTransform;if(n&&(t.fields=n(t.fields,t.model,t.options,t.form),!t.fields))throw e.getFormlyError("fieldTransform must return an array of fields");m(),f["default"].forEach(t.fields,v),f["default"].forEach(t.fields,g)}function u(){n["throw"]([n.formOptionsApi.optional],[t.options],{prefix:"formly-form options check"}),t.options=t.options||{},t.options.formState=t.options.formState||{},f["default"].extend(t.options,{updateInitialValue:p,resetModel:c})}function p(){f["default"].forEach(t.fields,function(e){d(e)&&e.options?e.options.updateInitialValue():e.updateInitialValue()})}function c(){f["default"].forEach(t.fields,function(e){d(e)&&e.options?e.options.resetModel():e.resetModel&&e.resetModel()})}function m(){var e=[t.model];t.options.formState&&e.push(t.options.formState),f["default"].forEach(t.fields,function(n){var o=y(n);n.model&&o&&-1===e.indexOf(n.model)&&(t.$watch(function(){return n.model},l,!0),e.push(n.model))})}function y(n){var o=!0;if(f["default"].isString(n.model)){var r=n.model,i=t.fields.indexOf(n);if(o=!h(r),n.model=E(r,void 0,n,i),!n.model)throw e.getFieldError("field-model-must-be-initialized","Field model must be initialized. When specifying a model as a string for a field, the result of the expression must have been initialized ahead of time.",n)}return o}function h(e){return["model","formState"].some(function(t){return i.startsWith(e,t+".")||i.startsWith(e,t+"[")})}function v(e,t){d(e)||(e.key=e.key||t||0)}function g(n,o){if(!d(n)&&f["default"].isDefined(n.watcher)){var r=n.watcher;f["default"].isArray(r)||(r=[r]),f["default"].forEach(r,function(r){if(!f["default"].isDefined(r.listener))throw e.getFieldError("all-field-watchers-must-have-a-listener","All field watchers must have a listener",n);var i=b(r,n,o),a=O(r,n,o),l=r.type||"$watch";r.stopWatching=t[l](i,a,r.watchDeep)})}}function b(e,t,n){var o=e.expression||"model['"+t.key+"']";return f["default"].isFunction(o)&&!function(){var i=o;o=function(){var t=x.apply(void 0,[e,n].concat(a.call(arguments)));return i.apply(void 0,r(t))},o.displayName="Formly Watch Expression for field for "+t.key}(),o}function O(e,t,n){var o=e.listener;return f["default"].isFunction(o)&&!function(){var i=o;o=function(){var t=x.apply(void 0,[e,n].concat(a.call(arguments)));return i.apply(void 0,r(t))},o.displayName="Formly Watch Listener for field for "+t.key}(),o}function x(e,n){for(var o=arguments.length,r=Array(o>2?o-2:0),i=2;o>i;i++)r[i-2]=arguments[i];return[t.fields[n]].concat(r,[e.stopWatching])}function E(e,n,o,r){var a=$(o,r);return i.formlyEval(t,e,n,n,a)}function $(e,n){return{options:e,index:n,formState:t.options.formState,formId:t.formId}}u(),t.model=t.model||{},s(),t.$watch("model",l,!0),t.options.formState&&t.$watch("options.formState",l,!0)}function u(e,r,i){function a(){var a=i.name;if(e.formId=a,e.theFormlyForm=e[a],i.form){var l=n(i.form),f=l.assign,s=l(e.$parent);s?(e.theFormlyForm=s,e[a]&&e.theFormlyForm.$removeControl(e[a]),r.removeData("$formController")):f(e.$parent,e[a])}e.theFormlyForm||o.disableWarnings||t("formly-form-has-no-formcontroller","Your formly-form does not have a `form` property. Many functions of the form (like validation) may not work",r,e)}function l(){var t=o.extras.removeChromeAutoComplete===!0,n=e.options&&e.options.removeChromeAutoComplete===!1,i=e.options&&e.options.removeChromeAutoComplete===!0;if(t&&!n||i){var a=document.createElement("input");a.setAttribute("autocomplete","address-level4"),a.setAttribute("hidden","true"),r[0].appendChild(a)}}a(),l()}function p(e){return e?e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):""}function d(e){return e&&!!e.fieldGroup}var c=1;return s.$inject=["$scope","formlyApiCheck","formlyUtil"],{restrict:"AE",template:l,replace:!0,transclude:!0,scope:{fields:"=",model:"=",form:"=?",options:"=?"},controller:s,link:u}}Object.defineProperty(t,"__esModule",{value:!0});var a=Array.prototype.slice,l=n(1),f=o(l);t["default"]=i,i.$inject=["formlyUsability","formlyWarn","$parse","formlyConfig","$interpolate"],e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=o(r),a=n(10),l=o(a),f=n(3),s=o(f),u=n(12),p=o(u),d=n(11),c=o(d),m=n(13),y=o(m),h=n(16),v=o(h),g=n(17),b=o(g),O=n(5),x=o(O),E=n(6),$=o(E),k=n(7),w=o(k),A=n(8),M=o(A),C=n(15),j=o(C),_=n(14),T=o(_),F="formly";t["default"]=F;var W=i["default"].module(F,[]);W.constant("formlyApiCheck",l["default"]),W.constant("formlyErrorAndWarningsUrlPrefix",s["default"]),W.constant("formlyVersion","7.0.0"),W.provider("formlyUsability",p["default"]),W.provider("formlyConfig",c["default"]),W.factory("formlyValidationMessages",y["default"]),W.factory("formlyUtil",v["default"]),W.factory("formlyWarn",b["default"]),W.directive("formlyCustomValidation",x["default"]),W.directive("formlyField",$["default"]),W.directive("formlyFocus",w["default"]),W.directive("formlyForm",M["default"]),W.run(j["default"]),W.run(T["default"]),e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function n(n,r,i,a){var l=a&&a.hasOwnProperty(r),f=e.some(function(e){return a&&a.hasOwnProperty(e)});return f||l?l?t(n,r,i,a):void 0:s.utils.getError(r,i,o)}a["default"].isArray(e)||(e=[e]);var o="specified if these are not specified: `"+e.join(", ")+"` (otherwise it's optional)";return n.type=o,s.utils.checkerHelpers.setupChecker(n)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=o(i),l=n(4),f=o(l),s=f["default"]({output:{prefix:"angular-formly:",docsBaseUrl:n(3)}}),u=s.oneOfType([s.string,s.func]),p=s.typeOrArrayOf(s.string).nullable,d=s.func,c=s.shape.onlyIf("apiCheck",s.func.withProperties({warn:s.func,"throw":s.func,shape:s.func})),m=s.shape.onlyIf("apiCheck",s.oneOf(["throw","warn"])),y=s.shape({name:r("types",s.string).optional,template:s.shape.ifNot("templateUrl",s.string).optional,templateUrl:s.shape.ifNot("template",s.string).optional,types:s.typeOrArrayOf(s.string).optional,overwriteOk:s.bool.optional,apiCheck:d.optional,apiCheckInstance:c.optional,apiCheckFunction:m.optional,apiCheckOptions:s.object.optional}).strict,h=s.objectOf(s.oneOfType([u,s.shape({expression:u,message:u.optional}).strict])),v=s.oneOfType([s.string,s.object]),g=s.shape({preWrapper:s.arrayOf(s.func).nullable.optional,postWrapper:s.arrayOf(s.func).nullable.optional}).strict.nullable,b=s.objectOf(s.oneOfType([u,s.shape({expression:u,message:u.optional}).strict])),O={$$hashKey:s.any.optional,type:s.shape.ifNot(["template","templateUrl"],s.string).optional,template:s.shape.ifNot(["type","templateUrl"],s.oneOfType([s.string,s.func])).optional,templateUrl:s.shape.ifNot(["type","template"],s.oneOfType([s.string,s.func])).optional,key:s.oneOfType([s.string,s.number]).optional,model:v.optional,originalModel:v.optional,className:s.string.optional,id:s.string.optional,name:s.string.optional,expressionProperties:h.optional,extras:s.shape({validateOnModelChange:s.bool.optional,skipNgModelAttrsManipulator:s.oneOfType([s.string,s.bool]).optional}).strict.optional,data:s.object.optional,templateOptions:s.object.optional,wrapper:p.optional,modelOptions:s.shape({updateOn:s.string.optional,debounce:s.oneOfType([s.objectOf(s.number),s.number]).optional,allowInvalid:s.bool.optional,getterSetter:s.bool.optional,timezone:s.string.optional}).optional,watcher:s.typeOrArrayOf(s.shape({expression:u.optional,listener:u})).optional,validators:b.optional,asyncValidators:b.optional,parsers:s.arrayOf(u).optional,formatters:s.arrayOf(u).optional,noFormControl:s.bool.optional,hide:s.bool.optional,hideExpression:u.optional,ngModelElAttrs:s.objectOf(s.string).optional,ngModelAttrs:s.objectOf(s.shape({statement:s.shape.ifNot(["value","attribute","bound","boolean"],s.any).optional,value:s.shape.ifNot("statement",s.any).optional,attribute:s.shape.ifNot("statement",s.any).optional,bound:s.shape.ifNot("statement",s.any).optional,"boolean":s.shape.ifNot("statement",s.any).optional}).strict).optional,elementAttributes:s.objectOf(s.string).optional,optionsTypes:s.typeOrArrayOf(s.string).optional,link:s.func.optional,controller:s.oneOfType([s.string,s.func,s.array]).optional,validation:s.shape({show:s.bool.nullable.optional,messages:s.objectOf(u).optional,errorExistsAndShouldBeVisible:s.bool.optional}).optional,formControl:s.typeOrArrayOf(s.object).optional,value:s.func.optional,runExpressions:s.func.optional,templateManipulators:g.optional,resetModel:s.func.optional,updateInitialValue:s.func.optional,initialValue:s.any.optional,defaultValue:s.any.optional},x=s.shape(O).strict,E=s.shape({formState:s.object.optional,resetModel:s.func.optional,updateInitialValue:s.func.optional,removeChromeAutoComplete:s.bool.optional,templateManipulators:g.optional,wrapper:p.optional,fieldTransform:s.func.optional,data:s.object.optional}).strict,$=s.shape({$$hashKey:s.any.optional,key:s.oneOfType([s.string,s.number]).optional,fieldGroup:s.arrayOf(s.oneOfType([x,s.object])),className:s.string.optional,options:E.optional,hide:s.bool.optional,hideExpression:u.optional,data:s.object.optional,model:v.optional,form:s.object.optional,elementAttributes:s.objectOf(s.string).optional}).strict,k=a["default"].copy(O);k.key=s.string.optional;var w=s.shape({name:s.string,template:s.shape.ifNot("templateUrl",s.oneOfType([s.string,s.func])).optional,templateUrl:s.shape.ifNot("template",s.oneOfType([s.string,s.func])).optional,controller:s.oneOfType([s.func,s.string,s.array]).optional,link:s.func.optional,defaultOptions:s.oneOfType([s.func,s.shape(k)]).optional,"extends":s.string.optional,wrapper:p.optional,data:s.object.optional,apiCheck:d.optional,apiCheckInstance:c.optional,apiCheckFunction:m.optional,apiCheckOptions:s.object.optional,overwriteOk:s.bool.optional}).strict;a["default"].extend(s,{formlyTypeOptions:w,formlyFieldOptions:x,formlyExpression:u,formlyWrapperType:y,fieldGroup:$,formOptionsApi:E}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t,n){function o(e){if(!l["default"].isArray(e)){if(l["default"].isObject(e))return i(e),e["extends"]&&a(e),M[e.name]=e,M[e.name];throw T("You must provide an object or array for setType. You provided: "+JSON.stringify(arguments))}var t=function(){var t=[];return l["default"].forEach(e,function(e){t.push(o(e))}),{v:t}}();return"object"==typeof t?t.v:void 0}function i(e){n["throw"](n.formlyTypeOptions,e,{prefix:"formlyConfig.setType",url:"settype-validation-failed"}),e.overwriteOk?e.overwriteOk=void 0:O(e.name,M,e,"types")}function a(e){var t=c(e["extends"],!0,e);u(e,t),p(e,t),d(e,t),s["default"].reverseDeepMerge(e,t),f(e,t)}function f(e,t){e.template&&t.templateUrl?delete e.templateUrl:e.templateUrl&&t.template&&delete e.template}function u(e,t){var n=t.controller;if(l["default"].isDefined(n)){var o=e.controller;l["default"].isDefined(o)?(e.controller=function(e,t){t(n,{$scope:e}),t(o,{$scope:e})},e.controller.$inject=["$scope","$controller"]):e.controller=n}}function p(e,t){var n=t.link;if(l["default"].isDefined(n)){var o=e.link;l["default"].isDefined(o)?e.link=function(){n.apply(void 0,arguments),o.apply(void 0,arguments)}:e.link=n}}function d(e,t){var n=t.defaultOptions;if(l["default"].isDefined(n)){var o=e.defaultOptions,r=l["default"].isFunction(o),i=l["default"].isFunction(n);i?e.defaultOptions=function(e,t){var i=n(e,t),a={};s["default"].reverseDeepMerge(a,e,i);var l=o;return r&&(l=l(a,t)),s["default"].reverseDeepMerge(i,l),i}:r&&(e.defaultOptions=function(e,t){var r={};return s["default"].reverseDeepMerge(r,e,n),o(r,t)})}}function c(e,t,n){if(!e)return void 0;var o=M[e];if(o||t!==!0)return o;throw T('There is no type by the name of "'+e+'": '+JSON.stringify(n))}function m(e){var t=[],n=e;for(l["default"].isString(n)&&(n=c(e)),e=n["extends"];e;)n=c(e),t.push(n),e=n["extends"];return t}function y(e,t){for(var n=!0;n;){var o=e,r=t;if(n=!1,l["default"].isArray(o))return o.map(function(e){return y(e)});if(l["default"].isObject(o))return o.types=h(o),o.name=v(o,r),g(o),C[o.name]=o,o;l["default"].isString(o)&&(e={template:o,name:r},t=void 0,n=!0)}}function h(e){return l["default"].isString(e.types)?[e.types]:l["default"].isDefined(e.types)?e.types:[]}function v(e,t){return e.name||t||e.types.join(" ")||j}function g(t){e.checkWrapper(t),t.template&&e.checkWrapperTemplate(t.template,t),t.overwriteOk?delete t.overwriteOk:O(t.name,C,t,"templateWrappers"),b(t)}function b(e){var t=!l["default"].isArray(e.types)||!e.types.every(l["default"].isString);if(t)throw T("Attempted to create a template wrapper with types that is not a string or an array of strings")}function O(e,t,n,o){t.hasOwnProperty(e)&&w("overwriting-types-or-wrappers",["Attempting to overwrite "+e+" on "+o+" which is currently",JSON.stringify(t[e])+" with "+JSON.stringify(n),'To supress this warning, specify the property "overwriteOk: true"'].join(" "))}function x(e){return C[e||j]}function E(e){var t=[];for(var n in C)C.hasOwnProperty(n)&&C[n].types&&-1!==C[n].types.indexOf(e)&&t.push(C[n]);return t}function $(e){var t=C[e];return delete C[e],t}function k(e){var t=E(e);return t?l["default"].isArray(t)?(t.forEach(function(e){return $(e.name)}),t):$(t.name):void 0}function w(){if(!_.disableWarnings&&console.warn){var e=Array.prototype.slice.call(arguments),n=e.shift();e.unshift("Formly Warning:"),e.push(""+t+n),console.warn.apply(console,r(e))}}var A=this,M={},C={},j="default",_=this,T=e.getFormlyError;l["default"].extend(this,{setType:o,getType:c,getTypeHeritage:m,setWrapper:y,getWrapper:x,getWrapperByType:E,removeWrapperByName:$,removeWrappersForType:k,disableWarnings:!1,extras:{disableNgModelAttrsManipulator:!1,ngModelAttrsManipulatorPreferUnbound:!1,removeChromeAutoComplete:!1,defaultHideDirective:"ng-if",getFieldId:null,explicitAsync:!1},templateManipulators:{preWrapper:[],postWrapper:[]},$get:function(){return A}})}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),l=o(a),f=n(2),s=o(f);t["default"]=i,i.$inject=["formlyUsabilityProvider","formlyErrorAndWarningsUrlPrefix","formlyApiCheck"],e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function n(e,t,n){return arguments.length<3&&(n=t,t=e,e=null),new Error(r(e,t)+(" Field definition: "+a["default"].toJson(n)))}function o(e,t){return t||(t=e,e=null),new Error(r(e,t))}function r(e,n){var o="";return null!==e&&(o=""+t+e),"Formly Error: "+n+". "+o}function i(t){e["throw"](e.formlyWrapperType,t,{prefix:"formlyConfig.setWrapper",urlSuffix:"setwrapper-validation-failed"})}function l(e,t){var n="<formly-transclude></formly-transclude>";if(-1===e.indexOf(n))throw o('Template wrapper templates must use "'+n+'" somewhere in them. This one does not have "<formly-transclude></formly-transclude>" in it: '+e+"\nAdditional information: "+JSON.stringify(t)); | ||
}var f=this;a["default"].extend(this,{getFormlyError:o,getFieldError:n,checkWrapper:i,checkWrapperTemplate:l,getErrorMessage:r,$get:function(){return f}})}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=o(i);t["default"]=r,r.$inject=["formlyApiCheck","formlyErrorAndWarningsUrlPrefix"],e.exports=t["default"]},function(e,t){"use strict";function n(){function e(e,t,r,i,a){o.messages[e]=n(t,r,i,a)}function t(e,t){o.messages[e]=function(){return t}}function n(e,t,n,o){return function(r,i,a){return a.options.templateOptions[e]?t+" "+a.options.templateOptions[e]+" "+n:o}}var o={addTemplateOptionValueMessage:e,addStringMessage:t,messages:{}};return o}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){e&&e.get&&!function(){var t=e.get(0),n=t.createElement("div");n.innerHTML="<!--[if lt IE 9]><i></i><![endif]-->";var o=1===n.getElementsByTagName("i").length;if(o){var r=["formly-field","formly-form","formly-custom-validation","formly-focus","formly-transpose"];a["default"].forEach(r,function(e){t.createElement(e)})}}()}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=o(i);t["default"]=r,r.$inject=["$document"],e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){function n(e,n,r){function i(){(a["default"].isDefined(n.validators)||a["default"].isDefined(n.validation.messages))&&u(g,"formly-custom-validation","")}function l(){d(n.key)&&p(g,"ng-model","model."+n.key)}function c(){a["default"].isDefined(n.modelOptions)&&(u(g,"ng-model-options","options.modelOptions"),n.modelOptions.getterSetter&&p(g,"ng-model","options.value"))}function m(){if(n.templateOptions||n.expressionProperties){var e=n.templateOptions||{},o=n.expressionProperties||{},r=f();a["default"].extend(r,n.ngModelAttrs),a["default"].forEach(r,function(r,i){var l=void 0,f=void 0,p="options.templateOptions['"+i+"']",d=e[i],c=s(o,i),m=a["default"].isDefined(d),y=a["default"].isDefined(c);if(r.value)f=r.value,l=i;else if(r.statement&&m)if(f=r.statement,a["default"].isString(e[i]))l="$eval("+p+")";else{if(!a["default"].isFunction(e[i]))throw new Error("options.templateOptions."+i+" must be a string or function: "+JSON.stringify(n));l=p+"(model[options.key], options, this, $event)"}else r.bound&&y?(f=r.bound,l=p):(r.attribute||r["boolean"])&&y?(f=r.attribute||r["boolean"],l=""+t.startSymbol()+p+t.endSymbol()):r.attribute&&m?(f=r.attribute,l=d):r["boolean"]?m&&!y&&d&&(f=r["boolean"],l=!0):r.bound&&m&&(f=r.bound,l=p);a["default"].isDefined(f)&&a["default"].isDefined(l)&&u(g,f,l)})}}function y(){a["default"].forEach(n.ngModelElAttrs,function(e,t){p(g,t,e)})}var h=document.createElement("div"),v=n.extras&&n.extras.skipNgModelAttrsManipulator;if(v===!0)return e;h.innerHTML=e;var g=o(h,v);return g&&g.length?(u(g,"id",r.id),u(g,"name",r.name||r.id),i(),l(),c(),m(),y(),h.innerHTML):e}function o(e,t){var n=a["default"].isString(t)?":not("+t+")":"",o=":not([formly-skip-ng-model-attrs-manipulator])",i="[ng-model]"+n+o+", [data-ng-model]"+n+o;try{return e.querySelectorAll(i)}catch(l){return r(e,t)}}function r(e,t){var n=e.querySelectorAll("[ng-model], [data-ng-model]"),o=[];o.item=function(e){return this[e]};for(var r=0;r<n.length;r++){var l=n[r];l.hasAttribute("formly-skip-ng-model-attrs-manipulator")||a["default"].isString(t)&&i(l,t)||o.push(l)}return o}function i(e,t){var n=document.createElement("div");return n.innerHTML=e.outerHTML,n.querySelector(t)}function f(){var t={focus:{attribute:"formly-focus"}},n=[],o=["required","disabled"],r=["pattern","minlength"],i=["change","keydown","keyup","keypress","click","focus","blur"],l=["placeholder","min","max","tabindex","type"];return e.extras.ngModelAttrsManipulatorPreferUnbound?r.push("maxlength"):n.push("maxlength"),a["default"].forEach(n,function(e){t[e]={bound:"ng-"+e}}),a["default"].forEach(o,function(e){t[e]={"boolean":e,bound:"ng-"+e}}),a["default"].forEach(r,function(e){t[e]={attribute:e,bound:"ng-"+e}}),a["default"].forEach(i,function(e){var n="on"+e.substr(0,1).toUpperCase()+e.substr(1);t[n]={statement:"ng-"+e}}),a["default"].forEach(l,function(e){t[e]={attribute:e}}),t}function s(e,t){return e["templateOptions."+t]||e["templateOptions['"+t+"']"]||e['templateOptions["'+t+'"]']}function u(e,t,n){a["default"].forEach(e,function(e){e.getAttribute(t)||e.setAttribute(t,n)})}function p(e,t,n){a["default"].forEach(e,function(e){e.setAttribute(t,n)})}function d(e){return l.contains(e,".")||l.contains(e,"[")&&l.contains(e,"]")}e.extras.disableNgModelAttrsManipulator||e.templateManipulators.preWrapper.push(n)}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=o(i),l=n(2);t["default"]=r,r.$inject=["formlyConfig","$interpolate"],e.exports=t["default"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(){return a["default"]}Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),a=o(i);t["default"]=r,e.exports=t["default"]},function(e,t){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t,o){return function(){if(!e.disableWarnings){var r=Array.prototype.slice.call(arguments),i=r.shift();r.unshift("Formly Warning:"),r.push(""+t+i),o.warn.apply(o,n(r))}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o,o.$inject=["formlyConfig","formlyErrorAndWarningsUrlPrefix","$log"],e.exports=t["default"]},function(e,n){e.exports=t}])}); | ||
//# sourceMappingURL=formly.min.js.map |
{ | ||
"name": "angular-formly", | ||
"version": "6.26.9", | ||
"version": "7.0.0", | ||
"author": "Astrism <astrisms@gmail.com>", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -5,3 +5,3 @@ import angular from 'angular-fix'; | ||
// @ngInject | ||
function formlyCustomValidation(formlyConfig, formlyUtil, $q, formlyWarn) { | ||
function formlyCustomValidation(formlyUtil) { | ||
return { | ||
@@ -12,3 +12,2 @@ restrict: 'A', | ||
const opts = scope.options; | ||
const warnedValidators = []; | ||
opts.validation.messages = opts.validation.messages || {}; | ||
@@ -46,27 +45,6 @@ angular.forEach(opts.validation.messages, (message, key) => { | ||
function setupWithValidators(validator, name, isAsync) { | ||
const isPossiblyAsync = !angular.isString(validator); | ||
let validatorCollection = (isPossiblyAsync || isAsync) ? '$asyncValidators' : '$validators'; | ||
const validatorCollection = isAsync ? '$asyncValidators' : '$validators'; | ||
// UPDATE IN 7.0.0 | ||
// this is temporary until we can have a breaking change. Allow people to get the wins of the explicitAsync api | ||
if (formlyConfig.extras.explicitAsync && !isAsync) { | ||
validatorCollection = '$validators'; | ||
} | ||
ctrl[validatorCollection][name] = function evalValidity(modelValue, viewValue) { | ||
const value = formlyUtil.formlyEval(scope, validator, modelValue, viewValue); | ||
// UPDATE IN 7.0.0 | ||
// In the next breaking change, this code should simply return the value | ||
if (isAsync) { | ||
return value; | ||
} else if (isPossiblyAsync && !formlyConfig.extras.explicitAsync) { | ||
if (isPromiseLike(value)) { | ||
logAsyncValidatorsDeprecationNotice(validator, opts); | ||
return value; | ||
} else { | ||
return value ? $q.when(value) : $q.reject(value); | ||
} | ||
} else { | ||
return value; | ||
} | ||
return formlyUtil.formlyEval(scope, validator, modelValue, viewValue); | ||
}; | ||
@@ -79,9 +57,3 @@ } | ||
const isValid = formlyUtil.formlyEval(scope, validator, ctrl.$modelValue, viewValue); | ||
// UPDATE IN 7.0.0 | ||
// In the next breaking change, rather than checking for isPromiseLike, it should just check for isAsync. | ||
if (isAsync || isPromiseLike(isValid)) { | ||
if (!isAsync) { | ||
logAsyncValidatorsDeprecationNotice(validator, opts); | ||
} | ||
if (isAsync) { | ||
ctrl.$pending = ctrl.$pending || {}; | ||
@@ -112,22 +84,4 @@ ctrl.$pending[name] = true; | ||
} | ||
function logAsyncValidatorsDeprecationNotice(validator, options) { | ||
if (warnedValidators.indexOf(validator) !== -1) { | ||
// we've warned about this one before. No spam necessary... | ||
return; | ||
} | ||
warnedValidators.push(validator); | ||
formlyWarn( | ||
'validators-returning-promises-should-use-asyncvalidators', | ||
'Validators returning promises should use asyncValidators instead of validators.', | ||
options | ||
); | ||
} | ||
} | ||
}; | ||
function isPromiseLike(obj) { | ||
return obj && angular.isFunction(obj.then); | ||
} | ||
} |
@@ -33,33 +33,2 @@ /* eslint no-unused-vars:0, max-len:0 */ | ||
)); | ||
describe(`validators that are functions placement`, () => { | ||
it(`should be placed in $asyncValidators because it can return a promise`, () => { | ||
scope.options.validators.isHello = viewValue => viewValue === 'hello'; | ||
$compile( | ||
`<form name="myForm"><input ng-model="input" name="field" formly-custom-validation /></form>` | ||
)(scope); | ||
scope.$digest(); | ||
const field = scope.myForm.field; | ||
expect(field.$validators.isHello).to.not.exist; | ||
expect(field.$asyncValidators.isHello).to.exist; | ||
}); | ||
it(`should be placed in $validators if formlyConfig.extras.explicitAsync`, () => { | ||
formlyConfig.extras.explicitAsync = true; | ||
scope.options.validators.isHello = viewValue => viewValue === 'hello'; | ||
$compile( | ||
`<form name="myForm"><input ng-model="input" name="field" formly-custom-validation /></form>` | ||
)(scope); | ||
scope.$digest(); | ||
const field = scope.myForm.field; | ||
expect(field.$validators.isHello).to.exist; | ||
expect(field.$asyncValidators.isHello).to.not.exist; | ||
}); | ||
it(`should validate properly when explicitAsync is true`, () => { | ||
formlyConfig.extras.explicitAsync = true; | ||
const template = `<form name="myForm"><input ng-model="input" name="field" formly-custom-validation /></form>`; | ||
doValidation(template, 'hello', false, viewValue => viewValue !== 'hello', false); | ||
}); | ||
}); | ||
}); | ||
@@ -104,14 +73,2 @@ | ||
}); | ||
it(`should warn if it's a function that returns a promise for a regular validator (should use asyncValidators instead)`, () => { | ||
const logArgs = [ | ||
'Formly Warning:', | ||
'Validators returning promises should use asyncValidators instead of validators.', | ||
scope.options, | ||
/validators-returning-promises-should-use-asyncvalidators/ | ||
]; | ||
shouldWarnWithLog($log, logArgs, () => { | ||
validate(() => $q.when(), true); | ||
}); | ||
}); | ||
}); | ||
@@ -118,0 +75,0 @@ |
@@ -567,3 +567,2 @@ import angular from 'angular-fix'; | ||
formlyUsability.checkWrapper(aWrapper, options); | ||
aWrapper.validateOptions && aWrapper.validateOptions(options); | ||
runApiCheck(aWrapper, options); | ||
@@ -643,5 +642,2 @@ }); | ||
if (type) { | ||
if (type.validateOptions) { | ||
type.validateOptions(options); | ||
} | ||
runApiCheck(type, options, true); | ||
@@ -684,22 +680,12 @@ } | ||
const fn = apiCheckFunction || 'warn'; | ||
if (angular.isFunction(apiCheck)) { | ||
// this is the new API | ||
const checkerObjects = apiCheck(instance); | ||
angular.forEach(checkerObjects, (shape, name) => { | ||
const checker = instance.shape(shape); | ||
const checkOptions = angular.extend({ | ||
prefix: `formly-field type ${options.type} for property ${name}`, | ||
url: formlyApiCheck.config.output.docsBaseUrl + 'formly-field-type-apicheck-failed' | ||
}, apiCheckOptions); | ||
instance[fn](checker, options[name], checkOptions); | ||
}); | ||
} else { | ||
// TODO this is the deprecated API. Remove this in a breaking change. | ||
const checker = instance.shape(apiCheck); | ||
const checkOptions = apiCheckOptions || { | ||
prefix: `formly-field type ${options.type}`, | ||
// this is the new API | ||
const checkerObjects = apiCheck(instance); | ||
angular.forEach(checkerObjects, (shape, name) => { | ||
const checker = instance.shape(shape); | ||
const checkOptions = angular.extend({ | ||
prefix: `formly-field type ${options.type} for property ${name}`, | ||
url: formlyApiCheck.config.output.docsBaseUrl + 'formly-field-type-apicheck-failed' | ||
}; | ||
instance[fn](checker, options, checkOptions); | ||
} | ||
}, apiCheckOptions); | ||
instance[fn](checker, options[name], checkOptions); | ||
}); | ||
} | ||
@@ -706,0 +692,0 @@ |
@@ -105,3 +105,2 @@ /* eslint no-shadow:0 */ | ||
describe('api check', () => { | ||
let validateOptions; | ||
beforeEach(() => { | ||
@@ -111,6 +110,4 @@ /* eslint no-console:0 */ | ||
console.warn = () => {}; | ||
validateOptions = sinon.spy(); | ||
formlyConfig.setType({ | ||
name: 'text', template: `<input name="{{id}}" ng-model="model[options.key]" />`, | ||
validateOptions | ||
name: 'text', template: `<input name="{{id}}" ng-model="model[options.key]" />` | ||
}); | ||
@@ -132,9 +129,2 @@ scope.model = {}; | ||
}); | ||
it(`should invoke the validateOptions property of the type`, () => { | ||
const field = {type: 'text'}; | ||
scope.fields = [field]; | ||
compileAndDigest(); | ||
expect(validateOptions).to.have.been.calledWith(field); | ||
}); | ||
}); | ||
@@ -190,3 +180,3 @@ | ||
myChange: { | ||
expression: 'ng-change' | ||
statement: 'ng-change' | ||
} | ||
@@ -639,24 +629,2 @@ }, | ||
it(`should work with the old api`, () => { | ||
shouldWarn( | ||
/deprecated/, | ||
() => { | ||
formlyConfig.setType({ | ||
name: 'someOtherType', | ||
template: '<label>{{to.label}}</label>', | ||
apiCheck: { | ||
templateOptions: apiCheck.shape({ | ||
label: apiCheck.string | ||
}) | ||
} | ||
}); | ||
} | ||
); | ||
scope.fields = [{type: 'someOtherType'}]; | ||
shouldWarn( | ||
/angular-formly: formly-field type someOtherType apiCheck failed.*?Required `label`.*?templateOptions.*?`String`/, | ||
compileAndDigest | ||
); | ||
}); | ||
it(`should not warn if everything's fine`, () => { | ||
@@ -663,0 +631,0 @@ scope.fields = [ |
@@ -33,13 +33,6 @@ import angular from 'angular-fix'; | ||
// TODO in 7.0.0 .nullable is available on all checkers | ||
function nullable(checker) { | ||
return apiCheck.oneOfType([ | ||
apiCheck.oneOf([null]), checker | ||
]); | ||
} | ||
const formlyExpression = apiCheck.oneOfType([apiCheck.string, apiCheck.func]); | ||
const specifyWrapperType = nullable(apiCheck.typeOrArrayOf(apiCheck.string)); | ||
const specifyWrapperType = apiCheck.typeOrArrayOf(apiCheck.string).nullable; | ||
const apiCheckProperty = apiCheck.oneOfType([apiCheck.func, apiCheck.objectOf(apiCheck.func)]); | ||
const apiCheckProperty = apiCheck.func; | ||
@@ -60,3 +53,2 @@ const apiCheckInstanceProperty = apiCheck.shape.onlyIf('apiCheck', apiCheck.func.withProperties({ | ||
overwriteOk: apiCheck.bool.optional, | ||
validateOptions: apiCheck.func.optional, | ||
apiCheck: apiCheckProperty.optional, | ||
@@ -78,6 +70,6 @@ apiCheckInstance: apiCheckInstanceProperty.optional, | ||
const templateManipulators = nullable(apiCheck.shape({ | ||
preWrapper: nullable(apiCheck.arrayOf(apiCheck.func)).optional, | ||
postWrapper: nullable(apiCheck.arrayOf(apiCheck.func)).optional | ||
}).strict); | ||
const templateManipulators = apiCheck.shape({ | ||
preWrapper: apiCheck.arrayOf(apiCheck.func).nullable.optional, | ||
postWrapper: apiCheck.arrayOf(apiCheck.func).nullable.optional | ||
}).strict.nullable; | ||
@@ -142,7 +134,7 @@ const validatorChecker = apiCheck.objectOf(apiCheck.oneOfType([ | ||
ngModelAttrs: apiCheck.objectOf(apiCheck.shape({ | ||
expression: apiCheck.shape.ifNot(['value', 'attribute', 'bound', 'boolean'], apiCheck.any).optional, | ||
value: apiCheck.shape.ifNot('expression', apiCheck.any).optional, | ||
attribute: apiCheck.shape.ifNot('expression', apiCheck.any).optional, | ||
bound: apiCheck.shape.ifNot('expression', apiCheck.any).optional, | ||
boolean: apiCheck.shape.ifNot('expression', apiCheck.any).optional | ||
statement: apiCheck.shape.ifNot(['value', 'attribute', 'bound', 'boolean'], apiCheck.any).optional, | ||
value: apiCheck.shape.ifNot('statement', apiCheck.any).optional, | ||
attribute: apiCheck.shape.ifNot('statement', apiCheck.any).optional, | ||
bound: apiCheck.shape.ifNot('statement', apiCheck.any).optional, | ||
boolean: apiCheck.shape.ifNot('statement', apiCheck.any).optional | ||
}).strict).optional, | ||
@@ -156,3 +148,3 @@ elementAttributes: apiCheck.objectOf(apiCheck.string).optional, | ||
validation: apiCheck.shape({ | ||
show: nullable(apiCheck.bool).optional, | ||
show: apiCheck.bool.nullable.optional, | ||
messages: apiCheck.objectOf(formlyExpression).optional, | ||
@@ -219,3 +211,2 @@ errorExistsAndShouldBeVisible: apiCheck.bool.optional | ||
data: apiCheck.object.optional, | ||
validateOptions: apiCheck.func.optional, | ||
apiCheck: apiCheckProperty.optional, | ||
@@ -222,0 +213,0 @@ apiCheckInstance: apiCheckInstanceProperty.optional, |
@@ -64,3 +64,2 @@ import angular from 'angular-fix'; | ||
}); | ||
checkDeprecatedOptions(options); | ||
if (!options.overwriteOk) { | ||
@@ -77,3 +76,2 @@ checkOverwrite(options.name, typeMap, options, 'types'); | ||
extendTypeLinkFunction(options, extendsType); | ||
extendTypeValidateOptionsFunction(options, extendsType); | ||
extendTypeDefaultOptions(options, extendsType); | ||
@@ -125,27 +123,2 @@ utils.reverseDeepMerge(options, extendsType); | ||
function extendTypeValidateOptionsFunction(options, extendsType) { | ||
const extendsFn = extendsType.validateOptions; | ||
if (!angular.isDefined(extendsFn)) { | ||
return; | ||
} | ||
const optionsFn = options.validateOptions; | ||
const originalDefaultOptions = options.defaultOptions; | ||
if (angular.isDefined(optionsFn)) { | ||
options.validateOptions = function(opts) { | ||
optionsFn(opts); | ||
const mergedOptions = angular.copy(opts); | ||
let defaultOptions = originalDefaultOptions; | ||
if (defaultOptions) { | ||
if (angular.isFunction(defaultOptions)) { | ||
defaultOptions = defaultOptions(mergedOptions); | ||
} | ||
utils.reverseDeepMerge(mergedOptions, defaultOptions); | ||
} | ||
extendsFn(mergedOptions); | ||
}; | ||
} else { | ||
options.validateOptions = extendsFn; | ||
} | ||
} | ||
function extendTypeDefaultOptions(options, extendsType) { | ||
@@ -247,3 +220,2 @@ const extendsDO = extendsType.defaultOptions; | ||
} | ||
checkDeprecatedOptions(options); | ||
if (!options.overwriteOk) { | ||
@@ -274,21 +246,2 @@ checkOverwrite(options.name, templateWrappersMap, options, 'templateWrappers'); | ||
function checkDeprecatedOptions(options) { | ||
if (options.apiCheck && !angular.isFunction(options.apiCheck)) { | ||
warn( | ||
'apicheck-as-an-object-deprecated', | ||
'apiCheck as an object has been deprecated.', | ||
`Attempted for type: ${options.name}`, | ||
options | ||
); | ||
} | ||
if (options.validateOptions) { | ||
warn( | ||
'validateoptions-deprecated', | ||
'the `validateOptions` property has been deprecated.', | ||
`Attempted for type: ${options.name}`, | ||
options | ||
); | ||
} | ||
} | ||
function getWrapper(name) { | ||
@@ -295,0 +248,0 @@ return templateWrappersMap[name || defaultWrapperName]; |
@@ -427,81 +427,2 @@ /* eslint max-len:0 */ | ||
describe(`validateOptions functions`, () => { | ||
let options, parentFn, childFn; | ||
beforeEach(() => { | ||
options = { | ||
data: { | ||
a: 'b', | ||
c: {d: 'e'} | ||
} | ||
}; | ||
parentFn = sinon.spy(); | ||
childFn = sinon.spy(); | ||
}); | ||
it(`should give a deprecation warning when specified as part of a type`, () => { | ||
shouldWarn( | ||
/Formly Warning: the `validateOptions` property has been deprecated. Attempted for type: foobar/, | ||
function() { | ||
setterFn({ | ||
name: 'foobar', | ||
validateOptions() {} | ||
}); | ||
} | ||
); | ||
}); | ||
describe(`old functionality`, () => { | ||
let originalWarn; | ||
beforeEach(() => { | ||
originalWarn = console.warn; | ||
console.warn = () => {}; | ||
}); | ||
it(`should call the parent validateOptions function when there is no child function`, () => { | ||
setterFn([ | ||
{name, template, validateOptions: parentFn}, | ||
{name: 'type2', extends: name} | ||
]); | ||
getterFn('type2').validateOptions(options); | ||
expect(parentFn).to.have.been.calledWith(options); | ||
}); | ||
it(`should call the child validateOptions function when there is no parent function`, () => { | ||
setterFn([ | ||
{name, template}, | ||
{name: 'type2', extends: name, validateOptions: childFn} | ||
]); | ||
getterFn('type2').validateOptions(options); | ||
expect(childFn).to.have.been.calledWith(options); | ||
}); | ||
it(`should call the child validateOptions function and the parent validateOptions function when they are both present`, () => { | ||
setterFn([ | ||
{name, template, validateOptions: parentFn}, | ||
{name: 'type2', extends: name, validateOptions: childFn} | ||
]); | ||
getterFn('type2').validateOptions(options); | ||
expect(childFn).to.have.been.calledWith(options); | ||
expect(parentFn).to.have.been.calledWith(options); | ||
}); | ||
it(`should pass the result of the child's defaultOptions with the given options to the parent's validateOptions function`, () => { | ||
const defaultOptions = {data: {f: 'g'}}; | ||
const combinedOptions = {data: {a: 'b', c: {d: 'e'}, f: 'g'}}; | ||
setterFn([ | ||
{name, template, validateOptions: parentFn}, | ||
{name: 'type2', extends: name, validateOptions: childFn, defaultOptions} | ||
]); | ||
getterFn('type2').validateOptions(options); | ||
expect(childFn).to.have.been.calledWith(options); | ||
expect(parentFn).to.have.been.calledWith(combinedOptions); | ||
}); | ||
afterEach(() => { | ||
console.warn = originalWarn; | ||
}); | ||
}); | ||
}); | ||
describe(`controller functions`, () => { | ||
@@ -611,15 +532,2 @@ let parentFn, childFn, $controller, $scope; | ||
it(`should give a deprecation warning when providing apiCheck as an object rather than a function`, () => { | ||
shouldWarn( | ||
/Formly Warning: apiCheck as an object has been deprecated. Attempted for type: input/, | ||
function() { | ||
setterFn({ | ||
name, | ||
apiCheck: {}, | ||
template | ||
}); | ||
} | ||
); | ||
}); | ||
describe(`apiCheckInstance`, () => { | ||
@@ -626,0 +534,0 @@ let apiCheckInstance; |
import angular from 'angular-fix'; | ||
import {contains} from '../other/utils'; | ||
@@ -6,3 +7,3 @@ export default addFormlyNgModelAttrsManipulator; | ||
// @ngInject | ||
function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate, formlyWarn) { | ||
function addFormlyNgModelAttrsManipulator(formlyConfig, $interpolate) { | ||
if (formlyConfig.extras.disableNgModelAttrsManipulator) { | ||
@@ -16,3 +17,3 @@ return; | ||
const node = document.createElement('div'); | ||
const skip = getSkip(options); | ||
const skip = options.extras && options.extras.skipNgModelAttrsManipulator; | ||
if (skip === true) { | ||
@@ -32,2 +33,3 @@ return template; | ||
addValidation(); | ||
alterNgModelAttr(); | ||
addModelOptions(); | ||
@@ -47,2 +49,8 @@ addTemplateOptionsAttrs(); | ||
function alterNgModelAttr() { | ||
if (isPropertyAccessor(options.key)) { | ||
addRegardlessOfPresence(modelNodes, 'ng-model', 'model.' + options.key); | ||
} | ||
} | ||
function addModelOptions() { | ||
@@ -52,5 +60,3 @@ if (angular.isDefined(options.modelOptions)) { | ||
if (options.modelOptions.getterSetter) { | ||
angular.forEach(modelNodes, modelNode => { | ||
modelNode.setAttribute('ng-model', 'options.value'); | ||
}); | ||
addRegardlessOfPresence(modelNodes, 'ng-model', 'options.value'); | ||
} | ||
@@ -87,4 +93,4 @@ } | ||
attrVal = name; | ||
} else if (val.expression && inTo) { | ||
attrName = val.expression; | ||
} else if (val.statement && inTo) { | ||
attrName = val.statement; | ||
if (angular.isString(to[name])) { | ||
@@ -130,3 +136,3 @@ attrVal = `$eval(${ref})`; | ||
angular.forEach(options.ngModelElAttrs, (val, name) => { | ||
addIfNotPresent(modelNodes, name, val); | ||
addRegardlessOfPresence(modelNodes, name, val); | ||
}); | ||
@@ -176,18 +182,2 @@ } | ||
function getSkip(options) { | ||
// UPDATE IN 7.0.0 | ||
let skip = options.extras && options.extras.skipNgModelAttrsManipulator; | ||
if (!angular.isDefined(skip)) { | ||
skip = options.data && options.data.skipNgModelAttrsManipulator; | ||
if (angular.isDefined(skip)) { | ||
formlyWarn( | ||
'skipngmodelattrsmanipulator-moved', | ||
'The skipNgModelAttrsManipulator property has been moved from the `data` property to the `extras` property', | ||
options | ||
); | ||
} | ||
} | ||
return skip; | ||
} | ||
function getBuiltInAttributes() { | ||
@@ -202,3 +192,3 @@ const ngModelAttributes = { | ||
const bothAttributeAndBound = ['pattern', 'minlength']; | ||
const expressionOnly = ['change', 'keydown', 'keyup', 'keypress', 'click', 'focus', 'blur']; | ||
const statementOnly = ['change', 'keydown', 'keyup', 'keypress', 'click', 'focus', 'blur']; | ||
const attributeOnly = ['placeholder', 'min', 'max', 'tabindex', 'type']; | ||
@@ -223,5 +213,5 @@ if (formlyConfig.extras.ngModelAttrsManipulatorPreferUnbound) { | ||
angular.forEach(expressionOnly, item => { | ||
angular.forEach(statementOnly, item => { | ||
const propName = 'on' + item.substr(0, 1).toUpperCase() + item.substr(1); | ||
ngModelAttributes[propName] = {expression: 'ng-' + item}; | ||
ngModelAttributes[propName] = {statement: 'ng-' + item}; | ||
}); | ||
@@ -248,2 +238,12 @@ | ||
} | ||
function addRegardlessOfPresence(nodes, attr, val) { | ||
angular.forEach(nodes, node => { | ||
node.setAttribute(attr, val); | ||
}); | ||
} | ||
function isPropertyAccessor(key) { | ||
return contains(key, '.') || (contains(key, '[') && contains(key, ']')); | ||
} | ||
} |
@@ -5,14 +5,9 @@ /* eslint max-len:0 */ | ||
import testUtils from '../test.utils.js'; | ||
const {shouldWarnWithLog} = testUtils; | ||
describe('formlyNgModelAttrsManipulator', () => { | ||
beforeEach(window.module('formly')); | ||
let formlyConfig, manipulator, scope, field, result, resultEl, resultNode, $log; | ||
let formlyConfig, manipulator, scope, field, result, resultEl, resultNode; | ||
const template = '<input ng-model="model[options.key]" />'; | ||
beforeEach(inject((_formlyConfig_, $rootScope, _$log_) => { | ||
$log = _$log_; | ||
beforeEach(inject((_formlyConfig_, $rootScope) => { | ||
formlyConfig = _formlyConfig_; | ||
@@ -31,14 +26,3 @@ manipulator = formlyConfig.templateManipulators.preWrapper[0]; | ||
describe(`skipping`, () => { | ||
it(`should give a deprecation warning when using the data property`, () => { | ||
field.data.skipNgModelAttrsManipulator = true; | ||
const logArgs = [ | ||
'Formly Warning:', | ||
'The skipNgModelAttrsManipulator property has been moved from the `data` property to the `extras` property', | ||
field, | ||
/skipngmodelattrsmanipulator-moved/ | ||
]; | ||
shouldWarnWithLog($log, logArgs, manipulate); | ||
}); | ||
it(`should allow you to skip the manipulator wholesale for the field`, () => { | ||
@@ -199,3 +183,16 @@ field.extras.skipNgModelAttrsManipulator = true; | ||
describe(`selector key notation`, () => { | ||
it(`should change the ng-model when the key is a dot property accessor`, () => { | ||
field.key = 'bar.foo'; | ||
manipulate(); | ||
expect(resultEl.attr('ng-model')).to.equal('model.' + field.key); | ||
}); | ||
it(`should change the ng-model when the key is a bracket property accessor`, () => { | ||
field.key = 'bar["foo-bar"]'; | ||
manipulate(); | ||
expect(resultEl.attr('ng-model')).to.equal('model.' + field.key); | ||
}); | ||
}); | ||
describe(`formly-custom-validation`, () => { | ||
@@ -355,2 +352,10 @@ it(`shouldn't be added if there aren't validators or messages`, () => { | ||
}); | ||
it(`should override existing attributes`, () => { | ||
field.ngModelElAttrs = { | ||
'ng-model': 'formState.foo.bar' | ||
}; | ||
manipulate(); | ||
expect(resultEl.attr('ng-model')).to.equal('formState.foo.bar'); | ||
}); | ||
}); | ||
@@ -357,0 +362,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
587696
7876