@lxlib/form
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
16 lines (14 loc) • 96.6 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/platform-browser"),require("@lxlib/acl"),require("@lxlib/theme"),require("@lxlib/util"),require("rxjs"),require("rxjs/operators"),require("@angular/common"),require("@angular/forms"),require("ng-zorro-antd/auto-complete"),require("ng-zorro-antd/button"),require("ng-zorro-antd/card"),require("ng-zorro-antd/cascader"),require("ng-zorro-antd/checkbox"),require("ng-zorro-antd/date-picker"),require("ng-zorro-antd/form"),require("ng-zorro-antd/grid"),require("ng-zorro-antd/icon"),require("ng-zorro-antd/input"),require("ng-zorro-antd/input-number"),require("ng-zorro-antd/mention"),require("ng-zorro-antd/modal"),require("ng-zorro-antd/radio"),require("ng-zorro-antd/rate"),require("ng-zorro-antd/select"),require("ng-zorro-antd/slider"),require("ng-zorro-antd/switch"),require("ng-zorro-antd/tag"),require("ng-zorro-antd/time-picker"),require("ng-zorro-antd/tooltip"),require("ng-zorro-antd/transfer"),require("ng-zorro-antd/tree-select"),require("ng-zorro-antd/upload"),require("ng-zorro-antd/core/animation"),require("date-fns/format"),require("date-fns/parse")):"function"==typeof define&&define.amd?define("@lxlib/form",["exports","@angular/core","@angular/platform-browser","@lxlib/acl","@lxlib/theme","@lxlib/util","rxjs","rxjs/operators","@angular/common","@angular/forms","ng-zorro-antd/auto-complete","ng-zorro-antd/button","ng-zorro-antd/card","ng-zorro-antd/cascader","ng-zorro-antd/checkbox","ng-zorro-antd/date-picker","ng-zorro-antd/form","ng-zorro-antd/grid","ng-zorro-antd/icon","ng-zorro-antd/input","ng-zorro-antd/input-number","ng-zorro-antd/mention","ng-zorro-antd/modal","ng-zorro-antd/radio","ng-zorro-antd/rate","ng-zorro-antd/select","ng-zorro-antd/slider","ng-zorro-antd/switch","ng-zorro-antd/tag","ng-zorro-antd/time-picker","ng-zorro-antd/tooltip","ng-zorro-antd/transfer","ng-zorro-antd/tree-select","ng-zorro-antd/upload","ng-zorro-antd/core/animation","date-fns/format","date-fns/parse"],t):t(((e=e||self).lxlib=e.lxlib||{},e.lxlib.form={}),e.ng.core,e.ng.platformBrowser,e.lxlib.acl,e.lxlib.theme,e.lxlib.util,e.rxjs,e.rxjs.operators,e.ng.common,e.ng.forms,e["ng-zorro-antd/auto-complete"],e["ng-zorro-antd/button"],e["ng-zorro-antd/card"],e["ng-zorro-antd/cascader"],e["ng-zorro-antd/checkbox"],e["ng-zorro-antd/date-picker"],e["ng-zorro-antd/form"],e["ng-zorro-antd/grid"],e["ng-zorro-antd/icon"],e["ng-zorro-antd/input"],e["ng-zorro-antd/input-number"],e["ng-zorro-antd/mention"],e["ng-zorro-antd/modal"],e["ng-zorro-antd/radio"],e["ng-zorro-antd/rate"],e["ng-zorro-antd/select"],e["ng-zorro-antd/slider"],e["ng-zorro-antd/switch"],e["ng-zorro-antd/tag"],e["ng-zorro-antd/time-picker"],e["ng-zorro-antd/tooltip"],e["ng-zorro-antd/transfer"],e["ng-zorro-antd/tree-select"],e["ng-zorro-antd/upload"],e.animation,e.format,e.parse)}(this,(function(e,t,n,r,i,o,a,s,l,u,p,c,h,d,f,m,y,g,b,v,z,w,C,_,x,S,O,V,E,P,T,I,M,D,k,F,j){"use strict";F=F&&Object.prototype.hasOwnProperty.call(F,"default")?F.default:F,j=j&&Object.prototype.hasOwnProperty.call(j,"default")?j.default:j;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var N=function(e,t){return(N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function A(e,t){function n(){this.constructor=e}N(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var L=function(){return(L=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function W(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function $(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function R(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function H(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(q(arguments[t]));return e}var U=function(){function e(){this.ingoreKeywords=["type","enum"],this.liveValidate=!0,this.autocomplete=null,this.firstVisual=!1,this.onlyVisual=!1,this.errors={},this.button={submit_type:"primary",reset_type:"default"},this.uiDateStringFormat="yyyy-MM-dd HH:mm:ss",this.uiDateNumberFormat="x",this.uiTimeStringFormat="HH:mm:ss",this.uiTimeNumberFormat="x",this.uiEmailSuffixes=["qq.com","163.com","gmail.com","126.com","aliyun.com"]}return e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();var B={"date-time":{widget:"date",showTime:!0,format:"yyyy-MM-ddTHH:mm:ssZ"},date:{widget:"date",format:"yyyy-MM-dd"},"full-date":{widget:"date",format:"yyyy-MM-dd"},time:{widget:"time"},"full-time":{widget:"time"},week:{widget:"date",mode:"week",format:"yyyy-WW"},month:{widget:"date",mode:"month",format:"yyyy-MM"},uri:{widget:"upload"},email:{widget:"autocomplete",type:"email"},color:{widget:"string",type:"color"},"":{widget:"string"}};function G(e){return null==e}function X(e,t){return null==(e=o.toBoolean(e,!0))?t:e}function K(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];e.debug&&console.warn.apply(console,H(t))}function Y(e,t){if(void 0===t&&(t={}),e.hasOwnProperty("$ref")){var n=function(e,t){var n,r,i=/^#\/definitions\/(.*)$/.exec(e);if(i&&i[1]){var o=i[1].split("/"),a=t;try{for(var s=R(o),l=s.next();!l.done;l=s.next()){var u=l.value;if(u=u.replace(/~1/g,"/").replace(/~0/g,"~"),!a.hasOwnProperty(u))throw new Error("Could not find a definition for "+e+".");a=a[u]}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a}throw new Error("Could not find a definition for "+e+".")}(e.$ref,t),r=(e.$ref,function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["$ref"]));return Y(L(L({},n),r),t)}return e}function Z(e,t){if(!e.hasOwnProperty("if")||!e.hasOwnProperty("then"))return null;if(!e.if.properties)throw new Error("if: does not contain 'properties'");var n=Object.keys(e.properties),r=Object.keys(e.if.properties);J(n,r),J(n,e.then.required),e.required=e.required.concat(e.then.required);var i=e.hasOwnProperty("else");i&&(J(n,e.else.required),e.required=e.required.concat(e.else.required));var o={},a={};return r.forEach((function(t){var n=e.if.properties[t].enum;o[t]=n,i&&(a[t]=function(e){return!n.includes(e)})})),e.then.required.forEach((function(e){return t["$"+e].visibleIf=o})),i&&e.else.required.forEach((function(e){return t["$"+e].visibleIf=a})),e}function J(e,t){t.forEach((function(t){if(!e.includes(t))throw new Error("if: properties does not contain '"+t+"'")}))}function Q(e,t,n){return G(e)||!Array.isArray(e)||0===e.length?[]:("object"!=typeof e[0]&&(e=e.map((function(e){return{label:e,value:e}}))),t&&(Array.isArray(t)||(t=[t]),e.forEach((function(e){~t.indexOf(e.value)&&(e.checked=!0)}))),n&&e.forEach((function(e){return e.disabled=!0})),e)}function ee(e,t,n){return Q(o.deepCopy(e||[]),t,n)}function te(e,t,n,r){return"function"==typeof t.asyncData?t.asyncData(r).pipe(s.map((function(t){return Q(t,n,e.readOnly)}))):a.of(ee(e.enum,n,e.readOnly))}var ne=function(){function e(e,t,n,r,i,o,s){this._options=s,this._errors=null,this._valueChanges=new a.BehaviorSubject(null),this._errorsChanges=new a.BehaviorSubject(null),this._visible=!0,this._visibilityChanges=new a.BehaviorSubject(!0),this._objErrors={},this._value=null,this.schema=t,this.ui=n,this.schemaValidator=e.createValidatorFn(t,{ingoreKeywords:this.ui.ingoreKeywords,debug:n.debug}),this.formData=r||t.default,this._parent=i,this._root=i?i.root:this,this.path=o}return Object.defineProperty(e.prototype,"valueChanges",{get:function(){return this._valueChanges},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorsChanges",{get:function(){return this._errorsChanges},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this.schema.type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errors",{get:function(){return this._errors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visible",{get:function(){return this._visible},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return null===this._errors||0===this._errors.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),e.prototype.updateValueAndValidity=function(e,t,n){void 0===e&&(e=!1),void 0===t&&(t=!0),void 0===n&&(n=!0),this._updateValue(),t&&this.valueChanges.next(this.value),n&&!0===this.ui.liveValidate&&this._runValidation(),this.parent&&!e&&this.parent.updateValueAndValidity(e,t,!1)},e.prototype.searchProperty=function(e){var t=this,n=null,r=null;if("/"===e[0])r=(n=this.findRoot()).getProperty(e.substr(1));else for(;null===r&&null!==t.parent;)t=n=t.parent,r=n.getProperty(e);return r},e.prototype.findRoot=function(){for(var e=this;null!==e.parent;)e=e.parent;return e},e.prototype.isEmptyData=function(e){if(G(e))return!0;switch(this.type){case"string":return 0===(""+e).length}return!1},e.prototype._runValidation=function(){var e,t=this,n=this.isEmptyData(this._value);e=n&&this.ui._required?[{keyword:"required"}]:n?[]:this.schemaValidator(this._value)||[];var r=this.ui.validator;if("function"==typeof r){var i=r(this.value,this,this.findRoot());return i instanceof a.Observable?void i.subscribe((function(n){t.setCustomErrors(e,n),t.widget.detectChanges()})):void this.setCustomErrors(e,i)}this._errors=e,this.setErrors(this._errors)},e.prototype.setCustomErrors=function(e,t){null!=t&&t.length>0&&t.forEach((function(e){if(!e.message)throw new Error("The custom validator must contain a 'message' attribute to viewed error text");e._custom=!0})),this._errors=this.mergeErrors(e,t),this.setErrors(this._errors)},e.prototype.mergeErrors=function(e,t){return t&&(Array.isArray(t)?e=e.concat.apply(e,H(t)):e.push(t)),e},e.prototype.setErrors=function(e,t){var n=this;if(void 0===t&&(t=!0),t&&e&&!this.ui.onlyVisual){var r=this.widget&&this.widget.l.error||{};e=e.map((function(e){var t=!0===e._custom&&e.message?e.message:(n.ui.errors||{})[e.keyword]||n._options.errors[e.keyword]||r[e.keyword]||"";return t&&"function"==typeof t&&(t=t(e)),t&&(~t.indexOf("{")&&(t=t.replace(/{([\.a-z0-9]+)}/g,(function(t,n){return e.params[n]||""}))),e.message=t),e}))}this._errors=e,this._errorsChanges.next(e),this._parent&&this._parent.setParentAndPlatErrors(e,this.path)},e.prototype.setParentAndPlatErrors=function(e,t){var n=this;this._objErrors[t]=e;var r=[];Object.keys(this._objErrors).forEach((function(e){var t=n.searchProperty(e);t&&!t.visible||r.push.apply(r,H(n._objErrors[e]))})),this.setErrors(r,!1)},e.prototype.setVisible=function(e){this._visible=e,this._visibilityChanges.next(e),this.resetValue(this.value,!0)},e.prototype._bindVisibility=function(){var e=this,t=this.ui.visibleIf;if("object"==typeof t&&0===Object.keys(t).length)this.setVisible(!1);else if(void 0!==t){var n=[],r=function(e){if(t.hasOwnProperty(e)){var r=i.searchProperty(e);if(r){var o=r.valueChanges.pipe(s.map((function(n){var r=t[e];return"function"==typeof r?r(n):-1!==r.indexOf("$ANY$")?n.length>0:-1!==r.indexOf(n)}))),l=r._visibilityChanges,u=a.combineLatest([o,l]).pipe(s.map((function(e){return e[0]&&e[1]})));n.push(u)}else console.warn("Can't find property "+e+" for visibility check of "+i.path)}},i=this;for(var o in t)r(o);a.combineLatest(n).pipe(s.map((function(e){return-1!==e.indexOf(!0)})),s.distinctUntilChanged()).subscribe((function(t){return e.setVisible(t)}))}},e}();var re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.properties=null,t}return A(t,e),t.prototype.getProperty=function(e){var n=e.indexOf("/"),r=-1!==n?e.substr(0,n):e,i=this.properties[r];if(null!==i&&-1!==n&&i instanceof t){var o=e.substr(n+1);i=i.getProperty(o)}return i},t.prototype.forEachChild=function(e){for(var t in this.properties){if(this.properties.hasOwnProperty(t))e(this.properties[t],t)}},t.prototype.forEachChildRecursive=function(e){this.forEachChild((function(n){e(n),n instanceof t&&n.forEachChildRecursive(e)}))},t.prototype._bindVisibility=function(){e.prototype._bindVisibility.call(this),this._bindVisibilityRecursive()},t.prototype._bindVisibilityRecursive=function(){this.forEachChildRecursive((function(e){e._bindVisibility()}))},t.prototype.isRoot=function(){return this===this.root},t}(ne);var ie=function(e){function t(t,n,r,i,o,a,s,l){var u=e.call(this,n,r,i,o,a,s,l)||this;return u.formPropertyFactory=t,u._propertiesId=[],u.createProperties(),u}return A(t,e),Object.defineProperty(t.prototype,"propertiesId",{get:function(){return this._propertiesId},enumerable:!0,configurable:!0}),t.prototype.createProperties=function(){var e,t=this;this.properties={},this._propertiesId=[];try{e=function(e,t){if(!Array.isArray(t))return e;var n=function(e){return e.reduce((function(e,t){return e[t]=!0,e}),{})},r=function(e){return"property ["+e.join("', '")+"]"},i=n(e),o=n(t),a=t.filter((function(e){return"*"!==e&&!i[e]}));if(a.length)throw new Error("ui schema order list contains extraneous "+r(a));var s=e.filter((function(e){return!o[e]})),l=t.indexOf("*");if(-1===l){if(s.length)throw new Error("ui schema order list does not contain "+r(s));return t}if(l!==t.lastIndexOf("*"))throw new Error("ui schema order list contains more than one wildcard item");var u=H(t);return u.splice.apply(u,H([l,1],s)),u}(Object.keys(this.schema.properties),this.ui.order)}catch(e){console.error("Invalid "+(this.schema.title||"root")+" object field configuration:",e)}e.forEach((function(e){t.properties[e]=t.formPropertyFactory.createProperty(t.schema.properties[e],t.ui["$"+e],(t.formData||{})[e],t,e),t._propertiesId.push(e)}))},t.prototype.setValue=function(e,t){var n=this.properties;for(var r in e)e.hasOwnProperty(r)&&n[r]&&n[r].setValue(e[r],!0);this.updateValueAndValidity(t,!0)},t.prototype.resetValue=function(e,t){e=e||this.schema.default||{};var n=this.properties;for(var r in this.schema.properties)n[r].resetValue(e[r],!0);this.updateValueAndValidity(t,!0)},t.prototype._hasValue=function(){return null!=this.value&&!!Object.keys(this.value).length},t.prototype._updateValue=function(){var e={};this.forEachChild((function(t,n){t.visible&&t._hasValue()&&(e[n]=t.value)})),this._value=e},t}(re);var oe=function(e){function t(t,n,r,i,o,a,s,l){var u=e.call(this,n,r,i,o,a,s,l)||this;return u.formPropertyFactory=t,u.properties=[],u}return A(t,e),t.prototype.getProperty=function(e){var t=e.indexOf("/"),n=+(-1!==t?e.substr(0,t):e),r=this.properties;if(!(isNaN(n)||n>=r.length)){var i=e.substr(t+1);return r[n].getProperty(i)}},t.prototype.setValue=function(e,t){this.properties=[],this.clearErrors(),this.resetProperties(e),this.updateValueAndValidity(t,!0)},t.prototype.resetValue=function(e,t){this._value=e||this.schema.default||[],this.setValue(this._value,t)},t.prototype._hasValue=function(){return!0},t.prototype._updateValue=function(){var e=[];this.forEachChild((function(t){t.visible&&t._hasValue()&&e.push(L(L({},t.formData),t.value))})),this._value=e},t.prototype.addProperty=function(e){var t=this.formPropertyFactory.createProperty(this.schema.items,this.ui.$items,e,this);return this.properties.push(t),t},t.prototype.resetProperties=function(e){var t,n;try{for(var r=R(e),i=r.next();!i.done;i=r.next()){var o=i.value;this.addProperty(o).resetValue(o,!0)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},t.prototype.clearErrors=function(e){(e||this)._objErrors={}},t.prototype.add=function(e){var t=this.addProperty(e);return t.resetValue(e,!1),t},t.prototype.remove=function(e){var t=this,n=this.properties;this.clearErrors(),n.splice(e,1),n.forEach((function(e,n){e.path=[e.parent.path,n].join("/"),t.clearErrors(e),e instanceof ie&&e.forEachChild((function(e){e.updateValueAndValidity()}))}))},t}(re);var ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.setValue=function(e,t){this._value=e,this.updateValueAndValidity(t,!0)},t.prototype.resetValue=function(e,t){null==e&&(e=void 0!==this.schema.default?this.schema.default:this.fallbackValue()),this._value=e,this.updateValueAndValidity(t,!0),this.widget&&this.widget.reset(e)},t.prototype._hasValue=function(){return this.fallbackValue()!==this.value},t.prototype._updateValue=function(){},t}(ne);var se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.fallbackValue=function(){return null},t}(ae),le=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.fallbackValue=function(){return null},t.prototype.setValue=function(e,t){"string"==typeof e&&(e=e.length?e.indexOf(".")>-1?parseFloat(e):parseInt(e,10):void 0),this._value=e,this.updateValueAndValidity(t,!0)},t}(ae),ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.fallbackValue=function(){return null},t.prototype.setValue=function(e,t){this._value=null==e?"":e,this.updateValueAndValidity(t,!0)},t}(ae),pe=function(){function e(e,t){this.schemaValidatorFactory=e,this.options=t}return e.prototype.createProperty=function(e,t,n,r,i){void 0===r&&(r=null);var o=null,a="";if(r)switch(a+=r.path,null!==r.parent&&(a+="/"),r.type){case"object":a+=i;break;case"array":a+=r.properties.length;break;default:throw new Error("Instanciation of a FormProperty with an unknown parent type: "+r.type)}else a="/";if(e.$ref){var s=Y(e,r.root.schema.definitions);o=this.createProperty(s,t,n,r,a)}else switch(i&&-1!==r.schema.required.indexOf(i.split("/").pop())&&(t._required=!0),null==e.title&&(e.title=i),"string"!==e.type&&"number"!==e.type||e.format||t.format?t._format=t.format:"date"===t.widget?t._format="string"===e.type?this.options.uiDateStringFormat:this.options.uiDateNumberFormat:"time"===t.widget&&(t._format="string"===e.type?this.options.uiTimeStringFormat:this.options.uiTimeNumberFormat),e.type){case"integer":case"number":o=new le(this.schemaValidatorFactory,e,t,n,r,a,this.options);break;case"string":o=new ue(this.schemaValidatorFactory,e,t,n,r,a,this.options);break;case"boolean":o=new se(this.schemaValidatorFactory,e,t,n,r,a,this.options);break;case"object":o=new ie(this,this.schemaValidatorFactory,e,t,n,r,a,this.options);break;case"array":o=new oe(this,this.schemaValidatorFactory,e,t,n,r,a,this.options);break;default:throw new TypeError("Undefined type "+e.type)}return o instanceof re&&this.initializeRoot(o),o},e.prototype.initializeRoot=function(e){e._bindVisibility()},e}();var ce=function(){function e(){this.onDestroy=new a.Subject}return e.prototype.destroy=function(){this.onDestroy.next(!0)},e}();var he=function(){function e(){}return e.decorators=[{type:t.Injectable}],e}();var de=function(e){function n(t){var n=e.call(this)||this;return n.options=t,n.ajv=new Ajv(L(L({},t.ajv),{errorDataPath:"property",allErrors:!0,jsonPointers:!0})),n.ajv.addFormat("data-url",/^data:([a-z]+\/[a-z0-9-+.]+)?;name=(.*);base64,(.*)$/),n.ajv.addFormat("color",/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/),n.ajv.addFormat("mobile",/^(0|\+?86|17951)?1[0-9]{10}$/),n.ajv.addFormat("id-card",/(^\d{15}$)|(^\d{17}([0-9]|X)$)/),n}return A(n,e),n.prototype.createValidatorFn=function(e,t){var n=this,r=H(this.options.ingoreKeywords,t.ingoreKeywords||[]);return function(i){try{n.ajv.validate(e,i)}catch(e){t.debug&&console.warn(e)}var o=n.ajv.errors;return n.options&&r&&o&&(o=o.filter((function(e){return-1===r.indexOf(e.keyword)}))),o}},n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[{type:U,decorators:[{type:t.Inject,args:[U]}]}]},n}(he);var fe=function(){function e(){this._widgets={}}return Object.defineProperty(e.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),e.prototype.setDefault=function(e){this.defaultWidget=e},e.prototype.register=function(e,t){this._widgets[e]=t},e.prototype.has=function(e){return this._widgets.hasOwnProperty(e)},e.prototype.getType=function(e){return this.has(e)?this._widgets[e]:this.defaultWidget},e}();var me=function(){function e(e,t){this.registry=e,this.resolver=t}return e.prototype.createWidget=function(e,t){this.registry.has(t)||console.warn('No widget for type "'+t+'"');var n=this.registry.getType(t),r=this.resolver.resolveComponentFactory(n);return e.createComponent(r)},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:fe},{type:t.ComponentFactoryResolver}]},e}();function ye(e,t){return new pe(e,t)}var ge=function(){function e(e,n,r,i,o,l,u,p){var c=this;this.formPropertyFactory=e,this.terminator=n,this.options=r,this.dom=i,this.cdr=o,this.localeSrv=l,this.aclSrv=u,this.i18nSrv=p,this.unsubscribe$=new a.Subject,this._renders=new Map,this._valid=!0,this._inited=!1,this.locale={},this.rootProperty=null,this.layout="horizontal",this.button={},this.liveValidate=!0,this.firstVisual=!0,this.onlyVisual=!1,this.loading=!1,this.disabled=!1,this.noColon=!1,this.cleanValue=!1,this.formChange=new t.EventEmitter,this.formSubmit=new t.EventEmitter,this.formReset=new t.EventEmitter,this.formError=new t.EventEmitter,this.liveValidate=r.liveValidate,this.firstVisual=r.firstVisual,this.autocomplete=r.autocomplete,this.localeSrv.change.pipe(s.takeUntil(this.unsubscribe$)).subscribe((function(){c.locale=c.localeSrv.getData("sf"),c._inited&&(c.validator({emitError:!1,onlyRoot:!1}),c.coverButtonProperty(),c.cdr.markForCheck())}));var h=[this.aclSrv?this.aclSrv.change:null,this.i18nSrv?this.i18nSrv.change:null].filter((function(e){return null!=e}));h.length>0&&a.merge.apply(void 0,H(h)).pipe(s.filter((function(){return c._inited})),s.takeUntil(this.unsubscribe$)).subscribe((function(){return c.refreshSchema()}))}return Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(e){switch(e){case"search":this.layout="inline",this.firstVisual=!1,this.liveValidate=!1,this._btn&&(this._btn.submit=this._btn.search);break;case"edit":this.layout="horizontal",this.firstVisual=!1,this.liveValidate=!0,this._btn&&(this._btn.submit=this._btn.edit)}this._mode=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return this._valid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._item},enumerable:!0,configurable:!0}),e.prototype.getProperty=function(e){return this.rootProperty.searchProperty(e)},e.prototype.getValue=function(e){return this.getProperty(e).value},e.prototype.setValue=function(e,t){var n=this.getProperty(e);if(!n)throw new Error("Invalid path: "+e);return n.resetValue(t,!1),this},e.prototype.onSubmit=function(e){e.preventDefault(),e.stopPropagation(),this.liveValidate||this.validator(),this.valid&&this.formSubmit.emit(this.value)},e.prototype.fanyi=function(e){return(this.i18nSrv?this.i18nSrv.fanyi(e):"")||e},e.prototype.inheritUI=function(e){var t=this;["optionalHelp"].filter((function(e){return!!t._defUi[e]})).forEach((function(n){return e[n]=L(L({},t._defUi[n]),e[n])}))},e.prototype.coverProperty=function(){var e=this,t="horizontal"===this.layout,n=o.deepCopy(this.schema),r=n.definitions,i=function(n,o,a,s,l){Array.isArray(n.required)||(n.required=[]),Object.keys(n.properties).forEach((function(o){var u="$"+o,p=Y(n.properties[o],r),c=L(L(L(L(L(L({widget:p.type},p.format&&B[p.format]),"string"==typeof p.ui?{widget:p.ui}:null),!p.format&&!p.ui&&Array.isArray(p.enum)&&p.enum.length>0?{widget:"select"}:null),e._defUi),p.ui),a[u]);if(t?s.spanLabelFixed?c.spanLabelFixed||(c.spanLabelFixed=s.spanLabelFixed):(c.spanLabel||(c.spanLabel=void 0===s.spanLabel?5:s.spanLabel),c.spanControl||(c.spanControl=void 0===s.spanControl?19:s.spanControl),c.offsetControl||(c.offsetControl=void 0===s.offsetControl?null:s.offsetControl)):(c.spanLabel=null,c.spanControl=null,c.offsetControl=null),"date"===c.widget&&null!=c.end){var h=n.properties[c.end];h?h.ui=L(L({},h.ui),{hidden:!0}):c.end=null}if(e.inheritUI(c),c.optionalHelp){"string"==typeof c.optionalHelp&&(c.optionalHelp={text:c.optionalHelp});var d=c.optionalHelp=L({text:"",icon:"question-circle",placement:"top",trigger:"hover",mouseEnterDelay:.15,mouseLeaveDelay:.1},c.optionalHelp);d.i18n&&(d.text=e.fanyi(d.i18n)),d.text||(c.optionalHelp=void 0)}if(c.i18n&&(p.title=e.fanyi(c.i18n)),c.descriptionI18n&&(p.description=e.fanyi(c.descriptionI18n)),p.description&&(p._description=e.dom.bypassSecurityTrustHtml(p.description)),c.hidden="boolean"==typeof c.hidden&&c.hidden,!1===c.hidden&&c.acl&&e.aclSrv&&!e.aclSrv.can(c.acl)&&(c.hidden=!0),l[u]=c,delete p.ui,!0===c.hidden){var f=n.required.indexOf(o);-1!==f&&n.required.splice(f,1)}if(p.items){var m=(a[u]||{}).$items||{};c.$items=L(L(L({},p.items.ui),m[u]),c.$items),i(p.items,p.items,m,c.$items,c.$items)}p.properties&&Object.keys(p.properties).length&&i(p,n,a[u]||{},c,c)}))},a=function(e,t){Object.keys(e.properties).forEach((function(n){var r=e.properties[n],i="$"+n;Z(r,t[i]),r.items&&a(r.items,t[i].$items),r.properties&&a(r,t[i])}))};null==this.ui&&(this.ui={}),this._defUi=L(L(L({onlyVisual:this.options.onlyVisual,size:this.options.size,liveValidate:this.liveValidate,firstVisual:this.firstVisual},this.options.ui),n.ui),this.ui["*"]),!0===this.onlyVisual&&(this._defUi.onlyVisual=!0),this._ui=L({},this._defUi),i(n,n,this.ui,this.ui,this._ui),Z(n,this._ui),a(n,this._ui),this._schema=n,K(this._ui,"cover schema & ui",this._ui,n)},e.prototype.coverButtonProperty=function(){this._btn=L(L(L({render:{size:"default"}},this.locale),this.options.button),this.button);var e=Object.keys(this._ui).find((function(e){return e.startsWith("$")}));if("horizontal"===this.layout){var t=e?this._ui[e]:this._defUi;this._btn.render.grid||(this._btn.render.grid={offset:t.spanLabel,span:t.spanControl}),null==this._btn.render.spanLabelFixed&&(this._btn.render.spanLabelFixed=t.spanLabelFixed),!this._btn.render.class&&"number"==typeof t.spanLabelFixed&&t.spanLabelFixed>0&&(this._btn.render.class="text-center")}else this._btn.render.grid={};this._mode&&(this.mode=this._mode),K(this._ui,"button property",this._btn)},e.prototype.ngOnInit=function(){this._inited=!0,this.validator()},e.prototype.ngOnChanges=function(e){1!==Object.keys(e).length||!e.loading&&!e.disabled?this.refreshSchema():this.cdr.detectChanges()},e.prototype._addTpl=function(e,t){this._renders.has(e)?console.warn('Duplicate definition "'+e+'" custom widget'):(this._renders.set(e,t),this.attachCustomRender())},e.prototype.attachCustomRender=function(){var e=this;this._renders.forEach((function(t,n){var r=e.rootProperty.searchProperty(n);null!=r&&(r.ui._render=t)}))},e.prototype.validator=function(e){void 0===e&&(e={emitError:!0,onlyRoot:!0});var t=function(e){e._runValidation(),e instanceof re&&e.properties&&(Array.isArray(e.properties)?e.properties.forEach((function(e){return t(e)})):Object.keys(e.properties).forEach((function(n){return t(e.properties[n])})))};e.onlyRoot?this.rootProperty._runValidation():t(this.rootProperty);var n=this.rootProperty.errors;return this._valid=!(n&&n.length),e.emitError&&!this._valid&&this.formError.emit(n),this.cdr.detectChanges(),this},e.prototype.refreshSchema=function(e,t){var n=this;if(e&&(this.schema=e),t&&(this.ui=t),!this.schema||void 0===this.schema.properties)throw new Error("Invalid Schema");if(this.schema.ui&&"string"==typeof this.schema.ui)throw new Error("Don't support string with root ui property");this.schema.type="object",this._formData=L({},this.formData),this._inited&&this.terminator.destroy(),this.cleanRootSub(),this.coverProperty(),this.coverButtonProperty(),this.rootProperty=this.formPropertyFactory.createProperty(this._schema,this._ui,this.formData),this.attachCustomRender(),this.cdr.detectChanges(),this.reset();var r=!0;return this.rootProperty.valueChanges.subscribe((function(e){n._item=L(L({},n.cleanValue?null:n.formData),e),r?r=!1:n.formChange.emit(n._item)})),this.rootProperty.errorsChanges.subscribe((function(e){n._valid=!(e&&e.length),n.formError.emit(e),n.cdr.detectChanges()})),this},e.prototype.reset=function(e){var t=this;return void 0===e&&(e=!1),this.rootProperty.resetValue(this.formData,!1),Promise.resolve().then((function(){return t.cdr.detectChanges()})),e&&this.formReset.emit(this.value),this},e.prototype.cleanRootSub=function(){this.rootProperty&&(this.rootProperty.errorsChanges.unsubscribe(),this.rootProperty.valueChanges.unsubscribe())},e.prototype.ngOnDestroy=function(){this.cleanRootSub(),this.terminator.destroy();var e=this.unsubscribe$;e.next(),e.complete()},e.decorators=[{type:t.Component,args:[{selector:"sf, [sf]",exportAs:"sf",template:'<ng-template #con>\n <ng-content></ng-content>\n</ng-template>\n<form nz-form [nzLayout]="layout" (submit)="onSubmit($event)" [attr.autocomplete]="autocomplete">\n <sf-item [formProperty]="rootProperty"></sf-item>\n <ng-container *ngIf="button !== \'none\'; else con">\n <nz-form-item [ngClass]="_btn.render!.class" class="sf-btns" [fixed-label]="_btn.render!.spanLabelFixed">\n <div nz-col\n class="ant-form-item-control"\n [nzSpan]="_btn.render!.grid!.span"\n [nzOffset]="_btn.render!.grid!.offset"\n [nzXs]="_btn.render!.grid!.xs"\n [nzSm]="_btn.render!.grid!.sm"\n [nzMd]="_btn.render!.grid!.md"\n [nzLg]="_btn.render!.grid!.lg"\n [nzXl]="_btn.render!.grid!.xl"\n [nzXXl]="_btn.render!.grid!.xxl">\n <div class="ant-form-item-control-input">\n <div class="ant-form-item-control-input-content">\n <ng-container *ngIf="button; else con">\n <button type="submit"\n nz-button\n data-type="submit"\n [nzType]="_btn.submit_type"\n [nzSize]="_btn.render!.size"\n [nzLoading]="loading"\n [disabled]="liveValidate && !valid">\n <i *ngIf="_btn.submit_icon"\n nz-icon\n [nzType]="_btn.submit_icon.type"\n [nzTheme]="_btn.submit_icon.theme"\n [nzTwotoneColor]="_btn.submit_icon.twoToneColor"\n [nzIconfont]="_btn.submit_icon.iconfont"></i>\n {{_btn.submit}}\n </button>\n <button *ngIf="_btn.reset"\n type="button"\n nz-button\n data-type="reset"\n [nzType]="_btn.reset_type"\n [nzSize]="_btn.render!.size"\n [disabled]="loading"\n (click)="reset(true)">\n <i *ngIf="_btn.reset_icon"\n nz-icon\n [nzType]="_btn.reset_icon.type"\n [nzTheme]="_btn.reset_icon.theme"\n [nzTwotoneColor]="_btn.reset_icon.twoToneColor"\n [nzIconfont]="_btn.reset_icon.iconfont"></i>\n {{_btn.reset}}\n </button>\n </ng-container>\n </div>\n </div>\n </div>\n </nz-form-item>\n </ng-container>\n</form>\n',providers:[me,{provide:pe,useFactory:ye,deps:[he,U]},ce],host:{"[class.sf]":"true","[class.sf__inline]":"layout === 'inline'","[class.sf__search]":"mode === 'search'","[class.sf__edit]":"mode === 'edit'","[class.sf__no-error]":"onlyVisual","[class.sf__no-colon]":"noColon"},preserveWhitespaces:!1,changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None}]}],e.ctorParameters=function(){return[{type:pe},{type:ce},{type:U},{type:n.DomSanitizer},{type:t.ChangeDetectorRef},{type:i.LxlibLocaleService},{type:r.ACLService,decorators:[{type:t.Optional}]},{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[i.LXLIB_I18N_TOKEN]}]}]},e.propDecorators={layout:[{type:t.Input}],schema:[{type:t.Input}],ui:[{type:t.Input}],formData:[{type:t.Input}],button:[{type:t.Input}],liveValidate:[{type:t.Input}],autocomplete:[{type:t.Input}],firstVisual:[{type:t.Input}],onlyVisual:[{type:t.Input}],mode:[{type:t.Input}],loading:[{type:t.Input}],disabled:[{type:t.Input}],noColon:[{type:t.Input}],cleanValue:[{type:t.Input}],formChange:[{type:t.Output}],formSubmit:[{type:t.Output}],formReset:[{type:t.Output}],formError:[{type:t.Output}]},W([o.InputBoolean(),$("design:type",Object)],e.prototype,"liveValidate",void 0),W([o.InputBoolean(),$("design:type",Object)],e.prototype,"firstVisual",void 0),W([o.InputBoolean(),$("design:type",Object)],e.prototype,"onlyVisual",void 0),W([o.InputBoolean(),$("design:type",Object)],e.prototype,"loading",void 0),W([o.InputBoolean(),$("design:type",Object)],e.prototype,"disabled",void 0),W([o.InputBoolean(),$("design:type",Object)],e.prototype,"noColon",void 0),W([o.InputBoolean(),$("design:type",Object)],e.prototype,"cleanValue",void 0),e}();var be=0,ve=function(){function e(e,t){this.widgetFactory=e,this.terminator=t,this.unsubscribe$=new a.Subject,this.widget=null}return e.prototype.onWidgetInstanciated=function(e){this.widget=e;var t="_sf-"+be++,n=this.formProperty.ui;this.widget.formProperty=this.formProperty,this.widget.schema=this.formProperty.schema,this.widget.ui=n,this.widget.id=t,this.widget.firstVisual=n.firstVisual,this.formProperty.widget=e},e.prototype.ngOnInit=function(){var e=this;this.terminator.onDestroy.subscribe((function(){return e.ngOnDestroy()}))},e.prototype.ngOnChanges=function(){this.ref=this.widgetFactory.createWidget(this.container,this.formProperty.ui.widget||this.formProperty.schema.type),this.onWidgetInstanciated(this.ref.instance)},e.prototype.ngOnDestroy=function(){var e=this.unsubscribe$;e.next(),e.complete(),this.ref.destroy()},e.decorators=[{type:t.Component,args:[{selector:"sf-item",exportAs:"sfItem",template:" <ng-template #target></ng-template> ",preserveWhitespaces:!1,encapsulation:t.ViewEncapsulation.None}]}],e.ctorParameters=function(){return[{type:me},{type:ce}]},e.propDecorators={formProperty:[{type:t.Input}],container:[{type:t.ViewChild,args:["target",{read:t.ViewContainerRef,static:!0}]}]},e}();var ze=function(){function e(e,t){this.render=t,this._inited=!1,this.el=e.nativeElement}return e.prototype.init=function(){if(this._inited&&null!=this.num&&!(this.num<=0)){var e=this.el.querySelector(".ant-row")||this.el;this.render.addClass(e,"sf__fixed");var t=e.querySelector(".ant-form-item-label"),n=this.num+"px";if(t)this.render.setStyle(t,"width",n),this.render.setStyle(t,"flex","0 0 "+n);else{var r=e.querySelector(".ant-form-item-control");this.render.setStyle(r,"margin-left",n)}}},e.prototype.ngAfterViewInit=function(){this._inited=!0,this.init()},e.prototype.ngOnChanges=function(){this._inited&&this.init()},e.decorators=[{type:t.Directive,args:[{selector:"[fixed-label]"}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2}]},e.propDecorators={num:[{type:t.Input,args:["fixed-label"]}]},W([o.InputNumber(),$("design:type",Number)],e.prototype,"num",void 0),e}();var we=function(){function e(){this.title=null}return Object.defineProperty(e.prototype,"t",{get:function(){return null===this.title?this.schema.title:this.title},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oh",{get:function(){return this.ui.optionalHelp},enumerable:!0,configurable:!0}),e.decorators=[{type:t.Component,args:[{selector:"sf-item-wrap",template:'<nz-form-item [style.width.px]="ui.width" [class.ant-form-item-has-error]="showError" [class.ant-form-item-with-help]="showError">\n <nz-col *ngIf="showTitle" [nzSpan]="ui.spanLabel" class="ant-form-item-label">\n <label *ngIf="t" [attr.for]="id" [class.ant-form-item-required]="ui._required">\n {{ t }}\n <span class="sf__optional">\n {{ ui.optional }}\n <i *ngIf="oh" nz-tooltip\n [nzTooltipTitle]="oh.text" [nzTooltipPlacement]="oh.placement" [nzTooltipTrigger]="oh.trigger"\n [nzOverlayClassName]="oh.overlayClassName" [nzOverlayStyle]="oh.overlayStyle"\n [nzMouseEnterDelay]="oh.mouseEnterDelay" [nzMouseLeaveDelay]="oh.mouseLeaveDelay"\n nz-icon [nzType]="oh.icon"></i>\n </span>\n </label>\n </nz-col>\n <nz-col class="ant-form-item-control" [nzSpan]="ui.spanControl" [nzOffset]="ui.offsetControl">\n <div class="ant-form-item-control-input">\n <div class="ant-form-item-control-input-content">\n <ng-content></ng-content>\n </div>\n </div>\n <div *ngIf="!ui.onlyVisual && showError" class="ant-form-item-explain">\n <div @helpMotion>{{error}}</div>\n </div>\n <div *ngIf="schema.description" class="ant-form-item-extra" [innerHTML]="schema._description"></div>\n </nz-col>\n</nz-form-item>\n',animations:[k.helpMotion],preserveWhitespaces:!1,encapsulation:t.ViewEncapsulation.None}]}],e.propDecorators={id:[{type:t.Input}],schema:[{type:t.Input}],ui:[{type:t.Input}],showError:[{type:t.Input}],error:[{type:t.Input}],showTitle:[{type:t.Input}],title:[{type:t.Input}]},e}();var Ce=function(){function e(e,t){this.templateRef=e,this.table=t}return e.prototype.ngOnInit=function(){this.table._addTpl(this.path.startsWith("/")?this.path:"/"+this.path,this.templateRef)},e.decorators=[{type:t.Directive,args:[{selector:"[sf-template]"}]}],e.ctorParameters=function(){return[{type:t.TemplateRef},{type:ge}]},e.propDecorators={path:[{type:t.Input,args:["sf-template"]}]},e}();var _e=function(){function e(e,t,n,r){this.cd=e,this.injector=t,this.sfItemComp=n,this.sfComp=r,this.showError=!1,this.id="",this.firstVisual=!1}return Object.defineProperty(e.prototype,"cls",{get:function(){return this.ui.class||""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"disabled",{get:function(){return!(!0!==this.schema.readOnly&&!this.sfComp.disabled)||null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"l",{get:function(){return this.formProperty.root.widget.sfComp.locale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"oh",{get:function(){return this.ui.optionalHelp},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dom",{get:function(){return this.injector.get(n.DomSanitizer)},enumerable:!0,configurable:!0}),e.prototype.ngAfterViewInit=function(){var e=this;this.formProperty.errorsChanges.pipe(s.takeUntil(this.sfItemComp.unsubscribe$)).subscribe((function(t){null!=t&&(K(e.ui,"errorsChanges",e.formProperty.path,t),e.firstVisual&&(e.showError=t.length>0,e.error=e.showError?t[0].message:"",e.cd.detectChanges()),e.firstVisual=!0)}))},e.prototype.setValue=function(e){this.formProperty.setValue(e,!1),K(this.ui,"valueChanges",this.formProperty.path,this.formProperty)},Object.defineProperty(e.prototype,"value",{get:function(){return this.formProperty.value},enumerable:!0,configurable:!0}),e.prototype.detectChanges=function(e){void 0===e&&(e=!1),e?this.cd.markForCheck():this.formProperty.root.widget.cd.markForCheck()},e.ctorParameters=function(){return[{type:t.ChangeDetectorRef,decorators:[{type:t.Inject,args:[t.ChangeDetectorRef]}]},{type:t.Injector,decorators:[{type:t.Inject,args:[t.Injector]}]},{type:ve,decorators:[{type:t.Inject,args:[ve]}]},{type:ge,decorators:[{type:t.Inject,args:[ge]}]}]},e.propDecorators={cls:[{type:t.HostBinding,args:["class"]}]},e}();var xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.reset=function(e){},t}(_e),Se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.reset=function(e){},t}(_e),Oe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.reset=function(e){},t.prototype.ngAfterViewInit=function(){var e=this;this.formProperty.errorsChanges.pipe(s.takeUntil(this.sfItemComp.unsubscribe$)).subscribe((function(){return e.cd.detectChanges()}))},t}(_e),Ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.reset=function(e){},t.prototype.ngAfterViewInit=function(){var e=this;this.formProperty.errorsChanges.pipe(s.takeUntil(this.sfItemComp.unsubscribe$)).subscribe((function(){return e.cd.detectChanges()}))},t}(_e),Ee=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.arraySpan=8,t}return A(n,e),Object.defineProperty(n.prototype,"addDisabled",{get:function(){return this.disabled||this.schema.maxItems&&this.formProperty.properties.length>=this.schema.maxItems},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"showRemove",{get:function(){return!this.disabled&&this.removeTitle},enumerable:!0,configurable:!0}),n.prototype.ngOnInit=function(){var e=this.ui,t=e.grid,n=e.addTitle,r=e.addType,i=e.removable,o=e.removeTitle;t&&t.arraySpan&&(this.arraySpan=t.arraySpan),this.addTitle=this.dom.bypassSecurityTrustHtml(n||this.l.addText),this.addType=r||"dashed",this.removeTitle=!1===i?null:o||this.l.removeText},n.prototype.addItem=function(){this.formProperty.add({})},n.prototype.removeItem=function(e){this.formProperty.remove(e)},n.decorators=[{type:t.Component,args:[{selector:"sf-array",template:'<nz-form-item [class.ant-form-item-with-help]="showError">\n <nz-col *ngIf="schema.title" [nzSpan]="ui.spanLabel" class="ant-form-item-label">\n <label>\n {{ schema.title }}\n <span class="sf__optional">\n {{ ui.optional }}\n <i *ngIf="oh" nz-tooltip\n [nzTooltipTitle]="oh.text" [nzTooltipPlacement]="oh.placement" [nzTooltipTrigger]="oh.trigger"\n [nzOverlayClassName]="oh.overlayClassName" [nzOverlayStyle]="oh.overlayStyle"\n [nzMouseEnterDelay]="oh.mouseEnterDelay" [nzMouseLeaveDelay]="oh.mouseLeaveDelay"\n nz-icon [nzType]="oh.icon"></i>\n </span>\n </label>\n <div class="sf__array-add">\n <button type="button"\n nz-button\n [nzType]="addType"\n [disabled]="addDisabled"\n (click)="addItem()"\n [innerHTML]="addTitle"></button>\n </div>\n </nz-col>\n <nz-col class="ant-form-item-control-wrapper" [nzSpan]="ui.spanControl" [nzOffset]="ui.offsetControl">\n <div class="ant-form-item-control" [class.has-error]="showError">\n <nz-row class="sf__array-container">\n <ng-container *ngFor="let i of formProperty.properties; let idx=index">\n <nz-col *ngIf="i.visible && !i.ui.hidden" [nzSpan]="arraySpan" [attr.data-index]="idx" class="sf-array-item">\n <nz-card>\n <sf-item [formProperty]="i"></sf-item>\n <span *ngIf="showRemove" class="sf__array-remove" (click)="removeItem(idx)" [attr.title]="removeTitle">\n <i nz-icon nzType="delete"></i>\n </span>\n </nz-card>\n </nz-col>\n </ng-container>\n </nz-row>\n <div *ngIf="!ui.onlyVisual && showError" class="ant-form-explain">{{error}}</div>\n <div *ngIf="schema.description" [innerHTML]="schema._description" class="ant-form-extra"></div>\n </div>\n </nz-col>\n</nz-form-item>\n',preserveWhitespaces:!1,encapsulation:t.ViewEncapsulation.None}]}],n}(Oe);var Pe=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.i={},t.typing="",t.isAsync=!1,t.fixData=[],t}return A(n,e),n.prototype.updateValue=function(e){this.typing=e.nzLabel,this.setValue(e.nzValue),this.ui.change&&this.ui.change(e)},n.prototype.ngAfterViewInit=function(){var e=this,t=this.ui,n=t.backfill,r=t.defaultActiveFirstOption,i=t.nzWidth,o=t.filterOption,a=t.asyncData;this.i={backfill:X(n,!1),defaultActiveFirstOption:X(r,!0),width:i||void 0};var l=null==o||o;"boolean"==typeof l&&(l=function(e,t){return t.label.toLowerCase().indexOf((e||"").toLowerCase())>-1}),this.filterOption=l,this.isAsync=!!a;var u=+(this.ui.debounceTime||0),p=Math.max(0,this.isAsync?Math.max(50,u):u);this.list=this.ngModel.valueChanges.pipe(s.debounceTime(p),s.startWith(""),s.flatMap((function(t){return e.isAsync?a(t):e.filterData(t)})),s.map((function(t){return Q(t,null,e.schema.readOnly)})))},n.prototype.reset=function(e){if(this.typing=this.value,!this.isAsync)switch(this.ui.type){case"email":this.fixData=ee(this.schema.enum||this.formProperty.options.uiEmailSuffixes,null,this.schema.readOnly);break;default:this.fixData=ee(this.schema.enum,e,this.schema.readOnly)}},n.prototype.filterData=function(e){var t=this;switch(this.ui.type){case"email":return this.addEmailSuffix(e);default:return a.of(this.fixData.filter((function(n){return t.filterOption(e,n)})))}},n.prototype.addEmailSuffix=function(e){return a.of(!e||~e.indexOf("@")?[]:this.fixData.map((function(t){return e+"@"+t.label})))},n.decorators=[{type:t.Component,args:[{selector:"sf-autocomplete",template:'<sf-item-wrap [id]="id"\n [schema]="schema"\n [ui]="ui"\n [showError]="showError"\n [error]="error"\n [showTitle]="schema.title">\n <input nz-input\n [nzAutocomplete]="auto"\n [attr.id]="id"\n [disabled]="disabled"\n [attr.disabled]="disabled"\n [nzSize]="ui.size"\n [(ngModel)]="typing"\n (ngModelChange)="setValue($event)"\n [attr.maxLength]="schema.maxLength || null"\n [attr.placeholder]="ui.placeholder"\n autocomplete="off">\n <nz-autocomplete #auto\n [nzBackfill]="i.backfill"\n [nzDefaultActiveFirstOption]="i.defaultActiveFirstOption"\n [nzWidth]="i.width"\n (selectionChange)="updateValue($event)">\n <nz-auto-option *ngFor="let i of list | async" [nzValue]="i.value" [nzLabel]="i.label">\n {{i.label}}\n </nz-auto-option>\n </nz-autocomplete>\n</sf-item-wrap>\n',preserveWhitespaces:!1,encapsulation:t.ViewEncapsulation.None}]}],n.propDecorators={ngModel:[{type:t.ViewChild,args:[u.NgModel,{static:!1}]}]},n}(Se);var Te=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return A(n,e),n.decorators=[{type:t.Component,args:[{selector:"sf-boolean",template:'<sf-item-wrap [id]="id"\n [schema]="schema"\n [ui]="ui"\n [showError]="showError"\n [error]="error"\n [showTitle]="schema.title">\n <nz-switch [ngModel]="value"\n (ngModelChange)="setValue($event)"\n [nzDisabled]="disabled"\n [nzSize]="ui.size"\n [nzCheckedChildren]="ui.checkedChildren"\n [nzUnCheckedChildren]="ui.unCheckedChildren">\n </nz-switch>\n</sf-item-wrap>\n',preserveWhitespaces:!1,encapsulation:t.ViewEncapsulation.None}]}],n}(xe),Ie=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.data=[],t}return A(n,e),n.prototype.ngOnInit=function(){var e=this,t=this.ui,n=t.clearText,r=t.showArrow,i=t.showInput,o=t.triggerAction,a=t.asyncData;this.clearText=n||"清除",this.showArrow=X(r,!0),this.showInput=X(i,!0),this.triggerAction=o||["click"],a&&(this.loadData=function(t,n){return a(t,n,e).then((function(){return e.detectChanges()}))})},n.prototype.reset=function(e){var t=this;te(this.schema,{},e).subscribe((function(e){t.data=e,t.detectChanges()}))},n.prototype._visibleChange=function(e){this.ui.visibleChange&&this.ui.visibleChange(e)},n.prototype._change=function(e){this.setValue(e),this.ui.change&&this.ui.change(e)},n.prototype._selectionChange=function(e){this.ui.selectionChange&&this.ui.selectionChange(e)},n.prototype._