@sankhyalabs/sankhyablocks 10.1.0-dev.4 → 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.
Files changed (139) hide show
  1. package/dist/cjs/{ConfigStorage-b29e31be.js → ConfigStorage-72f34bd4.js} +2 -2
  2. package/dist/cjs/{DataFetcher-ed9d97ea.js → DataFetcher-991b0349.js} +19 -1
  3. package/dist/cjs/{FormConfigHelper-ebb77625.js → FormConfigHelper-e253a418.js} +42 -0
  4. package/dist/cjs/{ISave-81eb2fbc.js → ISave-ebf6b4ed.js} +1 -1
  5. package/dist/cjs/{SnkFormConfigManager-6838389c.js → SnkFormConfigManager-cdbb29d4.js} +4 -4
  6. package/dist/cjs/{SnkMultiSelectionListDataSource-1e804147.js → SnkMultiSelectionListDataSource-011bec79.js} +4 -4
  7. package/dist/cjs/{auth-fetcher-cc28d847.js → auth-fetcher-c3cac878.js} +1 -1
  8. package/dist/cjs/{dataunit-fetcher-ab1cc071.js → dataunit-fetcher-8bf469e7.js} +1 -1
  9. package/dist/cjs/field-config_2.cjs.entry.js +1 -1
  10. package/dist/cjs/fields-layout.cjs.entry.js +4 -1
  11. package/dist/cjs/fields-selector.cjs.entry.js +1 -1
  12. package/dist/cjs/{form-config-fetcher-f0897eb5.js → form-config-fetcher-c7af90d8.js} +1 -1
  13. package/dist/cjs/guides-configurator.cjs.entry.js +3 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +4 -4
  16. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  17. package/dist/cjs/snk-actions-button_9.cjs.entry.js +5 -5
  18. package/dist/cjs/snk-application.cjs.entry.js +6 -6
  19. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  20. package/dist/cjs/snk-crud.cjs.entry.js +9 -7
  21. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  22. package/dist/cjs/{snk-data-unit-68992932.js → snk-data-unit-7d587ad5.js} +2 -2
  23. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  24. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  25. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +3 -3
  26. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  27. package/dist/cjs/snk-form_2.cjs.entry.js +22 -9
  28. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  29. package/dist/cjs/{snk-guides-viewer-8b841753.js → snk-guides-viewer-366d5c32.js} +90 -28
  30. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  31. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  32. package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -4
  33. package/dist/cjs/snk-simple-crud.cjs.entry.js +7 -7
  34. package/dist/cjs/snk-taskbar.cjs.entry.js +56 -44
  35. package/dist/collection/collection-manifest.json +1 -1
  36. package/dist/collection/components/snk-crud/snk-crud.js +29 -2
  37. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +124 -23
  38. package/dist/collection/components/snk-form-config/FormConfigHelper.js +40 -0
  39. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
  40. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.js +3 -0
  41. package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.js +3 -1
  42. package/dist/collection/components/snk-form-config/snk-form-config.js +43 -6
  43. package/dist/collection/components/snk-taskbar/snk-taskbar.js +58 -44
  44. package/dist/collection/lib/message/resources/en-us/snk-form.msg.js +6 -0
  45. package/dist/collection/lib/message/resources/es-es/snk-form.msg.js +6 -0
  46. package/dist/collection/lib/message/resources/pt-br/snk-form.msg.js +7 -1
  47. package/dist/components/DataFetcher.js +19 -1
  48. package/dist/components/SnkFormConfigManager.js +3 -3
  49. package/dist/components/field-config2.js +41 -1
  50. package/dist/components/fields-layout2.js +3 -0
  51. package/dist/components/guides-configurator2.js +3 -1
  52. package/dist/components/snk-crud.js +6 -2
  53. package/dist/components/snk-detail-view2.js +86 -23
  54. package/dist/components/snk-form-config2.js +19 -5
  55. package/dist/components/snk-taskbar2.js +57 -45
  56. package/dist/esm/{ConfigStorage-13d80e36.js → ConfigStorage-22324b6b.js} +2 -2
  57. package/dist/esm/{DataFetcher-f4ccd9f3.js → DataFetcher-450828a0.js} +19 -1
  58. package/dist/esm/{FormConfigHelper-4e42f0b6.js → FormConfigHelper-e89ca25c.js} +41 -1
  59. package/dist/esm/{ISave-288fa9df.js → ISave-61153166.js} +1 -1
  60. package/dist/esm/{SnkFormConfigManager-3ee2937b.js → SnkFormConfigManager-b5a92e12.js} +4 -4
  61. package/dist/esm/{SnkMultiSelectionListDataSource-5d3a93f2.js → SnkMultiSelectionListDataSource-d7ce2e54.js} +4 -4
  62. package/dist/esm/{auth-fetcher-59ab0c67.js → auth-fetcher-eef9d01e.js} +1 -1
  63. package/dist/esm/{dataunit-fetcher-c4f9f222.js → dataunit-fetcher-da9596f6.js} +1 -1
  64. package/dist/esm/field-config_2.entry.js +1 -1
  65. package/dist/esm/fields-layout.entry.js +4 -1
  66. package/dist/esm/fields-selector.entry.js +1 -1
  67. package/dist/esm/{form-config-fetcher-6a00fe9e.js → form-config-fetcher-8d0a5e1c.js} +1 -1
  68. package/dist/esm/guides-configurator.entry.js +3 -1
  69. package/dist/esm/loader.js +1 -1
  70. package/dist/esm/pesquisa-grid_2.entry.js +4 -4
  71. package/dist/esm/sankhyablocks.js +1 -1
  72. package/dist/esm/snk-actions-button_9.entry.js +5 -5
  73. package/dist/esm/snk-application.entry.js +6 -6
  74. package/dist/esm/snk-attach.entry.js +5 -5
  75. package/dist/esm/snk-crud.entry.js +9 -7
  76. package/dist/esm/snk-data-exporter.entry.js +5 -5
  77. package/dist/esm/{snk-data-unit-0edeb967.js → snk-data-unit-99616a07.js} +2 -2
  78. package/dist/esm/snk-data-unit.entry.js +3 -3
  79. package/dist/esm/snk-detail-view.entry.js +7 -7
  80. package/dist/esm/snk-filter-bar_4.entry.js +3 -3
  81. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  82. package/dist/esm/snk-form_2.entry.js +22 -9
  83. package/dist/esm/snk-grid.entry.js +6 -6
  84. package/dist/esm/{snk-guides-viewer-9cd4d20f.js → snk-guides-viewer-240de636.js} +90 -28
  85. package/dist/esm/snk-guides-viewer.entry.js +7 -7
  86. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  87. package/dist/esm/snk-pesquisa.entry.js +4 -4
  88. package/dist/esm/snk-simple-crud.entry.js +7 -7
  89. package/dist/esm/snk-taskbar.entry.js +57 -45
  90. package/dist/sankhyablocks/{p-1c2971e4.js → p-002d4d2b.js} +1 -1
  91. package/dist/sankhyablocks/{p-ae108ffd.entry.js → p-0948dc0a.entry.js} +1 -1
  92. package/dist/sankhyablocks/{p-7b3ca294.entry.js → p-0b9a42ad.entry.js} +1 -1
  93. package/dist/sankhyablocks/p-118c221e.js +1 -0
  94. package/dist/sankhyablocks/{p-dc851b6e.entry.js → p-1a9c5684.entry.js} +1 -1
  95. package/dist/sankhyablocks/p-1d589380.entry.js +1 -0
  96. package/dist/sankhyablocks/{p-d9c54991.js → p-28f50632.js} +1 -1
  97. package/dist/sankhyablocks/p-39be771c.js +1 -0
  98. package/dist/sankhyablocks/{p-26e0f63c.entry.js → p-4963dd2a.entry.js} +1 -1
  99. package/dist/sankhyablocks/p-55f6fef2.entry.js +1 -0
  100. package/dist/sankhyablocks/p-56f16390.entry.js +1 -0
  101. package/dist/sankhyablocks/{p-5304753a.js → p-58683e28.js} +2 -2
  102. package/dist/sankhyablocks/{p-11346b8d.entry.js → p-5ea893c5.entry.js} +1 -1
  103. package/dist/sankhyablocks/{p-f15478a1.js → p-62aef37a.js} +1 -1
  104. package/dist/sankhyablocks/{p-34f447ba.entry.js → p-62e9b9b8.entry.js} +1 -1
  105. package/dist/sankhyablocks/{p-e9021f79.entry.js → p-669bb869.entry.js} +1 -1
  106. package/dist/sankhyablocks/{p-6180de07.entry.js → p-6ee2ca7a.entry.js} +1 -1
  107. package/dist/sankhyablocks/p-7cac3870.entry.js +1 -0
  108. package/dist/sankhyablocks/{p-78ff8734.js → p-7d6f1285.js} +1 -1
  109. package/dist/sankhyablocks/{p-53599b26.js → p-840fb68c.js} +1 -1
  110. package/dist/sankhyablocks/{p-b4322b87.entry.js → p-86e54841.entry.js} +1 -1
  111. package/dist/sankhyablocks/{p-34df7eca.entry.js → p-88b337fe.entry.js} +1 -1
  112. package/dist/sankhyablocks/{p-3d021bef.entry.js → p-91005a00.entry.js} +1 -1
  113. package/dist/sankhyablocks/p-92cfc028.js +1 -0
  114. package/dist/sankhyablocks/{p-44939a0e.entry.js → p-ada013c0.entry.js} +1 -1
  115. package/dist/sankhyablocks/{p-9317942f.js → p-c35fc941.js} +1 -1
  116. package/dist/sankhyablocks/p-c98c79c3.entry.js +1 -0
  117. package/dist/sankhyablocks/{p-1858c023.entry.js → p-cadf4846.entry.js} +1 -1
  118. package/dist/sankhyablocks/{p-38e56b68.entry.js → p-e91c3c57.entry.js} +1 -1
  119. package/dist/sankhyablocks/{p-f8f29e1a.entry.js → p-ea729922.entry.js} +1 -1
  120. package/dist/sankhyablocks/p-ec5fbad8.js +1 -0
  121. package/dist/sankhyablocks/{p-80014119.entry.js → p-f5e942b7.entry.js} +1 -1
  122. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  123. package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
  124. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +22 -0
  125. package/dist/types/components/snk-form-config/FormConfigHelper.d.ts +5 -0
  126. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +1 -1
  127. package/dist/types/components/snk-form-config/snk-form-config.d.ts +8 -2
  128. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -3
  129. package/dist/types/components.d.ts +30 -0
  130. package/package.json +1 -1
  131. package/dist/sankhyablocks/p-0e279e7a.js +0 -1
  132. package/dist/sankhyablocks/p-3abeeefa.entry.js +0 -1
  133. package/dist/sankhyablocks/p-557368df.entry.js +0 -1
  134. package/dist/sankhyablocks/p-583151c5.entry.js +0 -1
  135. package/dist/sankhyablocks/p-8f73da95.js +0 -1
  136. package/dist/sankhyablocks/p-a2ed1ebd.entry.js +0 -1
  137. package/dist/sankhyablocks/p-a5108625.entry.js +0 -1
  138. package/dist/sankhyablocks/p-a644a956.js +0 -1
  139. 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-f4ccd9f3.js';
