@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-68936.0 → 0.0.0-bugfix-dev-KB-69235.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/ez-chart.cjs.entry.js +2 -0
- package/dist/cjs/ez-form.cjs.entry.js +5 -1
- package/dist/cjs/ez-grid.cjs.entry.js +12 -117
- package/dist/cjs/ez-tabselector.cjs.entry.js +8 -2
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-chart/ez-chart.js +2 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +2 -40
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +5 -73
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +5 -1
- package/dist/collection/components/ez-grid/ez-grid.js +0 -21
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +34 -2
- package/dist/collection/utils/form/DataBinder.js +6 -2
- package/dist/custom-elements/index.js +29 -122
- package/dist/esm/ez-chart.entry.js +2 -0
- package/dist/esm/ez-form.entry.js +6 -2
- package/dist/esm/ez-grid.entry.js +12 -117
- package/dist/esm/ez-tabselector.entry.js +8 -2
- 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-569a0b9a.entry.js → p-044d46d5.entry.js} +1 -1
- package/dist/ezui/p-92748142.entry.js +1 -0
- package/dist/ezui/{p-ac426b69.entry.js → p-b150ccd3.entry.js} +1 -1
- package/dist/ezui/p-ee9315ff.entry.js +1 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +1 -13
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +1 -8
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +0 -17
- package/dist/types/components/ez-grid/ez-grid.d.ts +0 -4
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +2 -1
- package/dist/types/components.d.ts +1 -8
- package/dist/types/utils/form/DataBinder.d.ts +2 -0
- package/package.json +1 -1
- package/dist/ezui/p-439fbc78.entry.js +0 -1
- package/dist/ezui/p-c5a80844.entry.js +0 -1
|
@@ -2,67 +2,6 @@ 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
|
-
handleDataChanged(action) {
|
|
6
|
-
var _a, _b;
|
|
7
|
-
if (!this._options.enableGridInsert) {
|
|
8
|
-
this.handleRefresh(action);
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
this.updateGridRowNodes((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : []);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Nesse ponto, o registro já se encontra atualizado no DU,
|
|
15
|
-
* basta então passar seu valor para que a garde possa atualizar sua linha.
|
|
16
|
-
*/
|
|
17
|
-
updateGridRowNodes(recordIDList) {
|
|
18
|
-
const recordsToUpdate = recordIDList === null || recordIDList === void 0 ? void 0 : recordIDList.map(id => this.getRecordById(id));
|
|
19
|
-
this._controller.updateRows(recordsToUpdate);
|
|
20
|
-
}
|
|
21
|
-
getRecordById(recordId) {
|
|
22
|
-
return this._dataUnit.records.find(record => record['__record__id__'] === recordId);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Em caso de necessidade de reload (isWaitingToReload), eh preciso chamar o dataUnit.gotoPage, pois ele aplica tambem a ordenacao dos registros,
|
|
26
|
-
* enquanto que o _controller.refresh apenas recarrega os dados na ordem que atua.
|
|
27
|
-
*/
|
|
28
|
-
handleRefreshOrReload(action) {
|
|
29
|
-
if (this._dataUnit.isWaitingToReload()) {
|
|
30
|
-
this.handleReload();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
this.handleRefresh(action);
|
|
34
|
-
}
|
|
35
|
-
handleReload() {
|
|
36
|
-
this._dataUnit.setWaitingToReload(false);
|
|
37
|
-
this._dataUnit.gotoPage(0);
|
|
38
|
-
}
|
|
39
|
-
handleRefresh(action) {
|
|
40
|
-
if (this.isSilentChange(action)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this._controller.refresh();
|
|
44
|
-
}
|
|
45
|
-
handleRecordsAdded() {
|
|
46
|
-
if (this._options.enableGridInsert) {
|
|
47
|
-
this._controller.refresh();
|
|
48
|
-
this.focusOnNewRecord();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
focusOnNewRecord() {
|
|
52
|
-
/**
|
|
53
|
-
* O SetTimeout eh utilizado pois é preciso aguardar que o novo registro seja renderizado na grade.
|
|
54
|
-
* Tentamos utilizar a api da grade para adicionar um event listener, porém na versão que utilizamos, não existe
|
|
55
|
-
* algo que resolva nosso cenário.
|
|
56
|
-
*
|
|
57
|
-
* Sugiro no futuro utilizar algo como o applyServerSideTransaction, porém será preciso lidar com os handlers
|
|
58
|
-
* e callbacks implementados no AgGridController e GridEditionManager.
|
|
59
|
-
*/
|
|
60
|
-
setTimeout(() => {
|
|
61
|
-
var _a;
|
|
62
|
-
const newRowIndex = ((_a = this._dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) - 1;
|
|
63
|
-
this._controller.startEditionOnRowByIndex(newRowIndex);
|
|
64
|
-
}, 500);
|
|
65
|
-
}
|
|
66
5
|
updateLoadedRecords(action) {
|
|
67
6
|
const records = action.payload;
|
|
68
7
|
if ((records === null || records === void 0 ? void 0 : records.length) > 0) {
|
|
@@ -114,19 +53,15 @@ export default class DataSource {
|
|
|
114
53
|
this._options.onPaginationUpdate(this._dataUnit.getPaginationInfo());
|
|
115
54
|
}
|
|
116
55
|
break;
|
|
117
|
-
case Action.
|
|
118
|
-
this.handleRecordsAdded();
|
|
119
|
-
break;
|
|
56
|
+
case Action.RECORDS_REMOVED:
|
|
120
57
|
case Action.DATA_SAVED:
|
|
121
58
|
case Action.EDITION_CANCELED:
|
|
122
|
-
this.handleRefreshOrReload(action);
|
|
123
|
-
break;
|
|
124
59
|
case Action.DATA_CHANGED:
|
|
125
60
|
case Action.DATA_RESOLVED:
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
this.
|
|
61
|
+
if (this.isSilentChange(action)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this._controller.refresh();
|
|
130
65
|
break;
|
|
131
66
|
case Action.SELECTION_CHANGED:
|
|
132
67
|
case Action.NEXT_SELECTED:
|
|
@@ -157,9 +92,6 @@ export default class DataSource {
|
|
|
157
92
|
setAutoFocus(autoFocus) {
|
|
158
93
|
this._options.autoFocus = autoFocus;
|
|
159
94
|
}
|
|
160
|
-
setEnableGridInsert(enable) {
|
|
161
|
-
this._options.enableGridInsert = enable;
|
|
162
|
-
}
|
|
163
95
|
getRows(params) {
|
|
164
96
|
if (this.needReload(params)) {
|
|
165
97
|
this._lastLoadingParams = params;
|
|
@@ -33,7 +33,7 @@ export default class GridEditionManager {
|
|
|
33
33
|
this.saveSuccess();
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
if (!this._isGridEdition) {
|
|
36
|
+
if (!this._isGridEdition || this._dataUnit.hasNewRecord()) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
const currentRercord = this._dataUnit.getSelectedRecord();
|
|
@@ -115,7 +115,11 @@ export default class GridEditionManager {
|
|
|
115
115
|
}).map(c => c.getColId());
|
|
116
116
|
}
|
|
117
117
|
saveSuccess() {
|
|
118
|
+
var _a;
|
|
118
119
|
this.focusOnCell(this._targetEditionCell);
|
|
120
|
+
if (((_a = this._targetEditionCell) === null || _a === void 0 ? void 0 : _a.rowIndex) !== undefined) {
|
|
121
|
+
this._dataUnit.setSelectionByIndex([this._targetEditionCell.rowIndex]);
|
|
122
|
+
}
|
|
119
123
|
this._lastCellEdited = undefined;
|
|
120
124
|
this._targetEditionCell = undefined;
|
|
121
125
|
this._isGridEdition = false;
|
|
@@ -36,7 +36,6 @@ export class EzGrid {
|
|
|
36
36
|
this.recordsValidator = undefined;
|
|
37
37
|
this.canEdit = true;
|
|
38
38
|
this.autoFocus = true;
|
|
39
|
-
this.enableGridInsert = false;
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
42
41
|
* Aplica a definição de colunas.
|
|
@@ -363,7 +362,6 @@ export class EzGrid {
|
|
|
363
362
|
editionIsDisabled: () => !this.canEdit,
|
|
364
363
|
customFormatters: this._customFormatters,
|
|
365
364
|
autoFocus: this.autoFocus,
|
|
366
|
-
enableGridInsert: this.enableGridInsert,
|
|
367
365
|
onRefresh: () => {
|
|
368
366
|
if (this.dataUnit) {
|
|
369
367
|
this.setSelection(this.dataUnit.getSelectionInfo());
|
|
@@ -456,7 +454,6 @@ export class EzGrid {
|
|
|
456
454
|
}
|
|
457
455
|
componentDidUpdate() {
|
|
458
456
|
this._gridController.setAutoFocus(this.autoFocus);
|
|
459
|
-
this._gridController.setEnableGridInsert(this.enableGridInsert);
|
|
460
457
|
}
|
|
461
458
|
getDataSource() {
|
|
462
459
|
var _a;
|
|
@@ -697,24 +694,6 @@ export class EzGrid {
|
|
|
697
694
|
"attribute": "auto-focus",
|
|
698
695
|
"reflect": false,
|
|
699
696
|
"defaultValue": "true"
|
|
700
|
-
},
|
|
701
|
-
"enableGridInsert": {
|
|
702
|
-
"type": "boolean",
|
|
703
|
-
"mutable": false,
|
|
704
|
-
"complexType": {
|
|
705
|
-
"original": "boolean",
|
|
706
|
-
"resolved": "boolean",
|
|
707
|
-
"references": {}
|
|
708
|
-
},
|
|
709
|
-
"required": false,
|
|
710
|
-
"optional": true,
|
|
711
|
-
"docs": {
|
|
712
|
-
"tags": [],
|
|
713
|
-
"text": "Ativa inser\u00E7\u00E3o de registros no modo grade."
|
|
714
|
-
},
|
|
715
|
-
"attribute": "enable-grid-insert",
|
|
716
|
-
"reflect": false,
|
|
717
|
-
"defaultValue": "false"
|
|
718
697
|
}
|
|
719
698
|
};
|
|
720
699
|
}
|
|
@@ -67,11 +67,17 @@ export class EzTabselector {
|
|
|
67
67
|
this.processesTabs();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
async goToTab(tabIndex, silent = false) {
|
|
71
|
+
const tab = this._processedTabs.find(tab => tab.index === tabIndex);
|
|
72
|
+
this.handleTabClick(tab, !silent);
|
|
73
|
+
}
|
|
74
|
+
handleTabClick(tab, emitChange = true) {
|
|
71
75
|
this.selectedIndex = tab.index;
|
|
72
76
|
this._focusedIndex = undefined;
|
|
73
77
|
this.selectedTab = tab.tabKey;
|
|
74
|
-
|
|
78
|
+
if (emitChange) {
|
|
79
|
+
this.ezChange.emit(tab);
|
|
80
|
+
}
|
|
75
81
|
this.setFocusedBtn(false, tab.index);
|
|
76
82
|
}
|
|
77
83
|
componentWillLoad() {
|
|
@@ -316,6 +322,32 @@ export class EzTabselector {
|
|
|
316
322
|
}
|
|
317
323
|
}];
|
|
318
324
|
}
|
|
325
|
+
static get methods() {
|
|
326
|
+
return {
|
|
327
|
+
"goToTab": {
|
|
328
|
+
"complexType": {
|
|
329
|
+
"signature": "(tabIndex: number, silent?: boolean) => Promise<void>",
|
|
330
|
+
"parameters": [{
|
|
331
|
+
"tags": [],
|
|
332
|
+
"text": ""
|
|
333
|
+
}, {
|
|
334
|
+
"tags": [],
|
|
335
|
+
"text": ""
|
|
336
|
+
}],
|
|
337
|
+
"references": {
|
|
338
|
+
"Promise": {
|
|
339
|
+
"location": "global"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"return": "Promise<void>"
|
|
343
|
+
},
|
|
344
|
+
"docs": {
|
|
345
|
+
"text": "",
|
|
346
|
+
"tags": []
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
}
|
|
319
351
|
static get elementRef() { return "_hostElem"; }
|
|
320
352
|
static get watchers() {
|
|
321
353
|
return [{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationContext, Action, WaitingChangeException, DataUnitAction } from "@sankhyalabs/core";
|
|
1
|
+
import { ApplicationContext, Action, WaitingChangeException, DataUnitAction, StringUtils } from "@sankhyalabs/core";
|
|
2
2
|
import { RecordValidationProcessor } from "../validators/recordvalidator/RecordValidationProcessor";
|
|
3
3
|
export default class DataBinder {
|
|
4
4
|
constructor(dataUnit) {
|
|
@@ -30,6 +30,7 @@ export default class DataBinder {
|
|
|
30
30
|
break;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
+
this._uuid = StringUtils.generateUUID();
|
|
33
34
|
this._fields = new Map();
|
|
34
35
|
this._dataUnit = dataUnit;
|
|
35
36
|
this.applyDefaultValues();
|
|
@@ -37,6 +38,9 @@ export default class DataBinder {
|
|
|
37
38
|
this._dataUnit.addInterceptor(this);
|
|
38
39
|
this.setContextDataBinder(dataUnit);
|
|
39
40
|
}
|
|
41
|
+
get dataBinderId() {
|
|
42
|
+
return this._uuid;
|
|
43
|
+
}
|
|
40
44
|
setContextDataBinder(dataUnit) {
|
|
41
45
|
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
42
46
|
const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
|
|
@@ -71,7 +75,7 @@ export default class DataBinder {
|
|
|
71
75
|
disconnectDataUnit() {
|
|
72
76
|
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
73
77
|
const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
|
|
74
|
-
const dataBindersFiltered = dataBinders.filter((dataBinder) =>
|
|
78
|
+
const dataBindersFiltered = dataBinders.filter((dataBinder) => dataBinder.dataBinderId !== this.dataBinderId);
|
|
75
79
|
dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
|
|
76
80
|
ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
|
|
77
81
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLElement as HTMLElement$1, createEvent, h, Host, forceUpdate, Fragment, proxyCustomElement } from '@stencil/core/internal/client';
|
|
2
2
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
3
|
-
import { UserInterface, DateUtils as DateUtils$1, Action, ApplicationContext, WaitingChangeException, DataUnitAction, FloatingManager, ElementIDUtils, ObjectUtils as ObjectUtils$1, JSUtils,
|
|
3
|
+
import { UserInterface, DateUtils as DateUtils$1, Action, StringUtils as StringUtils$1, ApplicationContext, WaitingChangeException, DataUnitAction, FloatingManager, ElementIDUtils, ObjectUtils as ObjectUtils$1, JSUtils, HTMLBuilder, TimeFormatter, DataUnit, NumberUtils as NumberUtils$1, MaskFormatter, DataType, SortMode, FieldComparator, ArrayUtils as ArrayUtils$1, OverflowWatcher, OVERFLOWED_CLASS_NAME, KeyboardManager } from '@sankhyalabs/core';
|
|
4
4
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
5
5
|
|
|
6
6
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
@@ -611,6 +611,7 @@ class DataBinder {
|
|
|
611
611
|
break;
|
|
612
612
|
}
|
|
613
613
|
};
|
|
614
|
+
this._uuid = StringUtils$1.generateUUID();
|
|
614
615
|
this._fields = new Map();
|
|
615
616
|
this._dataUnit = dataUnit;
|
|
616
617
|
this.applyDefaultValues();
|
|
@@ -618,6 +619,9 @@ class DataBinder {
|
|
|
618
619
|
this._dataUnit.addInterceptor(this);
|
|
619
620
|
this.setContextDataBinder(dataUnit);
|
|
620
621
|
}
|
|
622
|
+
get dataBinderId() {
|
|
623
|
+
return this._uuid;
|
|
624
|
+
}
|
|
621
625
|
setContextDataBinder(dataUnit) {
|
|
622
626
|
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
623
627
|
const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
|
|
@@ -652,7 +656,7 @@ class DataBinder {
|
|
|
652
656
|
disconnectDataUnit() {
|
|
653
657
|
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
654
658
|
const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
|
|
655
|
-
const dataBindersFiltered = dataBinders.filter((dataBinder) =>
|
|
659
|
+
const dataBindersFiltered = dataBinders.filter((dataBinder) => dataBinder.dataBinderId !== this.dataBinderId);
|
|
656
660
|
dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
|
|
657
661
|
ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
|
|
658
662
|
}
|
|
@@ -2491,6 +2495,8 @@ const EzChart$1 = class extends HTMLElement$1 {
|
|
|
2491
2495
|
subTitle: this.chartSubTitle,
|
|
2492
2496
|
legendEnabled: this.legendEnabled,
|
|
2493
2497
|
onClickSerie: this.ezSerieClick,
|
|
2498
|
+
width: this.width,
|
|
2499
|
+
height: this.height,
|
|
2494
2500
|
});
|
|
2495
2501
|
}
|
|
2496
2502
|
componentWillLoad() {
|
|
@@ -124422,67 +124428,6 @@ class DataSourceInterceptor {
|
|
|
124422
124428
|
}
|
|
124423
124429
|
|
|
124424
124430
|
class DataSource {
|
|
124425
|
-
handleDataChanged(action) {
|
|
124426
|
-
var _a, _b;
|
|
124427
|
-
if (!this._options.enableGridInsert) {
|
|
124428
|
-
this.handleRefresh(action);
|
|
124429
|
-
return;
|
|
124430
|
-
}
|
|
124431
|
-
this.updateGridRowNodes((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : []);
|
|
124432
|
-
}
|
|
124433
|
-
/**
|
|
124434
|
-
* Nesse ponto, o registro já se encontra atualizado no DU,
|
|
124435
|
-
* basta então passar seu valor para que a garde possa atualizar sua linha.
|
|
124436
|
-
*/
|
|
124437
|
-
updateGridRowNodes(recordIDList) {
|
|
124438
|
-
const recordsToUpdate = recordIDList === null || recordIDList === void 0 ? void 0 : recordIDList.map(id => this.getRecordById(id));
|
|
124439
|
-
this._controller.updateRows(recordsToUpdate);
|
|
124440
|
-
}
|
|
124441
|
-
getRecordById(recordId) {
|
|
124442
|
-
return this._dataUnit.records.find(record => record['__record__id__'] === recordId);
|
|
124443
|
-
}
|
|
124444
|
-
/**
|
|
124445
|
-
* Em caso de necessidade de reload (isWaitingToReload), eh preciso chamar o dataUnit.gotoPage, pois ele aplica tambem a ordenacao dos registros,
|
|
124446
|
-
* enquanto que o _controller.refresh apenas recarrega os dados na ordem que atua.
|
|
124447
|
-
*/
|
|
124448
|
-
handleRefreshOrReload(action) {
|
|
124449
|
-
if (this._dataUnit.isWaitingToReload()) {
|
|
124450
|
-
this.handleReload();
|
|
124451
|
-
return;
|
|
124452
|
-
}
|
|
124453
|
-
this.handleRefresh(action);
|
|
124454
|
-
}
|
|
124455
|
-
handleReload() {
|
|
124456
|
-
this._dataUnit.setWaitingToReload(false);
|
|
124457
|
-
this._dataUnit.gotoPage(0);
|
|
124458
|
-
}
|
|
124459
|
-
handleRefresh(action) {
|
|
124460
|
-
if (this.isSilentChange(action)) {
|
|
124461
|
-
return;
|
|
124462
|
-
}
|
|
124463
|
-
this._controller.refresh();
|
|
124464
|
-
}
|
|
124465
|
-
handleRecordsAdded() {
|
|
124466
|
-
if (this._options.enableGridInsert) {
|
|
124467
|
-
this._controller.refresh();
|
|
124468
|
-
this.focusOnNewRecord();
|
|
124469
|
-
}
|
|
124470
|
-
}
|
|
124471
|
-
focusOnNewRecord() {
|
|
124472
|
-
/**
|
|
124473
|
-
* O SetTimeout eh utilizado pois é preciso aguardar que o novo registro seja renderizado na grade.
|
|
124474
|
-
* Tentamos utilizar a api da grade para adicionar um event listener, porém na versão que utilizamos, não existe
|
|
124475
|
-
* algo que resolva nosso cenário.
|
|
124476
|
-
*
|
|
124477
|
-
* Sugiro no futuro utilizar algo como o applyServerSideTransaction, porém será preciso lidar com os handlers
|
|
124478
|
-
* e callbacks implementados no AgGridController e GridEditionManager.
|
|
124479
|
-
*/
|
|
124480
|
-
setTimeout(() => {
|
|
124481
|
-
var _a;
|
|
124482
|
-
const newRowIndex = ((_a = this._dataUnit.records) === null || _a === void 0 ? void 0 : _a.length) - 1;
|
|
124483
|
-
this._controller.startEditionOnRowByIndex(newRowIndex);
|
|
124484
|
-
}, 500);
|
|
124485
|
-
}
|
|
124486
124431
|
updateLoadedRecords(action) {
|
|
124487
124432
|
const records = action.payload;
|
|
124488
124433
|
if ((records === null || records === void 0 ? void 0 : records.length) > 0) {
|
|
@@ -124534,19 +124479,15 @@ class DataSource {
|
|
|
124534
124479
|
this._options.onPaginationUpdate(this._dataUnit.getPaginationInfo());
|
|
124535
124480
|
}
|
|
124536
124481
|
break;
|
|
124537
|
-
case Action.
|
|
124538
|
-
this.handleRecordsAdded();
|
|
124539
|
-
break;
|
|
124482
|
+
case Action.RECORDS_REMOVED:
|
|
124540
124483
|
case Action.DATA_SAVED:
|
|
124541
124484
|
case Action.EDITION_CANCELED:
|
|
124542
|
-
this.handleRefreshOrReload(action);
|
|
124543
|
-
break;
|
|
124544
124485
|
case Action.DATA_CHANGED:
|
|
124545
124486
|
case Action.DATA_RESOLVED:
|
|
124546
|
-
this.
|
|
124547
|
-
|
|
124548
|
-
|
|
124549
|
-
this.
|
|
124487
|
+
if (this.isSilentChange(action)) {
|
|
124488
|
+
return;
|
|
124489
|
+
}
|
|
124490
|
+
this._controller.refresh();
|
|
124550
124491
|
break;
|
|
124551
124492
|
case Action.SELECTION_CHANGED:
|
|
124552
124493
|
case Action.NEXT_SELECTED:
|
|
@@ -124577,9 +124518,6 @@ class DataSource {
|
|
|
124577
124518
|
setAutoFocus(autoFocus) {
|
|
124578
124519
|
this._options.autoFocus = autoFocus;
|
|
124579
124520
|
}
|
|
124580
|
-
setEnableGridInsert(enable) {
|
|
124581
|
-
this._options.enableGridInsert = enable;
|
|
124582
|
-
}
|
|
124583
124521
|
getRows(params) {
|
|
124584
124522
|
if (this.needReload(params)) {
|
|
124585
124523
|
this._lastLoadingParams = params;
|
|
@@ -125261,7 +125199,7 @@ class GridEditionManager {
|
|
|
125261
125199
|
this.saveSuccess();
|
|
125262
125200
|
return;
|
|
125263
125201
|
}
|
|
125264
|
-
if (!this._isGridEdition) {
|
|
125202
|
+
if (!this._isGridEdition || this._dataUnit.hasNewRecord()) {
|
|
125265
125203
|
return;
|
|
125266
125204
|
}
|
|
125267
125205
|
const currentRercord = this._dataUnit.getSelectedRecord();
|
|
@@ -125343,7 +125281,11 @@ class GridEditionManager {
|
|
|
125343
125281
|
}).map(c => c.getColId());
|
|
125344
125282
|
}
|
|
125345
125283
|
saveSuccess() {
|
|
125284
|
+
var _a;
|
|
125346
125285
|
this.focusOnCell(this._targetEditionCell);
|
|
125286
|
+
if (((_a = this._targetEditionCell) === null || _a === void 0 ? void 0 : _a.rowIndex) !== undefined) {
|
|
125287
|
+
this._dataUnit.setSelectionByIndex([this._targetEditionCell.rowIndex]);
|
|
125288
|
+
}
|
|
125347
125289
|
this._lastCellEdited = undefined;
|
|
125348
125290
|
this._targetEditionCell = undefined;
|
|
125349
125291
|
this._isGridEdition = false;
|
|
@@ -125862,15 +125804,10 @@ class AgGridController {
|
|
|
125862
125804
|
throw new Error('Erro interno: Grid ainda não inicializado.');
|
|
125863
125805
|
}
|
|
125864
125806
|
}
|
|
125865
|
-
updateRows(
|
|
125807
|
+
updateRows() {
|
|
125866
125808
|
if (this._grid === undefined) {
|
|
125867
125809
|
throw new Error('Erro interno: Grid ainda não inicializado.');
|
|
125868
125810
|
}
|
|
125869
|
-
rows === null || rows === void 0 ? void 0 : rows.forEach(row => this.updateRowData(row));
|
|
125870
|
-
}
|
|
125871
|
-
updateRowData(row) {
|
|
125872
|
-
const node = this._gridOptions.api.getRowNode(row[this._idAttribName]);
|
|
125873
|
-
node.setData(Object.assign({}, row));
|
|
125874
125811
|
}
|
|
125875
125812
|
selectAll(quietly = false) {
|
|
125876
125813
|
try {
|
|
@@ -125979,10 +125916,6 @@ class AgGridController {
|
|
|
125979
125916
|
var _a;
|
|
125980
125917
|
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.setAutoFocus(autoFocus);
|
|
125981
125918
|
}
|
|
125982
|
-
setEnableGridInsert(enable) {
|
|
125983
|
-
var _a;
|
|
125984
|
-
(_a = this._dataSource) === null || _a === void 0 ? void 0 : _a.setEnableGridInsert(enable);
|
|
125985
|
-
}
|
|
125986
125919
|
setFocusFirstRow() {
|
|
125987
125920
|
const firstRow = this._gridOptions.api.getDisplayedRowAtIndex(0);
|
|
125988
125921
|
if (firstRow) {
|
|
@@ -125998,38 +125931,9 @@ class AgGridController {
|
|
|
125998
125931
|
this.setFocusOnRow(lastRow.rowIndex);
|
|
125999
125932
|
}
|
|
126000
125933
|
}
|
|
126001
|
-
startEditionOnRowByIndex(rowIndex) {
|
|
126002
|
-
const firstCol = this.getFirstEditableColl(rowIndex);
|
|
126003
|
-
this.focusByCollAndRow(firstCol, rowIndex);
|
|
126004
|
-
this.startEdition(rowIndex, firstCol);
|
|
126005
|
-
}
|
|
126006
|
-
startEdition(rowIndex, firstCol) {
|
|
126007
|
-
this._gridOptions.api.clearRangeSelection();
|
|
126008
|
-
this._gridOptions.api.addCellRange({ rowStartIndex: rowIndex, rowEndIndex: rowIndex, columns: [firstCol] });
|
|
126009
|
-
this._gridOptions.api.setFocusedCell(rowIndex, firstCol);
|
|
126010
|
-
this._gridOptions.api.startEditingCell({ rowIndex, colKey: firstCol });
|
|
126011
|
-
const cellEditor = this._gridOptions.api.getCellEditorInstances()[0];
|
|
126012
|
-
if (cellEditor) {
|
|
126013
|
-
cellEditor.focusIn();
|
|
126014
|
-
}
|
|
126015
|
-
}
|
|
126016
|
-
getFirstEditableColl(rowIndex) {
|
|
126017
|
-
const displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
|
|
126018
|
-
return displayedColumns.find(column => this.isColumnEditable(rowIndex, column));
|
|
126019
|
-
}
|
|
126020
|
-
isColumnEditable(rowIndex, column) {
|
|
126021
|
-
if (column.getColDef().headerName === '')
|
|
126022
|
-
return false;
|
|
126023
|
-
const rowId = this._dataUnit.records[rowIndex][this._idAttribName];
|
|
126024
|
-
const rowNode = this._gridOptions.api.getRowNode(rowId);
|
|
126025
|
-
return column.isCellEditable(rowNode);
|
|
126026
|
-
}
|
|
126027
125934
|
setFocusOnRow(rowIndex) {
|
|
126028
125935
|
let displayedColumns = this._gridOptions.columnApi.getAllDisplayedColumns();
|
|
126029
|
-
let
|
|
126030
|
-
this.focusByCollAndRow(firstColl, rowIndex);
|
|
126031
|
-
}
|
|
126032
|
-
focusByCollAndRow(firstCell, rowIndex) {
|
|
125936
|
+
let firstCell = displayedColumns.find(column => column.getColDef().headerName !== '');
|
|
126033
125937
|
this._gridOptions.api.ensureColumnVisible(firstCell);
|
|
126034
125938
|
this._gridOptions.api.ensureIndexVisible(rowIndex);
|
|
126035
125939
|
this._gridOptions.api.setFocusedCell(rowIndex, firstCell);
|
|
@@ -126656,7 +126560,6 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
126656
126560
|
this.recordsValidator = undefined;
|
|
126657
126561
|
this.canEdit = true;
|
|
126658
126562
|
this.autoFocus = true;
|
|
126659
|
-
this.enableGridInsert = false;
|
|
126660
126563
|
}
|
|
126661
126564
|
/**
|
|
126662
126565
|
* Aplica a definição de colunas.
|
|
@@ -126983,7 +126886,6 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
126983
126886
|
editionIsDisabled: () => !this.canEdit,
|
|
126984
126887
|
customFormatters: this._customFormatters,
|
|
126985
126888
|
autoFocus: this.autoFocus,
|
|
126986
|
-
enableGridInsert: this.enableGridInsert,
|
|
126987
126889
|
onRefresh: () => {
|
|
126988
126890
|
if (this.dataUnit) {
|
|
126989
126891
|
this.setSelection(this.dataUnit.getSelectionInfo());
|
|
@@ -127076,7 +126978,6 @@ const EzGrid$1 = class extends HTMLElement$1 {
|
|
|
127076
126978
|
}
|
|
127077
126979
|
componentDidUpdate() {
|
|
127078
126980
|
this._gridController.setAutoFocus(this.autoFocus);
|
|
127079
|
-
this._gridController.setEnableGridInsert(this.enableGridInsert);
|
|
127080
126981
|
}
|
|
127081
126982
|
getDataSource() {
|
|
127082
126983
|
var _a;
|
|
@@ -130722,11 +130623,17 @@ const EzTabselector$1 = class extends HTMLElement$1 {
|
|
|
130722
130623
|
this.processesTabs();
|
|
130723
130624
|
}
|
|
130724
130625
|
}
|
|
130725
|
-
|
|
130626
|
+
async goToTab(tabIndex, silent = false) {
|
|
130627
|
+
const tab = this._processedTabs.find(tab => tab.index === tabIndex);
|
|
130628
|
+
this.handleTabClick(tab, !silent);
|
|
130629
|
+
}
|
|
130630
|
+
handleTabClick(tab, emitChange = true) {
|
|
130726
130631
|
this.selectedIndex = tab.index;
|
|
130727
130632
|
this._focusedIndex = undefined;
|
|
130728
130633
|
this.selectedTab = tab.tabKey;
|
|
130729
|
-
|
|
130634
|
+
if (emitChange) {
|
|
130635
|
+
this.ezChange.emit(tab);
|
|
130636
|
+
}
|
|
130730
130637
|
this.setFocusedBtn(false, tab.index);
|
|
130731
130638
|
}
|
|
130732
130639
|
componentWillLoad() {
|
|
@@ -132902,7 +132809,7 @@ const EzFileItem = /*@__PURE__*/proxyCustomElement(EzFileItem$1, [1,"ez-file-ite
|
|
|
132902
132809
|
const EzFilterInput = /*@__PURE__*/proxyCustomElement(EzFilterInput$1, [1,"ez-filter-input",{"label":[1],"value":[1537],"enabled":[4],"errorMessage":[1537,"error-message"],"restrict":[1],"mode":[513],"asyncSearch":[516,"async-search"],"canShowError":[516,"can-show-error"]}]);
|
|
132903
132810
|
const EzForm = /*@__PURE__*/proxyCustomElement(EzForm$1, [2,"ez-form",{"dataUnit":[1040],"config":[16],"recordsValidator":[16],"fieldToFocus":[1,"field-to-focus"],"onlyStaticFields":[4,"only-static-fields"],"_fieldsProps":[32]}]);
|
|
132904
132811
|
const EzFormView = /*@__PURE__*/proxyCustomElement(EzFormView$1, [2,"ez-form-view",{"fields":[16],"selectedRecord":[16],"_customEditors":[32]}]);
|
|
132905
|
-
const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"selectionToastConfig":[16],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"columnfilterDataSource":[16],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"autoFocus":[4,"auto-focus"],"
|
|
132812
|
+
const EzGrid = /*@__PURE__*/proxyCustomElement(EzGrid$1, [6,"ez-grid",{"multipleSelection":[4,"multiple-selection"],"config":[1040],"selectionToastConfig":[16],"serverUrl":[1,"server-url"],"dataUnit":[16],"statusResolver":[16],"columnfilterDataSource":[16],"useEnterLikeTab":[4,"use-enter-like-tab"],"recordsValidator":[16],"canEdit":[4,"can-edit"],"autoFocus":[4,"auto-focus"],"_paginationInfo":[32],"_paginationChangedByKeyboard":[32],"_showSelectionCounter":[32],"_isAllSelection":[32],"_currentPageSelected":[32],"_selectionCount":[32],"_hasLeftButtons":[32],"_customFormatters":[32]},[[0,"ezSelectionChange","onSelectionChange"]]]);
|
|
132906
132813
|
const EzGuideNavigator = /*@__PURE__*/proxyCustomElement(EzGuideNavigator$1, [1,"ez-guide-navigator",{"open":[1540],"selectedId":[1537,"selected-id"],"items":[16],"tooltipResolver":[16],"filterText":[32]}]);
|
|
132907
132814
|
const EzIcon = /*@__PURE__*/proxyCustomElement(EzIcon$1, [1,"ez-icon",{"size":[513],"href":[513],"iconName":[513,"icon-name"]}]);
|
|
132908
132815
|
const EzList = /*@__PURE__*/proxyCustomElement(EzList$1, [1,"ez-list",{"dataSource":[1040],"listMode":[1,"list-mode"],"useGroups":[1540,"use-groups"],"ezDraggable":[1028,"ez-draggable"],"ezSelectable":[1028,"ez-selectable"],"itemSlotBuilder":[1040],"itemLeftSlotBuilder":[1040],"hoverFeedback":[1028,"hover-feedback"],"_listItems":[32],"_listGroupItems":[32]}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, f as forceUpdate, H as Host, g as getElement } from './index-5a720e56.js';
|
|
2
|
-
import { DateUtils, Action, ApplicationContext, WaitingChangeException, DataUnitAction,
|
|
2
|
+
import { DateUtils, Action, StringUtils, ApplicationContext, WaitingChangeException, DataUnitAction, DataUnit, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { b as buildFieldMetadata, R as RecordValidationProcessor } from './RecordValidationProcessor-b00b8b77.js';
|
|
4
4
|
import './ApplicationUtils-eaf91331.js';
|
|
5
5
|
import './DialogType-54a62731.js';
|
|
@@ -209,6 +209,7 @@ class DataBinder {
|
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
|
+
this._uuid = StringUtils.generateUUID();
|
|
212
213
|
this._fields = new Map();
|
|
213
214
|
this._dataUnit = dataUnit;
|
|
214
215
|
this.applyDefaultValues();
|
|
@@ -216,6 +217,9 @@ class DataBinder {
|
|
|
216
217
|
this._dataUnit.addInterceptor(this);
|
|
217
218
|
this.setContextDataBinder(dataUnit);
|
|
218
219
|
}
|
|
220
|
+
get dataBinderId() {
|
|
221
|
+
return this._uuid;
|
|
222
|
+
}
|
|
219
223
|
setContextDataBinder(dataUnit) {
|
|
220
224
|
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
221
225
|
const dataBinders = [...(dataBindersByDataUnit.get(dataUnit.dataUnitId) || []), this];
|
|
@@ -250,7 +254,7 @@ class DataBinder {
|
|
|
250
254
|
disconnectDataUnit() {
|
|
251
255
|
const dataBindersByDataUnit = ApplicationContext.getContextValue("__DATABINDER_BY_DATAUNIT__") || new Map();
|
|
252
256
|
const dataBinders = dataBindersByDataUnit.get(this._dataUnit.dataUnitId);
|
|
253
|
-
const dataBindersFiltered = dataBinders.filter((dataBinder) =>
|
|
257
|
+
const dataBindersFiltered = dataBinders.filter((dataBinder) => dataBinder.dataBinderId !== this.dataBinderId);
|
|
254
258
|
dataBindersByDataUnit.set(this._dataUnit.dataUnitId, dataBindersFiltered);
|
|
255
259
|
ApplicationContext.setContextValue("__DATABINDER_BY_DATAUNIT__", dataBindersByDataUnit);
|
|
256
260
|
}
|