@sankhyalabs/sankhyablocks 8.8.4 → 8.8.6
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/{dataunit-fetcher-af1c655d.js → dataunit-fetcher-55f98541.js} +3 -0
- package/dist/cjs/snk-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +1 -1
- package/dist/cjs/snk-attach.cjs.entry.js +1 -1
- package/dist/cjs/snk-crud.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-bar.cjs.entry.js +13 -5
- package/dist/cjs/{snk-guides-viewer-7d6ad1c8.js → snk-guides-viewer-6dfeec5c.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +2 -2
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -0
- package/dist/cjs/snk-simple-crud.cjs.entry.js +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +13 -5
- package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +16 -0
- package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +3 -0
- package/dist/components/dataunit-fetcher.js +3 -0
- package/dist/components/snk-filter-bar2.js +13 -5
- package/dist/components/snk-personalized-filter2.js +2 -0
- package/dist/esm/{dataunit-fetcher-d5e6cc8c.js → dataunit-fetcher-6725cb0e.js} +3 -0
- package/dist/esm/snk-actions-button.entry.js +1 -1
- package/dist/esm/snk-application.entry.js +1 -1
- package/dist/esm/snk-attach.entry.js +1 -1
- package/dist/esm/snk-crud.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +2 -2
- package/dist/esm/snk-filter-bar.entry.js +13 -5
- package/dist/esm/{snk-guides-viewer-cd6f8ff7.js → snk-guides-viewer-8b47f38c.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +2 -2
- package/dist/esm/snk-personalized-filter.entry.js +2 -0
- package/dist/esm/snk-simple-crud.entry.js +1 -1
- package/dist/sankhyablocks/{p-05f6c9dc.entry.js → p-0383e477.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5b1b2c33.js → p-08fca9d1.js} +1 -1
- package/dist/sankhyablocks/{p-8a08eda7.entry.js → p-2eb547d9.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a675e706.entry.js → p-47d20cb0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f661e804.entry.js → p-4efe1a8a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-056cb6c4.entry.js → p-651b4f89.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9ab4bffa.entry.js → p-70150991.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7f4435e2.js → p-73407f35.js} +1 -1
- package/dist/sankhyablocks/p-767db365.entry.js +1 -0
- package/dist/sankhyablocks/{p-7a85dcd3.entry.js → p-7749c662.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0814adec.entry.js → p-cab6a969.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
- package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +1 -0
- package/dist/types/components.d.ts +1 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-4f5b995d.entry.js +0 -1
@@ -249,6 +249,9 @@ class DatasetStrategy {
|
|
249
249
|
if (sorting != undefined && sorting.length !== 0) {
|
250
250
|
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
251
251
|
}
|
252
|
+
if (request.parentRecordId != undefined) {
|
253
|
+
txProperties["__DATA_UNIT_ADAPTER__[parentRecordId]"] = request.parentRecordId;
|
254
|
+
}
|
252
255
|
return txProperties;
|
253
256
|
}
|
254
257
|
processRecords(dataUnit, fields, responseRecords) {
|
@@ -11,7 +11,7 @@ require('./index-0e663819.js');
|
|
11
11
|
require('./ISave-d68ce3cd.js');
|
12
12
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
14
|
-
require('./dataunit-fetcher-
|
14
|
+
require('./dataunit-fetcher-55f98541.js');
|
15
15
|
require('./PreloadManager-84466da6.js');
|
16
16
|
require('./filter-item-type.enum-aa823a00.js');
|
17
17
|
require('./form-config-fetcher-17775a75.js');
|
@@ -8,7 +8,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
|
|
8
8
|
const ConfigStorage = require('./ConfigStorage-c15716fd.js');
|
9
9
|
const DataFetcher = require('./DataFetcher-713f0749.js');
|
10
10
|
const authFetcher = require('./auth-fetcher-555ff856.js');
|
11
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
11
|
+
const dataunitFetcher = require('./dataunit-fetcher-55f98541.js');
|
12
12
|
const pesquisaFetcher = require('./pesquisa-fetcher-34922b83.js');
|
13
13
|
const SnkMessageBuilder = require('./SnkMessageBuilder-dbc8d14e.js');
|
14
14
|
require('./form-config-fetcher-17775a75.js');
|
@@ -7,7 +7,7 @@ const core = require('@sankhyalabs/core');
|
|
7
7
|
const DataFetcher = require('./DataFetcher-713f0749.js');
|
8
8
|
const ISave = require('./ISave-d68ce3cd.js');
|
9
9
|
const constants = require('./constants-d187e03e.js');
|
10
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
10
|
+
const dataunitFetcher = require('./dataunit-fetcher-55f98541.js');
|
11
11
|
const taskbarElements = require('./taskbar-elements-39949c7a.js');
|
12
12
|
require('./_commonjsHelpers-537d719a.js');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
@@ -11,7 +11,7 @@ const index$1 = require('./index-0e663819.js');
|
|
11
11
|
require('./ISave-d68ce3cd.js');
|
12
12
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
13
13
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
14
|
-
require('./dataunit-fetcher-
|
14
|
+
require('./dataunit-fetcher-55f98541.js');
|
15
15
|
require('./PreloadManager-84466da6.js');
|
16
16
|
require('./filter-item-type.enum-aa823a00.js');
|
17
17
|
require('./form-config-fetcher-17775a75.js');
|
@@ -12,13 +12,13 @@ const index$1 = require('./index-0e663819.js');
|
|
12
12
|
require('./ISave-d68ce3cd.js');
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
15
|
-
require('./dataunit-fetcher-
|
15
|
+
require('./dataunit-fetcher-55f98541.js');
|
16
16
|
require('./PreloadManager-84466da6.js');
|
17
17
|
require('./filter-item-type.enum-aa823a00.js');
|
18
18
|
require('./form-config-fetcher-17775a75.js');
|
19
19
|
const taskbarElements = require('./taskbar-elements-39949c7a.js');
|
20
20
|
const constants = require('./constants-d187e03e.js');
|
21
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
21
|
+
const snkGuidesViewer = require('./snk-guides-viewer-6dfeec5c.js');
|
22
22
|
const SnkMessageBuilder = require('./SnkMessageBuilder-dbc8d14e.js');
|
23
23
|
require('./ConfigStorage-c15716fd.js');
|
24
24
|
require('./_commonjsHelpers-537d719a.js');
|
@@ -489,11 +489,19 @@ const SnkFilterBar = class {
|
|
489
489
|
this.showPersonalizedFilter = true;
|
490
490
|
this.personalizedFilterId = id;
|
491
491
|
}
|
492
|
+
handleHidePersonalizedFilter(reloadFilterBar) {
|
493
|
+
if (reloadFilterBar) {
|
494
|
+
this.loadConfigFromStorage().then(() => {
|
495
|
+
this.hidePersonalizedFilter();
|
496
|
+
});
|
497
|
+
}
|
498
|
+
else {
|
499
|
+
this.hidePersonalizedFilter();
|
500
|
+
}
|
501
|
+
}
|
492
502
|
hidePersonalizedFilter() {
|
493
|
-
this.
|
494
|
-
|
495
|
-
this.showPersonalizedFilter = false;
|
496
|
-
});
|
503
|
+
this.personalizedFilterId = undefined;
|
504
|
+
this.showPersonalizedFilter = false;
|
497
505
|
}
|
498
506
|
componentWillLoad() {
|
499
507
|
this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
@@ -511,7 +519,7 @@ const SnkFilterBar = class {
|
|
511
519
|
return undefined;
|
512
520
|
}
|
513
521
|
if (this.showPersonalizedFilter) {
|
514
|
-
return index$1.h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.
|
522
|
+
return index$1.h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
515
523
|
}
|
516
524
|
return (index$1.h(index$1.Host, null, index$1.h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, index$1.h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), index$1.h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, index$1.h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
517
525
|
}
|
@@ -13,7 +13,7 @@ const index$1 = require('./index-0e663819.js');
|
|
13
13
|
require('./ISave-d68ce3cd.js');
|
14
14
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
15
15
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
16
|
-
require('./dataunit-fetcher-
|
16
|
+
require('./dataunit-fetcher-55f98541.js');
|
17
17
|
require('./PreloadManager-84466da6.js');
|
18
18
|
require('./filter-item-type.enum-aa823a00.js');
|
19
19
|
require('./form-config-fetcher-17775a75.js');
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const snkGuidesViewer = require('./snk-guides-viewer-
|
5
|
+
const snkGuidesViewer = require('./snk-guides-viewer-6dfeec5c.js');
|
6
6
|
require('./index-f9e81701.js');
|
7
7
|
require('@sankhyalabs/core');
|
8
8
|
require('./SnkFormConfigManager-29101e20.js');
|
@@ -22,7 +22,7 @@ require('./constants-d187e03e.js');
|
|
22
22
|
require('./pesquisa-fetcher-34922b83.js');
|
23
23
|
require('./ISave-d68ce3cd.js');
|
24
24
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
25
|
-
require('./dataunit-fetcher-
|
25
|
+
require('./dataunit-fetcher-55f98541.js');
|
26
26
|
require('./PreloadManager-84466da6.js');
|
27
27
|
require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
|
28
28
|
require('./ResourceIDUtils-5ff86aa7.js');
|
@@ -23,6 +23,7 @@ const SnkPersonalizedFilter = class {
|
|
23
23
|
index.registerInstance(this, hostRef);
|
24
24
|
this.ezCancel = index.createEvent(this, "ezCancel", 7);
|
25
25
|
this.ezSave = index.createEvent(this, "ezSave", 7);
|
26
|
+
this.ezAfterSave = index.createEvent(this, "ezAfterSave", 7);
|
26
27
|
this._personalizedFilterFetcher = new ConfigStorage.PersonalizedFilterFetcher();
|
27
28
|
this._filterMetadataStorage = new Map();
|
28
29
|
this._dataSourceFetcher = {
|
@@ -122,6 +123,7 @@ const SnkPersonalizedFilter = class {
|
|
122
123
|
updatedFilterAssistent.parameters = PersonalizedFilterUtils.PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
|
123
124
|
this._originalFilterAssistent = core.ObjectUtils.copy(updatedFilterAssistent);
|
124
125
|
this._filterAssistent = core.ObjectUtils.copy(updatedFilterAssistent);
|
126
|
+
this.ezAfterSave.emit();
|
125
127
|
});
|
126
128
|
}
|
127
129
|
removeFilter() {
|
@@ -12,7 +12,7 @@ const index$1 = require('./index-0e663819.js');
|
|
12
12
|
require('./ISave-d68ce3cd.js');
|
13
13
|
require('@sankhyalabs/ezui/dist/collection/utils/constants');
|
14
14
|
require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
|
15
|
-
const dataunitFetcher = require('./dataunit-fetcher-
|
15
|
+
const dataunitFetcher = require('./dataunit-fetcher-55f98541.js');
|
16
16
|
require('./PreloadManager-84466da6.js');
|
17
17
|
require('./filter-item-type.enum-aa823a00.js');
|
18
18
|
require('./form-config-fetcher-17775a75.js');
|
@@ -295,11 +295,19 @@ export class SnkFilterBar {
|
|
295
295
|
this.showPersonalizedFilter = true;
|
296
296
|
this.personalizedFilterId = id;
|
297
297
|
}
|
298
|
+
handleHidePersonalizedFilter(reloadFilterBar) {
|
299
|
+
if (reloadFilterBar) {
|
300
|
+
this.loadConfigFromStorage().then(() => {
|
301
|
+
this.hidePersonalizedFilter();
|
302
|
+
});
|
303
|
+
}
|
304
|
+
else {
|
305
|
+
this.hidePersonalizedFilter();
|
306
|
+
}
|
307
|
+
}
|
298
308
|
hidePersonalizedFilter() {
|
299
|
-
this.
|
300
|
-
|
301
|
-
this.showPersonalizedFilter = false;
|
302
|
-
});
|
309
|
+
this.personalizedFilterId = undefined;
|
310
|
+
this.showPersonalizedFilter = false;
|
303
311
|
}
|
304
312
|
componentWillLoad() {
|
305
313
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
@@ -317,7 +325,7 @@ export class SnkFilterBar {
|
|
317
325
|
return undefined;
|
318
326
|
}
|
319
327
|
if (this.showPersonalizedFilter) {
|
320
|
-
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.
|
328
|
+
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
321
329
|
}
|
322
330
|
return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
323
331
|
}
|
@@ -108,6 +108,7 @@ export class SnkPersonalizedFilter {
|
|
108
108
|
updatedFilterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
|
109
109
|
this._originalFilterAssistent = ObjectUtils.copy(updatedFilterAssistent);
|
110
110
|
this._filterAssistent = ObjectUtils.copy(updatedFilterAssistent);
|
111
|
+
this.ezAfterSave.emit();
|
111
112
|
});
|
112
113
|
}
|
113
114
|
removeFilter() {
|
@@ -431,6 +432,21 @@ export class SnkPersonalizedFilter {
|
|
431
432
|
"resolved": "string",
|
432
433
|
"references": {}
|
433
434
|
}
|
435
|
+
}, {
|
436
|
+
"method": "ezAfterSave",
|
437
|
+
"name": "ezAfterSave",
|
438
|
+
"bubbles": true,
|
439
|
+
"cancelable": true,
|
440
|
+
"composed": true,
|
441
|
+
"docs": {
|
442
|
+
"tags": [],
|
443
|
+
"text": ""
|
444
|
+
},
|
445
|
+
"complexType": {
|
446
|
+
"original": "void",
|
447
|
+
"resolved": "void",
|
448
|
+
"references": {}
|
449
|
+
}
|
434
450
|
}];
|
435
451
|
}
|
436
452
|
static get methods() {
|
package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js
CHANGED
@@ -103,6 +103,9 @@ export class DatasetStrategy {
|
|
103
103
|
if (sorting != undefined && sorting.length !== 0) {
|
104
104
|
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
105
105
|
}
|
106
|
+
if (request.parentRecordId != undefined) {
|
107
|
+
txProperties["__DATA_UNIT_ADAPTER__[parentRecordId]"] = request.parentRecordId;
|
108
|
+
}
|
106
109
|
return txProperties;
|
107
110
|
}
|
108
111
|
processRecords(dataUnit, fields, responseRecords) {
|
@@ -625,6 +625,9 @@ class DatasetStrategy {
|
|
625
625
|
if (sorting != undefined && sorting.length !== 0) {
|
626
626
|
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
627
627
|
}
|
628
|
+
if (request.parentRecordId != undefined) {
|
629
|
+
txProperties["__DATA_UNIT_ADAPTER__[parentRecordId]"] = request.parentRecordId;
|
630
|
+
}
|
628
631
|
return txProperties;
|
629
632
|
}
|
630
633
|
processRecords(dataUnit, fields, responseRecords) {
|
@@ -490,11 +490,19 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
490
490
|
this.showPersonalizedFilter = true;
|
491
491
|
this.personalizedFilterId = id;
|
492
492
|
}
|
493
|
+
handleHidePersonalizedFilter(reloadFilterBar) {
|
494
|
+
if (reloadFilterBar) {
|
495
|
+
this.loadConfigFromStorage().then(() => {
|
496
|
+
this.hidePersonalizedFilter();
|
497
|
+
});
|
498
|
+
}
|
499
|
+
else {
|
500
|
+
this.hidePersonalizedFilter();
|
501
|
+
}
|
502
|
+
}
|
493
503
|
hidePersonalizedFilter() {
|
494
|
-
this.
|
495
|
-
|
496
|
-
this.showPersonalizedFilter = false;
|
497
|
-
});
|
504
|
+
this.personalizedFilterId = undefined;
|
505
|
+
this.showPersonalizedFilter = false;
|
498
506
|
}
|
499
507
|
componentWillLoad() {
|
500
508
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
@@ -512,7 +520,7 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
512
520
|
return undefined;
|
513
521
|
}
|
514
522
|
if (this.showPersonalizedFilter) {
|
515
|
-
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.
|
523
|
+
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
516
524
|
}
|
517
525
|
return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
518
526
|
}
|
@@ -20,6 +20,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
20
20
|
this.__registerHost();
|
21
21
|
this.ezCancel = createEvent(this, "ezCancel", 7);
|
22
22
|
this.ezSave = createEvent(this, "ezSave", 7);
|
23
|
+
this.ezAfterSave = createEvent(this, "ezAfterSave", 7);
|
23
24
|
this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
|
24
25
|
this._filterMetadataStorage = new Map();
|
25
26
|
this._dataSourceFetcher = {
|
@@ -119,6 +120,7 @@ const SnkPersonalizedFilter = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
119
120
|
updatedFilterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
|
120
121
|
this._originalFilterAssistent = ObjectUtils.copy(updatedFilterAssistent);
|
121
122
|
this._filterAssistent = ObjectUtils.copy(updatedFilterAssistent);
|
123
|
+
this.ezAfterSave.emit();
|
122
124
|
});
|
123
125
|
}
|
124
126
|
removeFilter() {
|
@@ -247,6 +247,9 @@ class DatasetStrategy {
|
|
247
247
|
if (sorting != undefined && sorting.length !== 0) {
|
248
248
|
txProperties["__DATA_UNIT_ADAPTER__[sorting]"] = JSON.stringify(sorting);
|
249
249
|
}
|
250
|
+
if (request.parentRecordId != undefined) {
|
251
|
+
txProperties["__DATA_UNIT_ADAPTER__[parentRecordId]"] = request.parentRecordId;
|
252
|
+
}
|
250
253
|
return txProperties;
|
251
254
|
}
|
252
255
|
processRecords(dataUnit, fields, responseRecords) {
|
@@ -7,7 +7,7 @@ import './index-1564817d.js';
|
|
7
7
|
import './ISave-4412b20c.js';
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
|
-
import './dataunit-fetcher-
|
10
|
+
import './dataunit-fetcher-6725cb0e.js';
|
11
11
|
import './PreloadManager-c1c2f2b4.js';
|
12
12
|
import './filter-item-type.enum-5028ed3f.js';
|
13
13
|
import './form-config-fetcher-e1603e66.js';
|
@@ -4,7 +4,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage-79c81f36.js';
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher-79f78222.js';
|
6
6
|
import { A as AutorizationType, a as AuthFetcher } from './auth-fetcher-e260d0cd.js';
|
7
|
-
import { D as DataUnitFetcher } from './dataunit-fetcher-
|
7
|
+
import { D as DataUnitFetcher } from './dataunit-fetcher-6725cb0e.js';
|
8
8
|
import { P as PesquisaFetcher } from './pesquisa-fetcher-8e922c9d.js';
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-7ac66e9c.js';
|
10
10
|
import './form-config-fetcher-e1603e66.js';
|
@@ -3,7 +3,7 @@ import { ApplicationContext, DataType, Action } from '@sankhyalabs/core';
|
|
3
3
|
import { D as DataFetcher } from './DataFetcher-79f78222.js';
|
4
4
|
import { S as SaveErrorsEnum } from './ISave-4412b20c.js';
|
5
5
|
import { c as VIEW_MODE } from './constants-3644f1b6.js';
|
6
|
-
import { D as DataUnitFetcher } from './dataunit-fetcher-
|
6
|
+
import { D as DataUnitFetcher } from './dataunit-fetcher-6725cb0e.js';
|
7
7
|
import { T as TaskbarElement } from './taskbar-elements-0a6b8b95.js';
|
8
8
|
import './_commonjsHelpers-9943807e.js';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
@@ -7,7 +7,7 @@ import { P as PresentationMode } from './index-1564817d.js';
|
|
7
7
|
import './ISave-4412b20c.js';
|
8
8
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
|
-
import './dataunit-fetcher-
|
10
|
+
import './dataunit-fetcher-6725cb0e.js';
|
11
11
|
import './PreloadManager-c1c2f2b4.js';
|
12
12
|
import './filter-item-type.enum-5028ed3f.js';
|
13
13
|
import './form-config-fetcher-e1603e66.js';
|
@@ -8,13 +8,13 @@ import { P as PresentationMode } from './index-1564817d.js';
|
|
8
8
|
import './ISave-4412b20c.js';
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
10
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
11
|
-
import './dataunit-fetcher-
|
11
|
+
import './dataunit-fetcher-6725cb0e.js';
|
12
12
|
import './PreloadManager-c1c2f2b4.js';
|
13
13
|
import './filter-item-type.enum-5028ed3f.js';
|
14
14
|
import './form-config-fetcher-e1603e66.js';
|
15
15
|
import { T as TaskbarElement } from './taskbar-elements-0a6b8b95.js';
|
16
16
|
import { c as VIEW_MODE } from './constants-3644f1b6.js';
|
17
|
-
import { S as SnkGuidesViewer } from './snk-guides-viewer-
|
17
|
+
import { S as SnkGuidesViewer } from './snk-guides-viewer-8b47f38c.js';
|
18
18
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder-7ac66e9c.js';
|
19
19
|
import './ConfigStorage-79c81f36.js';
|
20
20
|
import './_commonjsHelpers-9943807e.js';
|
@@ -485,11 +485,19 @@ const SnkFilterBar = class {
|
|
485
485
|
this.showPersonalizedFilter = true;
|
486
486
|
this.personalizedFilterId = id;
|
487
487
|
}
|
488
|
+
handleHidePersonalizedFilter(reloadFilterBar) {
|
489
|
+
if (reloadFilterBar) {
|
490
|
+
this.loadConfigFromStorage().then(() => {
|
491
|
+
this.hidePersonalizedFilter();
|
492
|
+
});
|
493
|
+
}
|
494
|
+
else {
|
495
|
+
this.hidePersonalizedFilter();
|
496
|
+
}
|
497
|
+
}
|
488
498
|
hidePersonalizedFilter() {
|
489
|
-
this.
|
490
|
-
|
491
|
-
this.showPersonalizedFilter = false;
|
492
|
-
});
|
499
|
+
this.personalizedFilterId = undefined;
|
500
|
+
this.showPersonalizedFilter = false;
|
493
501
|
}
|
494
502
|
componentWillLoad() {
|
495
503
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
@@ -507,7 +515,7 @@ const SnkFilterBar = class {
|
|
507
515
|
return undefined;
|
508
516
|
}
|
509
517
|
if (this.showPersonalizedFilter) {
|
510
|
-
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.
|
518
|
+
return h("snk-personalized-filter", { class: "filter-bar__personalized-filter", filterId: this.personalizedFilterId, ref: (el) => this._elPersonalizedFilter = el, onEzCancel: () => this.handleHidePersonalizedFilter(false), onEzAfterSave: () => this.handleHidePersonalizedFilter(true), entityUri: this.dataUnit.name, configName: this.configName, resourceID: this.resourceID });
|
511
519
|
}
|
512
520
|
return (h(Host, null, h("ez-scroller", { class: "snk-filter-bar__scroller", direction: EzScrollDirection.HORIZONTAL, activeShadow: true, locked: this.scrollerLocked }, h("section", { class: "snk-filter-bar__filter-item-container" }, this.getFilterItems())), h("ez-button", { class: "ez-padding-left--medium", size: "small", label: this.getMessage('snkFilterBar.filters', undefined, 'Filtros'), onClick: this.showFilterModal.bind(this) }, h("ez-icon", { slot: "leftIcon", iconName: "plus", class: "ez-padding-right--small" }))));
|
513
521
|
}
|
@@ -11,7 +11,7 @@ import { P as PresentationMode } from './index-1564817d.js';
|
|
11
11
|
import './ISave-4412b20c.js';
|
12
12
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
13
13
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
14
|
-
import './dataunit-fetcher-
|
14
|
+
import './dataunit-fetcher-6725cb0e.js';
|
15
15
|
import './PreloadManager-c1c2f2b4.js';
|
16
16
|
import './filter-item-type.enum-5028ed3f.js';
|
17
17
|
import './form-config-fetcher-e1603e66.js';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-8b47f38c.js';
|
2
2
|
import './index-a7d3d3f1.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
4
|
import './SnkFormConfigManager-7723f3ec.js';
|
@@ -18,7 +18,7 @@ import './constants-3644f1b6.js';
|
|
18
18
|
import './pesquisa-fetcher-8e922c9d.js';
|
19
19
|
import './ISave-4412b20c.js';
|
20
20
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
21
|
-
import './dataunit-fetcher-
|
21
|
+
import './dataunit-fetcher-6725cb0e.js';
|
22
22
|
import './PreloadManager-c1c2f2b4.js';
|
23
23
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
24
24
|
import './ResourceIDUtils-a114189a.js';
|
@@ -19,6 +19,7 @@ const SnkPersonalizedFilter = class {
|
|
19
19
|
registerInstance(this, hostRef);
|
20
20
|
this.ezCancel = createEvent(this, "ezCancel", 7);
|
21
21
|
this.ezSave = createEvent(this, "ezSave", 7);
|
22
|
+
this.ezAfterSave = createEvent(this, "ezAfterSave", 7);
|
22
23
|
this._personalizedFilterFetcher = new PersonalizedFilterFetcher();
|
23
24
|
this._filterMetadataStorage = new Map();
|
24
25
|
this._dataSourceFetcher = {
|
@@ -118,6 +119,7 @@ const SnkPersonalizedFilter = class {
|
|
118
119
|
updatedFilterAssistent.parameters = PersonalizedFilterUtils.buildVariableParameters(this._filterAssistent.assistent);
|
119
120
|
this._originalFilterAssistent = ObjectUtils.copy(updatedFilterAssistent);
|
120
121
|
this._filterAssistent = ObjectUtils.copy(updatedFilterAssistent);
|
122
|
+
this.ezAfterSave.emit();
|
121
123
|
});
|
122
124
|
}
|
123
125
|
removeFilter() {
|
@@ -8,7 +8,7 @@ import { P as PresentationMode } from './index-1564817d.js';
|
|
8
8
|
import './ISave-4412b20c.js';
|
9
9
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
10
10
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
11
|
-
import { I as InMemoryLoader } from './dataunit-fetcher-
|
11
|
+
import { I as InMemoryLoader } from './dataunit-fetcher-6725cb0e.js';
|
12
12
|
import './PreloadManager-c1c2f2b4.js';
|
13
13
|
import './filter-item-type.enum-5028ed3f.js';
|
14
14
|
import './form-config-fetcher-e1603e66.js';
|
@@ -1 +1 @@
|
|
1
|
-
import{r as t,c as i,h as e}from"./p-d2d301a6.js";import{ApplicationContext as s,DataType as n,Action as a}from"@sankhyalabs/core";import{D as r}from"./p-c9399ce6.js";import{S as o}from"./p-9e7d65a4.js";import{c as h}from"./p-4a78e118.js";import{D as d}from"./p-7f4435e2.js";import{T as l}from"./p-c9841939.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"./p-c22c1d8e.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"./p-688dcb4c.js";import"./p-5534e08c.js";import"./p-6dc031de.js";class c{constructor(t,i,e){var s;this.entityName=t,this.registerKey=i,this.dataUnitName=e,this.validateFields=t=>{if(t.LINK&&t.NOMEARQUIVO)throw new Error(o.LINK_AND_FILE_AT_THE_SAME_TIME);if(!t.LINK&&!t.NOMEARQUIVO)throw new Error(o.ANY_LINK_OR_FILE_FILLED);if(!this.registerKey)throw new Error("Register key can not be null")},this.resourceID=window.resourceID||(null===(s=window.workspace)||void 0===s?void 0:s.resourceID)}async save(t){var i,e;const s="AnexoSistemaSP.salvar";let{updatingFields:n}=t;n=Object.assign(Object.assign({},n),{NOMEARQUIVO:null===(i=n.NOMEARQUIVO)||void 0===i?void 0:i[0]});try{this.validateFields(n);const t=n.LINK?null:n.NOMEARQUIVO,i={serviceName:s,requestBody:{params:{resourceID:this.resourceID,description:n.DESCRICAO,fileSelect:t?1:0,keySession:null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e.fileNameTmp,nameAttach:null==t?void 0:t.name,link:n.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:n.TIPOACESSO,typeApres:n.TIPOAPRES}}},a=await r.get().callServiceBroker(s,JSON.stringify(i));return Promise.resolve([Object.assign(Object.assign(Object.assign({},a),n),{ARQUIVOOULINK:n.LINK?n.LINK:null==t?void 0:t.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}async edit(t){var i,e,s;const n="AnexoSistemaSP.salvar";let{updatingFields:a,record:o}=t;const h=t=>void 0!==a[t]?a[t]:o[t],d=h("NOMEARQUIVO"),l=null===(e=null===(i=a.NOMEARQUIVO)||void 0===i?void 0:i[0])||void 0===e?void 0:e.downloadURL;a=Object.assign(Object.assign({},a),{DESCRICAO:h("DESCRICAO"),LINK:h("LINK"),TIPOACESSO:h("TIPOACESSO"),TIPOAPRES:h("TIPOAPRES"),CHAVEARQUIVO:o.CHAVEARQUIVO,NOMEARQUIVO:null==d?void 0:d[0]});const c=a.LINK?null:a.NOMEARQUIVO;try{this.validateFields(a);const t={serviceName:n,requestBody:{params:{resourceID:this.resourceID,nuAttach:null==o?void 0:o.NUATTACH,description:a.DESCRICAO,fileSelect:l?1:0,keySession:null===(s=null==c?void 0:c.properties)||void 0===s?void 0:s.fileNameTmp,keyAttach:a.CHAVEARQUIVO,nameAttach:null==c?void 0:c.name,link:a.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:a.TIPOACESSO,typeApres:a.TIPOAPRES}}},i=await r.get().callServiceBroker(n,JSON.stringify(t));return Promise.resolve([Object.assign(Object.assign(Object.assign({},i),a),{ARQUIVOOULINK:a.LINK?a.LINK:null==c?void 0:c.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}delete(t){var i;const e="AnexoSistemaSP.excluir",s=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},n={serviceName:e,requestBody:{paramsDelete:{keyAttach:t.CHAVEARQUIVO,nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO}}};return new Promise(((t,i)=>{r.get().callServiceBroker(e,JSON.stringify(n)).then((i=>t(i))).catch((t=>i(t)))}))}getDownloadKey(t){var i;const e="AnexoSistemaSP.baixar",s=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},n={serviceName:e,requestBody:{paramsDown:{nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO,keyAttach:t.CHAVEARQUIVO}}};return new Promise(((t,i)=>{r.get().callServiceBroker(e,JSON.stringify(n)).then((i=>t(i))).catch((t=>i(t)))}))}}class m{constructor(t,i){this.entityName=t,this.getMessage=i,this._application=s.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){this.loader||(this.loader=t.dataLoader),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,s)=>this.saveLoader(s,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,s)=>this.removeLoader(t,s,i).then((t=>(t.length&&e(),t)))}dataLoader(t,i){return new Promise((e=>{this.loader(t,i).then((t=>{const i=((null==t?void 0:t.records)||[]).map((t=>{let i;return t.LINK||(i=[{name:t.NOMEARQUIVO}]),Object.assign(Object.assign({},t),{ARQUIVOOULINK:t.LINK?t.LINK:t.NOMEARQUIVO,NOMEARQUIVO:i})}));e(Object.assign(Object.assign({},t),{records:i}))}))}))}saveLoader(t,i){return new Promise((e=>{var s;const n=Array.isArray(t)?t[0]:{};((null===(s=null==n?void 0:n.record)||void 0===s?void 0:s.NUATTACH)>=0?i.edit.bind(i):i.save.bind(i))(n).then((t=>{e(t)})).catch((t=>t.message===o.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===o.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((s=>{const{records:n}=t.getSelectionInfo();e.delete(n[0]).then((()=>s(i)))}))}getFilters(t){return[{name:"AttachmentsByPK",expression:"this.PKREGISTRO = :PKREGISTRO",params:[{name:"PKREGISTRO",dataType:n.TEXT,value:`${t}_${this.entityName}`}]}]}getInterceptions(t,i,e){return new Promise((s=>i.type===a.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(h.GRID),s(i)):s(void 0))):s(i):i.type===a.DATA_SAVED?(t.loadData(),s(i)):void s(i)))}}const u=s.getContextValue("__SNK__APPLICATION__"),v=t=>{var i,e;return null===(e=null===(i=null==u?void 0:u.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},A={DOWNLOAD:{hint:v("snkAttach.taskbar.titleDownload"),name:"DOWNLOAD",iconName:"file-download"},LINK:{hint:v("snkAttach.taskbar.titleLink"),name:"LINK",iconName:"launch"}},O=()=>{const t=[l.REMOVE,"DOWNLOAD","LINK"];return{getButtons:(t,i,e)=>{if((null==i?void 0:i.insertionMode)||(null==i?void 0:i.isDirty))return e.reverse();e.splice(e.indexOf(l.REFRESH),1);const{selectedRecord:s}=i||{},n=(null==s?void 0:s.LINK)?A.LINK:A.DOWNLOAD;e.splice(e.indexOf(l.DIVIDER)+1,0,l.REMOVE,n,l.DIVIDER);const a=Array.from(new Set(e.filter((t=>t!==l.CLONE))));return a.splice(a.indexOf(n)+1,0,l.DIVIDER),a},isEnabled:(i,e,s)=>{const n=void 0!==(null==e?void 0:e.selectedRecord);return!(t.includes(s)&&!n)}}},p={grid:{columns:[{name:"ARQUIVOOULINK",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"DHCAD",orderIndex:2,width:0},{name:"DHALTER",orderIndex:3,width:0},{name:"TIPOAPRES",orderIndex:4,width:0},{name:"TIPOACESSO",orderIndex:5,width:0},{name:"CODUSU",orderIndex:6,width:0},{name:"CODUSUALT",orderIndex:7,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",required:!0},{name:"TIPOAPRES",required:!0},{name:"TIPOACESSO",required:!0},{name:"LINK"},{name:"NOMEARQUIVO"}]}},k=class{constructor(e){t(this,e),this.back=i(this,"back",7),this.handleTaskbarClick=({detail:t})=>{if(["DOWNLOAD","LINK"].includes(t))return this.downloadAttachment(this.dataUnit.getSelectedRecord())},this.handleBack=()=>{this.dataUnit.cancelEdition().then((t=>{t&&this.back.emit()}))},this.handleFinish=()=>{if(!this.dataUnit.isDirty())return this.back.emit();this.dataUnit.saveData().then((()=>{this.showFinishedToast(),this.back.emit()}))},this.registerKey=void 0,this.entityName=void 0,this.messagesBuilder=void 0,this.dataUnit=void 0,this.crudConfig=void 0}registerKeyWatcher(t,i){var e;i!==t&&(this.returnToGridMode(),this._attachFetcher=new c(this.entityName,this.registerKey,null===(e=this.dataUnit)||void 0===e?void 0:e.name),this._dataUnitBuilder.initLoaders(this.dataUnit,this._attachFetcher,(()=>{this.returnToGridMode()})),this.dataUnit.loadData())}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}showFinishedToast(){this._application.info(this.getMessage("snkAttach.finishedMessage"),{iconName:"check"})}downloadAttachment(t){if(!t)throw new Error("Nenhum registro selecionado");t.LINK?window.open(`${t.LINK}`):this._attachFetcher.getDownloadKey(t).then((({chave:t})=>{window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${t.valor}&forcarDownload=S`)}))}returnToGridMode(){this.dataUnit.clearSelection(),this._crudElement&&this._crudElement.goToView(h.GRID)}loadAttachmentDataUnit(){var t;try{const i=this.dataUnit||(new d).getDataUnit("AnexoSistema","br.com.sankhya.core.v3.anexoSistema");return this._attachFetcher=new c(this.entityName,this.registerKey,null===(t=this.dataUnit)||void 0===t?void 0:t.name),i.metadata||i.loadMetadata().then((()=>{this.crudConfig=p})),this._dataUnitBuilder=new m(this.entityName,this.getMessage.bind(this)),i.addFilterProvider({getFilter:()=>this._dataUnitBuilder.getFilters(this.registerKey)}),i.addInterceptor({interceptAction:t=>this._dataUnitBuilder.getInterceptions(i,t,this._crudElement)}),this.dataUnit=i,this.dataUnit.loadData().then((()=>{this.disableEditFieldsNotInForm()})),this.dataUnit}catch(t){throw new Error("There was an error while creating the data unit")}}disableEditFieldsNotInForm(){var t;null===(t=this.crudConfig)||void 0===t||t.grid.columns.forEach((t=>{var i;const e=t.name;(null===(i=this.crudConfig)||void 0===i?void 0:i.form.fields.some((t=>t.name===e)))||this.dataUnit.disableField(e)}))}componentWillLoad(){this._application=s.getContextValue("__SNK__APPLICATION__"),this.loadAttachmentDataUnit()}render(){var t,i;return this.dataUnit?e("main",{class:"snk-attach__main"},e("header",{class:"snk-attach__header"},e("snk-simple-bar",{onExit:this.handleBack,messagesBuilder:this.messagesBuilder},e("div",{slot:"rightSlot"},e("ez-button",{class:"ez-button--primary",label:this.getMessage("snkAttach.finish"),onClick:this.handleFinish})))),e("div",{class:"snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column"},e("div",{class:"ez-box__container"},e("snk-simple-crud",{ref:t=>this._crudElement=t,dataUnit:this.dataUnit,taskbarManager:O(),gridConfig:null===(t=this.crudConfig)||void 0===t?void 0:t.grid,formConfig:null===(i=this.crudConfig)||void 0===i?void 0:i.form,useCancelConfirm:!1,onActionClick:this.handleTaskbarClick},e("div",{slot:"snkSimpleCrudHeader"},e("div",{class:"ez-flex ez-flex--column"},e("span",{class:"ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium"},this.getMessage("snkAttach.title")),e("span",{class:"ez-text ez-text--medium ez-text--secondary"},this.getMessage("snkAttach.description")))))))):null}static get watchers(){return{registerKey:["registerKeyWatcher"]}}};k.style=".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}.snk-attach__main.sc-snk-attach{height:85%}.ez-box__container.sc-snk-attach{height:100%}";export{k as snk_attach}
|
1
|
+
import{r as t,c as i,h as e}from"./p-d2d301a6.js";import{ApplicationContext as s,DataType as n,Action as a}from"@sankhyalabs/core";import{D as r}from"./p-c9399ce6.js";import{S as o}from"./p-9e7d65a4.js";import{c as h}from"./p-4a78e118.js";import{D as d}from"./p-73407f35.js";import{T as l}from"./p-c9841939.js";import"./p-112455b1.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"./p-c22c1d8e.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"./p-688dcb4c.js";import"./p-5534e08c.js";import"./p-6dc031de.js";class c{constructor(t,i,e){var s;this.entityName=t,this.registerKey=i,this.dataUnitName=e,this.validateFields=t=>{if(t.LINK&&t.NOMEARQUIVO)throw new Error(o.LINK_AND_FILE_AT_THE_SAME_TIME);if(!t.LINK&&!t.NOMEARQUIVO)throw new Error(o.ANY_LINK_OR_FILE_FILLED);if(!this.registerKey)throw new Error("Register key can not be null")},this.resourceID=window.resourceID||(null===(s=window.workspace)||void 0===s?void 0:s.resourceID)}async save(t){var i,e;const s="AnexoSistemaSP.salvar";let{updatingFields:n}=t;n=Object.assign(Object.assign({},n),{NOMEARQUIVO:null===(i=n.NOMEARQUIVO)||void 0===i?void 0:i[0]});try{this.validateFields(n);const t=n.LINK?null:n.NOMEARQUIVO,i={serviceName:s,requestBody:{params:{resourceID:this.resourceID,description:n.DESCRICAO,fileSelect:t?1:0,keySession:null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e.fileNameTmp,nameAttach:null==t?void 0:t.name,link:n.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:n.TIPOACESSO,typeApres:n.TIPOAPRES}}},a=await r.get().callServiceBroker(s,JSON.stringify(i));return Promise.resolve([Object.assign(Object.assign(Object.assign({},a),n),{ARQUIVOOULINK:n.LINK?n.LINK:null==t?void 0:t.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}async edit(t){var i,e,s;const n="AnexoSistemaSP.salvar";let{updatingFields:a,record:o}=t;const h=t=>void 0!==a[t]?a[t]:o[t],d=h("NOMEARQUIVO"),l=null===(e=null===(i=a.NOMEARQUIVO)||void 0===i?void 0:i[0])||void 0===e?void 0:e.downloadURL;a=Object.assign(Object.assign({},a),{DESCRICAO:h("DESCRICAO"),LINK:h("LINK"),TIPOACESSO:h("TIPOACESSO"),TIPOAPRES:h("TIPOAPRES"),CHAVEARQUIVO:o.CHAVEARQUIVO,NOMEARQUIVO:null==d?void 0:d[0]});const c=a.LINK?null:a.NOMEARQUIVO;try{this.validateFields(a);const t={serviceName:n,requestBody:{params:{resourceID:this.resourceID,nuAttach:null==o?void 0:o.NUATTACH,description:a.DESCRICAO,fileSelect:l?1:0,keySession:null===(s=null==c?void 0:c.properties)||void 0===s?void 0:s.fileNameTmp,keyAttach:a.CHAVEARQUIVO,nameAttach:null==c?void 0:c.name,link:a.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:a.TIPOACESSO,typeApres:a.TIPOAPRES}}},i=await r.get().callServiceBroker(n,JSON.stringify(t));return Promise.resolve([Object.assign(Object.assign(Object.assign({},i),a),{ARQUIVOOULINK:a.LINK?a.LINK:null==c?void 0:c.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}delete(t){var i;const e="AnexoSistemaSP.excluir",s=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},n={serviceName:e,requestBody:{paramsDelete:{keyAttach:t.CHAVEARQUIVO,nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO}}};return new Promise(((t,i)=>{r.get().callServiceBroker(e,JSON.stringify(n)).then((i=>t(i))).catch((t=>i(t)))}))}getDownloadKey(t){var i;const e="AnexoSistemaSP.baixar",s=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},n={serviceName:e,requestBody:{paramsDown:{nameAttach:null==s?void 0:s.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO,keyAttach:t.CHAVEARQUIVO}}};return new Promise(((t,i)=>{r.get().callServiceBroker(e,JSON.stringify(n)).then((i=>t(i))).catch((t=>i(t)))}))}}class m{constructor(t,i){this.entityName=t,this.getMessage=i,this._application=s.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){this.loader||(this.loader=t.dataLoader),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,s)=>this.saveLoader(s,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,s)=>this.removeLoader(t,s,i).then((t=>(t.length&&e(),t)))}dataLoader(t,i){return new Promise((e=>{this.loader(t,i).then((t=>{const i=((null==t?void 0:t.records)||[]).map((t=>{let i;return t.LINK||(i=[{name:t.NOMEARQUIVO}]),Object.assign(Object.assign({},t),{ARQUIVOOULINK:t.LINK?t.LINK:t.NOMEARQUIVO,NOMEARQUIVO:i})}));e(Object.assign(Object.assign({},t),{records:i}))}))}))}saveLoader(t,i){return new Promise((e=>{var s;const n=Array.isArray(t)?t[0]:{};((null===(s=null==n?void 0:n.record)||void 0===s?void 0:s.NUATTACH)>=0?i.edit.bind(i):i.save.bind(i))(n).then((t=>{e(t)})).catch((t=>t.message===o.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===o.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((s=>{const{records:n}=t.getSelectionInfo();e.delete(n[0]).then((()=>s(i)))}))}getFilters(t){return[{name:"AttachmentsByPK",expression:"this.PKREGISTRO = :PKREGISTRO",params:[{name:"PKREGISTRO",dataType:n.TEXT,value:`${t}_${this.entityName}`}]}]}getInterceptions(t,i,e){return new Promise((s=>i.type===a.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(h.GRID),s(i)):s(void 0))):s(i):i.type===a.DATA_SAVED?(t.loadData(),s(i)):void s(i)))}}const u=s.getContextValue("__SNK__APPLICATION__"),v=t=>{var i,e;return null===(e=null===(i=null==u?void 0:u.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},A={DOWNLOAD:{hint:v("snkAttach.taskbar.titleDownload"),name:"DOWNLOAD",iconName:"file-download"},LINK:{hint:v("snkAttach.taskbar.titleLink"),name:"LINK",iconName:"launch"}},O=()=>{const t=[l.REMOVE,"DOWNLOAD","LINK"];return{getButtons:(t,i,e)=>{if((null==i?void 0:i.insertionMode)||(null==i?void 0:i.isDirty))return e.reverse();e.splice(e.indexOf(l.REFRESH),1);const{selectedRecord:s}=i||{},n=(null==s?void 0:s.LINK)?A.LINK:A.DOWNLOAD;e.splice(e.indexOf(l.DIVIDER)+1,0,l.REMOVE,n,l.DIVIDER);const a=Array.from(new Set(e.filter((t=>t!==l.CLONE))));return a.splice(a.indexOf(n)+1,0,l.DIVIDER),a},isEnabled:(i,e,s)=>{const n=void 0!==(null==e?void 0:e.selectedRecord);return!(t.includes(s)&&!n)}}},p={grid:{columns:[{name:"ARQUIVOOULINK",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"DHCAD",orderIndex:2,width:0},{name:"DHALTER",orderIndex:3,width:0},{name:"TIPOAPRES",orderIndex:4,width:0},{name:"TIPOACESSO",orderIndex:5,width:0},{name:"CODUSU",orderIndex:6,width:0},{name:"CODUSUALT",orderIndex:7,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",required:!0},{name:"TIPOAPRES",required:!0},{name:"TIPOACESSO",required:!0},{name:"LINK"},{name:"NOMEARQUIVO"}]}},k=class{constructor(e){t(this,e),this.back=i(this,"back",7),this.handleTaskbarClick=({detail:t})=>{if(["DOWNLOAD","LINK"].includes(t))return this.downloadAttachment(this.dataUnit.getSelectedRecord())},this.handleBack=()=>{this.dataUnit.cancelEdition().then((t=>{t&&this.back.emit()}))},this.handleFinish=()=>{if(!this.dataUnit.isDirty())return this.back.emit();this.dataUnit.saveData().then((()=>{this.showFinishedToast(),this.back.emit()}))},this.registerKey=void 0,this.entityName=void 0,this.messagesBuilder=void 0,this.dataUnit=void 0,this.crudConfig=void 0}registerKeyWatcher(t,i){var e;i!==t&&(this.returnToGridMode(),this._attachFetcher=new c(this.entityName,this.registerKey,null===(e=this.dataUnit)||void 0===e?void 0:e.name),this._dataUnitBuilder.initLoaders(this.dataUnit,this._attachFetcher,(()=>{this.returnToGridMode()})),this.dataUnit.loadData())}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}showFinishedToast(){this._application.info(this.getMessage("snkAttach.finishedMessage"),{iconName:"check"})}downloadAttachment(t){if(!t)throw new Error("Nenhum registro selecionado");t.LINK?window.open(`${t.LINK}`):this._attachFetcher.getDownloadKey(t).then((({chave:t})=>{window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${t.valor}&forcarDownload=S`)}))}returnToGridMode(){this.dataUnit.clearSelection(),this._crudElement&&this._crudElement.goToView(h.GRID)}loadAttachmentDataUnit(){var t;try{const i=this.dataUnit||(new d).getDataUnit("AnexoSistema","br.com.sankhya.core.v3.anexoSistema");return this._attachFetcher=new c(this.entityName,this.registerKey,null===(t=this.dataUnit)||void 0===t?void 0:t.name),i.metadata||i.loadMetadata().then((()=>{this.crudConfig=p})),this._dataUnitBuilder=new m(this.entityName,this.getMessage.bind(this)),i.addFilterProvider({getFilter:()=>this._dataUnitBuilder.getFilters(this.registerKey)}),i.addInterceptor({interceptAction:t=>this._dataUnitBuilder.getInterceptions(i,t,this._crudElement)}),this.dataUnit=i,this.dataUnit.loadData().then((()=>{this.disableEditFieldsNotInForm()})),this.dataUnit}catch(t){throw new Error("There was an error while creating the data unit")}}disableEditFieldsNotInForm(){var t;null===(t=this.crudConfig)||void 0===t||t.grid.columns.forEach((t=>{var i;const e=t.name;(null===(i=this.crudConfig)||void 0===i?void 0:i.form.fields.some((t=>t.name===e)))||this.dataUnit.disableField(e)}))}componentWillLoad(){this._application=s.getContextValue("__SNK__APPLICATION__"),this.loadAttachmentDataUnit()}render(){var t,i;return this.dataUnit?e("main",{class:"snk-attach__main"},e("header",{class:"snk-attach__header"},e("snk-simple-bar",{onExit:this.handleBack,messagesBuilder:this.messagesBuilder},e("div",{slot:"rightSlot"},e("ez-button",{class:"ez-button--primary",label:this.getMessage("snkAttach.finish"),onClick:this.handleFinish})))),e("div",{class:"snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column"},e("div",{class:"ez-box__container"},e("snk-simple-crud",{ref:t=>this._crudElement=t,dataUnit:this.dataUnit,taskbarManager:O(),gridConfig:null===(t=this.crudConfig)||void 0===t?void 0:t.grid,formConfig:null===(i=this.crudConfig)||void 0===i?void 0:i.form,useCancelConfirm:!1,onActionClick:this.handleTaskbarClick},e("div",{slot:"snkSimpleCrudHeader"},e("div",{class:"ez-flex ez-flex--column"},e("span",{class:"ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium"},this.getMessage("snkAttach.title")),e("span",{class:"ez-text ez-text--medium ez-text--secondary"},this.getMessage("snkAttach.description")))))))):null}static get watchers(){return{registerKey:["registerKeyWatcher"]}}};k.style=".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}.snk-attach__main.sc-snk-attach{height:85%}.ez-box__container.sc-snk-attach{height:100%}";export{k as snk_attach}
|
@@ -1 +1 @@
|
|
1
|
-
import{r as i,c as e,h as t,F as s}from"./p-d2d301a6.js";import{Action as r,ElementIDUtils as a}from"@sankhyalabs/core";import{S as n}from"./p-2e6f1666.js";import{buildFormMetadata as d,FormMetadata as o}from"@sankhyalabs/ezui/dist/collection/utils/form";import{T as h}from"./p-c2beb95c.js";import{T as l}from"./p-c9841939.js";import{c as u}from"./p-4a78e118.js";import"./p-c9399ce6.js";import"./p-41d156dd.js";import{P as c}from"./p-5534e08c.js";import"./p-9e7d65a4.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-7f4435e2.js";import"./p-c22c1d8e.js";import"./p-584d7212.js";import"./p-4651b43f.js";import{SelectionMode as v}from"@sankhyalabs/core/dist/dataunit/DataUnit";const g="__FORM:",m=class{constructor(t){i(this,t),this.exit=e(this,"exit",7),this.actionClick=e(this,"actionClick",7),this.formItemsReady=e(this,"formItemsReady",7),this._guideBuilders=new Map,this.dataUnit=void 0,this.dataState=void 0,this.configName=void 0,this.entityPath=void 0,this.actionsList=void 0,this.recordsValidator=void 0,this.masterFormConfig=void 0,this.selectedGuide=void 0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.canEdit=!0,this.presentationMode=void 0,this.resourceID=void 0,this.detailTaskbarCustomContainerId=void 0,this._breadcrumbItems=[],this._guides=void 0,this._formEditorConfigManager=void 0,this._formEditorDataUnit=void 0}observeDataUnit(){this.loadGuides(!0)}observeDataState(i,e){const t=null==i?void 0:i.selectedRecord,s=null==e?void 0:e.selectedRecord;(null==t?void 0:t.__record__id__)!==(null==s?void 0:s.__record__id__)&&this.loadGuides((null==e?void 0:e.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected())}async showFormConfig(i=!1){const e=!i||null==this._currentDetail;this._formEditorConfigManager=e?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=e?this.dataUnit:this._currentDetail.dataUnit}exitViewer(){this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===l.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){m.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataState.insertionMode,this.dataUnit)))}getMessage(i){return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=d(this.masterFormConfig,this.dataUnit,!0);const e=this._masterFormMetadata.getAllSheets(),t=this.dataUnit.getSelectedRecord(),s=!t||this.dataUnit.isNewRecord(t.__record__id__),r=[];Array.from(e.values()).forEach((i=>{const e={id:i.name,label:i.label};this.isDetail(i.name)&&s&&(e.tooltip="Para alterar detalhes é necessário estar com um registro selecionado.",e.disabled=!0),r.push(e)})),this._guides=r,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}isDetail(i){return null!=o.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const e=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&(this._guideNavigator.updateItem(e).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))})),this._guides=this._guides.map((i=>i.id===e.id?Object.assign(Object.assign({},i),e):i)))}getTaskBarId(){var i;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkGuideViewer.finish_edition":"snkGuideViewer.regular"}loadTaskbarProcessor(){var i;const e=this.getTaskBarId(),t=[];this.dataState&&this.dataState.hasPrevious||t.push("PREVIOUS"),this.dataState&&this.dataState.hasNext||t.push("NEXT"),(null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)&&(this.dataState.selectionInfo.length>1&&t.push("CLONE"),this.dataState.selectionInfo.isAllRecords()&&t.push("REMOVE"));const s=["PREVIOUS","NEXT","DIVIDER","ATTACH","CLONE","REMOVE","MORE_OPTIONS","ACTIONS_BUTTON","DIVIDER","GRID_MODE","CONFIGURATOR"];this.presentationMode==c.SECONDARY?s.unshift("INSERT"):s.push("INSERT");const r=this.getInvisibleButtons();this._taskbarProcessor=new h({"snkGuideViewer.regular":s,"snkGuideViewer.finish_edition":["CANCEL","SAVE"]}),this._taskbarProcessor.process(e,this.taskbarManager,this.dataState,t,r)}getInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===v.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}static updateContentCard(i,e,t,s){return s.saveCardState(i,e,t)}static buildFixedForms(i,e,r,a,n,d){const o=null==i?void 0:i.cardsState;if(null!=o)return t(s,null,Array.from(o.entries()).filter((([i,e])=>(null==e?void 0:e.fixed)&&i!=r)).sort((([,i],[,e])=>((null==i?void 0:i.fixSequence)||0)-((null==e?void 0:e.fixSequence)||0))).map((([s,r])=>{var o;const h=e.getSheet(s);if(null!=h)return t("snk-form-view",{levelPath:d,label:h.label,name:s,fields:h.fields,formMetadata:e,dataUnit:a,recordsValidator:n,contracted:"CONTRACTED"===(null==r?void 0:r.presentation),fixed:null==r?void 0:r.fixed,summaryFields:null===(o=null==i?void 0:i.summary)||void 0===o?void 0:o.get(s),key:s})})))}wrapDetail(i,e){if(0===i.length)return e;const s=i.pop(),r=o.getDetailName(s);return r?this.wrapDetail(i,t("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,r)}`,entityName:r},e)):void 0}getDataUnitName(i,e){if(i.length>0){const t=i.map((i=>o.getDetailName(i)));return`${this.entityPath}/${t.join("/")}/${e}`}return`${this.entityPath}/${e}`}getContent(){var i,e,s,r,a;if(!this.selectedGuide)return;const n=this.selectedGuide.id;let d;const h=n.split("::"),l=h.pop(),u=o.getDetailName(l);let v=n;if(u||h.length>0){let e,s;if(n.includes(g)){[v,e]=n.split(g);const t=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;s=t>1?this._breadcrumbItems[t-2]:this.selectedGuide}else s=this.selectedGuide;d=this.wrapDetail(h,t("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(h,u),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:u,selectedForm:e,branchGuide:s,guideItemPath:this._breadcrumbItems,key:`detail${v}`,canEdit:this.canEdit,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail),resourceID:this.resourceID,taskbarCustomContainerId:this.detailTaskbarCustomContainerId}))}else{const i=this.selectedGuide.id,o=this._masterFormMetadata.getSheet(i);if(o){const h=null===(s=null===(e=this.masterFormConfig)||void 0===e?void 0:e.cardsState)||void 0===s?void 0:s.get(i);d=t("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.fixed,summaryFields:null===(a=null===(r=this.masterFormConfig)||void 0===r?void 0:r.summary)||void 0===a?void 0:a.get(i),name:i,label:o.label,fields:o.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,key:n},this.presentationMode==c.SECONDARY&&this.buildTaskBar())}}return d}onBreadcrumbClickHandler(i){null!=(null==i?void 0:i.id)&&this._guideNavigator.selectGuide(i.id)}updateSelectedGuideHandler(i){this._guideHasChanged=this.selectedGuide!=i,this.selectedGuide=i,this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i})),this.resetGuideBadge(i)}resetGuideBadge(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>this.canClearGuideBadge(e,i.id)?Object.assign(Object.assign({},e),{badge:null}):e))]}canClearGuideBadge(i,e){return i.id===e||this.isIncludedInChildrenList(i,e)}isIncludedInChildrenList(i,e){return this.hasChildren(i)&&this.getChildrenIdList(i).includes(e)}hasChildren(i){return i.children&&Array.isArray(i.children)}getChildrenIdList(i){return i.children.map((i=>i.id))}getConfigViewMode(){return u.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===u.FORM?this.showFormConfig(!0):this._currentDetail.configGrid())}noGuideSelected(){var i;return void 0===this.selectedGuide||"__main"===(null===(i=this.selectedGuide)||void 0===i?void 0:i.id)}componentWillLoad(){if(null==this.resourceID)throw new Error("Erro interno: resourceID não informado");this._configManager=new n(this.configName,this.resourceID,(i=>this.masterFormConfig=i)),this._configManager.loadConfig()}componentDidRender(){this._guideHasChanged&&(this._currentDetail?this._currentDetail.showUp():this._mainForm&&this._mainForm.showUp(),this._guideHasChanged=!1)}getActionsList(){return null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions?this.taskbarManager.getMoreOptions(this.getTaskBarId(),this.configName,this.dataState,this.actionsList):this.actionsList}buildTaskBar(){var i;return t("div",{class:"ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 "+(this.presentationMode!=c.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},t("snk-taskbar",{key:"guideViewerTaskbar","data-element-id":"guideViewer",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.getActionsList(),messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"},t("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"})))}async dataUnitActionHandler(i){var e;if(i.type===r.FIELD_INVALIDATED){const t=this.getGuideName(null===(e=i.payload)||void 0===e?void 0:e.fieldName);await this.addErrorBadgeToGuide(t),await this.openGuideNavigator(t)}}async addErrorBadgeToGuide(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>Object.assign(Object.assign({},e),{badge:this.getBadge(e,i)})))]}async openGuideNavigator(i){this.selectedGuide.id!==i&&await this._guideNavigator.openGuideNavidator()}getBadge(i,e){var t;return this.selectedGuide.id===e?null:e===i.id?"error":null!==(t=i.badge)&&void 0!==t?t:null}getGuideName(i){var e;for(const t of this._masterFormMetadata.getAllSheets()){const s=null===(e=t[1])||void 0===e?void 0:e.fields;for(const e of s)if(e.name===i)return t[0]}return""}componentDidLoad(){this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this))}render(){var i,e;if(null!=this._formEditorConfigManager)return t("snk-form-config",{dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null});if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const s=this._guides&&this._guides.length>1;return t("section",{class:"snk-guides-viewer"},t("div",{class:"ez-row snk-guides-viewer__header"},t("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6 ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},t("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),t("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},t("h1",{class:"ez-title ez-title--primary ez-title--xlarge"},this.getMessage("snkCrud.title")),(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)>1&&t("div",{class:"ez-margin-top--extra-small"},t("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=c.SECONDARY&&this.buildTaskBar()),t("div",{class:"snk-guides-viewer__container"},s?t("ez-guide-navigator",{ref:i=>this._guideNavigator=i,class:"snk-guides-viewer__guide-navigator",items:this._guides,selectedId:this.selectedGuide?this.selectedGuide.id:void 0,onEzSelectionChange:i=>this.updateSelectedGuideHandler(i.detail)}):t("div",null),t("div",{class:"snk-guides-viewer__detail-container"},m.buildFixedForms(this.masterFormConfig,this._masterFormMetadata,null===(e=this.selectedGuide)||void 0===e?void 0:e.id,this.dataUnit,this.recordsValidator),this.getContent())),t("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this.getConfigViewMode(),onConfigSelected:i=>this.changeConfigViewMode(i.detail),messagesBuilder:this.messagesBuilder,onOpenConfig:i=>this.openConfig(i.detail),resourceID:this.resourceID}))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};m.style=".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";export{m as S}
|
1
|
+
import{r as i,c as e,h as t,F as s}from"./p-d2d301a6.js";import{Action as r,ElementIDUtils as a}from"@sankhyalabs/core";import{S as n}from"./p-2e6f1666.js";import{buildFormMetadata as d,FormMetadata as o}from"@sankhyalabs/ezui/dist/collection/utils/form";import{T as h}from"./p-c2beb95c.js";import{T as l}from"./p-c9841939.js";import{c as u}from"./p-4a78e118.js";import"./p-c9399ce6.js";import"./p-41d156dd.js";import{P as c}from"./p-5534e08c.js";import"./p-9e7d65a4.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-73407f35.js";import"./p-c22c1d8e.js";import"./p-584d7212.js";import"./p-4651b43f.js";import{SelectionMode as v}from"@sankhyalabs/core/dist/dataunit/DataUnit";const g="__FORM:",m=class{constructor(t){i(this,t),this.exit=e(this,"exit",7),this.actionClick=e(this,"actionClick",7),this.formItemsReady=e(this,"formItemsReady",7),this._guideBuilders=new Map,this.dataUnit=void 0,this.dataState=void 0,this.configName=void 0,this.entityPath=void 0,this.actionsList=void 0,this.recordsValidator=void 0,this.masterFormConfig=void 0,this.selectedGuide=void 0,this.taskbarManager=void 0,this.messagesBuilder=void 0,this.canEdit=!0,this.presentationMode=void 0,this.resourceID=void 0,this.detailTaskbarCustomContainerId=void 0,this._breadcrumbItems=[],this._guides=void 0,this._formEditorConfigManager=void 0,this._formEditorDataUnit=void 0}observeDataUnit(){this.loadGuides(!0)}observeDataState(i,e){const t=null==i?void 0:i.selectedRecord,s=null==e?void 0:e.selectedRecord;(null==t?void 0:t.__record__id__)!==(null==s?void 0:s.__record__id__)&&this.loadGuides((null==e?void 0:e.insertionMode)!=(null==i?void 0:i.insertionMode))}observeMasterFormConfig(){this.loadGuides(this.noGuideSelected())}async showFormConfig(i=!1){const e=!i||null==this._currentDetail;this._formEditorConfigManager=e?this._configManager:this._currentDetail.formConfigManager,this._formEditorDataUnit=e?this.dataUnit:this._currentDetail.dataUnit}exitViewer(){this.dataUnit.isDirty()?this.dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}onActionClick(i){i.detail===l.CONFIGURATOR&&"master"!=i.target.dataset.taskbarOwner&&(this._snkConfigurator.open(),i.stopImmediatePropagation(),i.stopPropagation())}onContentCardChanged(i){m.updateContentCard(i.detail.formName,i.detail.cardConfig,i.detail.propertyChanged,this._configManager).then((()=>this.masterFormConfig=this._configManager.getConfig(this.dataState.insertionMode,this.dataUnit)))}getMessage(i){return this.messagesBuilder.getMessage(i,this.dataUnit.getSelectedRecord())}loadGuides(i){if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this._masterFormMetadata=d(this.masterFormConfig,this.dataUnit,!0);const e=this._masterFormMetadata.getAllSheets(),t=this.dataUnit.getSelectedRecord(),s=!t||this.dataUnit.isNewRecord(t.__record__id__),r=[];Array.from(e.values()).forEach((i=>{const e={id:i.name,label:i.label};this.isDetail(i.name)&&s&&(e.tooltip="Para alterar detalhes é necessário estar com um registro selecionado.",e.disabled=!0),r.push(e)})),this._guides=r,this._guideNavigator&&this._guideNavigator.updateItem(this._guides),i&&(this.selectedGuide=this._guides.length>0?this._guides[0]:void 0)}isDetail(i){return null!=o.getDetailName(i)}updateGuide(i){this._guideBuilders.set(i.id,i);const e=i.buildGuideItem(this._guideBuilders);this._guideNavigator&&(this._guideNavigator.updateItem(e).then((()=>{this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i}))})),this._guides=this._guides.map((i=>i.id===e.id?Object.assign(Object.assign({},i),e):i)))}getTaskBarId(){var i;return(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"snkGuideViewer.finish_edition":"snkGuideViewer.regular"}loadTaskbarProcessor(){var i;const e=this.getTaskBarId(),t=[];this.dataState&&this.dataState.hasPrevious||t.push("PREVIOUS"),this.dataState&&this.dataState.hasNext||t.push("NEXT"),(null===(i=this.dataState)||void 0===i?void 0:i.selectionInfo)&&(this.dataState.selectionInfo.length>1&&t.push("CLONE"),this.dataState.selectionInfo.isAllRecords()&&t.push("REMOVE"));const s=["PREVIOUS","NEXT","DIVIDER","ATTACH","CLONE","REMOVE","MORE_OPTIONS","ACTIONS_BUTTON","DIVIDER","GRID_MODE","CONFIGURATOR"];this.presentationMode==c.SECONDARY?s.unshift("INSERT"):s.push("INSERT");const r=this.getInvisibleButtons();this._taskbarProcessor=new h({"snkGuideViewer.regular":s,"snkGuideViewer.finish_edition":["CANCEL","SAVE"]}),this._taskbarProcessor.process(e,this.taskbarManager,this.dataState,t,r)}getInvisibleButtons(){const i=[];return this.dataState&&this.dataState.selectionInfo.mode===v.ALL_RECORDS&&i.push("ACTIONS_BUTTON"),i}static updateContentCard(i,e,t,s){return s.saveCardState(i,e,t)}static buildFixedForms(i,e,r,a,n,d){const o=null==i?void 0:i.cardsState;if(null!=o)return t(s,null,Array.from(o.entries()).filter((([i,e])=>(null==e?void 0:e.fixed)&&i!=r)).sort((([,i],[,e])=>((null==i?void 0:i.fixSequence)||0)-((null==e?void 0:e.fixSequence)||0))).map((([s,r])=>{var o;const h=e.getSheet(s);if(null!=h)return t("snk-form-view",{levelPath:d,label:h.label,name:s,fields:h.fields,formMetadata:e,dataUnit:a,recordsValidator:n,contracted:"CONTRACTED"===(null==r?void 0:r.presentation),fixed:null==r?void 0:r.fixed,summaryFields:null===(o=null==i?void 0:i.summary)||void 0===o?void 0:o.get(s),key:s})})))}wrapDetail(i,e){if(0===i.length)return e;const s=i.pop(),r=o.getDetailName(s);return r?this.wrapDetail(i,t("snk-data-unit",{dataUnitName:`${this.getDataUnitName(i,r)}`,entityName:r},e)):void 0}getDataUnitName(i,e){if(i.length>0){const t=i.map((i=>o.getDetailName(i)));return`${this.entityPath}/${t.join("/")}/${e}`}return`${this.entityPath}/${e}`}getContent(){var i,e,s,r,a;if(!this.selectedGuide)return;const n=this.selectedGuide.id;let d;const h=n.split("::"),l=h.pop(),u=o.getDetailName(l);let v=n;if(u||h.length>0){let e,s;if(n.includes(g)){[v,e]=n.split(g);const t=(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)||0;s=t>1?this._breadcrumbItems[t-2]:this.selectedGuide}else s=this.selectedGuide;d=this.wrapDetail(h,t("snk-detail-view",{ref:i=>this._currentDetail=i,dataUnitName:this.getDataUnitName(h,u),onSnkDetailGuidesChange:i=>this.updateGuide(i.detail),entityName:u,selectedForm:e,branchGuide:s,guideItemPath:this._breadcrumbItems,key:`detail${v}`,canEdit:this.canEdit,onSnkSwitchGuide:i=>this._guideNavigator.selectGuide(i.detail),resourceID:this.resourceID,taskbarCustomContainerId:this.detailTaskbarCustomContainerId}))}else{const i=this.selectedGuide.id,o=this._masterFormMetadata.getSheet(i);if(o){const h=null===(s=null===(e=this.masterFormConfig)||void 0===e?void 0:e.cardsState)||void 0===s?void 0:s.get(i);d=t("snk-form-view",{ref:i=>this._mainForm=i,fixed:null==h?void 0:h.fixed,summaryFields:null===(a=null===(r=this.masterFormConfig)||void 0===r?void 0:r.summary)||void 0===a?void 0:a.get(i),name:i,label:o.label,fields:o.fields,dataUnit:this.dataUnit,formMetadata:this._masterFormMetadata,recordsValidator:this.recordsValidator,key:n},this.presentationMode==c.SECONDARY&&this.buildTaskBar())}}return d}onBreadcrumbClickHandler(i){null!=(null==i?void 0:i.id)&&this._guideNavigator.selectGuide(i.id)}updateSelectedGuideHandler(i){this._guideHasChanged=this.selectedGuide!=i,this.selectedGuide=i,this._guideNavigator.getCurrentPath().then((i=>{this._breadcrumbItems=i})),this.resetGuideBadge(i)}resetGuideBadge(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>this.canClearGuideBadge(e,i.id)?Object.assign(Object.assign({},e),{badge:null}):e))]}canClearGuideBadge(i,e){return i.id===e||this.isIncludedInChildrenList(i,e)}isIncludedInChildrenList(i,e){return this.hasChildren(i)&&this.getChildrenIdList(i).includes(e)}hasChildren(i){return i.children&&Array.isArray(i.children)}getChildrenIdList(i){return i.children.map((i=>i.id))}getConfigViewMode(){return u.GRID}changeConfigViewMode(i){this._currentDetail&&this._currentDetail.changeViewMode(i)}openConfig(i){this._snkConfigurator.close(),this._currentDetail&&(i===u.FORM?this.showFormConfig(!0):this._currentDetail.configGrid())}noGuideSelected(){var i;return void 0===this.selectedGuide||"__main"===(null===(i=this.selectedGuide)||void 0===i?void 0:i.id)}componentWillLoad(){if(null==this.resourceID)throw new Error("Erro interno: resourceID não informado");this._configManager=new n(this.configName,this.resourceID,(i=>this.masterFormConfig=i)),this._configManager.loadConfig()}componentDidRender(){this._guideHasChanged&&(this._currentDetail?this._currentDetail.showUp():this._mainForm&&this._mainForm.showUp(),this._guideHasChanged=!1)}getActionsList(){return null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions?this.taskbarManager.getMoreOptions(this.getTaskBarId(),this.configName,this.dataState,this.actionsList):this.actionsList}buildTaskBar(){var i;return t("div",{class:"ez-col ez-flex-item--align-center ez-col--sd-6 ez-col--tb-6 "+(this.presentationMode!=c.SECONDARY?"ez-align--right":"ez-padding-bottom--medium")},t("snk-taskbar",{key:"guideViewerTaskbar","data-element-id":"guideViewer",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.getActionsList(),messagesBuilder:this.messagesBuilder,presentationMode:this.presentationMode,primaryButton:(null===(i=this.dataState)||void 0===i?void 0:i.isDirty)?"SAVE":"INSERT","data-taskbar-owner":"master",dataUnit:this.dataUnit,resourceID:this.resourceID,customSlotId:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"},t("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"})))}async dataUnitActionHandler(i){var e;if(i.type===r.FIELD_INVALIDATED){const t=this.getGuideName(null===(e=i.payload)||void 0===e?void 0:e.fieldName);await this.addErrorBadgeToGuide(t),await this.openGuideNavigator(t)}}async addErrorBadgeToGuide(i){var e;this._guides=[...null===(e=this._guides)||void 0===e?void 0:e.map((e=>Object.assign(Object.assign({},e),{badge:this.getBadge(e,i)})))]}async openGuideNavigator(i){this.selectedGuide.id!==i&&await this._guideNavigator.openGuideNavidator()}getBadge(i,e){var t;return this.selectedGuide.id===e?null:e===i.id?"error":null!==(t=i.badge)&&void 0!==t?t:null}getGuideName(i){var e;for(const t of this._masterFormMetadata.getAllSheets()){const s=null===(e=t[1])||void 0===e?void 0:e.fields;for(const e of s)if(e.name===i)return t[0]}return""}componentDidLoad(){this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this))}render(){var i,e;if(null!=this._formEditorConfigManager)return t("snk-form-config",{dataUnit:this._formEditorDataUnit,messagesBuilder:this.messagesBuilder,configManager:this._formEditorConfigManager,onConfigClose:()=>this._formEditorConfigManager=null});if(!this.dataUnit)return;if(!this._configManager.isLoaded)return;this.loadTaskbarProcessor();const s=this._guides&&this._guides.length>1;return t("section",{class:"snk-guides-viewer"},t("div",{class:"ez-row snk-guides-viewer__header"},t("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6 ez-flex--align-items-center ez-flex-item--align-center ez-padding-left--large",key:"header"},t("ez-button",{onClick:()=>this.exitViewer(),title:this.getMessage("snkCrud.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small"}),t("div",{class:"ez-flex ez-flex--column ez-flex-item--auto"},t("h1",{class:"ez-title ez-title--primary ez-title--xlarge"},this.getMessage("snkCrud.title")),(null===(i=this._breadcrumbItems)||void 0===i?void 0:i.length)>1&&t("div",{class:"ez-margin-top--extra-small"},t("ez-breadcrumb",Object.assign({items:this._breadcrumbItems,onSelectedItem:i=>this.onBreadcrumbClickHandler(null==i?void 0:i.detail)},{[a.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${a.getInternalIDInfo("breadcrumb")}`}))))),this.presentationMode!=c.SECONDARY&&this.buildTaskBar()),t("div",{class:"snk-guides-viewer__container"},s?t("ez-guide-navigator",{ref:i=>this._guideNavigator=i,class:"snk-guides-viewer__guide-navigator",items:this._guides,selectedId:this.selectedGuide?this.selectedGuide.id:void 0,onEzSelectionChange:i=>this.updateSelectedGuideHandler(i.detail)}):t("div",null),t("div",{class:"snk-guides-viewer__detail-container"},m.buildFixedForms(this.masterFormConfig,this._masterFormMetadata,null===(e=this.selectedGuide)||void 0===e?void 0:e.id,this.dataUnit,this.recordsValidator),this.getContent())),t("snk-configurator",{ref:i=>this._snkConfigurator=i,viewMode:this.getConfigViewMode(),onConfigSelected:i=>this.changeConfigViewMode(i.detail),messagesBuilder:this.messagesBuilder,onOpenConfig:i=>this.openConfig(i.detail),resourceID:this.resourceID}))}static get watchers(){return{dataUnit:["observeDataUnit"],dataState:["observeDataState"],masterFormConfig:["observeMasterFormConfig"]}}};m.style=".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-medium:var(--space--medium, 12px);--snk-guides-viewer__header--min-height:94px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-medium);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-medium)}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-medium));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-medium))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";export{m as S}
|