@sankhyalabs/ezui 5.22.0-dev.5 → 5.22.0-dev.51
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/dist/cjs/DataBinder-3b083480.js +445 -0
- package/dist/cjs/FocusResolver-885f2173.js +35 -0
- package/dist/cjs/ez-button.cjs.entry.js +11 -5
- package/dist/cjs/ez-card-item_3.cjs.entry.js +21 -6
- package/dist/cjs/ez-chart.cjs.entry.js +1 -1
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +64 -11
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +35 -5
- package/dist/cjs/ez-date-input.cjs.entry.js +12 -3
- package/dist/cjs/ez-date-time-input.cjs.entry.js +9 -3
- package/dist/cjs/ez-dialog.cjs.entry.js +10 -2
- package/dist/cjs/{ez-dropdown.cjs.entry.js → ez-dropdown_2.cjs.entry.js} +75 -8
- package/dist/cjs/ez-form-view.cjs.entry.js +5 -4
- package/dist/cjs/ez-form.cjs.entry.js +5 -325
- package/dist/cjs/ez-grid.cjs.entry.js +14701 -70252
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +6 -7
- package/dist/cjs/ez-modal-container.cjs.entry.js +2 -1
- package/dist/cjs/ez-modal.cjs.entry.js +19 -4
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +13 -1
- package/dist/cjs/ez-popup.cjs.entry.js +21 -2
- package/dist/cjs/ez-scroller_2.cjs.entry.js +3 -3
- package/dist/cjs/ez-search.cjs.entry.js +107 -44
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-panel.cjs.entry.js +14 -4
- package/dist/cjs/ez-text-area.cjs.entry.js +67 -5
- package/dist/cjs/ez-text-input.cjs.entry.js +51 -5
- package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-9e5554cb.js +2 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-button/ez-button.css +23 -13
- package/dist/collection/components/ez-button/ez-button.js +12 -6
- package/dist/collection/components/ez-card-item/ez-card-item.css +60 -10
- package/dist/collection/components/ez-card-item/ez-card-item.js +30 -3
- package/dist/collection/components/ez-check/ez-check.css +1 -6
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +2 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +109 -13
- package/dist/collection/components/ez-date-input/ez-date-input.css +1 -1
- package/dist/collection/components/ez-date-input/ez-date-input.js +38 -4
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.css +1 -1
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
- package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
- package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
- package/dist/collection/components/ez-dropdown/ez-dropdown.js +33 -8
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +35 -4
- package/dist/collection/components/ez-form/ez-form.js +1 -0
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +49 -6
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +3 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +254 -53
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +107 -5
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +219 -42
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +16 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +8 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +2 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +4 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +2 -0
- package/dist/collection/components/ez-grid/ez-grid.css +17 -7
- package/dist/collection/components/ez-grid/ez-grid.js +181 -7
- package/dist/collection/components/ez-icon/ez-icon.css +153 -149
- package/dist/collection/components/ez-list/ez-list.css +2 -1
- package/dist/collection/components/ez-list/ez-list.js +6 -7
- package/dist/collection/components/ez-modal/ez-modal.css +5 -1
- package/dist/collection/components/ez-modal/ez-modal.js +38 -5
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +20 -1
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +1 -1
- package/dist/collection/components/ez-number-input/ez-number-input.js +49 -1
- package/dist/collection/components/ez-popup/ez-popup.css +7 -3
- package/dist/collection/components/ez-popup/ez-popup.js +38 -1
- package/dist/collection/components/ez-scroller/ez-scroller.css +1 -0
- package/dist/collection/components/ez-search/ez-search.css +21 -10
- package/dist/collection/components/ez-search/ez-search.js +173 -48
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +3 -0
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
- package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +3 -1
- package/dist/collection/components/ez-split-button/ez-split-button.css +50 -14
- package/dist/collection/components/ez-split-button/ez-split-button.js +3 -3
- package/dist/collection/components/ez-split-panel/ez-split-panel.js +35 -4
- package/dist/collection/components/ez-split-panel/interfaces/IPanelSizeInfo.js +1 -0
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +1 -0
- package/dist/collection/components/ez-text-area/ez-text-area.css +73 -28
- package/dist/collection/components/ez-text-area/ez-text-area.js +103 -3
- package/dist/collection/components/ez-text-input/ez-text-input.css +41 -71
- package/dist/collection/components/ez-text-input/ez-text-input.js +86 -4
- package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
- package/dist/collection/sw.js +46 -0
- package/dist/collection/utils/FocusResolver.js +31 -0
- package/dist/collection/utils/form/DataBinder.js +20 -5
- package/dist/collection/utils/form/FormMetadata.js +1 -1
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
- package/dist/collection/utils/validators/recordvalidator/IInvalidCells.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +7 -1
- package/dist/custom-elements/index.js +15603 -70736
- package/dist/esm/DataBinder-02fa9bb9.js +441 -0
- package/dist/esm/FocusResolver-1ccbf850.js +33 -0
- package/dist/esm/ez-button.entry.js +11 -5
- package/dist/esm/ez-card-item_3.entry.js +21 -6
- package/dist/esm/ez-chart.entry.js +1 -1
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +65 -12
- package/dist/esm/ez-custom-form-input_2.entry.js +36 -6
- package/dist/esm/ez-date-input.entry.js +12 -3
- package/dist/esm/ez-date-time-input.entry.js +9 -3
- package/dist/esm/ez-dialog.entry.js +10 -2
- package/dist/esm/{ez-dropdown.entry.js → ez-dropdown_2.entry.js} +75 -9
- package/dist/esm/ez-form-view.entry.js +5 -4
- package/dist/esm/ez-form.entry.js +4 -324
- package/dist/esm/ez-grid.entry.js +14754 -70305
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +6 -7
- package/dist/esm/ez-modal-container.entry.js +2 -1
- package/dist/esm/ez-modal.entry.js +19 -4
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +13 -1
- package/dist/esm/ez-popup.entry.js +21 -2
- package/dist/esm/ez-scroller_2.entry.js +3 -3
- package/dist/esm/ez-search.entry.js +107 -44
- package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +2 -2
- package/dist/esm/ez-split-item.entry.js +1 -1
- package/dist/esm/ez-split-panel.entry.js +15 -5
- package/dist/esm/ez-text-area.entry.js +67 -5
- package/dist/esm/ez-text-input.entry.js +51 -5
- package/dist/esm/ez-time-input.entry.js +6 -0
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-5a720e56.js +2 -6
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-16e21a40.entry.js +1 -0
- package/dist/ezui/p-2a7f7580.entry.js +1 -0
- package/dist/ezui/p-2f53435e.entry.js +1 -0
- package/dist/ezui/p-33675dae.entry.js +1 -0
- package/dist/ezui/p-397e3026.entry.js +1 -0
- package/dist/ezui/p-3af64edd.entry.js +1 -0
- package/dist/ezui/p-3c10cd94.entry.js +1 -0
- package/dist/ezui/p-3cc9b84a.entry.js +1 -0
- package/dist/ezui/p-3d38bfea.entry.js +1 -0
- package/dist/ezui/p-455e737c.js +1 -0
- package/dist/ezui/p-46a46507.entry.js +1 -0
- package/dist/ezui/p-554522db.entry.js +1 -0
- package/dist/ezui/p-6bc25bc8.entry.js +1 -0
- package/dist/ezui/p-6bda82d1.entry.js +1 -0
- package/dist/ezui/p-6d31c43c.entry.js +1 -0
- package/dist/ezui/p-6f0422ff.entry.js +309 -0
- package/dist/ezui/p-70f1c812.entry.js +1 -0
- package/dist/ezui/p-7f5afb1f.entry.js +1 -0
- package/dist/ezui/p-8f026744.entry.js +1 -0
- package/dist/ezui/p-a4ee2991.entry.js +1 -0
- package/dist/ezui/{p-82ac8b06.entry.js → p-a563df31.entry.js} +1 -1
- package/dist/ezui/p-a921e3e7.entry.js +1 -0
- package/dist/ezui/p-b858fc6e.entry.js +1 -0
- package/dist/ezui/p-be34c77f.entry.js +1 -0
- package/dist/ezui/{p-9aa27e69.entry.js → p-bef7daac.entry.js} +1 -1
- package/dist/ezui/p-bfc30e61.entry.js +1 -0
- package/dist/ezui/p-bfc59380.entry.js +1 -0
- package/dist/ezui/p-d960a031.entry.js +1 -0
- package/dist/ezui/p-dc628ed3.js +1 -0
- package/dist/ezui/{p-33792b2b.entry.js → p-e18d9e6a.entry.js} +1 -1
- package/dist/ezui/{p-31674f8e.entry.js → p-e7395eae.entry.js} +1 -1
- package/dist/ezui/p-efbe0b73.entry.js +1 -0
- package/dist/types/components/ez-button/ez-button.d.ts +2 -1
- package/dist/types/components/ez-card-item/ez-card-item.d.ts +5 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +12 -1
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
- package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +4 -0
- package/dist/types/components/ez-dropdown/structure/DropdownItem.d.ts +1 -1
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +6 -1
- package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +7 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +56 -4
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +32 -4
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +23 -1
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +33 -7
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +4 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +2 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +27 -1
- package/dist/types/components/ez-modal/ez-modal.d.ts +7 -1
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +4 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +8 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +7 -0
- package/dist/types/components/ez-search/ez-search.d.ts +25 -5
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +1 -1
- package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +4 -0
- package/dist/types/components/ez-split-panel/interfaces/IPanelSizeInfo.d.ts +9 -0
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
- package/dist/types/components.d.ts +218 -20
- package/dist/types/utils/FocusResolver.d.ts +5 -0
- package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +2 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/dist/types/utils/validators/recordvalidator/IInvalidCells.d.ts +5 -0
- package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +1 -1
- package/package.json +12 -4
- package/dist/cjs/RecordValidationProcessor-4c893e04.js +0 -102
- package/dist/cjs/ez-skeleton.cjs.entry.js +0 -67
- package/dist/esm/RecordValidationProcessor-b00b8b77.js +0 -99
- package/dist/esm/ez-skeleton.entry.js +0 -63
- package/dist/ezui/p-044d46d5.entry.js +0 -1
- package/dist/ezui/p-04f24913.js +0 -1
- package/dist/ezui/p-11b09aa1.entry.js +0 -1
- package/dist/ezui/p-24ca32a3.entry.js +0 -1
- package/dist/ezui/p-2af4e2de.entry.js +0 -1
- package/dist/ezui/p-33b08253.entry.js +0 -304
- package/dist/ezui/p-36180f4d.entry.js +0 -1
- package/dist/ezui/p-3f8c33e0.entry.js +0 -1
- package/dist/ezui/p-5fefcdc9.entry.js +0 -1
- package/dist/ezui/p-752c4069.entry.js +0 -1
- package/dist/ezui/p-81cffa53.entry.js +0 -1
- package/dist/ezui/p-81f99ace.entry.js +0 -1
- package/dist/ezui/p-8eef0f70.entry.js +0 -1
- package/dist/ezui/p-9634631d.entry.js +0 -1
- package/dist/ezui/p-9a11e223.entry.js +0 -1
- package/dist/ezui/p-9a23d513.entry.js +0 -1
- package/dist/ezui/p-9c2e2d68.entry.js +0 -1
- package/dist/ezui/p-a35b41e6.entry.js +0 -1
- package/dist/ezui/p-acbf0e76.entry.js +0 -1
- package/dist/ezui/p-b0e71d23.entry.js +0 -1
- package/dist/ezui/p-c3b7a23e.entry.js +0 -1
- package/dist/ezui/p-cd1a2e6b.entry.js +0 -1
- package/dist/ezui/p-dbeee5aa.entry.js +0 -1
- package/dist/ezui/p-de870657.entry.js +0 -1
- package/dist/ezui/p-e151e795.entry.js +0 -1
- package/dist/ezui/p-ee9315ff.entry.js +0 -1
- package/dist/ezui/p-f1c3f85d.entry.js +0 -1
- package/dist/ezui/p-f291db18.entry.js +0 -1
|
@@ -283,6 +283,7 @@ const EzDropdown = class {
|
|
|
283
283
|
this.ezClick = createEvent(this, "ezClick", 7);
|
|
284
284
|
this.ezSubActionClick = createEvent(this, "ezSubActionClick", 7);
|
|
285
285
|
this.ezOutsideClick = createEvent(this, "ezOutsideClick", 7);
|
|
286
|
+
this.ezHover = createEvent(this, "ezHover", 7);
|
|
286
287
|
this._itemList = {};
|
|
287
288
|
this._submenuList = [];
|
|
288
289
|
this._openedMenuList = {};
|
|
@@ -403,14 +404,19 @@ const EzDropdown = class {
|
|
|
403
404
|
}
|
|
404
405
|
return groupItems.map((item) => {
|
|
405
406
|
var _a;
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
h("div", { ref: (ref) => this.
|
|
413
|
-
|
|
407
|
+
switch (item.type) {
|
|
408
|
+
case "loading":
|
|
409
|
+
return (h("div", { class: "ez-dropdown__item" }, h("ez-skeleton", { width: '200px' })));
|
|
410
|
+
case "divider":
|
|
411
|
+
return (h("hr", Object.assign({ class: "ez-dropdown__divider" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`${item.id}_ezDropdownDivider`) })));
|
|
412
|
+
case "item":
|
|
413
|
+
return (h("div", Object.assign({ ref: (ref) => this._itemList[item.id] = ref, class: "ez-dropdown__item", "data-level": level }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`${item.id}_ezDropdownItem`) }), h("div", { class: "ez-dropdown__item-content", onClick: (evt) => this.onItemClick(evt, item), onMouseOver: (evt) => this.onShowSubmenu(evt, item), onMouseEnter: () => this.ezHover.emit(item) }, this.itemBuilder
|
|
414
|
+
? this.getContainerItemBuilder(item, level, isLockedLevels, hasIcon, hasChildren)
|
|
415
|
+
: this.defaultItemBuilder(item, isLockedLevels, hasIcon, hasChildren)), ((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
416
|
+
!isLockedLevels &&
|
|
417
|
+
hasChildren &&
|
|
418
|
+
h("div", { ref: (ref) => this._submenuList.push(ref), class: "ez-dropdown__submenu ez-dropdown__submenu--hide" }, this.renderDropdown(item.children, counterLevel))));
|
|
419
|
+
}
|
|
414
420
|
});
|
|
415
421
|
}
|
|
416
422
|
renderDropdown(branchItems = this.items, level = 1) {
|
|
@@ -514,4 +520,64 @@ const EzDropdown = class {
|
|
|
514
520
|
};
|
|
515
521
|
EzDropdown.style = ezDropdownCss;
|
|
516
522
|
|
|
517
|
-
|
|
523
|
+
const ALLOWED_ANIMATIONS = ['progress', 'progress-dark', 'pulse', 'false'];
|
|
524
|
+
|
|
525
|
+
const ezSkeletonCss = ".skeleton {\n\tbox-sizing: border-box;\n\toutline: none;\n\toverflow: hidden;\n\tposition: relative;\n\n\tbackground:var(--skeleton-background, #eff1f6) no-repeat;\n\n\tborder-radius: var(--skeleton-border-radius, 4px);\n\twidth: var(--skeleton-width, 100%);\n\theight: var(--skeleton-height, 20px);\n\tdisplay: inline-block;\n\tmargin-bottom: var(--skeleton-margin-bottom, 0px);\n\twill-change: transform;\n\n\t&:after,\n\t&:before {\n\t\tbox-sizing: border-box;\n\t}\n\n\t&.circle {\n\t\twidth: var(--skeleton-width, 40px);\n\t\theight: var(--skeleton-height, 40px);\n\t\tmargin-bottom: var(--skeleton-margin-bottom, 5px);\n\t\tborder-radius: var(--skeleton-border-radius, 50%);\n\t}\n\n\t&.rect {\n\t\tborder-radius: var(--skeleton-border-radius, 0px);\n\t}\n\n\t&.progress,\n\t&.progress-dark {\n\t\tanimation: progress 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tbackground-size: 200px 100%;\n\t}\n\n\t&.progress {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\trgba(255, 255, 255, 0),\n\t\t\trgba(255, 255, 255, 0.6),\n\t\t\trgba(255, 255, 255, 0)\n\t\t);\n\t}\n\n\t&.progress-dark {\n\t\tbackground-image: linear-gradient(\n\t\t\t90deg,\n\t\t\ttransparent,\n\t\t\trgba(0, 0, 0, 0.2),\n\t\t\ttransparent\n\t\t);\n\t}\n\n\t&.pulse {\n\t\tanimation: pulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n\t\tanimation-delay: 0.5s;\n\t}\n\n\t@media (prefers-reduced-motion: reduce) {\n\t\t&.pulse,\n\t\t&.progress-dark,\n\t\t&.progress {\n\t\t\tanimation: none;\n\t\t}\n\n\t\t&.progress,\n\t\t&.progress-dark {\n\t\t\tbackground-image: none;\n\t\t}\n\t}\n}\n\n@keyframes progress {\n\t0% {\n\t\tbackground-position: -200px 0;\n\t}\n\t100% {\n\t\tbackground-position: calc(200px + 100%) 0;\n\t}\n}\n\n@keyframes pulse {\n\t0% {\n\t\topacity: 1;\n\t}\n\t50% {\n\t\topacity: 0.4;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}";
|
|
526
|
+
|
|
527
|
+
const EzSkeleton = class {
|
|
528
|
+
constructor(hostRef) {
|
|
529
|
+
registerInstance(this, hostRef);
|
|
530
|
+
this.items = [];
|
|
531
|
+
this.count = 1;
|
|
532
|
+
this.variant = 'text';
|
|
533
|
+
this.width = null;
|
|
534
|
+
this.height = null;
|
|
535
|
+
this.marginBottom = null;
|
|
536
|
+
this.animation = 'progress';
|
|
537
|
+
}
|
|
538
|
+
componentWillLoad() {
|
|
539
|
+
this.init();
|
|
540
|
+
}
|
|
541
|
+
componentWillUpdate() {
|
|
542
|
+
this.init();
|
|
543
|
+
}
|
|
544
|
+
init() {
|
|
545
|
+
this.items.length = this.count;
|
|
546
|
+
this.items.fill(1);
|
|
547
|
+
if (!ALLOWED_ANIMATIONS.includes(this.animation)) {
|
|
548
|
+
this.animation = 'progress';
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
get style() {
|
|
552
|
+
let dimenssionsStyles = {
|
|
553
|
+
width: null,
|
|
554
|
+
height: null,
|
|
555
|
+
marginBottom: null
|
|
556
|
+
};
|
|
557
|
+
if (this.width) {
|
|
558
|
+
dimenssionsStyles.width = this.width;
|
|
559
|
+
}
|
|
560
|
+
if (this.height) {
|
|
561
|
+
dimenssionsStyles.height = this.height;
|
|
562
|
+
}
|
|
563
|
+
if (this.marginBottom) {
|
|
564
|
+
dimenssionsStyles.marginBottom = this.marginBottom;
|
|
565
|
+
}
|
|
566
|
+
return dimenssionsStyles;
|
|
567
|
+
}
|
|
568
|
+
render() {
|
|
569
|
+
return this.items.map((_, index) => {
|
|
570
|
+
return (h("span", { key: index, class: {
|
|
571
|
+
circle: this.variant === 'circle',
|
|
572
|
+
rect: this.variant === 'rect',
|
|
573
|
+
progress: this.animation === 'progress',
|
|
574
|
+
'progress-dark': this.animation === 'progress-dark',
|
|
575
|
+
pulse: this.animation === 'pulse',
|
|
576
|
+
skeleton: true
|
|
577
|
+
}, "data-busy": "true", "data-valuemin": "0", "data-valuemax": "100", "data-valuetext": "Loading...", role: "progressbar", tabindex: "0", style: this.style }));
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
EzSkeleton.style = ezSkeletonCss;
|
|
582
|
+
|
|
583
|
+
export { EzDropdown as ez_dropdown, EzSkeleton as ez_skeleton };
|
|
@@ -68,9 +68,10 @@ function buildNumeric(fieldName, fieldLabel, readOnly, precision, prettyPrecisio
|
|
|
68
68
|
h("ez-number-input", { enabled: !readOnly, label: fieldLabel, precision: precision, prettyPrecision: prettyPrecision, "data-field-name": fieldName, "data-context-name": contextName, key: fieldName, canShowError: canShowError })));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const buildSearch = ({ name, label, readOnly, required, contextName, canShowError, optionLoader }) => {
|
|
71
|
+
const buildSearch = ({ name, label, readOnly, required, contextName, canShowError, optionLoader, props }) => {
|
|
72
|
+
var _a;
|
|
72
73
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
73
|
-
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, optionLoader: optionLoader })));
|
|
74
|
+
h("ez-search", { enabled: !readOnly, suppressEmptyOption: required, label: label, "data-field-name": name, "data-context-name": contextName, key: name, canShowError: canShowError, optionLoader: optionLoader, ignoreLimitCharsToSearch: (_a = props.ignoreLimitCharsToSearch) !== null && _a !== void 0 ? _a : false })));
|
|
74
75
|
};
|
|
75
76
|
|
|
76
77
|
const buildTextArea = ({ name, label, readOnly, contextName, rows, canShowError }) => {
|
|
@@ -78,9 +79,9 @@ const buildTextArea = ({ name, label, readOnly, contextName, rows, canShowError
|
|
|
78
79
|
h("ez-text-area", { enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, rows: rows, canShowError: canShowError })));
|
|
79
80
|
};
|
|
80
81
|
|
|
81
|
-
const buildTextInput = ({ name, label, readOnly, contextName, canShowError }) => {
|
|
82
|
+
const buildTextInput = ({ name, label, readOnly, contextName, canShowError, props }) => {
|
|
82
83
|
return (h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
|
|
83
|
-
h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError })));
|
|
84
|
+
h("ez-text-input", { label: label, "data-field-name": name, "data-context-name": contextName, key: name, enabled: !readOnly, canShowError: canShowError, mask: props === null || props === void 0 ? void 0 : props.mask, "clean-value-mask": props === null || props === void 0 ? void 0 : props.cleanValueMask })));
|
|
84
85
|
};
|
|
85
86
|
|
|
86
87
|
const uiBuilders = new Map();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, f as forceUpdate, H as Host, g as getElement } from './index-5a720e56.js';
|
|
2
|
-
import { DateUtils, Action, StringUtils,
|
|
3
|
-
import { b as buildFieldMetadata,
|
|
2
|
+
import { DateUtils, Action, StringUtils, DataUnit, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { b as buildFieldMetadata, D as DataBinder } from './DataBinder-02fa9bb9.js';
|
|
4
4
|
import './ApplicationUtils-eaf91331.js';
|
|
5
5
|
import './DialogType-54a62731.js';
|
|
6
6
|
|
|
@@ -101,7 +101,7 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
const descriptor = dataUnit.getField(field.name);
|
|
104
|
-
if (descriptor && tabConfig.visible) {
|
|
104
|
+
if (descriptor && descriptor.visible && tabConfig.visible) {
|
|
105
105
|
if (!sheets.has(tabConfig)) {
|
|
106
106
|
sheets.set(tabConfig, []);
|
|
107
107
|
}
|
|
@@ -179,327 +179,6 @@ const buildDetailSheet = (child) => {
|
|
|
179
179
|
};
|
|
180
180
|
};
|
|
181
181
|
|
|
182
|
-
class DataBinder {
|
|
183
|
-
constructor(dataUnit) {
|
|
184
|
-
this.onDataUnitEvent = (action) => {
|
|
185
|
-
var _a, _b;
|
|
186
|
-
switch (action.type) {
|
|
187
|
-
case Action.DATA_LOADED:
|
|
188
|
-
case Action.DATA_SAVED:
|
|
189
|
-
case Action.RECORDS_REMOVED:
|
|
190
|
-
case Action.RECORDS_ADDED:
|
|
191
|
-
case Action.RECORDS_COPIED:
|
|
192
|
-
case Action.EDITION_CANCELED:
|
|
193
|
-
case Action.SELECTION_CHANGED:
|
|
194
|
-
case Action.NEXT_SELECTED:
|
|
195
|
-
case Action.PREVIOUS_SELECTED:
|
|
196
|
-
this.clearInvalid();
|
|
197
|
-
case Action.DATA_CHANGED:
|
|
198
|
-
case Action.CHANGE_UNDONE:
|
|
199
|
-
case Action.CHANGE_REDONE:
|
|
200
|
-
case Action.RECORD_LOADED:
|
|
201
|
-
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
202
|
-
this.updateValue(field.fieldName, field.field);
|
|
203
|
-
});
|
|
204
|
-
break;
|
|
205
|
-
case Action.FIELD_INVALIDATED:
|
|
206
|
-
(_b = this._fields) === null || _b === void 0 ? void 0 : _b.forEach(field => {
|
|
207
|
-
this.updateErrorMessage(field.fieldName, field.field);
|
|
208
|
-
});
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
this._uuid = StringUtils.generateUUID();
|
|
213
|
-
this._fields = new Map();
|
|
214
|
-
this._dataUnit = dataUnit;
|
|
215
|
-
this.applyDefaultValues();
|
|
216
|
-
this._dataUnit.subscribe(this.onDataUnitEvent);
|
|
217
|
-
this._dataUnit.addInterceptor(this);
|
|
218
|
-
this.setContextDataBinder(dataUnit);
|
|
219
|
-
}
|
|
220
|
-
get dataBinderId() {
|
|
221
|
-
return this._uuid;
|
|
222
|
-
}
|
|
223
|
-
setContextDataBinder(dataUnit) {
|
|
224
|
-
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
225
|
-
const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
|
|
226
|
-
dataBindersByDataUnit.set(dataUnit.dataUnitId, dataBinders);
|
|
227
|
-
ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
|
|
228
|
-
}
|
|
229
|
-
applyDefaultValues() {
|
|
230
|
-
const recordIds = (this._dataUnit.getAddedRecords() || []).map(r => r.__record__id__);
|
|
231
|
-
if (recordIds.length > 0) {
|
|
232
|
-
const defaultValues = this.getDefaultValues();
|
|
233
|
-
if (defaultValues) {
|
|
234
|
-
Object.keys(defaultValues).forEach(field => {
|
|
235
|
-
this._dataUnit.setFieldValue(field, defaultValues[field], recordIds);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
bind(fields, currentContextName, formMetadata, recordsValidator) {
|
|
241
|
-
fields.forEach(fieldElement => {
|
|
242
|
-
const { fieldName, contextName } = fieldElement.dataset;
|
|
243
|
-
if (contextName == undefined || contextName === currentContextName) {
|
|
244
|
-
this.updateBind(fieldName, fieldElement);
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
this._formMetadata = formMetadata;
|
|
248
|
-
this._recordValidatorProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
249
|
-
getRequiredFields: () => this._formMetadata.getRequiredFields(),
|
|
250
|
-
markAsInvalid: field => this.markInvalid(field),
|
|
251
|
-
getMessageForField: field => this.getErrorMessage(field)
|
|
252
|
-
}, recordsValidator);
|
|
253
|
-
}
|
|
254
|
-
disconnectDataUnit() {
|
|
255
|
-
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
256
|
-
const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
|
|
257
|
-
const dataBindersFiltered = dataBinders.filter((dataBinder) => dataBinder.dataBinderId !== this.dataBinderId);
|
|
258
|
-
dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
|
|
259
|
-
ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
|
|
260
|
-
}
|
|
261
|
-
onDisconnectedCallback() {
|
|
262
|
-
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
263
|
-
this._dataUnit.removeInterceptor(this);
|
|
264
|
-
this.disconnectDataUnit();
|
|
265
|
-
}
|
|
266
|
-
getCurrentRecordId() {
|
|
267
|
-
const record = this._dataUnit.getSelectedRecord();
|
|
268
|
-
return record === null || record === void 0 ? void 0 : record.__record__id__;
|
|
269
|
-
}
|
|
270
|
-
markInvalid(field) {
|
|
271
|
-
if (this._fields.has(field.name)) {
|
|
272
|
-
const fieldElement = this._fields.get(field.name).field;
|
|
273
|
-
this.updateErrorMessage(field.name, fieldElement, field.message);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
setFocus(fieldName) {
|
|
277
|
-
if (!this._fields.has(fieldName)) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
const fieldElement = this._fields.get(fieldName).field;
|
|
281
|
-
if (typeof fieldElement["setFocus"] != "function") {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
fieldElement["setFocus"]();
|
|
285
|
-
}
|
|
286
|
-
clearInvalid(recordId) {
|
|
287
|
-
this._dataUnit.clearInvalid(recordId);
|
|
288
|
-
this._fields.forEach(fieldBinder => {
|
|
289
|
-
const fieldElement = fieldBinder.field;
|
|
290
|
-
fieldElement["errorMessage"] = "";
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
updateValue(fieldName, field) {
|
|
294
|
-
const bind = this._fields.get(fieldName);
|
|
295
|
-
try {
|
|
296
|
-
if (bind) {
|
|
297
|
-
bind.listen = false;
|
|
298
|
-
}
|
|
299
|
-
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
300
|
-
this.updateErrorMessage(fieldName, field);
|
|
301
|
-
}
|
|
302
|
-
finally {
|
|
303
|
-
if (bind) {
|
|
304
|
-
bind.listen = true;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
validate() {
|
|
309
|
-
return this._recordValidatorProcessor.validate();
|
|
310
|
-
}
|
|
311
|
-
static async validateByDataunit(dataUnit) {
|
|
312
|
-
try {
|
|
313
|
-
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__");
|
|
314
|
-
const dataBinders = dataBindersByDataUnit.get(dataUnit.dataUnitId) || [];
|
|
315
|
-
await Promise.all(dataBinders.map((dataBinder) => dataBinder.validate()));
|
|
316
|
-
return true;
|
|
317
|
-
}
|
|
318
|
-
catch (_a) {
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
updateErrorMessage(fieldName, field, message) {
|
|
323
|
-
if (message == undefined) {
|
|
324
|
-
message = this._dataUnit.getInvalidMessage(this.getCurrentRecordId(), fieldName);
|
|
325
|
-
}
|
|
326
|
-
if (!field["errorMessage"]) {
|
|
327
|
-
field["errorMessage"] = message;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
getErrorMessage(fieldName) {
|
|
331
|
-
if (this._fields.has(fieldName)) {
|
|
332
|
-
const fieldElement = this._fields.get(fieldName).field;
|
|
333
|
-
return fieldElement["errorMessage"];
|
|
334
|
-
}
|
|
335
|
-
return undefined;
|
|
336
|
-
}
|
|
337
|
-
updateBind(fieldName, field) {
|
|
338
|
-
const oldBind = this._fields.get(fieldName);
|
|
339
|
-
if (oldBind) {
|
|
340
|
-
oldBind.destroy();
|
|
341
|
-
}
|
|
342
|
-
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
343
|
-
this.updateErrorMessage(fieldName, field);
|
|
344
|
-
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
345
|
-
this.bindSearchOptionsLoader(fieldName, field);
|
|
346
|
-
this.applyEzUploadContext(fieldName, field);
|
|
347
|
-
}
|
|
348
|
-
changeStarted(fieldName, waitingChange) {
|
|
349
|
-
/**
|
|
350
|
-
* se o waitingChange não é blocante, add um event listener pra
|
|
351
|
-
* fazer o accept da promise
|
|
352
|
-
*
|
|
353
|
-
* se não tiver promise no waitingChange, eu crio uma e resolvo no bind
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*/
|
|
357
|
-
if (this._dataUnit.records.length === 0) {
|
|
358
|
-
this._dataUnit.addRecord();
|
|
359
|
-
}
|
|
360
|
-
if (!waitingChange.blocking && waitingChange.promise == undefined) {
|
|
361
|
-
const bind = this._fields.get(fieldName);
|
|
362
|
-
if (bind) {
|
|
363
|
-
waitingChange.promise = new Promise((resolve, reject) => {
|
|
364
|
-
bind.waitingChangePromiseResolve = resolve;
|
|
365
|
-
bind.waitingChangePromiseReject = reject;
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
this._dataUnit.startChange(fieldName, waitingChange);
|
|
370
|
-
}
|
|
371
|
-
cancelWaitingChange(fieldName) {
|
|
372
|
-
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
373
|
-
this._dataUnit.cancelWaitingChange(fieldName);
|
|
374
|
-
const bind = this._fields.get(fieldName);
|
|
375
|
-
if (bind) {
|
|
376
|
-
bind.rejectWaitingChange(new WaitingChangeException("Change canceled", fieldName));
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
setFieldValue(fieldName, newValue) {
|
|
381
|
-
if (this._dataUnit.records.length === 0) {
|
|
382
|
-
this._dataUnit.addRecord();
|
|
383
|
-
}
|
|
384
|
-
this._dataUnit.clearInvalid(this.getCurrentRecordId(), fieldName);
|
|
385
|
-
const record = this._dataUnit.getSelectedRecord();
|
|
386
|
-
this._dataUnit.setFieldValue(fieldName, newValue, record ? [record.__record__id__] : undefined);
|
|
387
|
-
if (this._dataUnit.waitingForChange(fieldName)) {
|
|
388
|
-
const bind = this._fields.get(fieldName);
|
|
389
|
-
if (bind) {
|
|
390
|
-
bind.acceptWaitingChange();
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
bindSearchOptionsLoader(fieldName, field) {
|
|
395
|
-
if (field.nodeName === "EZ-SEARCH" && field["optionLoader"] == undefined) {
|
|
396
|
-
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
397
|
-
if (loader) {
|
|
398
|
-
field["optionLoader"] = (arg) => {
|
|
399
|
-
return loader(arg, fieldName, this._dataUnit);
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
applyEzUploadContext(fieldName, field) {
|
|
405
|
-
var _a, _b;
|
|
406
|
-
if (field.nodeName === "EZ-UPLOAD") {
|
|
407
|
-
field["urlUpload"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__ADD__URL__");
|
|
408
|
-
field["urlDelete"] = ApplicationContext.getContextValue("__EZUI__UPLOAD__DEL__URL__");
|
|
409
|
-
const descriptor = this._dataUnit.getField(fieldName);
|
|
410
|
-
const destination = (_a = descriptor.properties) === null || _a === void 0 ? void 0 : _a.DESTINATION;
|
|
411
|
-
if (destination) {
|
|
412
|
-
field["requestHeaders"] = { XTRAINF: `{"destination": "${destination}"}` };
|
|
413
|
-
}
|
|
414
|
-
field["maxFiles"] = ((_b = descriptor.properties) === null || _b === void 0 ? void 0 : _b.MAX_FILES) || 0;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
interceptAction(action) {
|
|
418
|
-
if (action.type === Action.RECORDS_COPIED) {
|
|
419
|
-
const cleanFields = this._formMetadata.getCleanOnCopyFields();
|
|
420
|
-
if (cleanFields) {
|
|
421
|
-
const records = action.payload;
|
|
422
|
-
return new DataUnitAction(Action.RECORDS_COPIED, records.map(record => {
|
|
423
|
-
const newRecord = Object.assign({}, record);
|
|
424
|
-
cleanFields.forEach(fieldName => delete newRecord[fieldName]);
|
|
425
|
-
return newRecord;
|
|
426
|
-
}));
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
if (action.type === Action.SAVING_DATA) {
|
|
430
|
-
return new Promise((resolve) => {
|
|
431
|
-
this.validate()
|
|
432
|
-
.then(() => resolve(action))
|
|
433
|
-
.catch(() => { });
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
if (action.type === Action.RECORDS_ADDED) {
|
|
437
|
-
const defaultValues = this.getDefaultValues();
|
|
438
|
-
if (defaultValues) {
|
|
439
|
-
const records = action.payload;
|
|
440
|
-
return new DataUnitAction(Action.RECORDS_ADDED, records.map(record => {
|
|
441
|
-
return Object.assign(Object.assign({}, record), defaultValues);
|
|
442
|
-
}));
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
return action;
|
|
446
|
-
}
|
|
447
|
-
getDefaultValues() {
|
|
448
|
-
var _a;
|
|
449
|
-
const rawDefaultValues = (_a = this._formMetadata) === null || _a === void 0 ? void 0 : _a.getDefaultValues();
|
|
450
|
-
if (rawDefaultValues) {
|
|
451
|
-
const defaultValues = {};
|
|
452
|
-
for (const field in rawDefaultValues) {
|
|
453
|
-
defaultValues[field] = this._dataUnit.valueFromString(field, rawDefaultValues[field]);
|
|
454
|
-
}
|
|
455
|
-
return defaultValues;
|
|
456
|
-
}
|
|
457
|
-
return undefined;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
class Bind {
|
|
461
|
-
constructor() {
|
|
462
|
-
this.listen = true;
|
|
463
|
-
this.startChangeEventName = "ezStartChange";
|
|
464
|
-
this.cancelWaitingChangeEventName = "ezCancelWaitingChange";
|
|
465
|
-
this.changeEventName = "ezChange";
|
|
466
|
-
}
|
|
467
|
-
destroy() {
|
|
468
|
-
this.field.removeEventListener(this.startChangeEventName, this.startChangeListener);
|
|
469
|
-
this.field.removeEventListener(this.cancelWaitingChangeEventName, this.cancelWaitingChangeListener);
|
|
470
|
-
this.field.removeEventListener(this.changeEventName, this.changeListener);
|
|
471
|
-
}
|
|
472
|
-
acceptWaitingChange() {
|
|
473
|
-
if (this.waitingChangePromiseResolve) {
|
|
474
|
-
this.waitingChangePromiseResolve();
|
|
475
|
-
this.waitingChangePromiseReject = undefined;
|
|
476
|
-
this.waitingChangePromiseResolve = undefined;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
rejectWaitingChange(reason) {
|
|
480
|
-
if (this.waitingChangePromiseReject) {
|
|
481
|
-
this.waitingChangePromiseReject(reason);
|
|
482
|
-
this.waitingChangePromiseReject = undefined;
|
|
483
|
-
this.waitingChangePromiseResolve = undefined;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
static create(fieldName, field, startChangeCallback, cancelWaitingChangeCallback, changeCallback) {
|
|
487
|
-
const b = new Bind();
|
|
488
|
-
b.field = field;
|
|
489
|
-
b.fieldName = fieldName;
|
|
490
|
-
b.startChangeListener = (evt) => { if (b.listen)
|
|
491
|
-
startChangeCallback(fieldName, evt.detail); };
|
|
492
|
-
b.field.addEventListener(b.startChangeEventName, b.startChangeListener);
|
|
493
|
-
b.cancelWaitingChangeListener = () => { if (b.listen)
|
|
494
|
-
cancelWaitingChangeCallback(fieldName); };
|
|
495
|
-
b.field.addEventListener(b.cancelWaitingChangeEventName, b.cancelWaitingChangeListener);
|
|
496
|
-
b.changeListener = (evt) => { if (b.listen)
|
|
497
|
-
changeCallback(fieldName, evt.detail); };
|
|
498
|
-
b.field.addEventListener(b.changeEventName, b.changeListener);
|
|
499
|
-
return b;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
|
|
503
182
|
/**
|
|
504
183
|
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
505
184
|
*
|
|
@@ -963,6 +642,7 @@ const EzForm = class {
|
|
|
963
642
|
if (this.dataUnit === undefined) {
|
|
964
643
|
this.dataUnit = new DataUnit("ez-form");
|
|
965
644
|
}
|
|
645
|
+
this.dataUnit.unsubscribe(this.onDataUnitAction);
|
|
966
646
|
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
967
647
|
this._dataBinder = new DataBinder(this.dataUnit);
|
|
968
648
|
this._store = createStore(formReducer);
|