7
- import './ISave-288fa9df.js';
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-c4f9f222.js';
11
+ import './dataunit-fetcher-da9596f6.js';
12
12
  import './filter-item-type.enum-d45e026f.js';
13
- import './form-config-fetcher-6a00fe9e.js';
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-3ee2937b.js';
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
- let content;
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 || levels.length > 0) {
317
- let formName;
318
- let detailBranch;
319
- if (guideId.includes(FORM_NAME_PREFIX)) {
320
- [detailId, formName] = guideId.split(FORM_NAME_PREFIX);
321
- const pathSize = ((_a = this._breadcrumbItems) === null || _a === void 0 ? void 0 : _a.length) || 0;
322
- detailBranch = pathSize > 1 ? this._breadcrumbItems[pathSize - 2] : this.selectedGuide;
323
- }
324
- else {
325
- detailBranch = this.selectedGuide;
326
- }
327
- content = 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 }));
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
- const cardId = this.selectedGuide.id;
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 content;
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-9cd4d20f.js';
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-f4ccd9f3.js';
7
+ import './DataFetcher-450828a0.js';
8
8
  import './PrintUtils-3e4ff0f5.js';
9
9
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
10
- import './ISave-288fa9df.js';
10
+ import './ISave-61153166.js';
11
11
  import './index-b40568ff.js';
