@sankhyalabs/sankhyablocks 10.1.0-dev.3 → 10.1.0-dev.5
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-b29e31be.js → ConfigStorage-72f34bd4.js} +2 -2
- package/dist/cjs/{DataFetcher-ed9d97ea.js → DataFetcher-991b0349.js} +19 -1
- package/dist/cjs/{FormConfigHelper-ebb77625.js → FormConfigHelper-e253a418.js} +42 -0
- package/dist/cjs/{ISave-81eb2fbc.js → ISave-ebf6b4ed.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-6838389c.js → SnkFormConfigManager-cdbb29d4.js} +4 -4
- package/dist/cjs/{SnkMultiSelectionListDataSource-1e804147.js → SnkMultiSelectionListDataSource-011bec79.js} +4 -4
- package/dist/cjs/{auth-fetcher-cc28d847.js → auth-fetcher-c3cac878.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-ab1cc071.js → dataunit-fetcher-8bf469e7.js} +1 -1
- package/dist/cjs/field-config_2.cjs.entry.js +1 -1
- package/dist/cjs/fields-layout.cjs.entry.js +4 -1
- package/dist/cjs/fields-selector.cjs.entry.js +1 -1
- package/dist/cjs/{form-config-fetcher-f0897eb5.js → form-config-fetcher-c7af90d8.js} +1 -1
- package/dist/cjs/guides-configurator.cjs.entry.js +3 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +6 -6
- package/dist/cjs/snk-attach.cjs.entry.js +5 -5
- package/dist/cjs/snk-crud.cjs.entry.js +9 -7
- package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
- package/dist/cjs/{snk-data-unit-68992932.js → snk-data-unit-7d587ad5.js} +2 -2
- package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
- package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
- package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form_2.cjs.entry.js +22 -9
- package/dist/cjs/snk-grid.cjs.entry.js +10 -8
- package/dist/cjs/{snk-guides-viewer-8b841753.js → snk-guides-viewer-366d5c32.js} +90 -28
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -4
- package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
- package/dist/cjs/snk-taskbar.cjs.entry.js +56 -44
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/snk-crud/snk-crud.js +29 -2
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +124 -23
- package/dist/collection/components/snk-form-config/FormConfigHelper.js +40 -0
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
- package/dist/collection/components/snk-form-config/fields-layout/fields-layout.js +3 -0
- package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.js +3 -1
- package/dist/collection/components/snk-form-config/snk-form-config.js +43 -6
- package/dist/collection/components/snk-grid/snk-grid.js +6 -3
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +58 -44
- package/dist/collection/lib/message/resources/en-us/snk-form.msg.js +6 -0
- package/dist/collection/lib/message/resources/es-es/snk-form.msg.js +6 -0
- package/dist/collection/lib/message/resources/pt-br/snk-form.msg.js +7 -1
- package/dist/components/DataFetcher.js +19 -1
- package/dist/components/SnkFormConfigManager.js +3 -3
- package/dist/components/field-config2.js +41 -1
- package/dist/components/fields-layout2.js +3 -0
- package/dist/components/guides-configurator2.js +3 -1
- package/dist/components/snk-crud.js +6 -2
- package/dist/components/snk-detail-view2.js +86 -23
- package/dist/components/snk-form-config2.js +19 -5
- package/dist/components/snk-grid2.js +5 -2
- package/dist/components/snk-taskbar2.js +57 -45
- package/dist/esm/{ConfigStorage-13d80e36.js → ConfigStorage-22324b6b.js} +2 -2
- package/dist/esm/{DataFetcher-f4ccd9f3.js → DataFetcher-450828a0.js} +19 -1
- package/dist/esm/{FormConfigHelper-4e42f0b6.js → FormConfigHelper-e89ca25c.js} +41 -1
- package/dist/esm/{ISave-288fa9df.js → ISave-61153166.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-3ee2937b.js → SnkFormConfigManager-b5a92e12.js} +4 -4
- package/dist/esm/{SnkMultiSelectionListDataSource-5d3a93f2.js → SnkMultiSelectionListDataSource-d7ce2e54.js} +4 -4
- package/dist/esm/{auth-fetcher-59ab0c67.js → auth-fetcher-eef9d01e.js} +1 -1
- package/dist/esm/{dataunit-fetcher-c4f9f222.js → dataunit-fetcher-da9596f6.js} +1 -1
- package/dist/esm/field-config_2.entry.js +1 -1
- package/dist/esm/fields-layout.entry.js +4 -1
- package/dist/esm/fields-selector.entry.js +1 -1
- package/dist/esm/{form-config-fetcher-6a00fe9e.js → form-config-fetcher-8d0a5e1c.js} +1 -1
- package/dist/esm/guides-configurator.entry.js +3 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pesquisa-grid_2.entry.js +4 -4
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_9.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +6 -6
- package/dist/esm/snk-attach.entry.js +5 -5
- package/dist/esm/snk-crud.entry.js +9 -7
- package/dist/esm/snk-data-exporter.entry.js +5 -5
- package/dist/esm/{snk-data-unit-0edeb967.js → snk-data-unit-99616a07.js} +2 -2
- package/dist/esm/snk-data-unit.entry.js +3 -3
- package/dist/esm/snk-detail-view.entry.js +7 -7
- package/dist/esm/snk-filter-bar_4.entry.js +3 -3
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form_2.entry.js +22 -9
- package/dist/esm/snk-grid.entry.js +10 -8
- package/dist/esm/{snk-guides-viewer-9cd4d20f.js → snk-guides-viewer-240de636.js} +90 -28
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-pesquisa.entry.js +4 -4
- package/dist/esm/snk-simple-crud.entry.js +7 -7
- package/dist/esm/snk-taskbar.entry.js +57 -45
- package/dist/sankhyablocks/{p-1c2971e4.js → p-002d4d2b.js} +1 -1
- package/dist/sankhyablocks/{p-ae108ffd.entry.js → p-0948dc0a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-7b3ca294.entry.js → p-0b9a42ad.entry.js} +1 -1
- package/dist/sankhyablocks/p-118c221e.js +1 -0
- package/dist/sankhyablocks/p-1a9c5684.entry.js +1 -0
- package/dist/sankhyablocks/p-1d589380.entry.js +1 -0
- package/dist/sankhyablocks/{p-d9c54991.js → p-28f50632.js} +1 -1
- package/dist/sankhyablocks/p-39be771c.js +1 -0
- package/dist/sankhyablocks/{p-26e0f63c.entry.js → p-4963dd2a.entry.js} +1 -1
- package/dist/sankhyablocks/p-55f6fef2.entry.js +1 -0
- package/dist/sankhyablocks/p-56f16390.entry.js +1 -0
- package/dist/sankhyablocks/{p-5304753a.js → p-58683e28.js} +2 -2
- package/dist/sankhyablocks/{p-11346b8d.entry.js → p-5ea893c5.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f15478a1.js → p-62aef37a.js} +1 -1
- package/dist/sankhyablocks/{p-34f447ba.entry.js → p-62e9b9b8.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e9021f79.entry.js → p-669bb869.entry.js} +1 -1
- package/dist/sankhyablocks/{p-6180de07.entry.js → p-6ee2ca7a.entry.js} +1 -1
- package/dist/sankhyablocks/p-7cac3870.entry.js +1 -0
- package/dist/sankhyablocks/{p-78ff8734.js → p-7d6f1285.js} +1 -1
- package/dist/sankhyablocks/{p-53599b26.js → p-840fb68c.js} +1 -1
- package/dist/sankhyablocks/{p-b4322b87.entry.js → p-86e54841.entry.js} +1 -1
- package/dist/sankhyablocks/{p-34df7eca.entry.js → p-88b337fe.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3d021bef.entry.js → p-91005a00.entry.js} +1 -1
- package/dist/sankhyablocks/p-92cfc028.js +1 -0
- package/dist/sankhyablocks/{p-44939a0e.entry.js → p-ada013c0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-9317942f.js → p-c35fc941.js} +1 -1
- package/dist/sankhyablocks/p-c98c79c3.entry.js +1 -0
- package/dist/sankhyablocks/{p-1858c023.entry.js → p-cadf4846.entry.js} +1 -1
- package/dist/sankhyablocks/{p-38e56b68.entry.js → p-e91c3c57.entry.js} +1 -1
- package/dist/sankhyablocks/{p-f8f29e1a.entry.js → p-ea729922.entry.js} +1 -1
- package/dist/sankhyablocks/p-ec5fbad8.js +1 -0
- package/dist/sankhyablocks/{p-80014119.entry.js → p-f5e942b7.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +22 -0
- package/dist/types/components/snk-form-config/FormConfigHelper.d.ts +5 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -1
- package/dist/types/components/snk-form-config/snk-form-config.d.ts +8 -2
- package/dist/types/components/snk-grid/snk-grid.d.ts +1 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -3
- package/dist/types/components.d.ts +30 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-0e279e7a.js +0 -1
- package/dist/sankhyablocks/p-3abeeefa.entry.js +0 -1
- package/dist/sankhyablocks/p-557368df.entry.js +0 -1
- package/dist/sankhyablocks/p-583151c5.entry.js +0 -1
- package/dist/sankhyablocks/p-8a88690f.entry.js +0 -1
- package/dist/sankhyablocks/p-8f73da95.js +0 -1
- package/dist/sankhyablocks/p-a2ed1ebd.entry.js +0 -1
- package/dist/sankhyablocks/p-a5108625.entry.js +0 -1
- package/dist/sankhyablocks/p-a644a956.js +0 -1
- package/dist/sankhyablocks/p-bb2f5f38.js +0 -1
@@ -3,16 +3,16 @@ import { ObjectUtils, StringUtils, Action, KeyboardManager, ElementIDUtils } fro
|
|
3
3
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
4
4
|
import { buildFieldSearch, SHORTCUT_SEARCH_FIELD } from '@sankhyalabs/ezui/dist/collection/utils';
|
5
5
|
import { buildFormMetadata, FormMetadata } from '@sankhyalabs/ezui/dist/collection/utils/form';
|
6
|
-
import './DataFetcher-
|
7
|
-
import './ISave-
|
6
|
+
import './DataFetcher-450828a0.js';
|
7
|
+
import './ISave-61153166.js';
|
8
8
|
import { P as PresentationMode } from './index-b40568ff.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-da9596f6.js';
|
12
12
|
import './filter-item-type.enum-d45e026f.js';
|
13
|
-
import './form-config-fetcher-
|
13
|
+
import './form-config-fetcher-8d0a5e1c.js';
|
14
14
|
import { V as VIEW_MODE } from './constants-7b422de0.js';
|
15
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
15
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-b5a92e12.js';
|
16
16
|
import { T as TaskbarElement } from './taskbar-elements-faaf5d8f.js';
|
17
17
|
import { T as TaskbarProcessor } from './taskbar-processor-3436124c.js';
|
18
18
|
|
@@ -23,10 +23,13 @@ const SnkGuidesViewer = class {
|
|
23
23
|
constructor(hostRef) {
|
24
24
|
registerInstance(this, hostRef);
|
25
25
|
this.snkMasterFormConfigChange = createEvent(this, "snkMasterFormConfigChange", 7);
|
26
|
+
this.formConfigVisibilityChanged = createEvent(this, "formConfigVisibilityChanged", 7);
|
26
27
|
this.exit = createEvent(this, "exit", 7);
|
27
28
|
this.actionClick = createEvent(this, "actionClick", 7);
|
28
29
|
this.formItemsReady = createEvent(this, "formItemsReady", 7);
|
29
30
|
this._guideBuilders = new Map();
|
31
|
+
this.CUSTOM_GUIDE_ID_PREFIX = "CUSTOM_GUIDE_";
|
32
|
+
this.CUSTOM_GUIDE_DATA_CUSTOM_ID = "CUSTOM_GUIDE";
|
30
33
|
this.dataUnit = undefined;
|
31
34
|
this.dataState = undefined;
|
32
35
|
this.configName = undefined;
|
@@ -45,6 +48,7 @@ const SnkGuidesViewer = class {
|
|
45
48
|
this.enableGridInsert = false;
|
46
49
|
this.ignoreReadOnlyFormFields = undefined;
|
47
50
|
this.getCustomTitle = undefined;
|
51
|
+
this.customGuidesConfig = [];
|
48
52
|
this._hasToCreateFieldSearch = true;
|
49
53
|
this._breadcrumbItems = [];
|
50
54
|
this._guides = undefined;
|
@@ -59,6 +63,9 @@ const SnkGuidesViewer = class {
|
|
59
63
|
observeDataUnit() {
|
60
64
|
this.loadGuides(true);
|
61
65
|
}
|
66
|
+
observeFormConfigManager(value) {
|
67
|
+
this.formConfigVisibilityChanged.emit(!!value);
|
68
|
+
}
|
62
69
|
observeDataState(newValue, oldValue) {
|
63
70
|
var _a, _b, _c, _d, _e, _f;
|
64
71
|
const newRecordsIds = (_b = (_a = newValue === null || newValue === void 0 ? void 0 : newValue.selectionInfo) === null || _a === void 0 ? void 0 : _a.recordIds) !== null && _b !== void 0 ? _b : (_c = newValue === null || newValue === void 0 ? void 0 : newValue.selectedRecord) === null || _c === void 0 ? void 0 : _c['__record__id__'];
|
@@ -157,7 +164,7 @@ const SnkGuidesViewer = class {
|
|
157
164
|
if (!this._configManager.isLoaded) {
|
158
165
|
return;
|
159
166
|
}
|
160
|
-
this._masterFormMetadata = buildFormMetadata(this.masterFormConfig, this.dataUnit, true);
|
167
|
+
this._masterFormMetadata = buildFormMetadata(this.masterFormConfig, this.dataUnit, true, this.customGuidesConfig);
|
161
168
|
const allSheets = this._masterFormMetadata.getAllSheets();
|
162
169
|
const currentRecord = this.dataUnit.getSelectedRecord();
|
163
170
|
const disableDetails = this.hasToDisableDetails(currentRecord);
|
@@ -303,38 +310,67 @@ const SnkGuidesViewer = class {
|
|
303
310
|
return `${this.entityPath}/${entityName}`;
|
304
311
|
}
|
305
312
|
getContent() {
|
306
|
-
var _a, _b, _c, _d, _e;
|
307
313
|
if (!this.selectedGuide) {
|
308
314
|
return;
|
309
315
|
}
|
310
316
|
const guideId = this.selectedGuide.id;
|
311
|
-
|
317
|
+
if (this.isCustomGuide(guideId)) {
|
318
|
+
return h("div", { "data-custom-id": `${this.CUSTOM_GUIDE_DATA_CUSTOM_ID}`, "data-reserved-slot-id": guideId, id: this.buildCustomGuideContainerId(guideId) });
|
319
|
+
}
|
312
320
|
const levels = guideId.split("::");
|
313
321
|
const currentLevel = levels.pop();
|
314
322
|
const childEntityName = FormMetadata.getDetailName(currentLevel);
|
315
323
|
let detailId = guideId;
|
316
|
-
if (childEntityName
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
324
|
+
if (this.isDetailGuide(childEntityName, levels)) {
|
325
|
+
return this.buildDetailGuideContent(guideId, detailId, levels, childEntityName);
|
326
|
+
}
|
327
|
+
return this.buildFormViewGuideContent(guideId);
|
328
|
+
}
|
329
|
+
buildCustomGuideContainerId(guideId) {
|
330
|
+
return `${this.CUSTOM_GUIDE_ID_PREFIX}${guideId}`;
|
331
|
+
}
|
332
|
+
buildFormViewGuideContent(cardId) {
|
333
|
+
var _a, _b, _c, _d;
|
334
|
+
const sheet = this._masterFormMetadata.getSheet(cardId);
|
335
|
+
if (!sheet)
|
336
|
+
return;
|
337
|
+
const cardConfig = (_b = (_a = this.masterFormConfig) === null || _a === void 0 ? void 0 : _a.cardsState) === null || _b === void 0 ? void 0 : _b.get(cardId);
|
338
|
+
return (h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_d = (_c = this.masterFormConfig) === null || _c === void 0 ? void 0 : _c.summary) === null || _d === void 0 ? void 0 : _d.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: cardId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar()));
|
339
|
+
}
|
340
|
+
isDetailGuide(childEntityName, levels) {
|
341
|
+
return childEntityName || levels.length > 0;
|
342
|
+
}
|
343
|
+
buildDetailGuideContent(guideId, detailId, levels, childEntityName) {
|
344
|
+
var _a;
|
345
|
+
let formName;
|
346
|
+
let detailBranch;
|
347
|
+
if (guideId.includes(FORM_NAME_PREFIX)) {
|
348
|
+
[detailId, formName] = guideId.split(FORM_NAME_PREFIX);
|
349
|
+
const pathSize = ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
350
|
+
detailBranch = pathSize > 1 ? this._breadcrumbItems[pathSize - 2] : this.selectedGuide;
|
328
351
|
}
|
329
352
|
else {
|
330
|
-
|
331
|
-
const sheet = this._masterFormMetadata.getSheet(cardId);
|
332
|
-
if (sheet) {
|
333
|
-
const cardConfig = (_c = (_b = this.masterFormConfig) === null || _b === void 0 ? void 0 : _b.cardsState) === null || _c === void 0 ? void 0 : _c.get(cardId);
|
334
|
-
content = h("snk-form-view", { ref: ref => this._mainForm = ref, fixed: cardConfig === null || cardConfig === void 0 ? void 0 : cardConfig.fixed, summaryFields: (_e = (_d = this.masterFormConfig) === null || _d === void 0 ? void 0 : _d.summary) === null || _e === void 0 ? void 0 : _e.get(cardId), name: cardId, label: sheet.label, fields: sheet.fields, dataUnit: this.dataUnit, formMetadata: this._masterFormMetadata, recordsValidator: this.recordsValidator, fieldToFocus: this._fieldToGetFocus, key: guideId, onSnkRequestClearFieldToFocus: _ => this.clearFieldToFocusHandler(), customEditors: this._customEditors, fieldsProps: this._fieldsProps, fieldSearch: this._fieldSearch }, this.presentationMode == PresentationMode.SECONDARY && this.buildTaskBar());
|
335
|
-
}
|
353
|
+
detailBranch = this.selectedGuide;
|
336
354
|
}
|
337
|
-
return
|
355
|
+
return this.wrapDetail(levels, h("snk-detail-view", { ref: (ref) => this._currentDetail = ref, dataUnitName: this.getDataUnitName(levels, childEntityName), onSnkDetailGuidesChange: (evt) => this.updateGuide(evt.detail), entityName: childEntityName, selectedForm: formName, branchGuide: detailBranch, guideItemPath: this._breadcrumbItems, key: `detail${detailId}`, canEdit: this.canEdit, onSnkSwitchGuide: evt => this._guideNavigator.selectGuide(evt.detail), resourceID: this.resourceID, taskbarCustomContainerId: this.detailTaskbarCustomContainerId, customEditors: this._customEditors, customRenders: this._customRenders, presentationMode: this.presentationMode }));
|
356
|
+
}
|
357
|
+
isCustomGuide(guideId) {
|
358
|
+
var _a;
|
359
|
+
return (_a = this.customGuidesConfig) === null || _a === void 0 ? void 0 : _a.map(g => g.id).includes(guideId);
|
360
|
+
}
|
361
|
+
attachCustomGuideInView() {
|
362
|
+
//As guias customizadas ficam em slots reservados na DOM e
|
363
|
+
// precisam ser acessadas via querySelector e colocadas no container correto na view.
|
364
|
+
var _a;
|
365
|
+
const guideId = (_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id;
|
366
|
+
if (!this.isCustomGuide(guideId))
|
367
|
+
return;
|
368
|
+
const customGuideSlot = document.querySelector(`#${guideId}`);
|
369
|
+
const customGuideElement = customGuideSlot === null || customGuideSlot === void 0 ? void 0 : customGuideSlot.firstElementChild;
|
370
|
+
const customGuideViewContainer = document.querySelector(`#${this.buildCustomGuideContainerId(guideId)}`);
|
371
|
+
if (!customGuideElement || !customGuideViewContainer)
|
372
|
+
return;
|
373
|
+
customGuideViewContainer.appendChild(customGuideElement);
|
338
374
|
}
|
339
375
|
onBreadcrumbClickHandler(item) {
|
340
376
|
if ((item === null || item === void 0 ? void 0 : item.id) == undefined) {
|
@@ -417,7 +453,29 @@ const SnkGuidesViewer = class {
|
|
417
453
|
this.addFormLegacyConfigName();
|
418
454
|
this._configManager.loadConfig();
|
419
455
|
}
|
456
|
+
componentWillRender() {
|
457
|
+
this.detachCustomGuideFromView();
|
458
|
+
}
|
459
|
+
detachCustomGuideFromView() {
|
460
|
+
// Antes de cada renderização, o componente remove a guia customizada da view
|
461
|
+
// e a coloca de volta no slot reservado na DOM para que não seja perdida sua referência.
|
462
|
+
if (!this.customGuidesConfig || this.customGuidesConfig.length === 0)
|
463
|
+
return;
|
464
|
+
const viewCustomGuideContainer = this._element.querySelector(`[data-custom-id="${this.CUSTOM_GUIDE_DATA_CUSTOM_ID}"]`);
|
465
|
+
const reservedSlotId = viewCustomGuideContainer === null || viewCustomGuideContainer === void 0 ? void 0 : viewCustomGuideContainer.getAttribute('data-reserved-slot-id');
|
466
|
+
if (!(viewCustomGuideContainer === null || viewCustomGuideContainer === void 0 ? void 0 : viewCustomGuideContainer.hasChildNodes()) || !reservedSlotId)
|
467
|
+
return;
|
468
|
+
const customGuideReservedSlot = document.querySelector(`#${reservedSlotId}`);
|
469
|
+
const customGuideElement = viewCustomGuideContainer === null || viewCustomGuideContainer === void 0 ? void 0 : viewCustomGuideContainer.firstElementChild;
|
470
|
+
if (!customGuideReservedSlot || !customGuideElement)
|
471
|
+
return;
|
472
|
+
customGuideReservedSlot.appendChild(customGuideElement);
|
473
|
+
}
|
420
474
|
componentDidRender() {
|
475
|
+
var _a;
|
476
|
+
if (this.isCustomGuide((_a = this.selectedGuide) === null || _a === void 0 ? void 0 : _a.id)) {
|
477
|
+
this.attachCustomGuideInView();
|
478
|
+
}
|
421
479
|
if (!this._guideHasChanged) {
|
422
480
|
return;
|
423
481
|
}
|
@@ -546,6 +604,9 @@ const SnkGuidesViewer = class {
|
|
546
604
|
const labels = selectedRecords.map(record => this.messagesBuilder.getMessage("snkCrud.title", record));
|
547
605
|
return `[${labels.join(", ")}]`;
|
548
606
|
}
|
607
|
+
getCustomGuidesConfig() {
|
608
|
+
return this._currentDetail ? [] : this.customGuidesConfig;
|
609
|
+
}
|
549
610
|
componentDidLoad() {
|
550
611
|
this.dataUnit.subscribe(this.dataUnitActionHandler.bind(this));
|
551
612
|
this.initKeyboardManager();
|
@@ -565,7 +626,7 @@ const SnkGuidesViewer = class {
|
|
565
626
|
render() {
|
566
627
|
var _a, _b;
|
567
628
|
if (this._formEditorConfigManager != undefined) {
|
568
|
-
return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null }));
|
629
|
+
return (h("snk-form-config", { ref: ref => this._container = ref, tabindex: -1, dataUnit: this._formEditorDataUnit, messagesBuilder: this.messagesBuilder, configManager: this._formEditorConfigManager, onConfigClose: () => this._formEditorConfigManager = null, customGuidesConfig: this.getCustomGuidesConfig() }));
|
569
630
|
}
|
570
631
|
if (!this.dataUnit || !this._configManager.isLoaded) {
|
571
632
|
return;
|
@@ -591,6 +652,7 @@ const SnkGuidesViewer = class {
|
|
591
652
|
get _element() { return getElement(this); }
|
592
653
|
static get watchers() { return {
|
593
654
|
"dataUnit": ["observeDataUnit"],
|
655
|
+
"_formEditorConfigManager": ["observeFormConfigManager"],
|
594
656
|
"dataState": ["observeDataState"],
|
595
657
|
"masterFormConfig": ["observeMasterFormConfig"]
|
596
658
|
}; }
|
@@ -1,24 +1,24 @@
|
|
1
|
-
export { S as snk_guides_viewer } from './snk-guides-viewer-
|
1
|
+
export { S as snk_guides_viewer } from './snk-guides-viewer-240de636.js';
|
2
2
|
import './index-479e1293.js';
|
3
3
|
import '@sankhyalabs/core';
|
4
4
|
import '@sankhyalabs/core/dist/dataunit/DataUnit';
|
5
5
|
import '@sankhyalabs/ezui/dist/collection/utils';
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/form';
|
7
|
-
import './DataFetcher-
|
7
|
+
import './DataFetcher-450828a0.js';
|
8
8
|
import './PrintUtils-3e4ff0f5.js';
|
9
9
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
10
|
-
import './ISave-
|
10
|
+
import './ISave-61153166.js';
|
11
11
|
import './index-b40568ff.js';
|
12
12
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
13
|
-
import './dataunit-fetcher-
|
13
|
+
import './dataunit-fetcher-da9596f6.js';
|
14
14
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
15
15
|
import '@sankhyalabs/core/dist/utils/SortingUtils';
|
16
16
|
import './ResourceIDUtils-a114189a.js';
|
17
17
|
import './filter-item-type.enum-d45e026f.js';
|
18
|
-
import './form-config-fetcher-
|
18
|
+
import './form-config-fetcher-8d0a5e1c.js';
|
19
19
|
import './constants-7b422de0.js';
|
20
|
-
import './SnkFormConfigManager-
|
21
|
-
import './ConfigStorage-
|
20
|
+
import './SnkFormConfigManager-b5a92e12.js';
|
21
|
+
import './ConfigStorage-22324b6b.js';
|
22
22
|
import './taskbar-elements-faaf5d8f.js';
|
23
23
|
import './index-446f9341.js';
|
24
24
|
import './taskbar-processor-3436124c.js';
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host } from './index-479e1293.js';
|
2
2
|
import { StringUtils, ObjectUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
3
|
import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-2db38ff2.js';
|
4
|
-
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-
|
4
|
+
import { P as PersonalizedFilterFetcher, C as ConfigStorage } from './ConfigStorage-22324b6b.js';
|
5
5
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
6
6
|
import { a as FilterGroupCondition, D as DefaultFilter } from './index-8acbae97.js';
|
7
7
|
import { s as store } from './index-446f9341.js';
|
8
8
|
import './filter-item-type.enum-d45e026f.js';
|
9
|
-
import './form-config-fetcher-
|
10
|
-
import './DataFetcher-
|
9
|
+
import './form-config-fetcher-8d0a5e1c.js';
|
10
|
+
import './DataFetcher-450828a0.js';
|
11
11
|
import './PrintUtils-3e4ff0f5.js';
|
12
12
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
13
13
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement } from './index-479e1293.js';
|
2
2
|
import { ObjectUtils, StringUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
3
|
-
import { P as PesquisaFetcher, b as buildGridMetadata, a as PESQUISA_VIEW_MODE } from './ISave-
|
4
|
-
import './DataFetcher-
|
3
|
+
import { P as PesquisaFetcher, b as buildGridMetadata, a as PESQUISA_VIEW_MODE } from './ISave-61153166.js';
|
4
|
+
import './DataFetcher-450828a0.js';
|
5
5
|
import './index-b40568ff.js';
|
6
6
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
7
7
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
8
|
-
import './dataunit-fetcher-
|
8
|
+
import './dataunit-fetcher-da9596f6.js';
|
9
9
|
import './filter-item-type.enum-d45e026f.js';
|
10
|
-
import './form-config-fetcher-
|
10
|
+
import './form-config-fetcher-8d0a5e1c.js';
|
11
11
|
import './constants-7b422de0.js';
|
12
12
|
import './PrintUtils-3e4ff0f5.js';
|
13
13
|
import '@sankhyalabs/ezui/dist/collection/components/ez-grid/utils';
|
@@ -3,18 +3,18 @@ import { StringUtils, ApplicationContext, ObjectUtils, Action, DataType, UserInt
|
|
3
3
|
import { CSSVarsUtils, buildFieldSearch } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { V as VIEW_MODE, S as SIMPLE_CRUD_MODE } from './constants-7b422de0.js';
|
5
5
|
import { T as TaskbarElement } from './taskbar-elements-faaf5d8f.js';
|
6
|
-
import './DataFetcher-
|
7
|
-
import './ISave-
|
8
|
-
import { S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils, c as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-
|
6
|
+
import './DataFetcher-450828a0.js';
|
7
|
+
import './ISave-61153166.js';
|
8
|
+
import { S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils, c as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-d7ce2e54.js';
|
9
9
|
import { P as PresentationMode } from './index-b40568ff.js';
|
10
10
|
import '@sankhyalabs/ezui/dist/collection/utils/constants';
|
11
11
|
import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
12
|
-
import { I as InMemoryLoader } from './dataunit-fetcher-
|
12
|
+
import { I as InMemoryLoader } from './dataunit-fetcher-da9596f6.js';
|
13
13
|
import './filter-item-type.enum-d45e026f.js';
|
14
|
-
import { F as FormConfigFetcher } from './form-config-fetcher-
|
14
|
+
import { F as FormConfigFetcher } from './form-config-fetcher-8d0a5e1c.js';
|
15
15
|
import { T as TaskbarProcessor } from './taskbar-processor-3436124c.js';
|
16
|
-
import { C as ConfigStorage } from './ConfigStorage-
|
17
|
-
import { S as SnkFormConfigManager } from './SnkFormConfigManager-
|
16
|
+
import { C as ConfigStorage } from './ConfigStorage-22324b6b.js';
|
17
|
+
import { S as SnkFormConfigManager } from './SnkFormConfigManager-b5a92e12.js';
|
18
18
|
import { s as store } from './index-446f9341.js';
|
19
19
|
import './PrintUtils-3e4ff0f5.js';
|
20
20
|
import './GetSelectedRecordsIDsInfo-9fa41508.js';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-479e1293.js';
|
2
|
-
import { Action, LockManager, LockManagerOperation, SilentException, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection
|
2
|
+
import { Action, ElementIDUtils, LockManager, LockManagerOperation, SilentException, StringUtils, ApplicationContext, OVERFLOWED_CLASS_NAME, OverflowWatcher, OverflowDirection } from '@sankhyalabs/core';
|
3
|
+
import { P as PresentationMode } from './index-b40568ff.js';
|
3
4
|
import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
|
4
5
|
import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-faaf5d8f.js';
|
5
|
-
import { P as PresentationMode } from './index-b40568ff.js';
|
6
6
|
import './index-446f9341.js';
|
7
7
|
|
8
8
|
const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";
|
@@ -19,6 +19,7 @@ const SnkTaskbar = class {
|
|
19
19
|
this.TASKBAR_CUSTOM_ELEMENTS = 'taskbar-custom-elements-container';
|
20
20
|
this.TASKBAR_ADDITIONAL_SLOT_CONTAINER_CLASS_NAME = 'taskbar-additional-slot-container';
|
21
21
|
this.TASKBAR_ADDITIONAL_SLOT = 'taskbar-additional-slot-container';
|
22
|
+
this._dataUnitInitialized = false;
|
22
23
|
this._titleKeyByElement = {
|
23
24
|
[TaskbarElement.UPDATE_MULTIPLE]: "snkTaskbar.titleUpdateMultiple",
|
24
25
|
[TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
|
@@ -117,6 +118,17 @@ const SnkTaskbar = class {
|
|
117
118
|
this.taskbarSaveUnlocker.emit();
|
118
119
|
}
|
119
120
|
}
|
121
|
+
observeDataUnit(newValue) {
|
122
|
+
this.initializeDataUnit(newValue);
|
123
|
+
}
|
124
|
+
initializeDataUnit(dataUnit) {
|
125
|
+
if (!!dataUnit && !this._dataUnitInitialized) {
|
126
|
+
this._dataUnitInitialized = true;
|
127
|
+
const dataInfo = { dataUnit: this.dataUnit };
|
128
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
129
|
+
this.dataUnit.subscribe(this.onSaveEvent);
|
130
|
+
}
|
131
|
+
}
|
120
132
|
// Internal methods
|
121
133
|
elementsFromString(strButtons) {
|
122
134
|
const elements = [];
|
@@ -162,45 +174,46 @@ const SnkTaskbar = class {
|
|
162
174
|
}
|
163
175
|
elementClick(elem) {
|
164
176
|
LockManager.whenResolve(this._element, LockManagerOperation.TASKBAR_CLICK).then(() => {
|
165
|
-
if (this.dataUnit) {
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
177
|
+
if (!this.dataUnit) {
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
switch (elem) {
|
181
|
+
case TaskbarElement.PREVIOUS:
|
182
|
+
this.dataUnit.previousRecord();
|
183
|
+
break;
|
184
|
+
case TaskbarElement.NEXT:
|
185
|
+
this.dataUnit.nextRecord();
|
186
|
+
break;
|
187
|
+
case TaskbarElement.REFRESH:
|
188
|
+
this.dataUnit.loadData();
|
189
|
+
break;
|
190
|
+
case TaskbarElement.CLONE:
|
191
|
+
this.dataUnit.copySelected();
|
192
|
+
break;
|
193
|
+
case TaskbarElement.REMOVE:
|
194
|
+
this.dataUnit.removeSelectedRecords();
|
195
|
+
break;
|
196
|
+
case TaskbarElement.INSERT:
|
197
|
+
this.dataUnit.addRecord();
|
198
|
+
break;
|
199
|
+
case TaskbarElement.CANCEL:
|
200
|
+
this.dataUnit.cancelEdition();
|
201
|
+
break;
|
202
|
+
case TaskbarElement.SAVE:
|
203
|
+
if (!this._isWaitingForSave) {
|
204
|
+
this._isWaitingForSave = true;
|
205
|
+
this.dataUnit.saveData().catch((err) => {
|
206
|
+
if (err instanceof SilentException) {
|
207
|
+
return;
|
208
|
+
}
|
209
|
+
else {
|
210
|
+
throw err;
|
211
|
+
}
|
212
|
+
}).finally(() => {
|
213
|
+
this._isWaitingForSave = false;
|
214
|
+
});
|
215
|
+
}
|
216
|
+
break;
|
204
217
|
}
|
205
218
|
if (this.isEnabled(elem))
|
206
219
|
this.actionClick.emit(elem);
|
@@ -399,10 +412,8 @@ const SnkTaskbar = class {
|
|
399
412
|
};
|
400
413
|
}
|
401
414
|
componentDidLoad() {
|
402
|
-
|
403
|
-
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
415
|
+
this.initializeDataUnit(this.dataUnit);
|
404
416
|
this.handleOverFlowStrategy();
|
405
|
-
this.dataUnit.subscribe(this.onSaveEvent);
|
406
417
|
}
|
407
418
|
componentDidRender() {
|
408
419
|
this.appendCustomElementsInTaskbar();
|
@@ -462,7 +473,8 @@ const SnkTaskbar = class {
|
|
462
473
|
"buttons": ["observeButtons"],
|
463
474
|
"disabledButtons": ["observeDisabledButtons"],
|
464
475
|
"_lastWidth": ["observeLastWidth"],
|
465
|
-
"_isWaitingForSave": ["observeIsWaitingForSave"]
|
476
|
+
"_isWaitingForSave": ["observeIsWaitingForSave"],
|
477
|
+
"dataUnit": ["observeDataUnit"]
|
466
478
|
}; }
|
467
479
|
};
|
468
480
|
SnkTaskbar.style = snkTaskbarCss;
|
@@ -1 +1 @@
|
|
1
|
-
import{ObjectUtils as t}from"@sankhyalabs/core";import{R as a}from"./p-
|
1
|
+
import{ObjectUtils as t}from"@sankhyalabs/core";import{R as a}from"./p-c35fc941.js";class s extends a{getData(a){const s=`cfg://auth/${a}`;return new Promise(((a,e)=>{this.loadResource(s).then((s=>{let e=t.stringToObject(s);e&&"object"==typeof e&&a(e)})).catch((t=>{e(t)}))}))}}var e;!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(e||(e={}));export{e as A,s as a}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{r as t,c as e,h as i,H as s,g as n}from"./p-d8d8169b.js";import{DateUtils as r,StringUtils as a,ObjectUtils as o,WaitingChangeException as h,SilentException as l,WarningException as c,ErrorException as d,ElementIDUtils as u,SearchUtils as p,ArrayUtils as m,KeyboardManager as g,OnboardingUtils as w,DependencyType as y,DataType as v,ApplicationContext as f,ErrorTracking as P,UserAgentUtils as k,LockManager as z,LockManagerOperation as _}from"@sankhyalabs/core";import{ApplicationUtils as x}from"@sankhyalabs/ezui/dist/collection/utils";import{C as A}from"./p-
|
1
|
+
import{r as t,c as e,h as i,H as s,g as n}from"./p-d8d8169b.js";import{DateUtils as r,StringUtils as a,ObjectUtils as o,WaitingChangeException as h,SilentException as l,WarningException as c,ErrorException as d,ElementIDUtils as u,SearchUtils as p,ArrayUtils as m,KeyboardManager as g,OnboardingUtils as w,DependencyType as y,DataType as v,ApplicationContext as f,ErrorTracking as P,UserAgentUtils as k,LockManager as z,LockManagerOperation as _}from"@sankhyalabs/core";import{ApplicationUtils as x}from"@sankhyalabs/ezui/dist/collection/utils";import{C as A}from"./p-7d6f1285.js";import{d as S,D as b,U as I,S as T}from"./p-39be771c.js";import{A as O,a as L}from"./p-002d4d2b.js";import{P as N,D as C}from"./p-58683e28.js";import{P as E}from"./p-840fb68c.js";import{T as D}from"./p-9019a32f.js";import"./p-0f3698af.js";import"./p-ff1990ad.js";import{F as R}from"./p-c35fc941.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class F{static webConnectionCaller(t,e,i){var s;null===(s=window.AppletCaller)||void 0===s||s.webConnectionCaller(t,e,i)}}const M=U;function U(t,e){const i=j();return(U=function(t){return i[t-=378]})(t,e)}function j(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(j=function(){return t})()}!function(){const t=U,e=j();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class ${[M(397)](t){const e=M;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const i=new H("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>i.putAccess(t[e(382)],String(t.status)==e(398)))),i}}class H{constructor(t){const e=M;this.isSup=t,this[e(384)]={}}[M(378)](t,e){this[M(384)][t]=e}[M(393)](t){const e=M;if(this[e(402)])return!0;let i=!0;return this[e(384)][e(380)](t)&&(i=this.actions[t]),i}isUserSup(){return this.isSup}}class B{constructor(){this._embeddedParams=new Map,this._cachedParams=new Map,this.templateByQuery=new Map;try{if(null!=window.MGE_PARAMS){atob(window.MGE_PARAMS).split("__;__").forEach((t=>{const[e,i]=t.split("__=__");this._embeddedParams.set(e,i)}))}}catch(t){console.error("Problemas ao obter parâmetros embarcados"),console.error(t)}this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",S.gql`query($name: String!) {
|
2
2
|
$queryAlias$: fetchResource(name: $name){
|
3
3
|
name
|
4
4
|
resource
|
@@ -1 +1 @@
|
|
1
|
-
import{r as e,c as i,f as t,h as s,H as o,g as n}from"./p-d8d8169b.js";import{StringUtils as r,ObjectUtils as a}from"@sankhyalabs/core";import{S as l}from"./p-51833248.js";import{S as d,d as h,I as u}from"./p-8f73da95.js";import{a as c,G as p}from"./p-9019a32f.js";import{ApplicationUtils as g}from"@sankhyalabs/ezui/dist/collection/utils";const m=class{constructor(t){e(this,t),this.isEditingGuideName=i(this,"isEditingGuideName",7),this.isEditingGroupName=i(this,"isEditingGroupName",7),this.layoutChanged=i(this,"layoutChanged",7),this.setFieldListAsAvailable=i(this,"setFieldListAsAvailable",7),this.guideRenamed=i(this,"guideRenamed",7),this.ID_GROUPS="container-groups",this.ID_FIELDS="container-fields",this.reservedGuideNames=[c.main.toLowerCase(),c.general.toLocaleLowerCase()],this.groupsListMemory=[],this.groupsRefList=[],this.isEditGuideNameActive=!1,this.selectedGuide=void 0,this.groupsList=[],this.guideNames=[],this.dataUnit=void 0,this.messagesBuilder=void 0}onMessagesBuilderChange(){this.setCustomCSSProperties()}handleFieldConfigChanged({detail:e}){const i=this.groupsListMemory.find((i=>i.name===e.group));if(!i)return;const t=i.fields.map((i=>i.name===e.name?e:i)),s=this.groupsListMemory.map((e=>e.name===i.name?{name:e.name,fields:t}:e));this.applyGroupUpdate(s)}observeSelectedGuide(){this.isEditGuideNameActive=!1,t(this),this.isEditingGroupName.emit(!1)}observeGroupList(e){this.groupsListMemory=[...e]}observeIsEditGuideNameActive(e){this.isEditingGuideName.emit(e)}async addFieldToLayout(e){e.group=p.noGroup,e.tab=this.selectedGuide.name;const i=this.getFixedFieldsGroup(),t={name:p.noGroup,fields:i?[...i.fields,e]:[e]},s=i?[t,...this.groupsListMemory.slice(1)]:[t,...this.groupsListMemory];this.applyGroupUpdate(s)}getFixedFieldsGroup(){return this.groupsListMemory.find((e=>e.name===p.noGroup))}getMessage(e,i){return this.messagesBuilder.getMessage(e,i)}handleAddGroup(){const e={name:this.buildNewGroupName(),fields:[]},i=[...this.groupsListMemory,e];this.applyGroupUpdate(i)}buildNewGroupName(){var e,i;const t=this.getMessage("snkFormConfig.form.newGroup"),s=null!==(i=null===(e=this.groupsListMemory.filter((e=>e.name.includes(t))))||void 0===e?void 0:e.length)&&void 0!==i?i:0;return 0===s?t:`${t} (${s})`}makeDynamicFieldsContainersDraggable(){this.groupsList.filter((e=>e.name!==p.noGroup)).forEach((e=>{this.makeFieldContainerDraggable(this.getFieldsContainerId(e.name))}))}getFieldsContainerId(e){return`${this.ID_FIELDS}-${r.replaceBlankCharacters(e)}`}handleSortGroups(e){var i;const t=null===(i=e.to)||void 0===i?void 0:i.children;if(!t)return;const s=Array.from(t).map((e=>e.getAttribute("data-group-name"))),o=[],n=this.getFixedFieldsGroup();n&&o.push(n),s.forEach((e=>{const i=this.groupsListMemory.find((i=>i.name===e));i&&o.push(i)})),this.applyGroupUpdate(o)}handleFieldsChanged(e){let i=[...this.groupsListMemory];i=[...this.handleFieldsOnGroupUpdate(i,e,d.FROM)],i=[...this.handleFieldsOnGroupUpdate(i,e,d.TO)],this.applyGroupUpdate(i)}applyGroupUpdate(e){var i;return null===(i=this.groupsRefList)||void 0===i||i.forEach((e=>null==e?void 0:e.cancelEdition())),!a.equals(e,this.groupsListMemory)&&(this.groupsListMemory=[...e],this.layoutChanged.emit(this.groupsListMemory),!0)}handleFieldsOnGroupUpdate(e,i,t){const s=i[t];return s.id===u?e:this.updateGroupList(e,s,t,i)}updateGroupList(e,i,t,s){const o=i.getAttribute("data-group-name"),n={name:o,fields:h(s,t,o,this.selectedGuide.name)};return this.replaceGroup(e,n)}replaceGroup(e,i){return e.map((e=>e.name===i.name?i:e))}makeGroupsDraggable(){try{const e=this.getContainerElement(this.ID_GROUPS);if(!e)return;new l(e,{group:"groups",ghostClass:"ghost",direction:"horizontal",animation:15,onSort:e=>this.handleSortGroups(e)})}catch(e){console.error(this.getMessage("snkFormConfig.errors.failMakeGroupsDraggable"),this.ID_GROUPS)}}makeFieldContainerDraggable(e){try{const i=this.getContainerElement(e);if(!i)return;new l(i,{group:"fields",ghostClass:"ghost",direction:"vertical",animation:15,onAdd:e=>this.handleFieldsChanged(e),onRemove:e=>this.handleFieldsChanged(e),onSort:e=>this.handleFieldsChanged(e)})}catch(i){console.error(this.getMessage("snkFormConfig.errors.failMakeFieldContainerDraggable"),e)}}getContainerElement(e){return this.el.querySelector(`[id="${e}"]`)}handleSetFieldAsAvailable(e){var i;const t=null!==(i=e.group)&&void 0!==i?i:p.noGroup,s=this.groupsListMemory.find((e=>e.name===t)).fields.filter((i=>i.name!==e.name)),o=[...this.replaceGroup(this.groupsListMemory,{name:t,fields:s})];this.applyGroupUpdate(o)}removeGroup(e){var i,t;const s=null!==(t=null===(i=this.groupsListMemory.find((i=>i.name===e.name)))||void 0===i?void 0:i.fields)&&void 0!==t?t:[],o=[...this.groupsListMemory.filter((i=>i.name!==e.name))];this.applyGroupUpdate(o)&&this.setFieldListAsAvailable.emit(s)}handleRenameGroup(e){const{value:i,newValue:t}=e.detail,s=this.groupsListMemory.map((e=>{if(e.name!==i)return Object.assign({},e);const s=e.fields.map((e=>Object.assign(Object.assign({},e),{group:t})));return{name:t,fields:s}}));this.applyGroupUpdate(s)}canSaveGroup(e,i){if(!this.groupsList.some((i=>{var t;return(null!==(t=i.name)&&void 0!==t?t:"").toLocaleLowerCase()===(null!=e?e:"").toLocaleLowerCase()})))return!0;const t=this.getMessage("snkFormConfig.confirm.title"),s=this.buildDuplicatedGroupNameContent(e);return g.alert(t,s).then((()=>{var e;return null===(e=this.groupsRefList[i])||void 0===e?void 0:e.applyFocusTextEdit()})),!1}buildDuplicatedGroupNameContent(e){const i=this.selectedGuide.name;return`\n ${this.getMessage("snkFormConfig.alert.titleGroupExists")}\n <b>${e}</b>\n ${this.getMessage("snkFormConfig.alert.inTab")}\n <b>${i===c.main?this.getMessage("snkFormConfig.form.mainArea"):i}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildDuplicatedTabNameContent(e){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideExists")}\n <b>${e}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildReservedTabNameContent(e){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideReservedName")}\n <br/><br/>\n <b>${e}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}renderFields(e){if(0!==e.length)return e.map((e=>s("field-item",{key:e.name,fieldConfig:e,onLayoutConfig:!0,dataUnit:this.dataUnit,messagesBuilder:this.messagesBuilder,onSetFieldAsAvailable:e=>this.handleSetFieldAsAvailable(e.detail)})))}renderDraggableGroups(){return this.groupsList.filter((e=>e.name!==p.noGroup)).map(((e,i)=>{var t;return s("div",{key:e.name,class:"group-config","data-group-name":e.name},s("ez-collapsible-box",{ref:e=>this.groupsRefList[i]=e,label:e.name,headerSize:"large",editable:!0,removable:!0,"icon-placement":"left",onEzRemove:()=>this.removeGroup(e),onEzSaveEditLabel:e=>this.handleRenameGroup(e),onEzEditLabelMode:({detail:e})=>this.isEditingGroupName.emit(e),conditionalSave:e=>this.canSaveGroup(e,i)},s("div",{id:this.getFieldsContainerId(e.name),class:"group-content "+((null===(t=e.fields)||void 0===t?void 0:t.length)?"":"empty-content"),"data-group-name":e.name},this.renderFields(e.fields))))}))}renderFixedFields(){var e,i;const t=null!==(i=null===(e=this.groupsList.find((e=>e.name===p.noGroup)))||void 0===e?void 0:e.fields)&&void 0!==i?i:[];return this.renderFields(t)}handleRenameGuide(e){const{value:i,newValue:t}=e.detail;if(this.isEditGuideNameActive=!1,t===i)return;const s=this.guideNames.includes(t.toLowerCase()),o=this.reservedGuideNames.includes(t.toLowerCase());if(o||s){const e=this.getMessage("snkFormConfig.confirm.title"),i=o?this.buildReservedTabNameContent(t):this.buildDuplicatedTabNameContent(t);g.alert(e,i).then((()=>this._refTextEdit.applyFocusSelect()))}else this.guideRenamed.emit(t)}cancelEditGuideName(){this.isEditGuideNameActive=!1}async startGuideNameEdition(){this.isEditGuideNameActive=!0,setTimeout((async()=>{await this._refTextEdit.applyFocusSelect()}),200)}getTextEditStyle(){return{fontSize:"20px",fontWeight:"500",fontFamily:"Roboto"}}renderGuideName(){var e,i;return this.isEditGuideNameActive?s("div",{class:"guide-header"},s("ez-text-edit",{class:"collapsible-box__text-edit",ref:e=>this._refTextEdit=e,value:null===(e=this.selectedGuide)||void 0===e?void 0:e.label,styled:this.getTextEditStyle(),onSaveEdition:e=>this.handleRenameGuide(e),onCancelEdition:()=>this.cancelEditGuideName()})):s("div",{class:"guide-header"},s("span",{class:"guide-header-label"},null===(i=this.selectedGuide)||void 0===i?void 0:i.label),this.renderEditGuideNameButton())}renderEditGuideNameButton(){var e;if((null===(e=this.selectedGuide)||void 0===e?void 0:e.name)!==c.main)return s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.startGuideNameEdition(),size:"medium",iconName:"edit",title:this.getMessage("snkFormConfig.buttons.rename")})}setCustomCSSProperties(){document.documentElement.style.setProperty("--empty-content-message",`"${this.getMessage("snkFormConfig.form.labelDropField")}"`),document.documentElement.style.setProperty("--no-group-message",`"${this.getMessage("snkFormConfig.form.subTitleInfo")}"`)}componentDidRender(){this.makeGroupsDraggable(),this.makeDynamicFieldsContainersDraggable(),this.makeFieldContainerDraggable(p.noGroup),this.setCustomCSSProperties()}render(){return this.selectedGuide?s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},this.renderGuideName(),s("div",{class:"layout-container"},s("ez-scroller",{direction:"vertical",activeShadow:!0},s("div",{class:"no-group-container"},s("div",{id:p.noGroup,class:"group-content","data-group-name":p.noGroup},this.renderFixedFields())),s("hr",null),s("div",{id:this.ID_GROUPS,class:"groups-container"},this.renderDraggableGroups()))),s("div",{class:"add-group-container",onClick:this.handleAddGroup.bind(this)},s("ez-icon",{slot:"leftIcon",iconName:"plus"}),s("span",null,this.getMessage("snkFormConfig.form.createNewGroup")))):s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},s("span",{class:"no-guide-selected"},this.getMessage("snkFormConfig.form.noGuideSelected")))}get el(){return n(this)}static get watchers(){return{messagesBuilder:["onMessagesBuilderChange"],selectedGuide:["observeSelectedGuide"],groupsList:["observeGroupList"],isEditGuideNameActive:["observeIsEditGuideNameActive"]}}};m.style='.sc-fields-layout-h{display:flex;padding:12px;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);flex-direction:column}.layout-container.sc-fields-layout{container-type:inline-size;display:flex;flex-direction:column;overflow:auto;height:calc(100vh - 225px)}.guide-header.sc-fields-layout{display:flex;width:100%;font-size:20px;border-bottom:1px solid #dce0e8;margin-bottom:6px;align-items:center;height:45px}.guide-header.sc-fields-layout ez-button.sc-fields-layout{transition:all 0.2s ease-in-out;visibility:hidden;opacity:0}.guide-header.sc-fields-layout:hover ez-button.sc-fields-layout{visibility:visible;opacity:1}.guide-header-label.sc-fields-layout{display:block;padding:10px 0}.group-config.sc-fields-layout{padding:12px 0;display:flex;flex-direction:column;width:100%}.group-content.sc-fields-layout{display:grid;gap:12px;min-height:65px;width:100%;padding:6px 0;grid-template-columns:repeat(auto-fill, minmax(250px, 1fr))}.group-content.empty-content.sc-fields-layout{position:relative}.group-content.empty-content.sc-fields-layout::before{content:var(--empty-content-message, "Arraste e solte um campo aqui");color:#cbcfd7;font-size:16px;font-weight:500;text-align:center;position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;transition:opacity 0.3s;height:100%;box-sizing:border-box;padding:10px;background:#f9f9f9;border:1px dashed #dce0e8;border-radius:6px}.no-group-container.sc-fields-layout{padding:12px 0;width:100%;border-bottom:1px solid #dce0e8}.no-group-container.sc-fields-layout::before{content:var(--no-group-message, "Inclua estes campos nos grupos ou deixe-os separados no topo do formulário");width:100%;display:block;font-size:16px;font-weight:400;color:#AFB6C0;padding-bottom:12px}.add-group-container.sc-fields-layout{display:flex;align-items:center;border-top:1px solid #dce0e8;padding-top:22px;padding-bottom:12px;gap:6px;cursor:pointer;justify-content:center;width:100%;height:55px}.no-guide-selected.sc-fields-layout{display:block;margin:auto;font-size:24px;color:#AFB6C0;font-weight:500}.ghost.sc-fields-layout{opacity:.5;background:#c8fbe2}';export{m as fields_layout}
|
1
|
+
import{r as e,c as i,f as t,h as s,H as o,g as n}from"./p-d8d8169b.js";import{StringUtils as a,ObjectUtils as r}from"@sankhyalabs/core";import{S as l}from"./p-51833248.js";import{S as d,f as h,I as u}from"./p-118c221e.js";import{a as c,G as p}from"./p-9019a32f.js";import{ApplicationUtils as g}from"@sankhyalabs/ezui/dist/collection/utils";const m=class{constructor(t){e(this,t),this.isEditingGuideName=i(this,"isEditingGuideName",7),this.isEditingGroupName=i(this,"isEditingGroupName",7),this.layoutChanged=i(this,"layoutChanged",7),this.setFieldListAsAvailable=i(this,"setFieldListAsAvailable",7),this.guideRenamed=i(this,"guideRenamed",7),this.ID_GROUPS="container-groups",this.ID_FIELDS="container-fields",this.reservedGuideNames=[c.main.toLowerCase(),c.general.toLocaleLowerCase()],this.groupsListMemory=[],this.groupsRefList=[],this.isEditGuideNameActive=!1,this.selectedGuide=void 0,this.groupsList=[],this.guideNames=[],this.dataUnit=void 0,this.messagesBuilder=void 0}onMessagesBuilderChange(){this.setCustomCSSProperties()}handleFieldConfigChanged({detail:e}){const i=this.groupsListMemory.find((i=>i.name===e.group));if(!i)return;const t=i.fields.map((i=>i.name===e.name?e:i)),s=this.groupsListMemory.map((e=>e.name===i.name?{name:e.name,fields:t}:e));this.applyGroupUpdate(s)}observeSelectedGuide(){this.isEditGuideNameActive=!1,t(this),this.isEditingGroupName.emit(!1)}observeGroupList(e){this.groupsListMemory=[...e]}observeIsEditGuideNameActive(e){this.isEditingGuideName.emit(e)}async addFieldToLayout(e){e.group=p.noGroup,e.tab=this.selectedGuide.name;const i=this.getFixedFieldsGroup(),t={name:p.noGroup,fields:i?[...i.fields,e]:[e]},s=i?[t,...this.groupsListMemory.slice(1)]:[t,...this.groupsListMemory];this.applyGroupUpdate(s)}getFixedFieldsGroup(){return this.groupsListMemory.find((e=>e.name===p.noGroup))}getMessage(e,i){return this.messagesBuilder.getMessage(e,i)}handleAddGroup(){const e={name:this.buildNewGroupName(),fields:[]},i=[...this.groupsListMemory,e];this.applyGroupUpdate(i)}buildNewGroupName(){var e,i;const t=this.getMessage("snkFormConfig.form.newGroup"),s=null!==(i=null===(e=this.groupsListMemory.filter((e=>e.name.includes(t))))||void 0===e?void 0:e.length)&&void 0!==i?i:0;return 0===s?t:`${t} (${s})`}makeDynamicFieldsContainersDraggable(){this.groupsList.filter((e=>e.name!==p.noGroup)).forEach((e=>{this.makeFieldContainerDraggable(this.getFieldsContainerId(e.name))}))}getFieldsContainerId(e){return`${this.ID_FIELDS}-${a.replaceBlankCharacters(e)}`}handleSortGroups(e){var i;const t=null===(i=e.to)||void 0===i?void 0:i.children;if(!t)return;const s=Array.from(t).map((e=>e.getAttribute("data-group-name"))),o=[],n=this.getFixedFieldsGroup();n&&o.push(n),s.forEach((e=>{const i=this.groupsListMemory.find((i=>i.name===e));i&&o.push(i)})),this.applyGroupUpdate(o)}handleFieldsChanged(e){let i=[...this.groupsListMemory];i=[...this.handleFieldsOnGroupUpdate(i,e,d.FROM)],i=[...this.handleFieldsOnGroupUpdate(i,e,d.TO)],this.applyGroupUpdate(i)}applyGroupUpdate(e){var i;return null===(i=this.groupsRefList)||void 0===i||i.forEach((e=>null==e?void 0:e.cancelEdition())),!r.equals(e,this.groupsListMemory)&&(this.groupsListMemory=[...e],this.layoutChanged.emit(this.groupsListMemory),!0)}handleFieldsOnGroupUpdate(e,i,t){const s=i[t];return s.id===u?e:this.updateGroupList(e,s,t,i)}updateGroupList(e,i,t,s){const o=i.getAttribute("data-group-name"),n={name:o,fields:h(s,t,o,this.selectedGuide.name)};return this.replaceGroup(e,n)}replaceGroup(e,i){return e.map((e=>e.name===i.name?i:e))}makeGroupsDraggable(){try{const e=this.getContainerElement(this.ID_GROUPS);if(!e)return;new l(e,{group:"groups",ghostClass:"ghost",direction:"horizontal",animation:15,onSort:e=>this.handleSortGroups(e)})}catch(e){console.error(this.getMessage("snkFormConfig.errors.failMakeGroupsDraggable"),this.ID_GROUPS)}}makeFieldContainerDraggable(e){try{const i=this.getContainerElement(e);if(!i)return;new l(i,{group:"fields",ghostClass:"ghost",direction:"vertical",animation:15,onAdd:e=>this.handleFieldsChanged(e),onRemove:e=>this.handleFieldsChanged(e),onSort:e=>this.handleFieldsChanged(e)})}catch(i){console.error(this.getMessage("snkFormConfig.errors.failMakeFieldContainerDraggable"),e)}}getContainerElement(e){return this.el.querySelector(`[id="${e}"]`)}handleSetFieldAsAvailable(e){var i;const t=null!==(i=e.group)&&void 0!==i?i:p.noGroup,s=this.groupsListMemory.find((e=>e.name===t)).fields.filter((i=>i.name!==e.name)),o=[...this.replaceGroup(this.groupsListMemory,{name:t,fields:s})];this.applyGroupUpdate(o)}removeGroup(e){var i,t;const s=null!==(t=null===(i=this.groupsListMemory.find((i=>i.name===e.name)))||void 0===i?void 0:i.fields)&&void 0!==t?t:[],o=[...this.groupsListMemory.filter((i=>i.name!==e.name))];this.applyGroupUpdate(o)&&this.setFieldListAsAvailable.emit(s)}handleRenameGroup(e){const{value:i,newValue:t}=e.detail,s=this.groupsListMemory.map((e=>{if(e.name!==i)return Object.assign({},e);const s=e.fields.map((e=>Object.assign(Object.assign({},e),{group:t})));return{name:t,fields:s}}));this.applyGroupUpdate(s)}canSaveGroup(e,i){if(!this.groupsList.some((i=>{var t;return(null!==(t=i.name)&&void 0!==t?t:"").toLocaleLowerCase()===(null!=e?e:"").toLocaleLowerCase()})))return!0;const t=this.getMessage("snkFormConfig.confirm.title"),s=this.buildDuplicatedGroupNameContent(e);return g.alert(t,s).then((()=>{var e;return null===(e=this.groupsRefList[i])||void 0===e?void 0:e.applyFocusTextEdit()})),!1}buildDuplicatedGroupNameContent(e){const i=this.selectedGuide.name;return`\n ${this.getMessage("snkFormConfig.alert.titleGroupExists")}\n <b>${e}</b>\n ${this.getMessage("snkFormConfig.alert.inTab")}\n <b>${i===c.main?this.getMessage("snkFormConfig.form.mainArea"):i}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildDuplicatedTabNameContent(e){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideExists")}\n <b>${e}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}buildReservedTabNameContent(e){return`\n ${this.getMessage("snkFormConfig.alert.titleGuideReservedName")}\n <br/><br/>\n <b>${e}</b>.\n <br/><br/>\n ${this.getMessage("snkFormConfig.alert.infoValidTitle")}\n `}renderFields(e){if(0!==e.length)return e.map((e=>s("field-item",{key:e.name,fieldConfig:e,onLayoutConfig:!0,dataUnit:this.dataUnit,messagesBuilder:this.messagesBuilder,onSetFieldAsAvailable:e=>this.handleSetFieldAsAvailable(e.detail)})))}renderDraggableGroups(){return this.groupsList.filter((e=>e.name!==p.noGroup)).map(((e,i)=>{var t;return s("div",{key:e.name,class:"group-config","data-group-name":e.name},s("ez-collapsible-box",{ref:e=>this.groupsRefList[i]=e,label:e.name,headerSize:"large",editable:!0,removable:!0,"icon-placement":"left",onEzRemove:()=>this.removeGroup(e),onEzSaveEditLabel:e=>this.handleRenameGroup(e),onEzEditLabelMode:({detail:e})=>this.isEditingGroupName.emit(e),conditionalSave:e=>this.canSaveGroup(e,i)},s("div",{id:this.getFieldsContainerId(e.name),class:"group-content "+((null===(t=e.fields)||void 0===t?void 0:t.length)?"":"empty-content"),"data-group-name":e.name},this.renderFields(e.fields))))}))}renderFixedFields(){var e,i;const t=null!==(i=null===(e=this.groupsList.find((e=>e.name===p.noGroup)))||void 0===e?void 0:e.fields)&&void 0!==i?i:[];return this.renderFields(t)}handleRenameGuide(e){const{value:i,newValue:t}=e.detail;if(this.isEditGuideNameActive=!1,t===i)return;const s=this.guideNames.includes(t.toLowerCase()),o=this.reservedGuideNames.includes(t.toLowerCase());if(o||s){const e=this.getMessage("snkFormConfig.confirm.title"),i=o?this.buildReservedTabNameContent(t):this.buildDuplicatedTabNameContent(t);g.alert(e,i).then((()=>this._refTextEdit.applyFocusSelect()))}else this.guideRenamed.emit(t)}cancelEditGuideName(){this.isEditGuideNameActive=!1}async startGuideNameEdition(){this.isEditGuideNameActive=!0,setTimeout((async()=>{await this._refTextEdit.applyFocusSelect()}),200)}getTextEditStyle(){return{fontSize:"20px",fontWeight:"500",fontFamily:"Roboto"}}renderGuideName(){var e,i;return this.isEditGuideNameActive?s("div",{class:"guide-header"},s("ez-text-edit",{class:"collapsible-box__text-edit",ref:e=>this._refTextEdit=e,value:null===(e=this.selectedGuide)||void 0===e?void 0:e.label,styled:this.getTextEditStyle(),onSaveEdition:e=>this.handleRenameGuide(e),onCancelEdition:()=>this.cancelEditGuideName()})):s("div",{class:"guide-header"},s("span",{class:"guide-header-label"},null===(i=this.selectedGuide)||void 0===i?void 0:i.label),this.renderEditGuideNameButton())}renderEditGuideNameButton(){var e;if((null===(e=this.selectedGuide)||void 0===e?void 0:e.name)!==c.main)return s("ez-button",{mode:"icon",class:"ez-button--tertiary",onClick:()=>this.startGuideNameEdition(),size:"medium",iconName:"edit",title:this.getMessage("snkFormConfig.buttons.rename")})}setCustomCSSProperties(){document.documentElement.style.setProperty("--empty-content-message",`"${this.getMessage("snkFormConfig.form.labelDropField")}"`),document.documentElement.style.setProperty("--no-group-message",`"${this.getMessage("snkFormConfig.form.subTitleInfo")}"`)}componentDidRender(){this.makeGroupsDraggable(),this.makeDynamicFieldsContainersDraggable(),this.makeFieldContainerDraggable(p.noGroup),this.setCustomCSSProperties()}render(){return this.selectedGuide?this.selectedGuide.isCustom||this.selectedGuide.isDetail?s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},s("span",{class:"no-guide-selected"},this.getMessage("snkFormConfig.form.canNotEditCustomGuide"))):s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},this.renderGuideName(),s("div",{class:"layout-container"},s("ez-scroller",{direction:"vertical",activeShadow:!0},s("div",{class:"no-group-container"},s("div",{id:p.noGroup,class:"group-content","data-group-name":p.noGroup},this.renderFixedFields())),s("hr",null),s("div",{id:this.ID_GROUPS,class:"groups-container"},this.renderDraggableGroups()))),s("div",{class:"add-group-container",onClick:this.handleAddGroup.bind(this)},s("ez-icon",{slot:"leftIcon",iconName:"plus"}),s("span",null,this.getMessage("snkFormConfig.form.createNewGroup")))):s(o,{class:"ez-flex-item--auto ez-size-height--full ez-box ez-padding--medium content-container"},s("span",{class:"no-guide-selected"},this.getMessage("snkFormConfig.form.noGuideSelected")))}get el(){return n(this)}static get watchers(){return{messagesBuilder:["onMessagesBuilderChange"],selectedGuide:["observeSelectedGuide"],groupsList:["observeGroupList"],isEditGuideNameActive:["observeIsEditGuideNameActive"]}}};m.style='.sc-fields-layout-h{display:flex;padding:12px;box-shadow:var(--shadow--small, 0 0 16px rgba(0, 38, 111, 0.07));border-radius:var(--border--radius-medium, 6px);height:var(--snk-form-config-container-height);flex-direction:column}.layout-container.sc-fields-layout{container-type:inline-size;display:flex;flex-direction:column;overflow:auto;height:calc(100vh - 225px)}.guide-header.sc-fields-layout{display:flex;width:100%;font-size:20px;border-bottom:1px solid #dce0e8;margin-bottom:6px;align-items:center;height:45px}.guide-header.sc-fields-layout ez-button.sc-fields-layout{transition:all 0.2s ease-in-out;visibility:hidden;opacity:0}.guide-header.sc-fields-layout:hover ez-button.sc-fields-layout{visibility:visible;opacity:1}.guide-header-label.sc-fields-layout{display:block;padding:10px 0}.group-config.sc-fields-layout{padding:12px 0;display:flex;flex-direction:column;width:100%}.group-content.sc-fields-layout{display:grid;gap:12px;min-height:65px;width:100%;padding:6px 0;grid-template-columns:repeat(auto-fill, minmax(250px, 1fr))}.group-content.empty-content.sc-fields-layout{position:relative}.group-content.empty-content.sc-fields-layout::before{content:var(--empty-content-message, "Arraste e solte um campo aqui");color:#cbcfd7;font-size:16px;font-weight:500;text-align:center;position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;transition:opacity 0.3s;height:100%;box-sizing:border-box;padding:10px;background:#f9f9f9;border:1px dashed #dce0e8;border-radius:6px}.no-group-container.sc-fields-layout{padding:12px 0;width:100%;border-bottom:1px solid #dce0e8}.no-group-container.sc-fields-layout::before{content:var(--no-group-message, "Inclua estes campos nos grupos ou deixe-os separados no topo do formulário");width:100%;display:block;font-size:16px;font-weight:400;color:#AFB6C0;padding-bottom:12px}.add-group-container.sc-fields-layout{display:flex;align-items:center;border-top:1px solid #dce0e8;padding-top:22px;padding-bottom:12px;gap:6px;cursor:pointer;justify-content:center;width:100%;height:55px}.no-guide-selected.sc-fields-layout{display:block;margin:auto;font-size:24px;color:#AFB6C0;font-weight:500}.ghost.sc-fields-layout{opacity:.5;background:#c8fbe2}';export{m as fields_layout}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{UserInterface as n,DataType as t}from"@sankhyalabs/core";import{a as o,G as r,D as e}from"./p-9019a32f.js";const u=new Map([[n.DATE,"calendar"],[n.DATETIME,"calendar-clock"],[n.ELAPSEDTIME,"timer-outline"],[n.TIME,"timer-outline"],[n.DECIMALNUMBER,"number"],[n.INTEGERNUMBER,"number"],[n.FILE,"zip"],[n.IMAGE,"pdf"],[n.HTML,"tag_code"],[n.SEARCH,"search"],[n.SEARCHPLUS,"search"],[n.OPTIONSELECTOR,"list"],[n.CHECKBOX,"list"],[n.SWITCH,"boolean"],[n.PASSWORD,"eye-off"]]),i="container-available-fields";var l;function c(n,t,o,r){var e;const u=null===(e=null==n?void 0:n[t])||void 0===e?void 0:e.children;return u?Array.from(u).map((({fieldConfig:n})=>Object.assign(Object.assign({},n),{group:o,tab:r}))):[]}function a(n,t){return n.map((n=>Object.assign(Object.assign({},n),{fields:n.fields.map((n=>Object.assign(Object.assign({},n),{tab:t})))})))}function f(n,o,r){var e;if(null==n||!o||!r)return;const u=null===(e=o.getField(r))||void 0===e?void 0:e.dataType;if(null==u)return;if(void 0!==(null==n?void 0:n.waitmessage))return;const i=u!==t.OBJECT&&u!==t.DATE&&"object"==typeof n?n.value:n;return u===t.OBJECT?JSON.stringify(i):i}function s(n,t,o){if(!o)return!0;const r=o.properties||{},e=!0!==o[n];return r.hasOwnProperty(t)?"S"!==r[t]:e}function d(n,t,o){return!(!t||!0!==t[n])||o}function v(n){return u.get(n)||"text"}function b(n,t){var o,r;const e=t("snkFormConfig.form.newGuide"),u=null!==(r=null===(o=n.filter((n=>n.name.includes(e))))||void 0===o?void 0:o.length)&&void 0!==r?r:0;return 0===u?e:`${e} (${u})`}function m(n){const t=[];return n.forEach((n=>{n.forEach((({fields:n})=>{null==n||n.forEach((n=>{t.push(function(n){const t={cleanOnCopy:n.cleanOnCopy||!1,group:n.group===r.noGroup?void 0:n.group,label:n.label,name:n.name,required:n.required,readOnly:n.readOnly,tab:n.tab};return null!=n.defaultValue&&(t.defaultValue=null==n.defaultValue.type?{type:e.fixed,value:n.defaultValue}:n.defaultValue),t}(n))}))}))})),t}function p(n,t,r,e){const u=n.map((n=>{const t=n.tab;return Object.assign(Object.assign({},n),{tab:t&&t!==o.general?n.tab:o.main})})),i=function(n){const t=new Map;return g(n).forEach((n=>{t.set(n.name,[])})),t}(t);if(null==u?void 0:u.length){for(let n of i.keys()){const t=x(M(S(u,n,e),r,e));i.set(n,t)}return i}}function j(n,t){let r=n.tabs?[...n.tabs]:function(n){const t=[];let o=1;return null==n||n.forEach((n=>{const r=n.tab;(function(n,t){return n&&!t.map((n=>n.name)).includes(n)})(r,t)&&(t.push({name:r,label:r,visible:!0,order:o}),o+=1)})),t}(null==n?void 0:n.fields);return r=g(r),r=function(n){return n.map((n=>Object.assign(Object.assign({},n),{name:n.name?n.name:n.label})))}(r),function(n,t){const r={name:o.main,label:t,visible:!0};return n.some((n=>n.name===o.main))?n=n.map((n=>n.name===o.main?r:n)):n.unshift(r),n}(r,t)}function O(n,t=0,o){var r;if(!n||!n.metadata)return[];const e=(null===(r=n.metadata)||void 0===r?void 0:r.children)||[],u=[];for(const n of e)o.some((t=>n.label===t.label))||u.push({label:n.label,name:n.name,visible:!0,isCustom:!0,order:t++});return u}function y(n,t){let o=t.length;const r=function(n,t){return n.filter((n=>!function(n,t){return n.some((n=>n.name===t.id||n.label===t.label))}(t,n)))}(n,t);return r.map((n=>({name:n.id,label:n.label,visible:!0,isCustom:!0,order:o++})))}function g(n){return[...n.filter((n=>n.label!==o.general))]}function C(n,t){n.label||(n.label=t.label)}function h(n,t){n.tab||(n.tab=t)}function k(n){n.group||(n.group=r.noGroup)}function w(n){var t;return!0===(null===(t=null==n?void 0:n.properties)||void 0===t?void 0:t.visibleOnConfig)&&!1===(null==n?void 0:n.visible)}function M(n,t,o){const e=new Map;e.set(r.noGroup,[]);for(let r of n){const n=t.getField(r.name);((null==n?void 0:n.visible)||w(n))&&(C(r,n),h(r,o),k(r),e.has(r.group)?e.get(r.group).push(r):e.set(r.group,[r]))}return e}function S(n,t,o){return n.filter((n=>{const r=function(n,t){var o;return"string"==typeof n?n:null!==(o=null==n?void 0:n.label)&&void 0!==o?o:t}(n.tab,o);return r===t}))}function x(n){const t=[];for(let o of n.keys())t.push({name:o,fields:n.get(o)});return t}!function(n){n.FROM="from",n.TO="to"}(l||(l={}));export{i as I,l as S,O as a,j as b,y as c,p as d,b as e,c as f,m as g,f as h,s as i,d as j,v as k,a as u}
|
@@ -0,0 +1 @@
|
|
1
|
+
import{r as i,c as t,h as s,F as e,g as r}from"./p-d8d8169b.js";import{KeyboardManager as a,Action as n,ElementIDUtils as o,ApplicationContext as d,StringUtils as h}from"@sankhyalabs/core";import{SelectionMode as l}from"@sankhyalabs/core/dist/dataunit/DataUnit";import{buildFieldSearch as c}from"@sankhyalabs/ezui/dist/collection/utils";import"./p-39be771c.js";import"./p-840fb68c.js";import{C as u,S as g,a as m,R as k,b as v,c as p}from"./p-62aef37a.js";import{P as f,E as T}from"./p-0f3698af.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-58683e28.js";import"./p-ff1990ad.js";import"./p-c35fc941.js";import"./p-9019a32f.js";import{C as b}from"./p-7d6f1285.js";import{s as C}from"./p-55798617.js";import{g as E}from"./p-7dd49d15.js";import{v as R}from"./p-76e66fd9.js";import{T as _}from"./p-b987e15d.js";import{T as O}from"./p-1a0caadb.js";import"./p-8d884fab.js";import"./p-8f3f2306.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";class I extends u{getFilters(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getAppliedFilters()}getOrders(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getSort()}getResourceURI(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.name}getSelectedNumber(){return this.dataUnit.getSelectionInfo().length}getTotalRecords(){var i,t,s;const{total:e}=(null===(i=this.dataUnit)||void 0===i?void 0:i.getPaginationInfo())||{};return null!=e?e:null===(s=null===(t=this.dataUnit)||void 0===t?void 0:t.records)||void 0===s?void 0:s.length}getSelectedIDs(){return E(this.dataUnit)}getOffset(){return this.getExporterOffset(this.getPaginationInfo())}getPageSize(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.pageSize}getExportLimit(){return 5e3}getRecordID(){var i,t,s;return null===(s=null===(t=null===(i=this.dataUnit)||void 0===i?void 0:i.records)||void 0===t?void 0:t[0])||void 0===s?void 0:s.__record__id__}getPaginationInfo(){var i;return null===(i=this.dataUnit)||void 0===i?void 0:i.getPaginationInfo()}getExporterOffset(i){if(null==i)return;const t=i.firstRecord;return t>0?t-1:t}}const S=class{constructor(s){i(this,s),this.actionClick=t(this,"actionClick",7),this.gridDoubleClick=t(this,"gridDoubleClick",7),this.componentReady=t(this,"componentReady",7),this._customEditors=new Map,this._customRenders=new Map,this._keyboardManager=new a,this._topTaskbarProcessor=new O({"snkGridTopTaskbar.regular":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.secondary":["FORM_MODE","CONFIGURATOR","INSERT"],"snkGridTopTaskbar.regular.singleTaskbar":[],"snkGridTopTaskbar.finish_edition":["CANCEL","SAVE",this.handleAddFormMode()],"snkGridTopTaskbar.finish_edition.secondary":[],"snkGridTopTaskbar.finish_edition.singleTaskbar":[]}),this._headerTaskbarProcessor=new O({"snkGridHeaderTaskbar.unselected":["REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.selected":this.getGridHeaderSelectedBtns(),"snkGridHeaderTaskbar.detail.unselected":["REFRESH","MORE_OPTIONS"],"snkGridHeaderTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","REFRESH"],"snkGridHeaderTaskbar.singleTaskbar.unselected":["INSERT","FORM_MODE","CONFIGURATOR","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON","MORE_OPTIONS"],"snkGridHeaderTaskbar.singleTaskbar.selected":["UPDATE","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","ATTACH","FORM_MODE","CONFIGURATOR","REFRESH","DATA_EXPORTER","ACTIONS_BUTTON"],"snkGridHeaderTaskbar.singleTaskbar.detail.unselected":["INSERT","FORM_MODE","CONFIGURATOR","REFRESH","MORE_OPTIONS"],"snkGridHeaderTaskbar.singleTaskbar.detail.selected":["UPDATE","ATTACH","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","FORM_MODE","CONFIGURATOR","REFRESH"],"snkGridHeaderTaskbar.singleTaskbar.finish_edition":["CANCEL","SAVE",this.handleAddFormMode()]}),this.dataUnitInterceptor={interceptAction:async i=>i.type===n.METADATA_LOADED?await this.interceptMetadataLoaded(i):i.type===n.LOADING_DATA?await this.interceptLoadData(i):i},this._dataUnit=void 0,this._dataState=void 0,this._gridConfig=void 0,this._popUpGridConfig=!1,this._showSnkFilterBar=!0,this._enableContinuousInsert=!1,this._filterMode="regular",this.columnFilterDataSource=new g,this.enableLockManagerLoadingComp=!1,this.enableLockManagerTaskbarClick=!1,this.configName=void 0,this.filterBarTitle=void 0,this.resourceID=void 0,this.selectionToastConfig=void 0,this.actionsList=void 0,this.isDetail=void 0,this.taskbarManager=void 0,this.statusResolver=void 0,this.multipleSelection=void 0,this.presentationMode=f.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.recordsValidator=void 0,this.canEdit=!0,this.taskbarCustomContainerId=void 0,this.gridHeaderCustomSlotId="GRID_HEADER_CUSTOM_ELEMENTS",this.gridHeaderDynamicSearchSlotId="GRID_HEADER_DYNAMIC_SEARCH",this.topTaskbarCustomSlotId="GRID_TASKBAR_CUSTOM_ELEMENTS",this.disablePersonalizedFilter=void 0,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.autoLoad=void 0,this.autoFocus=!0,this.enableGridInsert=!1,this.outlineMode=!1,this.suppressHorizontalScroll=!1,this.strategyExporter=T.SERVER_SIDE,this.useSearchColumn=!0,this.multipleEditionEnabled=!0,this.paginationCounterMode="auto",this.suppressCheckboxColumn=void 0,this.suppressFilterColumn=!1,this.compact=void 0,this.filterCustomConfig=void 0,this.filterCustomConfigInterceptor=void 0}getGridHeaderSelectedBtns(){const i=[_.UPDATE,_.CLONE,_.REMOVE,_.MORE_OPTIONS,_.DIVIDER,_.ATTACH,_.FORM_MODE,_.CONFIGURATOR,_.REFRESH,_.DATA_EXPORTER,_.ACTIONS_BUTTON];return this.multipleEditionEnabled&&i.unshift(_.UPDATE_MULTIPLE),i}async refreshColumnFilterDataSource(){await this._grid.refreshColumnFilterDataSource()}reloadConfig(){this.loadConfig()}async showConfig(){null!=this._grid&&this.openGridConfig()}async hideConfig(){null!=this._grid&&this.closeGridConfig()}async setConfig(i){this.setGridConfig(i)}async reloadFilterBar(){var i;null===(i=this._snkFilterBar)||void 0===i||i.reload()}async getFilterBar(){return this._snkFilterBar}async addCustomEditor(i,t,s){if(this._grid)return void this._grid.addCustomEditor(i,t,s);const e=new Map(this._customEditors);e.set(i,{customEditor:t,detailContext:s}),this._customEditors=e}async addGridCustomRender(i,t,s){if(this._grid)return void this._grid.addGridCustomRender(i,t,s);const e=new Map(this._customRenders);e.set(i,{customRender:t,detailContext:s}),this._customRenders=e}async addCustomValueFormatter(i,t){this._grid.addCustomValueFormatter(i,t)}async removeCustomValueFormatter(i){this._grid.removeCustomValueFormatter(i)}async setFocus(){this._grid.setFocus()}async handleClick(i){var t;if(this.hasToBlockEvent(i)){if(i.preventDefault(),i.stopPropagation(),!await this._dataUnit.cancelEdition())return;const s=new i.constructor(i.type,i);null===(t=i.target)||void 0===t||t.dispatchEvent(s)}this._grid&&!this._grid.contains(i.target)&&this._grid.stopEdit()}hasToBlockEvent(i){var t;return(null===(t=this._snkFilterBar)||void 0===t?void 0:t.contains(i.target))&&this.enableGridInsert&&this._dataUnit.hasNewRecord()}async handleGridLegacyConfigName(i,t){i&&i!==t&&(this.addGridLegacyConfigName(),this.loadConfig())}handleAddFormMode(){return this.enableGridInsert?_.FORM_MODE:""}openGridConfig(){this._grid.getColumnsState().then((i=>{this._snkGridConfig.columns=i.filter((i=>i.name)),this._popUpGridConfig=!0}))}closeGridConfig(){this._popUpGridConfig=!1}setGridConfig(i){this._gridConfig=i,m.assertDefaultSorting(this._gridConfig,this._dataUnit)}fixColumNameCharset(i){try{return decodeURIComponent(escape(i))}catch(t){return i}}normalizeGridConfig(i){if(!i)return i;const t=i.columns.map((i=>Object.assign(Object.assign({},i),{name:this.fixColumNameCharset(i.name)})));return Object.assign(Object.assign({},i),{columns:t})}loadConfig(){b.loadGridConfig(this.configName,this.resourceID).then((i=>{this.setGridConfig(this.normalizeGridConfig(i))})).catch((i=>{console.warn(i)}))}addGridLegacyConfigName(){this.gridLegacyConfigName&&this.configName&&b.addGridLegacyConfig(this.configName,this.gridLegacyConfigName)}hasCalculatedFields(i){let t=!1;return i.forEach((i=>{var s;"true"===(null===(s=this._dataUnit.getField(i).properties)||void 0===s?void 0:s.calculated)&&(t=!0)})),t}gridConfigChangeHandler(i){const t=this.normalizeGridConfig(i.detail);b.saveGridConfig(t,this.configName,this.resourceID),i.stopPropagation()}modalConfigChangeHandler(i){const t=this.normalizeGridConfig(i.detail);this._grid.setColumnsState(t.columns).then((()=>{this.setGridConfig(t),this.closeGridConfig(),this.dataExporterProviderStore()})),i.stopPropagation()}async hasToForceClientSideExporter(){if(!this._grid)return!1;const i=(await this._grid.getAppliedColumnFilters()).map((i=>i.name.replace("FILTRO_COLUNA_","")));return this.hasCalculatedFields(i)}async dataExporterProviderStore(){const i=await this.hasToForceClientSideExporter()||this.strategyExporter===T.CLIENT_SIDE?new p(this._dataUnit,this._grid):new I(this._dataUnit,this._grid);C.set("exporterProviders",Object.assign(Object.assign({},C.get("exporterProviders")),{[this.configName]:i}))}addElementID(){o.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}loadGridCustomFormatters(i){i&&this._grid&&i.forEach((i=>{var t;(null===(t=i.properties)||void 0===t?void 0:t.rm_precision)&&this.addCustomValueFormatter(i.name,this._rmPrecisionCustomValueFormatter)}))}async interceptMetadataLoaded(i){return this.loadGridCustomFormatters(i.payload.fields),i}async interceptLoadData(i){var t;if(R(null===(t=this._snkFilterBar)||void 0===t?void 0:t.filterConfig))return i;{const i=this.messagesBuilder.getMessage("snkGrid.requiredFiltersNotFilled.title",{}),t=this.messagesBuilder.getMessage("snkGrid.requiredFiltersNotFilled.message",{});await this._application.error(i,t)}}finishLoading(){this._dataUnit.addInterceptor(this.dataUnitInterceptor),m.assertDefaultSorting(this._gridConfig,this._dataUnit),this.addElementID(),null!=this.columnFilterDataSource&&(this.columnFilterDataSource.setApplication(this._application),this.columnFilterDataSource.setDataUnit(this._dataUnit))}setCustomRenders(){if(this._grid)for(const[i,t]of this._customRenders)this._grid.addGridCustomRender(i,t.customRender,t.detailContext),this._customRenders.delete(i)}setCustomEditors(){if(this._grid)for(const[i,t]of this._customEditors)this._grid.addCustomEditor(i,t.customEditor,t.detailContext),this._customEditors.delete(i)}componentWillLoad(){this._application=d.getContextValue("__SNK__APPLICATION__");let i=this._element.parentElement;for(;i;){if("SNK-DATA-UNIT"===i.tagName.toUpperCase()){this._snkDataUnit=i,this._dataUnit=this._snkDataUnit.dataUnit,this._dataUnit?this.finishLoading():this._snkDataUnit.addEventListener("dataUnitReady",(i=>{this._dataUnit=i.detail,this.finishLoading()})),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this)),this._snkDataUnit.addEventListener("cancelEdition",(()=>{var i;(null===(i=this._dataState)||void 0===i?void 0:i.recordsIsEmpty)&&this._dataUnit.clearSelection()}));break}i=i.parentElement}this._rmPrecisionCustomValueFormatter=new k,this.addGridLegacyConfigName(),this.loadConfig(),this._continuousInsertUtils=new v(this._application,this.resourceID,this.configName),this.enableGridInsert&&this._continuousInsertUtils.getConfig().then((i=>this._enableContinuousInsert=i))}componentDidRender(){var i,t;this._rmPrecisionCustomValueFormatter.setGrid(this._grid),this.loadGridCustomFormatters(null===(t=null===(i=this._dataUnit)||void 0===i?void 0:i.metadata)||void 0===t?void 0:t.fields),this.setCustomRenders(),this.setCustomEditors()}async handleDataStateChange(i){this._dataState=i.detail,this._rmPrecisionCustomValueFormatter.setDataState(this._dataState)}getHeaderDisabledButtons(){var i;const t=[];return(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo)&&(this._dataState.selectionInfo.length>1&&t.push(_.CLONE,_.ATTACH,_.UPDATE),this._dataState.selectionInfo.isAllRecords()&&t.push(_.REMOVE)),t}getInvisibleButtons(){var i,t;let s=[];return this._dataUnit&&0!==this._dataUnit.records.length||s.push(_.DATA_EXPORTER),(null===(i=this._dataState)||void 0===i?void 0:i.selectionInfo.mode)===l.ALL_RECORDS&&s.push(_.ACTIONS_BUTTON),1===(null===(t=this._dataState)||void 0===t?void 0:t.selectionInfo.length)&&s.push(_.UPDATE_MULTIPLE),s}componentWillRender(){const i=this.getInvisibleButtons();this._headerTaskbarProcessor.process(this.getHeaderTaskbarId(),this.taskbarManager,this._dataState,this.getHeaderDisabledButtons(),i),this._topTaskbarProcessor.process(this.getTopTaskBarId(),this.taskbarManager,this._dataState,void 0,i),this.dataExporterProviderStore()}getHeaderTaskbarId(){var i,t;const s=this._dataState&&!!(null===(i=this._dataState.selectionInfo)||void 0===i?void 0:i.length),e={primary:this.isDetail?"snkGridHeaderTaskbar.detail":"snkGridHeaderTaskbar",secondary:this.isDetail?"snkGridHeaderTaskbar.detail":"snkGridHeaderTaskbar",singleTaskbar:this.isDetail?"snkGridHeaderTaskbar.singleTaskbar.detail":"snkGridHeaderTaskbar.singleTaskbar"}[this.presentationMode];let r=s?`${e}.selected`:`${e}.unselected`;return(null===(t=this._dataState)||void 0===t?void 0:t.isDirty)&&this.presentationMode===f.SINGLE_TASKBAR&&(r="snkGridHeaderTaskbar.singleTaskbar.finish_edition"),r}getTopTaskBarId(){var i;const t={primary:"",secondary:".secondary",singleTaskbar:".singleTaskbar"}[this.presentationMode];return(null===(i=this._dataState)||void 0===i?void 0:i.isDirty)?`snkGridTopTaskbar.finish_edition${t}`:`snkGridTopTaskbar.regular${t}`}getPrimaryButton(){return{primary:"INSERT",secondary:"",singleTaskbar:"INSERT"}[this.presentationMode]}getColumnSearch(i){return null!=this._columnSearch||(this._columnSearch=c(i,(({argument:i})=>new Promise((t=>{this._grid.filterColumns(i).then((i=>{t(i.filter((i=>!i.hidden)).map((i=>({label:i.label,value:i.name}))))}))}))),(i=>{null!=i&&this._grid.locateColumn(i.value)}))),this._columnSearch}getActionsList(){const i=[];if(this.enableGridInsert&&i.push(this._continuousInsertUtils.actionContinuousInsert(this._enableContinuousInsert,(()=>{this._enableContinuousInsert=!this._enableContinuousInsert,this._continuousInsertUtils.handleSaveConfig(this._enableContinuousInsert)}))),this.isGridInsertActive())return i;if(null!=this.taskbarManager&&null!=this.taskbarManager.getMoreOptions){const t=this.getTopTaskBarId();return i.concat(this.taskbarManager.getMoreOptions(t,this.configName,this._dataState,this.actionsList))}return i.concat(this.actionsList)}getActionsSettingsList(){return[{value:h.generateUUID(),label:this.messagesBuilder.getMessage("snkGrid.findColumn",{}),disableCloseOnSelect:!0,eagerInitialize:!0,itemBuilder:(i,t)=>this.getColumnSearch(t)}]}handleFilterConfigUpdated(i){if(i.length)return 1===i.length&&"PERSONALIZED_FILTER_GROUP"===i[0].id?(this._showSnkFilterBar=!0,void(this._filterMode=i[0].groupedItems.length>0?"regular":"button")):void(this._showSnkFilterBar=!0);this._showSnkFilterBar=!1}getGridHeaderButtons(){return this.isGridInsertActive()?_.MORE_OPTIONS:this._headerTaskbarProcessor.buttons}isGridInsertActive(){return this.enableGridInsert&&this._dataUnit.hasNewRecord()}render(){if(this._dataUnit)return s("div",{class:"snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large ez-box--no-outline",tabindex:"0"},s("div",{class:"snk-grid__header ez-margin-bottom--extra-small"},this._showSnkFilterBar&&s(e,null,s("snk-filter-bar",{ref:i=>this._snkFilterBar=i,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:i=>this.handleFilterConfigUpdated(i.detail),disablePersonalizedFilter:this.disablePersonalizedFilter,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,filterCustomConfig:this.filterCustomConfig,filterCustomConfigInterceptor:this.filterCustomConfigInterceptor,mode:this._filterMode}),s("hr",{class:"ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider"})),s("snk-taskbar",{class:"ez-padding-left--medium ez-padding-top--extra-small","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",actionsSettingsList:this.getActionsSettingsList()},s("slot",{name:this.topTaskbarCustomSlotId}))),s("ez-grid",{ref:i=>this._grid=i,class:(this.presentationMode===f.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:i=>{this.gridConfigChangeHandler(i)},onEzColumnFilterChanged:async()=>await this.dataExporterProviderStore(),onEzDoubleClick:i=>this.gridDoubleClick.emit(i.detail),statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,columnfilterDataSource:this.columnFilterDataSource,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,recordsValidator:this.recordsValidator,canEdit:this.canEdit,autoFocus:this.autoFocus,enableGridInsert:this.enableGridInsert,enableContinuousInsert:this._enableContinuousInsert,enableLockManagerTaskbarClick:this.enableLockManagerTaskbarClick,enableLockManagerLoadingComp:this.enableLockManagerLoadingComp,outlineMode:this.outlineMode,useSearchColumn:this.useSearchColumn,suppressHorizontalScroll:this.suppressHorizontalScroll,paginationCounterMode:this.paginationCounterMode,suppressCheckboxColumn:this.suppressCheckboxColumn,suppressFilterColumn:this.suppressFilterColumn,compact:this.compact},s("snk-taskbar",{id:"teste",dataUnit:this._dataUnit,configName:this.configName,messagesBuilder:this.messagesBuilder,"data-element-id":"grid_left",buttons:this.getGridHeaderButtons(),presentationMode:this.presentationMode,disabledButtons:this._headerTaskbarProcessor.disabledButtons,customButtons:this._headerTaskbarProcessor.customButtons,slot:"leftButtons",actionsList:this.getActionsList(),primaryButton:this.getPrimaryButton(),resourceID:this.resourceID,customContainerId:this.taskbarCustomContainerId,customSlotId:this.gridHeaderCustomSlotId,additionalSlotId:this.gridHeaderDynamicSearchSlotId,actionsSettingsList:this.getActionsSettingsList()},s("slot",{name:this.gridHeaderCustomSlotId}),s("slot",{name:this.gridHeaderDynamicSearchSlotId}))),s("div",{class:"ez-col ez-col--sd-12 snk-grid-container__footer"},s("slot",{name:"SnkGridFooter"})),s("ez-popup",{size:"medium",heightMode:"auto",useHeader:!1,opened:this._popUpGridConfig,onEzClosePopup:()=>this.closeGridConfig()},s("snk-grid-config",{ref:i=>this._snkGridConfig=i,config:this._gridConfig,"data-element-id":this._element.getAttribute(o.DATA_ELEMENT_ID_ATTRIBUTE_NAME),selectedIndex:0,configName:this.configName,onConfigChange:i=>this.modalConfigChangeHandler(i),onConfigCancel:()=>this.closeGridConfig(),resourceID:this.resourceID})))}get _element(){return r(this)}static get watchers(){return{gridLegacyConfigName:["handleGridLegacyConfigName"]}}};S.style=".sc-snk-grid-h{--snk-grid-min-height:300px;--snk-grid-padding:var(--space--small)}.snk-grid__container.sc-snk-grid{display:flex;height:100%;width:100%;padding:var(--snk-grid-padding);outline:none}.snk-grid__header.sc-snk-grid{width:100%;display:flex;flex-wrap:nowrap;justify-content:flex-end}.snk-grid__filter-bar.sc-snk-grid{width:100%}.snk-grid__header-divider.sc-snk-grid{margin-bottom:var(--space--medium)}.snk-grid__table.sc-snk-grid{min-height:var(--snk-grid-min-height)}.snk-grid-container__without-shadow.sc-snk-grid{--ezgrid__container--shadow:unset}.snk-grid-container__footer.sc-snk-grid{background-color:var(--background--xlight, #FFF);border-radius:0 0 var(--border--radius-medium) var(--border--radius-medium);box-shadow:var(--shadow--small)}";export{S as snk_grid}
|