@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-50898.1 → 0.0.0-bugfix-dev-59880.0
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/ICustomRender-6fafffce.js +13 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -0
- package/dist/cjs/ez-alert-list.cjs.entry.js +11 -1
- package/dist/cjs/ez-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +1 -0
- package/dist/cjs/{ez-text-edit.cjs.entry.js → ez-custom-form-input_2.cjs.entry.js} +86 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +36 -4
- package/dist/cjs/ez-form.cjs.entry.js +51 -2
- package/dist/cjs/ez-grid.cjs.entry.js +322 -19
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +15 -4
- package/dist/cjs/ez-modal.cjs.entry.js +7 -8
- package/dist/cjs/ez-number-input.cjs.entry.js +9 -2
- package/dist/cjs/ez-popup.cjs.entry.js +14 -8
- package/dist/cjs/ez-search.cjs.entry.js +6 -2
- package/dist/cjs/ez-split-item.cjs.entry.js +3 -2
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +11 -1
- 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-date-input/ez-date-input.js +1 -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 +245 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +92 -2
- 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 +62 -4
- 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/ez-grid.js +206 -2
- 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 +12 -1
- package/dist/collection/components/ez-popup/ez-popup.js +14 -8
- package/dist/collection/components/ez-search/ez-search.js +5 -2
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +0 -7
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.js +1 -1
- 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/index.js +2 -0
- package/dist/custom-elements/index.d.ts +6 -0
- package/dist/custom-elements/index.js +580 -61
- package/dist/esm/ICustomRender-875b5a40.js +13 -0
- package/dist/esm/ez-actions-button.entry.js +1 -0
- package/dist/esm/ez-alert-list.entry.js +11 -1
- package/dist/esm/ez-button.entry.js +2 -2
- package/dist/esm/ez-collapsible-box.entry.js +1 -0
- package/dist/esm/ez-combo-box.entry.js +1 -0
- package/dist/esm/{ez-text-edit.entry.js → ez-custom-form-input_2.entry.js} +88 -3
- package/dist/esm/ez-date-input.entry.js +1 -0
- package/dist/esm/ez-form-view.entry.js +36 -4
- package/dist/esm/ez-form.entry.js +51 -2
- package/dist/esm/ez-grid.entry.js +322 -19
- package/dist/esm/ez-list.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-number-input.entry.js +9 -2
- package/dist/esm/ez-popup.entry.js +15 -9
- package/dist/esm/ez-search.entry.js +6 -2
- package/dist/esm/ez-split-item.entry.js +3 -2
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-09de35a2.entry.js +1 -0
- package/dist/ezui/p-13d2fe2d.entry.js +1 -0
- package/dist/ezui/{p-384247cd.entry.js → p-1f96ba9a.entry.js} +2 -2
- package/dist/ezui/p-204b1439.entry.js +1 -0
- package/dist/ezui/p-2b8da3a4.entry.js +1 -0
- package/dist/ezui/p-30775e7f.entry.js +1 -0
- package/dist/ezui/p-4607fb89.js +1 -0
- package/dist/ezui/{p-2a1a0e04.entry.js → p-77362d3a.entry.js} +1 -1
- package/dist/ezui/{p-8defa6d3.entry.js → p-786559c5.entry.js} +1 -1
- package/dist/ezui/p-7922142b.entry.js +1 -0
- package/dist/ezui/p-84e439b9.entry.js +1 -0
- package/dist/ezui/p-922ac38b.entry.js +1 -0
- package/dist/ezui/p-bae4e180.entry.js +1 -0
- package/dist/ezui/p-bcb53f27.entry.js +1 -0
- package/dist/ezui/p-c942e4a7.entry.js +1 -0
- package/dist/ezui/p-d9401ea0.entry.js +1 -0
- package/dist/ezui/p-e90dd4eb.entry.js +1 -0
- package/dist/ezui/p-f3c526cc.entry.js +1 -0
- package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +5 -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 +41 -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 +29 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +11 -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 +30 -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 +1 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +3 -3
- package/dist/types/components.d.ts +124 -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/index.d.ts +2 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -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-5e1d036e.entry.js +0 -1
- package/dist/ezui/p-701231f0.entry.js +0 -1
- package/dist/ezui/p-7a636dfc.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-9f1e89c9.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-db77a984.entry.js +0 -1
- package/dist/ezui/p-e228ccb9.entry.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ApplicationContext, DataType, MaskFormatter, NumberUtils, SortMode, StringUtils, UserInterface, } from '@sankhyalabs/core';
|
|
2
|
-
import { Grid
|
|
2
|
+
import { Grid } from 'ag-grid-community';
|
|
3
3
|
import { Grid as EnterpriseGrid, LicenseManager } from 'ag-grid-enterprise';
|
|
4
4
|
import DataSource from './DataSource';
|
|
5
5
|
import { EzGridCustomHeader } from './components/EzGridCustomHeader';
|
|
6
6
|
import { CellRendererStatus } from './components/cellRendererStatus';
|
|
7
7
|
import SelectionHeader from './components/selectionHeader';
|
|
8
|
-
import gridTerms from './i18n/pt-BR
|
|
8
|
+
import gridTerms from './i18n/pt-BR';
|
|
9
9
|
import { DISTINCT_FILTER_NAME_PREFIX, EZ_GRID_LOADING_SOURCE } from '../../../../utils/constants';
|
|
10
10
|
import GridEditionManager from './GridEditionManager';
|
|
11
11
|
export default class AgGridController {
|
|
@@ -42,6 +42,7 @@ export default class AgGridController {
|
|
|
42
42
|
this._gridConfig = [];
|
|
43
43
|
this._filteredColumns = new Map();
|
|
44
44
|
this._filterColumnleftPosition = 0;
|
|
45
|
+
this._customFormatters = new Map();
|
|
45
46
|
this._enterprise = enterprise;
|
|
46
47
|
}
|
|
47
48
|
getGridConfig() {
|
|
@@ -125,7 +126,7 @@ export default class AgGridController {
|
|
|
125
126
|
this._doubleClickCallBack = options.onDoubleClick;
|
|
126
127
|
this._multipleSelection = options.allowMultipleSelection;
|
|
127
128
|
this._dataUnit = options.dataUnit;
|
|
128
|
-
this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled);
|
|
129
|
+
this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders);
|
|
129
130
|
this._statusResolver = options.statusResolver;
|
|
130
131
|
if (this._dataUnit) {
|
|
131
132
|
this._dataUnit.sortingProvider = this;
|
|
@@ -157,6 +158,13 @@ export default class AgGridController {
|
|
|
157
158
|
headerCheckStatusGetter: () => this.getSelectionHeaderStatus(),
|
|
158
159
|
headerCheckStatusSetter: (selectAll) => this.updateSelectionForAll(selectAll),
|
|
159
160
|
},
|
|
161
|
+
processCellForClipboard: this.processFormatterCellCallback,
|
|
162
|
+
defaultExcelExportParams: {
|
|
163
|
+
processCellCallback: this.processFormatterCellCallback
|
|
164
|
+
},
|
|
165
|
+
defaultCsvExportParams: {
|
|
166
|
+
processCellCallback: this.processFormatterCellCallback
|
|
167
|
+
}
|
|
160
168
|
};
|
|
161
169
|
this.defineRowModelType(this._gridOptions, options);
|
|
162
170
|
this.setOptionsEvents(this._gridOptions);
|
|
@@ -180,7 +188,25 @@ export default class AgGridController {
|
|
|
180
188
|
this.selectRows((selection === null || selection === void 0 ? void 0 : selection.recordIds) || [], true);
|
|
181
189
|
}
|
|
182
190
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
191
|
+
this._customFormatters = options.customFormatters;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
processFormatterCellCallback(params) {
|
|
195
|
+
const column = params.column.getColDef();
|
|
196
|
+
if (typeof column.valueFormatter === 'function') {
|
|
197
|
+
const valueParams = {
|
|
198
|
+
value: params.value,
|
|
199
|
+
data: params.node.data,
|
|
200
|
+
node: params.node,
|
|
201
|
+
colDef: column,
|
|
202
|
+
column: params.column,
|
|
203
|
+
api: params.api,
|
|
204
|
+
columnApi: params.columnApi,
|
|
205
|
+
context: params.context,
|
|
206
|
+
};
|
|
207
|
+
return column.valueFormatter(valueParams);
|
|
183
208
|
}
|
|
209
|
+
return params.value;
|
|
184
210
|
}
|
|
185
211
|
setFilterColumnLeftPosition({ type, ePopup }) {
|
|
186
212
|
if (type === 'columnMenu') {
|
|
@@ -530,7 +556,7 @@ export default class AgGridController {
|
|
|
530
556
|
//Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
|
|
531
557
|
const columnsOffset = colDef.length - columns.length;
|
|
532
558
|
let sort = [];
|
|
533
|
-
state.forEach((cfgColumn, index) => {
|
|
559
|
+
state === null || state === void 0 ? void 0 : state.forEach((cfgColumn, index) => {
|
|
534
560
|
const colWidth = this.getColumnWidth(cfgColumn);
|
|
535
561
|
this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
|
|
536
562
|
this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
|
|
@@ -633,6 +659,13 @@ export default class AgGridController {
|
|
|
633
659
|
if (params.value instanceof Promise) {
|
|
634
660
|
return "Carregando...";
|
|
635
661
|
}
|
|
662
|
+
const customFormatter = this._customFormatters.get(source.name);
|
|
663
|
+
if (customFormatter) {
|
|
664
|
+
const formattedValue = customFormatter.format(params.value, source, params.data.__record__id__);
|
|
665
|
+
if (formattedValue) {
|
|
666
|
+
return formattedValue;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
636
669
|
if (this._dataUnit) {
|
|
637
670
|
return this._dataUnit.getFormattedValue(source.name, params.value);
|
|
638
671
|
}
|
|
@@ -641,6 +674,13 @@ export default class AgGridController {
|
|
|
641
674
|
cellStyle: this.getStyleByColumn(source),
|
|
642
675
|
});
|
|
643
676
|
}
|
|
677
|
+
setCustomFormatters(customFormatters) {
|
|
678
|
+
this._customFormatters = customFormatters;
|
|
679
|
+
}
|
|
680
|
+
refreshSelectedRows() {
|
|
681
|
+
const selectedNodes = this._gridOptions.api.getSelectedNodes();
|
|
682
|
+
this._gridOptions.api.redrawRows({ rowNodes: selectedNodes });
|
|
683
|
+
}
|
|
644
684
|
getInitCellStyle() {
|
|
645
685
|
return {
|
|
646
686
|
'line-height': this.getRowHeight() - 1 + 'px',
|
|
@@ -816,4 +856,22 @@ export default class AgGridController {
|
|
|
816
856
|
const labelSize = (((_b = field === null || field === void 0 ? void 0 : field.label) === null || _b === void 0 ? void 0 : _b.length) || 0) * this.DEFAULT_FONT_SIZE + this.DEFAULT_ICON_SIZE;
|
|
817
857
|
return labelSize > this.DEFAULT_MAX_SIZE ? this.DEFAULT_MAX_SIZE : labelSize;
|
|
818
858
|
}
|
|
859
|
+
setCellEditors(customEditors) {
|
|
860
|
+
var _a;
|
|
861
|
+
if (!this._editionManager) {
|
|
862
|
+
this._customEditors = customEditors;
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
this._editionManager.setCellEditors(customEditors);
|
|
866
|
+
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
|
|
867
|
+
}
|
|
868
|
+
setCellRenders(customRenders) {
|
|
869
|
+
var _a;
|
|
870
|
+
if (!this._editionManager) {
|
|
871
|
+
this._customRenders = customRenders;
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
this._editionManager.setCellRenders(customRenders);
|
|
875
|
+
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
|
|
876
|
+
}
|
|
819
877
|
}
|
|
@@ -2,8 +2,10 @@ import { UserInterface } from "@sankhyalabs/core";
|
|
|
2
2
|
import { KeyCode } from "ag-grid-community";
|
|
3
3
|
import { RecordValidationProcessor } from "../../../../utils/validators/recordvalidator/RecordValidationProcessor";
|
|
4
4
|
import EzCellEditor from "./editor/EzCellEditor";
|
|
5
|
+
import EzGridCustomCellEditor from "./components/EzGridCustomCellEditor";
|
|
6
|
+
import EzGridCustomCellRender from "./components/EzGridCustomCellRender";
|
|
5
7
|
export default class GridEditionManager {
|
|
6
|
-
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled) {
|
|
8
|
+
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders) {
|
|
7
9
|
this._dataUnit = dataUnit;
|
|
8
10
|
this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
9
11
|
getRequiredFields: () => this.getRequiredFields(),
|
|
@@ -12,6 +14,8 @@ export default class GridEditionManager {
|
|
|
12
14
|
}, recordsValidator);
|
|
13
15
|
this._useEnterLikeTab = useEnterLikeTab;
|
|
14
16
|
this._editionIsDisabled = editionIsDisabled;
|
|
17
|
+
this._customEditors = customEditors;
|
|
18
|
+
this._customRenders = customRenders;
|
|
15
19
|
}
|
|
16
20
|
configureGrid(options) {
|
|
17
21
|
this._gridOptions = options;
|
|
@@ -78,6 +82,30 @@ export default class GridEditionManager {
|
|
|
78
82
|
col.suppressKeyboardEvent = (params) => {
|
|
79
83
|
return params.event.key === KeyCode.ENTER;
|
|
80
84
|
};
|
|
85
|
+
col.cellEditorSelector = (params) => {
|
|
86
|
+
var _a;
|
|
87
|
+
if ((_a = this._customEditors) === null || _a === void 0 ? void 0 : _a.has(params.colDef.field)) {
|
|
88
|
+
const customEditor = this._customEditors.get(params.colDef.field);
|
|
89
|
+
return {
|
|
90
|
+
component: EzGridCustomCellEditor,
|
|
91
|
+
params: {
|
|
92
|
+
customEditorsInfo: customEditor,
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
col.cellRendererSelector = (params) => {
|
|
98
|
+
var _a;
|
|
99
|
+
if ((_a = this._customRenders) === null || _a === void 0 ? void 0 : _a.has(params.colDef.field)) {
|
|
100
|
+
const customRender = this._customRenders.get(params.colDef.field);
|
|
101
|
+
return {
|
|
102
|
+
component: EzGridCustomCellRender,
|
|
103
|
+
params: {
|
|
104
|
+
customRendersInfo: customRender,
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
81
109
|
return col;
|
|
82
110
|
}
|
|
83
111
|
getRequiredFields() {
|
|
@@ -219,6 +247,12 @@ export default class GridEditionManager {
|
|
|
219
247
|
this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
|
|
220
248
|
}
|
|
221
249
|
}
|
|
250
|
+
setCellEditors(customEditors) {
|
|
251
|
+
this._customEditors = customEditors;
|
|
252
|
+
}
|
|
253
|
+
setCellRenders(customRenders) {
|
|
254
|
+
this._customRenders = customRenders;
|
|
255
|
+
}
|
|
222
256
|
}
|
|
223
257
|
class TargetEdition {
|
|
224
258
|
constructor(rowIndex, column, backwards) {
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { HTMLBuilder } from "@sankhyalabs/core";
|
|
2
|
+
import { CustomEditorSource } from "../../../../../utils/customEditor/interfaces/ICustomEditor";
|
|
3
|
+
import EzCellEditor from "../editor/EzCellEditor";
|
|
4
|
+
export default class EzGridCustomCellEditor extends EzCellEditor {
|
|
5
|
+
init(params) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
this._value = params.value;
|
|
8
|
+
this._fieldName = params.column.getColId();
|
|
9
|
+
this._customEditorInstance = params.customEditorsInfo.customEditor;
|
|
10
|
+
super.init(params);
|
|
11
|
+
this._defaultGui = this.getDefaultGui();
|
|
12
|
+
const fieldMetadata = super.getFieldMetadata();
|
|
13
|
+
this._params = {
|
|
14
|
+
value: params.value,
|
|
15
|
+
charPress: params.charPress,
|
|
16
|
+
currentEditor: this._defaultGui,
|
|
17
|
+
name: this._fieldName,
|
|
18
|
+
source: CustomEditorSource.GRID,
|
|
19
|
+
detailContext: params.customEditorsInfo.detailContext,
|
|
20
|
+
setValue: (value) => this.setValue(value),
|
|
21
|
+
getValue: () => this.getValue(),
|
|
22
|
+
editorMetadata: {
|
|
23
|
+
hidden: ((_a = fieldMetadata.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
24
|
+
label: fieldMetadata.label,
|
|
25
|
+
userInterface: fieldMetadata.userInterface,
|
|
26
|
+
props: fieldMetadata.props,
|
|
27
|
+
optionLoader: fieldMetadata.optionLoader,
|
|
28
|
+
options: ((_b = fieldMetadata.props) === null || _b === void 0 ? void 0 : _b.options) || {},
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
getDefaultGui() {
|
|
33
|
+
const gui = super.getGui();
|
|
34
|
+
gui.value = this._value;
|
|
35
|
+
gui.onkeyup = (event) => {
|
|
36
|
+
const value = event.target.value;
|
|
37
|
+
this.setValue(value);
|
|
38
|
+
};
|
|
39
|
+
return gui;
|
|
40
|
+
}
|
|
41
|
+
getGui() {
|
|
42
|
+
const editorElement = this._customEditorInstance.getEditorElement(this._params);
|
|
43
|
+
if (!editorElement) {
|
|
44
|
+
return this._defaultGui;
|
|
45
|
+
}
|
|
46
|
+
if (typeof editorElement === 'string') {
|
|
47
|
+
const element = HTMLBuilder.parseElement(editorElement);
|
|
48
|
+
return element;
|
|
49
|
+
}
|
|
50
|
+
return editorElement;
|
|
51
|
+
}
|
|
52
|
+
setValue(value) {
|
|
53
|
+
this._value = value;
|
|
54
|
+
}
|
|
55
|
+
getValue() {
|
|
56
|
+
return this._value;
|
|
57
|
+
}
|
|
58
|
+
}
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import EzCellRender from "../editor/EzCellRender";
|
|
2
|
+
import { HTMLBuilder } from "@sankhyalabs/core";
|
|
3
|
+
import { CustomRenderSource } from "../../../../../utils/customRender/interfaces/ICustomRender";
|
|
4
|
+
export default class EzGridCustomCellRender extends EzCellRender {
|
|
5
|
+
init(params) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
this._fieldName = params.column.getColId();
|
|
8
|
+
this._customRenderInstance = params.customRendersInfo.customRender;
|
|
9
|
+
super.init(params);
|
|
10
|
+
const fieldMetadata = super.getFieldMetadata();
|
|
11
|
+
this._params = {
|
|
12
|
+
value: params.value,
|
|
13
|
+
charPress: '',
|
|
14
|
+
currentRender: super.getGui(),
|
|
15
|
+
name: this._fieldName,
|
|
16
|
+
source: CustomRenderSource.GRID,
|
|
17
|
+
getValue: () => params.getValue(),
|
|
18
|
+
detailContext: params.customRendersInfo.detailContext,
|
|
19
|
+
renderMetadata: {
|
|
20
|
+
hidden: ((_a = fieldMetadata.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
21
|
+
label: fieldMetadata.label,
|
|
22
|
+
userInterface: fieldMetadata.userInterface,
|
|
23
|
+
props: fieldMetadata.props,
|
|
24
|
+
optionLoader: fieldMetadata.optionLoader,
|
|
25
|
+
options: ((_b = fieldMetadata.props) === null || _b === void 0 ? void 0 : _b.options) || {},
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
getGui() {
|
|
30
|
+
const editorElement = this._customRenderInstance.getRenderElement(this._params);
|
|
31
|
+
if (!editorElement) {
|
|
32
|
+
return super.getGui();
|
|
33
|
+
}
|
|
34
|
+
if (typeof editorElement === 'string') {
|
|
35
|
+
const element = HTMLBuilder.parseElement(editorElement);
|
|
36
|
+
return element;
|
|
37
|
+
}
|
|
38
|
+
return editorElement;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataType, UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
export const metadata = {
|
|
3
|
+
name: 'metadatada',
|
|
4
|
+
label: 'metadatada',
|
|
5
|
+
fields: [{
|
|
6
|
+
name: 'FIELDNAME',
|
|
7
|
+
label: 'Test',
|
|
8
|
+
dataType: DataType.TEXT,
|
|
9
|
+
userInterface: UserInterface.SHORTTEXT,
|
|
10
|
+
}],
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataType, UserInterface } from "@sankhyalabs/core";
|
|
2
|
+
export const metadata = {
|
|
3
|
+
name: 'metadatada',
|
|
4
|
+
label: 'metadatada',
|
|
5
|
+
fields: [{
|
|
6
|
+
name: 'FIELDNAME',
|
|
7
|
+
label: 'Test',
|
|
8
|
+
dataType: DataType.TEXT,
|
|
9
|
+
userInterface: UserInterface.SHORTTEXT,
|
|
10
|
+
}],
|
|
11
|
+
};
|
|
@@ -20,9 +20,9 @@ export default class EzCellEditor {
|
|
|
20
20
|
init(params) {
|
|
21
21
|
const fieldName = params.column.getColId();
|
|
22
22
|
const dataUnit = params.context.dataUnit;
|
|
23
|
-
|
|
24
|
-
const builder = uiBuilders.get(
|
|
25
|
-
this._gui = builder(
|
|
23
|
+
this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
|
|
24
|
+
const builder = uiBuilders.get(this._fieldMetadata.userInterface) || buildTextInput;
|
|
25
|
+
this._gui = builder(this._fieldMetadata);
|
|
26
26
|
if (this._gui.valueSetter != undefined) {
|
|
27
27
|
this._gui.valueSetter(params.value);
|
|
28
28
|
}
|
|
@@ -46,4 +46,7 @@ export default class EzCellEditor {
|
|
|
46
46
|
isPopup() {
|
|
47
47
|
return this._gui.isPopUp;
|
|
48
48
|
}
|
|
49
|
+
getFieldMetadata() {
|
|
50
|
+
return this._fieldMetadata;
|
|
51
|
+
}
|
|
49
52
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { buildEditorMetadata } from "./IEditorMetadata";
|
|
2
|
+
export default class EzCellRender {
|
|
3
|
+
init(params) {
|
|
4
|
+
const span = document.createElement('span');
|
|
5
|
+
this._currentParams = params;
|
|
6
|
+
span.textContent = params.value;
|
|
7
|
+
const fieldName = params.column.getColId();
|
|
8
|
+
const dataUnit = params.context.dataUnit;
|
|
9
|
+
this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
|
|
10
|
+
this._gui = span;
|
|
11
|
+
}
|
|
12
|
+
refresh() {
|
|
13
|
+
try {
|
|
14
|
+
this._currentParams.refreshCell();
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (_a) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
getGui() {
|
|
22
|
+
return this._gui;
|
|
23
|
+
}
|
|
24
|
+
afterGuiAttached() {
|
|
25
|
+
this.focusIn();
|
|
26
|
+
}
|
|
27
|
+
focusIn() {
|
|
28
|
+
this._gui.focus();
|
|
29
|
+
this._gui.setFocus({ selectText: true });
|
|
30
|
+
}
|
|
31
|
+
getValue() {
|
|
32
|
+
return this._currentParams.getValue();
|
|
33
|
+
}
|
|
34
|
+
isPopup() {
|
|
35
|
+
return this._gui.isPopUp;
|
|
36
|
+
}
|
|
37
|
+
getFieldMetadata() {
|
|
38
|
+
return this._fieldMetadata;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,63 @@ 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
|
+
}
|
|
96
156
|
observeConfig(config) {
|
|
97
157
|
this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
|
|
98
158
|
}
|
|
@@ -294,7 +354,8 @@ export class EzGrid {
|
|
|
294
354
|
statusResolver: this.statusResolver,
|
|
295
355
|
useEnterLikeTab: this.useEnterLikeTab,
|
|
296
356
|
recordsValidator: this.recordsValidator,
|
|
297
|
-
editionIsDisabled: () => !this.canEdit
|
|
357
|
+
editionIsDisabled: () => !this.canEdit,
|
|
358
|
+
customFormatters: this._customFormatters
|
|
298
359
|
});
|
|
299
360
|
if (this.config) {
|
|
300
361
|
this.observeConfig(this.config);
|
|
@@ -612,7 +673,8 @@ export class EzGrid {
|
|
|
612
673
|
"_isAllSelection": {},
|
|
613
674
|
"_currentPageSelected": {},
|
|
614
675
|
"_selectionCount": {},
|
|
615
|
-
"_hasLeftButtons": {}
|
|
676
|
+
"_hasLeftButtons": {},
|
|
677
|
+
"_customFormatters": {}
|
|
616
678
|
};
|
|
617
679
|
}
|
|
618
680
|
static get events() {
|
|
@@ -946,6 +1008,148 @@ export class EzGrid {
|
|
|
946
1008
|
"text": "Usa um argumento para filtrar as colunas po label",
|
|
947
1009
|
"tags": []
|
|
948
1010
|
}
|
|
1011
|
+
},
|
|
1012
|
+
"addCustomEditor": {
|
|
1013
|
+
"complexType": {
|
|
1014
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
|
1015
|
+
"parameters": [{
|
|
1016
|
+
"tags": [],
|
|
1017
|
+
"text": ""
|
|
1018
|
+
}, {
|
|
1019
|
+
"tags": [],
|
|
1020
|
+
"text": ""
|
|
1021
|
+
}, {
|
|
1022
|
+
"tags": [],
|
|
1023
|
+
"text": ""
|
|
1024
|
+
}],
|
|
1025
|
+
"references": {
|
|
1026
|
+
"Promise": {
|
|
1027
|
+
"location": "global"
|
|
1028
|
+
},
|
|
1029
|
+
"ICustomEditor": {
|
|
1030
|
+
"location": "import",
|
|
1031
|
+
"path": "../../utils/customEditor/interfaces/ICustomEditor"
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
"return": "Promise<void>"
|
|
1035
|
+
},
|
|
1036
|
+
"docs": {
|
|
1037
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
1038
|
+
"tags": []
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
"addGridCustomRender": {
|
|
1042
|
+
"complexType": {
|
|
1043
|
+
"signature": "(fieldName: string, customRender: ICustomRender, detailContext?: string) => Promise<void>",
|
|
1044
|
+
"parameters": [{
|
|
1045
|
+
"tags": [],
|
|
1046
|
+
"text": ""
|
|
1047
|
+
}, {
|
|
1048
|
+
"tags": [],
|
|
1049
|
+
"text": ""
|
|
1050
|
+
}, {
|
|
1051
|
+
"tags": [],
|
|
1052
|
+
"text": ""
|
|
1053
|
+
}],
|
|
1054
|
+
"references": {
|
|
1055
|
+
"Promise": {
|
|
1056
|
+
"location": "global"
|
|
1057
|
+
},
|
|
1058
|
+
"ICustomRender": {
|
|
1059
|
+
"location": "import",
|
|
1060
|
+
"path": "../../utils/customRender/interfaces/ICustomRender"
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
"return": "Promise<void>"
|
|
1064
|
+
},
|
|
1065
|
+
"docs": {
|
|
1066
|
+
"text": "Registra um render customizado para colunas da grid.",
|
|
1067
|
+
"tags": []
|
|
1068
|
+
}
|
|
1069
|
+
},
|
|
1070
|
+
"addCustomValueFormatter": {
|
|
1071
|
+
"complexType": {
|
|
1072
|
+
"signature": "(columnName: string, customFormatter: ICustomFormatter) => Promise<void>",
|
|
1073
|
+
"parameters": [{
|
|
1074
|
+
"tags": [],
|
|
1075
|
+
"text": ""
|
|
1076
|
+
}, {
|
|
1077
|
+
"tags": [],
|
|
1078
|
+
"text": ""
|
|
1079
|
+
}],
|
|
1080
|
+
"references": {
|
|
1081
|
+
"Promise": {
|
|
1082
|
+
"location": "global"
|
|
1083
|
+
},
|
|
1084
|
+
"ICustomFormatter": {
|
|
1085
|
+
"location": "import",
|
|
1086
|
+
"path": "./interfaces"
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
"return": "Promise<void>"
|
|
1090
|
+
},
|
|
1091
|
+
"docs": {
|
|
1092
|
+
"text": "Registra um formatador de valores para uma coluna da grid.",
|
|
1093
|
+
"tags": []
|
|
1094
|
+
}
|
|
1095
|
+
},
|
|
1096
|
+
"removeCustomValueFormatter": {
|
|
1097
|
+
"complexType": {
|
|
1098
|
+
"signature": "(columnName: string) => Promise<void>",
|
|
1099
|
+
"parameters": [{
|
|
1100
|
+
"tags": [],
|
|
1101
|
+
"text": ""
|
|
1102
|
+
}],
|
|
1103
|
+
"references": {
|
|
1104
|
+
"Promise": {
|
|
1105
|
+
"location": "global"
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
"return": "Promise<void>"
|
|
1109
|
+
},
|
|
1110
|
+
"docs": {
|
|
1111
|
+
"text": "Remove o formatador de valores de uma coluna da grid.",
|
|
1112
|
+
"tags": []
|
|
1113
|
+
}
|
|
1114
|
+
},
|
|
1115
|
+
"refreshSelectedRows": {
|
|
1116
|
+
"complexType": {
|
|
1117
|
+
"signature": "() => Promise<void>",
|
|
1118
|
+
"parameters": [],
|
|
1119
|
+
"references": {
|
|
1120
|
+
"Promise": {
|
|
1121
|
+
"location": "global"
|
|
1122
|
+
}
|
|
1123
|
+
},
|
|
1124
|
+
"return": "Promise<void>"
|
|
1125
|
+
},
|
|
1126
|
+
"docs": {
|
|
1127
|
+
"text": "Atualiza linhas da grade.",
|
|
1128
|
+
"tags": []
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
"getCustomValueFormatter": {
|
|
1132
|
+
"complexType": {
|
|
1133
|
+
"signature": "(columnName: string) => Promise<ICustomFormatter | undefined>",
|
|
1134
|
+
"parameters": [{
|
|
1135
|
+
"tags": [],
|
|
1136
|
+
"text": ""
|
|
1137
|
+
}],
|
|
1138
|
+
"references": {
|
|
1139
|
+
"Promise": {
|
|
1140
|
+
"location": "global"
|
|
1141
|
+
},
|
|
1142
|
+
"ICustomFormatter": {
|
|
1143
|
+
"location": "import",
|
|
1144
|
+
"path": "./interfaces"
|
|
1145
|
+
}
|
|
1146
|
+
},
|
|
1147
|
+
"return": "Promise<ICustomFormatter>"
|
|
1148
|
+
},
|
|
1149
|
+
"docs": {
|
|
1150
|
+
"text": "Retorna o formatador customizado da coluna caso exista.",
|
|
1151
|
+
"tags": []
|
|
1152
|
+
}
|
|
949
1153
|
}
|
|
950
1154
|
};
|
|
951
1155
|
}
|
|
@@ -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)
|