@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-74224.0 → 0.0.0-bugfix-dev-KB-75070.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/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
- package/dist/cjs/{ContinuousInsertUtils-29b65619.js → ContinuousInsertUtils-64e47516.js} +29 -20
- package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
- package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-63369164.js} +2 -2
- package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-f89461c1.js → dataunit-fetcher-228016f4.js} +3 -3
- package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
- package/dist/cjs/index-f9e81701.js +8 -28
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-ca89181c.js → pesquisa-fetcher-a9bfeb22.js} +7 -2
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +6 -6
- package/dist/cjs/snk-application.cjs.entry.js +111 -59
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +365 -3
- package/dist/cjs/snk-crud.cjs.entry.js +13 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-668dc5e8.js → snk-data-unit-3d9b6ed4.js} +26 -14
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
- package/dist/cjs/{snk-filter-bar.cjs.entry.js → snk-filter-bar_4.cjs.entry.js} +691 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-grid.cjs.entry.js +16 -8
- package/dist/cjs/{snk-guides-viewer-4236cb9d.js → snk-guides-viewer-eee43c8b.js} +8 -5
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +45 -10
- package/dist/cjs/snk-taskbar.cjs.entry.js +37 -35
- package/dist/collection/collection-manifest.json +11 -31
- package/dist/collection/components/snk-actions-button/snk-actions-button.js +1 -1
- package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
- package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
- package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
- package/dist/collection/components/snk-application/snk-application.js +44 -54
- package/dist/collection/components/snk-crud/snk-crud.js +26 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +3 -0
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +25 -13
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +18 -0
- package/dist/collection/components/snk-grid/snk-grid.js +28 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +57 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +38 -36
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
- package/dist/collection/lib/utils/CrudUtils.js +25 -16
- package/dist/collection/sw.js +46 -0
- package/dist/components/ContinuousInsertUtils.js +25 -16
- package/dist/components/DataFetcher.js +7 -5
- package/dist/components/dataunit-fetcher.js +2 -2
- package/dist/components/pesquisa-fetcher.js +6 -1
- package/dist/components/snk-actions-button2.js +1 -1
- package/dist/components/snk-application2.js +107 -54
- package/dist/components/snk-crud.js +9 -2
- package/dist/components/snk-data-unit2.js +25 -13
- package/dist/components/snk-detail-view2.js +3 -0
- package/dist/components/snk-filter-bar2.js +4 -0
- package/dist/components/snk-grid2.js +11 -2
- package/dist/components/snk-simple-crud2.js +40 -4
- package/dist/components/snk-taskbar2.js +38 -36
- package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
- package/dist/esm/{ContinuousInsertUtils-30caa626.js → ContinuousInsertUtils-b62906f9.js} +29 -20
- package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
- package/dist/esm/{SnkFormConfigManager-139f09fa.js → SnkFormConfigManager-b409c745.js} +3 -3
- package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
- package/dist/esm/{constants-8457af36.js → constants-7302ee87.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c24c76c6.js → dataunit-fetcher-56cb648b.js} +3 -3
- package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
- package/dist/esm/index-a7d3d3f1.js +8 -28
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-8edaa8cd.js → pesquisa-fetcher-6bc2e41a.js} +7 -2
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +7 -7
- package/dist/esm/snk-application.entry.js +111 -59
- package/dist/esm/snk-attach.entry.js +6 -6
- package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +366 -6
- package/dist/esm/snk-configurator.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +14 -8
- package/dist/esm/snk-data-exporter.entry.js +6 -6
- package/dist/esm/{snk-data-unit-0fdfb6c2.js → snk-data-unit-9fa7d2b9.js} +26 -14
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +8 -8
- package/dist/esm/snk-field-config.entry.js +1 -1
- package/dist/esm/{snk-filter-bar.entry.js → snk-filter-bar_4.entry.js} +690 -5
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-grid.entry.js +16 -8
- package/dist/esm/{snk-guides-viewer-8934c537.js → snk-guides-viewer-e8ca764a.js} +9 -6
- package/dist/esm/snk-guides-viewer.entry.js +8 -8
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +47 -12
- package/dist/esm/snk-tab-config.entry.js +1 -1
- package/dist/esm/snk-taskbar.entry.js +38 -36
- package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
- package/dist/sankhyablocks/{p-b9c67e45.entry.js → p-0d2a2e9e.entry.js} +1 -1
- package/dist/sankhyablocks/{p-afbb070d.js → p-0e206e62.js} +1 -1
- package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
- package/dist/sankhyablocks/p-200a5481.entry.js +11 -0
- package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-2d3f9482.entry.js} +1 -1
- package/dist/sankhyablocks/p-30ebcbe0.entry.js +1 -0
- package/dist/sankhyablocks/{p-1bf06cd3.js → p-341465ce.js} +2 -2
- package/dist/sankhyablocks/p-342eeb3b.js +1 -0
- package/dist/sankhyablocks/{p-7663f597.entry.js → p-41793e17.entry.js} +1 -1
- package/dist/sankhyablocks/p-42130213.entry.js +1 -0
- package/dist/sankhyablocks/{p-be5d8fcb.entry.js → p-43353d86.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7ac7932c.js → p-47d24ac8.js} +2 -2
- package/dist/sankhyablocks/p-520c7c38.entry.js +1 -0
- package/dist/sankhyablocks/{p-430e4d3c.entry.js → p-7075b789.entry.js} +1 -1
- package/dist/sankhyablocks/p-83e71703.entry.js +1 -0
- package/dist/sankhyablocks/{p-95df461f.entry.js → p-8b4fc28f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-b0ef4383.js → p-95ce311a.js} +1 -1
- package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
- package/dist/sankhyablocks/{p-dcead955.entry.js → p-a2c790ac.entry.js} +1 -1
- package/dist/sankhyablocks/p-a3fadd0b.entry.js +1 -0
- package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
- package/dist/sankhyablocks/p-aaf94476.js +1 -0
- package/dist/sankhyablocks/p-ac26df7a.entry.js +1 -0
- package/dist/sankhyablocks/{p-4f35399c.entry.js → p-af7f7b3e.entry.js} +1 -1
- package/dist/sankhyablocks/p-c51ad0e7.entry.js +1 -0
- package/dist/sankhyablocks/{p-16869f77.js → p-e3a285a2.js} +1 -1
- package/dist/sankhyablocks/p-e4391e16.js +1 -0
- package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
- package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
- package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
- package/dist/types/components/snk-application/snk-application.d.ts +9 -13
- package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +2 -0
- package/dist/types/components.d.ts +30 -0
- package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
- package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
- package/package.json +3 -2
- package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
- package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
- package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
- package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
- package/dist/cjs/snk-form.cjs.entry.js +0 -144
- package/dist/esm/snk-config-options.entry.js +0 -235
- package/dist/esm/snk-filter-item.entry.js +0 -308
- package/dist/esm/snk-filter-list.entry.js +0 -148
- package/dist/esm/snk-filter-modal.entry.js +0 -245
- package/dist/esm/snk-form.entry.js +0 -140
- package/dist/sankhyablocks/p-01086ff7.entry.js +0 -1
- package/dist/sankhyablocks/p-2923c1b5.js +0 -1
- package/dist/sankhyablocks/p-2aae03a1.entry.js +0 -1
- package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
- package/dist/sankhyablocks/p-5dd8cf4f.js +0 -1
- package/dist/sankhyablocks/p-60b29483.entry.js +0 -1
- package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
- package/dist/sankhyablocks/p-92eadb1c.entry.js +0 -1
- package/dist/sankhyablocks/p-a42e7a1e.entry.js +0 -11
- package/dist/sankhyablocks/p-a724e798.entry.js +0 -1
- package/dist/sankhyablocks/p-a75d242d.entry.js +0 -1
- package/dist/sankhyablocks/p-b9679243.entry.js +0 -1
- package/dist/sankhyablocks/p-ca5ec380.js +0 -1
- package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
- package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
- package/dist/sankhyablocks/p-feba9d4b.entry.js +0 -1
|
@@ -24,7 +24,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
24
24
|
this._rowMetadataCache = new Map();
|
|
25
25
|
this.REGEX_DATAUNIT_NAME = /dd:\/\/(.+?)\//;
|
|
26
26
|
this._dataUnitObserver = async (action) => {
|
|
27
|
-
const duState = this.buildDataState(action.type);
|
|
27
|
+
const duState = await this.buildDataState(action.type);
|
|
28
28
|
this.dataState = duState;
|
|
29
29
|
this.messagesBuilder.currentOperation = this.getMessageOperation();
|
|
30
30
|
switch (action.type) {
|
|
@@ -136,14 +136,22 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
136
136
|
async getRowMetadata(record) {
|
|
137
137
|
return this.doGetRowMetadata(record);
|
|
138
138
|
}
|
|
139
|
-
doGetRowMetadata(record) {
|
|
139
|
+
async doGetRowMetadata(record) {
|
|
140
140
|
const selectedRecord = this.dataUnit.getSelectedRecord();
|
|
141
141
|
if (!record && !selectedRecord) {
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
const currentRecord = record || selectedRecord;
|
|
145
145
|
const recordId = typeof currentRecord === 'string' ? currentRecord : currentRecord.__record__id__;
|
|
146
|
-
|
|
146
|
+
let rowMetadata = this._metadataByRow.get(recordId);
|
|
147
|
+
/*
|
|
148
|
+
Nao fazemos cache de metadataByRow pra registros novos, pois a chave do mesmo
|
|
149
|
+
muda ao ser salvo, por isso essa tratativa é necessária para que o dataState fique com metadados
|
|
150
|
+
corretos nao confiando apenas no _metadataByRow
|
|
151
|
+
*/
|
|
152
|
+
if (this.dataUnit.isNewRecord(recordId) && !rowMetadata) {
|
|
153
|
+
rowMetadata = await this.handleLoadRowMetadata(selectedRecord);
|
|
154
|
+
}
|
|
147
155
|
if (!rowMetadata) {
|
|
148
156
|
return;
|
|
149
157
|
}
|
|
@@ -337,7 +345,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
337
345
|
case Action.RECORDS_COPIED:
|
|
338
346
|
return this.interceptRecordsCopied(action);
|
|
339
347
|
case Action.DATA_CHANGED:
|
|
340
|
-
await this.handleLoadRowMetadata(action);
|
|
348
|
+
await this.handleLoadRowMetadata(action.payload);
|
|
341
349
|
return await this.interceptDataChange(action);
|
|
342
350
|
case Action.CHANGING_DATA:
|
|
343
351
|
return await this.interceptDataChange(action);
|
|
@@ -357,8 +365,9 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
357
365
|
return action;
|
|
358
366
|
}
|
|
359
367
|
}
|
|
360
|
-
async handleLoadRowMetadata(
|
|
361
|
-
|
|
368
|
+
async handleLoadRowMetadata(record) {
|
|
369
|
+
if (!record)
|
|
370
|
+
return;
|
|
362
371
|
const keysPayload = Object.keys(record);
|
|
363
372
|
const rmpField = keysPayload.find((field) => this._fieldsWithRmp.includes(field));
|
|
364
373
|
if (rmpField) {
|
|
@@ -437,7 +446,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
437
446
|
isAllowed(flag) {
|
|
438
447
|
return this._permissions ? this._permissions.isSup || this._permissions[flag] : false;
|
|
439
448
|
}
|
|
440
|
-
buildDataState(actionType) {
|
|
449
|
+
async buildDataState(actionType) {
|
|
441
450
|
var _a;
|
|
442
451
|
const selectionInfo = this.dataUnit.getSelectionInfo();
|
|
443
452
|
const isStartingInsertionMode = (this.dataUnit.hasDirtyRecords() || this.dataUnit.hasWaitingChanges()) && (selectionInfo === null || selectionInfo === void 0 ? void 0 : selectionInfo.isEmpty());
|
|
@@ -445,7 +454,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
445
454
|
let rowMetadata = (_a = this.dataState) === null || _a === void 0 ? void 0 : _a.rowMetadata;
|
|
446
455
|
const allowedOverwrite = [Action.SELECTION_CHANGED, Action.EDITION_CANCELED, Action.NEXT_SELECTED, Action.PREVIOUS_SELECTED];
|
|
447
456
|
if (selectedRecord && (!rowMetadata || allowedOverwrite.includes(actionType))) {
|
|
448
|
-
rowMetadata = this.doGetRowMetadata(selectedRecord);
|
|
457
|
+
rowMetadata = await this.doGetRowMetadata(selectedRecord);
|
|
449
458
|
}
|
|
450
459
|
else if (rowMetadata) {
|
|
451
460
|
rowMetadata.getProp = this.buildGetPropRowMetadata(rowMetadata);
|
|
@@ -467,17 +476,20 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
467
476
|
});
|
|
468
477
|
}
|
|
469
478
|
async handleDataSaved(action) {
|
|
470
|
-
|
|
479
|
+
var _a, _b, _c;
|
|
480
|
+
const newRowMetadata = await this.handleLoadRowMetadata((_c = (_b = (_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.changes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.record);
|
|
471
481
|
if (newRowMetadata) {
|
|
472
482
|
newRowMetadata.getProp = this.buildGetPropRowMetadata(newRowMetadata);
|
|
473
483
|
}
|
|
474
484
|
const recordId = action.payload.records[0].__record__id__;
|
|
475
485
|
this._metadataByRow.set(recordId, newRowMetadata);
|
|
476
|
-
this.dataState = this.buildDataState();
|
|
477
|
-
|
|
486
|
+
this.dataState = await this.buildDataState();
|
|
487
|
+
let saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
|
488
|
+
if (saveOperation == 'copy')
|
|
489
|
+
saveOperation = OperationMap.CLONE;
|
|
490
|
+
if (this.ignoreSaveMessage && ![OperationMap.CLONE, OperationMap.INSERT].includes(saveOperation)) {
|
|
478
491
|
return;
|
|
479
492
|
}
|
|
480
|
-
const saveOperation = action.payload.changes[0]._operation.toLowerCase();
|
|
481
493
|
const msg = this.getMessage("snkDataUnit.saveInfo", action.payload.records[0], saveOperation);
|
|
482
494
|
if (msg != undefined) {
|
|
483
495
|
this.showSuccessMessage(msg);
|
|
@@ -570,7 +582,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
570
582
|
const { records } = this.getMetadataByRow(this.dataUnit);
|
|
571
583
|
this.dataUnit.records = records;
|
|
572
584
|
}
|
|
573
|
-
this.dataState = this.buildDataState();
|
|
585
|
+
this.dataState = await this.buildDataState();
|
|
574
586
|
let resolver;
|
|
575
587
|
while (resolver = this._onDataUnitResolve.pop()) {
|
|
576
588
|
resolver(this.dataUnit);
|
|
@@ -482,6 +482,9 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
482
482
|
await this.addErrorBadgeToGuide(guideName);
|
|
483
483
|
await this.openGuideNavigator(guideName);
|
|
484
484
|
}
|
|
485
|
+
if (action.type === Action.METADATA_LOADED) {
|
|
486
|
+
this.loadGuides(false);
|
|
487
|
+
}
|
|
485
488
|
}
|
|
486
489
|
async addErrorBadgeToGuide(guideName) {
|
|
487
490
|
var _a;
|
|
@@ -290,6 +290,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
290
290
|
this.disablePersonalizedFilter = undefined;
|
|
291
291
|
this.filterBarLegacyConfigName = undefined;
|
|
292
292
|
this.autoLoad = undefined;
|
|
293
|
+
this.afterFilterModalApply = undefined;
|
|
293
294
|
this.allowDefault = undefined;
|
|
294
295
|
this.scrollerLocked = false;
|
|
295
296
|
this.showPersonalizedFilter = false;
|
|
@@ -643,7 +644,9 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
643
644
|
*/
|
|
644
645
|
async showFilterModal() {
|
|
645
646
|
const callbackOnApplyFilter = (filters) => {
|
|
647
|
+
var _a;
|
|
646
648
|
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
|
649
|
+
(_a = this.afterFilterModalApply) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
647
650
|
};
|
|
648
651
|
let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
|
|
649
652
|
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
|
@@ -735,6 +738,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
735
738
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
736
739
|
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
737
740
|
"autoLoad": [4, "auto-load"],
|
|
741
|
+
"afterFilterModalApply": [16],
|
|
738
742
|
"allowDefault": [32],
|
|
739
743
|
"scrollerLocked": [32],
|
|
740
744
|
"showPersonalizedFilter": [32],
|
|
@@ -153,6 +153,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
153
153
|
this.autoLoad = undefined;
|
|
154
154
|
this.autoFocus = true;
|
|
155
155
|
this.enableGridInsert = false;
|
|
156
|
+
this.enableLockManger = false;
|
|
156
157
|
}
|
|
157
158
|
/**
|
|
158
159
|
* Exibe a janela de configurações da grade.
|
|
@@ -240,10 +241,17 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
240
241
|
this._grid.setFocus();
|
|
241
242
|
}
|
|
242
243
|
async handleClick(event) {
|
|
244
|
+
var _a;
|
|
243
245
|
if (this.hasToBlockEvent(event)) {
|
|
244
246
|
event.preventDefault();
|
|
245
247
|
event.stopPropagation();
|
|
246
|
-
await this._dataUnit.cancelEdition()
|
|
248
|
+
if (!await this._dataUnit.cancelEdition())
|
|
249
|
+
return;
|
|
250
|
+
const newEvent = new event.constructor(event.type, event);
|
|
251
|
+
(_a = event.target) === null || _a === void 0 ? void 0 : _a.dispatchEvent(newEvent);
|
|
252
|
+
}
|
|
253
|
+
if (this._grid && !this._grid.contains(event.target)) {
|
|
254
|
+
this._grid.stopEdit();
|
|
247
255
|
}
|
|
248
256
|
}
|
|
249
257
|
hasToBlockEvent(event) {
|
|
@@ -534,7 +542,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
534
542
|
return undefined;
|
|
535
543
|
}
|
|
536
544
|
return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-margin-bottom--extra-small" }, this._showSnkFilterBar &&
|
|
537
|
-
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
545
|
+
h(Fragment, null, h("snk-filter-bar", { ref: (ref) => this._snkFilterBar = ref, title: this.filterBarTitle, dataUnit: this._dataUnit, "data-element-id": "gridFilter", class: "snk-grid__filter-bar ez-align--top", configName: this.configName, messagesBuilder: this.messagesBuilder, resourceID: this.resourceID, onConfigUpdated: evt => this.handleFilterConfigUpdated(evt.detail), disablePersonalizedFilter: this.disablePersonalizedFilter, filterBarLegacyConfigName: this.filterBarLegacyConfigName, autoLoad: this.autoLoad }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" })), h("snk-taskbar", { class: "ez-padding-left--medium", "data-element-id": "grid_top", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, messagesBuilder: this.messagesBuilder, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.topTaskbarCustomSlotId, overflowStrategy: 'none' }, h("slot", { name: this.topTaskbarCustomSlotId }))), h("ez-grid", { ref: ref => this._grid = ref, class: (this.presentationMode === PresentationMode.SECONDARY ? "snk-grid-container__without-shadow " : "") + "snk-grid__table", "data-element-id": "embedded", dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.gridConfigChangeHandler(evt); }, onEzDoubleClick: (evt) => this.gridDoubleClick.emit(evt.detail), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, columnfilterDataSource: this.columnFilterDataSource, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, recordsValidator: this.recordsValidator, canEdit: this.canEdit, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this.getGridHeaderButtons(), presentationMode: this.presentationMode, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.getActionsList(), primaryButton: this.getPrimaryButton(), resourceID: this.resourceID, customContainerId: this.taskbarCustomContainerId, customSlotId: this.gridHeaderCustomSlotId }, h("slot", { name: this.gridHeaderCustomSlotId }))), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" })), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this._gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resourceID }))));
|
|
538
546
|
}
|
|
539
547
|
get _element() { return this; }
|
|
540
548
|
static get watchers() { return {
|
|
@@ -566,6 +574,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
566
574
|
"autoLoad": [4, "auto-load"],
|
|
567
575
|
"autoFocus": [4, "auto-focus"],
|
|
568
576
|
"enableGridInsert": [4, "enable-grid-insert"],
|
|
577
|
+
"enableLockManger": [4, "enable-lock-manger"],
|
|
569
578
|
"_dataUnit": [32],
|
|
570
579
|
"_dataState": [32],
|
|
571
580
|
"_gridConfig": [32],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { UserInterface, StringUtils, ApplicationContext, ObjectUtils, DataType, JSUtils, FloatingManager, KeyboardManager, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { CSSVarsUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants.js';
|
|
5
5
|
import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
|
|
@@ -123,6 +123,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
123
123
|
this.mode = SIMPLE_CRUD_MODE.SERVER;
|
|
124
124
|
this.gridConfig = undefined;
|
|
125
125
|
this.formConfig = undefined;
|
|
126
|
+
this.enableLockManger = false;
|
|
126
127
|
this._formFields = [];
|
|
127
128
|
this._fieldsProps = new Map();
|
|
128
129
|
this._enableContinuousInsert = true;
|
|
@@ -422,6 +423,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
422
423
|
}
|
|
423
424
|
componentDidLoad() {
|
|
424
425
|
CSSVarsUtils.applyVarsGrid(this._element, this._grid);
|
|
426
|
+
this.initKeyboardManager();
|
|
425
427
|
}
|
|
426
428
|
setCustomRenders() {
|
|
427
429
|
if (!this._grid) {
|
|
@@ -726,9 +728,11 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
726
728
|
window.removeEventListener("keydown", this._keyDownHandler);
|
|
727
729
|
}
|
|
728
730
|
gridConfigChangeHandler(evt) {
|
|
731
|
+
evt.stopPropagation();
|
|
732
|
+
if (!this.configName)
|
|
733
|
+
return;
|
|
729
734
|
const config = evt.detail;
|
|
730
735
|
ConfigStorage.saveGridConfig(config, this.configName, this.resolveResourceID());
|
|
731
|
-
evt.stopPropagation();
|
|
732
736
|
}
|
|
733
737
|
modalConfigChangeHandler(evt) {
|
|
734
738
|
const config = evt.detail;
|
|
@@ -805,6 +809,37 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
805
809
|
return;
|
|
806
810
|
this.goToView(VIEW_MODE.FORM);
|
|
807
811
|
}
|
|
812
|
+
async initKeyboardManager() {
|
|
813
|
+
const keyboardManager = new KeyboardManager();
|
|
814
|
+
if (keyboardManager) {
|
|
815
|
+
const dataUnit = this.dataUnit || await this._snkDataUnit.getDataUnit();
|
|
816
|
+
async function saveDataUnitHandlingFocus() {
|
|
817
|
+
const element = document.activeElement;
|
|
818
|
+
const isDocumentBody = (element == document.body);
|
|
819
|
+
if (!isDocumentBody)
|
|
820
|
+
element.blur();
|
|
821
|
+
await dataUnit.saveData();
|
|
822
|
+
if (!isDocumentBody && element.setFocus != undefined) {
|
|
823
|
+
element.setFocus();
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
if (!isDocumentBody)
|
|
827
|
+
element.focus();
|
|
828
|
+
}
|
|
829
|
+
keyboardManager
|
|
830
|
+
.bind("F7", saveDataUnitHandlingFocus.bind(this), { description: "Salva os dados.", element: this._element })
|
|
831
|
+
.bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro.", element: this._element })
|
|
832
|
+
.bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado.", element: this._element })
|
|
833
|
+
.bind("Escape", () => {
|
|
834
|
+
if (dataUnit.isDirty()) {
|
|
835
|
+
dataUnit.cancelEdition();
|
|
836
|
+
}
|
|
837
|
+
}, {
|
|
838
|
+
debounceTime: 1000,
|
|
839
|
+
description: "Cancela uma ação.", element: this._element
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
}
|
|
808
843
|
renderTaskbarContent() {
|
|
809
844
|
var _a;
|
|
810
845
|
return (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
|
|
@@ -814,9 +849,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
814
849
|
if (this.dataUnit == undefined) {
|
|
815
850
|
return;
|
|
816
851
|
}
|
|
817
|
-
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID
|
|
852
|
+
return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
|
|
818
853
|
? undefined
|
|
819
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
854
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
|
|
820
855
|
}
|
|
821
856
|
get _element() { return this; }
|
|
822
857
|
static get watchers() { return {
|
|
@@ -835,6 +870,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
835
870
|
"mode": [2],
|
|
836
871
|
"gridConfig": [1040],
|
|
837
872
|
"formConfig": [1040],
|
|
873
|
+
"enableLockManger": [4, "enable-lock-manger"],
|
|
838
874
|
"multipleSelection": [4, "multiple-selection"],
|
|
839
875
|
"useCancelConfirm": [4, "use-cancel-confirm"],
|
|
840
876
|
"pageSize": [2, "page-size"],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, createEvent, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { Action, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { Action, LockManager, LockManagerOperation, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { A as AuthorizationConfig } from './AuthorizationConfig.js';
|
|
4
4
|
import { P as PresentationMode } from './ISave.js';
|
|
5
5
|
import { s as store } from './index2.js';
|
|
@@ -273,42 +273,44 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
273
273
|
return key ? (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, {}) : "";
|
|
274
274
|
}
|
|
275
275
|
elementClick(elem) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
this._isWaitingForSave
|
|
302
|
-
|
|
303
|
-
.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
276
|
+
LockManager.whenResolve(this._element, LockManagerOperation.TASKBAR_CLICK).then(() => {
|
|
277
|
+
if (this.dataUnit) {
|
|
278
|
+
switch (elem) {
|
|
279
|
+
case TaskbarElement.PREVIOUS:
|
|
280
|
+
this.dataUnit.previousRecord();
|
|
281
|
+
break;
|
|
282
|
+
case TaskbarElement.NEXT:
|
|
283
|
+
this.dataUnit.nextRecord();
|
|
284
|
+
break;
|
|
285
|
+
case TaskbarElement.REFRESH:
|
|
286
|
+
this.dataUnit.loadData();
|
|
287
|
+
break;
|
|
288
|
+
case TaskbarElement.CLONE:
|
|
289
|
+
this.dataUnit.copySelected();
|
|
290
|
+
break;
|
|
291
|
+
case TaskbarElement.REMOVE:
|
|
292
|
+
this.dataUnit.removeSelectedRecords();
|
|
293
|
+
break;
|
|
294
|
+
case TaskbarElement.INSERT:
|
|
295
|
+
this.dataUnit.addRecord();
|
|
296
|
+
break;
|
|
297
|
+
case TaskbarElement.CANCEL:
|
|
298
|
+
this.dataUnit.cancelEdition();
|
|
299
|
+
break;
|
|
300
|
+
case TaskbarElement.SAVE:
|
|
301
|
+
if (!this._isWaitingForSave) {
|
|
302
|
+
this._isWaitingForSave = true;
|
|
303
|
+
this.dataUnit.saveData()
|
|
304
|
+
.finally(() => {
|
|
305
|
+
this._isWaitingForSave = false;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
308
310
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
311
|
+
if (this.isEnabled(elem))
|
|
312
|
+
this.actionClick.emit(elem);
|
|
313
|
+
});
|
|
312
314
|
}
|
|
313
315
|
isEnabled(elem) {
|
|
314
316
|
if (!this.isAllowed(elem)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-
|
|
1
|
+
import { R as ResourceFetcher, F as FormConfigFetcher } from './form-config-fetcher-a7d3e277.js';
|
|
2
2
|
import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
|
|
3
3
|
import { ObjectUtils } from '@sankhyalabs/core';
|
|
4
|
-
import { d as dist, D as DataFetcher } from './DataFetcher-
|
|
4
|
+
import { d as dist, D as DataFetcher } from './DataFetcher-5034df59.js';
|
|
5
5
|
|
|
6
6
|
class GridConfigFetcher extends ResourceFetcher {
|
|
7
7
|
constructor() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { D as DataFetcher } from './DataFetcher-
|
|
2
|
-
import './pesquisa-fetcher-
|
|
1
|
+
import { D as DataFetcher } from './DataFetcher-5034df59.js';
|
|
2
|
+
import './pesquisa-fetcher-6bc2e41a.js';
|
|
3
3
|
import { SortMode, ApplicationContext, UserInterface, DateUtils, ObjectUtils, StringUtils, NumberUtils, DataType } from '@sankhyalabs/core';
|
|
4
4
|
import './index-3aa4977a.js';
|
|
5
5
|
import './ISave-d8c8bc59.js';
|
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
7
7
|
import { UserInterface as UserInterface$1 } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
8
|
-
import { P as PreloadManager } from './dataunit-fetcher-
|
|
8
|
+
import { P as PreloadManager } from './dataunit-fetcher-56cb648b.js';
|
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
|
10
|
-
import './form-config-fetcher-
|
|
10
|
+
import './form-config-fetcher-a7d3e277.js';
|
|
11
11
|
import InMemoryFilterColumnDataSource from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource';
|
|
12
12
|
import { h } from './index-a7d3d3f1.js';
|
|
13
13
|
|
|
@@ -24,6 +24,28 @@ class CrudUtils {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
static parseCrudResults(entities, onlyFirst) {
|
|
28
|
+
if (!Array.isArray(entities)) {
|
|
29
|
+
entities = [entities];
|
|
30
|
+
}
|
|
31
|
+
const crudFindResults = [];
|
|
32
|
+
for (const entity of entities) {
|
|
33
|
+
let crudFindResult = {
|
|
34
|
+
fields: new Map()
|
|
35
|
+
};
|
|
36
|
+
for (let key in entity) {
|
|
37
|
+
let fieldValue = entity[key];
|
|
38
|
+
if (fieldValue.hasOwnProperty('$')) {
|
|
39
|
+
crudFindResult.fields.set(key, fieldValue.$);
|
|
40
|
+
}
|
|
41
|
+
if (onlyFirst) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
crudFindResults.push(crudFindResult);
|
|
46
|
+
}
|
|
47
|
+
return crudFindResults.length > 1 ? crudFindResults : crudFindResults[0];
|
|
48
|
+
}
|
|
27
49
|
static find(entityName, fields, criteria, onlyFirst = true, criteriaExpression, orderBy) {
|
|
28
50
|
const SERVICE_CRUD_FIND = "mge@crud.find";
|
|
29
51
|
let parsedFields = [];
|
|
@@ -71,24 +93,11 @@ class CrudUtils {
|
|
|
71
93
|
DataFetcher.get().callServiceBroker(SERVICE_CRUD_FIND, JSON.stringify(request)).then((result) => {
|
|
72
94
|
var _a;
|
|
73
95
|
let entities = (_a = result.entidades) === null || _a === void 0 ? void 0 : _a.entidade;
|
|
74
|
-
if (entities
|
|
75
|
-
let crudFindResult = {
|
|
76
|
-
fields: new Map()
|
|
77
|
-
};
|
|
78
|
-
for (let key in entities) {
|
|
79
|
-
let fieldValue = entities[key];
|
|
80
|
-
if (fieldValue.hasOwnProperty('$')) {
|
|
81
|
-
crudFindResult.fields.set(key, fieldValue.$);
|
|
82
|
-
}
|
|
83
|
-
if (onlyFirst) {
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
resolve(crudFindResult);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
96
|
+
if (!entities) {
|
|
90
97
|
resolve(null);
|
|
91
98
|
}
|
|
99
|
+
const crudFindResults = this.parseCrudResults(entities, onlyFirst);
|
|
100
|
+
resolve(crudFindResults);
|
|
92
101
|
});
|
|
93
102
|
});
|
|
94
103
|
}
|
|
@@ -6777,7 +6777,8 @@ class DataFetcher {
|
|
|
6777
6777
|
}
|
|
6778
6778
|
payloadJson['requestBody']['clientEventList'].clientEvent.push({ $: key });
|
|
6779
6779
|
}
|
|
6780
|
-
|
|
6780
|
+
const requestId = StringUtils.generateUUID();
|
|
6781
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url: url, requestBody: payload, requestId }));
|
|
6781
6782
|
http.open("POST", url, true);
|
|
6782
6783
|
http.withCredentials = true;
|
|
6783
6784
|
http.send(ObjectUtils.objectToString(payloadJson));
|
|
@@ -6817,7 +6818,7 @@ class DataFetcher {
|
|
|
6817
6818
|
else if (http.readyState == 4 && http.status != 200) {
|
|
6818
6819
|
reject(new ErrorException(`Erro ao executar serviço: ${serviceName}`, http.responseText));
|
|
6819
6820
|
}
|
|
6820
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload }));
|
|
6821
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url: url, requestBody: payload, requestId }));
|
|
6821
6822
|
};
|
|
6822
6823
|
});
|
|
6823
6824
|
}
|
|
@@ -6922,7 +6923,8 @@ class DataFetcher {
|
|
|
6922
6923
|
const errorsResponse = [];
|
|
6923
6924
|
const responseExtensions = [];
|
|
6924
6925
|
const url = this.buildGraphQlURL(quietMode);
|
|
6925
|
-
|
|
6926
|
+
const requestId = StringUtils.generateUUID();
|
|
6927
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestStart({ url, requestBody: request, requestId }));
|
|
6926
6928
|
try {
|
|
6927
6929
|
const response = await dist.batchRequests(url, request, { 'Content-Type': `application/json; charset=${window['SERVER_ENCODING'] || 'UTF-8'}` });
|
|
6928
6930
|
response.forEach((resItem, index) => {
|
|
@@ -6956,11 +6958,11 @@ class DataFetcher {
|
|
|
6956
6958
|
});
|
|
6957
6959
|
}
|
|
6958
6960
|
else {
|
|
6959
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
|
|
6961
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
|
|
6960
6962
|
throw new ErrorException("Falha de comunicação", err.message);
|
|
6961
6963
|
}
|
|
6962
6964
|
}
|
|
6963
|
-
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request }));
|
|
6965
|
+
DataFetcher.requestListener.forEach(listener => listener.onRequestEnd({ url, requestBody: request, requestId }));
|
|
6964
6966
|
return { data: dataResponse, errors: errorsResponse, extensions: responseExtensions };
|
|
6965
6967
|
}
|
|
6966
6968
|
isHttpError(err) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
|
1
|
+
import { C as ConfigStorage } from './ConfigStorage-6514d66e.js';
|
|
2
2
|
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
3
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
|
4
|
-
import {
|
|
3
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-a7d3e277.js';
|
|
4
|
+
import { b as TAB_NAMES } from './constants-7302ee87.js';
|
|
5
5
|
|
|
6
6
|
class SnkFormConfigManager {
|
|
7
7
|
constructor(configName, resourceID, onConfigChange, dataUnit) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectUtils } from '@sankhyalabs/core';
|
|
2
|
-
import { R as ResourceFetcher } from './form-config-fetcher-
|
|
2
|
+
import { R as ResourceFetcher } from './form-config-fetcher-a7d3e277.js';
|
|
3
3
|
|
|
4
4
|
class AuthFetcher extends ResourceFetcher {
|
|
5
5
|
getData(resourceID) {
|
|
@@ -90,4 +90,4 @@ var SIMPLE_CRUD_MODE;
|
|
|
90
90
|
SIMPLE_CRUD_MODE[SIMPLE_CRUD_MODE["IN_MEMORY"] = 1] = "IN_MEMORY";
|
|
91
91
|
})(SIMPLE_CRUD_MODE || (SIMPLE_CRUD_MODE = {}));
|
|
92
92
|
|
|
93
|
-
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S,
|
|
93
|
+
export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, ORDER_VALUES as O, REPORT_LAUNCHER_RESOURCE_ID as R, SIMPLE_CRUD_MODE as S, TYPE_ACTIONS as T, VIEW_MODE as V, CONFIG_SORTABLE_EVENTS as a, TAB_NAMES as b, VARS_BY_TYPE as c, TAGS_BY_TYPE as d };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectUtils, DataUnit, DataType, DateUtils, StringUtils, ChangeOperation, ApplicationContext, UserInterface, DataUnitStorage } from '@sankhyalabs/core';
|
|
2
|
-
import { D as DataFetcher, d as dist } from './DataFetcher-
|
|
2
|
+
import { D as DataFetcher, d as dist } from './DataFetcher-5034df59.js';
|
|
3
3
|
import { DISTINCT_FILTER_NAME_PREFIX } from '@sankhyalabs/ezui/dist/collection/utils/constants';
|
|
4
4
|
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
|
5
5
|
import { ColumnFilterManager } from '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
|
@@ -712,7 +712,7 @@ class DataUnitDataLoader {
|
|
|
712
712
|
}
|
|
713
713
|
const count = loadingInfo.count;
|
|
714
714
|
if (loadingInfo.loadingInProgress) {
|
|
715
|
-
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count }));
|
|
715
|
+
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { count, loadingInProgress: true }));
|
|
716
716
|
return;
|
|
717
717
|
}
|
|
718
718
|
if (loadingInfo.needReload) {
|
|
@@ -720,7 +720,7 @@ class DataUnitDataLoader {
|
|
|
720
720
|
dataUnit.gotoPage(0);
|
|
721
721
|
return;
|
|
722
722
|
}
|
|
723
|
-
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count }));
|
|
723
|
+
dataUnit.updatePagination(Object.assign(Object.assign({}, dataUnitPagination), { total: count, count, loadingInProgress: false }));
|
|
724
724
|
}
|
|
725
725
|
static registryLoading(dataUnit, loadingInfo) {
|
|
726
726
|
if (loadingInfo == undefined) {
|
|
@@ -2034,18 +2034,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2034
2034
|
return import(
|
|
2035
2035
|
/* webpackMode: "lazy" */
|
|
2036
2036
|
'./snk-application.entry.js').then(processMod, consoleError);
|
|
2037
|
-
case 'snk-form':
|
|
2038
|
-
return import(
|
|
2039
|
-
/* webpackMode: "lazy" */
|
|
2040
|
-
'./snk-form.entry.js').then(processMod, consoleError);
|
|
2041
|
-
case 'snk-form-config':
|
|
2042
|
-
return import(
|
|
2043
|
-
/* webpackMode: "lazy" */
|
|
2044
|
-
'./snk-form-config.entry.js').then(processMod, consoleError);
|
|
2045
|
-
case 'snk-config-options':
|
|
2046
|
-
return import(
|
|
2047
|
-
/* webpackMode: "lazy" */
|
|
2048
|
-
'./snk-config-options.entry.js').then(processMod, consoleError);
|
|
2049
2037
|
case 'snk-tab-config':
|
|
2050
2038
|
return import(
|
|
2051
2039
|
/* webpackMode: "lazy" */
|
|
@@ -2086,22 +2074,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2086
2074
|
return import(
|
|
2087
2075
|
/* webpackMode: "lazy" */
|
|
2088
2076
|
'./snk-data-unit.entry.js').then(processMod, consoleError);
|
|
2089
|
-
case 'snk-filter-bar':
|
|
2090
|
-
return import(
|
|
2091
|
-
/* webpackMode: "lazy" */
|
|
2092
|
-
'./snk-filter-bar.entry.js').then(processMod, consoleError);
|
|
2093
|
-
case 'snk-filter-item':
|
|
2094
|
-
return import(
|
|
2095
|
-
/* webpackMode: "lazy" */
|
|
2096
|
-
'./snk-filter-item.entry.js').then(processMod, consoleError);
|
|
2097
|
-
case 'snk-filter-list':
|
|
2098
|
-
return import(
|
|
2099
|
-
/* webpackMode: "lazy" */
|
|
2100
|
-
'./snk-filter-list.entry.js').then(processMod, consoleError);
|
|
2101
|
-
case 'snk-filter-modal':
|
|
2102
|
-
return import(
|
|
2103
|
-
/* webpackMode: "lazy" */
|
|
2104
|
-
'./snk-filter-modal.entry.js').then(processMod, consoleError);
|
|
2105
2077
|
case 'snk-field-config':
|
|
2106
2078
|
return import(
|
|
2107
2079
|
/* webpackMode: "lazy" */
|
|
@@ -2118,6 +2090,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2118
2090
|
return import(
|
|
2119
2091
|
/* webpackMode: "lazy" */
|
|
2120
2092
|
'./snk-taskbar.entry.js').then(processMod, consoleError);
|
|
2093
|
+
case 'snk-config-options_3':
|
|
2094
|
+
return import(
|
|
2095
|
+
/* webpackMode: "lazy" */
|
|
2096
|
+
'./snk-config-options_3.entry.js').then(processMod, consoleError);
|
|
2097
|
+
case 'snk-filter-bar_4':
|
|
2098
|
+
return import(
|
|
2099
|
+
/* webpackMode: "lazy" */
|
|
2100
|
+
'./snk-filter-bar_4.entry.js').then(processMod, consoleError);
|
|
2121
2101
|
case 'snk-actions-form':
|
|
2122
2102
|
return import(
|
|
2123
2103
|
/* webpackMode: "lazy" */
|