monkey-front-components 0.0.116 → 0.0.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/monkey-front-components.umd.js +45 -17
- package/bundles/monkey-front-components.umd.js.map +1 -1
- package/esm2015/lib/components/base/base-dynamic-array.js +17 -7
- package/esm2015/lib/components/dynamic/dynamic-directive.js +13 -9
- package/esm2015/lib/components/dynamic/file-upload/file-upload.component.js +3 -1
- package/esm2015/lib/components/dynamic/input/input.component.js +1 -1
- package/esm2015/lib/components/dynamic/select/select.component.js +11 -2
- package/esm2015/lib/components/dynamic/select-search/select-search.component.js +3 -1
- package/fesm2015/monkey-front-components.js +43 -16
- package/fesm2015/monkey-front-components.js.map +1 -1
- package/lib/components/base/base-dynamic-array.d.ts +1 -0
- package/lib/components/dynamic/dynamic-directive.d.ts +3 -2
- package/monkey-front-components-0.0.120.tgz +0 -0
- package/package.json +3 -3
- package/monkey-front-components-0.0.116.tgz +0 -0
|
@@ -734,14 +734,17 @@
|
|
|
734
734
|
};
|
|
735
735
|
return _this;
|
|
736
736
|
}
|
|
737
|
-
BaseDynamicArray.prototype.
|
|
738
|
-
var
|
|
739
|
-
var operator = settings.operator, value = settings.value;
|
|
737
|
+
BaseDynamicArray.prototype.handleInternalPlusValidation = function (mainField, data) {
|
|
738
|
+
var operator = mainField.operator, value = mainField.value;
|
|
740
739
|
var validators = {
|
|
741
740
|
e: function (val1, val2) { return val1 === val2; },
|
|
742
741
|
lt: function (val1, val2) { return val1 < val2; },
|
|
743
742
|
gt: function (val1, val2) { return val1 > val2; }
|
|
744
743
|
};
|
|
744
|
+
return validators[operator](data, value);
|
|
745
|
+
};
|
|
746
|
+
BaseDynamicArray.prototype.makeInternalPlusValidation = function (data, sourceField, settings, rowIndex) {
|
|
747
|
+
var _this = this;
|
|
745
748
|
var changeFields = function (show) {
|
|
746
749
|
var saved = __spreadArray([], __read(_this.fields));
|
|
747
750
|
saved.map(function (val) {
|
|
@@ -759,7 +762,7 @@
|
|
|
759
762
|
return null;
|
|
760
763
|
});
|
|
761
764
|
};
|
|
762
|
-
var validated =
|
|
765
|
+
var validated = this.handleInternalPlusValidation(settings, data);
|
|
763
766
|
changeFields(validated);
|
|
764
767
|
};
|
|
765
768
|
BaseDynamicArray.prototype.createOneControl = function (fieldName, ctrl, create) {
|
|
@@ -789,7 +792,7 @@
|
|
|
789
792
|
}
|
|
790
793
|
});
|
|
791
794
|
};
|
|
792
|
-
BaseDynamicArray.prototype.createControl = function () {
|
|
795
|
+
BaseDynamicArray.prototype.createControl = function (data) {
|
|
793
796
|
var _this = this;
|
|
794
797
|
var fields = this.fields;
|
|
795
798
|
if (!fields)
|
|
@@ -799,7 +802,13 @@
|
|
|
799
802
|
fields.forEach(function (field) {
|
|
800
803
|
var fieldType = field.fieldType, validations = field.validations, name = field.name, disabled = field.disabled, alwaysShow = field.alwaysShow;
|
|
801
804
|
var value = field.value;
|
|
802
|
-
if (
|
|
805
|
+
if (field.alwaysShowPlusValidation) {
|
|
806
|
+
if (_this.handleInternalPlusValidation(field.alwaysShowPlusValidation, data))
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
else if (!alwaysShow)
|
|
810
|
+
return;
|
|
811
|
+
if (fieldType === 'button')
|
|
803
812
|
return;
|
|
804
813
|
if (fieldType === 'radiobutton' || fieldType === 'checkbox' || fieldType === 'select') {
|
|
805
814
|
value = '';
|
|
@@ -873,6 +882,7 @@
|
|
|
873
882
|
.map(function (_, index) {
|
|
874
883
|
var form = _this.createControl();
|
|
875
884
|
if (data && data[index]) {
|
|
885
|
+
form = _this.createControl(data[index]);
|
|
876
886
|
var handledData = data[index];
|
|
877
887
|
Object.entries(handledData).forEach(function (_b) {
|
|
878
888
|
var _c = __read(_b, 2), key = _c[0], value = _c[1];
|
|
@@ -935,6 +945,8 @@
|
|
|
935
945
|
this._formErrors = {};
|
|
936
946
|
this._function = function (file, callback) {
|
|
937
947
|
var _a, _b, _c, _d;
|
|
948
|
+
if (_this._form.disable)
|
|
949
|
+
return;
|
|
938
950
|
if (!((_b = (_a = _this._field) === null || _a === void 0 ? void 0 : _a.functions) === null || _b === void 0 ? void 0 : _b.onHandleUpload)) {
|
|
939
951
|
console.error('onHandleUpload not declared');
|
|
940
952
|
return;
|
|
@@ -1076,7 +1088,7 @@
|
|
|
1076
1088
|
return MECXDynamicInputComponent;
|
|
1077
1089
|
}());
|
|
1078
1090
|
MECXDynamicInputComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: MECXDynamicInputComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1079
|
-
MECXDynamicInputComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: MECXDynamicInputComponent, selector: "mecx-dynamic-input", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<monkey-input\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [mask]=\"_field?.mask\" [prefix]=\"_field?.prefix\" [name]=\"_field?.name\"\n [formControl]=\"_form.controls[_field?.name]\" [placeholder]=\"_field?.placeholder | translate\"\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\n [type]=\"_field?.type\" #inputElement (onChange)=\"onChange($event)\"\n [onlyNumber]=\"_field?.onlyNumber\" [currency]=\"_field?.currency\" [maxLength]=\"_field?.maxLength\"\n [maxDateToday]=\"_field?.maxDateToday\">\n</monkey-input>", components: [{ type: i1__namespace$1.MonkeyInputComponent, selector: "monkey-input", inputs: ["name", "helperMessage", "placeholder", "maxLength", "maxDateToday", "value", "type", "label", "icon", "infoMessage", "errorMessage", "mask", "prefix", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency"], outputs: ["onChange"] }], directives: [{ type: i1__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i4__namespace.TranslatePipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
|
|
1091
|
+
MECXDynamicInputComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: MECXDynamicInputComponent, selector: "mecx-dynamic-input", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<monkey-input\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [mask]=\"_field?.mask\" [prefix]=\"_field?.prefix\" [name]=\"_field?.name\"\n [formControl]=\"_form.controls[_field?.name]\" [placeholder]=\"_field?.placeholder | translate\"\n [helperMessage]=\"_field?.helperMessage | translate\" [label]=\"_field?.label | translate\"\n [type]=\"_field?.type\" #inputElement (onChange)=\"onChange($event)\"\n [onlyNumber]=\"_field?.onlyNumber\" [currency]=\"_field?.currency\" [maxLength]=\"_field?.maxLength\"\n [maxDateToday]=\"_field?.maxDateToday\">\n</monkey-input>", components: [{ type: i1__namespace$1.MonkeyInputComponent, selector: "monkey-input", inputs: ["name", "helperMessage", "placeholder", "maxLength", "maxDateToday", "value", "type", "label", "icon", "infoMessage", "errorMessage", "mask", "prefix", "onlyNumber", "onlyAlphaNumeric", "upperCase", "lowerCase", "capitalize", "currency", "percent"], outputs: ["onChange"] }], directives: [{ type: i1__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], pipes: { "translate": i4__namespace.TranslatePipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
|
|
1080
1092
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: MECXDynamicInputComponent, decorators: [{
|
|
1081
1093
|
type: i0.Component,
|
|
1082
1094
|
args: [{
|
|
@@ -1155,15 +1167,24 @@
|
|
|
1155
1167
|
var _this = this;
|
|
1156
1168
|
var _a, _b;
|
|
1157
1169
|
var _c = this, _form = _c._form, _field = _c._field, self = _c.self;
|
|
1170
|
+
console.log('1');
|
|
1171
|
+
if (_form.disable)
|
|
1172
|
+
return;
|
|
1173
|
+
console.log('2');
|
|
1158
1174
|
var name = _field.name;
|
|
1175
|
+
console.log('3');
|
|
1159
1176
|
if ((_a = _field === null || _field === void 0 ? void 0 : _field.value) === null || _a === void 0 ? void 0 : _a.length)
|
|
1160
1177
|
return;
|
|
1178
|
+
console.log('4');
|
|
1161
1179
|
var _d = (_b = _field === null || _field === void 0 ? void 0 : _field.functions) === null || _b === void 0 ? void 0 : _b.onHandleGenericLoad, func = _d.func, url = _d.url;
|
|
1180
|
+
console.log('5');
|
|
1162
1181
|
if (!func || !self[func]) {
|
|
1163
1182
|
console.error('onHandleGenericLoad not declared');
|
|
1164
1183
|
return;
|
|
1165
1184
|
}
|
|
1185
|
+
console.log('6');
|
|
1166
1186
|
_form.disable();
|
|
1187
|
+
console.log('7');
|
|
1167
1188
|
self[func]({
|
|
1168
1189
|
name: name,
|
|
1169
1190
|
url: url,
|
|
@@ -1195,7 +1216,7 @@
|
|
|
1195
1216
|
return MECXDynamicSelectComponent;
|
|
1196
1217
|
}());
|
|
1197
1218
|
MECXDynamicSelectComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: MECXDynamicSelectComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1198
|
-
MECXDynamicSelectComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: MECXDynamicSelectComponent, selector: "mecx-dynamic-select", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, ngImport: i0__namespace, template: "
|
|
1219
|
+
MECXDynamicSelectComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.4", type: MECXDynamicSelectComponent, selector: "mecx-dynamic-select", inputs: { _field: "_field", _form: "_form", _formErrors: "_formErrors", self: "self" }, host: { properties: { "class": "this.className" } }, ngImport: i0__namespace, template: "<monkey-select\n errorMessage=\"{{ _formErrors[_field?.name]?.firstMessage | translate }} {{ _formErrors[_field?.name]?.lastMessage }}\"\n [formControl]=\"_form.controls[_field?.name]\" [helperMessage]=\"_field?.helperMessage | translate\"\n [label]=\"_field?.label | translate\" (click)=\"onHandleGenericLoad()\"\n [onHandleOptions]=\"_onHandleOptions\" (onChange)=\"onChange($event)\"\n [labelSelect]=\"_form.get(_field?.name).value || ('FIELD.SELECT' | translate)\">\n <monkey-option [label]=\"'FIELD.LOADING' | translate\" *ngIf=\"!_field?.value?.length\"\n enableClick=\"false\">\n </monkey-option>\n <monkey-option *ngFor=\"let value of _field?.value\" [label]=\"value.description | translate\"\n [value]=\"value.value\">\n </monkey-option>\n</monkey-select>", components: [{ type: i1__namespace$1.MonkeySelectComponent, selector: "monkey-select", inputs: ["labelSelect", "onHandleOptions", "value", "label", "helperMessage", "placeholder", "icon", "infoMessage", "errorMessage"], outputs: ["onChange"] }, { type: i1__namespace$1.MonkeyOptionComponent, selector: "monkey-option", inputs: ["type", "enableClick", "label", "value", "selectAll", "selected"], outputs: ["onSelectOption"] }], directives: [{ type: i1__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "translate": i4__namespace.TranslatePipe }, encapsulation: i0__namespace.ViewEncapsulation.None });
|
|
1199
1220
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: MECXDynamicSelectComponent, decorators: [{
|
|
1200
1221
|
type: i0.Component,
|
|
1201
1222
|
args: [{
|
|
@@ -1234,6 +1255,8 @@
|
|
|
1234
1255
|
var _this = this;
|
|
1235
1256
|
var _a, _b;
|
|
1236
1257
|
var _c = this, _form = _c._form, _field = _c._field, self = _c.self;
|
|
1258
|
+
if (_form.disable)
|
|
1259
|
+
return;
|
|
1237
1260
|
var name = _field.name;
|
|
1238
1261
|
if ((_a = _field === null || _field === void 0 ? void 0 : _field.value) === null || _a === void 0 ? void 0 : _a.length)
|
|
1239
1262
|
return;
|
|
@@ -1287,16 +1310,17 @@
|
|
|
1287
1310
|
button: MECXDynamicButtonComponent
|
|
1288
1311
|
};
|
|
1289
1312
|
var MECXDynamicDirective = /** @class */ (function () {
|
|
1290
|
-
function MECXDynamicDirective(resolver, container) {
|
|
1313
|
+
function MECXDynamicDirective(resolver, container, cdr) {
|
|
1291
1314
|
this.resolver = resolver;
|
|
1292
1315
|
this.container = container;
|
|
1316
|
+
this.cdr = cdr;
|
|
1293
1317
|
// not to do
|
|
1294
1318
|
}
|
|
1295
1319
|
MECXDynamicDirective.prototype.handleInternalPlusValidation = function () {
|
|
1296
1320
|
var _a, _b;
|
|
1297
1321
|
if (!((_a = this.field) === null || _a === void 0 ? void 0 : _a.alwaysShowPlusValidation))
|
|
1298
1322
|
return false;
|
|
1299
|
-
var
|
|
1323
|
+
var _d = (_b = this.field) === null || _b === void 0 ? void 0 : _b.alwaysShowPlusValidation, operator = _d.operator, value = _d.value, field = _d.field;
|
|
1300
1324
|
var validators = {
|
|
1301
1325
|
e: function (val1, val2) { return val1 === val2; },
|
|
1302
1326
|
lt: function (val1, val2) { return val1 < val2; },
|
|
@@ -1323,34 +1347,38 @@
|
|
|
1323
1347
|
this.buildComponent();
|
|
1324
1348
|
};
|
|
1325
1349
|
MECXDynamicDirective.prototype.ngOnChanges = function () {
|
|
1326
|
-
var
|
|
1350
|
+
var _this = this;
|
|
1351
|
+
var _a, _b, _c;
|
|
1327
1352
|
if (this.plusValidations && this.plusValidations[this.field.name]) {
|
|
1328
1353
|
if (!this.field.alwaysShow && this.plusValidations[this.field.name].alwaysShow) {
|
|
1329
|
-
this.
|
|
1330
|
-
|
|
1354
|
+
(_a = this.form.controls[this.field.name]) === null || _a === void 0 ? void 0 : _a.setValue(null);
|
|
1355
|
+
setTimeout(function () {
|
|
1356
|
+
_this.buildComponent();
|
|
1357
|
+
_this.cdr.detectChanges();
|
|
1358
|
+
}, 1);
|
|
1331
1359
|
return;
|
|
1332
1360
|
}
|
|
1333
|
-
if ((
|
|
1361
|
+
if ((_b = this.componentRef) === null || _b === void 0 ? void 0 : _b.instance) {
|
|
1334
1362
|
this.componentRef.destroy();
|
|
1335
1363
|
this.componentRef = null;
|
|
1336
1364
|
this.form.controls[this.field.name].setValue(null);
|
|
1337
1365
|
this.form.controls[this.field.name].clearValidators();
|
|
1338
1366
|
}
|
|
1339
1367
|
}
|
|
1340
|
-
if (!((
|
|
1368
|
+
if (!((_c = this.componentRef) === null || _c === void 0 ? void 0 : _c.instance))
|
|
1341
1369
|
return;
|
|
1342
1370
|
this.componentRef.instance._formErrors = this.formErrors || {};
|
|
1343
1371
|
};
|
|
1344
1372
|
return MECXDynamicDirective;
|
|
1345
1373
|
}());
|
|
1346
|
-
MECXDynamicDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: MECXDynamicDirective, deps: [{ token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.ViewContainerRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1374
|
+
MECXDynamicDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: MECXDynamicDirective, deps: [{ token: i0__namespace.ComponentFactoryResolver }, { token: i0__namespace.ViewContainerRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1347
1375
|
MECXDynamicDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.4", type: MECXDynamicDirective, selector: "[MECXDynamic]", inputs: { field: "field", form: "form", formErrors: "formErrors", self: "self", plusValidations: "plusValidations" }, usesOnChanges: true, ngImport: i0__namespace });
|
|
1348
1376
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.4", ngImport: i0__namespace, type: MECXDynamicDirective, decorators: [{
|
|
1349
1377
|
type: i0.Directive,
|
|
1350
1378
|
args: [{
|
|
1351
1379
|
selector: '[MECXDynamic]'
|
|
1352
1380
|
}]
|
|
1353
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.ComponentFactoryResolver }, { type: i0__namespace.ViewContainerRef }]; }, propDecorators: { field: [{
|
|
1381
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.ComponentFactoryResolver }, { type: i0__namespace.ViewContainerRef }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { field: [{
|
|
1354
1382
|
type: i0.Input
|
|
1355
1383
|
}], form: [{
|
|
1356
1384
|
type: i0.Input
|