@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-77074.0 → 0.0.0-bugfix-dev-kb-77634.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/DataBinder-3b083480.js +445 -0
- package/dist/cjs/FocusResolver-885f2173.js +35 -0
- package/dist/cjs/ez-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-card-item_3.cjs.entry.js +12 -19
- package/dist/cjs/ez-chart.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +46 -10
- package/dist/cjs/ez-custom-form-input_2.cjs.entry.js +3 -2
- package/dist/cjs/ez-date-input.cjs.entry.js +8 -2
- package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -2
- package/dist/cjs/ez-dialog.cjs.entry.js +10 -2
- package/dist/cjs/ez-form-view.cjs.entry.js +2 -2
- package/dist/cjs/ez-form.cjs.entry.js +5 -325
- package/dist/cjs/ez-grid.cjs.entry.js +14614 -70500
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +151 -100
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +7 -0
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-search.cjs.entry.js +71 -22
- package/dist/cjs/ez-split-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +66 -4
- package/dist/cjs/ez-text-input.cjs.entry.js +49 -7
- package/dist/cjs/ez-time-input.cjs.entry.js +6 -0
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-button/ez-button.css +2 -2
- package/dist/collection/components/ez-card-item/ez-card-item.css +14 -5
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +75 -14
- package/dist/collection/components/ez-date-input/ez-date-input.js +35 -4
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +35 -4
- package/dist/collection/components/ez-dialog/ez-dialog.css +3 -3
- package/dist/collection/components/ez-dialog/ez-dialog.js +9 -1
- package/dist/collection/components/ez-filter-input/ez-filter-input.css +0 -11
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +22 -52
- package/dist/collection/components/ez-form/ez-form.js +1 -0
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +3 -2
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.js +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +96 -27
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +8 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +164 -46
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +7 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/DateInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js +4 -1
- package/dist/collection/components/ez-grid/ez-grid.js +90 -3
- package/dist/collection/components/ez-icon/ez-icon.css +153 -149
- package/dist/collection/components/ez-list/ez-list.css +5 -5
- package/dist/collection/components/ez-list/ez-list.js +152 -170
- package/dist/collection/components/ez-modal/ez-modal.css +4 -0
- package/dist/collection/components/ez-modal/ez-modal.js +2 -2
- package/dist/collection/components/ez-number-input/ez-number-input.js +25 -0
- package/dist/collection/components/ez-popover/ez-popover.css +3 -10
- package/dist/collection/components/ez-popup/ez-popup.css +1 -1
- package/dist/collection/components/ez-popup/ez-popup.js +1 -1
- package/dist/collection/components/ez-search/ez-search.css +1 -1
- package/dist/collection/components/ez-search/ez-search.js +98 -24
- package/dist/collection/components/ez-split-button/ez-split-button.css +2 -2
- package/dist/collection/components/ez-text-area/ez-text-area.css +49 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +102 -2
- package/dist/collection/components/ez-text-input/ez-text-input.css +27 -53
- package/dist/collection/components/ez-text-input/ez-text-input.js +84 -6
- package/dist/collection/components/ez-time-input/ez-time-input.js +24 -0
- package/dist/collection/utils/FocusResolver.js +31 -0
- package/dist/collection/utils/form/DataBinder.js +18 -3
- package/dist/collection/utils/form/FormMetadata.js +1 -1
- package/dist/collection/utils/interfaces/AbstractFieldMetadata.js +1 -1
- package/dist/custom-elements/index.js +15294 -70867
- package/dist/esm/DataBinder-02fa9bb9.js +441 -0
- package/dist/esm/FocusResolver-1ccbf850.js +33 -0
- package/dist/esm/ez-button.entry.js +1 -1
- package/dist/esm/ez-card-item_3.entry.js +12 -19
- package/dist/esm/ez-chart.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +47 -11
- package/dist/esm/ez-custom-form-input_2.entry.js +3 -2
- package/dist/esm/ez-date-input.entry.js +8 -2
- package/dist/esm/ez-date-time-input.entry.js +8 -2
- package/dist/esm/ez-dialog.entry.js +10 -2
- package/dist/esm/ez-form-view.entry.js +2 -2
- package/dist/esm/ez-form.entry.js +4 -324
- package/dist/esm/ez-grid.entry.js +14584 -70470
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +152 -101
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +7 -0
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-search.entry.js +71 -22
- package/dist/esm/ez-split-button.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +66 -4
- package/dist/esm/ez-text-input.entry.js +49 -7
- package/dist/esm/ez-time-input.entry.js +6 -0
- 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-0a75bb05.entry.js +1 -0
- package/dist/ezui/p-0db68715.entry.js +1 -0
- package/dist/ezui/p-15d7af92.entry.js +1 -0
- package/dist/ezui/p-19098a3f.entry.js +1 -0
- package/dist/ezui/p-1f830a2f.entry.js +1 -0
- package/dist/ezui/p-2aa8e4b2.entry.js +1 -0
- package/dist/ezui/p-2bb2a0c4.entry.js +1 -0
- package/dist/ezui/p-3175fe8c.entry.js +1 -0
- package/dist/ezui/p-455e737c.js +1 -0
- package/dist/ezui/{p-a2e5b8c3.entry.js → p-7409eeaa.entry.js} +1 -1
- package/dist/ezui/p-7ed30844.entry.js +1 -0
- package/dist/ezui/p-97af4b13.entry.js +1 -0
- package/dist/ezui/p-98dc7ce3.entry.js +309 -0
- package/dist/ezui/p-a5b91a77.entry.js +1 -0
- package/dist/ezui/p-a80b1287.entry.js +1 -0
- package/dist/ezui/p-bfad39eb.entry.js +1 -0
- package/dist/ezui/p-cd2e78f0.entry.js +1 -0
- package/dist/ezui/p-d0ca26fe.entry.js +1 -0
- package/dist/ezui/p-d24a7b4c.entry.js +1 -0
- package/dist/ezui/p-dc628ed3.js +1 -0
- package/dist/ezui/p-dc8b36c3.entry.js +1 -0
- package/dist/ezui/p-e5e16038.entry.js +1 -0
- package/dist/ezui/p-fec696ab.entry.js +1 -0
- package/dist/ezui/p-ffd246f5.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +7 -1
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +6 -1
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +6 -1
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +2 -0
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -11
- package/dist/types/components/ez-form-view/fieldbuilder/templates/TextInput.tpl.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +12 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +7 -2
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -1
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +19 -7
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +3 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/cellRendererStatus.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/selectionHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +1 -1
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellEditor.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/mock/Server.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +11 -1
- package/dist/types/components/ez-list/ez-list.d.ts +3 -26
- package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +4 -0
- package/dist/types/components/ez-search/ez-search.d.ts +10 -2
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +17 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +9 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +4 -0
- package/dist/types/components.d.ts +109 -44
- package/dist/types/utils/FocusResolver.d.ts +5 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/package.json +11 -4
- package/dist/cjs/RecordValidationProcessor-10846595.js +0 -108
- package/dist/esm/RecordValidationProcessor-9c6cc267.js +0 -105
- package/dist/ezui/p-10820c20.entry.js +0 -1
- package/dist/ezui/p-188f1c4c.entry.js +0 -1
- package/dist/ezui/p-49456b34.entry.js +0 -1
- package/dist/ezui/p-5a90d7d1.entry.js +0 -1
- package/dist/ezui/p-5b205c80.entry.js +0 -1
- package/dist/ezui/p-62732269.entry.js +0 -1
- package/dist/ezui/p-7bc07c31.entry.js +0 -1
- package/dist/ezui/p-86b6aa01.entry.js +0 -1
- package/dist/ezui/p-9d9ecb7c.entry.js +0 -1
- package/dist/ezui/p-abce5219.entry.js +0 -1
- package/dist/ezui/p-b3b94f72.entry.js +0 -1
- package/dist/ezui/p-b95632e8.entry.js +0 -1
- package/dist/ezui/p-bcd47eda.entry.js +0 -1
- package/dist/ezui/p-c3c3d640.entry.js +0 -304
- package/dist/ezui/p-cdc472cc.entry.js +0 -1
- package/dist/ezui/p-d2c06f38.entry.js +0 -1
- package/dist/ezui/p-d8f64bb7.entry.js +0 -1
- package/dist/ezui/p-dc4ada32.entry.js +0 -1
- package/dist/ezui/p-e85c48d7.entry.js +0 -1
- package/dist/ezui/p-f299c608.entry.js +0 -1
- package/dist/ezui/p-f42855b9.js +0 -1
- package/dist/ezui/p-f80ac647.entry.js +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { UserInterface } from '@sankhyalabs/core';
|
|
2
|
-
import { KeyCode, } from
|
|
1
|
+
import { LockManager, LockManagerOperation, UserInterface } from '@sankhyalabs/core';
|
|
2
|
+
import { KeyCode, } from "@ag-grid-community/core";
|
|
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
|
+
import { DataBinder } from '../../../../utils';
|
|
7
8
|
export default class GridEditionManager {
|
|
8
|
-
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert) {
|
|
9
|
+
constructor(dataUnit, useEnterLikeTab, recordsValidator, editionIsDisabled, customEditors, customRenders, enableContinuousInsert, enableGridInsert, lockerId) {
|
|
9
10
|
this._dataUnit = dataUnit;
|
|
10
11
|
this._recordValidationProcessor = new RecordValidationProcessor(this._dataUnit, {
|
|
11
12
|
getRequiredFields: () => this.getRequiredFields(),
|
|
12
|
-
markAsInvalid: (invalidField, recordId) => { this.
|
|
13
|
+
markAsInvalid: (invalidField, recordId) => { this.pushInvalidCell(invalidField, recordId); },
|
|
13
14
|
getMessageForField: () => null,
|
|
14
15
|
}, recordsValidator);
|
|
15
16
|
this._useEnterLikeTab = useEnterLikeTab;
|
|
@@ -18,16 +19,34 @@ export default class GridEditionManager {
|
|
|
18
19
|
this._enableGridInsert = enableGridInsert;
|
|
19
20
|
this._customEditors = customEditors;
|
|
20
21
|
this._customRenders = customRenders;
|
|
22
|
+
this._lockerId = lockerId;
|
|
21
23
|
}
|
|
22
24
|
configureGrid(options) {
|
|
23
25
|
this._gridOptions = options;
|
|
24
26
|
options.readOnlyEdit = true;
|
|
25
27
|
options.onCellEditRequest = evt => this.onCellEditRequest(evt);
|
|
28
|
+
options.onCellEditingStarted = async (evt) => {
|
|
29
|
+
var _a;
|
|
30
|
+
if (this._dataUnit.hasNewRecord()) {
|
|
31
|
+
this.handleCellEditingStartedRowAdd(evt);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this._lastCellOpened = this._lastCellEdited = { rowIndex: evt.rowIndex, column: evt.column, rowPinned: undefined };
|
|
35
|
+
}
|
|
36
|
+
(_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
37
|
+
this._currentEditLock = LockManager.lock(this._lockerId, LockManagerOperation.TASKBAR_CLICK);
|
|
38
|
+
};
|
|
39
|
+
options.onCellEditingStopped = () => {
|
|
40
|
+
var _a;
|
|
41
|
+
(_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
42
|
+
};
|
|
26
43
|
options.onCellKeyDown = evt => {
|
|
27
44
|
if (evt.event && evt["column"]) {
|
|
28
45
|
this.onCellKeyDown(evt);
|
|
29
46
|
}
|
|
30
47
|
};
|
|
48
|
+
options.isRowSelectable = (node) => this.isSelectableRow(node);
|
|
49
|
+
options.onCellFocused = () => this.lockFocusWhenAddRow();
|
|
31
50
|
return options;
|
|
32
51
|
}
|
|
33
52
|
updateCurrentEditorGuiValue(updatedRowValue) {
|
|
@@ -40,37 +59,82 @@ export default class GridEditionManager {
|
|
|
40
59
|
const value = updatedRowValue[fieldName];
|
|
41
60
|
currentEditor.setGuiValue(value);
|
|
42
61
|
}
|
|
62
|
+
lockFocusWhenAddRow() {
|
|
63
|
+
var _a, _b, _c, _d;
|
|
64
|
+
const api = this._gridOptions.api;
|
|
65
|
+
const newFocusCell = api.getFocusedCell();
|
|
66
|
+
const rowIndex = newFocusCell === null || newFocusCell === void 0 ? void 0 : newFocusCell.rowIndex;
|
|
67
|
+
const recordId = (_b = (_a = this._dataUnit.getAddedRecords()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.__record__id__;
|
|
68
|
+
const rowNode = api.getRowNode(recordId);
|
|
69
|
+
if (!this._dataUnit.hasNewRecord() || rowIndex == (rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const lastCell = (_d = (_c = this._lastCellOpened) !== null && _c !== void 0 ? _c : this._lastCellEdited) !== null && _d !== void 0 ? _d : this._lastCellClicked;
|
|
73
|
+
if ((lastCell === null || lastCell === void 0 ? void 0 : lastCell.rowIndex) < (rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
api.clearFocusedCell();
|
|
77
|
+
if (!lastCell || (rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex) == undefined) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
lastCell.rowIndex = rowNode === null || rowNode === void 0 ? void 0 : rowNode.rowIndex;
|
|
81
|
+
this.focusOnCell(lastCell);
|
|
82
|
+
}
|
|
83
|
+
handleCellEditingStartedRowAdd(evt) {
|
|
84
|
+
var _a, _b, _c, _d, _e;
|
|
85
|
+
const nodeId = (_a = evt.node) === null || _a === void 0 ? void 0 : _a.id;
|
|
86
|
+
const addedRecordId = (_c = (_b = this._dataUnit.getAddedRecords()) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.__record__id__;
|
|
87
|
+
if (nodeId == addedRecordId) {
|
|
88
|
+
this._lastCellOpened = this._lastCellEdited = { rowIndex: evt.rowIndex, column: evt === null || evt === void 0 ? void 0 : evt.column, rowPinned: undefined };
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
evt.api.stopEditing();
|
|
92
|
+
const rowIndex = (_d = evt.api.getRowNode(addedRecordId)) === null || _d === void 0 ? void 0 : _d.rowIndex;
|
|
93
|
+
this._lastCellOpened = this._lastCellEdited = { rowIndex: rowIndex, column: (_e = this._lastCellEdited) === null || _e === void 0 ? void 0 : _e.column, rowPinned: undefined };
|
|
94
|
+
}
|
|
95
|
+
isSelectableRow(node) {
|
|
96
|
+
if (!this._dataUnit.hasNewRecord()) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
if (!this._dataUnit.isNewRecord(node.id)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
43
104
|
canContinuousInsert() {
|
|
44
105
|
var _a;
|
|
45
106
|
return this._enableContinuousInsert && (this._dataUnit.records.length - 1) === ((_a = this._lastCellEdited) === null || _a === void 0 ? void 0 : _a.rowIndex);
|
|
46
107
|
}
|
|
47
|
-
proceedAutoSave() {
|
|
108
|
+
async proceedAutoSave() {
|
|
48
109
|
if (!this._dataUnit.isDirty()) {
|
|
49
110
|
this.saveSuccess();
|
|
50
|
-
return;
|
|
111
|
+
return true;
|
|
51
112
|
}
|
|
52
|
-
|
|
53
|
-
|
|
113
|
+
const currentRecord = this._dataUnit.getSelectedRecord();
|
|
114
|
+
if (currentRecord == undefined) {
|
|
115
|
+
return true;
|
|
54
116
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
117
|
+
this.clearInvalidCells(false);
|
|
118
|
+
try {
|
|
119
|
+
await this._recordValidationProcessor.validate(true);
|
|
120
|
+
await this.saveDataUnit();
|
|
121
|
+
this.saveSuccess();
|
|
122
|
+
return true;
|
|
58
123
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.catch(reason => this.saveFail(reason));
|
|
124
|
+
catch (reason) {
|
|
125
|
+
this.saveFail(reason);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async saveDataUnit() {
|
|
130
|
+
await this._dataUnit.saveData();
|
|
131
|
+
return true;
|
|
68
132
|
}
|
|
69
133
|
async recordValidate() {
|
|
70
134
|
if (!this._dataUnit.isDirty())
|
|
71
135
|
return;
|
|
72
136
|
try {
|
|
73
|
-
this.
|
|
137
|
+
this.clearInvalidCells(false);
|
|
74
138
|
await this._recordValidationProcessor.validate(false);
|
|
75
139
|
}
|
|
76
140
|
catch (error) { }
|
|
@@ -98,6 +162,13 @@ export default class GridEditionManager {
|
|
|
98
162
|
return { ezCellEditor: EzCellEditor };
|
|
99
163
|
}
|
|
100
164
|
verifyClickToEdition(api, cellClicked) {
|
|
165
|
+
var _a, _b;
|
|
166
|
+
const selectedRecordID = (_a = this._dataUnit.getSelectedRecord()) === null || _a === void 0 ? void 0 : _a.__record__id__;
|
|
167
|
+
if (this._dataUnit.hasNewRecord() && selectedRecordID) {
|
|
168
|
+
const dataUnitRecordIndex = (_b = api.getRowNode(selectedRecordID)) === null || _b === void 0 ? void 0 : _b.rowIndex;
|
|
169
|
+
if (dataUnitRecordIndex != cellClicked.rowIndex)
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
101
172
|
if (this.isSecondClick(cellClicked)) {
|
|
102
173
|
api.startEditingCell({ rowIndex: cellClicked.rowIndex, colKey: cellClicked.column.getColId() });
|
|
103
174
|
}
|
|
@@ -107,6 +178,9 @@ export default class GridEditionManager {
|
|
|
107
178
|
col.cellEditor = 'ezCellEditor';
|
|
108
179
|
col.editable = params => this.canEdit(params);
|
|
109
180
|
col.suppressKeyboardEvent = (params) => {
|
|
181
|
+
if (params.event.key === KeyCode.ESCAPE && params.editing) {
|
|
182
|
+
return this._dataUnit.isDirty();
|
|
183
|
+
}
|
|
110
184
|
return params.event.key === KeyCode.ENTER;
|
|
111
185
|
};
|
|
112
186
|
col.cellEditorSelector = (params) => {
|
|
@@ -136,10 +210,21 @@ export default class GridEditionManager {
|
|
|
136
210
|
return col;
|
|
137
211
|
}
|
|
138
212
|
getRequiredFields() {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
213
|
+
const formRequiredFields = this.getFormRequiredFields();
|
|
214
|
+
return this._gridOptions.columnApi.getAllDisplayedColumns()
|
|
215
|
+
.filter(column => {
|
|
216
|
+
const fieldDefinition = this._dataUnit.getField(column.getColId());
|
|
217
|
+
return (fieldDefinition && fieldDefinition.required) || formRequiredFields.includes(column.getColId());
|
|
218
|
+
})
|
|
219
|
+
.map(column => column.getColId());
|
|
220
|
+
}
|
|
221
|
+
getFormRequiredFields() {
|
|
222
|
+
const formRequiredFields = [];
|
|
223
|
+
const dataBinders = DataBinder.getDataBindersByDataUnit(this._dataUnit);
|
|
224
|
+
dataBinders.forEach(dataBinder => {
|
|
225
|
+
formRequiredFields.push(...dataBinder.getFormRequiredFields());
|
|
226
|
+
});
|
|
227
|
+
return formRequiredFields;
|
|
143
228
|
}
|
|
144
229
|
saveSuccess() {
|
|
145
230
|
var _a;
|
|
@@ -152,10 +237,11 @@ export default class GridEditionManager {
|
|
|
152
237
|
this._isGridEdition = false;
|
|
153
238
|
}
|
|
154
239
|
saveFail(reason) {
|
|
155
|
-
|
|
240
|
+
var _a;
|
|
241
|
+
this.focusOnCell((_a = this._lastCellOpened) !== null && _a !== void 0 ? _a : this._lastCellEdited);
|
|
156
242
|
this._isGridEdition = false;
|
|
157
243
|
if (reason) {
|
|
158
|
-
|
|
244
|
+
throw reason;
|
|
159
245
|
}
|
|
160
246
|
}
|
|
161
247
|
focusOnCell(cell) {
|
|
@@ -220,6 +306,9 @@ export default class GridEditionManager {
|
|
|
220
306
|
this.moveEditionVertically(api, 1);
|
|
221
307
|
}
|
|
222
308
|
moveEditionVertically(api, offset) {
|
|
309
|
+
if (this._dataUnit.hasNewRecord() && this._isGridEdition) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
223
312
|
const editionCell = api.getEditingCells()[0];
|
|
224
313
|
if (!editionCell) {
|
|
225
314
|
return;
|
|
@@ -264,41 +353,63 @@ export default class GridEditionManager {
|
|
|
264
353
|
return true;
|
|
265
354
|
}
|
|
266
355
|
onCellEditRequest(event) {
|
|
267
|
-
|
|
356
|
+
var _a;
|
|
268
357
|
const value = event.newValue;
|
|
269
|
-
if (event.oldValue
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
358
|
+
if (event.oldValue == value) {
|
|
359
|
+
(_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
if (value instanceof Promise) {
|
|
363
|
+
this.handlePromiseValue(event, value);
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
this.updateCellValue(event, value);
|
|
367
|
+
}
|
|
368
|
+
async handlePromiseValue(event, value) {
|
|
369
|
+
const fieldName = event.colDef.field;
|
|
370
|
+
const fieldDescriptor = this._dataUnit.getField(event.colDef.colId);
|
|
371
|
+
const initialValue = (fieldDescriptor === null || fieldDescriptor === void 0 ? void 0 : fieldDescriptor.userInterface) === UserInterface.SEARCH ? value : event.oldValue;
|
|
372
|
+
event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: initialValue }));
|
|
373
|
+
const resolved = await value;
|
|
374
|
+
return this.updateCellValue(event, resolved);
|
|
375
|
+
}
|
|
376
|
+
updateCellValue(event, newValue) {
|
|
377
|
+
var _a;
|
|
378
|
+
const fieldName = event.colDef.field;
|
|
379
|
+
event.node.setData(Object.assign(Object.assign({}, event.data), { [fieldName]: newValue }));
|
|
380
|
+
(_a = this._currentEditLock) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
381
|
+
if (event.oldValue !== newValue) {
|
|
278
382
|
this._isGridEdition = true;
|
|
279
|
-
this._dataUnit.setFieldValue(fieldName,
|
|
383
|
+
this._dataUnit.setFieldValue(fieldName, newValue, [event.data.__record__id__], { suppressCreateNewRecord: true });
|
|
280
384
|
this._lastCellEdited = { rowIndex: event.rowIndex, column: event.column, rowPinned: undefined };
|
|
281
385
|
}
|
|
282
386
|
}
|
|
283
387
|
setCellEditors(customEditors) {
|
|
388
|
+
var _a;
|
|
284
389
|
this._customEditors = customEditors;
|
|
390
|
+
(_a = this._gridOptions) === null || _a === void 0 ? void 0 : _a.api.stopEditing();
|
|
285
391
|
}
|
|
286
392
|
setCellRenders(customRenders) {
|
|
287
393
|
this._customRenders = customRenders;
|
|
288
394
|
}
|
|
289
|
-
|
|
290
|
-
this.
|
|
395
|
+
pushInvalidCell(invalidField, recordId) {
|
|
396
|
+
this._invalidCells.push({ field: invalidField, recordId });
|
|
397
|
+
this._nextInvalidCell = this._invalidCells[0];
|
|
398
|
+
}
|
|
399
|
+
getInvalidCells() {
|
|
400
|
+
return this._invalidCells;
|
|
291
401
|
}
|
|
292
|
-
|
|
293
|
-
return this.
|
|
402
|
+
getNextInvalidCell() {
|
|
403
|
+
return this._nextInvalidCell;
|
|
294
404
|
}
|
|
295
|
-
processContinuousInsert() {
|
|
405
|
+
async processContinuousInsert() {
|
|
296
406
|
if (!this.canContinuousInsert())
|
|
297
407
|
return;
|
|
298
408
|
this._dataUnit.addRecord();
|
|
299
409
|
}
|
|
300
410
|
clearInvalidCells(stopEdition) {
|
|
301
|
-
this.
|
|
411
|
+
this._invalidCells = [];
|
|
412
|
+
this._nextInvalidCell = undefined;
|
|
302
413
|
if (stopEdition) {
|
|
303
414
|
this._isGridEdition = false;
|
|
304
415
|
}
|
|
@@ -309,10 +420,17 @@ export default class GridEditionManager {
|
|
|
309
420
|
hasInvalidField(fieldName, recordId) {
|
|
310
421
|
if (!this.hasInvalidCell())
|
|
311
422
|
return false;
|
|
312
|
-
|
|
423
|
+
this._nextInvalidCell = this._invalidCells[0];
|
|
424
|
+
const containsFieldName = this._nextInvalidCell.field.name === fieldName;
|
|
425
|
+
const containsRecordId = this._nextInvalidCell.recordId === recordId;
|
|
426
|
+
return containsFieldName && containsRecordId;
|
|
313
427
|
}
|
|
314
428
|
hasInvalidCell() {
|
|
315
|
-
|
|
429
|
+
var _a, _b, _c;
|
|
430
|
+
const hasInvalidCell = ((_a = this._invalidCells) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
431
|
+
const hasField = (_b = this._invalidCells) === null || _b === void 0 ? void 0 : _b.filter(invalidCell => { invalidCell.field; });
|
|
432
|
+
const hasRecordId = (_c = this._invalidCells) === null || _c === void 0 ? void 0 : _c.filter(invalidCell => { invalidCell.recordId; });
|
|
433
|
+
if (!hasInvalidCell || !hasField || !hasRecordId)
|
|
316
434
|
return false;
|
|
317
435
|
return true;
|
|
318
436
|
}
|
package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js
CHANGED
|
@@ -2,6 +2,7 @@ import { HTMLBuilder } from "@sankhyalabs/core";
|
|
|
2
2
|
import { CustomEditorSource } from "../../../../../utils/customEditor/interfaces/ICustomEditor";
|
|
3
3
|
import EzCellEditor from "../editor/EzCellEditor";
|
|
4
4
|
import { getViewPortHeight } from "../editor/GridEditorUtils";
|
|
5
|
+
import FocusResolver from "../../../../../utils/FocusResolver";
|
|
5
6
|
export default class EzGridCustomCellEditor extends EzCellEditor {
|
|
6
7
|
init(params) {
|
|
7
8
|
var _a, _b;
|
|
@@ -65,4 +66,10 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
|
|
|
65
66
|
return this._customGui.value;
|
|
66
67
|
return this._value;
|
|
67
68
|
}
|
|
69
|
+
afterGuiAttached() {
|
|
70
|
+
this.focusIn();
|
|
71
|
+
}
|
|
72
|
+
focusIn() {
|
|
73
|
+
FocusResolver.resolveFocus(this._customGui);
|
|
74
|
+
}
|
|
68
75
|
}
|
package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/ComboBox.tpl.js
CHANGED
|
@@ -19,6 +19,7 @@ export const buildComboBox = ({ required, props, eGridCell }) => {
|
|
|
19
19
|
combo.options = options;
|
|
20
20
|
combo.stopPropagateEnterKeyEvent = true;
|
|
21
21
|
combo.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
|
|
22
|
+
combo.autoFocus = true;
|
|
22
23
|
return combo;
|
|
23
24
|
};
|
|
24
25
|
export const buildSwitch = (fieldMetadata) => {
|
package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/Search.tpl.js
CHANGED
|
@@ -13,6 +13,7 @@ export const buildSearch = ({ name, required, readOnly, eGridCell, dataUnit }) =
|
|
|
13
13
|
ezSearch.suppressPreLoad = true;
|
|
14
14
|
ezSearch.listOptionsPosition = { verticalPosition: 29, bottomLimit: getViewPortHeight(eGridCell), hardPosition: true };
|
|
15
15
|
ezSearch.stopPropagateEnterKeyEvent = true;
|
|
16
|
+
ezSearch.autoFocus = true;
|
|
16
17
|
ezSearch.valueGetter = () => ezSearch.getValueAsync();
|
|
17
18
|
return ezSearch;
|
|
18
19
|
};
|
package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/TextInput.tpl.js
CHANGED
|
@@ -2,12 +2,14 @@ import { HTMLBuilder } from "@sankhyalabs/core";
|
|
|
2
2
|
const MINIMIUM_WIDTH_TEXTAREA = 210;
|
|
3
3
|
const PADDING_VALUE_TEXTAREA = 12;
|
|
4
4
|
export const buildTextInput = ({ name, contextName }) => {
|
|
5
|
-
|
|
5
|
+
const textInput = HTMLBuilder.parseElement(`<ez-text-input
|
|
6
6
|
class="ez-grid grid_editor"
|
|
7
7
|
data-field-name=${name}
|
|
8
8
|
data-context-name=${contextName}
|
|
9
9
|
mode="slim"
|
|
10
10
|
/>`);
|
|
11
|
+
textInput.autoFocus = true;
|
|
12
|
+
return textInput;
|
|
11
13
|
};
|
|
12
14
|
export const buildTextAreaInput = ({ eGridCell, editionManager }) => {
|
|
13
15
|
const element = HTMLBuilder.parseElement(`<ez-text-area
|
|
@@ -17,6 +19,7 @@ export const buildTextAreaInput = ({ eGridCell, editionManager }) => {
|
|
|
17
19
|
element.addEventListener('keydown', event => handlePressEnterEvent(event, element, editionManager));
|
|
18
20
|
setElementInitialWidth(eGridCell, element);
|
|
19
21
|
element.isPopUp = true;
|
|
22
|
+
element.autoFocus = true;
|
|
20
23
|
return element;
|
|
21
24
|
};
|
|
22
25
|
function setElementInitialWidth(eGridCell, element) {
|
|
@@ -39,6 +39,7 @@ export class EzGrid {
|
|
|
39
39
|
this.paginationCounterMode = 'show';
|
|
40
40
|
this.enableGridInsert = false;
|
|
41
41
|
this.enableContinuousInsert = true;
|
|
42
|
+
this.enableLockManger = true;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* Aplica a definição de colunas.
|
|
@@ -163,6 +164,18 @@ export class EzGrid {
|
|
|
163
164
|
async setFocus() {
|
|
164
165
|
this._gridController.setFocus();
|
|
165
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Para a edição da grade.
|
|
169
|
+
*/
|
|
170
|
+
async stopEdit() {
|
|
171
|
+
this._gridController.stopEdit();
|
|
172
|
+
}
|
|
173
|
+
async checkStopEditOutsideClick(event) {
|
|
174
|
+
var _a;
|
|
175
|
+
if ((_a = this._container) === null || _a === void 0 ? void 0 : _a.contains(event.target))
|
|
176
|
+
return;
|
|
177
|
+
this._gridController.stopEdit();
|
|
178
|
+
}
|
|
166
179
|
observeConfig(config) {
|
|
167
180
|
this._gridController.setColumnsState(config === null || config === void 0 ? void 0 : config.columns);
|
|
168
181
|
}
|
|
@@ -188,6 +201,9 @@ export class EzGrid {
|
|
|
188
201
|
this.setSelection(this.dataUnit.getSelectionInfo());
|
|
189
202
|
}
|
|
190
203
|
}
|
|
204
|
+
async handleClick(event) {
|
|
205
|
+
this.checkStopEditOutsideClick(event);
|
|
206
|
+
}
|
|
191
207
|
setSelection(selectionInfo) {
|
|
192
208
|
var _a;
|
|
193
209
|
this._selectionCount = (_a = selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.length) !== null && _a !== void 0 ? _a : 0;
|
|
@@ -343,7 +359,7 @@ export class EzGrid {
|
|
|
343
359
|
resetPaginationState() {
|
|
344
360
|
var _a;
|
|
345
361
|
this._paginationChangedByKeyboard = false;
|
|
346
|
-
(_a = this.
|
|
362
|
+
(_a = this._gridController) === null || _a === void 0 ? void 0 : _a.resetPaginationState();
|
|
347
363
|
}
|
|
348
364
|
resolvePaginationClassMode() {
|
|
349
365
|
if (this.paginationCounterMode == 'show')
|
|
@@ -384,7 +400,8 @@ export class EzGrid {
|
|
|
384
400
|
if (this.dataUnit) {
|
|
385
401
|
this.setSelection(this.dataUnit.getSelectionInfo());
|
|
386
402
|
}
|
|
387
|
-
}
|
|
403
|
+
},
|
|
404
|
+
enableLockManger: this.enableLockManger
|
|
388
405
|
});
|
|
389
406
|
if (this.config) {
|
|
390
407
|
this.observeConfig(this.config);
|
|
@@ -456,8 +473,13 @@ export class EzGrid {
|
|
|
456
473
|
this._refPaginationLabelTooltip.removeAttribute('data-tooltip');
|
|
457
474
|
}
|
|
458
475
|
disconnectedCallback() {
|
|
459
|
-
var _a;
|
|
476
|
+
var _a, _b;
|
|
460
477
|
(_a = this._headerOverflowWatcher) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
478
|
+
(_b = this._gridController) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
479
|
+
}
|
|
480
|
+
connectedCallback() {
|
|
481
|
+
var _a;
|
|
482
|
+
(_a = this._gridController) === null || _a === void 0 ? void 0 : _a.registryListeners();
|
|
461
483
|
}
|
|
462
484
|
componentWillRender() {
|
|
463
485
|
this.configSelectionCounter();
|
|
@@ -778,6 +800,24 @@ export class EzGrid {
|
|
|
778
800
|
"attribute": "enable-continuous-insert",
|
|
779
801
|
"reflect": false,
|
|
780
802
|
"defaultValue": "true"
|
|
803
|
+
},
|
|
804
|
+
"enableLockManger": {
|
|
805
|
+
"type": "boolean",
|
|
806
|
+
"mutable": false,
|
|
807
|
+
"complexType": {
|
|
808
|
+
"original": "boolean",
|
|
809
|
+
"resolved": "boolean",
|
|
810
|
+
"references": {}
|
|
811
|
+
},
|
|
812
|
+
"required": false,
|
|
813
|
+
"optional": true,
|
|
814
|
+
"docs": {
|
|
815
|
+
"tags": [],
|
|
816
|
+
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
817
|
+
},
|
|
818
|
+
"attribute": "enable-lock-manger",
|
|
819
|
+
"reflect": false,
|
|
820
|
+
"defaultValue": "true"
|
|
781
821
|
}
|
|
782
822
|
};
|
|
783
823
|
}
|
|
@@ -1282,6 +1322,47 @@ export class EzGrid {
|
|
|
1282
1322
|
"text": "Atribui o foco para a grade.",
|
|
1283
1323
|
"tags": []
|
|
1284
1324
|
}
|
|
1325
|
+
},
|
|
1326
|
+
"stopEdit": {
|
|
1327
|
+
"complexType": {
|
|
1328
|
+
"signature": "() => Promise<void>",
|
|
1329
|
+
"parameters": [],
|
|
1330
|
+
"references": {
|
|
1331
|
+
"Promise": {
|
|
1332
|
+
"location": "global"
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
"return": "Promise<void>"
|
|
1336
|
+
},
|
|
1337
|
+
"docs": {
|
|
1338
|
+
"text": "Para a edi\u00E7\u00E3o da grade.",
|
|
1339
|
+
"tags": []
|
|
1340
|
+
}
|
|
1341
|
+
},
|
|
1342
|
+
"checkStopEditOutsideClick": {
|
|
1343
|
+
"complexType": {
|
|
1344
|
+
"signature": "(event: MouseEvent) => Promise<void>",
|
|
1345
|
+
"parameters": [{
|
|
1346
|
+
"tags": [],
|
|
1347
|
+
"text": ""
|
|
1348
|
+
}],
|
|
1349
|
+
"references": {
|
|
1350
|
+
"Promise": {
|
|
1351
|
+
"location": "global"
|
|
1352
|
+
},
|
|
1353
|
+
"MouseEvent": {
|
|
1354
|
+
"location": "global"
|
|
1355
|
+
},
|
|
1356
|
+
"Node": {
|
|
1357
|
+
"location": "global"
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
"return": "Promise<void>"
|
|
1361
|
+
},
|
|
1362
|
+
"docs": {
|
|
1363
|
+
"text": "",
|
|
1364
|
+
"tags": []
|
|
1365
|
+
}
|
|
1285
1366
|
}
|
|
1286
1367
|
};
|
|
1287
1368
|
}
|
|
@@ -1305,6 +1386,12 @@ export class EzGrid {
|
|
|
1305
1386
|
"target": undefined,
|
|
1306
1387
|
"capture": false,
|
|
1307
1388
|
"passive": false
|
|
1389
|
+
}, {
|
|
1390
|
+
"name": "click",
|
|
1391
|
+
"method": "handleClick",
|
|
1392
|
+
"target": undefined,
|
|
1393
|
+
"capture": true,
|
|
1394
|
+
"passive": false
|
|
1308
1395
|
}];
|
|
1309
1396
|
}
|
|
1310
1397
|
}
|