@sankhyalabs/ezui 5.21.0-dev.2 → 5.21.0-dev.21
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/README.md +1 -1
- package/dist/cjs/ICustomRender-6fafffce.js +13 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +2 -1
- package/dist/cjs/ez-alert-list.cjs.entry.js +7 -5
- package/dist/cjs/ez-alert.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-badge.cjs.entry.js +1 -1
- package/dist/cjs/ez-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/ez-button.cjs.entry.js +3 -3
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item_3.cjs.entry.js +1 -1
- package/dist/cjs/ez-chart.cjs.entry.js +433 -0
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +2 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +2 -1
- package/dist/cjs/{ez-text-edit.cjs.entry.js → ez-custom-form-input_2.cjs.entry.js} +95 -1
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +34 -4
- package/dist/cjs/ez-form.cjs.entry.js +78 -3
- package/dist/cjs/ez-grid.cjs.entry.js +333 -33
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +2 -2
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +16 -5
- package/dist/cjs/ez-modal.cjs.entry.js +8 -9
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +35 -29
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +15 -9
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-scroller_3.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +18 -6
- package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-item.cjs.entry.js +2 -1
- package/dist/cjs/ez-split-panel.cjs.entry.js +2 -2
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/ez-view-stack.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/filter-column.cjs.entry.js +1 -1
- package/dist/cjs/{index-a7b0c73d.js → index-9e5554cb.js} +11 -4
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +6 -4
- package/dist/collection/components/ez-button/ez-button.css +7 -0
- package/dist/collection/components/ez-button/ez-button.js +1 -1
- package/dist/collection/components/ez-chart/components/BarChart.js +27 -0
- package/dist/collection/components/ez-chart/components/ColumnChart.js +27 -0
- package/dist/collection/components/ez-chart/components/DonutChart.js +42 -0
- package/dist/collection/components/ez-chart/components/LineChart.js +27 -0
- package/dist/collection/components/ez-chart/components/PieChart.js +45 -0
- package/dist/collection/components/ez-chart/components/index.js +5 -0
- package/dist/collection/components/ez-chart/ez-chart.css +5 -0
- package/dist/collection/components/ez-chart/ez-chart.js +284 -0
- package/dist/collection/components/ez-chart/interfaces/ChartAxis.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartContext.js +14 -0
- package/dist/collection/components/ez-chart/interfaces/ChartOptions.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartSerie.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartStrategies.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartType.js +8 -0
- package/dist/collection/components/ez-chart/interfaces/index.js +5 -0
- package/dist/collection/components/ez-chart/test/mock-chart.js +137 -0
- package/dist/collection/components/ez-chart/types/BaseHighChartsRender.js +146 -0
- package/dist/collection/components/ez-form/ez-form.js +130 -4
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +253 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +89 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +3 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +56 -5
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +35 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +58 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.js +11 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.js +11 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +6 -3
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellRender.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellRender.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +3 -2
- package/dist/collection/components/ez-grid/ez-grid.css +1 -0
- package/dist/collection/components/ez-grid/ez-grid.js +233 -11
- package/dist/collection/components/ez-grid/interfaces/ICustomFormatter.js +1 -0
- package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +3 -11
- package/dist/collection/components/ez-grid/subcomponents/utils/selectionCounterUtils.js +22 -0
- package/dist/collection/components/ez-grid/test/resources/gridDataUnit.js +19 -0
- package/dist/collection/components/ez-list/ez-list.css +6 -2
- package/dist/collection/components/ez-modal/ez-modal.js +22 -9
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +4 -0
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +23 -3
- package/dist/collection/components/ez-number-input/ez-number-input.js +42 -27
- package/dist/collection/components/ez-popup/ez-popup.js +14 -8
- package/dist/collection/components/ez-search/ez-search.js +16 -5
- package/dist/collection/components/ez-split-panel/ez-split-panel.css +1 -0
- package/dist/collection/utils/customEditor/interfaces/ICustomEditor.js +5 -0
- package/dist/collection/utils/customEditor/interfaces/ICustomEditorInfo.js +1 -0
- package/dist/collection/utils/customRender/interfaces/ICustomRender.js +5 -0
- package/dist/collection/utils/customRender/interfaces/ICustomRenderInfo.js +1 -0
- package/dist/collection/utils/form/DataBinder.js +26 -0
- package/dist/collection/utils/form/test/DataBinder.test.js +41 -4
- package/dist/collection/utils/form/test/resources/metadataTest.js +15 -0
- package/dist/collection/utils/index.js +2 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +1081 -105
- package/dist/esm/ICustomRender-875b5a40.js +13 -0
- package/dist/esm/ez-actions-button.entry.js +2 -1
- package/dist/esm/ez-alert-list.entry.js +7 -5
- package/dist/esm/ez-alert.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-badge.entry.js +1 -1
- package/dist/esm/ez-breadcrumb.entry.js +1 -1
- package/dist/esm/ez-button.entry.js +3 -3
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-card-item_3.entry.js +1 -1
- package/dist/esm/ez-chart.entry.js +429 -0
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +2 -1
- package/dist/esm/ez-combo-box.entry.js +2 -1
- package/dist/esm/{ez-text-edit.entry.js → ez-custom-form-input_2.entry.js} +96 -3
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-dropdown.entry.js +1 -1
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +34 -4
- package/dist/esm/ez-form.entry.js +79 -4
- package/dist/esm/ez-grid.entry.js +333 -33
- package/dist/esm/ez-guide-navigator.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +2 -2
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +16 -5
- package/dist/esm/ez-modal.entry.js +9 -10
- package/dist/esm/ez-multi-selection-list.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +35 -29
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +15 -9
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-scroller_3.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +18 -6
- package/dist/esm/ez-skeleton.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +1 -1
- package/dist/esm/ez-split-item.entry.js +2 -1
- package/dist/esm/ez-split-panel.entry.js +2 -2
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +1 -1
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/ez-view-stack.entry.js +1 -1
- package/dist/esm/ezui.js +3 -3
- package/dist/esm/filter-column.entry.js +1 -1
- package/dist/esm/{index-baa5e267.js → index-5a720e56.js} +11 -5
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-44caad9a.entry.js → p-0378416a.entry.js} +1 -1
- package/dist/ezui/p-085babb4.entry.js +1 -0
- package/dist/ezui/{p-91f626d3.entry.js → p-0e551dd4.entry.js} +1 -1
- package/dist/ezui/{p-af2ecb1b.entry.js → p-11b09aa1.entry.js} +1 -1
- package/dist/ezui/{p-77a4bd35.entry.js → p-11bfeca3.entry.js} +1 -1
- package/dist/ezui/p-23a796cc.entry.js +1 -0
- package/dist/ezui/{p-af95cd16.entry.js → p-24ca32a3.entry.js} +1 -1
- package/dist/ezui/{p-cc2dc4f4.entry.js → p-2a6e44a0.entry.js} +1 -1
- package/dist/ezui/p-2af4e2de.entry.js +1 -0
- package/dist/ezui/{p-baf80b13.entry.js → p-30951bd7.entry.js} +1 -1
- package/dist/ezui/p-31674f8e.entry.js +1 -0
- package/dist/ezui/{p-bf79aaa1.entry.js → p-33792b2b.entry.js} +1 -1
- package/dist/ezui/{p-b44741b0.entry.js → p-355c20f5.entry.js} +2 -2
- package/dist/ezui/{p-e85c48d7.entry.js → p-36180f4d.entry.js} +1 -1
- package/dist/ezui/{p-7bc07c31.entry.js → p-3f8c33e0.entry.js} +1 -1
- package/dist/ezui/p-4559c266.entry.js +1 -0
- package/dist/ezui/p-4607fb89.js +1 -0
- package/dist/ezui/p-507ec8ed.entry.js +1 -0
- package/dist/ezui/{p-8defa6d3.entry.js → p-51e4c040.entry.js} +1 -1
- package/dist/ezui/p-569a0b9a.entry.js +1 -0
- package/dist/ezui/{p-1f50fa05.entry.js → p-6b51c9cc.entry.js} +1 -1
- package/dist/ezui/p-6ec40dec.entry.js +1 -0
- package/dist/ezui/{p-5ed81457.entry.js → p-6fc26622.entry.js} +1 -1
- package/dist/ezui/{p-555c9018.entry.js → p-7567ccdd.entry.js} +1 -1
- package/dist/ezui/{p-1e7a8633.entry.js → p-81461d2f.entry.js} +1 -1
- package/dist/ezui/{p-072e6347.entry.js → p-82ac8b06.entry.js} +1 -1
- package/dist/ezui/{p-8df1ca33.entry.js → p-82fa4b09.entry.js} +1 -1
- package/dist/ezui/p-868b56f7.entry.js +1 -0
- package/dist/ezui/{p-85c8baae.entry.js → p-8eef0f70.entry.js} +1 -1
- package/dist/ezui/p-91ccae0c.entry.js +1 -0
- package/dist/ezui/{p-3faa2b46.entry.js → p-9634631d.entry.js} +1 -1
- package/dist/ezui/p-9a11e223.entry.js +1 -0
- package/dist/ezui/{p-7af81663.entry.js → p-9a23d513.entry.js} +1 -1
- package/dist/ezui/p-9aa27e69.entry.js +1 -0
- package/dist/ezui/{p-784fe207.entry.js → p-9c2e2d68.entry.js} +1 -1
- package/dist/ezui/{p-9050d2cd.entry.js → p-b0e71d23.entry.js} +1 -1
- package/dist/ezui/{p-17be134a.entry.js → p-b2f6bc0a.entry.js} +1 -1
- package/dist/ezui/{p-9f5fa3f9.entry.js → p-c2b20f78.entry.js} +1 -1
- package/dist/ezui/{p-5bd5e68f.entry.js → p-c3b7a23e.entry.js} +1 -1
- package/dist/ezui/p-cd1a2e6b.entry.js +1 -0
- package/dist/ezui/p-d62ff380.entry.js +1 -0
- package/dist/ezui/{p-bae4e180.entry.js → p-dbeee5aa.entry.js} +1 -1
- package/dist/ezui/{p-a80b1287.entry.js → p-dfca5946.entry.js} +1 -1
- package/dist/ezui/p-e151e795.entry.js +1 -0
- package/dist/ezui/{p-23a36bb6.js → p-e4c7eb39.js} +2 -2
- package/dist/ezui/{p-0306dff7.entry.js → p-e6b38ade.entry.js} +1 -1
- package/dist/ezui/{p-650e4b6d.entry.js → p-f1c2c19e.entry.js} +1 -1
- package/dist/ezui/p-f1c3f85d.entry.js +1 -0
- package/dist/ezui/{p-49456b34.entry.js → p-f291db18.entry.js} +1 -1
- package/dist/ezui/{p-6e429cff.entry.js → p-fc194825.entry.js} +1 -1
- package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +2 -2
- package/dist/types/components/ez-chart/components/BarChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/ColumnChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/DonutChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/LineChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/PieChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/index.d.ts +5 -0
- package/dist/types/components/ez-chart/ez-chart.d.ts +58 -0
- package/dist/types/components/ez-chart/interfaces/ChartAxis.d.ts +7 -0
- package/dist/types/components/ez-chart/interfaces/ChartContext.d.ts +11 -0
- package/dist/types/components/ez-chart/interfaces/ChartOptions.d.ts +10 -0
- package/dist/types/components/ez-chart/interfaces/ChartSerie.d.ts +20 -0
- package/dist/types/components/ez-chart/interfaces/ChartStrategies.d.ts +7 -0
- package/dist/types/components/ez-chart/interfaces/ChartType.d.ts +7 -0
- package/dist/types/components/ez-chart/interfaces/index.d.ts +5 -0
- package/dist/types/components/ez-chart/types/BaseHighChartsRender.d.ts +15 -0
- package/dist/types/components/ez-form/ez-form.d.ts +20 -1
- package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +43 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +30 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +13 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +19 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +14 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +3 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +15 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellRender.d.ts +10 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +34 -1
- package/dist/types/components/ez-grid/interfaces/ICustomFormatter.d.ts +5 -0
- package/dist/types/components/ez-grid/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-grid/subcomponents/utils/selectionCounterUtils.d.ts +4 -0
- package/dist/types/components/ez-grid/test/resources/gridDataUnit.d.ts +2 -0
- package/dist/types/components/ez-modal/ez-modal.d.ts +9 -1
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +3 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +3 -3
- package/dist/types/components/ez-search/ez-search.d.ts +2 -1
- package/dist/types/components.d.ts +223 -4
- package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +29 -0
- package/dist/types/utils/customEditor/interfaces/ICustomEditorInfo.d.ts +5 -0
- package/dist/types/utils/customRender/interfaces/ICustomRender.d.ts +29 -0
- package/dist/types/utils/customRender/interfaces/ICustomRenderInfo.d.ts +5 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/dist/types/utils/form/test/resources/metadataTest.d.ts +2 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +2 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-0447d17c.entry.js +0 -1
- package/dist/ezui/p-20ec22c0.entry.js +0 -1
- package/dist/ezui/p-2a1a0e04.entry.js +0 -1
- package/dist/ezui/p-5e1d036e.entry.js +0 -1
- package/dist/ezui/p-5ef056ce.entry.js +0 -1
- package/dist/ezui/p-637f69f2.entry.js +0 -1
- package/dist/ezui/p-701231f0.entry.js +0 -1
- package/dist/ezui/p-99ead599.entry.js +0 -1
- package/dist/ezui/p-9aefaa52.entry.js +0 -1
- package/dist/ezui/p-a1ec32ef.entry.js +0 -1
- package/dist/ezui/p-b041333c.entry.js +0 -1
- package/dist/ezui/p-b567fa8c.entry.js +0 -1
- package/dist/ezui/p-bae3d0aa.entry.js +0 -1
- package/dist/ezui/p-bc2f844e.entry.js +0 -1
- package/dist/ezui/p-db77a984.entry.js +0 -1
|
@@ -15,6 +15,8 @@ export class EzGrid {
|
|
|
15
15
|
constructor() {
|
|
16
16
|
this._gridController = new AgGridController(false);
|
|
17
17
|
this._messageFilterAppliedSuccess = 'Filtro de coluna aplicado com sucesso!';
|
|
18
|
+
this._customEditor = new Map();
|
|
19
|
+
this._customRenders = new Map();
|
|
18
20
|
this._paginationInfo = undefined;
|
|
19
21
|
this._paginationChangedByKeyboard = true;
|
|
20
22
|
this._showSelectionCounter = false;
|
|
@@ -22,6 +24,7 @@ export class EzGrid {
|
|
|
22
24
|
this._currentPageSelected = undefined;
|
|
23
25
|
this._selectionCount = undefined;
|
|
24
26
|
this._hasLeftButtons = false;
|
|
27
|
+
this._customFormatters = new Map();
|
|
25
28
|
this.multipleSelection = undefined;
|
|
26
29
|
this.config = undefined;
|
|
27
30
|
this.selectionToastConfig = undefined;
|
|
@@ -93,6 +96,69 @@ export class EzGrid {
|
|
|
93
96
|
async filterColumns(search) {
|
|
94
97
|
return Promise.resolve(this._gridController.getColumnsState().filter(col => matches(col.label, search)));
|
|
95
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
101
|
+
*/
|
|
102
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
103
|
+
const newCustomEditor = new Map(this._customEditor);
|
|
104
|
+
newCustomEditor.set(fieldName, {
|
|
105
|
+
customEditor,
|
|
106
|
+
detailContext,
|
|
107
|
+
});
|
|
108
|
+
this._customEditor = newCustomEditor;
|
|
109
|
+
this._gridController.setCellEditors(newCustomEditor);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Registra um render customizado para colunas da grid.
|
|
113
|
+
*/
|
|
114
|
+
async addGridCustomRender(fieldName, customRender, detailContext) {
|
|
115
|
+
const newCustomRenders = new Map(this._customRenders);
|
|
116
|
+
newCustomRenders.set(fieldName, { customRender, detailContext });
|
|
117
|
+
this._customRenders = newCustomRenders;
|
|
118
|
+
this._gridController.setCellRenders(newCustomRenders);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Registra um formatador de valores para uma coluna da grid.
|
|
122
|
+
*/
|
|
123
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
|
124
|
+
if (!columnName || !customFormatter) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const newCustomFormatters = new Map(this._customFormatters);
|
|
128
|
+
newCustomFormatters.set(columnName, customFormatter);
|
|
129
|
+
this._customFormatters = newCustomFormatters;
|
|
130
|
+
this._gridController.setCustomFormatters(newCustomFormatters);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Remove o formatador de valores de uma coluna da grid.
|
|
134
|
+
*/
|
|
135
|
+
async removeCustomValueFormatter(columnName) {
|
|
136
|
+
if (!columnName) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const newCustomFormatters = new Map(this._customFormatters);
|
|
140
|
+
newCustomFormatters.delete(columnName);
|
|
141
|
+
this._customFormatters = newCustomFormatters;
|
|
142
|
+
this._gridController.setCustomFormatters(newCustomFormatters);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Atualiza linhas da grade.
|
|
146
|
+
*/
|
|
147
|
+
async refreshSelectedRows() {
|
|
148
|
+
this._gridController.refreshSelectedRows();
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Retorna o formatador customizado da coluna caso exista.
|
|
152
|
+
*/
|
|
153
|
+
async getCustomValueFormatter(columnName) {
|
|
154
|
+
return this._customFormatters.get(columnName);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Atribui o foco para a grade.
|
|
158
|
+
*/
|
|
159
|
+
async setFocus() {
|
|
160
|
+
this._gridController.setFocus();
|
|
161
|
+
}
|
|
96
162
|
observeConfig(config) {
|
|
97
163
|
this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
|
|
98
164
|
}
|
|
@@ -266,14 +332,10 @@ export class EzGrid {
|
|
|
266
332
|
(_a = this._gridApi) === null || _a === void 0 ? void 0 : _a.clearRangeSelection();
|
|
267
333
|
}
|
|
268
334
|
getPaginationControl() {
|
|
269
|
-
if (this._paginationInfo)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
h("div", { id: "grid-pagination-tooltip", ref: (element) => (this._refPaginationLabelTooltip = element), class: "ez-flex ez-margin-right--medium" }, h("ez-button", { size: "small", class: "ez-margin-right--medium", iconName: "chevron-left", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }), h("ez-button", { size: "small", iconName: "chevron-right", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" })),
|
|
274
|
-
];
|
|
275
|
-
}
|
|
276
|
-
return null;
|
|
335
|
+
if (!this._paginationInfo)
|
|
336
|
+
return null;
|
|
337
|
+
const { currentPage, hasMore } = this._paginationInfo;
|
|
338
|
+
return (h("div", { class: "grid-header__container grid-header__pagination", ref: ref => (this._refPaginationControl = ref) }, h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium", ref: (element) => (this._refPaginationLabel = element) }, h("span", { class: "grid-header__pagination-label" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" }, this._getActualPageLabel()), this._getRemainingPageLabel())), h("div", { id: "grid-pagination-tooltip", ref: (element) => (this._refPaginationLabelTooltip = element), class: "ez-flex ez-margin-right--medium" }, h("ez-button", { size: "small", class: "ez-margin-right--medium", iconName: "chevron-left", mode: "icon", enabled: currentPage > 0, onClick: () => this.previousPage(), label: "P\u00E1gina anterior" }), h("ez-button", { size: "small", iconName: "chevron-right", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" }))));
|
|
277
339
|
}
|
|
278
340
|
componentDidLoad() {
|
|
279
341
|
this._gridController.initDatagrid(this._container, {
|
|
@@ -294,7 +356,8 @@ export class EzGrid {
|
|
|
294
356
|
statusResolver: this.statusResolver,
|
|
295
357
|
useEnterLikeTab: this.useEnterLikeTab,
|
|
296
358
|
recordsValidator: this.recordsValidator,
|
|
297
|
-
editionIsDisabled: () => !this.canEdit
|
|
359
|
+
editionIsDisabled: () => !this.canEdit,
|
|
360
|
+
customFormatters: this._customFormatters
|
|
298
361
|
});
|
|
299
362
|
if (this.config) {
|
|
300
363
|
this.observeConfig(this.config);
|
|
@@ -389,7 +452,7 @@ export class EzGrid {
|
|
|
389
452
|
}
|
|
390
453
|
render() {
|
|
391
454
|
var _a;
|
|
392
|
-
return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container grid-header__left-container" }, h("slot", { name: "leftButtons" })),
|
|
455
|
+
return (h(Host, { "no-header": this.hideHeader() }, h("div", { class: "grid__container ez-grid", ref: elem => (this._container = elem) }), h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container grid-header__left-container" }, h("slot", { name: "leftButtons" })), this.getPaginationControl())), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
|
|
393
456
|
${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
|
|
394
457
|
` }, h(SelectionCounter, { selectionCount: this._selectionCount, currentPageSelected: this._currentPageSelected, paginationInfo: this._paginationInfo, canSelectAll: (_a = this.selectionToastConfig) === null || _a === void 0 ? void 0 : _a.canSelectAll, allRecordSelected: this._isAllSelection, onSelectAll: () => this.onSelectAllRecords(), onSelectPage: () => this.onSelectPageRecords(), onClearAll: () => this.onClearSelectedRecords(), onClose: () => (this._showSelectionCounter = false) })), h("div", { class: "grid__footer" }, h("slot", { name: "footer" }))));
|
|
395
458
|
}
|
|
@@ -612,7 +675,8 @@ export class EzGrid {
|
|
|
612
675
|
"_isAllSelection": {},
|
|
613
676
|
"_currentPageSelected": {},
|
|
614
677
|
"_selectionCount": {},
|
|
615
|
-
"_hasLeftButtons": {}
|
|
678
|
+
"_hasLeftButtons": {},
|
|
679
|
+
"_customFormatters": {}
|
|
616
680
|
};
|
|
617
681
|
}
|
|
618
682
|
static get events() {
|
|
@@ -946,6 +1010,164 @@ export class EzGrid {
|
|
|
946
1010
|
"text": "Usa um argumento para filtrar as colunas po label",
|
|
947
1011
|
"tags": []
|
|
948
1012
|
}
|
|
1013
|
+
},
|
|
1014
|
+
"addCustomEditor": {
|
|
1015
|
+
"complexType": {
|
|
1016
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
|
1017
|
+
"parameters": [{
|
|
1018
|
+
"tags": [],
|
|
1019
|
+
"text": ""
|
|
1020
|
+
}, {
|
|
1021
|
+
"tags": [],
|
|
1022
|
+
"text": ""
|
|
1023
|
+
}, {
|
|
1024
|
+
"tags": [],
|
|
1025
|
+
"text": ""
|
|
1026
|
+
}],
|
|
1027
|
+
"references": {
|
|
1028
|
+
"Promise": {
|
|
1029
|
+
"location": "global"
|
|
1030
|
+
},
|
|
1031
|
+
"ICustomEditor": {
|
|
1032
|
+
"location": "import",
|
|
1033
|
+
"path": "../../utils/customEditor/interfaces/ICustomEditor"
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
"return": "Promise<void>"
|
|
1037
|
+
},
|
|
1038
|
+
"docs": {
|
|
1039
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
1040
|
+
"tags": []
|
|
1041
|
+
}
|
|
1042
|
+
},
|
|
1043
|
+
"addGridCustomRender": {
|
|
1044
|
+
"complexType": {
|
|
1045
|
+
"signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
|
|
1046
|
+
"parameters": [{
|
|
1047
|
+
"tags": [],
|
|
1048
|
+
"text": ""
|
|
1049
|
+
}, {
|
|
1050
|
+
"tags": [],
|
|
1051
|
+
"text": ""
|
|
1052
|
+
}, {
|
|
1053
|
+
"tags": [],
|
|
1054
|
+
"text": ""
|
|
1055
|
+
}],
|
|
1056
|
+
"references": {
|
|
1057
|
+
"Promise": {
|
|
1058
|
+
"location": "global"
|
|
1059
|
+
},
|
|
1060
|
+
"ICustomRender": {
|
|
1061
|
+
"location": "import",
|
|
1062
|
+
"path": "../../utils/customRender/interfaces/ICustomRender"
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
"return": "Promise<void>"
|
|
1066
|
+
},
|
|
1067
|
+
"docs": {
|
|
1068
|
+
"text": "Registra um render customizado para colunas da grid.",
|
|
1069
|
+
"tags": []
|
|
1070
|
+
}
|
|
1071
|
+
},
|
|
1072
|
+
"addCustomValueFormatter": {
|
|
1073
|
+
"complexType": {
|
|
1074
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
|
1075
|
+
"parameters": [{
|
|
1076
|
+
"tags": [],
|
|
1077
|
+
"text": ""
|
|
1078
|
+
}, {
|
|
1079
|
+
"tags": [],
|
|
1080
|
+
"text": ""
|
|
1081
|
+
}],
|
|
1082
|
+
"references": {
|
|
1083
|
+
"Promise": {
|
|
1084
|
+
"location": "global"
|
|
1085
|
+
},
|
|
1086
|
+
"ICustomFormatter": {
|
|
1087
|
+
"location": "import",
|
|
1088
|
+
"path": "./interfaces"
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
"return": "Promise<void>"
|
|
1092
|
+
},
|
|
1093
|
+
"docs": {
|
|
1094
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
|
1095
|
+
"tags": []
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
"removeCustomValueFormatter": {
|
|
1099
|
+
"complexType": {
|
|
1100
|
+
"signature": "(columnName: string) => Promise<void>",
|
|
1101
|
+
"parameters": [{
|
|
1102
|
+
"tags": [],
|
|
1103
|
+
"text": ""
|
|
1104
|
+
}],
|
|
1105
|
+
"references": {
|
|
1106
|
+
"Promise": {
|
|
1107
|
+
"location": "global"
|
|
1108
|
+
}
|
|
1109
|
+
},
|
|
1110
|
+
"return": "Promise<void>"
|
|
1111
|
+
},
|
|
1112
|
+
"docs": {
|
|
1113
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
|
1114
|
+
"tags": []
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
"refreshSelectedRows": {
|
|
1118
|
+
"complexType": {
|
|
1119
|
+
"signature": "() => Promise<void>",
|
|
1120
|
+
"parameters": [],
|
|
1121
|
+
"references": {
|
|
1122
|
+
"Promise": {
|
|
1123
|
+
"location": "global"
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
"return": "Promise<void>"
|
|
1127
|
+
},
|
|
1128
|
+
"docs": {
|
|
1129
|
+
"text": "Atualiza linhas da grade.",
|
|
1130
|
+
"tags": []
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
"getCustomValueFormatter": {
|
|
1134
|
+
"complexType": {
|
|
1135
|
+
"signature": "(columnName: string) => Promise<ICustomFormatter | undefined>",
|
|
1136
|
+
"parameters": [{
|
|
1137
|
+
"tags": [],
|
|
1138
|
+
"text": ""
|
|
1139
|
+
}],
|
|
1140
|
+
"references": {
|
|
1141
|
+
"Promise": {
|
|
1142
|
+
"location": "global"
|
|
1143
|
+
},
|
|
1144
|
+
"ICustomFormatter": {
|
|
1145
|
+
"location": "import",
|
|
1146
|
+
"path": "./interfaces"
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
"return": "Promise<ICustomFormatter>"
|
|
1150
|
+
},
|
|
1151
|
+
"docs": {
|
|
1152
|
+
"text": "Retorna o formatador customizado da coluna caso exista.",
|
|
1153
|
+
"tags": []
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
"setFocus": {
|
|
1157
|
+
"complexType": {
|
|
1158
|
+
"signature": "() => Promise<void>",
|
|
1159
|
+
"parameters": [],
|
|
1160
|
+
"references": {
|
|
1161
|
+
"Promise": {
|
|
1162
|
+
"location": "global"
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
"return": "Promise<void>"
|
|
1166
|
+
},
|
|
1167
|
+
"docs": {
|
|
1168
|
+
"text": "Atribui o foco para a grade.",
|
|
1169
|
+
"tags": []
|
|
1170
|
+
}
|
|
949
1171
|
}
|
|
950
1172
|
};
|
|
951
1173
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ElementIDUtils } from "@sankhyalabs/core";
|
|
2
2
|
import { h } from "@stencil/core";
|
|
3
|
+
import { buildSelectAllLabel, buildSelectAllTitle, enableSelectAll, getText } from './utils/selectionCounterUtils';
|
|
3
4
|
export const SelectionCounter = (props) => {
|
|
4
5
|
const { selectionCount, currentPageSelected, allRecordSelected, paginationInfo, canSelectAll, onSelectAll, onSelectPage, onClearAll, onClose } = props;
|
|
5
|
-
const { total, hasMore } = paginationInfo || {};
|
|
6
|
+
const { total, hasMore, count } = paginationInfo || {};
|
|
6
7
|
const shouldRenderSelectionButton = () => {
|
|
7
8
|
if ((!allRecordSelected && selectionCount === total) || (allRecordSelected && !hasMore))
|
|
8
9
|
return false;
|
|
@@ -11,17 +12,8 @@ export const SelectionCounter = (props) => {
|
|
|
11
12
|
return !!paginationInfo && (currentPageSelected || allRecordSelected);
|
|
12
13
|
};
|
|
13
14
|
return (h("div", Object.assign({ class: "ez-box ez-box--shadow-small" }, getElementID("ezGridSelectionCounter")), h("div", { class: "ez-flex ez-flex--align-items-center ez-size-width--full ez-padding-horizontal--medium" }, h("div", { class: "ez-flex ez-flex--wrap ez-flex--align-items-baseline ez-flex--justify-center" }, h("label", Object.assign({ innerHTML: getText(selectionCount, allRecordSelected), class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium ez-margin-top--medium" }, getElementID("ezGridSelectionCounter_label"))), h("div", { class: "ez-flex ez-margin-right--medium" }, shouldRenderSelectionButton() &&
|
|
14
|
-
h("ez-button", Object.assign({ class: "ez-margin-right--medium", label:
|
|
15
|
+
h("ez-button", Object.assign({ title: buildSelectAllTitle(total), enabled: enableSelectAll(total), class: "ez-margin-right--medium", label: buildSelectAllLabel(allRecordSelected, count, total), mode: "link", onClick: allRecordSelected ? onSelectPage : onSelectAll }, getElementID(`ezGridSelectionCounter_select${allRecordSelected ? "Page" : "All"}`))), h("ez-button", Object.assign({ class: "grid__btn-clear", label: "Limpar Sele\u00E7\u00E3o", mode: "link", onClick: onClearAll }, getElementID("ezGridSelectionCounter_clearAll"))))), h("button", Object.assign({ class: "grid__btn-close", title: "Fechar", onClick: onClose }, getElementID("ezGridSelectionCounter_close")), h("ez-icon", { iconName: "close" })))));
|
|
15
16
|
};
|
|
16
|
-
function getText(selectionCount, allSelectedRecords) {
|
|
17
|
-
if (allSelectedRecords) {
|
|
18
|
-
return `Todos os <strong>${selectionCount} registros</strong> da grade estão selecionados.`;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
const pluralChar = selectionCount > 1 ? "s" : "";
|
|
22
|
-
return `Há <strong>${selectionCount} registro${pluralChar}</strong> selecionado${pluralChar}.`;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
17
|
function getElementID(sufix) {
|
|
26
18
|
return {
|
|
27
19
|
[ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function enableSelectAll(total) {
|
|
2
|
+
return total !== undefined;
|
|
3
|
+
}
|
|
4
|
+
export function buildSelectAllLabel(allRecordSelected, count, total) {
|
|
5
|
+
if (allRecordSelected)
|
|
6
|
+
return 'Selecionar apenas a página atual';
|
|
7
|
+
if (total === undefined)
|
|
8
|
+
return `Carregando todos os ${count} registros`;
|
|
9
|
+
return `Selecionar todos os ${total} registros`;
|
|
10
|
+
}
|
|
11
|
+
export function buildSelectAllTitle(total) {
|
|
12
|
+
if (enableSelectAll(total))
|
|
13
|
+
return '';
|
|
14
|
+
return 'Aguarde o carregamento para selecionar o registro de todas as páginas';
|
|
15
|
+
}
|
|
16
|
+
export function getText(selectionCount, allSelectedRecords) {
|
|
17
|
+
if (allSelectedRecords) {
|
|
18
|
+
return `Todos os <strong>${selectionCount} registros</strong> da grade estão selecionados.`;
|
|
19
|
+
}
|
|
20
|
+
const pluralCharacter = selectionCount > 1 ? "s" : "";
|
|
21
|
+
return `Há <strong>${selectionCount} registro${pluralCharacter}</strong> selecionado${pluralCharacter} na grade.`;
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DataType, DataUnit, StringUtils } from "@sankhyalabs/core";
|
|
2
|
+
export function getDataUnit() {
|
|
3
|
+
const dataUnit = new DataUnit('EzGridDU');
|
|
4
|
+
dataUnit.pageSize = 3;
|
|
5
|
+
dataUnit.metadata = {
|
|
6
|
+
name: "exemplo.datagrid",
|
|
7
|
+
label: "Exemplo data grid",
|
|
8
|
+
fields: [
|
|
9
|
+
{ name: "PRODUTO", label: "Produto", dataType: DataType.TEXT },
|
|
10
|
+
{ name: "QUANTIDADE", label: "Quantidade", dataType: DataType.NUMBER }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
dataUnit.records = [
|
|
14
|
+
{ __record__id__: StringUtils.generateUUID(), "PRODUTO": "Mamão", "QUANTIDADE": 1 },
|
|
15
|
+
{ __record__id__: StringUtils.generateUUID(), "PRODUTO": "Mexerica", "QUANTIDADE": 2 }
|
|
16
|
+
];
|
|
17
|
+
dataUnit.selectFirst();
|
|
18
|
+
return dataUnit;
|
|
19
|
+
}
|
|
@@ -168,14 +168,18 @@ p {
|
|
|
168
168
|
display: flex;
|
|
169
169
|
|
|
170
170
|
/*public*/
|
|
171
|
-
padding: var(--space--2xs, 8px) var(--space--3xs, 4px);
|
|
172
|
-
margin: var(--ez-list__item--margin);
|
|
173
171
|
font-family: var(--ez-list__item--font-family);
|
|
174
172
|
font-size: var(--ez-list__item--font-size);
|
|
175
173
|
color: var(--ez-list__item--color);
|
|
176
174
|
border-bottom: var(--ez-list__item--border-bottom, none) var(--ez-list__item--border-bottom-color);
|
|
177
175
|
}
|
|
178
176
|
|
|
177
|
+
.draggable-list li > div {
|
|
178
|
+
/*public*/
|
|
179
|
+
padding: var(--space--2xs, 8px) var(--space--3xs, 4px);
|
|
180
|
+
margin: var(--ez-list__item--margin);
|
|
181
|
+
}
|
|
182
|
+
|
|
179
183
|
.over {
|
|
180
184
|
/*public*/
|
|
181
185
|
border-top: 1px dashed var(--ez-list__over--border--color);
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { FloatingManager } from '@sankhyalabs/core';
|
|
2
|
+
import { FloatingManager, KeyboardManager } from '@sankhyalabs/core';
|
|
3
3
|
export class EzModal {
|
|
4
4
|
constructor() {
|
|
5
|
-
this.handleKeyboardEvent = (ev) => {
|
|
6
|
-
if ((ev === null || ev === void 0 ? void 0 : ev.key) === "Escape" && this.closeEsc) {
|
|
7
|
-
this.closeModal();
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
5
|
this.modalSize = undefined;
|
|
11
6
|
this.align = undefined;
|
|
12
7
|
this.heightMode = "regular";
|
|
@@ -18,11 +13,9 @@ export class EzModal {
|
|
|
18
13
|
observeOpened() {
|
|
19
14
|
if (this.opened) {
|
|
20
15
|
this._overlayId = FloatingManager.subscribeOverlayControl(this._modalRef);
|
|
21
|
-
document.addEventListener("keydown", this.handleKeyboardEvent);
|
|
22
16
|
}
|
|
23
17
|
else {
|
|
24
18
|
FloatingManager.unsubscribeOverlayControl(this._modalRef || this._overlayId);
|
|
25
|
-
document.removeEventListener("keydown", this.handleKeyboardEvent);
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
closeModal() {
|
|
@@ -31,6 +24,10 @@ export class EzModal {
|
|
|
31
24
|
}
|
|
32
25
|
componentDidLoad() {
|
|
33
26
|
this.observeOpened();
|
|
27
|
+
new KeyboardManager({ propagate: false, element: this._element })
|
|
28
|
+
.bind("Enter", this.ezModalAction.emit.bind("OK"))
|
|
29
|
+
.bind("Escape", () => this.closeModal())
|
|
30
|
+
.bind("Esc", () => this.closeModal());
|
|
34
31
|
}
|
|
35
32
|
componentDidRender() {
|
|
36
33
|
if (this.opened) {
|
|
@@ -49,7 +46,7 @@ export class EzModal {
|
|
|
49
46
|
const scrimType = `modal__screen-${this.scrim}`;
|
|
50
47
|
return (h(Host, null, this.opened
|
|
51
48
|
?
|
|
52
|
-
h("div", { ref: ref => this._modalRef = ref, class: `modal ${scrimType} ${regularVerticalPaddingClass}`, onMouseDown: evt => this.onMouseDownHandler(evt) }, h("div", { class: `modal__container modal__container--${positionSufix}`, ref: ref => this._overlay = ref }, h("div", { class: `modal__content ${modalContentHeightMode} ${this.modalSize}` }, h("slot", null))))
|
|
49
|
+
h("div", { ref: ref => this._modalRef = ref, class: `modal ${scrimType} ${regularVerticalPaddingClass}`, onMouseDown: evt => this.onMouseDownHandler(evt), tabIndex: -1 }, h("div", { class: `modal__container modal__container--${positionSufix}`, ref: ref => this._overlay = ref }, h("div", { class: `modal__content ${modalContentHeightMode} ${this.modalSize}` }, h("slot", null))))
|
|
53
50
|
:
|
|
54
51
|
undefined));
|
|
55
52
|
}
|
|
@@ -228,8 +225,24 @@ export class EzModal {
|
|
|
228
225
|
"resolved": "any",
|
|
229
226
|
"references": {}
|
|
230
227
|
}
|
|
228
|
+
}, {
|
|
229
|
+
"method": "ezModalAction",
|
|
230
|
+
"name": "ezModalAction",
|
|
231
|
+
"bubbles": true,
|
|
232
|
+
"cancelable": true,
|
|
233
|
+
"composed": true,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": "Representa a intera\u00E7\u00E3o com o usu\u00E1rio.\nOK - Quando o bot\u00E3o \u00E9 acionado\nCANCEL - Quando o bot\u00E3o de cancelar \u00E9 acionado\nCLOSE - Quando o bot\u00E3o de fechar \u00E9 acionado.\nLOAD - Quando o modal \u00E9 carregado (eventualmente pode ser usado para dar foco a um elemento espec\u00EDfico)"
|
|
237
|
+
},
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "string",
|
|
240
|
+
"resolved": "string",
|
|
241
|
+
"references": {}
|
|
242
|
+
}
|
|
231
243
|
}];
|
|
232
244
|
}
|
|
245
|
+
static get elementRef() { return "_element"; }
|
|
233
246
|
static get watchers() {
|
|
234
247
|
return [{
|
|
235
248
|
"propName": "opened",
|
|
@@ -12,6 +12,12 @@ export class EzModalContainer {
|
|
|
12
12
|
this.cancelButtonStatus = undefined;
|
|
13
13
|
this.okButtonStatus = undefined;
|
|
14
14
|
}
|
|
15
|
+
async handleEzModalAction(event) {
|
|
16
|
+
var _a;
|
|
17
|
+
if ((event === null || event === void 0 ? void 0 : event.target) && (event === null || event === void 0 ? void 0 : event.target) === ((_a = this._element) === null || _a === void 0 ? void 0 : _a.parentElement)) {
|
|
18
|
+
this.closeModal();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
15
21
|
cancelIsVisible() {
|
|
16
22
|
return (this.cancelButtonStatus !== ModalButtonStatus.HIDDEN && this.cancelButtonLabel != undefined);
|
|
17
23
|
}
|
|
@@ -21,11 +27,15 @@ export class EzModalContainer {
|
|
|
21
27
|
componentDidLoad() {
|
|
22
28
|
window.requestAnimationFrame(() => {
|
|
23
29
|
this.ezModalAction.emit(ModalAction.LOAD);
|
|
30
|
+
this._modalRef.focus();
|
|
24
31
|
});
|
|
25
32
|
new KeyboardManager({ propagate: false, element: this._element })
|
|
26
33
|
.bind("Enter", this.ezModalAction.emit.bind(ModalAction.OK))
|
|
27
|
-
.bind("Escape", this.
|
|
28
|
-
.bind("Esc", this.
|
|
34
|
+
.bind("Escape", () => this.closeModal())
|
|
35
|
+
.bind("Esc", () => this.closeModal());
|
|
36
|
+
}
|
|
37
|
+
closeModal() {
|
|
38
|
+
this.ezModalAction.emit("CLOSE");
|
|
29
39
|
}
|
|
30
40
|
focusLast() {
|
|
31
41
|
if (this._okButton == undefined) {
|
|
@@ -37,7 +47,7 @@ export class EzModalContainer {
|
|
|
37
47
|
this._closeButton.focus();
|
|
38
48
|
}
|
|
39
49
|
render() {
|
|
40
|
-
return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div",
|
|
50
|
+
return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--large" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" }))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
|
|
41
51
|
}
|
|
42
52
|
static get is() { return "ez-modal-container"; }
|
|
43
53
|
static get encapsulation() { return "scoped"; }
|
|
@@ -193,4 +203,14 @@ export class EzModalContainer {
|
|
|
193
203
|
}
|
|
194
204
|
}];
|
|
195
205
|
}
|
|
206
|
+
static get elementRef() { return "_element"; }
|
|
207
|
+
static get listeners() {
|
|
208
|
+
return [{
|
|
209
|
+
"name": "ezCloseModal",
|
|
210
|
+
"method": "handleEzModalAction",
|
|
211
|
+
"target": "document",
|
|
212
|
+
"capture": false,
|
|
213
|
+
"passive": false
|
|
214
|
+
}];
|
|
215
|
+
}
|
|
196
216
|
}
|