12
12
  import '@sankhyalabs/ezui/dist/collection/utils/constants';
13
- import './dataunit-fetcher-c4f9f222.js';
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-6a00fe9e.js';
18
+ import './form-config-fetcher-8d0a5e1c.js';
19
19
  import './constants-7b422de0.js';
20
- import './SnkFormConfigManager-3ee2937b.js';
21
- import './ConfigStorage-13d80e36.js';
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-13d80e36.js';
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-6a00fe9e.js';
10
- import './DataFetcher-f4ccd9f3.js';
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-288fa9df.js';
4
- import './DataFetcher-f4ccd9f3.js';
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-c4f9f222.js';
8
+ import './dataunit-fetcher-da9596f6.js';
9
9
  import './filter-item-type.enum-d45e026f.js';
10
- import './form-config-fetcher-6a00fe9e.js';
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-f4ccd9f3.js';
7
- import './ISave-288fa9df.js';
8
- import { S as SnkMultiSelectionListDataSource, R as RmPrecisionCustomValueFormatter, b as ContinuousInsertUtils, a as CrudUtils, c as ClientSideExporterProvider } from './SnkMultiSelectionListDataSource-5d3a93f2.js';
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-c4f9f222.js';
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-6a00fe9e.js';
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-13d80e36.js';
17
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-3ee2937b.js';
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, ElementIDUtils } from '@sankhyalabs/core';
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
- switch (elem) {
167
- case TaskbarElement.PREVIOUS:
168
- this.dataUnit.previousRecord();
169
- break;
170
- case TaskbarElement.NEXT:
171
- this.dataUnit.nextRecord();
172
- break;
173
- case TaskbarElement.REFRESH:
174
- this.dataUnit.loadData();
175
- break;
176
- case TaskbarElement.CLONE:
177
- this.dataUnit.copySelected();
178
- break;
179
- case TaskbarElement.REMOVE:
180
- this.dataUnit.removeSelectedRecords();
181
- break;
182
- case TaskbarElement.INSERT:
183
- this.dataUnit.addRecord();
184
- break;
185
- case TaskbarElement.CANCEL:
186
- this.dataUnit.cancelEdition();
187
- break;
188
- case TaskbarElement.SAVE:
189
- if (!this._isWaitingForSave) {
190
- this._isWaitingForSave = true;
191
- this.dataUnit.saveData().catch((err) => {
192
- if (err instanceof SilentException) {
193
- return;
194
- }
195
- else {
196
- throw err;
197
- }
198
- }).finally(() => {
199
- this._isWaitingForSave = false;
200
- });
201
- }
202
- break;
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
- const dataInfo = { dataUnit: this.dataUnit };
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-9317942f.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
+ 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-78ff8734.js";import{d as S,D as b,U as I,S as T}from"./p-bb2f5f38.js";import{A as O,a as L}from"./p-1c2971e4.js";import{P as N,D as C}from"./p-5304753a.js";import{P as E}from"./p-53599b26.js";import{T as D}from"./p-9019a32f.js";import"./p-0f3698af.js";import"./p-ff1990ad.js";import{F as R}from"./p-9317942f.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!) {
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}