@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-71826.0 → 0.0.0-bugfix-dev-KB-60622.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/{RecordValidationProcessor-4c893e04.js → RecordValidationProcessor-10846595.js} +7 -1
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item_3.cjs.entry.js +13 -4
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +2 -2
- package/dist/cjs/ez-grid.cjs.entry.js +254 -18
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-scroller_2.cjs.entry.js +3 -3
- package/dist/cjs/ez-search.cjs.entry.js +5 -6
- package/dist/cjs/ez-sidebar-navigator.cjs.entry.js +1 -1
- package/dist/cjs/ez-split-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-button/ez-button.css +2 -2
- package/dist/collection/components/ez-card-item/ez-card-item.css +60 -10
- package/dist/collection/components/ez-card-item/ez-card-item.js +30 -3
- package/dist/collection/components/ez-check/ez-check.css +1 -6
- package/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +106 -4
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +83 -5
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +57 -6
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/test/constants/GridEditionMock.js +1 -0
- package/dist/collection/components/ez-grid/ez-grid.js +43 -1
- package/dist/collection/components/ez-list/ez-list.css +2 -1
- package/dist/collection/components/ez-modal/ez-modal.css +1 -1
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +1 -1
- package/dist/collection/components/ez-scroller/ez-scroller.css +1 -0
- package/dist/collection/components/ez-search/ez-search.css +19 -8
- package/dist/collection/components/ez-search/ez-search.js +7 -26
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.css +3 -0
- package/dist/collection/components/ez-sidebar-button/ez-sidebar-button.js +1 -1
- package/dist/collection/components/ez-sidebar-navigator/ez-sidebar-navigator.css +3 -1
- package/dist/collection/components/ez-split-button/ez-split-button.css +1 -1
- package/dist/collection/components/ez-split-button/ez-split-button.js +3 -3
- package/dist/collection/components/ez-split-panel/structure/item/ez-split-item.css +1 -0
- package/dist/collection/utils/form/DataBinder.js +1 -1
- package/dist/collection/utils/validators/recordvalidator/IInvalidCells.js +1 -0
- package/dist/collection/utils/validators/recordvalidator/RecordValidationProcessor.js +7 -1
- package/dist/custom-elements/index.js +295 -45
- package/dist/esm/{RecordValidationProcessor-b00b8b77.js → RecordValidationProcessor-9c6cc267.js} +7 -1
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-card-item_3.entry.js +13 -4
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +2 -2
- package/dist/esm/ez-grid.entry.js +254 -18
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-scroller_2.entry.js +3 -3
- package/dist/esm/ez-search.entry.js +5 -6
- package/dist/esm/ez-sidebar-navigator.entry.js +1 -1
- package/dist/esm/ez-split-button.entry.js +2 -2
- package/dist/esm/ez-split-item.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-2480e948.entry.js +1 -0
- package/dist/ezui/p-39b31672.entry.js +1 -0
- package/dist/ezui/{p-81cffa53.entry.js → p-4b5f83a4.entry.js} +1 -1
- package/dist/ezui/p-554522db.entry.js +1 -0
- package/dist/ezui/p-93d355a1.entry.js +1 -0
- package/dist/ezui/{p-ee9315ff.entry.js → p-a7490128.entry.js} +1 -1
- package/dist/ezui/p-a921e3e7.entry.js +1 -0
- package/dist/ezui/{p-860681b8.entry.js → p-b82be651.entry.js} +2 -2
- package/dist/ezui/p-b858fc6e.entry.js +1 -0
- package/dist/ezui/p-b9fa2526.entry.js +1 -0
- package/dist/ezui/{p-9aa27e69.entry.js → p-bef7daac.entry.js} +1 -1
- package/dist/ezui/{p-3141ee18.entry.js → p-e03c2774.entry.js} +1 -1
- package/dist/ezui/{p-33792b2b.entry.js → p-e18d9e6a.entry.js} +1 -1
- package/dist/ezui/{p-31674f8e.entry.js → p-e7395eae.entry.js} +1 -1
- package/dist/ezui/p-f42855b9.js +1 -0
- package/dist/types/components/ez-card-item/ez-card-item.d.ts +5 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +32 -4
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +19 -3
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +18 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +13 -2
- package/dist/types/components/ez-grid/ez-grid.d.ts +9 -0
- package/dist/types/components/ez-search/ez-search.d.ts +2 -6
- package/dist/types/components/ez-split-button/ez-split-button.d.ts +1 -1
- package/dist/types/components.d.ts +34 -18
- package/dist/types/utils/validators/recordvalidator/IInvalidCells.d.ts +5 -0
- package/dist/types/utils/validators/recordvalidator/RecordValidationProcessor.d.ts +1 -1
- package/package.json +1 -1
- package/dist/ezui/p-04f24913.js +0 -1
- package/dist/ezui/p-0ee0ac03.entry.js +0 -1
- package/dist/ezui/p-55324014.entry.js +0 -1
- package/dist/ezui/p-752c4069.entry.js +0 -1
- package/dist/ezui/p-81f99ace.entry.js +0 -1
- package/dist/ezui/p-9634631d.entry.js +0 -1
- package/dist/ezui/p-9a23d513.entry.js +0 -1
- package/dist/ezui/p-f1c3f85d.entry.js +0 -1
|
@@ -73,7 +73,7 @@ ez-icon {
|
|
|
73
73
|
.collapsible-box__title {
|
|
74
74
|
/*private*/
|
|
75
75
|
position: relative;
|
|
76
|
-
width:
|
|
76
|
+
width: 100%;
|
|
77
77
|
display: flex;
|
|
78
78
|
box-sizing: border-box;
|
|
79
79
|
align-items: center;
|
|
@@ -98,7 +98,7 @@ ez-icon {
|
|
|
98
98
|
|
|
99
99
|
.collapsible-box__label {
|
|
100
100
|
/*private*/
|
|
101
|
-
display:
|
|
101
|
+
display: block;
|
|
102
102
|
white-space: nowrap;
|
|
103
103
|
overflow: hidden;
|
|
104
104
|
cursor: pointer;
|
|
@@ -41,6 +41,8 @@ export default class AgGridController {
|
|
|
41
41
|
this._filteredColumns = new Map();
|
|
42
42
|
this._filterColumnleftPosition = 0;
|
|
43
43
|
this._customFormatters = new Map();
|
|
44
|
+
this._gridShowDom = false;
|
|
45
|
+
this.peddingExecutionsOnGridShow = [];
|
|
44
46
|
this._enterprise = enterprise;
|
|
45
47
|
}
|
|
46
48
|
getGridConfig() {
|
|
@@ -126,7 +128,7 @@ export default class AgGridController {
|
|
|
126
128
|
this._doubleClickCallBack = options.onDoubleClick;
|
|
127
129
|
this._multipleSelection = options.allowMultipleSelection;
|
|
128
130
|
this._dataUnit = options.dataUnit;
|
|
129
|
-
this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders);
|
|
131
|
+
this._editionManager = new GridEditionManager(this._dataUnit, options.useEnterLikeTab, options.recordsValidator, options.editionIsDisabled, options.customEditors || this._customEditors, options.customRenders || this._customRenders, options.enableContinuousInsert);
|
|
130
132
|
this._statusResolver = options.statusResolver;
|
|
131
133
|
if (this._dataUnit) {
|
|
132
134
|
this._dataUnit.sortingProvider = this;
|
|
@@ -146,6 +148,9 @@ export default class AgGridController {
|
|
|
146
148
|
defaultColDef: {
|
|
147
149
|
headerClass: 'ez-grid__cell-header',
|
|
148
150
|
cellClass: 'ez-grid__cell-body',
|
|
151
|
+
cellClassRules: {
|
|
152
|
+
'invalidValue': (params) => this._editionManager.hasInvalidField(params.colDef.field, params.data["__record__id__"]),
|
|
153
|
+
},
|
|
149
154
|
cellStyle: {
|
|
150
155
|
height: '100%'
|
|
151
156
|
}
|
|
@@ -185,6 +190,23 @@ export default class AgGridController {
|
|
|
185
190
|
}
|
|
186
191
|
this._gridOptions.api.setHeaderHeight(this.getHeaderRowHeight());
|
|
187
192
|
this._customFormatters = options.customFormatters;
|
|
193
|
+
const observerCallback = (entries) => {
|
|
194
|
+
entries.forEach(entry => {
|
|
195
|
+
if (entry.isIntersecting) {
|
|
196
|
+
this._gridShowDom = true;
|
|
197
|
+
this.peddingExecutionsOnGridShow.forEach(func => func());
|
|
198
|
+
this.peddingExecutionsOnGridShow = [];
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this._gridShowDom = false;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
this.observer = new IntersectionObserver(observerCallback, {
|
|
206
|
+
root: null,
|
|
207
|
+
threshold: 0.1
|
|
208
|
+
});
|
|
209
|
+
this.observer.observe(container);
|
|
188
210
|
}
|
|
189
211
|
}
|
|
190
212
|
processFormatterCellCallback(params) {
|
|
@@ -375,10 +397,16 @@ export default class AgGridController {
|
|
|
375
397
|
throw new Error('Erro interno: Grid ainda não inicializado.');
|
|
376
398
|
}
|
|
377
399
|
}
|
|
378
|
-
updateRows() {
|
|
400
|
+
updateRows(rows) {
|
|
379
401
|
if (this._grid === undefined) {
|
|
380
402
|
throw new Error('Erro interno: Grid ainda não inicializado.');
|
|
381
403
|
}
|
|
404
|
+
rows === null || rows === void 0 ? void 0 : rows.forEach(row => this.updateRowData(row));
|
|
405
|
+
}
|
|
406
|
+
updateRowData(row) {
|
|
407
|
+
const node = this._gridOptions.api.getRowNode(row[this._idAttribName]);
|
|
408
|
+
node.setData(Object.assign({}, row));
|
|
409
|
+
this._editionManager.recordValidate();
|
|
382
410
|
}
|
|
383
411
|
selectAll(quietly = false) {
|
|
384
412
|
try {
|
|
@@ -461,14 +489,42 @@ export default class AgGridController {
|
|
|
461
489
|
});
|
|
462
490
|
r.setData(data);
|
|
463
491
|
});
|
|
492
|
+
this._gridOptions.api.refreshCells({ force: true });
|
|
493
|
+
const invalidCell = this._editionManager.getInvalidCell();
|
|
494
|
+
if (invalidCell) {
|
|
495
|
+
const rowNode = this._gridOptions.api.getRowNode(invalidCell.recordId);
|
|
496
|
+
if (rowNode && invalidCell.field) {
|
|
497
|
+
this.startEdition(rowNode.rowIndex, this._gridOptions.columnApi.getColumn(invalidCell.field.name));
|
|
498
|
+
}
|
|
499
|
+
}
|
|
464
500
|
}
|
|
465
501
|
}
|
|
466
|
-
|
|
502
|
+
savingCanceled(fields, recordId) {
|
|
503
|
+
const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
|
|
504
|
+
const rowIndex = this._gridOptions.api.getRowNode(recordId).rowIndex;
|
|
505
|
+
const columnFocus = displayedColumns.find(column => this.isColumnEditable(rowIndex, column) && fields.find(field => field.name === column.getColId()));
|
|
506
|
+
this.focusByCollAndRow(columnFocus, rowIndex);
|
|
507
|
+
this.startEdition(rowIndex, columnFocus);
|
|
508
|
+
}
|
|
509
|
+
refresh(scrollToSelectedRow = false) {
|
|
467
510
|
if (this._grid === undefined) {
|
|
468
511
|
throw new Error('Erro interno: Grid ainda não inicializado.');
|
|
469
512
|
}
|
|
470
513
|
this._gridOptions.api.refreshServerSide({ purge: true });
|
|
471
514
|
this._options.onRefresh();
|
|
515
|
+
if (scrollToSelectedRow)
|
|
516
|
+
this.scrollToSelectedRow();
|
|
517
|
+
}
|
|
518
|
+
scrollToSelectedRow() {
|
|
519
|
+
const rowNode = this._gridOptions.api.getSelectedNodes();
|
|
520
|
+
if (!rowNode || rowNode.length === 0)
|
|
521
|
+
return;
|
|
522
|
+
if (this._gridShowDom) {
|
|
523
|
+
this._gridOptions.api.ensureNodeVisible(rowNode[0]);
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
this.peddingExecutionsOnGridShow.push(() => this._gridOptions.api.ensureNodeVisible(rowNode[0]));
|
|
527
|
+
}
|
|
472
528
|
}
|
|
473
529
|
focusOnGridContainer() {
|
|
474
530
|
this._container.setAttribute('tabindex', '-1');
|
|
@@ -487,6 +543,14 @@ export default class AgGridController {
|
|
|
487
543
|
var _a;
|
|
488
544
|
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.setAutoFocus(autoFocus);
|
|
489
545
|
}
|
|
546
|
+
setEnableGridInsert(enable) {
|
|
547
|
+
var _a;
|
|
548
|
+
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.setEnableGridInsert(enable);
|
|
549
|
+
}
|
|
550
|
+
setEnableContinuousInsert(enable) {
|
|
551
|
+
var _a;
|
|
552
|
+
(_a = this._editionManager) === null || _a === void 0 ? void 0 : _a.setEnableContinuousInsert(enable);
|
|
553
|
+
}
|
|
490
554
|
setFocusFirstRow() {
|
|
491
555
|
const firstRow = this._gridOptions.api.getDisplayedRowAtIndex(0);
|
|
492
556
|
if (firstRow) {
|
|
@@ -502,9 +566,38 @@ export default class AgGridController {
|
|
|
502
566
|
this.setFocusOnRow(lastRow.rowIndex);
|
|
503
567
|
}
|
|
504
568
|
}
|
|
569
|
+
startEditionOnRowByIndex(rowIndex) {
|
|
570
|
+
const firstCol = this.getFirstEditableColl(rowIndex);
|
|
571
|
+
this.focusByCollAndRow(firstCol, rowIndex);
|
|
572
|
+
this.startEdition(rowIndex, firstCol);
|
|
573
|
+
}
|
|
574
|
+
startEdition(rowIndex, firstCol) {
|
|
575
|
+
this._gridOptions.api.clearRangeSelection();
|
|
576
|
+
this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstCol] });
|
|
577
|
+
this._gridOptions.api.setFocusedCell(rowIndex, firstCol);
|
|
578
|
+
this._gridOptions.api.startEditingCell({ rowIndex, colKey: firstCol });
|
|
579
|
+
const cellEditor = this._gridOptions.api.getCellEditorInstances()[0];
|
|
580
|
+
if (cellEditor) {
|
|
581
|
+
cellEditor.focusIn();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
getFirstEditableColl(rowIndex) {
|
|
585
|
+
const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
|
|
586
|
+
return displayedColumns.find(column => this.isColumnEditable(rowIndex, column));
|
|
587
|
+
}
|
|
588
|
+
isColumnEditable(rowIndex, column) {
|
|
589
|
+
if (column.getColDef().headerName === '' || rowIndex === -1)
|
|
590
|
+
return false;
|
|
591
|
+
const rowId = this._dataUnit.records[rowIndex][this._idAttribName];
|
|
592
|
+
const rowNode = this._gridOptions.api.getRowNode(rowId);
|
|
593
|
+
return column.isCellEditable(rowNode);
|
|
594
|
+
}
|
|
505
595
|
setFocusOnRow(rowIndex) {
|
|
506
596
|
let displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
|
|
507
|
-
let
|
|
597
|
+
let firstColl = displayedColumns.find(column => column.getColDef().headerName !== '');
|
|
598
|
+
this.focusByCollAndRow(firstColl, rowIndex);
|
|
599
|
+
}
|
|
600
|
+
focusByCollAndRow(firstCell, rowIndex) {
|
|
508
601
|
this._gridOptions.api.ensureColumnVisible(firstCell);
|
|
509
602
|
this._gridOptions.api.ensureIndexVisible(rowIndex);
|
|
510
603
|
this._gridOptions.api.setFocusedCell(rowIndex, firstCell);
|
|
@@ -884,4 +977,13 @@ export default class AgGridController {
|
|
|
884
977
|
this._editionManager.setCellRenders(customRenders);
|
|
885
978
|
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.redrawRows();
|
|
886
979
|
}
|
|
980
|
+
clearInvalidCells(action) {
|
|
981
|
+
if (!this._editionManager)
|
|
982
|
+
return;
|
|
983
|
+
this._editionManager.clearInvalidCells(action);
|
|
984
|
+
this._gridOptions.api.refreshCells({ force: true });
|
|
985
|
+
}
|
|
986
|
+
destroy() {
|
|
987
|
+
this.observer.disconnect();
|
|
988
|
+
}
|
|
887
989
|
}
|
|
@@ -2,6 +2,73 @@ import { Action, ObjectUtils } from '@sankhyalabs/core';
|
|
|
2
2
|
import { EZ_GRID_LOADING_SOURCE } from "../../../../utils/constants";
|
|
3
3
|
import { DataSourceInterceptor } from "./DataSourceInterceptor";
|
|
4
4
|
export default class DataSource {
|
|
5
|
+
handleSavingCanceled(action) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
|
+
if (!((_a = action.payload) === null || _a === void 0 ? void 0 : _a.fields) || !((_b = action.payload) === null || _b === void 0 ? void 0 : _b.recordId))
|
|
8
|
+
return;
|
|
9
|
+
this._controller.savingCanceled((_c = action.payload) === null || _c === void 0 ? void 0 : _c.fields, (_d = action.payload) === null || _d === void 0 ? void 0 : _d.recordId);
|
|
10
|
+
}
|
|
11
|
+
handleDataChanged(action) {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
if (!this._options.enableGridInsert) {
|
|
14
|
+
this.handleRefresh(action);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.updateGridRowNodes((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : []);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Nesse ponto, o registro já se encontra atualizado no DU,
|
|
21
|
+
* basta então passar seu valor para que a garde possa atualizar sua linha.
|
|
22
|
+
*/
|
|
23
|
+
updateGridRowNodes(recordIDList) {
|
|
24
|
+
const recordsToUpdate = recordIDList === null || recordIDList === void 0 ? void 0 : recordIDList.map(id => this.getRecordById(id));
|
|
25
|
+
this._controller.updateRows(recordsToUpdate);
|
|
26
|
+
}
|
|
27
|
+
getRecordById(recordId) {
|
|
28
|
+
return this._dataUnit.records.find(record => record['__record__id__'] === recordId);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Em caso de necessidade de reload (isWaitingToReload), eh preciso chamar o dataUnit.gotoPage, pois ele aplica tambem a ordenacao dos registros,
|
|
32
|
+
* enquanto que o _controller.refresh apenas recarrega os dados na ordem que atua.
|
|
33
|
+
*/
|
|
34
|
+
handleRefreshOrReload(action) {
|
|
35
|
+
if (this._dataUnit.isWaitingToReload()) {
|
|
36
|
+
this.handleReload();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
this.handleRefresh(action);
|
|
40
|
+
}
|
|
41
|
+
handleReload() {
|
|
42
|
+
this._dataUnit.setWaitingToReload(false);
|
|
43
|
+
this._dataUnit.gotoPage(0);
|
|
44
|
+
}
|
|
45
|
+
handleRefresh(action) {
|
|
46
|
+
if (this.isSilentChange(action)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this._controller.refresh(action.type === Action.DATA_SAVED);
|
|
50
|
+
}
|
|
51
|
+
handleRecordsAdded() {
|
|
52
|
+
if (this._options.enableGridInsert) {
|
|
53
|
+
this._controller.refresh();
|
|
54
|
+
this.focusOnNewRecord();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
focusOnNewRecord() {
|
|
58
|
+
/**
|
|
59
|
+
* O SetTimeout eh utilizado pois é preciso aguardar que o novo registro seja renderizado na grade.
|
|
60
|
+
* Tentamos utilizar a api da grade para adicionar um event listener, porém na versão que utilizamos, não existe
|
|
61
|
+
* algo que resolva nosso cenário.
|
|
62
|
+
*
|
|
63
|
+
* Sugiro no futuro utilizar algo como o applyServerSideTransaction, porém será preciso lidar com os handlers
|
|
64
|
+
* e callbacks implementados no AgGridController e GridEditionManager.
|
|
65
|
+
*/
|
|
66
|
+
setTimeout(() => {
|
|
67
|
+
var _a;
|
|
68
|
+
const newRowIndex = ((_a = this._dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) - 1;
|
|
69
|
+
this._controller.startEditionOnRowByIndex(newRowIndex);
|
|
70
|
+
}, 500);
|
|
71
|
+
}
|
|
5
72
|
updateLoadedRecords(action) {
|
|
6
73
|
const records = action.payload;
|
|
7
74
|
if ((records === null || records === void 0 ? void 0 : records.length) > 0) {
|
|
@@ -53,15 +120,20 @@ export default class DataSource {
|
|
|
53
120
|
this._options.onPaginationUpdate(this._dataUnit.getPaginationInfo());
|
|
54
121
|
}
|
|
55
122
|
break;
|
|
56
|
-
case Action.
|
|
123
|
+
case Action.RECORDS_ADDED:
|
|
124
|
+
this.handleRecordsAdded();
|
|
125
|
+
break;
|
|
57
126
|
case Action.DATA_SAVED:
|
|
58
127
|
case Action.EDITION_CANCELED:
|
|
128
|
+
this._controller.clearInvalidCells(action.type);
|
|
129
|
+
this.handleRefreshOrReload(action);
|
|
130
|
+
break;
|
|
59
131
|
case Action.DATA_CHANGED:
|
|
60
132
|
case Action.DATA_RESOLVED:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
133
|
+
this.handleDataChanged(action);
|
|
134
|
+
break;
|
|
135
|
+
case Action.RECORDS_REMOVED:
|
|
136
|
+
this.handleRefresh(action);
|
|
65
137
|
break;
|
|
66
138
|
case Action.SELECTION_CHANGED:
|
|
67
139
|
case Action.NEXT_SELECTED:
|
|
@@ -71,6 +143,9 @@ export default class DataSource {
|
|
|
71
143
|
case Action.RECORD_LOADED:
|
|
72
144
|
this.updateLoadedRecords(action);
|
|
73
145
|
break;
|
|
146
|
+
case Action.SAVING_CANCELED:
|
|
147
|
+
this.handleSavingCanceled(action);
|
|
148
|
+
break;
|
|
74
149
|
}
|
|
75
150
|
};
|
|
76
151
|
this._dataUnit = dataUnit;
|
|
@@ -92,6 +167,9 @@ export default class DataSource {
|
|
|
92
167
|
setAutoFocus(autoFocus) {
|
|
93
168
|
this._options.autoFocus = autoFocus;
|
|
94
169
|
}
|
|
170
|
+
setEnableGridInsert(enable) {
|
|
171
|
+
this._options.enableGridInsert = enable;
|
|
172
|
+
}
|
|
95
173
|
getRows(params) {
|
|
96
174
|
if (this.needReload(params)) {
|
|
97
175
|
this._lastLoadingParams = params;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { UserInterface } from "@sankhyalabs/core";
|
|
1
|
+
import { Action, 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
5
|
import EzGridCustomCellEditor from "./components/EzGridCustomCellEditor";
|
|
6
6
|
import EzGridCustomCellRender from "./components/EzGridCustomCellRender";
|
|
7
7
|
export default class GridEditionManager {
|
|
8
|
-
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders) {
|
|
8
|
+
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert) {
|
|
9
9
|
this._dataUnit = dataUnit;
|
|
10
10
|
this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
11
11
|
getRequiredFields: () => this.getRequiredFields(),
|
|
12
|
-
markAsInvalid: () => { },
|
|
13
|
-
getMessageForField: () => null
|
|
12
|
+
markAsInvalid: (invalidField, recordId) => { this.setInvalidCell(invalidField, recordId); },
|
|
13
|
+
getMessageForField: () => null,
|
|
14
14
|
}, recordsValidator);
|
|
15
15
|
this._useEnterLikeTab = useEnterLikeTab;
|
|
16
16
|
this._editionIsDisabled = editionIsDisabled;
|
|
17
|
+
this._enableContinuousInsert = enableContinuousInsert;
|
|
17
18
|
this._customEditors = customEditors;
|
|
18
19
|
this._customRenders = customRenders;
|
|
19
20
|
}
|
|
@@ -28,6 +29,10 @@ export default class GridEditionManager {
|
|
|
28
29
|
};
|
|
29
30
|
return options;
|
|
30
31
|
}
|
|
32
|
+
canContinuousInsert() {
|
|
33
|
+
var _a;
|
|
34
|
+
return this._enableContinuousInsert && (this._dataUnit.records.length - 1) === ((_a = this._lastCellEdited) === null || _a === void 0 ? void 0 : _a.rowIndex);
|
|
35
|
+
}
|
|
31
36
|
proceedAutoSave() {
|
|
32
37
|
if (!this._dataUnit.isDirty()) {
|
|
33
38
|
this.saveSuccess();
|
|
@@ -40,15 +45,33 @@ export default class GridEditionManager {
|
|
|
40
45
|
if (currentRercord == undefined) {
|
|
41
46
|
return;
|
|
42
47
|
}
|
|
48
|
+
this._invalidCell = undefined;
|
|
43
49
|
this._recordValidationProcessor
|
|
44
|
-
.validate()
|
|
50
|
+
.validate(true)
|
|
45
51
|
.then(() => {
|
|
46
52
|
this._dataUnit.saveData()
|
|
47
|
-
.then(() =>
|
|
53
|
+
.then(() => {
|
|
54
|
+
if (this.canContinuousInsert()) {
|
|
55
|
+
this._dataUnit.addRecord();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.saveSuccess();
|
|
59
|
+
}
|
|
60
|
+
})
|
|
48
61
|
.catch(reason => this.saveFail(reason));
|
|
49
62
|
})
|
|
50
63
|
.catch(reason => this.saveFail(reason));
|
|
51
64
|
}
|
|
65
|
+
async recordValidate() {
|
|
66
|
+
if (!this._dataUnit.isDirty())
|
|
67
|
+
return;
|
|
68
|
+
try {
|
|
69
|
+
this._invalidCell = undefined;
|
|
70
|
+
await this._recordValidationProcessor.validate(false);
|
|
71
|
+
}
|
|
72
|
+
catch (error) { }
|
|
73
|
+
this._gridOptions.api.refreshCells({ force: true });
|
|
74
|
+
}
|
|
52
75
|
navigateByEnterKey(keyboardEvent) {
|
|
53
76
|
const backwards = keyboardEvent.shiftKey;
|
|
54
77
|
if (this._useEnterLikeTab) {
|
|
@@ -257,6 +280,34 @@ export default class GridEditionManager {
|
|
|
257
280
|
setCellRenders(customRenders) {
|
|
258
281
|
this._customRenders = customRenders;
|
|
259
282
|
}
|
|
283
|
+
setInvalidCell(invalidCell, recordId) {
|
|
284
|
+
this._invalidCell = { field: invalidCell, recordId };
|
|
285
|
+
}
|
|
286
|
+
getInvalidCell() {
|
|
287
|
+
return this._invalidCell;
|
|
288
|
+
}
|
|
289
|
+
clearInvalidCells(action) {
|
|
290
|
+
this._invalidCell = undefined;
|
|
291
|
+
if (action === Action.EDITION_CANCELED) {
|
|
292
|
+
this._isGridEdition = false;
|
|
293
|
+
}
|
|
294
|
+
else if (action === Action.DATA_SAVED && this.canContinuousInsert()) {
|
|
295
|
+
this._dataUnit.addRecord();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
setEnableContinuousInsert(enable) {
|
|
299
|
+
this._enableContinuousInsert = enable;
|
|
300
|
+
}
|
|
301
|
+
hasInvalidField(fieldName, recordId) {
|
|
302
|
+
if (!this.hasInvalidCell())
|
|
303
|
+
return false;
|
|
304
|
+
return this._invalidCell.field.name === fieldName && this._invalidCell.recordId === recordId;
|
|
305
|
+
}
|
|
306
|
+
hasInvalidCell() {
|
|
307
|
+
if (!this._invalidCell || !this._invalidCell.field || !this._invalidCell.recordId)
|
|
308
|
+
return false;
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
260
311
|
}
|
|
261
312
|
class TargetEdition {
|
|
262
313
|
constructor(rowIndex, column, backwards) {
|
package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js
CHANGED
|
@@ -9,8 +9,7 @@ export const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) =
|
|
|
9
9
|
/>`);
|
|
10
10
|
const loader = ApplicationContext.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");
|
|
11
11
|
ezSearch.optionLoader = (argument) => loader(argument, name, dataUnit);
|
|
12
|
-
ezSearch.
|
|
13
|
-
ezSearch.suppressPreLoad = true;
|
|
12
|
+
ezSearch.fromGrid = true;
|
|
14
13
|
ezSearch.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
|
|
15
14
|
ezSearch.valueGetter = () => ezSearch.getValueAsync();
|
|
16
15
|
return ezSearch;
|
|
@@ -36,6 +36,8 @@ export class EzGrid {
|
|
|
36
36
|
this.recordsValidator = undefined;
|
|
37
37
|
this.canEdit = true;
|
|
38
38
|
this.autoFocus = true;
|
|
39
|
+
this.enableGridInsert = false;
|
|
40
|
+
this.enableContinuousInsert = true;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* Aplica a definição de colunas.
|
|
@@ -362,6 +364,8 @@ export class EzGrid {
|
|
|
362
364
|
editionIsDisabled: () => !this.canEdit,
|
|
363
365
|
customFormatters: this._customFormatters,
|
|
364
366
|
autoFocus: this.autoFocus,
|
|
367
|
+
enableGridInsert: this.enableGridInsert,
|
|
368
|
+
enableContinuousInsert: this.enableContinuousInsert,
|
|
365
369
|
onRefresh: () => {
|
|
366
370
|
if (this.dataUnit) {
|
|
367
371
|
this.setSelection(this.dataUnit.getSelectionInfo());
|
|
@@ -454,6 +458,8 @@ export class EzGrid {
|
|
|
454
458
|
}
|
|
455
459
|
componentDidUpdate() {
|
|
456
460
|
this._gridController.setAutoFocus(this.autoFocus);
|
|
461
|
+
this._gridController.setEnableGridInsert(this.enableGridInsert);
|
|
462
|
+
this._gridController.setEnableContinuousInsert(this.enableContinuousInsert);
|
|
457
463
|
if (this.dataUnit) {
|
|
458
464
|
this.setSelection(this.dataUnit.getSelectionInfo());
|
|
459
465
|
}
|
|
@@ -467,7 +473,7 @@ export class EzGrid {
|
|
|
467
473
|
}
|
|
468
474
|
render() {
|
|
469
475
|
var _a;
|
|
470
|
-
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--
|
|
476
|
+
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--small grid-header" }, h("filter-column", { class: "grid-header__popover", noHeaderTaskBar: !this._hasLeftButtons, dataSource: this.getDataSource(), dataUnit: this.dataUnit, gridHeaderHidden: this.hideHeader(), ref: (element) => (this._filterColumn = element) }), h("div", { class: "grid-header__position" }, h("div", { class: "grid-header__container grid-header__left-container" }, h("slot", { name: "leftButtons" })), this.getPaginationControl())), h("div", { ref: (ref) => (this._gridSelectionCounter = ref), class: `grid__selection-counter ez-elevation--4
|
|
471
477
|
${this._showSelectionCounter ? 'grid__selection-counter--opened' : ''}
|
|
472
478
|
` }, 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" }))));
|
|
473
479
|
}
|
|
@@ -697,6 +703,42 @@ export class EzGrid {
|
|
|
697
703
|
"attribute": "auto-focus",
|
|
698
704
|
"reflect": false,
|
|
699
705
|
"defaultValue": "true"
|
|
706
|
+
},
|
|
707
|
+
"enableGridInsert": {
|
|
708
|
+
"type": "boolean",
|
|
709
|
+
"mutable": false,
|
|
710
|
+
"complexType": {
|
|
711
|
+
"original": "boolean",
|
|
712
|
+
"resolved": "boolean",
|
|
713
|
+
"references": {}
|
|
714
|
+
},
|
|
715
|
+
"required": false,
|
|
716
|
+
"optional": true,
|
|
717
|
+
"docs": {
|
|
718
|
+
"tags": [],
|
|
719
|
+
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
720
|
+
},
|
|
721
|
+
"attribute": "enable-grid-insert",
|
|
722
|
+
"reflect": false,
|
|
723
|
+
"defaultValue": "false"
|
|
724
|
+
},
|
|
725
|
+
"enableContinuousInsert": {
|
|
726
|
+
"type": "boolean",
|
|
727
|
+
"mutable": false,
|
|
728
|
+
"complexType": {
|
|
729
|
+
"original": "boolean",
|
|
730
|
+
"resolved": "boolean",
|
|
731
|
+
"references": {}
|
|
732
|
+
},
|
|
733
|
+
"required": false,
|
|
734
|
+
"optional": true,
|
|
735
|
+
"docs": {
|
|
736
|
+
"tags": [],
|
|
737
|
+
"text": "Ativa/desativa a inser\u00E7\u00E3o continua na grade\nS\u00F3 funciona quando a prop enableGridInsert est\u00E1 ativa"
|
|
738
|
+
},
|
|
739
|
+
"attribute": "enable-continuous-insert",
|
|
740
|
+
"reflect": false,
|
|
741
|
+
"defaultValue": "true"
|
|
700
742
|
}
|
|
701
743
|
};
|
|
702
744
|
}
|
|
@@ -147,6 +147,7 @@ p {
|
|
|
147
147
|
|
|
148
148
|
.item-content {
|
|
149
149
|
display: flex;
|
|
150
|
+
align-items: center;
|
|
150
151
|
overflow: hidden;
|
|
151
152
|
justify-content: flex-start;
|
|
152
153
|
width: 100%;
|
|
@@ -176,7 +177,7 @@ p {
|
|
|
176
177
|
|
|
177
178
|
.draggable-list li > div {
|
|
178
179
|
/*public*/
|
|
179
|
-
padding: var(--space--
|
|
180
|
+
padding: var(--space--3xs, 4px) var(--space--3xs, 4px);
|
|
180
181
|
margin: var(--ez-list__item--margin);
|
|
181
182
|
}
|
|
182
183
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
/*@doc Define a camada em que o componente será exibido.*/
|
|
3
|
-
--ez-modal-z-index: var(--elevation--
|
|
3
|
+
--ez-modal-z-index: var(--elevation--22, 22);
|
|
4
4
|
/*@doc Define o espaçamento vertical do conteúdo do modal.*/
|
|
5
5
|
--ez-modal-vertical-padding: var(--space--large, 24px);
|
|
6
6
|
/*@doc Define o padding entre o conteúdo e o modal */
|
|
@@ -48,7 +48,7 @@ export class EzModalContainer {
|
|
|
48
48
|
this._closeButton.focus();
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
51
|
-
return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--
|
|
51
|
+
return (h(Host, null, h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusLast() }), h("div", { ref: ref => this._modalRef = ref, tabIndex: -1, class: "ez-modal-container__header-container" }, this.showTitleBar && (h("div", { class: "ez-modal-container__header ez-margin-bottom--medium" }, h("div", { class: "ez-col ez-align--middle ez-modal-container__title" }, h("h2", { class: "ez-text ez-title--large ez-title--primary ez-text--bold ez-margin-vertical--extra-small" }, this.modalTitle), this.modalSubTitle && (h("div", { class: "ez-text ez-text--medium ez-text--primary ez-margin-vertical--extra-small" }, this.modalSubTitle))), (this.showCloseButton && h("button", { ref: ref => this._closeButton = ref, class: "ez-modal-container__close-button", onClick: () => this.ezModalAction.emit(ModalAction.CLOSE) }, h("ez-icon", { class: "ez-modal-container__close-icon", size: "medium", iconName: "close" })))))), h("div", { class: "ez-modal-container__content" }, h("slot", null)), h("div", { class: "ez-modal-container__footer" }, this.cancelIsVisible() && (h("ez-button", { label: this.cancelButtonLabel, enabled: this.cancelButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.CANCEL) })), this.okIsVisible() && (h("ez-button", { ref: ref => this._okButton = ref, class: "ez-button--primary", label: this.okButtonLabel, enabled: this.okButtonStatus !== ModalButtonStatus.DISABLED, onClick: () => this.ezModalAction.emit(ModalAction.OK) }))), h("button", { class: "ez-modal-container__focus-ctrl", onFocusin: () => this.focusFirst() })));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "ez-modal-container"; }
|
|
54
54
|
static get encapsulation() { return "scoped"; }
|
|
@@ -135,10 +135,10 @@ ez-icon {
|
|
|
135
135
|
background-color: var(--ez-search--background-color--xlight);
|
|
136
136
|
border-radius: var(--ez-search--border-radius);
|
|
137
137
|
box-shadow: var(--shadow, 0px 0px 16px 0px #000);
|
|
138
|
-
padding: var(--ez-search--space--small);
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
.list-options {
|
|
141
|
+
margin-top: 0px;
|
|
142
142
|
box-sizing: border-box;
|
|
143
143
|
width: 100%;
|
|
144
144
|
height: 100%;
|
|
@@ -146,20 +146,24 @@ ez-icon {
|
|
|
146
146
|
display: flex;
|
|
147
147
|
flex-direction: column;
|
|
148
148
|
scroll-behavior: smooth;
|
|
149
|
-
overflow: auto;
|
|
149
|
+
overflow-y: auto;
|
|
150
|
+
overflow-x: hidden;
|
|
150
151
|
scrollbar-width: thin;
|
|
151
|
-
gap: 3px;
|
|
152
152
|
|
|
153
153
|
/*public*/
|
|
154
154
|
scrollbar-color: var(--ez-search__scrollbar--color-clicked) var(--ez-search__scrollbar--color-background);
|
|
155
|
+
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
.list-options::-webkit-scrollbar {
|
|
158
159
|
/*public*/
|
|
159
|
-
background-color: var(--
|
|
160
|
-
width: var(--
|
|
161
|
-
max-width: var(--
|
|
162
|
-
min-width: var(--
|
|
160
|
+
background-color: var(--scrollbar--background);
|
|
161
|
+
width: var(--space--small);
|
|
162
|
+
max-width: var(--space--small);
|
|
163
|
+
min-width: var(--space--small);
|
|
164
|
+
height: var(--space--small);
|
|
165
|
+
max-height: var(--space--small);
|
|
166
|
+
min-height: var(--space--small);
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
.list-options::-webkit-scrollbar-track {
|
|
@@ -196,7 +200,6 @@ ez-icon {
|
|
|
196
200
|
|
|
197
201
|
/*public*/
|
|
198
202
|
border-radius: var(--ez-search--border-radius-small);
|
|
199
|
-
padding: var(--ez-search--space--small);
|
|
200
203
|
gap: var(--space--small, 6px);
|
|
201
204
|
}
|
|
202
205
|
|
|
@@ -331,4 +334,12 @@ ez-text-input:hover .btn__close, ez-text-input:focus .btn__close {
|
|
|
331
334
|
@keyframes spin {
|
|
332
335
|
0% { transform: rotate(0deg); }
|
|
333
336
|
100% { transform: rotate(360deg); }
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
@supports not (scrollbar-width: thin) {
|
|
340
|
+
/* Estilos para navegadores que NÃO suportam scrollbar-width */
|
|
341
|
+
.item {
|
|
342
|
+
/* Estilos alternativos, por exemplo, para navegadores que não suportam scrollbar-width */
|
|
343
|
+
padding-right: 8px;
|
|
344
|
+
}
|
|
334
345
|
}
|