@sankhyalabs/ezui 5.20.4 → 5.21.0-dev.10
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 +4 -5
- package/dist/cjs/{CSSVarsUtils-b136a156.js → CSSVarsUtils-10c9d5b4.js} +13 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-alert-list.cjs.entry.js +123 -49
- 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 +183 -0
- package/dist/cjs/ez-check.cjs.entry.js +2 -2
- package/dist/cjs/ez-chip.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 +20 -163
- package/dist/cjs/ez-date-input.cjs.entry.js +2 -2
- package/dist/cjs/ez-date-time-input.cjs.entry.js +2 -2
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-dropdown.cjs.entry.js +10 -4
- package/dist/cjs/ez-file-item.cjs.entry.js +1 -1
- package/dist/cjs/ez-form-view.cjs.entry.js +48 -16
- package/dist/cjs/ez-form.cjs.entry.js +29 -3
- package/dist/cjs/ez-grid.cjs.entry.js +216 -72
- package/dist/cjs/ez-guide-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-icon.cjs.entry.js +2 -2
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-loading-bar.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +19 -3
- 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 +10 -3
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +21 -8
- package/dist/cjs/ez-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-scroller_3.cjs.entry.js +19 -5
- package/dist/cjs/ez-search.cjs.entry.js +625 -33
- package/dist/cjs/ez-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +166 -0
- package/dist/cjs/ez-split-item.cjs.entry.js +21 -3
- package/dist/cjs/ez-split-panel.cjs.entry.js +68 -14
- 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-edit.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 +2 -2
- 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 +17 -6
- package/dist/cjs/{index-1064511f.js → index-a7b0c73d.js} +12 -10
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +4 -3
- package/dist/collection/components/ez-alert-list/ez-alert-list.css +16 -2
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +129 -48
- 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-card-item/ez-card-item.css +52 -3
- package/dist/collection/components/ez-card-item/ez-card-item.js +22 -3
- package/dist/collection/components/ez-check/ez-check.css +1 -0
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +19 -179
- package/dist/collection/components/ez-dropdown/ez-dropdown.js +32 -3
- package/dist/collection/components/ez-form/ez-form.js +76 -2
- package/dist/collection/components/ez-form-view/ez-form-view.css +17 -1
- package/dist/collection/components/ez-form-view/ez-form-view.js +60 -5
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/CheckBox.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/ComboBox.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/DateInput.tpl.js +3 -3
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.js +4 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/SearchInput.tpl.js +1 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +26 -13
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +3 -4
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSourceInterceptor.js +21 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -3
- package/dist/collection/components/ez-grid/ez-grid.css +25 -1
- package/dist/collection/components/ez-grid/ez-grid.js +228 -35
- 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/filter-column.js +16 -5
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +3 -11
- package/dist/collection/components/ez-grid/subcomponents/utils/selectionCounterUtils.js +24 -0
- package/dist/collection/components/ez-grid/test/resources/gridDataUnit.js +19 -0
- package/dist/collection/components/ez-icon/ez-icon.css +119 -117
- 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 +26 -1
- package/dist/collection/components/ez-number-input/ez-number-input.js +11 -0
- package/dist/collection/components/ez-popup/ez-popup.css +2 -5
- package/dist/collection/components/ez-popup/ez-popup.js +35 -8
- package/dist/collection/components/ez-search/ez-search.css +331 -0
- package/dist/collection/components/ez-search/ez-search.js +701 -55
- package/dist/collection/components/ez-split-button/ez-split-button.css +229 -0
- package/dist/collection/components/ez-split-button/ez-split-button.js +455 -0
- package/dist/collection/components/ez-split-button/test/dropdownItems.js +42 -0
- package/dist/collection/components/ez-split-panel/ez-split-panel.css +6 -7
- package/dist/collection/components/ez-split-panel/ez-split-panel.js +103 -15
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +59 -12
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +82 -2
- package/dist/collection/components/ez-tree/ez-tree.css +26 -0
- package/dist/collection/components/ez-tree/interfaces/ITreeItemBadge.js +1 -0
- package/dist/collection/components/ez-tree/subcomponents/TreeItem.js +15 -2
- package/dist/collection/utils/CSSVarsUtils.js +13 -0
- package/dist/collection/utils/form/test/DataBinder.test.js +9 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +1427 -397
- package/dist/esm/{CSSVarsUtils-a97cfa29.js → CSSVarsUtils-71ce76be.js} +13 -0
- package/dist/esm/ez-actions-button.entry.js +2 -2
- package/dist/esm/ez-alert-list.entry.js +123 -49
- 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 +177 -0
- package/dist/esm/ez-check.entry.js +2 -2
- package/dist/esm/ez-chip.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +21 -164
- package/dist/esm/ez-date-input.entry.js +2 -2
- package/dist/esm/ez-date-time-input.entry.js +2 -2
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-dropdown.entry.js +10 -4
- package/dist/esm/ez-file-item.entry.js +1 -1
- package/dist/esm/ez-form-view.entry.js +48 -16
- package/dist/esm/ez-form.entry.js +29 -3
- package/dist/esm/ez-grid.entry.js +217 -73
- package/dist/esm/ez-guide-navigator.entry.js +1 -1
- package/dist/esm/ez-icon.entry.js +2 -2
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-loading-bar.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +19 -3
- 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 +10 -3
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +22 -9
- package/dist/esm/ez-radio-button.entry.js +1 -1
- package/dist/esm/ez-scroller_3.entry.js +19 -5
- package/dist/esm/ez-search.entry.js +626 -34
- package/dist/esm/ez-skeleton.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +162 -0
- package/dist/esm/ez-split-item.entry.js +21 -3
- package/dist/esm/ez-split-panel.entry.js +68 -14
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +1 -1
- package/dist/esm/ez-text-edit.entry.js +1 -1
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +2 -2
- 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 +17 -6
- package/dist/esm/{index-296b8458.js → index-baa5e267.js} +12 -10
- package/dist/esm/loader.js +3 -3
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-5cef0264.entry.js → p-0306dff7.entry.js} +1 -1
- package/dist/ezui/{p-871c1a07.entry.js → p-0447d17c.entry.js} +1 -1
- package/dist/ezui/p-072e6347.entry.js +1 -0
- package/dist/ezui/p-09de35a2.entry.js +1 -0
- package/dist/ezui/p-13d2fe2d.entry.js +1 -0
- package/dist/ezui/{p-f4208819.entry.js → p-17be134a.entry.js} +1 -1
- package/dist/ezui/{p-545b5b2f.entry.js → p-1db718ab.entry.js} +2 -2
- package/dist/ezui/{p-cd19a6f8.entry.js → p-1e7a8633.entry.js} +1 -1
- package/dist/ezui/{p-60ba28ea.entry.js → p-1f50fa05.entry.js} +1 -1
- package/dist/ezui/{p-245a44ed.entry.js → p-20ec22c0.entry.js} +1 -1
- package/dist/ezui/{p-e318d280.js → p-23a36bb6.js} +1 -1
- package/dist/ezui/p-30775e7f.entry.js +1 -0
- package/dist/ezui/{p-8252d9b5.entry.js → p-3a21618b.entry.js} +1 -1
- package/dist/ezui/p-3faa2b46.entry.js +1 -0
- package/dist/ezui/{p-9b347f04.entry.js → p-44caad9a.entry.js} +1 -1
- package/dist/ezui/{p-7319c253.entry.js → p-49456b34.entry.js} +1 -1
- package/dist/ezui/{p-ccb4ccd9.entry.js → p-555c9018.entry.js} +1 -1
- package/dist/ezui/{p-52dd8b4c.entry.js → p-5bd5e68f.entry.js} +1 -1
- package/dist/ezui/{p-7525e604.entry.js → p-5ed81457.entry.js} +1 -1
- package/dist/ezui/p-637f69f2.entry.js +1 -0
- package/dist/ezui/{p-c49dbf23.entry.js → p-650e4b6d.entry.js} +1 -1
- package/dist/ezui/{p-f55d75e7.entry.js → p-6e429cff.entry.js} +1 -1
- package/dist/ezui/{p-0b902469.entry.js → p-77a4bd35.entry.js} +1 -1
- package/dist/ezui/{p-81cd05c8.entry.js → p-784fe207.entry.js} +1 -1
- package/dist/ezui/p-7af81663.entry.js +1 -0
- package/dist/ezui/p-7bc07c31.entry.js +1 -0
- package/dist/ezui/p-7c770f14.entry.js +1 -0
- package/dist/ezui/p-836cdfdf.entry.js +1 -0
- package/dist/ezui/{p-5d6f2550.entry.js → p-85c8baae.entry.js} +1 -1
- package/dist/ezui/{p-d3b5228e.entry.js → p-8defa6d3.entry.js} +1 -1
- package/dist/ezui/{p-fbca293f.entry.js → p-8df1ca33.entry.js} +1 -1
- package/dist/ezui/{p-391de0e4.entry.js → p-9050d2cd.entry.js} +1 -1
- package/dist/ezui/p-91f626d3.entry.js +1 -0
- package/dist/ezui/{p-3e7cc8a4.entry.js → p-99ead599.entry.js} +1 -1
- package/dist/ezui/p-99f46950.entry.js +1 -0
- package/dist/ezui/{p-7eb3e1a5.js → p-9e11fc7b.js} +1 -1
- package/dist/ezui/{p-b11f035c.entry.js → p-9f5fa3f9.entry.js} +1 -1
- package/dist/ezui/{p-2da09f70.entry.js → p-a80b1287.entry.js} +1 -1
- package/dist/ezui/{p-d20ed286.entry.js → p-af2ecb1b.entry.js} +1 -1
- package/dist/ezui/{p-e8f88361.entry.js → p-af95cd16.entry.js} +1 -1
- package/dist/ezui/p-bae3d0aa.entry.js +1 -0
- package/dist/ezui/{p-fb21d72f.entry.js → p-bae4e180.entry.js} +1 -1
- package/dist/ezui/p-baf80b13.entry.js +1 -0
- package/dist/ezui/p-bc2f844e.entry.js +1 -0
- package/dist/ezui/p-bf79aaa1.entry.js +1 -0
- package/dist/ezui/{p-83885b21.entry.js → p-cc2dc4f4.entry.js} +1 -1
- package/dist/ezui/p-d9401ea0.entry.js +1 -0
- package/dist/ezui/{p-028f264f.entry.js → p-e85c48d7.entry.js} +1 -1
- package/dist/ezui/p-f3c526cc.entry.js +1 -0
- package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +38 -4
- package/dist/types/components/ez-card-item/ez-card-item.d.ts +4 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -15
- package/dist/types/components/ez-dropdown/ez-dropdown.d.ts +5 -0
- package/dist/types/components/ez-form/ez-form.d.ts +12 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +7 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +10 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +4 -0
- package/dist/types/components/ez-grid/controller/ag-grid/DataSourceInterceptor.d.ts +8 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +35 -3
- 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/filter-column.d.ts +4 -1
- 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-guide-navigator/interfaces/IGuideItem.d.ts +0 -1
- package/dist/types/components/ez-modal/ez-modal.d.ts +9 -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 +1 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +9 -3
- package/dist/types/components/ez-search/ez-search.d.ts +101 -10
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +92 -0
- package/dist/types/components/ez-split-button/test/dropdownItems.d.ts +2 -0
- package/dist/types/components/ez-split-panel/ez-split-panel.d.ts +29 -0
- package/dist/types/components/ez-split-panel/structure/item/ez-split-item.d.ts +27 -0
- package/dist/types/components/ez-tree/interfaces/ITreeItem.d.ts +3 -1
- package/dist/types/components/ez-tree/interfaces/ITreeItemBadge.d.ts +6 -0
- package/dist/types/components/ez-tree/subcomponents/TreeItem.d.ts +0 -1
- package/dist/types/components.d.ts +225 -16
- package/dist/types/utils/CSSVarsUtils.d.ts +1 -0
- package/dist/types/utils/form/test/DataBinder.test.d.ts +1 -0
- package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +2 -1
- package/dist/types/utils/interfaces/IAction.d.ts +1 -1
- package/package.json +13 -5
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/ez-card-item.cjs.entry.js +0 -52
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +0 -137
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +0 -8
- package/dist/esm/ez-card-item.entry.js +0 -48
- package/dist/esm/ez-filter-input_2.entry.js +0 -132
- package/dist/ezui/p-12526044.entry.js +0 -1
- package/dist/ezui/p-32b4163f.entry.js +0 -1
- package/dist/ezui/p-47afb974.entry.js +0 -1
- package/dist/ezui/p-59bcb27c.entry.js +0 -1
- package/dist/ezui/p-62304715.entry.js +0 -1
- package/dist/ezui/p-74049254.entry.js +0 -1
- package/dist/ezui/p-76d16a24.entry.js +0 -1
- package/dist/ezui/p-7fd54841.entry.js +0 -1
- package/dist/ezui/p-87e85160.entry.js +0 -1
- package/dist/ezui/p-95426f93.entry.js +0 -1
- package/dist/ezui/p-99692afa.entry.js +0 -1
- package/dist/ezui/p-a01068e1.entry.js +0 -1
- package/dist/ezui/p-a42fe2ce.entry.js +0 -1
- package/dist/ezui/p-af285e68.entry.js +0 -1
- package/dist/ezui/p-b6867f19.entry.js +0 -1
- package/dist/ezui/p-d51aa09b.entry.js +0 -1
- package/dist/ezui/p-d81917fd.entry.js +0 -1
- package/dist/ezui/p-f8653522.entry.js +0 -1
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ElementIDUtils, JSUtils, StringUtils, } from '@sankhyalabs/core';
|
|
1
|
+
import { ElementIDUtils, JSUtils, OverflowWatcher, OVERFLOWED_CLASS_NAME, StringUtils, } from '@sankhyalabs/core';
|
|
2
2
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
3
|
-
import {
|
|
3
|
+
import { Host, h } from '@stencil/core';
|
|
4
|
+
import { ApplicationUtils } from '../../utils';
|
|
4
5
|
import AgGridController from './controller/ag-grid/AgGridController';
|
|
5
6
|
import { SelectionCounter } from './subcomponents/selection-counter';
|
|
6
|
-
import { ApplicationUtils } from '../../utils';
|
|
7
7
|
import InMemoryFilterColumnDataSource from './utils/InMemoryFilterColumnDataSource';
|
|
8
8
|
const windowInstace = window;
|
|
9
9
|
const matches = (text, filter) => {
|
|
10
|
-
const normalizedText = StringUtils.replaceAccentuatedCharsLower(text.toLocaleLowerCase());
|
|
10
|
+
const normalizedText = StringUtils.replaceAccentuatedCharsLower(text === null || text === void 0 ? void 0 : text.toLocaleLowerCase());
|
|
11
11
|
const normalizedFilter = StringUtils.replaceAccentuatedCharsLower(filter.toLocaleLowerCase());
|
|
12
|
-
return normalizedText.includes(normalizedFilter);
|
|
12
|
+
return normalizedText === null || normalizedText === void 0 ? void 0 : normalizedText.includes(normalizedFilter);
|
|
13
13
|
};
|
|
14
14
|
export class EzGrid {
|
|
15
15
|
constructor() {
|
|
@@ -22,6 +22,7 @@ export class EzGrid {
|
|
|
22
22
|
this._currentPageSelected = undefined;
|
|
23
23
|
this._selectionCount = undefined;
|
|
24
24
|
this._hasLeftButtons = false;
|
|
25
|
+
this._customFormatters = new Map();
|
|
25
26
|
this.multipleSelection = undefined;
|
|
26
27
|
this.config = undefined;
|
|
27
28
|
this.selectionToastConfig = undefined;
|
|
@@ -93,8 +94,52 @@ export class EzGrid {
|
|
|
93
94
|
async filterColumns(search) {
|
|
94
95
|
return Promise.resolve(this._gridController.getColumnsState().filter(col => matches(col.label, search)));
|
|
95
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Registra um formatador de valores para uma coluna da grid.
|
|
99
|
+
*/
|
|
100
|
+
async addCustomValueFormatter(columnName, customFormatter) {
|
|
101
|
+
if (!columnName || !customFormatter) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const newCustomFormatters = new Map(this._customFormatters);
|
|
105
|
+
newCustomFormatters.set(columnName, customFormatter);
|
|
106
|
+
this._customFormatters = newCustomFormatters;
|
|
107
|
+
this._gridController.setCustomFormatters(newCustomFormatters);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Remove o formatador de valores de uma coluna da grid.
|
|
111
|
+
*/
|
|
112
|
+
async removeCustomValueFormatter(columnName) {
|
|
113
|
+
if (!columnName) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const newCustomFormatters = new Map(this._customFormatters);
|
|
117
|
+
newCustomFormatters.delete(columnName);
|
|
118
|
+
this._customFormatters = newCustomFormatters;
|
|
119
|
+
this._gridController.setCustomFormatters(newCustomFormatters);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Atualiza linhas da grade.
|
|
123
|
+
*/
|
|
124
|
+
async refreshSelectedRows() {
|
|
125
|
+
this._gridController.refreshSelectedRows();
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Retorna o formatador customizado da coluna caso exista.
|
|
129
|
+
*/
|
|
130
|
+
async getCustomValueFormatter(columnName) {
|
|
131
|
+
return this._customFormatters.get(columnName);
|
|
132
|
+
}
|
|
96
133
|
observeConfig(config) {
|
|
97
|
-
this._gridController.setColumnsState(config.columns);
|
|
134
|
+
this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
|
|
135
|
+
}
|
|
136
|
+
updatePaginationTooltip() {
|
|
137
|
+
if (!this._refPaginationLabelTooltip)
|
|
138
|
+
return;
|
|
139
|
+
const alreadyDefined = this._refPaginationLabelTooltip.getAttribute('data-tooltip');
|
|
140
|
+
if (alreadyDefined) {
|
|
141
|
+
this._refPaginationLabelTooltip.setAttribute('data-tooltip', this._getPaginationTooltip());
|
|
142
|
+
}
|
|
98
143
|
}
|
|
99
144
|
onSelectionChange(evt) {
|
|
100
145
|
this._currentPageSelected = evt.detail.selectionHeaderStatus === true;
|
|
@@ -144,21 +189,29 @@ export class EzGrid {
|
|
|
144
189
|
return newConfig;
|
|
145
190
|
}
|
|
146
191
|
positionSelectionCounter() {
|
|
147
|
-
var _a;
|
|
148
|
-
if (this._gridSelectionCounter
|
|
192
|
+
var _a, _b;
|
|
193
|
+
if (!this._gridSelectionCounter)
|
|
149
194
|
return;
|
|
150
|
-
|
|
151
|
-
if (this._showSelectionCounter) {
|
|
152
|
-
const boundingContainer = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
153
|
-
if (boundingContainer == undefined) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const limitBottom = boundingContainer.bottom - 30;
|
|
157
|
-
this._gridSelectionCounter.style.bottom = document.body.clientHeight - limitBottom + 'px';
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
195
|
+
if (!this._showSelectionCounter) {
|
|
160
196
|
this._gridSelectionCounter.style.bottom = '';
|
|
197
|
+
return;
|
|
161
198
|
}
|
|
199
|
+
const containerRect = (_a = this._container) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
200
|
+
const selectionRect = (_b = this._gridSelectionCounter) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
201
|
+
if (!containerRect || !selectionRect)
|
|
202
|
+
return;
|
|
203
|
+
const positionBottom = containerRect.bottom - 30;
|
|
204
|
+
this._gridSelectionCounter.style.bottom = document.body.clientHeight - positionBottom + 'px';
|
|
205
|
+
this._gridSelectionCounter.style.left = this.calculatePositionLeft(containerRect, selectionRect);
|
|
206
|
+
}
|
|
207
|
+
calculatePositionLeft(containerRect, selectionRect) {
|
|
208
|
+
let selectionStart = containerRect.left + (containerRect.width / 2);
|
|
209
|
+
const containerRightEdge = containerRect.left + this._container.clientWidth;
|
|
210
|
+
const selectionEnd = (selectionStart - (selectionRect.width / 2)) + selectionRect.width;
|
|
211
|
+
if (selectionEnd > containerRightEdge) {
|
|
212
|
+
selectionStart = containerRightEdge - (selectionRect.width / 2);
|
|
213
|
+
}
|
|
214
|
+
return `${selectionStart}px`;
|
|
162
215
|
}
|
|
163
216
|
setEvents() {
|
|
164
217
|
window.removeEventListener('scroll', this.positionSelectionCounter.bind(this));
|
|
@@ -251,11 +304,10 @@ export class EzGrid {
|
|
|
251
304
|
}
|
|
252
305
|
getPaginationControl() {
|
|
253
306
|
if (this._paginationInfo) {
|
|
254
|
-
const {
|
|
307
|
+
const { currentPage, hasMore } = this._paginationInfo;
|
|
255
308
|
return [
|
|
256
|
-
h("div", { class: "ez-text ez-text--primary ez-text--medium ez-margin-right--medium" }, h("strong", { class: "ez-text ez-text--primary ez-text--medium" },
|
|
257
|
-
h("
|
|
258
|
-
h("ez-button", { size: "small", iconName: "chevron-right", class: "ez-margin-right--medium", mode: "icon", enabled: hasMore, onClick: () => this.nextPage(), label: "Pr\u00F3xima P\u00E1gina" }),
|
|
309
|
+
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())),
|
|
310
|
+
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" })),
|
|
259
311
|
];
|
|
260
312
|
}
|
|
261
313
|
return null;
|
|
@@ -264,16 +316,8 @@ export class EzGrid {
|
|
|
264
316
|
this._gridController.initDatagrid(this._container, {
|
|
265
317
|
onColumnStateChange: (type, state, info) => this.onColumnStateChange(type, state, info),
|
|
266
318
|
onSelectionChange: (selection) => this.ezSelectionChange.emit(selection),
|
|
267
|
-
onPaginationChange: (paginationInfo) => {
|
|
268
|
-
|
|
269
|
-
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
|
|
270
|
-
this._gridController.setFocusLastRow();
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
this._gridController.setFocusFirstRow();
|
|
274
|
-
this._paginationChangedByKeyboard = true;
|
|
275
|
-
}
|
|
276
|
-
this._paginationInfo = paginationInfo;
|
|
319
|
+
onPaginationChange: (paginationInfo, selectFirstRecord) => {
|
|
320
|
+
this.handlePaginationChange(selectFirstRecord, paginationInfo);
|
|
277
321
|
},
|
|
278
322
|
onPaginationUpdate: (paginationInfo) => {
|
|
279
323
|
this._paginationInfo = paginationInfo;
|
|
@@ -287,7 +331,8 @@ export class EzGrid {
|
|
|
287
331
|
statusResolver: this.statusResolver,
|
|
288
332
|
useEnterLikeTab: this.useEnterLikeTab,
|
|
289
333
|
recordsValidator: this.recordsValidator,
|
|
290
|
-
editionIsDisabled: () => !this.canEdit
|
|
334
|
+
editionIsDisabled: () => !this.canEdit,
|
|
335
|
+
customFormatters: this._customFormatters
|
|
291
336
|
});
|
|
292
337
|
if (this.config) {
|
|
293
338
|
this.observeConfig(this.config);
|
|
@@ -299,6 +344,66 @@ export class EzGrid {
|
|
|
299
344
|
this.setEvents();
|
|
300
345
|
this.componentReady.emit();
|
|
301
346
|
this._gridController.configFilterColumn(this._filterColumn);
|
|
347
|
+
this._initHeaderOverflowWatcher();
|
|
348
|
+
}
|
|
349
|
+
handlePaginationChange(selectFirstRecord, paginationInfo) {
|
|
350
|
+
var _a;
|
|
351
|
+
if (selectFirstRecord !== false) {
|
|
352
|
+
if (((_a = this._paginationInfo) === null || _a === void 0 ? void 0 : _a.currentPage) > (paginationInfo === null || paginationInfo === void 0 ? void 0 : paginationInfo.currentPage) && this._paginationChangedByKeyboard) {
|
|
353
|
+
this._gridController.setFocusLastRow();
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
this._gridController.setFocusFirstRow();
|
|
357
|
+
this._paginationChangedByKeyboard = true;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
this._paginationInfo = paginationInfo;
|
|
361
|
+
}
|
|
362
|
+
_getActualPageLabel() {
|
|
363
|
+
const { firstRecord, lastRecord } = this._paginationInfo;
|
|
364
|
+
return `${firstRecord}-${lastRecord}`;
|
|
365
|
+
}
|
|
366
|
+
_getRemainingPageLabel() {
|
|
367
|
+
const { total, count } = this._paginationInfo;
|
|
368
|
+
return `${total == undefined ? ` de ${count + 1} ou mais` : ` de ${total}`}`;
|
|
369
|
+
}
|
|
370
|
+
_getPaginationTooltip() {
|
|
371
|
+
return this._getActualPageLabel() + this._getRemainingPageLabel();
|
|
372
|
+
}
|
|
373
|
+
_initHeaderOverflowWatcher() {
|
|
374
|
+
this._headerOverflowWatcher = new OverflowWatcher(this.buildOverFlowWatcherParams());
|
|
375
|
+
}
|
|
376
|
+
buildOverFlowWatcherParams() {
|
|
377
|
+
return {
|
|
378
|
+
element: this._refPaginationControl,
|
|
379
|
+
callback: this.handleOverFlow.bind(this),
|
|
380
|
+
notOverFlow: ["grid-pagination-tooltip"]
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
handleOverFlow(elementsOverflow) {
|
|
384
|
+
if (!this._refPaginationLabel)
|
|
385
|
+
return;
|
|
386
|
+
if (elementsOverflow.length > 0) {
|
|
387
|
+
this._hidePaginationDescription();
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
this._showPaginationDescription();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
_hidePaginationDescription() {
|
|
394
|
+
this._refPaginationLabel.classList.add(OVERFLOWED_CLASS_NAME);
|
|
395
|
+
this._refPaginationLabelTooltip.setAttribute('data-flow', 'bottom');
|
|
396
|
+
this._refPaginationLabelTooltip.setAttribute('data-tooltip', this._getPaginationTooltip());
|
|
397
|
+
}
|
|
398
|
+
;
|
|
399
|
+
_showPaginationDescription() {
|
|
400
|
+
this._refPaginationLabel.classList.remove(OVERFLOWED_CLASS_NAME);
|
|
401
|
+
this._refPaginationLabelTooltip.removeAttribute('data-flow');
|
|
402
|
+
this._refPaginationLabelTooltip.removeAttribute('data-tooltip');
|
|
403
|
+
}
|
|
404
|
+
disconnectedCallback() {
|
|
405
|
+
var _a;
|
|
406
|
+
(_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
302
407
|
}
|
|
303
408
|
componentWillRender() {
|
|
304
409
|
this.configSelectionCounter();
|
|
@@ -322,7 +427,7 @@ export class EzGrid {
|
|
|
322
427
|
}
|
|
323
428
|
render() {
|
|
324
429
|
var _a;
|
|
325
|
-
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" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
|
|
430
|
+
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" })), h("div", { class: "grid-header__container grid-header__pagination", ref: ref => (this._refPaginationControl = ref) }, this.getPaginationControl()))), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
|
|
326
431
|
${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
|
|
327
432
|
` }, 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" }))));
|
|
328
433
|
}
|
|
@@ -545,7 +650,8 @@ export class EzGrid {
|
|
|
545
650
|
"_isAllSelection": {},
|
|
546
651
|
"_currentPageSelected": {},
|
|
547
652
|
"_selectionCount": {},
|
|
548
|
-
"_hasLeftButtons": {}
|
|
653
|
+
"_hasLeftButtons": {},
|
|
654
|
+
"_customFormatters": {}
|
|
549
655
|
};
|
|
550
656
|
}
|
|
551
657
|
static get events() {
|
|
@@ -879,6 +985,90 @@ export class EzGrid {
|
|
|
879
985
|
"text": "Usa um argumento para filtrar as colunas po label",
|
|
880
986
|
"tags": []
|
|
881
987
|
}
|
|
988
|
+
},
|
|
989
|
+
"addCustomValueFormatter": {
|
|
990
|
+
"complexType": {
|
|
991
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
|
992
|
+
"parameters": [{
|
|
993
|
+
"tags": [],
|
|
994
|
+
"text": ""
|
|
995
|
+
}, {
|
|
996
|
+
"tags": [],
|
|
997
|
+
"text": ""
|
|
998
|
+
}],
|
|
999
|
+
"references": {
|
|
1000
|
+
"Promise": {
|
|
1001
|
+
"location": "global"
|
|
1002
|
+
},
|
|
1003
|
+
"ICustomFormatter": {
|
|
1004
|
+
"location": "import",
|
|
1005
|
+
"path": "./interfaces"
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
"return": "Promise<void>"
|
|
1009
|
+
},
|
|
1010
|
+
"docs": {
|
|
1011
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
|
1012
|
+
"tags": []
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
"removeCustomValueFormatter": {
|
|
1016
|
+
"complexType": {
|
|
1017
|
+
"signature": "(columnName: string) => Promise<void>",
|
|
1018
|
+
"parameters": [{
|
|
1019
|
+
"tags": [],
|
|
1020
|
+
"text": ""
|
|
1021
|
+
}],
|
|
1022
|
+
"references": {
|
|
1023
|
+
"Promise": {
|
|
1024
|
+
"location": "global"
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
"return": "Promise<void>"
|
|
1028
|
+
},
|
|
1029
|
+
"docs": {
|
|
1030
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
|
1031
|
+
"tags": []
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
"refreshSelectedRows": {
|
|
1035
|
+
"complexType": {
|
|
1036
|
+
"signature": "() => Promise<void>",
|
|
1037
|
+
"parameters": [],
|
|
1038
|
+
"references": {
|
|
1039
|
+
"Promise": {
|
|
1040
|
+
"location": "global"
|
|
1041
|
+
}
|
|
1042
|
+
},
|
|
1043
|
+
"return": "Promise<void>"
|
|
1044
|
+
},
|
|
1045
|
+
"docs": {
|
|
1046
|
+
"text": "Atualiza linhas da grade.",
|
|
1047
|
+
"tags": []
|
|
1048
|
+
}
|
|
1049
|
+
},
|
|
1050
|
+
"getCustomValueFormatter": {
|
|
1051
|
+
"complexType": {
|
|
1052
|
+
"signature": "(columnName: string) => Promise<ICustomFormatter | undefined>",
|
|
1053
|
+
"parameters": [{
|
|
1054
|
+
"tags": [],
|
|
1055
|
+
"text": ""
|
|
1056
|
+
}],
|
|
1057
|
+
"references": {
|
|
1058
|
+
"Promise": {
|
|
1059
|
+
"location": "global"
|
|
1060
|
+
},
|
|
1061
|
+
"ICustomFormatter": {
|
|
1062
|
+
"location": "import",
|
|
1063
|
+
"path": "./interfaces"
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
"return": "Promise<ICustomFormatter>"
|
|
1067
|
+
},
|
|
1068
|
+
"docs": {
|
|
1069
|
+
"text": "Retorna o formatador customizado da coluna caso exista.",
|
|
1070
|
+
"tags": []
|
|
1071
|
+
}
|
|
882
1072
|
}
|
|
883
1073
|
};
|
|
884
1074
|
}
|
|
@@ -887,6 +1077,9 @@ export class EzGrid {
|
|
|
887
1077
|
return [{
|
|
888
1078
|
"propName": "config",
|
|
889
1079
|
"methodName": "observeConfig"
|
|
1080
|
+
}, {
|
|
1081
|
+
"propName": "_paginationInfo",
|
|
1082
|
+
"methodName": "updatePaginationTooltip"
|
|
890
1083
|
}];
|
|
891
1084
|
}
|
|
892
1085
|
static get listeners() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,6 +13,8 @@ export class FilterColumn {
|
|
|
13
13
|
this.TOP_POSITION_NO_TASKBAR = '32';
|
|
14
14
|
this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN = '20';
|
|
15
15
|
this.DEFAULT_HEIGHT = 430;
|
|
16
|
+
this.FIX_MARGIN = 60;
|
|
17
|
+
this.FILTER_COLUMN_WIDTH = 330;
|
|
16
18
|
this.opened = true;
|
|
17
19
|
this.columnName = undefined;
|
|
18
20
|
this.columnLabel = undefined;
|
|
@@ -45,15 +47,24 @@ export class FilterColumn {
|
|
|
45
47
|
await this.ezPopoverElement.show(this.calcTopPosition(), this.calculateLeftPosition(configs));
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
calculateLeftPosition(
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
calculateLeftPosition({ leftPosition, fromIcon }) {
|
|
51
|
+
const leftPositionCalculated = this.calcFilterColumnLeftPosition(leftPosition);
|
|
52
|
+
if (!fromIcon) {
|
|
53
|
+
return `${leftPositionCalculated}px`;
|
|
51
54
|
}
|
|
52
55
|
const difference = this.ezPopoverElement.getBoundingClientRect().left;
|
|
53
|
-
const
|
|
54
|
-
const leftResolved = (leftReference + 16) - difference;
|
|
56
|
+
const leftResolved = (leftPositionCalculated + 16) - difference;
|
|
55
57
|
return `${(leftResolved > 0 ? leftResolved : 0)}px`;
|
|
56
58
|
}
|
|
59
|
+
calcFilterColumnLeftPosition(leftReference) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
const gridReference = this.ezPopoverElement.closest("ez-grid");
|
|
62
|
+
const gridLimit = (_a = gridReference.getBoundingClientRect()) === null || _a === void 0 ? void 0 : _a.right;
|
|
63
|
+
const popoverDiff = (_b = this.ezPopoverElement.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.left;
|
|
64
|
+
const maxLeft = gridLimit - (this.FILTER_COLUMN_WIDTH + popoverDiff);
|
|
65
|
+
const leftInt = leftReference - (this.FIX_MARGIN + popoverDiff);
|
|
66
|
+
return leftInt > maxLeft ? maxLeft : leftInt;
|
|
67
|
+
}
|
|
57
68
|
buildIsTextSearch() {
|
|
58
69
|
var _a, _b;
|
|
59
70
|
const userInterface = (_b = (_a = this.fieldDescriptor) === null || _a === void 0 ? void 0 : _a.userInterface) !== null && _b !== void 0 ? _b : UserInterface.SHORTTEXT;
|
|
@@ -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,24 @@
|
|
|
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
|
+
if (selectionCount > 1) {
|
|
21
|
+
return `Os <strong>${selectionCount} registros</strong> dessa página estão selecionados.`;
|
|
22
|
+
}
|
|
23
|
+
return "O único registro dessa página está selecionado";
|
|
24
|
+
}
|
|
@@ -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
|
+
}
|