UNPKG

@kre-form/ant

Version:

879 lines (863 loc) 778 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/router'), require('rxjs/operators'), require('@angular/common'), require('@angular/http'), require('@angular/cdk/drag-drop'), require('@angular/common/http'), require('@ngx-translate/core'), require('ng-zorro-antd'), require('ngx-color-picker'), require('@ant-design/icons-angular/icons'), require('@angular/common/locales/zh'), require('rxjs'), require('ng-zorro-antd/modal'), require('@angular/platform-browser'), require('@kre-form/core'), require('ng-zorro-antd/message'), require('@angular/cdk/overlay'), require('lodash'), require('@angular/forms'), require('date-fns/difference_in_calendar_days'), require('moment'), require('@kre-form/abc'), require('@angular/core')) : typeof define === 'function' && define.amd ? define('@kre-form/ant', ['exports', '@angular/router', 'rxjs/operators', '@angular/common', '@angular/http', '@angular/cdk/drag-drop', '@angular/common/http', '@ngx-translate/core', 'ng-zorro-antd', 'ngx-color-picker', '@ant-design/icons-angular/icons', '@angular/common/locales/zh', 'rxjs', 'ng-zorro-antd/modal', '@angular/platform-browser', '@kre-form/core', 'ng-zorro-antd/message', '@angular/cdk/overlay', 'lodash', '@angular/forms', 'date-fns/difference_in_calendar_days', 'moment', '@kre-form/abc', '@angular/core'], factory) : (factory((global['kre-form'] = global['kre-form'] || {}, global['kre-form'].ant = {}),global.ng.router,global.rxjs.operators,global.ng.common,global.ng.http,global.ng.cdk['drag-drop'],global.ng.common.http,global.core,global.ngZorroAntd,global.ngxColorPicker,global.icons,global.ng.common.locales.zh,global.rxjs,global.i1$1,global.ng.platformBrowser,global.core$1,global.message,global.ng.cdk.overlay,global._,global.ng.forms,global.differenceInCalendarDays_,global.moment_,global.abc,global.ng.core)); }(this, (function (exports,router,operators,common,http,dragDrop,i1,core,ngZorroAntd,ngxColorPicker,icons,zh,rxjs,i1$1,platformBrowser,core$1,message,overlay,_,forms,differenceInCalendarDays_,moment_,abc,i0) { 'use strict'; zh = zh && zh.hasOwnProperty('default') ? zh['default'] : zh; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldAnchor = /** @class */ (function (_super) { __extends(KreFormFieldAnchor, _super); function KreFormFieldAnchor() { return _super !== null && _super.apply(this, arguments) || this; } KreFormFieldAnchor.decorators = [ { type: i0.Component, args: [{ selector: "krefield-anchor", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <nz-divider\n class=\"control-design\"\n [id]=\"field.key\"\n [nzText]=\"to.description\"\n ></nz-divider>\n <!-- <div id=\"components-anchor-demo-basic\" style=\"height: 400px;\">1</div> -->\n </ng-container>\n\n <ng-template #other>\n <nz-divider\n class=\"control-design\"\n [id]=\"field.key\"\n [nzText]=\"to.description\"\n ></nz-divider>\n <!-- <div id=\"components-anchor-demo-basic\" style=\"height: 400px;\">1</div> -->\n </ng-template>\n " }] } ]; return KreFormFieldAnchor; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /* <ng-container *ngIf="formStatus !== 0"> <krefield-private_text [field]="field" [status]="formStatus"></krefield-private_text> </ng-container> */ var KreFormFieldText = /** @class */ (function (_super) { __extends(KreFormFieldText, _super); function KreFormFieldText() { return _super !== null && _super.apply(this, arguments) || this; } KreFormFieldText.decorators = [ { type: i0.Component, args: [{ selector: "krefield-text", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <input nz-input disabled />\n </div>\n </ng-container>\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <input\n nz-input\n autocomplete=\"off\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [placeholder]=\"placeHolder\"\n [class.is-invalid]=\"showError\"\n [maxLength]=\"to.maxLength || 200\"\n [minLength]=\"to.minLength || 0\"\n />\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </ng-container>\n\n <div class=\"fieldtext\" *ngIf=\"editor === false\">{{ text }}</div>\n </ng-template>\n " }] } ]; return KreFormFieldText; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldTextI18n = /** @class */ (function (_super) { __extends(KreFormFieldTextI18n, _super); function KreFormFieldTextI18n(route) { var _this = _super.call(this) || this; _this.route = route; _this.triggerWidth = "260px"; _this.languageList = [ { languageType: "zh-cn", label: "中", resValue: null }, { languageType: "en", label: "英", resValue: null }, ]; return _this; } /** * @param {?} event * @return {?} */ KreFormFieldTextI18n.prototype.resize = /** * @param {?} event * @return {?} */ function (event) { this.visibleChange(event); }; /** * @return {?} */ KreFormFieldTextI18n.prototype.ngOnInit = /** * @return {?} */ function () { if (!!this.route.snapshot.queryParams["lang"] && (( /** @type {?} */(this.route.snapshot.queryParams["lang"]))).toLocaleLowerCase() === "en") { this.languageList = [ { languageType: "zh-cn", label: "中", resValue: null }, { languageType: "en", label: "EN", resValue: null }, ]; } }; Object.defineProperty(KreFormFieldTextI18n.prototype, "language", { get: /** * @return {?} */ function () { if (this.model != undefined && this.model != null && this.key != undefined && this.key != null && this.model.hasOwnProperty(this.key)) { if (this.formControl.value != undefined && this.formControl.value != null && this.formControl.value != [] && this.formControl.value.length > 0) { if (this.formControl.value != this.languageList) { this.languageList = this.formControl.value; } } } return this.languageList; }, enumerable: true, configurable: true }); /** * @param {?} value * @return {?} */ KreFormFieldTextI18n.prototype.onChange = /** * @param {?} value * @return {?} */ function (value) { if (this.to.required) { /** @type {?} */ var empty = this.languageList.some(( /** * @param {?} item * @return {?} */function (item) { return ((item.resValue === null || item.resValue === "" || item.resValue === " ") && item.languageType === "zh-cn"); })); if (empty) { this.formControl.setValue([]); } else { this.formControl.setValue(this.languageList); } } else { this.formControl.setValue(this.languageList); } this.formControl.markAsTouched(); }; /** * @param {?} event * @return {?} */ KreFormFieldTextI18n.prototype.visibleChange = /** * @param {?} event * @return {?} */ function (event) { if (event) { if (this.cdkOverlayOrigin !== undefined) { this.triggerWidth = this.cdkOverlayOrigin.elementRef.nativeElement.getBoundingClientRect() .width - 0 + "px"; } } }; Object.defineProperty(KreFormFieldTextI18n.prototype, "langText", { get: /** * @return {?} */ function () { if (this.model != undefined && this.model != null && this.key != undefined && this.key != null && this.model[this.key] != undefined) { /** @type {?} */ var lang = this.model[this.key]; if (lang != undefined && lang != null && lang != "" && lang instanceof Array && lang.length > 0) { return lang[0]["resValue"]; } return ""; } return ""; }, enumerable: true, configurable: true }); KreFormFieldTextI18n.decorators = [ { type: i0.Component, args: [{ selector: "kreform-field-inputi18n", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <input nz-input disabled />\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <div class=\"inputi18n\">\n <div class=\"inputi18n-text\" cdkOverlayOrigin>\n <input\n nz-input\n autocomplete=\"off\"\n [(ngModel)]=\"language[0].resValue\"\n [kreFormAttributes]=\"field\"\n (ngModelChange)=\"onChange(language[0].resValue)\"\n nz-popover\n nzPopoverTrigger=\"click\"\n [nzPopoverContent]=\"contentTemplate\"\n nzOverlayClassName=\"inputi18n-template\"\n nzPopoverPlacement=\"bottom\"\n [nzOverlayStyle]=\"{ width: triggerWidth }\"\n (nzVisibleChange)=\"visibleChange($event)\"\n [maxLength]=\"to.maxLength || 200\"\n [minLength]=\"to.minLength || 0\"\n />\n <i nz-icon class=\"inputi18n-i\" nzType=\"global\"></i>\n </div>\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </div>\n\n <ng-template #contentTemplate>\n <ul>\n <ng-container *ngFor=\"let item of language; let i = index\">\n <li *ngIf=\"i > 0\">\n <label>{{ item.label }}</label>\n <input\n nz-input\n autocomplete=\"off\"\n [(ngModel)]=\"item.resValue\"\n [kreFormAttributes]=\"field\"\n (ngModelChange)=\"onChange(item.resValue)\"\n [maxLength]=\"to.maxLength || 200\"\n [minLength]=\"to.minLength || 0\"\n />\n </li>\n </ng-container>\n </ul>\n </ng-template>\n </ng-container>\n <div class=\"fieldtext\" *ngIf=\"editor === false\">{{ langText }}</div>\n </ng-template>\n " }] } ]; /** @nocollapse */ KreFormFieldTextI18n.ctorParameters = function () { return [ { type: router.ActivatedRoute } ]; }; KreFormFieldTextI18n.propDecorators = { cdkOverlayOrigin: [{ type: i0.ViewChild, args: [overlay.CdkOverlayOrigin, { static: false },] }], resize: [{ type: i0.HostListener, args: ["window:resize", ["$event"],] }] }; return KreFormFieldTextI18n; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldTextArea = /** @class */ (function (_super) { __extends(KreFormFieldTextArea, _super); function KreFormFieldTextArea() { return _super !== null && _super.apply(this, arguments) || this; } /** * @return {?} */ KreFormFieldTextArea.prototype.ngOnInit = /** * @return {?} */ function () { // console.log(this.formControl.value); }; KreFormFieldTextArea.decorators = [ { type: i0.Component, args: [{ selector: "krefield-textarea", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <textarea\n nz-input\n disabled\n [rows]=\"to.rows ? to.rows : 4\"\n style=\"resize:none\"\n >\n </textarea>\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <textarea\n wrap=\"hard\"\n nz-input\n autocomplete=\"off\"\n [formControl]=\"formControl\"\n class=\"form-control\"\n [class.is-invalid]=\"showError\"\n [kreFormAttributes]=\"field\"\n [rows]=\"to.rows ? to.rows : 4\"\n style=\"resize:none\"\n [maxLength]=\"to.maxLength || 500\"\n [minLength]=\"to.minLength || 0\"\n >\n </textarea>\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </ng-container>\n <div\n class=\"fieldtext krefield-textarea-{{ to.rows || 4 }} \"\n *ngIf=\"editor === false\"\n [innerHTML]=\"text | replaceLine\"\n ></div>\n </ng-template>\n " }] } ]; return KreFormFieldTextArea; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldNumber = /** @class */ (function (_super) { __extends(KreFormFieldNumber, _super); function KreFormFieldNumber() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(KreFormFieldNumber.prototype, "precision", { get: /** * @return {?} */ function () { /** @type {?} */ var result = 0; if (this.to != undefined && this.to != null && this.to["precision"] != undefined && this.to["precision"] != null) { result = this.to["precision"]; } return result; }, enumerable: true, configurable: true }); Object.defineProperty(KreFormFieldNumber.prototype, "number", { get: /** * @return {?} */ function () { /** @type {?} */ var result = this.text; if (this.to != undefined && this.to != null && this.to["precision"] != undefined && this.to["precision"] != null) { if (!!result || result === 0) { result = _.round(result, this.to["precision"]); if (!_.isEmpty(this.model) && (( /** @type {?} */(this.model))).hasOwnProperty(this.key)) { this.model[this.key] = result; } } } return result; }, enumerable: true, configurable: true }); KreFormFieldNumber.decorators = [ { type: i0.Component, args: [{ selector: "krefield-number", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <input nz-input disabled />\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <nz-input-number\n autocomplete=\"off\"\n [formControl]=\"formControl\"\n [nzPlaceHolder]=\"placeHolder\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n [nzPrecision]=\"\n to.precision == undefined || to.precision == null\n ? null\n : to.precision\n \"\n [nzMax]=\"to.max || 999999\"\n [nzMin]=\"to.min || -999999\"\n ></nz-input-number>\n </ng-container>\n <div class=\"fieldtext\" *ngIf=\"editor === false\">{{ number }}</div>\n </ng-template>\n " }] } ]; return KreFormFieldNumber; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldPassWord = /** @class */ (function (_super) { __extends(KreFormFieldPassWord, _super); function KreFormFieldPassWord() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.passwordVisible = false; return _this; // clickRead() { // this.read = !this.read; // if (this.read) { // this.password = new Array(this.text.length).fill("*").join(""); // } else { // this.password = this.text; // } // } // <div class="text"> // {{ password }} // </div> // <div class="read"> // <i // nz-icon // [nzType]="read ? 'eye-invisible' : 'eye'" // (click)="clickRead()" // ></i> // </div> } // password = ""; // read = true; // password = ""; // read = true; /** * @return {?} */ KreFormFieldPassWord.prototype.ngOnInit = // password = ""; // read = true; /** * @return {?} */ function () { // this.password = new Array(this.text.length).fill("*").join(""); }; KreFormFieldPassWord.decorators = [ { type: i0.Component, args: [{ selector: "krefield-password", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <input nz-input disabled />\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <!-- <input\n nz-input\n autocomplete=\"off\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n [type]=\"'password'\"\n />-->\n\n <nz-input-group [nzSuffix]=\"suffixTemplate\">\n <input\n [type]=\"passwordVisible ? 'text' : 'password'\"\n nz-input\n autocomplete=\"off\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n />\n </nz-input-group>\n <ng-template #suffixTemplate>\n <i\n nz-icon\n [nzType]=\"passwordVisible ? 'eye-invisible' : 'eye'\"\n (click)=\"passwordVisible = !passwordVisible\"\n ></i>\n </ng-template>\n </ng-container>\n\n <div class=\"fieldtext\" *ngIf=\"editor === false\">\n {{ text }}\n </div>\n </ng-template>\n " }] } ]; return KreFormFieldPassWord; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldRadio = /** @class */ (function (_super) { __extends(KreFormFieldRadio, _super); function KreFormFieldRadio() { return _super !== null && _super.apply(this, arguments) || this; } KreFormFieldRadio.decorators = [ { type: i0.Component, args: [{ selector: "krefield-radio", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <label nz-radio nzDisabled=\"true\"></label>\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <label\n nz-radio\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n ></label>\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </ng-container>\n\n <div class=\"fieldtext\" *ngIf=\"editor === false\">{{ text }}</div>\n </ng-template>\n " }] } ]; return KreFormFieldRadio; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldRadioGroup = /** @class */ (function (_super) { __extends(KreFormFieldRadioGroup, _super); function KreFormFieldRadioGroup() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.guid = core$1.Guid.create()["value"]; return _this; } KreFormFieldRadioGroup.decorators = [ { type: i0.Component, args: [{ selector: "krefield-radiogroup", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <nz-radio-group\n [nzName]=\"'radiogroup-' + guid\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n >\n <ng-container *ngFor=\"let item of to.options\">\n <label nz-radio [nzValue]=\"item.value\" nzDisabled=\"true\">{{\n item.label\n }}</label>\n </ng-container>\n </nz-radio-group>\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <nz-radio-group\n [nzName]=\"'radiogroup-' + guid\"\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n >\n <ng-container *ngFor=\"let item of to.options\">\n <ng-container *ngIf=\"to.type == 'button'\">\n <label nz-radio-button [nzValue]=\"item.value\">{{\n item.label\n }}</label>\n </ng-container>\n <ng-container\n *ngIf=\"\n to.type == null || to.type == undefined || to.type == 'default'\n \"\n >\n <label nz-radio [nzValue]=\"item.value\">{{ item.label }}</label>\n </ng-container>\n </ng-container>\n </nz-radio-group>\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </ng-container>\n\n <div class=\"fieldtext\" *ngIf=\"editor === false\">{{ textRadio }}</div>\n </ng-template>\n " }] } ]; return KreFormFieldRadioGroup; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldCheckbox = /** @class */ (function (_super) { __extends(KreFormFieldCheckbox, _super); function KreFormFieldCheckbox() { return _super !== null && _super.apply(this, arguments) || this; } KreFormFieldCheckbox.decorators = [ { type: i0.Component, args: [{ selector: "krefield-checkbox", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <label nz-checkbox nzDisabled=\"true\"></label>\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <label\n nz-checkbox\n [formControl]=\"formControl\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n ></label>\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </ng-container>\n\n <div class=\"fieldtext\" *ngIf=\"editor === false\">{{ text }}</div>\n </ng-template>\n " }] } ]; return KreFormFieldCheckbox; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldCheckboxGroup = /** @class */ (function (_super) { __extends(KreFormFieldCheckboxGroup, _super); function KreFormFieldCheckboxGroup() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.guid = core$1.Guid.create()["value"]; return _this; } /** * @param {?} values * @return {?} */ KreFormFieldCheckboxGroup.prototype.onChange = /** * @param {?} values * @return {?} */ function (values) { var _this = this; if (values != undefined && values != null && values.length > 0) { values.forEach(( /** * @param {?} value * @return {?} */function (value) { if (_this.to.options !== undefined && _this.to.options !== null) { _this.to.options.forEach(( /** * @param {?} option * @return {?} */function (option) { if (option["value"] === value) ; })); } })); } this.formControl.patchValue(values); this.formControl.markAsTouched(); }; /** * @param {?} option * @return {?} */ KreFormFieldCheckboxGroup.prototype.getCheckStatus = /** * @param {?} option * @return {?} */ function (option) { this.formControl.value; }; /** * @param {?} values * @param {?} option * @return {?} */ KreFormFieldCheckboxGroup.prototype.getControlChecked = /** * @param {?} values * @param {?} option * @return {?} */ function (values, option) { /** @type {?} */ var result = false; if (option && values) { result = values.some(( /** * @param {?} value * @return {?} */function (value) { return value == option.value; })); } return result; }; KreFormFieldCheckboxGroup.decorators = [ { type: i0.Component, args: [{ selector: "krefield-checkboxgroup", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <nz-checkbox-wrapper\n style=\"width: 100%;\"\n (nzOnChange)=\"onChange($event)\"\n [class.is-invalid]=\"showError\"\n >\n <ng-container *ngFor=\"let option of to.options; let i = index\">\n <label\n nz-checkbox\n [nzValue]=\"option.value\"\n [ngModel]=\"getControlChecked(formControl.value, option)\"\n [kreFormAttributes]=\"field\"\n disabled\n >{{ option.label }}</label\n >\n </ng-container>\n </nz-checkbox-wrapper>\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <nz-checkbox-wrapper\n style=\"width: 100%;\"\n (nzOnChange)=\"onChange($event)\"\n [class.is-invalid]=\"showError\"\n >\n <ng-container *ngFor=\"let option of to.options; let i = index\">\n <label\n nz-checkbox\n [nzValue]=\"option.value\"\n [ngModel]=\"getControlChecked(formControl.value, option)\"\n [kreFormAttributes]=\"field\"\n >{{ option.label }}</label\n >\n </ng-container>\n </nz-checkbox-wrapper>\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </ng-container>\n <div class=\"fieldtext\" *ngIf=\"editor === false\">{{ textMultiple }}</div>\n </ng-template>\n " }] } ]; return KreFormFieldCheckboxGroup; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var KreFormFieldSelect = /** @class */ (function (_super) { __extends(KreFormFieldSelect, _super); function KreFormFieldSelect() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._defaultValue = ""; _this._defaultValues = []; _this.selectType = "default"; return _this; } Object.defineProperty(KreFormFieldSelect.prototype, "getModelValue", { get: /** * @return {?} */ function () { if (this.to.selectType === "multiple") { return this.defaultValues; } else { return this.defaultValue; } }, set: /** * @param {?} value * @return {?} */ function (value) { }, enumerable: true, configurable: true }); Object.defineProperty(KreFormFieldSelect.prototype, "defaultValue", { get: /** * @return {?} */ function () { if (this.model && this.model[this.key] && Array.isArray(this.model[this.key]) && this.model[this.key].length > 0) { this._defaultValue = this.model[this.key][0].value; } else { return null; } return this._defaultValue; }, enumerable: true, configurable: true }); Object.defineProperty(KreFormFieldSelect.prototype, "defaultValues", { get: /** * @return {?} */ function () { var _this = this; if (this.model && this.model[this.key] && Array.isArray(this.model[this.key])) { this._defaultValues.length = 0; this.model[this.key].forEach(( /** * @param {?} item * @return {?} */function (item) { _this._defaultValues.push(item.value); })); } else { return null; } return this._defaultValues; }, enumerable: true, configurable: true }); // get defaultValues() { // if (!this._defaultValues) { // this._defaultValues = []; // } else { // this._defaultValues.length = 0; // } // if ( // this.model && // this.model[this.key] && // Array.isArray(this.model[this.key]) && // !_.isEmpty(this.model[this.key]) // ) { // if (!!this.model[this.key]) { // this.model[this.key].forEach((item: any) => { // this._defaultValues.push(item.value); // }); // } // } else { // this._defaultValues = null; // } // return this._defaultValues; // } // get defaultValues() { // if (!this._defaultValues) { // this._defaultValues = []; // } else { // this._defaultValues.length = 0; // } // if ( // this.model && // this.model[this.key] && // Array.isArray(this.model[this.key]) && // !_.isEmpty(this.model[this.key]) // ) { // if (!!this.model[this.key]) { // this.model[this.key].forEach((item: any) => { // this._defaultValues.push(item.value); // }); // } // } else { // this._defaultValues = null; // } // return this._defaultValues; // } /** * @return {?} */ KreFormFieldSelect.prototype.getSelectText = // get defaultValues() { // if (!this._defaultValues) { // this._defaultValues = []; // } else { // this._defaultValues.length = 0; // } // if ( // this.model && // this.model[this.key] && // Array.isArray(this.model[this.key]) && // !_.isEmpty(this.model[this.key]) // ) { // if (!!this.model[this.key]) { // this.model[this.key].forEach((item: any) => { // this._defaultValues.push(item.value); // }); // } // } else { // this._defaultValues = null; // } // return this._defaultValues; // } /** * @return {?} */ function () { /** @type {?} */ var result = ""; if (this.to && this.to.selectType) { if (this.to.selectType === "multiple") { result = this.textMultiple; } else { result = this.textSingle; } } else { result = this.textSingle; } return result; }; /** * @param {?} e * @return {?} */ KreFormFieldSelect.prototype.selectedChange = /** * @param {?} e * @return {?} */ function (e) { var _this = this; /** @type {?} */ var values = []; if (this.to.selectType && this.to.selectType == "multiple") { if (e && Array.isArray(e)) { e.forEach(( /** * @param {?} item * @return {?} */function (item) { if (_this.to.options && Array.isArray(_this.to.options)) { _this.to.options.forEach(( /** * @param {?} options * @return {?} */function (options) { if (options.value == item) { values.push(options); } })); } })); } } else { if (this.to.options && Array.isArray(this.to.options)) { this.to.options.forEach(( /** * @param {?} options * @return {?} */function (options) { if (options.value == e) { values = [options]; } })); } } this.formControl.patchValue(values); this.formControl.markAsTouched(); }; Object.defineProperty(KreFormFieldSelect.prototype, "clear", { get: /** * @return {?} */ function () { if (typeof this.to.clear === "undefined") { return true; } return !!this.to.clear; }, enumerable: true, configurable: true }); KreFormFieldSelect.decorators = [ { type: i0.Component, args: [{ selector: "krefield-select", template: "\n <ng-container *ngIf=\"formStatus !== 0; else other\">\n <div class=\"control-design\">\n <input nz-input disabled />\n </div>\n </ng-container>\n\n <ng-template #other>\n <ng-container *ngIf=\"editor === true\">\n <nz-select\n [nzAllowClear]=\"!to.required && clear\"\n [nzMode]=\"to.selectType === 'multiple' ? 'multiple' : 'default'\"\n [kreFormAttributes]=\"field\"\n [class.is-invalid]=\"showError\"\n [nzPlaceHolder]=\"placeHolder\"\n [(ngModel)]=\"getModelValue\"\n nzShowSearch=\"true\"\n (ngModelChange)=\"selectedChange($event)\"\n >\n <ng-container *ngFor=\"let item of to.options\">\n <nz-option\n [nzLabel]=\"item.label\"\n [nzValue]=\"item.value\"\n ></nz-option>\n </ng-container>\n </nz-select>\n <!-- <div class=\"tips\">\n <i\n class=\"icon-bangzhu\"\n [nzTooltipTitle]=\"tips\"\n nzTooltipPlacement=\"top\"\n nz-tooltip\n *ngIf=\"tips != ''\"\n ></i>\n </div> -->\n </ng-container>\n <div class=\"fieldtext\" *ngIf=\"editor === false\">\n {{ getSelectText() }}\n </div>\n </ng-template>\n " }] } ]; return KreFormFieldSelect; }(core$1.FieldType)); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var moment = moment_; /** @type {?} */ var differenceInCalendarDays = differenceInCalendarDays_; var KreFormFieldDateTime = /** @class */ (function (_super) { __extends(KreFormFieldDateTime, _super); function KreFormFieldDateTime(globalService, commonService) { var _this = _super.call(this) || this; _this.globalService = globalService; _this.commonService = commonService; _this.disabledDate = ( /** * @param {?} current * @return {?} */function (current) { if (!!( /** @type {?} */(_this.to)).maxDate && !!( /** @type {?} */(_this.to)).minDate) { return (differenceInCalendarDays(current, new Date(( /** @type {?} */(_this.to)).maxDate)) > 0 || differenceInCalendarDays(current, new Date(( /** @type {?} */(( /** @type {?} */(_this.to)).minDate)))) < 0); } else if (!!( /** @type {?} */(_this.to)).maxDate && !( /** @type {?} */(_this.to)).minDate) { return differenceInCalendarDays(current, new Date(( /** @type {?} */(_this.to)).maxDate)) > 0; } else if (!( /** @type {?} */(_this.to)).maxDate && !!( /** @type {?} */(_this.to)).minDate) { return differenceInCalendarDays(current, new Date(( /** @type {?} */(_this.to)).minDate)) < 0; } else { return false; } }); _this.disabledDateTime = ( /** * @param {?} e * @return {?} */function (e) { /** @type {?} */ var nzDisabledHours = []; /** @type {?} */ var nzDisabledMinutes = []; if (!!( /** @type {?} */(_this.to)).maxDate && !!( /** @type {?} */(_this.to)).minDate) { if (differenceInCalendarDays(e, new Date(( /** @type {?} */(_this.to)).minDate)) === 0) { nzDisabledHours = _this.range(-1, new Date(( /** @type {?} */(_this.to)).minDate).getHours()); if (!!e && new Date(( /** @type {?} */(_this.to)).minDate).getHours() - e.getHours() === 0) { nzDisabledMinutes = _this.range(-1, new Date(( /** @type {?} */(_this.to)).minDate).getMinutes()); } } if (differenceInCalendarDays(e, new Date(( /** @type {?} */(_this.to)).maxDate)) === 0) { nzDisabledHours = __spread(nzDisabledHours, _this.range(new Date(( /** @type {?} */(_this.to)).maxDate).getHours() + 1, 24)); if (!!e && new Date(( /** @type {?} */(_this.to)).maxDate).getHours() - e.getHours() === 0) { nzDisabledMinutes = __spread(nzDisabledMinutes, _this.range(new Date(( /** @type {?} */(_this.to)).maxDate).getMinutes(), 60)); } } } else if (!!( /** @type {?} */(_this.to)).maxDate && !( /** @type {?} */(_this.to)).minDate) { if (!!e && differenceInCalendarDays(e, new Date(( /** @type {?} */(_this.to)).maxDate)) === 0) { nzDisabledHours = _this.range(new Date(( /** @type {?} */(_this.to)).maxDate).getHours() + 1, 24); if (!!e && new Date(( /** @type {?} */(_this.to)).maxDate).getHours() - e.getHours() === 0) { nzDisabledMinutes = _this.range(new Date(( /** @type {?} */(_this.to)).maxDate).getMinutes(), 60); } } } else if (!( /** @type {?} */(_this.to)).maxDate && !!( /** @type {?} */(_this.to)).minDate) { if (!!e && differenceInCalendarDays(e, new Date(( /** @type {?} */(_this.to)).minDate)) === 0) { nzDisabledHours = _this.range(0, new Date(( /** @type {?} */(_this.to)).minDate).getHours()); if (!!e && new Date(( /** @type {?} */(_this.to)).minDate).getHours() - e.getHours() === 0) { nzDisabledMinutes = _this.range(-1, new Date(( /** @type {?} */(_this.to)).minDate).getMinutes()); } } } return { nzDisabledHours: ( /** * @return {?} */function () { return nzDisabledHours; }), nzDisabledMinutes: ( /** * @return {?} */function () { return nzDisabledMinutes; }), nzDisabledSeconds: ( /** * @return {?} */function () { return []; }), }; }); _this.disabledHours = ( /** * @return {?} */function () { /** @type {?} */ var nzDisabledHours = []; if (!!( /** @type {?} */(_this.to)).maxDate && !!( /** @type {?} */(_this.to)).minDate) { nzDisabledHours = _this.range(-1, new Date(( /** @type {?} */(_this.to)).minDate).getHours()); nzDisabledHours = nzDisabledHours.concat(_this.range(new Date(( /** @type {?} */(_this.to)).maxDate).getHours() + 1, 24)); } else if