@sankhyalabs/ezui 5.21.2 → 5.22.0-dev.1
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-chart.cjs.entry.js +433 -0
- 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} +99 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +34 -3
- package/dist/cjs/ez-form.cjs.entry.js +77 -2
- package/dist/cjs/ez-grid.cjs.entry.js +313 -39
- package/dist/cjs/ez-list.cjs.entry.js +10 -2
- package/dist/cjs/ez-number-input.cjs.entry.js +37 -31
- package/dist/cjs/ez-scroller_2.cjs.entry.js +222 -0
- package/dist/cjs/ez-search.cjs.entry.js +39 -32
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +92 -0
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -0
- package/dist/cjs/{ez-scroller_3.cjs.entry.js → ez-tree.cjs.entry.js} +0 -215
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +16 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- 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 +278 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +110 -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 +51 -22
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +6 -1
- 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 +59 -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 +10 -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/controller/ag-grid/test/constants/GridEditionMock.js +40 -0
- package/dist/collection/components/ez-grid/ez-grid.js +237 -12
- 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/test/resources/gridDataUnit.js +19 -0
- package/dist/collection/components/ez-list/ez-list.js +28 -2
- package/dist/collection/components/ez-number-input/ez-number-input.js +46 -31
- package/dist/collection/components/ez-search/ez-search.js +38 -32
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +6 -2
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
- package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +180 -0
- package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.js +293 -0
- package/dist/collection/components/ez-sidebar-navigator/interfaces/ModeMenuEnum.js +5 -0
- package/dist/collection/components/ez-sidebar-navigator/interfaces/SizeMenuEnum.js +6 -0
- package/dist/collection/components/ez-sidebar-navigator/interfaces/TypeMenuEnum.js +6 -0
- package/dist/collection/components/ez-sidebar-navigator/interfaces/index.js +3 -0
- package/dist/collection/components/ez-sidebar-navigator/messages/constants.js +5 -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 +18 -0
- package/dist/custom-elements/index.js +1145 -117
- package/dist/esm/ICustomRender-875b5a40.js +13 -0
- package/dist/esm/ez-actions-button.entry.js +1 -0
- package/dist/esm/ez-chart.entry.js +429 -0
- 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} +101 -3
- package/dist/esm/ez-form-view.entry.js +34 -3
- package/dist/esm/ez-form.entry.js +78 -3
- package/dist/esm/ez-grid.entry.js +313 -39
- package/dist/esm/ez-list.entry.js +10 -2
- package/dist/esm/ez-number-input.entry.js +38 -32
- package/dist/esm/ez-scroller_2.entry.js +217 -0
- package/dist/esm/ez-search.entry.js +39 -32
- package/dist/esm/ez-sidebar-navigator.entry.js +88 -0
- package/dist/esm/ez-split-item.entry.js +1 -0
- package/dist/esm/{ez-scroller_3.entry.js → ez-tree.entry.js} +3 -216
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +16 -4
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-12ae1104.entry.js +1 -0
- package/dist/ezui/p-2097d0cf.entry.js +1 -0
- package/dist/ezui/p-3b4eeeb6.entry.js +1 -0
- package/dist/ezui/p-4607fb89.js +1 -0
- package/dist/ezui/p-4d5235f1.entry.js +1 -0
- package/dist/ezui/p-5056284a.entry.js +1 -0
- package/dist/ezui/p-7922142b.entry.js +1 -0
- package/dist/ezui/{p-fbee26ec.entry.js → p-816cece6.entry.js} +2 -2
- package/dist/ezui/p-84e439b9.entry.js +1 -0
- package/dist/ezui/p-8888d9ed.entry.js +1 -0
- package/dist/ezui/p-922ac38b.entry.js +1 -0
- package/dist/ezui/p-9ab22a07.entry.js +1 -0
- package/dist/ezui/p-a31b9c90.entry.js +1 -0
- package/dist/ezui/p-bcb53f27.entry.js +1 -0
- package/dist/ezui/p-ecc2c1ec.entry.js +1 -0
- package/dist/ezui/p-ffef392d.entry.js +1 -0
- 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 +48 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +16 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +37 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +13 -4
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +1 -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 +6 -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/controller/ag-grid/test/constants/GridEditionMock.d.ts +6 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +35 -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/test/resources/gridDataUnit.d.ts +2 -0
- package/dist/types/components/ez-list/ez-list.d.ts +5 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -0
- package/dist/types/components/ez-search/ez-search.d.ts +4 -2
- package/dist/types/components/ez-sidebar-navigator/ez-sidebar-navigator.d.ts +57 -0
- package/dist/types/components/ez-sidebar-navigator/interfaces/ModeMenuEnum.d.ts +4 -0
- package/dist/types/components/ez-sidebar-navigator/interfaces/SizeMenuEnum.d.ts +5 -0
- package/dist/types/components/ez-sidebar-navigator/interfaces/TypeMenuEnum.d.ts +5 -0
- package/dist/types/components/ez-sidebar-navigator/interfaces/index.d.ts +3 -0
- package/dist/types/components/ez-sidebar-navigator/messages/constants.d.ts +5 -0
- package/dist/types/components.d.ts +334 -5
- package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +31 -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 +3 -0
- package/react/components.js +3 -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-637f69f2.entry.js +0 -1
- package/dist/ezui/p-786559c5.entry.js +0 -1
- package/dist/ezui/p-7c770f14.entry.js +0 -1
- package/dist/ezui/p-91f626d3.entry.js +0 -1
- package/dist/ezui/p-99ead599.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
|
@@ -1,5 +1,5 @@
|
|
|
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';
|
|
@@ -34,14 +34,13 @@ export default class AgGridController {
|
|
|
34
34
|
this.STATUS_COL_ID = 'statusColumn';
|
|
35
35
|
this.RECORD_ARCHIVE_COL_ID = '__RECORD_ARCHIVE__';
|
|
36
36
|
this.BLOCK_LOAD_DEBOUNCE = 100;
|
|
37
|
-
this.
|
|
38
|
-
this.DEFAULT_ICON_SIZE = 12;
|
|
39
|
-
this.DEFAULT_MAX_SIZE = 200;
|
|
37
|
+
this.DOC_WIDTH = 1150;
|
|
40
38
|
this._menuItems = [];
|
|
41
39
|
this._idAttribName = '__record__id__';
|
|
42
40
|
this._gridConfig = [];
|
|
43
41
|
this._filteredColumns = new Map();
|
|
44
42
|
this._filterColumnleftPosition = 0;
|
|
43
|
+
this._customFormatters = new Map();
|
|
45
44
|
this._enterprise = enterprise;
|
|
46
45
|
}
|
|
47
46
|
getGridConfig() {
|
|
@@ -127,7 +126,7 @@ export default class AgGridController {
|
|
|
127
126
|
this._doubleClickCallBack = options.onDoubleClick;
|
|
128
127
|
this._multipleSelection = options.allowMultipleSelection;
|
|
129
128
|
this._dataUnit = options.dataUnit;
|
|
130
|
-
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);
|
|
131
130
|
this._statusResolver = options.statusResolver;
|
|
132
131
|
if (this._dataUnit) {
|
|
133
132
|
this._dataUnit.sortingProvider = this;
|
|
@@ -189,6 +188,7 @@ export default class AgGridController {
|
|
|
189
188
|
this.selectRows((selection === null || selection === void 0 ? void 0 : selection.recordIds) || [], true);
|
|
190
189
|
}
|
|
191
190
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
191
|
+
this._customFormatters = options.customFormatters;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
processFormatterCellCallback(params) {
|
|
@@ -487,6 +487,10 @@ export default class AgGridController {
|
|
|
487
487
|
this.focusOnGridContainer();
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
+
setAutoFocus(autoFocus) {
|
|
491
|
+
var _a;
|
|
492
|
+
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.setAutoFocus(autoFocus);
|
|
493
|
+
}
|
|
490
494
|
setFocusFirstRow() {
|
|
491
495
|
const firstRow = this._gridOptions.api.getDisplayedRowAtIndex(0);
|
|
492
496
|
if (firstRow) {
|
|
@@ -572,9 +576,11 @@ export default class AgGridController {
|
|
|
572
576
|
//Existem colunas implícitas que não tem estado, essas colunas são sempre as primeiras.
|
|
573
577
|
//Como vamos reordenar, precisamos considerar o deslocamento provocado por elas.
|
|
574
578
|
const columnsOffset = colDef.length - columns.length;
|
|
579
|
+
this._gridConfig = state;
|
|
575
580
|
let sort = [];
|
|
576
|
-
state.forEach((cfgColumn, index) => {
|
|
577
|
-
|
|
581
|
+
state === null || state === void 0 ? void 0 : state.forEach((cfgColumn, index) => {
|
|
582
|
+
var _a;
|
|
583
|
+
const colWidth = (_a = this._gridOptions.columnApi.getColumn(cfgColumn.name)) === null || _a === void 0 ? void 0 : _a.getActualWidth();
|
|
578
584
|
this._gridOptions.columnApi.moveColumn(cfgColumn.name, index + columnsOffset);
|
|
579
585
|
this._gridOptions.columnApi.setColumnWidth(cfgColumn.name, colWidth);
|
|
580
586
|
visibleColumns.push(cfgColumn.name);
|
|
@@ -589,7 +595,11 @@ export default class AgGridController {
|
|
|
589
595
|
state: sort,
|
|
590
596
|
defaultState: { sort: null },
|
|
591
597
|
});
|
|
592
|
-
|
|
598
|
+
}
|
|
599
|
+
getAdaptiveWidth(width) {
|
|
600
|
+
const widthGrid = this._container.clientWidth;
|
|
601
|
+
const adaptiveWidth = (this.DOC_WIDTH * width) / widthGrid;
|
|
602
|
+
return Math.round(adaptiveWidth);
|
|
593
603
|
}
|
|
594
604
|
getColumnsState() {
|
|
595
605
|
if (this._grid === undefined) {
|
|
@@ -598,13 +608,15 @@ export default class AgGridController {
|
|
|
598
608
|
const colState = this._gridOptions.columnApi.getColumnState();
|
|
599
609
|
return colState
|
|
600
610
|
.map(s => {
|
|
601
|
-
const
|
|
611
|
+
const column = this._gridOptions.columnApi.getColumn(s.colId);
|
|
612
|
+
const def = column.getColDef();
|
|
613
|
+
const width = this.getAdaptiveWidth(column.getActualWidth());
|
|
602
614
|
const label = def.headerName;
|
|
603
615
|
const name = def.checkboxSelection ? '__SELECTION__' : s.colId;
|
|
604
616
|
const colState = { label, name };
|
|
605
617
|
this.conditionalSet(colState, 'sort', s.sort);
|
|
606
618
|
this.conditionalSet(colState, 'sortIndex', s.sortIndex);
|
|
607
|
-
this.conditionalSet(colState, 'width',
|
|
619
|
+
this.conditionalSet(colState, 'width', width);
|
|
608
620
|
this.conditionalSet(colState, 'pinned', s.pinned !== null);
|
|
609
621
|
this.conditionalSet(colState, 'hidden', s.hide);
|
|
610
622
|
const props = new Map();
|
|
@@ -670,12 +682,19 @@ export default class AgGridController {
|
|
|
670
682
|
showColumnFilter: (leftPosition) => this.showFilterColumn({ columnName: source.name, columnLabel: source.label, leftPosition, filteredOptions: this._filteredColumns.get(source.name), fromIcon: true }),
|
|
671
683
|
},
|
|
672
684
|
valueFormatter: params => {
|
|
673
|
-
if (params.value === undefined) {
|
|
685
|
+
if (params.value === undefined || params.value === null) {
|
|
674
686
|
return "";
|
|
675
687
|
}
|
|
676
688
|
if (params.value instanceof Promise) {
|
|
677
689
|
return "Carregando...";
|
|
678
690
|
}
|
|
691
|
+
const customFormatter = this._customFormatters.get(source.name);
|
|
692
|
+
if (customFormatter) {
|
|
693
|
+
const formattedValue = customFormatter.format(params.value, source, params.data.__record__id__);
|
|
694
|
+
if (formattedValue) {
|
|
695
|
+
return formattedValue;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
679
698
|
if (this._dataUnit) {
|
|
680
699
|
return this._dataUnit.getFormattedValue(source.name, params.value);
|
|
681
700
|
}
|
|
@@ -684,6 +703,13 @@ export default class AgGridController {
|
|
|
684
703
|
cellStyle: this.getStyleByColumn(source),
|
|
685
704
|
});
|
|
686
705
|
}
|
|
706
|
+
setCustomFormatters(customFormatters) {
|
|
707
|
+
this._customFormatters = customFormatters;
|
|
708
|
+
}
|
|
709
|
+
refreshSelectedRows() {
|
|
710
|
+
const selectedNodes = this._gridOptions.api.getSelectedNodes();
|
|
711
|
+
this._gridOptions.api.redrawRows({ rowNodes: selectedNodes });
|
|
712
|
+
}
|
|
687
713
|
getInitCellStyle() {
|
|
688
714
|
return {
|
|
689
715
|
'line-height': this.getRowHeight() - 1 + 'px',
|
|
@@ -844,19 +870,22 @@ export default class AgGridController {
|
|
|
844
870
|
host[attribute] = value;
|
|
845
871
|
}
|
|
846
872
|
}
|
|
847
|
-
|
|
848
|
-
var _a
|
|
849
|
-
if (
|
|
873
|
+
setCellEditors(customEditors) {
|
|
874
|
+
var _a;
|
|
875
|
+
if (!this._editionManager) {
|
|
876
|
+
this._customEditors = customEditors;
|
|
850
877
|
return;
|
|
851
878
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
879
|
+
this._editionManager.setCellEditors(customEditors);
|
|
880
|
+
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
|
|
881
|
+
}
|
|
882
|
+
setCellRenders(customRenders) {
|
|
883
|
+
var _a;
|
|
884
|
+
if (!this._editionManager) {
|
|
885
|
+
this._customRenders = customRenders;
|
|
886
|
+
return;
|
|
858
887
|
}
|
|
859
|
-
|
|
860
|
-
|
|
888
|
+
this._editionManager.setCellRenders(customRenders);
|
|
889
|
+
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
|
|
861
890
|
}
|
|
862
891
|
}
|
|
@@ -11,7 +11,9 @@ export default class DataSource {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
handleFocusFirstRow() {
|
|
14
|
-
this.
|
|
14
|
+
if (this._options.autoFocus) {
|
|
15
|
+
this._controller.setFocusFirstRow();
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
18
|
isSilentChange(action) {
|
|
17
19
|
//TODO: Provisorio p/ não atualizar a grade quando a alteração for apenas de campos transisntes
|
|
@@ -87,6 +89,9 @@ export default class DataSource {
|
|
|
87
89
|
this._controller.selectRows(selectionInfo.recordIds, true);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
92
|
+
setAutoFocus(autoFocus) {
|
|
93
|
+
this._options.autoFocus = autoFocus;
|
|
94
|
+
}
|
|
90
95
|
getRows(params) {
|
|
91
96
|
if (this.needReload(params)) {
|
|
92
97
|
this._lastLoadingParams = params;
|
|
@@ -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() {
|
|
@@ -223,6 +251,12 @@ export default class GridEditionManager {
|
|
|
223
251
|
this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
|
|
224
252
|
}
|
|
225
253
|
}
|
|
254
|
+
setCellEditors(customEditors) {
|
|
255
|
+
this._customEditors = customEditors;
|
|
256
|
+
}
|
|
257
|
+
setCellRenders(customRenders) {
|
|
258
|
+
this._customRenders = customRenders;
|
|
259
|
+
}
|
|
226
260
|
}
|
|
227
261
|
class TargetEdition {
|
|
228
262
|
constructor(rowIndex, column, backwards) {
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
record: super.getRecord(),
|
|
23
|
+
editorMetadata: {
|
|
24
|
+
hidden: ((_a = fieldMetadata.props) === null || _a === void 0 ? void 0 : _a.visible) === false,
|
|
25
|
+
label: fieldMetadata.label,
|
|
26
|
+
userInterface: fieldMetadata.userInterface,
|
|
27
|
+
props: fieldMetadata.props,
|
|
28
|
+
optionLoader: fieldMetadata.optionLoader,
|
|
29
|
+
options: ((_b = fieldMetadata.props) === null || _b === void 0 ? void 0 : _b.options) || {},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
getDefaultGui() {
|
|
34
|
+
const gui = super.getGui();
|
|
35
|
+
gui.value = this._value;
|
|
36
|
+
gui.onkeyup = (event) => {
|
|
37
|
+
const value = event.target.value;
|
|
38
|
+
this.setValue(value);
|
|
39
|
+
};
|
|
40
|
+
return gui;
|
|
41
|
+
}
|
|
42
|
+
getGui() {
|
|
43
|
+
const editorElement = this._customEditorInstance.getEditorElement(this._params);
|
|
44
|
+
if (!editorElement) {
|
|
45
|
+
return this._defaultGui;
|
|
46
|
+
}
|
|
47
|
+
if (typeof editorElement === 'string') {
|
|
48
|
+
const element = HTMLBuilder.parseElement(editorElement);
|
|
49
|
+
return element;
|
|
50
|
+
}
|
|
51
|
+
return editorElement;
|
|
52
|
+
}
|
|
53
|
+
setValue(value) {
|
|
54
|
+
this._value = value;
|
|
55
|
+
}
|
|
56
|
+
getValue() {
|
|
57
|
+
return this._value;
|
|
58
|
+
}
|
|
59
|
+
}
|
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
|
+
};
|
|
@@ -18,11 +18,12 @@ uiBuilders.set(UserInterface.LONGTEXT, buildTextAreaInput);
|
|
|
18
18
|
uiBuilders.set(UserInterface.SEARCH, buildSearch);
|
|
19
19
|
export default class EzCellEditor {
|
|
20
20
|
init(params) {
|
|
21
|
+
this._rowData = params.data;
|
|
21
22
|
const fieldName = params.column.getColId();
|
|
22
23
|
const dataUnit = params.context.dataUnit;
|
|
23
|
-
|
|
24
|
-
const builder = uiBuilders.get(
|
|
25
|
-
this._gui = builder(
|
|
24
|
+
this._fieldMetadata = buildEditorMetadata(dataUnit.getField(fieldName), params.eGridCell, dataUnit, params.context.editionManager);
|
|
25
|
+
const builder = uiBuilders.get(this._fieldMetadata.userInterface) || buildTextInput;
|
|
26
|
+
this._gui = builder(this._fieldMetadata);
|
|
26
27
|
if (this._gui.valueSetter != undefined) {
|
|
27
28
|
this._gui.valueSetter(params.value);
|
|
28
29
|
}
|
|
@@ -46,4 +47,10 @@ export default class EzCellEditor {
|
|
|
46
47
|
isPopup() {
|
|
47
48
|
return this._gui.isPopUp;
|
|
48
49
|
}
|
|
50
|
+
getFieldMetadata() {
|
|
51
|
+
return this._fieldMetadata;
|
|
52
|
+
}
|
|
53
|
+
getRecord() {
|
|
54
|
+
return this._rowData;
|
|
55
|
+
}
|
|
49
56
|
}
|
|
@@ -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 {};
|
package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { HTMLBuilder } from "@sankhyalabs/core";
|
|
2
2
|
export const buildDecimal = ({ readOnly, props }) => {
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const precision = Number((_a = props === null || props === void 0 ? void 0 : props.precision) !== null && _a !== void 0 ? _a : 2);
|
|
5
|
+
const prettyPrecision = Number((_b = props === null || props === void 0 ? void 0 : props.prettyPrecision) !== null && _b !== void 0 ? _b : precision);
|
|
5
6
|
return buildNumeric(readOnly, precision, prettyPrecision);
|
|
6
7
|
};
|
|
7
8
|
export const buildInteger = ({ readOnly }) => {
|
package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { StringUtils } from "@sankhyalabs/core";
|
|
2
|
+
const columnsState = [{
|
|
3
|
+
colId: StringUtils.generateUUID(),
|
|
4
|
+
}];
|
|
5
|
+
const colDef = {
|
|
6
|
+
headerName: 'name',
|
|
7
|
+
checkboxSelection: false,
|
|
8
|
+
};
|
|
9
|
+
export const gridEditionImplementation = {
|
|
10
|
+
getComponents: () => ({}),
|
|
11
|
+
configureGrid: (option) => (Object.assign(Object.assign({}, option), { api: {
|
|
12
|
+
setHeaderHeight: () => { },
|
|
13
|
+
forEachNode: () => { },
|
|
14
|
+
}, context: {}, columnApi: {
|
|
15
|
+
moveColumn: () => { },
|
|
16
|
+
setColumnWidth: () => { },
|
|
17
|
+
setColumnsVisible: () => { },
|
|
18
|
+
applyColumnState: () => { },
|
|
19
|
+
getColumns: () => ([]),
|
|
20
|
+
getColumn: () => ({
|
|
21
|
+
getActualWidth: () => 30,
|
|
22
|
+
getColDef: () => colDef,
|
|
23
|
+
}),
|
|
24
|
+
getColumnState: () => columnsState,
|
|
25
|
+
} }))
|
|
26
|
+
};
|
|
27
|
+
export function buildOptions(dataUnit) {
|
|
28
|
+
return ({
|
|
29
|
+
allowMultipleSelection: true,
|
|
30
|
+
dataUnit,
|
|
31
|
+
onColumnStateChange: () => { },
|
|
32
|
+
onDoubleClick: () => { },
|
|
33
|
+
onPaginationChange: () => { },
|
|
34
|
+
onPaginationUpdate: () => { },
|
|
35
|
+
onSelectionChange: () => { },
|
|
36
|
+
serverURL: '',
|
|
37
|
+
statusResolver: {},
|
|
38
|
+
useEnterLikeTab: true,
|
|
39
|
+
});
|
|
40
|
+
}
|