@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-48463.1 → 0.0.0-bugfix-dev-KB-49699.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-d4c99a5e.js → ConfigStorage-34be11ce.js} +68 -5
- package/dist/cjs/{SnkFormConfigManager-0ffd098d.js → SnkFormConfigManager-6211fb28.js} +6 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +8 -2
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +5 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
- package/dist/cjs/snk-filter-bar.cjs.entry.js +8 -1
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +1 -1
- package/dist/cjs/snk-form.cjs.entry.js +9 -2
- package/dist/cjs/snk-grid.cjs.entry.js +12 -3
- package/dist/cjs/{snk-guides-viewer-c7293cfa.js → snk-guides-viewer-508bb6fe.js} +9 -2
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +1 -1
- package/dist/cjs/snk-simple-crud.cjs.entry.js +70 -11
- package/dist/cjs/snk-taskbar.cjs.entry.js +12 -10
- package/dist/cjs/{taskbar-elements-1e4fb2e0.js → taskbar-elements-3ecd1278.js} +1 -1
- package/dist/collection/components/snk-application/snk-application.js +42 -2
- package/dist/collection/components/snk-crud/snk-crud.js +55 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +24 -0
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +24 -0
- package/dist/collection/components/snk-form/snk-form.js +24 -0
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -1
- package/dist/collection/components/snk-grid/snk-grid.js +44 -1
- package/dist/collection/components/snk-simple-crud/regular-buttons.js +3 -0
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +120 -7
- package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +1 -1
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +12 -8
- package/dist/collection/lib/configs/ConfigStorage.js +63 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +6 -3
- package/dist/components/ConfigStorage.js +68 -5
- package/dist/components/SnkFormConfigManager.js +5 -0
- package/dist/components/snk-application2.js +9 -1
- package/dist/components/snk-crud.js +7 -1
- package/dist/components/snk-detail-view2.js +8 -0
- package/dist/components/snk-filter-bar2.js +8 -0
- package/dist/components/snk-form.js +8 -0
- package/dist/components/snk-grid2.js +12 -1
- package/dist/components/snk-simple-crud2.js +70 -8
- package/dist/components/snk-taskbar2.js +12 -10
- package/dist/esm/{ConfigStorage-39ed8aeb.js → ConfigStorage-101a2b4c.js} +68 -5
- package/dist/esm/{SnkFormConfigManager-dd450734.js → SnkFormConfigManager-d86ba46f.js} +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +8 -2
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +5 -2
- package/dist/esm/snk-detail-view.entry.js +4 -4
- package/dist/esm/snk-filter-bar.entry.js +8 -1
- package/dist/esm/snk-filter-modal-item.entry.js +1 -1
- package/dist/esm/snk-form.entry.js +9 -2
- package/dist/esm/snk-grid.entry.js +12 -3
- package/dist/esm/{snk-guides-viewer-47443f7c.js → snk-guides-viewer-18859840.js} +9 -2
- package/dist/esm/snk-guides-viewer.entry.js +4 -4
- package/dist/esm/snk-personalized-filter.entry.js +1 -1
- package/dist/esm/snk-simple-crud.entry.js +70 -11
- package/dist/esm/snk-taskbar.entry.js +12 -10
- package/dist/esm/{taskbar-elements-846c027c.js → taskbar-elements-2473c8ac.js} +1 -1
- package/dist/sankhyablocks/p-1f3174cb.entry.js +1 -0
- package/dist/sankhyablocks/p-1fa5a18c.entry.js +11 -0
- package/dist/sankhyablocks/p-5c0b53ce.js +56 -0
- package/dist/sankhyablocks/p-5dbc1a3f.js +1 -0
- package/dist/sankhyablocks/p-60fa6c7a.js +1 -0
- package/dist/sankhyablocks/p-64c1b368.entry.js +1 -0
- package/dist/sankhyablocks/p-650f7216.entry.js +1 -0
- package/dist/sankhyablocks/{p-9d608b62.entry.js → p-6b28cc74.entry.js} +1 -1
- package/dist/sankhyablocks/{p-827e4b01.entry.js → p-7ddd95b6.entry.js} +1 -1
- package/dist/sankhyablocks/p-ae4fc9a9.js +1 -0
- package/dist/sankhyablocks/{p-9fb97691.entry.js → p-b41a622a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0c9dd95e.entry.js → p-b4de81ac.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3c5b7cfc.entry.js → p-ba4871b5.entry.js} +1 -1
- package/dist/sankhyablocks/p-d01ceda6.entry.js +1 -0
- package/dist/sankhyablocks/p-d304659d.entry.js +1 -0
- package/dist/sankhyablocks/{p-99b1926b.entry.js → p-e4fb3308.entry.js} +1 -1
- package/dist/sankhyablocks/p-fbfab20b.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +8 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +12 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +5 -0
- package/dist/types/components/snk-form/snk-form.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -0
- package/dist/types/components/snk-grid/snk-grid.d.ts +9 -0
- package/dist/types/components/snk-simple-crud/regular-buttons.d.ts +3 -0
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +19 -2
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
- package/dist/types/components.d.ts +104 -0
- package/dist/types/lib/configs/ConfigStorage.d.ts +21 -1
- package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +2 -1
- package/package.json +1 -1
- package/dist/sankhyablocks/p-30735d1e.entry.js +0 -1
- package/dist/sankhyablocks/p-3e2e2424.entry.js +0 -1
- package/dist/sankhyablocks/p-67aedbe0.js +0 -56
- package/dist/sankhyablocks/p-6ae58da0.js +0 -1
- package/dist/sankhyablocks/p-746fc99e.entry.js +0 -1
- package/dist/sankhyablocks/p-8c13d8d6.entry.js +0 -1
- package/dist/sankhyablocks/p-8c49760e.js +0 -1
- package/dist/sankhyablocks/p-9ea14b61.js +0 -1
- package/dist/sankhyablocks/p-c4bcdd4b.entry.js +0 -11
- package/dist/sankhyablocks/p-fca66dda.entry.js +0 -1
- package/dist/sankhyablocks/p-fd216f2e.entry.js +0 -1
|
@@ -232,7 +232,7 @@ class PersonalizedFilterFetcher {
|
|
|
232
232
|
assistent
|
|
233
233
|
}
|
|
234
234
|
}`);
|
|
235
|
-
this.templateByQuery.set("savePersonalizedFilter", dist.gql `
|
|
235
|
+
this.templateByQuery.set("savePersonalizedFilter", dist.gql `
|
|
236
236
|
mutation($name: String!, $filterAssistent: InputFilterAssistent!) {
|
|
237
237
|
$queryAlias$: savePersonalizedFilter(name: $name, filterAssistent: $filterAssistent) {
|
|
238
238
|
id
|
|
@@ -254,11 +254,11 @@ class PersonalizedFilterFetcher {
|
|
|
254
254
|
}
|
|
255
255
|
}`);
|
|
256
256
|
}
|
|
257
|
-
async loadPersonalizedFilter(resourceID, filterID, configName) {
|
|
257
|
+
async loadPersonalizedFilter(resourceID, filterID, configName, legacyConfigName) {
|
|
258
258
|
return new Promise((resolve, reject) => {
|
|
259
259
|
DataFetcher.get()
|
|
260
260
|
.callGraphQL({
|
|
261
|
-
values: { name: this.resolveURI(resourceID, configName) + "/" + filterID },
|
|
261
|
+
values: { name: this.resolveURI(resourceID, configName) + "/" + filterID + this.resolveLegacyConfigName(legacyConfigName) },
|
|
262
262
|
query: this.templateByQuery.get("fetchFilterAssistent"),
|
|
263
263
|
})
|
|
264
264
|
.then((resp) => {
|
|
@@ -270,6 +270,9 @@ class PersonalizedFilterFetcher {
|
|
|
270
270
|
});
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
|
+
resolveLegacyConfigName(legacyConfigName) {
|
|
274
|
+
return legacyConfigName ? `?legacyResourceID=${legacyConfigName}` : '';
|
|
275
|
+
}
|
|
273
276
|
async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
|
274
277
|
if (!personalizedFilter || Object.keys(personalizedFilter).length == 0) {
|
|
275
278
|
return Promise.reject(new Error("personalizedFilter não pode ser vazio"));
|
|
@@ -358,11 +361,30 @@ var CONFIG_SOURCE;
|
|
|
358
361
|
CONFIG_SOURCE["filterBar"] = "filterBar";
|
|
359
362
|
})(CONFIG_SOURCE || (CONFIG_SOURCE = {}));
|
|
360
363
|
class ConfigStorage {
|
|
361
|
-
static
|
|
364
|
+
static addFilterBarLegacyConfig(configName, legacyConfigName) {
|
|
365
|
+
this.validateConfigName(configName, legacyConfigName);
|
|
366
|
+
this.filterBarLegacyConfig.set(configName, legacyConfigName);
|
|
367
|
+
}
|
|
368
|
+
static addFormLegacyConfig(configName, legacyConfigName) {
|
|
369
|
+
this.validateConfigName(configName, legacyConfigName);
|
|
370
|
+
this.formLegacyConfig.set(configName, legacyConfigName);
|
|
371
|
+
}
|
|
372
|
+
static addGridLegacyConfig(configName, legacyConfigName) {
|
|
373
|
+
this.validateConfigName(configName, legacyConfigName);
|
|
374
|
+
this.gridLegacyConfig.set(configName, legacyConfigName);
|
|
375
|
+
}
|
|
376
|
+
static preload(resourceID, configName, legacyConfigs) {
|
|
377
|
+
if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.gridLegacyConfig)) {
|
|
378
|
+
ConfigStorage.addGridLegacyConfig(configName, legacyConfigs.gridLegacyConfig);
|
|
379
|
+
}
|
|
380
|
+
if (configName && (legacyConfigs === null || legacyConfigs === void 0 ? void 0 : legacyConfigs.formLegacyConfig)) {
|
|
381
|
+
ConfigStorage.addFormLegacyConfig(configName, legacyConfigs.formLegacyConfig);
|
|
382
|
+
}
|
|
362
383
|
ConfigStorage.loadFormConfig(configName, resourceID);
|
|
363
384
|
ConfigStorage.loadGridConfig(configName, resourceID);
|
|
364
385
|
}
|
|
365
386
|
static async loadFilterBarConfig(name, resourceID, urlParams) {
|
|
387
|
+
urlParams = this.handleLegacyConfig(name, CONFIG_SOURCE.filterBar, urlParams);
|
|
366
388
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.filterBar, resourceID);
|
|
367
389
|
if (!ConfigStorage.configById.has(cacheID)) {
|
|
368
390
|
ConfigStorage.configById.set(cacheID, ConfigStorage.filterBarConfigFetcher.getConfig(resourceID, name, urlParams));
|
|
@@ -370,6 +392,7 @@ class ConfigStorage {
|
|
|
370
392
|
return ConfigStorage.configById.get(cacheID);
|
|
371
393
|
}
|
|
372
394
|
static async loadFormConfig(name, resourceID) {
|
|
395
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
|
|
373
396
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.form, resourceID);
|
|
374
397
|
if (!ConfigStorage.configById.has(cacheID)) {
|
|
375
398
|
ConfigStorage.configById.set(cacheID, ConfigStorage.formConfigFetcher.loadFormConfig(name, resourceID));
|
|
@@ -377,6 +400,7 @@ class ConfigStorage {
|
|
|
377
400
|
return ConfigStorage.configById.get(cacheID);
|
|
378
401
|
}
|
|
379
402
|
static async loadGridConfig(name, resourceID) {
|
|
403
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.grid);
|
|
380
404
|
const cacheID = ConfigStorage.buildCacheID(name, CONFIG_SOURCE.grid, resourceID);
|
|
381
405
|
if (!ConfigStorage.configById.has(cacheID)) {
|
|
382
406
|
ConfigStorage.configById.set(cacheID, ConfigStorage.gridConfigFetcher.getConfig(name, resourceID));
|
|
@@ -388,6 +412,7 @@ class ConfigStorage {
|
|
|
388
412
|
return this.filterBarConfigFetcher.saveConfig(config, resourceID, name);
|
|
389
413
|
}
|
|
390
414
|
static async saveFormConfig(config, name, resourceID) {
|
|
415
|
+
name = this.handleLegacyConfigAsString(name, CONFIG_SOURCE.form);
|
|
391
416
|
await this.deleteFormConfigCache(name, resourceID);
|
|
392
417
|
return this.formConfigFetcher.saveConfig(config, name, resourceID);
|
|
393
418
|
}
|
|
@@ -402,7 +427,8 @@ class ConfigStorage {
|
|
|
402
427
|
return this.gridConfigFetcher.saveConfig(config, name, resourceID);
|
|
403
428
|
}
|
|
404
429
|
static async loadPersonalizedFilter(filterId, resourceID, configName) {
|
|
405
|
-
|
|
430
|
+
const legacyConfigName = this.filterBarLegacyConfig.get(configName);
|
|
431
|
+
return this.personalizedFilterFetcher.loadPersonalizedFilter(resourceID, filterId, configName, legacyConfigName);
|
|
406
432
|
}
|
|
407
433
|
static async savePersonalizedFilter(personalizedFilter, resourceID, configName) {
|
|
408
434
|
//Ao criar ou alterar um filtro personalizado,
|
|
@@ -425,6 +451,38 @@ class ConfigStorage {
|
|
|
425
451
|
static async deleteFilterBarConfigCache(name, resourceID) {
|
|
426
452
|
await this.deleteConfigCache(name, resourceID, CONFIG_SOURCE.filterBar);
|
|
427
453
|
}
|
|
454
|
+
static validateConfigName(configName, legacyConfigName) {
|
|
455
|
+
if (!configName)
|
|
456
|
+
throw Error(this.CONFIG_NAME_ERROR_MESSAGE);
|
|
457
|
+
if (!legacyConfigName)
|
|
458
|
+
throw Error(this.LEGACY_CONFIG_NAME_ERROR_MESSAGE);
|
|
459
|
+
}
|
|
460
|
+
static handleLegacyConfig(configName, configSource, urlParams) {
|
|
461
|
+
let legacyConfigName;
|
|
462
|
+
switch (configSource) {
|
|
463
|
+
case CONFIG_SOURCE.filterBar:
|
|
464
|
+
legacyConfigName = this.filterBarLegacyConfig.get(configName);
|
|
465
|
+
break;
|
|
466
|
+
case CONFIG_SOURCE.grid:
|
|
467
|
+
legacyConfigName = this.gridLegacyConfig.get(configName);
|
|
468
|
+
break;
|
|
469
|
+
case CONFIG_SOURCE.form:
|
|
470
|
+
legacyConfigName = this.formLegacyConfig.get(configName);
|
|
471
|
+
}
|
|
472
|
+
const params = urlParams ? Object.assign({}, urlParams) : {};
|
|
473
|
+
if (legacyConfigName) {
|
|
474
|
+
params['legacyResourceID'] = legacyConfigName;
|
|
475
|
+
}
|
|
476
|
+
return params;
|
|
477
|
+
}
|
|
478
|
+
static handleLegacyConfigAsString(name, source) {
|
|
479
|
+
const params = this.handleLegacyConfig(name, source);
|
|
480
|
+
const legacyResourceID = params['legacyResourceID'];
|
|
481
|
+
if (legacyResourceID) {
|
|
482
|
+
name = name + `?legacyResourceID=${legacyResourceID}`;
|
|
483
|
+
}
|
|
484
|
+
return name;
|
|
485
|
+
}
|
|
428
486
|
static async deleteConfigCache(name, resourceID, source) {
|
|
429
487
|
const cacheID = ConfigStorage.buildCacheID(name, source, resourceID);
|
|
430
488
|
this.configById.delete(cacheID);
|
|
@@ -436,6 +494,11 @@ class ConfigStorage {
|
|
|
436
494
|
return `req_${source}_${name}_${resourceID}`;
|
|
437
495
|
}
|
|
438
496
|
}
|
|
497
|
+
ConfigStorage.CONFIG_NAME_ERROR_MESSAGE = "ConfigName precisa ser informado.";
|
|
498
|
+
ConfigStorage.LEGACY_CONFIG_NAME_ERROR_MESSAGE = "LegacyConfigName precisa ser informado.";
|
|
499
|
+
ConfigStorage.filterBarLegacyConfig = new Map();
|
|
500
|
+
ConfigStorage.formLegacyConfig = new Map();
|
|
501
|
+
ConfigStorage.gridLegacyConfig = new Map();
|
|
439
502
|
ConfigStorage.configById = new Map();
|
|
440
503
|
ConfigStorage.filterBarConfigFetcher = new FilterBarConfigFetcher();
|
|
441
504
|
ConfigStorage.formConfigFetcher = new FormConfigFetcher();
|
|
@@ -8,6 +8,11 @@ class SnkFormConfigManager {
|
|
|
8
8
|
this._configName = configName;
|
|
9
9
|
this._onConfigChange = onConfigChange;
|
|
10
10
|
}
|
|
11
|
+
addFormLegacyConfig(legacyConfigName) {
|
|
12
|
+
if (this._configName) {
|
|
13
|
+
ConfigStorage.addFormLegacyConfig(this._configName, legacyConfigName);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
11
16
|
async loadConfig() {
|
|
12
17
|
return new Promise(resolve => {
|
|
13
18
|
ConfigStorage.loadFormConfig(this._configName, this._resourceID)
|
|
@@ -292,6 +292,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
292
292
|
this._isLoadedByPk = false;
|
|
293
293
|
this.messagesBuilder = undefined;
|
|
294
294
|
this.configName = undefined;
|
|
295
|
+
this.gridLegacyConfigName = undefined;
|
|
296
|
+
this.formLegacyConfigName = undefined;
|
|
295
297
|
this.loadByPK = undefined;
|
|
296
298
|
}
|
|
297
299
|
async processPendingActions(actionsLocker) {
|
|
@@ -1198,7 +1200,11 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1198
1200
|
ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
|
|
1199
1201
|
this.registerPkChangeListener();
|
|
1200
1202
|
ErrorTracking.init();
|
|
1201
|
-
|
|
1203
|
+
let legacyConfig = {
|
|
1204
|
+
gridLegacyConfig: this.gridLegacyConfigName,
|
|
1205
|
+
formLegacyConfig: this.formLegacyConfigName
|
|
1206
|
+
};
|
|
1207
|
+
ConfigStorage.preload(this.applicationResourceID, this.configName, legacyConfig);
|
|
1202
1208
|
document.addEventListener("click", () => Workspace.applicationClick());
|
|
1203
1209
|
this._waitingAppReady.forEach(resolve => resolve());
|
|
1204
1210
|
}
|
|
@@ -1241,6 +1247,8 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
1241
1247
|
}, [2, "snk-application", {
|
|
1242
1248
|
"messagesBuilder": [1040],
|
|
1243
1249
|
"configName": [1, "config-name"],
|
|
1250
|
+
"gridLegacyConfigName": [1, "grid-legacy-config-name"],
|
|
1251
|
+
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
1244
1252
|
"loadByPK": [16],
|
|
1245
1253
|
"getKeyboardManager": [64],
|
|
1246
1254
|
"isUserSup": [64],
|
|
@@ -70,6 +70,9 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
70
70
|
this.presentationMode = PresentationMode.PRIMARY;
|
|
71
71
|
this.messagesBuilder = undefined;
|
|
72
72
|
this.useEnterLikeTab = false;
|
|
73
|
+
this.gridLegacyConfigName = undefined;
|
|
74
|
+
this.filterBarLegacyConfigName = undefined;
|
|
75
|
+
this.formLegacyConfigName = undefined;
|
|
73
76
|
this.disablePersonalizedFilter = undefined;
|
|
74
77
|
this.customContainerId = `SNK-CRUD-CUSTOM-CONTAINER-${StringUtils.generateUUID()}`;
|
|
75
78
|
}
|
|
@@ -321,7 +324,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
321
324
|
return;
|
|
322
325
|
}
|
|
323
326
|
this._snkDataUnit.ignoreSaveMessage = this._currentViewMode === VIEW_MODE.GRID;
|
|
324
|
-
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
327
|
+
return (h(Host, null, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "crud" }, h("stack-item", null, h("snk-grid", { ref: (ref) => this._snkGrid = ref, filterBarTitle: this.filterBarTitle, "data-element-id": "crud_grid", configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), messagesBuilder: this.messagesBuilder, actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection, presentationMode: this.presentationMode, recordsValidator: this.recordsValidator, selectionToastConfig: this.selectionToastConfig, useEnterLikeTab: this.useEnterLikeTab, canEdit: this._canEdit, resourceID: this._resourceID, disablePersonalizedFilter: this.disablePersonalizedFilter, gridLegacyConfigName: this.gridLegacyConfigName, filterBarLegacyConfigName: this.filterBarLegacyConfigName }, h("slot", { name: "GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-guides-viewer", { ref: ref => this._guidesViewer = ref, entityPath: this._snkDataUnit.entityName, messagesBuilder: this.messagesBuilder, onExit: () => this.setViewMode(VIEW_MODE.GRID), dataState: this._dataState, dataUnit: this._dataUnit, actionsList: this.actionsList, taskbarManager: this.taskbarManager, configName: this.configName, onActionClick: evt => this.executeAction(evt.detail), presentationMode: this.presentationMode, "data-element-id": "crud_form", canEdit: this._canEdit, recordsValidator: this.recordsValidator, resourceID: this._resourceID, detailTaskbarCustomContainerId: this.customContainerId, formLegacyConfigName: this.formLegacyConfigName }, h("slot", { name: "GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "SnkFormTaskBar" }))), h("stack-item", null, h("snk-attach", { registerKey: this.attachmentRegisterKey, messagesBuilder: this.messagesBuilder, entityName: this._snkDataUnit.entityName, onBack: this.backView.bind(this) })), h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.setViewMode(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showActionButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this._resourceID, customContainerId: this.customContainerId })), h("div", { id: `${this.customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }), h("slot", { name: "DETAIL_GRID_HEADER_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS" }), h("slot", { name: "DETAIL_TASKBAR_CUSTOM_ELEMENTS" }))));
|
|
325
328
|
}
|
|
326
329
|
get _element() { return this; }
|
|
327
330
|
static get watchers() { return {
|
|
@@ -341,6 +344,9 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
341
344
|
"presentationMode": [1, "presentation-mode"],
|
|
342
345
|
"messagesBuilder": [1040],
|
|
343
346
|
"useEnterLikeTab": [4, "use-enter-like-tab"],
|
|
347
|
+
"gridLegacyConfigName": [1, "grid-legacy-config-name"],
|
|
348
|
+
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
349
|
+
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
344
350
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
345
351
|
"_dataUnit": [32],
|
|
346
352
|
"_dataState": [32],
|
|
@@ -68,6 +68,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
68
68
|
this.presentationMode = undefined;
|
|
69
69
|
this.resourceID = undefined;
|
|
70
70
|
this.detailTaskbarCustomContainerId = undefined;
|
|
71
|
+
this.formLegacyConfigName = undefined;
|
|
71
72
|
this._hasToCreateFieldSearch = true;
|
|
72
73
|
this._breadcrumbItems = [];
|
|
73
74
|
this._guides = undefined;
|
|
@@ -365,11 +366,17 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
365
366
|
var _a;
|
|
366
367
|
return this.selectedGuide === undefined || '__main' === ((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id);
|
|
367
368
|
}
|
|
369
|
+
addFormLegacyConfigName() {
|
|
370
|
+
if (this.formLegacyConfigName) {
|
|
371
|
+
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
368
374
|
componentWillLoad() {
|
|
369
375
|
if (this.resourceID == undefined) {
|
|
370
376
|
throw new Error("Erro interno: resourceID não informado");
|
|
371
377
|
}
|
|
372
378
|
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, config => this.masterFormConfig = config);
|
|
379
|
+
this.addFormLegacyConfigName();
|
|
373
380
|
this._configManager.loadConfig();
|
|
374
381
|
}
|
|
375
382
|
componentDidRender() {
|
|
@@ -519,6 +526,7 @@ const SnkGuidesViewer = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
519
526
|
"presentationMode": [1, "presentation-mode"],
|
|
520
527
|
"resourceID": [1, "resource-i-d"],
|
|
521
528
|
"detailTaskbarCustomContainerId": [1, "detail-taskbar-custom-container-id"],
|
|
529
|
+
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
522
530
|
"_hasToCreateFieldSearch": [32],
|
|
523
531
|
"_breadcrumbItems": [32],
|
|
524
532
|
"_guides": [32],
|
|
@@ -287,6 +287,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
287
287
|
this.filterConfig = undefined;
|
|
288
288
|
this.messagesBuilder = undefined;
|
|
289
289
|
this.disablePersonalizedFilter = undefined;
|
|
290
|
+
this.filterBarLegacyConfigName = undefined;
|
|
290
291
|
this.allowDefault = undefined;
|
|
291
292
|
this.scrollerLocked = false;
|
|
292
293
|
this.showPersonalizedFilter = false;
|
|
@@ -554,6 +555,11 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
554
555
|
loadPermitions() {
|
|
555
556
|
this._application.isUserSup().then(value => this.allowDefault = value);
|
|
556
557
|
}
|
|
558
|
+
addFilterBarLegacyConfigName() {
|
|
559
|
+
if (this.filterBarLegacyConfigName && this.configName) {
|
|
560
|
+
ConfigStorage.addFilterBarLegacyConfig(this.configName, this.filterBarLegacyConfigName);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
557
563
|
async loadConfigFromStorage(clearCache) {
|
|
558
564
|
if (clearCache) {
|
|
559
565
|
await ConfigStorage.deleteFilterBarConfigCache(this.configName, this.resourceID);
|
|
@@ -660,6 +666,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
660
666
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
661
667
|
if (this._application) {
|
|
662
668
|
this.loadPermitions();
|
|
669
|
+
this.addFilterBarLegacyConfigName();
|
|
663
670
|
this.loadConfigFromStorage();
|
|
664
671
|
}
|
|
665
672
|
this.attachDataUnit();
|
|
@@ -692,6 +699,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
692
699
|
"filterConfig": [1040],
|
|
693
700
|
"messagesBuilder": [1040],
|
|
694
701
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
702
|
+
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
695
703
|
"allowDefault": [32],
|
|
696
704
|
"scrollerLocked": [32],
|
|
697
705
|
"showPersonalizedFilter": [32],
|
|
@@ -23,6 +23,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
23
23
|
this.configName = undefined;
|
|
24
24
|
this.recordsValidator = undefined;
|
|
25
25
|
this.messagesBuilder = undefined;
|
|
26
|
+
this.formLegacyConfigName = undefined;
|
|
26
27
|
this.resourceID = undefined;
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
@@ -70,8 +71,14 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
70
71
|
this.resourceID = await ResourceIDUtils.getResourceID();
|
|
71
72
|
}
|
|
72
73
|
this._configManager = new SnkFormConfigManager(this.configName, this.resourceID);
|
|
74
|
+
this.addFormLegacyConfig();
|
|
73
75
|
this._configManager.loadConfig();
|
|
74
76
|
}
|
|
77
|
+
addFormLegacyConfig() {
|
|
78
|
+
if (this.formLegacyConfigName) {
|
|
79
|
+
this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
75
82
|
render() {
|
|
76
83
|
if (!this._dataUnit || !this._dataState) {
|
|
77
84
|
return undefined;
|
|
@@ -85,6 +92,7 @@ const SnkForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
85
92
|
"configName": [1, "config-name"],
|
|
86
93
|
"recordsValidator": [16],
|
|
87
94
|
"messagesBuilder": [1040],
|
|
95
|
+
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
88
96
|
"resourceID": [1, "resource-i-d"],
|
|
89
97
|
"_dataUnit": [32],
|
|
90
98
|
"_dataState": [32],
|
|
@@ -81,6 +81,8 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
81
81
|
this.gridHeaderCustomSlotId = 'GRID_HEADER_CUSTOM_ELEMENTS';
|
|
82
82
|
this.topTaskbarCustomSlotId = 'GRID_TASKBAR_CUSTOM_ELEMENTS';
|
|
83
83
|
this.disablePersonalizedFilter = undefined;
|
|
84
|
+
this.gridLegacyConfigName = undefined;
|
|
85
|
+
this.filterBarLegacyConfigName = undefined;
|
|
84
86
|
}
|
|
85
87
|
/**
|
|
86
88
|
* Exibe a janela de configurações da grade.
|
|
@@ -149,6 +151,11 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
149
151
|
console.warn(error);
|
|
150
152
|
});
|
|
151
153
|
}
|
|
154
|
+
addGridLegacyConfigName() {
|
|
155
|
+
if (this.gridLegacyConfigName && this.configName) {
|
|
156
|
+
ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
152
159
|
gridConfigChangeHandler(evt) {
|
|
153
160
|
const config = evt.detail;
|
|
154
161
|
ConfigStorage.saveGridConfig(config, this.configName, this.resourceID);
|
|
@@ -273,6 +280,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
273
280
|
}
|
|
274
281
|
componentWillLoad() {
|
|
275
282
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
283
|
+
//TODO: substituir pelo metodo nativo closest
|
|
276
284
|
let parent = this._element.parentElement;
|
|
277
285
|
while (parent) {
|
|
278
286
|
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
|
@@ -302,6 +310,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
302
310
|
}
|
|
303
311
|
parent = parent.parentElement;
|
|
304
312
|
}
|
|
313
|
+
this.addGridLegacyConfigName();
|
|
305
314
|
this.loadConfig();
|
|
306
315
|
}
|
|
307
316
|
getHeaderDisabledButtons() {
|
|
@@ -416,7 +425,7 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
416
425
|
return undefined;
|
|
417
426
|
}
|
|
418
427
|
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--medium" }, this._showSnkFilterBar &&
|
|
419
|
-
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 }), 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 }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, 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 }))));
|
|
428
|
+
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 }), 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 }, h("snk-taskbar", { id: 'teste', dataUnit: this._dataUnit, configName: this.configName, messagesBuilder: this.messagesBuilder, "data-element-id": "grid_left", buttons: this._headerTaskbarProcessor.buttons, 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 }))));
|
|
420
429
|
}
|
|
421
430
|
get _element() { return this; }
|
|
422
431
|
static get style() { return snkGridCss; }
|
|
@@ -440,6 +449,8 @@ const SnkGrid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
440
449
|
"gridHeaderCustomSlotId": [1, "grid-header-custom-slot-id"],
|
|
441
450
|
"topTaskbarCustomSlotId": [1, "top-taskbar-custom-slot-id"],
|
|
442
451
|
"disablePersonalizedFilter": [4, "disable-personalized-filter"],
|
|
452
|
+
"gridLegacyConfigName": [1, "grid-legacy-config-name"],
|
|
453
|
+
"filterBarLegacyConfigName": [1, "filter-bar-legacy-config-name"],
|
|
443
454
|
"_dataUnit": [32],
|
|
444
455
|
"_dataState": [32],
|
|
445
456
|
"_gridConfig": [32],
|
|
@@ -25,6 +25,9 @@ import { d as defineCustomElement$4 } from './snk-select-box2.js';
|
|
|
25
25
|
import { d as defineCustomElement$3 } from './snk-tab-config2.js';
|
|
26
26
|
import { d as defineCustomElement$1 } from './taskbar-actions-button2.js';
|
|
27
27
|
|
|
28
|
+
const REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
29
|
+
const REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
|
30
|
+
|
|
28
31
|
const snkSimpleCrudCss = ".sc-snk-simple-crud-h{display:flex;height:100%;width:100%}.simple-crud__container.sc-snk-simple-crud{display:grid;grid-template-rows:max-content;row-gap:12px;height:100%;width:100%}.simple-crud__container-section.sc-snk-simple-crud{flex-wrap:unset;flex-direction:column}.simple-crud__form--hidden.sc-snk-simple-crud{display:none}ez-grid.sc-snk-simple-crud{--ez-grid__container--shadow:none;min-height:300px}ez-form.sc-snk-simple-crud{min-height:300px}";
|
|
29
32
|
|
|
30
33
|
const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -37,8 +40,6 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
37
40
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
|
38
41
|
this.configuratorSave = createEvent(this, "configuratorSave", 7);
|
|
39
42
|
this.configuratorCancel = createEvent(this, "configuratorCancel", 7);
|
|
40
|
-
this.REGULAR_DEFAULT_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "MORE_OPTIONS"];
|
|
41
|
-
this.REGULAR_SELECTED_BTNS = ["INSERT", "REFRESH", "PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "DIVIDER", "MORE_OPTIONS"];
|
|
42
43
|
this._multiSelectionListDataSource = new SnkMultiSelectionListDataSource();
|
|
43
44
|
this._keyDownHandler = (event) => this.keyDownListener(event);
|
|
44
45
|
this._taskbarProcessor = new TaskbarProcessor({
|
|
@@ -68,9 +69,12 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
68
69
|
this.actionsList = undefined;
|
|
69
70
|
this.configName = undefined;
|
|
70
71
|
this.showConfiguratorButtons = undefined;
|
|
72
|
+
this.gridLegacyConfigName = undefined;
|
|
73
|
+
this.formLegacyConfigName = undefined;
|
|
74
|
+
this.ignoreReadOnlyFormFields = false;
|
|
71
75
|
}
|
|
72
76
|
getButtons(selected, changeModeBtn) {
|
|
73
|
-
return this.addConfigButton(this.resolveInMemoryBtns(selected ?
|
|
77
|
+
return this.addConfigButton(this.resolveInMemoryBtns(selected ? REGULAR_SELECTED_BTNS : REGULAR_DEFAULT_BTNS)
|
|
74
78
|
.concat(changeModeBtn));
|
|
75
79
|
}
|
|
76
80
|
addConfigButton(buttons) {
|
|
@@ -121,6 +125,44 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
121
125
|
this.dataStateChange.emit(newValue);
|
|
122
126
|
}
|
|
123
127
|
}
|
|
128
|
+
async observeFormLegacy() {
|
|
129
|
+
await this.handleUpdateFormLegacyConfig();
|
|
130
|
+
}
|
|
131
|
+
async observeGridLegacy() {
|
|
132
|
+
await this.handleUpdateGridLegacyConfig();
|
|
133
|
+
}
|
|
134
|
+
async handleUpdateGridLegacyConfig() {
|
|
135
|
+
if (this.gridLegacyConfigName) {
|
|
136
|
+
this.addGridLegacyConfigName();
|
|
137
|
+
if (this._gridConfigAlreadyLoaded) {
|
|
138
|
+
await this.loadGridConfig(true);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async handleUpdateFormLegacyConfig() {
|
|
143
|
+
var _a, _b, _c;
|
|
144
|
+
if (this.formLegacyConfigName) {
|
|
145
|
+
const legacyConfig = await this.fetchFormLegacyConfig();
|
|
146
|
+
if (!legacyConfig)
|
|
147
|
+
return;
|
|
148
|
+
const rawFields = (_c = (_b = (_a = legacyConfig === null || legacyConfig === void 0 ? void 0 : legacyConfig.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
|
|
149
|
+
const fields = Array.isArray(rawFields) ? rawFields : [rawFields];
|
|
150
|
+
const newConfig = { emptyConfig: false, fields: fields };
|
|
151
|
+
this.setFormConfig(newConfig, true);
|
|
152
|
+
this._formConfigManager.setConfig(this.formConfig);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async fetchFormLegacyConfig() {
|
|
156
|
+
const payload = {
|
|
157
|
+
'requestBody': {
|
|
158
|
+
'config': {
|
|
159
|
+
'chave': this.formLegacyConfigName,
|
|
160
|
+
'tipo': 'T',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
return await this.application.callServiceBroker('SystemUtilsSP.getConf', JSON.stringify(payload));
|
|
165
|
+
}
|
|
124
166
|
openConfig(viewMode) {
|
|
125
167
|
this._snkConfigurator.close();
|
|
126
168
|
if (viewMode === VIEW_MODE.GRID) {
|
|
@@ -139,10 +181,18 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
139
181
|
});
|
|
140
182
|
}
|
|
141
183
|
openFormConfig() {
|
|
184
|
+
//No momento não daremos suporte para configuraçao de formulário quando houver legacy config
|
|
185
|
+
if (this.formLegacyConfigName)
|
|
186
|
+
return;
|
|
142
187
|
this._showFormConfig = true;
|
|
143
188
|
}
|
|
144
|
-
|
|
145
|
-
if (this.
|
|
189
|
+
addGridLegacyConfigName() {
|
|
190
|
+
if (this.gridLegacyConfigName && this.configName) {
|
|
191
|
+
ConfigStorage.addGridLegacyConfig(this.configName, this.gridLegacyConfigName);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
loadGridConfig(forceUpdate) {
|
|
195
|
+
if ((this.gridConfig != undefined || this._gridConfigAlreadyLoaded) && !forceUpdate) {
|
|
146
196
|
return;
|
|
147
197
|
}
|
|
148
198
|
this._gridConfigAlreadyLoaded = true;
|
|
@@ -177,6 +227,7 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
177
227
|
if (this.gridConfig != undefined || this._gridConfigAlreadyLoaded) {
|
|
178
228
|
return;
|
|
179
229
|
}
|
|
230
|
+
await this.addGridLegacyConfigName();
|
|
180
231
|
this.loadGridConfig();
|
|
181
232
|
this.loadFormConfig();
|
|
182
233
|
}
|
|
@@ -436,7 +487,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
436
487
|
this.gridConfig = config;
|
|
437
488
|
CrudUtils.assertDefaultSorting(this.gridConfig, this.dataUnit);
|
|
438
489
|
}
|
|
439
|
-
setFormConfig(config) {
|
|
490
|
+
setFormConfig(config, forceUpdate) {
|
|
491
|
+
if (this.formConfig && !forceUpdate)
|
|
492
|
+
return;
|
|
440
493
|
this.formConfig = config;
|
|
441
494
|
}
|
|
442
495
|
closeGridConfig() {
|
|
@@ -445,6 +498,10 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
445
498
|
closeFormConfig() {
|
|
446
499
|
this._showFormConfig = false;
|
|
447
500
|
}
|
|
501
|
+
//No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
|
|
502
|
+
handleShowFormConfig() {
|
|
503
|
+
return this._showFormConfig && !this.formLegacyConfigName;
|
|
504
|
+
}
|
|
448
505
|
/* istanbul ignore next */
|
|
449
506
|
render() {
|
|
450
507
|
var _a, _b, _c;
|
|
@@ -453,12 +510,14 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
453
510
|
}
|
|
454
511
|
return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("snk-taskbar", { class: "ez-box ez-box--shadow ez-padding--medium", 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, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })), 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)
|
|
455
512
|
? undefined
|
|
456
|
-
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.
|
|
513
|
+
: this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: (_b = this._formConfigManager) === null || _b === void 0 ? void 0 : _b.getConfig(this.ignoreReadOnlyFormFields ? (_c = this.dataState) === null || _c === void 0 ? void 0 : _c.insertionMode : false, this.dataUnit), 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._resourceID, 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._resourceID }))));
|
|
457
514
|
}
|
|
458
515
|
get _element() { return this; }
|
|
459
516
|
static get watchers() { return {
|
|
460
517
|
"mode": ["onModeChange"],
|
|
461
|
-
"dataState": ["observeDataState"]
|
|
518
|
+
"dataState": ["observeDataState"],
|
|
519
|
+
"formLegacyConfigName": ["observeFormLegacy"],
|
|
520
|
+
"gridLegacyConfigName": ["observeGridLegacy"]
|
|
462
521
|
}; }
|
|
463
522
|
static get style() { return snkSimpleCrudCss; }
|
|
464
523
|
}, [6, "snk-simple-crud", {
|
|
@@ -475,6 +534,9 @@ const SnkSimpleCrud = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
475
534
|
"actionsList": [16],
|
|
476
535
|
"configName": [1025, "config-name"],
|
|
477
536
|
"showConfiguratorButtons": [4, "show-configurator-buttons"],
|
|
537
|
+
"gridLegacyConfigName": [1, "grid-legacy-config-name"],
|
|
538
|
+
"formLegacyConfigName": [1, "form-legacy-config-name"],
|
|
539
|
+
"ignoreReadOnlyFormFields": [4, "ignore-read-only-form-fields"],
|
|
478
540
|
"_showPopUpGridConfig": [32],
|
|
479
541
|
"_showFormConfig": [32],
|
|
480
542
|
"_currentViewMode": [32],
|
|
@@ -95,7 +95,7 @@ const buildElem = (element, className, dataElementId, getTitle, action, isEnable
|
|
|
95
95
|
case TaskbarElement.MORE_OPTIONS:
|
|
96
96
|
return actionButton(element, className, dataElementId, title, isEnabled, actions, action);
|
|
97
97
|
case TaskbarElement.DIVIDER:
|
|
98
|
-
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-
|
|
98
|
+
return h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin--none ez-margin-left--medium", "data-taskbar-divider": true });
|
|
99
99
|
case TaskbarElement.DATA_EXPORTER:
|
|
100
100
|
const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
|
|
101
101
|
return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId, "data-taskbar-element": element });
|
|
@@ -171,7 +171,13 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
171
171
|
}
|
|
172
172
|
observeButtons() {
|
|
173
173
|
this._definitions = undefined;
|
|
174
|
-
requestAnimationFrame(() => {
|
|
174
|
+
requestAnimationFrame(() => {
|
|
175
|
+
requestAnimationFrame(() => { var _a; return (_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate(); });
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
observeDisabledButtons() {
|
|
179
|
+
var _a;
|
|
180
|
+
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.forceUpdate();
|
|
175
181
|
}
|
|
176
182
|
// Internal methods
|
|
177
183
|
elementsFromString(strButtons) {
|
|
@@ -326,7 +332,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
326
332
|
this._customElementsId.push(elementId);
|
|
327
333
|
(_a = this._overFlowWatcher) === null || _a === void 0 ? void 0 : _a.addNotOverFlowElement(elementId);
|
|
328
334
|
}
|
|
329
|
-
return h("span", { key: elementId, id: elementId });
|
|
335
|
+
return h("span", { class: "ez-padding-left--medium", key: elementId, id: elementId });
|
|
330
336
|
}
|
|
331
337
|
getCustomElements() {
|
|
332
338
|
var _a, _b;
|
|
@@ -450,12 +456,7 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
450
456
|
let index = 0;
|
|
451
457
|
return (h(Host, { class: this.getHostClasses() }, this.removeEmpty(this._definitions.map((elem) => {
|
|
452
458
|
var _a, _b;
|
|
453
|
-
|
|
454
|
-
index = 0;
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
index++;
|
|
458
|
-
}
|
|
459
|
+
index++;
|
|
459
460
|
if (TaskbarElement[elem]) {
|
|
460
461
|
return this.getElement(index, TaskbarElement[elem]);
|
|
461
462
|
}
|
|
@@ -476,7 +477,8 @@ const SnkTaskbar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
476
477
|
}
|
|
477
478
|
get _element() { return this; }
|
|
478
479
|
static get watchers() { return {
|
|
479
|
-
"buttons": ["observeButtons"]
|
|
480
|
+
"buttons": ["observeButtons"],
|
|
481
|
+
"disabledButtons": ["observeDisabledButtons"]
|
|
480
482
|
}; }
|
|
481
483
|
static get style() { return snkTaskbarCss; }
|
|
482
484
|
}, [6, "snk-taskbar", {
|