@sankhyalabs/ezui 1.1.155 → 1.1.157-beta.2
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-grid.cjs.entry.js +20 -31
- package/dist/cjs/ez-number-input.cjs.entry.js +5 -1
- package/dist/cjs/grid-config.cjs.entry.js +3 -1
- package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +1 -15
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +6 -15
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +13 -1
- package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +3 -1
- package/dist/collection/components/ez-number-input/ez-number-input.js +5 -1
- package/dist/custom-elements/index.js +28 -33
- package/dist/esm/ez-grid.entry.js +20 -31
- package/dist/esm/ez-number-input.entry.js +5 -1
- package/dist/esm/grid-config.entry.js +3 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-91377c65.entry.js +1 -0
- package/dist/ezui/{p-addedd7d.entry.js → p-be87ac5e.entry.js} +1 -1
- package/dist/ezui/p-bea6f8a6.entry.js +1 -0
- package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +0 -1
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -2
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +3 -0
- package/dist/types/components/ez-grid/subcomponents/gridconfig/grid-config.d.ts +1 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +1 -1
- package/package.json +1 -1
- package/dist/ezui/p-24e98dc1.entry.js +0 -1
- package/dist/ezui/p-905688e6.entry.js +0 -1
|
@@ -110049,7 +110049,16 @@ class DataSource {
|
|
|
110049
110049
|
loadData(page) {
|
|
110050
110050
|
return new Promise((resolve, reject) => {
|
|
110051
110051
|
if (this._dataUnit) {
|
|
110052
|
-
|
|
110052
|
+
if (this._localRefresh && this._lastPageResponse) {
|
|
110053
|
+
resolve({ rowCount: (this._lastPageResponse.rowCount + Math.max((this._dataUnit.records.length - this._lastPageResponse.rowData.length), 0)), rowData: this._dataUnit.records });
|
|
110054
|
+
this._localRefresh = false;
|
|
110055
|
+
}
|
|
110056
|
+
else {
|
|
110057
|
+
this._dataUnit.loadData(page).then(pageRes => {
|
|
110058
|
+
this._lastPageResponse = { rowData: this._dataUnit.records, rowCount: pageRes ? pageRes.total : 0 };
|
|
110059
|
+
resolve(this._lastPageResponse);
|
|
110060
|
+
});
|
|
110061
|
+
}
|
|
110053
110062
|
}
|
|
110054
110063
|
else {
|
|
110055
110064
|
fetch(this._serverURL)
|
|
@@ -110063,6 +110072,9 @@ class DataSource {
|
|
|
110063
110072
|
setQuickFilter(term, fields) {
|
|
110064
110073
|
this._quickFilter = { term, fields };
|
|
110065
110074
|
}
|
|
110075
|
+
setLocalRefresh(localREfresh) {
|
|
110076
|
+
this._localRefresh = localREfresh;
|
|
110077
|
+
}
|
|
110066
110078
|
}
|
|
110067
110079
|
|
|
110068
110080
|
class AgGridController {
|
|
@@ -110179,28 +110191,19 @@ class AgGridController {
|
|
|
110179
110191
|
}
|
|
110180
110192
|
this._gridOptions.api.setRowData(data);
|
|
110181
110193
|
}
|
|
110182
|
-
addRows(
|
|
110194
|
+
addRows() {
|
|
110183
110195
|
if (this._grid === undefined) {
|
|
110184
110196
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
110185
110197
|
}
|
|
110186
|
-
|
|
110187
|
-
|
|
110188
|
-
addIndex: 0,
|
|
110189
|
-
add: rows
|
|
110190
|
-
});
|
|
110191
|
-
this.syncSelection();
|
|
110192
|
-
}
|
|
110198
|
+
this._dataSource.setLocalRefresh(true);
|
|
110199
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
110193
110200
|
}
|
|
110194
|
-
updateRows(
|
|
110201
|
+
updateRows() {
|
|
110195
110202
|
if (this._grid === undefined) {
|
|
110196
110203
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
110197
110204
|
}
|
|
110198
|
-
|
|
110199
|
-
|
|
110200
|
-
this.changeValues(row, [row[this._idAttribName]]);
|
|
110201
|
-
});
|
|
110202
|
-
this.syncSelection();
|
|
110203
|
-
}
|
|
110205
|
+
this._dataSource.setLocalRefresh(true);
|
|
110206
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
110204
110207
|
}
|
|
110205
110208
|
selectRows(rowIds) {
|
|
110206
110209
|
if (this._grid === undefined) {
|
|
@@ -110587,7 +110590,6 @@ class DataUnitBridge {
|
|
|
110587
110590
|
constructor(gridController, dataUnit) {
|
|
110588
110591
|
this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
|
|
110589
110592
|
this.processAction = (action) => {
|
|
110590
|
-
var _a, _b, _c, _d;
|
|
110591
110593
|
switch (action.type) {
|
|
110592
110594
|
case core.Action.METADATA_LOADED:
|
|
110593
110595
|
this._gridController.setColumnsDef(this.buildColumnDefs(), true);
|
|
@@ -110597,16 +110599,8 @@ class DataUnitBridge {
|
|
|
110597
110599
|
this._gridController.removeRows(records);
|
|
110598
110600
|
break;
|
|
110599
110601
|
case core.Action.DATA_SAVED:
|
|
110600
|
-
const recordsAdded = (_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.filter(r => { var _a; return (_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_'); });
|
|
110601
|
-
const recordsUpdated = (_d = (_c = action.payload) === null || _c === void 0 ? void 0 : _c.records) === null || _d === void 0 ? void 0 : _d.filter(r => { var _a; return !((_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_')); });
|
|
110602
|
-
if (recordsAdded.length > 0)
|
|
110603
|
-
this._gridController.addRows(recordsAdded);
|
|
110604
|
-
if (recordsUpdated.length > 0)
|
|
110605
|
-
this._gridController.updateRows(recordsUpdated);
|
|
110606
|
-
break;
|
|
110607
110602
|
case core.Action.EDITION_CANCELED:
|
|
110608
|
-
this.
|
|
110609
|
-
break;
|
|
110603
|
+
this._gridController.updateRows();
|
|
110610
110604
|
case core.Action.SELECTION_CHANGED:
|
|
110611
110605
|
const { selection } = action.payload;
|
|
110612
110606
|
this._gridController.selectRows(selection);
|
|
@@ -110625,11 +110619,6 @@ class DataUnitBridge {
|
|
|
110625
110619
|
this._dataUnit = dataUnit;
|
|
110626
110620
|
this._dataUnit.subscribe(this.processAction);
|
|
110627
110621
|
}
|
|
110628
|
-
updateValues() {
|
|
110629
|
-
this._dataUnit.getSelectedRecords().forEach((record) => {
|
|
110630
|
-
this._gridController.changeValues(record, [record.__record__id__]);
|
|
110631
|
-
});
|
|
110632
|
-
}
|
|
110633
110622
|
buildColumnDefs() {
|
|
110634
110623
|
const columnDefs = [];
|
|
110635
110624
|
if (this._dataUnit.metadata) {
|
|
@@ -55,10 +55,12 @@ let EzNumberInput = class {
|
|
|
55
55
|
if (newValue !== this.value) {
|
|
56
56
|
this.value = newValue;
|
|
57
57
|
this.ezChange.emit(this.value);
|
|
58
|
+
return true;
|
|
58
59
|
}
|
|
59
60
|
else {
|
|
60
61
|
this.observeValue();
|
|
61
62
|
}
|
|
63
|
+
return false;
|
|
62
64
|
}
|
|
63
65
|
parseNumber() {
|
|
64
66
|
const parsedNumber = this._textInput.value ? core.NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
@@ -68,7 +70,9 @@ let EzNumberInput = class {
|
|
|
68
70
|
}
|
|
69
71
|
else {
|
|
70
72
|
try {
|
|
71
|
-
this.changeValue(parsedNumber)
|
|
73
|
+
if (!this.changeValue(parsedNumber)) {
|
|
74
|
+
this.ezCancelWaitingChange.emit();
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
catch (e) {
|
|
74
78
|
this.ezCancelWaitingChange.emit();
|
|
@@ -18,6 +18,7 @@ let GridConfig = class {
|
|
|
18
18
|
this._columListItems = [];
|
|
19
19
|
this._selectedIndex = -1;
|
|
20
20
|
this._dataChanged = false;
|
|
21
|
+
this._componenteInternalKey = Date.now();
|
|
21
22
|
this.selectedTab = "Colunas";
|
|
22
23
|
}
|
|
23
24
|
/* Creation Methods */
|
|
@@ -89,7 +90,7 @@ let GridConfig = class {
|
|
|
89
90
|
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
90
91
|
selectedOption = item.ascending == true ? 'asc' : 'desc';
|
|
91
92
|
}
|
|
92
|
-
return (index.h("div", null, index.h("select-box", { selectedOption: selectedOption, key: 'select-box' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
93
|
+
return (index.h("div", null, index.h("select-box", { selectedOption: selectedOption, key: 'select-box-' + this._componenteInternalKey + '-' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
93
94
|
}
|
|
94
95
|
updateOrder(sortOrder, updatedItemLabel) {
|
|
95
96
|
var _a;
|
|
@@ -363,6 +364,7 @@ let GridConfig = class {
|
|
|
363
364
|
this._dataChanged = false;
|
|
364
365
|
this.configCancel.emit();
|
|
365
366
|
this._orderList.clearHistory();
|
|
367
|
+
this._componenteInternalKey = Date.now();
|
|
366
368
|
}
|
|
367
369
|
else {
|
|
368
370
|
this.finish();
|
|
@@ -3,7 +3,6 @@ export default class DataUnitBridge {
|
|
|
3
3
|
constructor(gridController, dataUnit) {
|
|
4
4
|
this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
|
|
5
5
|
this.processAction = (action) => {
|
|
6
|
-
var _a, _b, _c, _d;
|
|
7
6
|
switch (action.type) {
|
|
8
7
|
case Action.METADATA_LOADED:
|
|
9
8
|
this._gridController.setColumnsDef(this.buildColumnDefs(), true);
|
|
@@ -13,16 +12,8 @@ export default class DataUnitBridge {
|
|
|
13
12
|
this._gridController.removeRows(records);
|
|
14
13
|
break;
|
|
15
14
|
case Action.DATA_SAVED:
|
|
16
|
-
const recordsAdded = (_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.filter(r => { var _a; return (_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_'); });
|
|
17
|
-
const recordsUpdated = (_d = (_c = action.payload) === null || _c === void 0 ? void 0 : _c.records) === null || _d === void 0 ? void 0 : _d.filter(r => { var _a; return !((_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_')); });
|
|
18
|
-
if (recordsAdded.length > 0)
|
|
19
|
-
this._gridController.addRows(recordsAdded);
|
|
20
|
-
if (recordsUpdated.length > 0)
|
|
21
|
-
this._gridController.updateRows(recordsUpdated);
|
|
22
|
-
break;
|
|
23
15
|
case Action.EDITION_CANCELED:
|
|
24
|
-
this.
|
|
25
|
-
break;
|
|
16
|
+
this._gridController.updateRows();
|
|
26
17
|
case Action.SELECTION_CHANGED:
|
|
27
18
|
const { selection } = action.payload;
|
|
28
19
|
this._gridController.selectRows(selection);
|
|
@@ -41,11 +32,6 @@ export default class DataUnitBridge {
|
|
|
41
32
|
this._dataUnit = dataUnit;
|
|
42
33
|
this._dataUnit.subscribe(this.processAction);
|
|
43
34
|
}
|
|
44
|
-
updateValues() {
|
|
45
|
-
this._dataUnit.getSelectedRecords().forEach((record) => {
|
|
46
|
-
this._gridController.changeValues(record, [record.__record__id__]);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
35
|
buildColumnDefs() {
|
|
50
36
|
const columnDefs = [];
|
|
51
37
|
if (this._dataUnit.metadata) {
|
|
@@ -120,28 +120,19 @@ export default class AgGridController {
|
|
|
120
120
|
}
|
|
121
121
|
this._gridOptions.api.setRowData(data);
|
|
122
122
|
}
|
|
123
|
-
addRows(
|
|
123
|
+
addRows() {
|
|
124
124
|
if (this._grid === undefined) {
|
|
125
125
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
addIndex: 0,
|
|
130
|
-
add: rows
|
|
131
|
-
});
|
|
132
|
-
this.syncSelection();
|
|
133
|
-
}
|
|
127
|
+
this._dataSource.setLocalRefresh(true);
|
|
128
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
134
129
|
}
|
|
135
|
-
updateRows(
|
|
130
|
+
updateRows() {
|
|
136
131
|
if (this._grid === undefined) {
|
|
137
132
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
138
133
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.changeValues(row, [row[this._idAttribName]]);
|
|
142
|
-
});
|
|
143
|
-
this.syncSelection();
|
|
144
|
-
}
|
|
134
|
+
this._dataSource.setLocalRefresh(true);
|
|
135
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
145
136
|
}
|
|
146
137
|
selectRows(rowIds) {
|
|
147
138
|
if (this._grid === undefined) {
|
|
@@ -27,7 +27,16 @@ export default class DataSource {
|
|
|
27
27
|
loadData(page) {
|
|
28
28
|
return new Promise((resolve, reject) => {
|
|
29
29
|
if (this._dataUnit) {
|
|
30
|
-
|
|
30
|
+
if (this._localRefresh && this._lastPageResponse) {
|
|
31
|
+
resolve({ rowCount: (this._lastPageResponse.rowCount + Math.max((this._dataUnit.records.length - this._lastPageResponse.rowData.length), 0)), rowData: this._dataUnit.records });
|
|
32
|
+
this._localRefresh = false;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this._dataUnit.loadData(page).then(pageRes => {
|
|
36
|
+
this._lastPageResponse = { rowData: this._dataUnit.records, rowCount: pageRes ? pageRes.total : 0 };
|
|
37
|
+
resolve(this._lastPageResponse);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
else {
|
|
33
42
|
fetch(this._serverURL)
|
|
@@ -41,4 +50,7 @@ export default class DataSource {
|
|
|
41
50
|
setQuickFilter(term, fields) {
|
|
42
51
|
this._quickFilter = { term, fields };
|
|
43
52
|
}
|
|
53
|
+
setLocalRefresh(localREfresh) {
|
|
54
|
+
this._localRefresh = localREfresh;
|
|
55
|
+
}
|
|
44
56
|
}
|
|
@@ -8,6 +8,7 @@ export class GridConfig {
|
|
|
8
8
|
this._columListItems = [];
|
|
9
9
|
this._selectedIndex = -1;
|
|
10
10
|
this._dataChanged = false;
|
|
11
|
+
this._componenteInternalKey = Date.now();
|
|
11
12
|
this.selectedTab = "Colunas";
|
|
12
13
|
}
|
|
13
14
|
/* Creation Methods */
|
|
@@ -81,7 +82,7 @@ export class GridConfig {
|
|
|
81
82
|
selectedOption = item.ascending == true ? 'asc' : 'desc';
|
|
82
83
|
}
|
|
83
84
|
return (h("div", null,
|
|
84
|
-
h("select-box", { selectedOption: selectedOption, key: 'select-box' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
85
|
+
h("select-box", { selectedOption: selectedOption, key: 'select-box-' + this._componenteInternalKey + '-' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
85
86
|
}
|
|
86
87
|
updateOrder(sortOrder, updatedItemLabel) {
|
|
87
88
|
var _a;
|
|
@@ -355,6 +356,7 @@ export class GridConfig {
|
|
|
355
356
|
this._dataChanged = false;
|
|
356
357
|
this.configCancel.emit();
|
|
357
358
|
this._orderList.clearHistory();
|
|
359
|
+
this._componenteInternalKey = Date.now();
|
|
358
360
|
}
|
|
359
361
|
else {
|
|
360
362
|
this.finish();
|
|
@@ -44,10 +44,12 @@ export class EzNumberInput {
|
|
|
44
44
|
if (newValue !== this.value) {
|
|
45
45
|
this.value = newValue;
|
|
46
46
|
this.ezChange.emit(this.value);
|
|
47
|
+
return true;
|
|
47
48
|
}
|
|
48
49
|
else {
|
|
49
50
|
this.observeValue();
|
|
50
51
|
}
|
|
52
|
+
return false;
|
|
51
53
|
}
|
|
52
54
|
parseNumber() {
|
|
53
55
|
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
@@ -57,7 +59,9 @@ export class EzNumberInput {
|
|
|
57
59
|
}
|
|
58
60
|
else {
|
|
59
61
|
try {
|
|
60
|
-
this.changeValue(parsedNumber)
|
|
62
|
+
if (!this.changeValue(parsedNumber)) {
|
|
63
|
+
this.ezCancelWaitingChange.emit();
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
catch (e) {
|
|
63
67
|
this.ezCancelWaitingChange.emit();
|
|
@@ -112324,7 +112324,16 @@ class DataSource {
|
|
|
112324
112324
|
loadData(page) {
|
|
112325
112325
|
return new Promise((resolve, reject) => {
|
|
112326
112326
|
if (this._dataUnit) {
|
|
112327
|
-
|
|
112327
|
+
if (this._localRefresh && this._lastPageResponse) {
|
|
112328
|
+
resolve({ rowCount: (this._lastPageResponse.rowCount + Math.max((this._dataUnit.records.length - this._lastPageResponse.rowData.length), 0)), rowData: this._dataUnit.records });
|
|
112329
|
+
this._localRefresh = false;
|
|
112330
|
+
}
|
|
112331
|
+
else {
|
|
112332
|
+
this._dataUnit.loadData(page).then(pageRes => {
|
|
112333
|
+
this._lastPageResponse = { rowData: this._dataUnit.records, rowCount: pageRes ? pageRes.total : 0 };
|
|
112334
|
+
resolve(this._lastPageResponse);
|
|
112335
|
+
});
|
|
112336
|
+
}
|
|
112328
112337
|
}
|
|
112329
112338
|
else {
|
|
112330
112339
|
fetch(this._serverURL)
|
|
@@ -112338,6 +112347,9 @@ class DataSource {
|
|
|
112338
112347
|
setQuickFilter(term, fields) {
|
|
112339
112348
|
this._quickFilter = { term, fields };
|
|
112340
112349
|
}
|
|
112350
|
+
setLocalRefresh(localREfresh) {
|
|
112351
|
+
this._localRefresh = localREfresh;
|
|
112352
|
+
}
|
|
112341
112353
|
}
|
|
112342
112354
|
|
|
112343
112355
|
class AgGridController {
|
|
@@ -112454,28 +112466,19 @@ class AgGridController {
|
|
|
112454
112466
|
}
|
|
112455
112467
|
this._gridOptions.api.setRowData(data);
|
|
112456
112468
|
}
|
|
112457
|
-
addRows(
|
|
112469
|
+
addRows() {
|
|
112458
112470
|
if (this._grid === undefined) {
|
|
112459
112471
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
112460
112472
|
}
|
|
112461
|
-
|
|
112462
|
-
|
|
112463
|
-
addIndex: 0,
|
|
112464
|
-
add: rows
|
|
112465
|
-
});
|
|
112466
|
-
this.syncSelection();
|
|
112467
|
-
}
|
|
112473
|
+
this._dataSource.setLocalRefresh(true);
|
|
112474
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
112468
112475
|
}
|
|
112469
|
-
updateRows(
|
|
112476
|
+
updateRows() {
|
|
112470
112477
|
if (this._grid === undefined) {
|
|
112471
112478
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
112472
112479
|
}
|
|
112473
|
-
|
|
112474
|
-
|
|
112475
|
-
this.changeValues(row, [row[this._idAttribName]]);
|
|
112476
|
-
});
|
|
112477
|
-
this.syncSelection();
|
|
112478
|
-
}
|
|
112480
|
+
this._dataSource.setLocalRefresh(true);
|
|
112481
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
112479
112482
|
}
|
|
112480
112483
|
selectRows(rowIds) {
|
|
112481
112484
|
if (this._grid === undefined) {
|
|
@@ -112862,7 +112865,6 @@ class DataUnitBridge {
|
|
|
112862
112865
|
constructor(gridController, dataUnit) {
|
|
112863
112866
|
this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
|
|
112864
112867
|
this.processAction = (action) => {
|
|
112865
|
-
var _a, _b, _c, _d;
|
|
112866
112868
|
switch (action.type) {
|
|
112867
112869
|
case Action.METADATA_LOADED:
|
|
112868
112870
|
this._gridController.setColumnsDef(this.buildColumnDefs(), true);
|
|
@@ -112872,16 +112874,8 @@ class DataUnitBridge {
|
|
|
112872
112874
|
this._gridController.removeRows(records);
|
|
112873
112875
|
break;
|
|
112874
112876
|
case Action.DATA_SAVED:
|
|
112875
|
-
const recordsAdded = (_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.filter(r => { var _a; return (_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_'); });
|
|
112876
|
-
const recordsUpdated = (_d = (_c = action.payload) === null || _c === void 0 ? void 0 : _c.records) === null || _d === void 0 ? void 0 : _d.filter(r => { var _a; return !((_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_')); });
|
|
112877
|
-
if (recordsAdded.length > 0)
|
|
112878
|
-
this._gridController.addRows(recordsAdded);
|
|
112879
|
-
if (recordsUpdated.length > 0)
|
|
112880
|
-
this._gridController.updateRows(recordsUpdated);
|
|
112881
|
-
break;
|
|
112882
112877
|
case Action.EDITION_CANCELED:
|
|
112883
|
-
this.
|
|
112884
|
-
break;
|
|
112878
|
+
this._gridController.updateRows();
|
|
112885
112879
|
case Action.SELECTION_CHANGED:
|
|
112886
112880
|
const { selection } = action.payload;
|
|
112887
112881
|
this._gridController.selectRows(selection);
|
|
@@ -112900,11 +112894,6 @@ class DataUnitBridge {
|
|
|
112900
112894
|
this._dataUnit = dataUnit;
|
|
112901
112895
|
this._dataUnit.subscribe(this.processAction);
|
|
112902
112896
|
}
|
|
112903
|
-
updateValues() {
|
|
112904
|
-
this._dataUnit.getSelectedRecords().forEach((record) => {
|
|
112905
|
-
this._gridController.changeValues(record, [record.__record__id__]);
|
|
112906
|
-
});
|
|
112907
|
-
}
|
|
112908
112897
|
buildColumnDefs() {
|
|
112909
112898
|
const columnDefs = [];
|
|
112910
112899
|
if (this._dataUnit.metadata) {
|
|
@@ -113888,10 +113877,12 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
|
|
|
113888
113877
|
if (newValue !== this.value) {
|
|
113889
113878
|
this.value = newValue;
|
|
113890
113879
|
this.ezChange.emit(this.value);
|
|
113880
|
+
return true;
|
|
113891
113881
|
}
|
|
113892
113882
|
else {
|
|
113893
113883
|
this.observeValue();
|
|
113894
113884
|
}
|
|
113885
|
+
return false;
|
|
113895
113886
|
}
|
|
113896
113887
|
parseNumber() {
|
|
113897
113888
|
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
@@ -113901,7 +113892,9 @@ let EzNumberInput$1 = class extends HTMLElement$1 {
|
|
|
113901
113892
|
}
|
|
113902
113893
|
else {
|
|
113903
113894
|
try {
|
|
113904
|
-
this.changeValue(parsedNumber)
|
|
113895
|
+
if (!this.changeValue(parsedNumber)) {
|
|
113896
|
+
this.ezCancelWaitingChange.emit();
|
|
113897
|
+
}
|
|
113905
113898
|
}
|
|
113906
113899
|
catch (e) {
|
|
113907
113900
|
this.ezCancelWaitingChange.emit();
|
|
@@ -115405,6 +115398,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
|
|
|
115405
115398
|
this._columListItems = [];
|
|
115406
115399
|
this._selectedIndex = -1;
|
|
115407
115400
|
this._dataChanged = false;
|
|
115401
|
+
this._componenteInternalKey = Date.now();
|
|
115408
115402
|
this.selectedTab = "Colunas";
|
|
115409
115403
|
}
|
|
115410
115404
|
/* Creation Methods */
|
|
@@ -115476,7 +115470,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
|
|
|
115476
115470
|
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
115477
115471
|
selectedOption = item.ascending == true ? 'asc' : 'desc';
|
|
115478
115472
|
}
|
|
115479
|
-
return (h("div", null, h("select-box", { selectedOption: selectedOption, key: 'select-box' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
115473
|
+
return (h("div", null, h("select-box", { selectedOption: selectedOption, key: 'select-box-' + this._componenteInternalKey + '-' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
115480
115474
|
}
|
|
115481
115475
|
updateOrder(sortOrder, updatedItemLabel) {
|
|
115482
115476
|
var _a;
|
|
@@ -115750,6 +115744,7 @@ let GridConfig$1 = class extends HTMLElement$1 {
|
|
|
115750
115744
|
this._dataChanged = false;
|
|
115751
115745
|
this.configCancel.emit();
|
|
115752
115746
|
this._orderList.clearHistory();
|
|
115747
|
+
this._componenteInternalKey = Date.now();
|
|
115753
115748
|
}
|
|
115754
115749
|
else {
|
|
115755
115750
|
this.finish();
|
|
@@ -110045,7 +110045,16 @@ class DataSource {
|
|
|
110045
110045
|
loadData(page) {
|
|
110046
110046
|
return new Promise((resolve, reject) => {
|
|
110047
110047
|
if (this._dataUnit) {
|
|
110048
|
-
|
|
110048
|
+
if (this._localRefresh && this._lastPageResponse) {
|
|
110049
|
+
resolve({ rowCount: (this._lastPageResponse.rowCount + Math.max((this._dataUnit.records.length - this._lastPageResponse.rowData.length), 0)), rowData: this._dataUnit.records });
|
|
110050
|
+
this._localRefresh = false;
|
|
110051
|
+
}
|
|
110052
|
+
else {
|
|
110053
|
+
this._dataUnit.loadData(page).then(pageRes => {
|
|
110054
|
+
this._lastPageResponse = { rowData: this._dataUnit.records, rowCount: pageRes ? pageRes.total : 0 };
|
|
110055
|
+
resolve(this._lastPageResponse);
|
|
110056
|
+
});
|
|
110057
|
+
}
|
|
110049
110058
|
}
|
|
110050
110059
|
else {
|
|
110051
110060
|
fetch(this._serverURL)
|
|
@@ -110059,6 +110068,9 @@ class DataSource {
|
|
|
110059
110068
|
setQuickFilter(term, fields) {
|
|
110060
110069
|
this._quickFilter = { term, fields };
|
|
110061
110070
|
}
|
|
110071
|
+
setLocalRefresh(localREfresh) {
|
|
110072
|
+
this._localRefresh = localREfresh;
|
|
110073
|
+
}
|
|
110062
110074
|
}
|
|
110063
110075
|
|
|
110064
110076
|
class AgGridController {
|
|
@@ -110175,28 +110187,19 @@ class AgGridController {
|
|
|
110175
110187
|
}
|
|
110176
110188
|
this._gridOptions.api.setRowData(data);
|
|
110177
110189
|
}
|
|
110178
|
-
addRows(
|
|
110190
|
+
addRows() {
|
|
110179
110191
|
if (this._grid === undefined) {
|
|
110180
110192
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
110181
110193
|
}
|
|
110182
|
-
|
|
110183
|
-
|
|
110184
|
-
addIndex: 0,
|
|
110185
|
-
add: rows
|
|
110186
|
-
});
|
|
110187
|
-
this.syncSelection();
|
|
110188
|
-
}
|
|
110194
|
+
this._dataSource.setLocalRefresh(true);
|
|
110195
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
110189
110196
|
}
|
|
110190
|
-
updateRows(
|
|
110197
|
+
updateRows() {
|
|
110191
110198
|
if (this._grid === undefined) {
|
|
110192
110199
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
110193
110200
|
}
|
|
110194
|
-
|
|
110195
|
-
|
|
110196
|
-
this.changeValues(row, [row[this._idAttribName]]);
|
|
110197
|
-
});
|
|
110198
|
-
this.syncSelection();
|
|
110199
|
-
}
|
|
110201
|
+
this._dataSource.setLocalRefresh(true);
|
|
110202
|
+
this._gridOptions.api.refreshServerSideStore({ purge: true });
|
|
110200
110203
|
}
|
|
110201
110204
|
selectRows(rowIds) {
|
|
110202
110205
|
if (this._grid === undefined) {
|
|
@@ -110583,7 +110586,6 @@ class DataUnitBridge {
|
|
|
110583
110586
|
constructor(gridController, dataUnit) {
|
|
110584
110587
|
this.RECORD_ARCHIVE = "__RECORD_ARCHIVE__";
|
|
110585
110588
|
this.processAction = (action) => {
|
|
110586
|
-
var _a, _b, _c, _d;
|
|
110587
110589
|
switch (action.type) {
|
|
110588
110590
|
case Action.METADATA_LOADED:
|
|
110589
110591
|
this._gridController.setColumnsDef(this.buildColumnDefs(), true);
|
|
@@ -110593,16 +110595,8 @@ class DataUnitBridge {
|
|
|
110593
110595
|
this._gridController.removeRows(records);
|
|
110594
110596
|
break;
|
|
110595
110597
|
case Action.DATA_SAVED:
|
|
110596
|
-
const recordsAdded = (_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.records) === null || _b === void 0 ? void 0 : _b.filter(r => { var _a; return (_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_'); });
|
|
110597
|
-
const recordsUpdated = (_d = (_c = action.payload) === null || _c === void 0 ? void 0 : _c.records) === null || _d === void 0 ? void 0 : _d.filter(r => { var _a; return !((_a = r.__old__id__) === null || _a === void 0 ? void 0 : _a.startsWith('NEW_')); });
|
|
110598
|
-
if (recordsAdded.length > 0)
|
|
110599
|
-
this._gridController.addRows(recordsAdded);
|
|
110600
|
-
if (recordsUpdated.length > 0)
|
|
110601
|
-
this._gridController.updateRows(recordsUpdated);
|
|
110602
|
-
break;
|
|
110603
110598
|
case Action.EDITION_CANCELED:
|
|
110604
|
-
this.
|
|
110605
|
-
break;
|
|
110599
|
+
this._gridController.updateRows();
|
|
110606
110600
|
case Action.SELECTION_CHANGED:
|
|
110607
110601
|
const { selection } = action.payload;
|
|
110608
110602
|
this._gridController.selectRows(selection);
|
|
@@ -110621,11 +110615,6 @@ class DataUnitBridge {
|
|
|
110621
110615
|
this._dataUnit = dataUnit;
|
|
110622
110616
|
this._dataUnit.subscribe(this.processAction);
|
|
110623
110617
|
}
|
|
110624
|
-
updateValues() {
|
|
110625
|
-
this._dataUnit.getSelectedRecords().forEach((record) => {
|
|
110626
|
-
this._gridController.changeValues(record, [record.__record__id__]);
|
|
110627
|
-
});
|
|
110628
|
-
}
|
|
110629
110618
|
buildColumnDefs() {
|
|
110630
110619
|
const columnDefs = [];
|
|
110631
110620
|
if (this._dataUnit.metadata) {
|
|
@@ -51,10 +51,12 @@ let EzNumberInput = class {
|
|
|
51
51
|
if (newValue !== this.value) {
|
|
52
52
|
this.value = newValue;
|
|
53
53
|
this.ezChange.emit(this.value);
|
|
54
|
+
return true;
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
57
|
this.observeValue();
|
|
57
58
|
}
|
|
59
|
+
return false;
|
|
58
60
|
}
|
|
59
61
|
parseNumber() {
|
|
60
62
|
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
|
|
@@ -64,7 +66,9 @@ let EzNumberInput = class {
|
|
|
64
66
|
}
|
|
65
67
|
else {
|
|
66
68
|
try {
|
|
67
|
-
this.changeValue(parsedNumber)
|
|
69
|
+
if (!this.changeValue(parsedNumber)) {
|
|
70
|
+
this.ezCancelWaitingChange.emit();
|
|
71
|
+
}
|
|
68
72
|
}
|
|
69
73
|
catch (e) {
|
|
70
74
|
this.ezCancelWaitingChange.emit();
|
|
@@ -14,6 +14,7 @@ let GridConfig = class {
|
|
|
14
14
|
this._columListItems = [];
|
|
15
15
|
this._selectedIndex = -1;
|
|
16
16
|
this._dataChanged = false;
|
|
17
|
+
this._componenteInternalKey = Date.now();
|
|
17
18
|
this.selectedTab = "Colunas";
|
|
18
19
|
}
|
|
19
20
|
/* Creation Methods */
|
|
@@ -85,7 +86,7 @@ let GridConfig = class {
|
|
|
85
86
|
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
86
87
|
selectedOption = item.ascending == true ? 'asc' : 'desc';
|
|
87
88
|
}
|
|
88
|
-
return (h("div", null, h("select-box", { selectedOption: selectedOption, key: 'select-box' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
89
|
+
return (h("div", null, h("select-box", { selectedOption: selectedOption, key: 'select-box-' + this._componenteInternalKey + '-' + item, onEzChange: (ev) => { ev.stopPropagation(); this.updateOrder(ev.detail, item.label); } })));
|
|
89
90
|
}
|
|
90
91
|
updateOrder(sortOrder, updatedItemLabel) {
|
|
91
92
|
var _a;
|
|
@@ -359,6 +360,7 @@ let GridConfig = class {
|
|
|
359
360
|
this._dataChanged = false;
|
|
360
361
|
this.configCancel.emit();
|
|
361
362
|
this._orderList.clearHistory();
|
|
363
|
+
this._componenteInternalKey = Date.now();
|
|
362
364
|
}
|
|
363
365
|
else {
|
|
364
366
|
this.finish();
|
package/dist/ezui/ezui.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as s}from"./p-139ed2f6.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-4c3cd534",[[0,"test-du",{isDirty:[32]}]]],["p-fc9b9487",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-2c4372a4",[[0,"ez-application"]]],["p-5a05f1ea",[[1,"ez-card-item",{item:[16]}]]],["p-6287fc90",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-8be1a4d6",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],innerElement:[1537,"inner-element"],updatePosition:[64],show:[64],hide:[64]}]]],["p-94ed1ae6",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-4f2e5cf4",[[0,"ez-view-stack",{show:[64],getSelectedIndex:[64]}]]],["p-c2de757f",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-024df41e",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],showHide:[64]}]]],["p-ecee9d8d",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-1941aef7",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-
|
|
1
|
+
import{p as e,b as s}from"./p-139ed2f6.js";(()=>{const s=import.meta.url,o={};return""!==s&&(o.resourcesUrl=new URL(".",s).href),e(o)})().then((e=>s([["p-4c3cd534",[[0,"test-du",{isDirty:[32]}]]],["p-fc9b9487",[[1,"ez-filter-input",{label:[1],value:[1537],enabled:[4],loading:[516],errorMessage:[1537,"error-message"],restrict:[1],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-2c4372a4",[[0,"ez-application"]]],["p-5a05f1ea",[[1,"ez-card-item",{item:[16]}]]],["p-6287fc90",[[1,"ez-loading-bar",{_showLoading:[32],hide:[64],show:[64]}]]],["p-8be1a4d6",[[1,"ez-popover",{autoClose:[516,"auto-close"],top:[1537],left:[1537],bottom:[1537],right:[1537],boxWidth:[513,"box-width"],opened:[1540],innerElement:[1537,"inner-element"],updatePosition:[64],show:[64],hide:[64]}]]],["p-94ed1ae6",[[1,"ez-toast",{message:[1025],fadeTime:[1026,"fade-time"],useIcon:[1028,"use-icon"],canClose:[1028,"can-close"],show:[64]}]]],["p-4f2e5cf4",[[0,"ez-view-stack",{show:[64],getSelectedIndex:[64]}]]],["p-c2de757f",[[1,"ez-modal",{modalSize:[1,"modal-size"],align:[1],opened:[1028],closeEsc:[4,"close-esc"],closeOutsideClick:[4,"close-outside-click"]}]]],["p-024df41e",[[1,"ez-collapsible-box",{value:[1540],label:[513],headerSize:[513,"header-size"],iconPlacement:[513,"icon-placement"],stretchTitle:[516,"stretch-title"],showHide:[64]}]]],["p-ecee9d8d",[[1,"ez-list",{dataSource:[1040],useGroups:[1540,"use-groups"],ezDraggable:[1028,"ez-draggable"],ezSelectable:[1028,"ez-selectable"],itemSlotBuilder:[1040],_listItems:[32],_listGroupItems:[32],clearHistory:[64],scrollToTop:[64],setSelection:[64],getSelection:[64],getList:[64]}]]],["p-1941aef7",[[1,"ez-button",{label:[513],enabled:[516],mode:[513],image:[513],iconName:[513,"icon-name"],size:[513],setFocus:[64],setBlur:[64]}]]],["p-be87ac5e",[[6,"ez-grid",{multipleSelection:[4,"multiple-selection"],config:[1040],pageSize:[2,"page-size"],serverUrl:[1,"server-url"],dataUnit:[16],_navigationHasPrevious:[32],_navigationHasNext:[32],_navigationFirstRow:[32],_navigationLastRow:[32],_navigationTotalRows:[32],_popUpGridConfig:[32],setColumnsDef:[64],addColumnMenuItem:[64],setColumnsState:[64],setData:[64],getSelection:[64],getColumnsState:[64],getColumns:[64],refresh:[64],quickFilter:[64],nextPage:[64],previousPage:[64],hasNextPage:[64],hasPreviousPage:[64],isLastOfPage:[64],isFirstOfPage:[64],nextRecord:[64],previousRecord:[64],hasNextRecord:[64],hasPreviousRecord:[64],openGridConfig:[64]}]]],["p-ec7b7e26",[[1,"ez-dialog",{confirm:[1028],critical:[1028],message:[1025],opened:[1540],personalizedIconPath:[1025,"personalized-icon-path"],ezTitle:[1025,"ez-title"],handleButtonClick:[64],show:[64]}]]],["p-dd723a09",[[1,"ez-chip",{label:[513],enabled:[516],removePosition:[513,"remove-position"],mode:[513],value:[1540],setFocus:[64],setBlur:[64]}]]],["p-294de17e",[[1,"ez-popup",{size:[1],opened:[1540],useHeader:[1540,"use-header"],ezTitle:[1,"ez-title"]}]]],["p-140f7085",[[1,"ez-text-input",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],mask:[1],canShowError:[516,"can-show-error"],restrict:[1],mode:[513],slaveMode:[516,"slave-mode"],setFocus:[64],setBlur:[64]}]]],["p-727a39e5",[[1,"select-box",{selectedOption:[1,"selected-option"]}]]],["p-bea6f8a6",[[2,"grid-config",{selectedTab:[1025,"selected-tab"],columns:[1040],config:[1040]}]]],["p-6d4b1628",[[1,"ez-search",{value:[1537],label:[1537],enabled:[1540],errorMessage:[1537,"error-message"],optionLoader:[16],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressEmptyOption:[4,"suppress-empty-option"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-c246e251",[[1,"ez-calendar",{value:[1040],floating:[516],time:[516],showSeconds:[516,"show-seconds"],show:[64],fitVertical:[64],hide:[64]}]]],["p-49fdfa4b",[[1,"ez-date-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-ec21ecce",[[1,"ez-date-time-input",{label:[513],value:[1040],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-4fdceb7d",[[1,"ez-time-input",{label:[513],viewValue:[1537,"view-value"],value:[1026],enabled:[516],errorMessage:[1537,"error-message"],showSeconds:[516,"show-seconds"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-91377c65",[[1,"ez-number-input",{label:[1],value:[1538],enabled:[4],errorMessage:[1537,"error-message"],precision:[2],prettyPrecision:[2,"pretty-precision"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-b524dfca",[[1,"ez-text-area",{label:[513],value:[1537],enabled:[516],loading:[516],errorMessage:[1537,"error-message"],rows:[1538],canShowError:[516,"can-show-error"],mode:[513],setFocus:[64],setBlur:[64]}]]],["p-da156da3",[[1,"ez-upload",{label:[1],enabled:[4],maxFileSize:[2,"max-file-size"],maxFiles:[2,"max-files"],requestHeaders:[8,"request-headers"],urlUpload:[1,"url-upload"],urlDelete:[1,"url-delete"],value:[1040],addFiles:[64],setFocus:[64],setBlur:[64]}]]],["p-b65e22a1",[[1,"ez-check",{label:[513],value:[1540],enabled:[1540],mode:[513],getMode:[64],setFocus:[64]}]]],["p-2b017e4c",[[1,"ez-tabselector",{selectedIndex:[1538,"selected-index"],selectedTab:[1537,"selected-tab"],tabs:[1]}]]],["p-317250bc",[[1,"ez-icon",{size:[513],href:[513],iconName:[513,"icon-name"]}]]],["p-2f34453f",[[1,"ez-combo-box",{value:[1537],label:[513],enabled:[516],options:[1040],errorMessage:[1537,"error-message"],searchMode:[4,"search-mode"],showSelectedValue:[4,"show-selected-value"],showOptionValue:[4,"show-option-value"],suppressSearch:[4,"suppress-search"],optionLoader:[16],suppressEmptyOption:[4,"suppress-empty-option"],canShowError:[516,"can-show-error"],mode:[513],_preSelection:[32],_visibleOptions:[32],_startLoading:[32],_showLoading:[32],setFocus:[64],setBlur:[64]}]]],["p-8f4fac31",[[0,"ez-form",{dataUnit:[1040],config:[16],submit:[64],cancel:[64],validate:[64]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as t,h as e,g as i}from"./p-139ed2f6.js";import{NumberUtils as h}from"@sankhyalabs/core";import{C as r}from"./p-933a7475.js";let a=class{constructor(e){s(this,e),this.ezChange=t(this,"ezChange",7),this.ezStartChange=t(this,"ezStartChange",7),this.ezCancelWaitingChange=t(this,"ezCancelWaitingChange",7),this.enabled=!0,this.mode="regular"}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){this._textInput&&(this._textInput.errorMessage=this.errorMessage)}observeValue(){this._textInput&&(this._textInput.value=this.getTextValue(this.value)||"")}changeValue(s){return this.errorMessage="",s!==this.value?(this.value=s,this.ezChange.emit(this.value),!0):(this.observeValue(),!1)}parseNumber(){const s=this._textInput.value?h.stringToNumber(this._textInput.value):void 0;if(void 0!==s&&isNaN(s))this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é um número válido";else try{this.changeValue(s)||this.ezCancelWaitingChange.emit()}catch(s){return this.ezCancelWaitingChange.emit(),void(this.errorMessage=s.message)}}getTextValue(s){if(s)return this.precision>0?h.format(s.toString(),Number(this.precision),Number(this.prettyPrecision)):s.toString()}startChange(){this.ezStartChange.emit({waitmessage:"",blocking:!1})}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput)}render(){return e("ez-text-input",{ref:s=>this._textInput=s,onBlur:()=>this.parseNumber(),label:this.label,onInput:()=>this.startChange(),value:this.getTextValue(this.value),restrict:this.precision>0?"0123456789-,.":"0123456789-",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,slaveMode:!0})}get _elem(){return i(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};a.style=":host{display:block;width:100%}";export{a as ez_number_input}
|