@sankhyalabs/sankhyablocks 8.16.0-dev.57 → 8.16.0-dev.59

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/dist/cjs/{ConfigStorage-f079f5fd.js → ConfigStorage-9b965af9.js} +1 -1
  2. package/dist/cjs/{ContinuousInsertUtils-3f27ea94.js → ContinuousInsertUtils-42636ac1.js} +1 -1
  3. package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-51caf3d0.js} +2 -2
  4. package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-a78242d1.js} +1 -1
  5. package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-91fba2b1.js} +37 -0
  6. package/dist/cjs/index-f9e81701.js +4 -4
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  9. package/dist/cjs/{snk-actions-button_4.cjs.entry.js → snk-actions-button_5.cjs.entry.js} +90 -2
  10. package/dist/cjs/snk-application.cjs.entry.js +3 -3
  11. package/dist/cjs/snk-attach.cjs.entry.js +10 -6
  12. package/dist/cjs/snk-config-options_3.cjs.entry.js +3 -3
  13. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  14. package/dist/cjs/snk-data-exporter.cjs.entry.js +1 -1
  15. package/dist/cjs/snk-detail-view.cjs.entry.js +4 -4
  16. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +2 -2
  17. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
  18. package/dist/cjs/snk-grid.cjs.entry.js +3 -3
  19. package/dist/cjs/{snk-guides-viewer-dcd05129.js → snk-guides-viewer-421555af.js} +2 -2
  20. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  21. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  22. package/dist/cjs/snk-simple-crud.cjs.entry.js +17 -24
  23. package/dist/collection/collection-manifest.json +1 -0
  24. package/dist/collection/components/snk-attach/structure/builder/taskbar-builder.js +8 -4
  25. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +13 -21
  26. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.css +22 -0
  27. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.js +179 -0
  28. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +41 -4
  29. package/dist/components/form-config-fetcher.js +37 -0
  30. package/dist/components/index.d.ts +1 -0
  31. package/dist/components/index.js +1 -0
  32. package/dist/components/snk-attach2.js +20 -34
  33. package/dist/components/snk-crud.js +61 -55
  34. package/dist/components/snk-detail-view2.js +84 -93
  35. package/dist/components/snk-simple-crud2.js +25 -51
  36. package/dist/components/snk-simple-form-config.d.ts +11 -0
  37. package/dist/components/snk-simple-form-config.js +6 -0
  38. package/dist/components/snk-simple-form-config2.js +119 -0
  39. package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-ff99377a.js} +1 -1
  40. package/dist/esm/{ContinuousInsertUtils-139ff541.js → ContinuousInsertUtils-071e0b6a.js} +1 -1
  41. package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-a7770e24.js} +2 -2
  42. package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-0b78ca31.js} +1 -1
  43. package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-0c2620ef.js} +37 -0
  44. package/dist/esm/index-a7d3d3f1.js +4 -4
  45. package/dist/esm/loader.js +1 -1
  46. package/dist/esm/sankhyablocks.js +1 -1
  47. package/dist/esm/{snk-actions-button_4.entry.js → snk-actions-button_5.entry.js} +90 -3
  48. package/dist/esm/snk-application.entry.js +3 -3
  49. package/dist/esm/snk-attach.entry.js +10 -6
  50. package/dist/esm/snk-config-options_3.entry.js +3 -3
  51. package/dist/esm/snk-crud.entry.js +2 -2
  52. package/dist/esm/snk-data-exporter.entry.js +1 -1
  53. package/dist/esm/snk-detail-view.entry.js +4 -4
  54. package/dist/esm/snk-filter-bar_4.entry.js +2 -2
  55. package/dist/esm/snk-filter-modal-item.entry.js +2 -2
  56. package/dist/esm/snk-grid.entry.js +3 -3
  57. package/dist/esm/{snk-guides-viewer-0c3efe6a.js → snk-guides-viewer-b740a1fe.js} +2 -2
  58. package/dist/esm/snk-guides-viewer.entry.js +4 -4
  59. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  60. package/dist/esm/snk-simple-crud.entry.js +17 -24
  61. package/dist/sankhyablocks/{p-ec43fcc8.entry.js → p-036b4807.entry.js} +1 -1
  62. package/dist/sankhyablocks/{p-e7469b05.entry.js → p-184012f4.entry.js} +1 -1
  63. package/dist/sankhyablocks/p-29643bef.entry.js +1 -0
  64. package/dist/sankhyablocks/{p-2011eaa3.entry.js → p-33b06d48.entry.js} +1 -1
  65. package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-35882caf.entry.js} +1 -1
  66. package/dist/sankhyablocks/{p-0791a167.entry.js → p-365d8ed4.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-5daf2e8c.entry.js → p-53ae0296.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-fcdfb0fe.entry.js → p-65650e05.entry.js} +1 -1
  69. package/dist/sankhyablocks/{p-994903df.js → p-72a451c8.js} +1 -1
  70. package/dist/sankhyablocks/{p-9ffd9fc7.js → p-763edad2.js} +1 -1
  71. package/dist/sankhyablocks/p-82274cb0.js +1 -0
  72. package/dist/sankhyablocks/{p-c9ab5a1f.entry.js → p-8cf0a9fe.entry.js} +1 -1
  73. package/dist/sankhyablocks/p-acca8a69.js +26 -0
  74. package/dist/sankhyablocks/{p-cb617269.js → p-c271fbf1.js} +1 -1
  75. package/dist/sankhyablocks/{p-db8eb000.entry.js → p-c629c07a.entry.js} +1 -1
  76. package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-e9432f45.entry.js} +1 -1
  77. package/dist/sankhyablocks/{p-bca6e570.entry.js → p-eda55eef.entry.js} +3 -3
  78. package/dist/sankhyablocks/p-f7650ed4.entry.js +1 -0
  79. package/dist/sankhyablocks/{p-0e206e62.js → p-fcc662c6.js} +1 -1
  80. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  81. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +2 -3
  82. package/dist/types/components/snk-simple-form-config/snk-simple-form-config.d.ts +33 -0
  83. package/dist/types/components.d.ts +38 -0
  84. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +8 -2
  85. package/package.json +1 -1
  86. package/react/components.d.ts +1 -0
  87. package/react/components.js +1 -0
  88. package/react/components.js.map +1 -1
  89. package/dist/sankhyablocks/p-126c58ea.js +0 -26
  90. package/dist/sankhyablocks/p-73b19d2a.entry.js +0 -1
  91. package/dist/sankhyablocks/p-aaf94476.js +0 -1
  92. package/dist/sankhyablocks/p-f35db6f1.entry.js +0 -1
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
- const SnkFormConfigManager = require('./SnkFormConfigManager-63369164.js');
7
+ const SnkFormConfigManager = require('./SnkFormConfigManager-51caf3d0.js');
8
8
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
9
9
  require('./DataFetcher-e059eb72.js');
10
10
  require('./pesquisa-fetcher-2ec4811b.js');
@@ -14,12 +14,12 @@ require('@sankhyalabs/ezui/dist/collection/utils/constants');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
15
15
  require('./dataunit-fetcher-228016f4.js');
16
16
  require('./filter-item-type.enum-a7ffdaa6.js');
17
- require('./form-config-fetcher-39397ac5.js');
17
+ require('./form-config-fetcher-91fba2b1.js');
18
18
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
19
19
  const constants = require('./constants-35ddd366.js');
20
- const snkGuidesViewer = require('./snk-guides-viewer-dcd05129.js');
20
+ const snkGuidesViewer = require('./snk-guides-viewer-421555af.js');
21
21
  const SnkMessageBuilder = require('./SnkMessageBuilder-bae64d0d.js');
22
- require('./ConfigStorage-f079f5fd.js');
22
+ require('./ConfigStorage-9b965af9.js');
23
23
  require('./PrintUtils-bcaeb82f.js');
24
24
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils');
25
25
  require('@sankhyalabs/core/dist/utils/SortingUtils');
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index$1 = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const EzScrollDirection = require('@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection');
8
- const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
8
+ const ConfigStorage = require('./ConfigStorage-9b965af9.js');
9
9
  const DataType = require('@sankhyalabs/core/dist/dataunit/metadata/DataType');
10
10
  const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
11
11
  const index = require('./index-c5771aba.js');
@@ -14,7 +14,7 @@ const utils = require('@sankhyalabs/ezui/dist/collection/utils');
14
14
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
15
15
  const ezModalContainer = require('@sankhyalabs/ezui/dist/collection/components/ez-modal-container');
16
16
  const filterType_enum = require('./filter-type.enum-b14ce507.js');
17
- require('./form-config-fetcher-39397ac5.js');
17
+ require('./form-config-fetcher-91fba2b1.js');
18
18
  require('./DataFetcher-e059eb72.js');
19
19
  require('./PrintUtils-bcaeb82f.js');
20
20
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -6,9 +6,9 @@ const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');
8
8
  const presentationMode = require('./presentationMode-52ec3bdd.js');
9
- const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
9
+ const ConfigStorage = require('./ConfigStorage-9b965af9.js');
10
10
  const filterType_enum = require('./filter-type.enum-b14ce507.js');
11
- require('./form-config-fetcher-39397ac5.js');
11
+ require('./form-config-fetcher-91fba2b1.js');
12
12
  require('./DataFetcher-e059eb72.js');
13
13
  require('./PrintUtils-bcaeb82f.js');
14
14
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -5,11 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
8
- const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
8
+ const ConfigStorage = require('./ConfigStorage-9b965af9.js');
9
9
  const index$1 = require('./index-1dfc7a6e.js');
10
10
  const fieldSearch = require('./field-search-68e34bf4.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
- const ContinuousInsertUtils = require('./ContinuousInsertUtils-3f27ea94.js');
12
+ const ContinuousInsertUtils = require('./ContinuousInsertUtils-42636ac1.js');
13
13
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
14
14
  require('./DataFetcher-e059eb72.js');
15
15
  require('./pesquisa-fetcher-2ec4811b.js');
@@ -18,7 +18,7 @@ require('@sankhyalabs/ezui/dist/collection/utils/constants');
18
18
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
19
19
  require('./dataunit-fetcher-228016f4.js');
20
20
  require('./filter-item-type.enum-a7ffdaa6.js');
21
- require('./form-config-fetcher-39397ac5.js');
21
+ require('./form-config-fetcher-91fba2b1.js');
22
22
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
23
23
  require('@sankhyalabs/ezui/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource');
24
24
  require('./PrintUtils-bcaeb82f.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  const index = require('./index-f9e81701.js');
4
4
  const core = require('@sankhyalabs/core');
5
- const SnkFormConfigManager = require('./SnkFormConfigManager-63369164.js');
5
+ const SnkFormConfigManager = require('./SnkFormConfigManager-51caf3d0.js');
6
6
  const form = require('@sankhyalabs/ezui/dist/collection/utils/form');
7
7
  const fieldSearch = require('./field-search-68e34bf4.js');
8
8
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
@@ -15,7 +15,7 @@ require('@sankhyalabs/ezui/dist/collection/utils/constants');
15
15
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
16
16
  require('./dataunit-fetcher-228016f4.js');
17
17
  require('./filter-item-type.enum-a7ffdaa6.js');
18
- require('./form-config-fetcher-39397ac5.js');
18
+ require('./form-config-fetcher-91fba2b1.js');
19
19
  const DataUnit = require('@sankhyalabs/core/dist/dataunit/DataUnit');
20
20
 
21
21
  const snkGuidesViewerCss = ".sc-snk-guides-viewer-h{--snk-guides-viewer--space-large:var(--space--large, 24px);--snk-guides-viewer--space-small:var(--space--2xs, 8px);--snk-guides-viewer__header--min-height:68px;--snk-guides-viewer__header--z-index:var(--more-visible, 2);--snk-guides-viewer__header--background-color:var(--background--body, #fafcff);--snk-guides-viewer__guide-navigator--width:340px;display:block}snk-form-view.sc-snk-guides-viewer{width:100%}.snk-guides-viewer.sc-snk-guides-viewer{position:relative;padding-left:0px;padding-top:0px;padding-right:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__detail-container.sc-snk-guides-viewer{display:flex;row-gap:24px;flex-direction:column}.snk-guides-viewer__header.sc-snk-guides-viewer{position:sticky;align-items:center;top:0;z-index:var(--snk-guides-viewer__header--z-index);background-color:var(--snk-guides-viewer__header--background-color);min-height:var(--snk-guides-viewer__header--min-height);width:calc(100% + (var(--snk-guides-viewer--space-large) * 2));padding-left:var(--snk-guides-viewer--space-large);padding-right:var(--snk-guides-viewer--space-large);padding-top:var(--snk-guides-viewer--space-large);padding-bottom:var(--snk-guides-viewer--space-small);margin-left:calc(var(--snk-guides-viewer--space-large) * -1);margin-right:calc(var(--snk-guides-viewer--space-large) * -1);margin-bottom:var(--snk-guides-viewer--space-small)}.snk-guides-viewer__header-breadcrumb.sc-snk-guides-viewer{width:25%;display:flex}.snk-guides-viewer__header-taskbar.sc-snk-guides-viewer{width:75%}.snk-guides-viewer__container.sc-snk-guides-viewer{display:grid;grid-template-columns:minmax(0, auto) minmax(0, 100%);height:100%;column-gap:var(--snk-guides-viewer--space-large)}.snk-guides-viewer__guide-navigator.sc-snk-guides-viewer{position:sticky;top:calc(var(--snk-guides-viewer__header--min-height) + var(--snk-guides-viewer--space-small));height:calc(100vh - var(--snk-guides-viewer__header--min-height) - var(--snk-guides-viewer--space-large) - var(--snk-guides-viewer--space-small))}.snk-guides-viewer__guide-navigator[open].sc-snk-guides-viewer{width:var(--snk-guides-viewer__guide-navigator--width);max-width:var(--snk-guides-viewer__guide-navigator--width);min-width:var(--snk-guides-viewer__guide-navigator--width)}.snk-guides-viewer__detail-content.sc-snk-guides-viewer{min-height:100%;align-items:flex-start;align-content:flex-start}";
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const snkGuidesViewer = require('./snk-guides-viewer-dcd05129.js');
5
+ const snkGuidesViewer = require('./snk-guides-viewer-421555af.js');
6
6
  require('./index-f9e81701.js');
7
7
  require('@sankhyalabs/core');
8
- require('./SnkFormConfigManager-63369164.js');
9
- require('./ConfigStorage-f079f5fd.js');
10
- require('./form-config-fetcher-39397ac5.js');
8
+ require('./SnkFormConfigManager-51caf3d0.js');
9
+ require('./ConfigStorage-9b965af9.js');
10
+ require('./form-config-fetcher-91fba2b1.js');
11
11
  require('./DataFetcher-e059eb72.js');
12
12
  require('./PrintUtils-bcaeb82f.js');
13
13
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-f9e81701.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const PersonalizedFilterUtils = require('./PersonalizedFilterUtils-0184ffbb.js');
8
- const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
8
+ const ConfigStorage = require('./ConfigStorage-9b965af9.js');
9
9
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
10
10
  const index$1 = require('./index-c5771aba.js');
11
11
  const index$2 = require('./index-102ba62d.js');
12
12
  require('./filter-item-type.enum-a7ffdaa6.js');
13
- require('./form-config-fetcher-39397ac5.js');
13
+ require('./form-config-fetcher-91fba2b1.js');
14
14
  require('./DataFetcher-e059eb72.js');
15
15
  require('./PrintUtils-bcaeb82f.js');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
@@ -9,17 +9,17 @@ const constants = require('./constants-35ddd366.js');
9
9
  const taskbarElements = require('./taskbar-elements-9ad1f9c0.js');
10
10
  require('./DataFetcher-e059eb72.js');
11
11
  require('./pesquisa-fetcher-2ec4811b.js');
12
- const ContinuousInsertUtils = require('./ContinuousInsertUtils-3f27ea94.js');
12
+ const ContinuousInsertUtils = require('./ContinuousInsertUtils-42636ac1.js');
13
13
  const index = require('./index-1dfc7a6e.js');
14
14
  require('./ISave-e91b70a7.js');
15
15
  require('@sankhyalabs/ezui/dist/collection/utils/constants');
16
16
  require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
17
17
  const dataunitFetcher = require('./dataunit-fetcher-228016f4.js');
18
18
  require('./filter-item-type.enum-a7ffdaa6.js');
19
- const formConfigFetcher = require('./form-config-fetcher-39397ac5.js');
19
+ const formConfigFetcher = require('./form-config-fetcher-91fba2b1.js');
20
20
  const fieldSearch = require('./field-search-68e34bf4.js');
21
- const ConfigStorage = require('./ConfigStorage-f079f5fd.js');
22
- const SnkFormConfigManager = require('./SnkFormConfigManager-63369164.js');
21
+ const ConfigStorage = require('./ConfigStorage-9b965af9.js');
22
+ const SnkFormConfigManager = require('./SnkFormConfigManager-51caf3d0.js');
23
23
  const GetSelectedRecordsIDsInfo = require('./GetSelectedRecordsIDsInfo-bd50caf1.js');
24
24
  const index$2 = require('./index-102ba62d.js');
25
25
  require('./PrintUtils-bcaeb82f.js');
@@ -110,7 +110,6 @@ const SnkSimpleCrud = class {
110
110
  "snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this)
111
111
  });
112
112
  this._showPopUpGridConfig = false;
113
- this._showFormConfig = false;
114
113
  this._currentViewMode = constants.VIEW_MODE.GRID;
115
114
  this._config = undefined;
116
115
  this._fieldToGetFocus = undefined;
@@ -330,15 +329,9 @@ const SnkSimpleCrud = class {
330
329
  });
331
330
  }
332
331
  async openFormConfig() {
333
- var _a, _b;
334
- //No momento não daremos suporte para configuraçao de formulário quando houver legacy config
335
- if (this.formLegacyConfigName) {
336
- const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
337
- const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
338
- await this.application.alert(title, message);
339
- return;
332
+ if (this.formLegacyConfigName || this.configName) {
333
+ await this._snkSimpleFormConfig.show();
340
334
  }
341
- this._showFormConfig = true;
342
335
  }
343
336
  addGridLegacyConfigName() {
344
337
  if (this.gridLegacyConfigName && this.configName) {
@@ -368,7 +361,7 @@ const SnkSimpleCrud = class {
368
361
  formConfigIsLoaded() {
369
362
  return this.formConfig != undefined || this._formConfigAlreadyLoaded;
370
363
  }
371
- async loadFormConfig(forceLoad = false) {
364
+ async loadFormConfig(forceLoad = false, forceSetNewConfig = false) {
372
365
  if (this.configName === undefined) {
373
366
  return;
374
367
  }
@@ -383,7 +376,7 @@ const SnkSimpleCrud = class {
383
376
  let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
384
377
  if (loadedLegacyConfig != undefined) {
385
378
  this._formConfigManager.setConfig(loadedLegacyConfig);
386
- this.setFormConfig(loadedLegacyConfig);
379
+ this.setFormConfig(loadedLegacyConfig, forceSetNewConfig);
387
380
  return;
388
381
  }
389
382
  this.setFormConfig(await this._formConfigManager.loadConfig());
@@ -767,9 +760,6 @@ const SnkSimpleCrud = class {
767
760
  closeGridConfig() {
768
761
  this._showPopUpGridConfig = false;
769
762
  }
770
- closeFormConfig() {
771
- this._showFormConfig = false;
772
- }
773
763
  getPageSize() {
774
764
  if (this.mode === constants.SIMPLE_CRUD_MODE.IN_MEMORY) {
775
765
  return 0;
@@ -779,10 +769,6 @@ const SnkSimpleCrud = class {
779
769
  }
780
770
  return this.pageSize;
781
771
  }
782
- //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
783
- handleShowFormConfig() {
784
- return this._showFormConfig && !this.formLegacyConfigName;
785
- }
786
772
  resolveResourceID() {
787
773
  return core.StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
788
774
  }
@@ -795,7 +781,10 @@ const SnkSimpleCrud = class {
795
781
  return configFromManager;
796
782
  }
797
783
  updateFormConfig() {
798
- const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
784
+ let newConfig = this.formConfig;
785
+ if (this.formLegacyConfigName == undefined) {
786
+ newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
787
+ }
799
788
  this.setFormConfig(newConfig, true);
800
789
  if (this._formConfigManager == undefined) {
801
790
  this._formConfigManager = new SnkFormConfigManager.SnkFormConfigManager(this.configName, this.resolveResourceID());
@@ -823,18 +812,22 @@ const SnkSimpleCrud = class {
823
812
  description: "Cancela uma ação.", element: this._element
824
813
  });
825
814
  }
815
+ async handleFormConfigSaved() {
816
+ await this.loadFormConfig(true, true);
817
+ }
826
818
  renderTaskbarContent() {
827
819
  var _a;
828
820
  return (index$1.h("snk-taskbar", { class: this._currentViewMode === constants.VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: index.PresentationMode.SECONDARY }, index$1.h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
829
821
  }
830
822
  /* istanbul ignore next */
831
823
  render() {
824
+ var _a;
832
825
  if (this.dataUnit == undefined) {
833
826
  return;
834
827
  }
835
828
  return (index$1.h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === constants.VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, index$1.h("header", null, index$1.h("slot", { name: "snkSimpleCrudHeader" })), index$1.h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, index$1.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, index$1.h("stack-item", null, index$1.h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(constants.VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(dataunitFetcher.InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
836
829
  ? undefined
837
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, this.renderTaskbarContent(), index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && index$1.h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
830
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), index$1.h("div", { slot: "footer" }, index$1.h("slot", { name: "snkSimpleCrudFooter" })))), index$1.h("stack-item", null, this.renderTaskbarContent(), index$1.h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), index$1.h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), this.messagesBuilder && index$1.h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), index$1.h("div", { id: `${this._customContainerId}` }, index$1.h("slot", { name: "SnkConfigContainerSlot" }))), index$1.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index$1.h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
838
831
  }
839
832
  get _element() { return index$1.getElement(this); }
840
833
  static get watchers() { return {
@@ -50,6 +50,7 @@
50
50
  "./components/snk-pesquisa/snk-pesquisa.js",
51
51
  "./components/snk-simple-bar/snk-simple-bar.js",
52
52
  "./components/snk-simple-crud/snk-simple-crud.js",
53
+ "./components/snk-simple-form-config/snk-simple-form-config.js",
53
54
  "./components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js",
54
55
  "./components/teste-pesquisa/teste-pesquisa.js"
55
56
  ],
@@ -25,14 +25,18 @@ export const buildTaskBarManager = () => {
25
25
  ];
26
26
  return {
27
27
  getButtons: (_, dataState, currentButtons) => {
28
- if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty))
28
+ const refreshBtnIndex = currentButtons.indexOf(TaskbarElement.REFRESH);
29
+ if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
29
30
  return currentButtons.reverse();
30
- else
31
- currentButtons.splice(currentButtons.indexOf(TaskbarElement.REFRESH), 1);
31
+ }
32
+ else if (refreshBtnIndex !== -1) {
33
+ currentButtons.splice(refreshBtnIndex, 1);
34
+ }
32
35
  const { selectedRecord } = dataState || {};
33
36
  const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
34
37
  currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
35
- const updatedButtons = Array.from(new Set(currentButtons.filter(button => button !== TaskbarElement.CLONE)));
38
+ const buttonsToRemove = [TaskbarElement.CLONE, TaskbarElement.DATA_EXPORTER];
39
+ const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
36
40
  updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
37
41
  return updatedButtons;
38
42
  },
@@ -30,7 +30,6 @@ export class SnkSimpleCrud {
30
30
  "snkSimpleCrudTaskbar.finish_edition": this.getFinishEditionButtonsCallback.bind(this)
31
31
  });
32
32
  this._showPopUpGridConfig = false;
33
- this._showFormConfig = false;
34
33
  this._currentViewMode = VIEW_MODE.GRID;
35
34
  this._config = undefined;
36
35
  this._fieldToGetFocus = undefined;
@@ -250,15 +249,9 @@ export class SnkSimpleCrud {
250
249
  });
251
250
  }
252
251
  async openFormConfig() {
253
- var _a, _b;
254
- //No momento não daremos suporte para configuraçao de formulário quando houver legacy config
255
- if (this.formLegacyConfigName) {
256
- const title = (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage("snkSimpleCrud.formConfigUnavaliable.title", undefined);
257
- const message = (_b = this.messagesBuilder) === null || _b === void 0 ? void 0 : _b.getMessage("snkSimpleCrud.formConfigUnavaliable.message", undefined);
258
- await this.application.alert(title, message);
259
- return;
252
+ if (this.formLegacyConfigName || this.configName) {
253
+ await this._snkSimpleFormConfig.show();
260
254
  }
261
- this._showFormConfig = true;
262
255
  }
263
256
  addGridLegacyConfigName() {
264
257
  if (this.gridLegacyConfigName && this.configName) {
@@ -288,7 +281,7 @@ export class SnkSimpleCrud {
288
281
  formConfigIsLoaded() {
289
282
  return this.formConfig != undefined || this._formConfigAlreadyLoaded;
290
283
  }
291
- async loadFormConfig(forceLoad = false) {
284
+ async loadFormConfig(forceLoad = false, forceSetNewConfig = false) {
292
285
  if (this.configName === undefined) {
293
286
  return;
294
287
  }
@@ -303,7 +296,7 @@ export class SnkSimpleCrud {
303
296
  let loadedLegacyConfig = await this._formConfigFetcher.fetchLegacyConfigurableForm(this.formLegacyConfigName);
304
297
  if (loadedLegacyConfig != undefined) {
305
298
  this._formConfigManager.setConfig(loadedLegacyConfig);
306
- this.setFormConfig(loadedLegacyConfig);
299
+ this.setFormConfig(loadedLegacyConfig, forceSetNewConfig);
307
300
  return;
308
301
  }
309
302
  this.setFormConfig(await this._formConfigManager.loadConfig());
@@ -687,9 +680,6 @@ export class SnkSimpleCrud {
687
680
  closeGridConfig() {
688
681
  this._showPopUpGridConfig = false;
689
682
  }
690
- closeFormConfig() {
691
- this._showFormConfig = false;
692
- }
693
683
  getPageSize() {
694
684
  if (this.mode === SIMPLE_CRUD_MODE.IN_MEMORY) {
695
685
  return 0;
@@ -699,10 +689,6 @@ export class SnkSimpleCrud {
699
689
  }
700
690
  return this.pageSize;
701
691
  }
702
- //No momento não daremos suporte para configuração de formulário quando houver formLegacyConfigName
703
- handleShowFormConfig() {
704
- return this._showFormConfig && !this.formLegacyConfigName;
705
- }
706
692
  resolveResourceID() {
707
693
  return StringUtils.isEmpty(this.resourceID) ? this._resourceID : this.resourceID;
708
694
  }
@@ -715,7 +701,10 @@ export class SnkSimpleCrud {
715
701
  return configFromManager;
716
702
  }
717
703
  updateFormConfig() {
718
- const newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
704
+ let newConfig = this.formConfig;
705
+ if (this.formLegacyConfigName == undefined) {
706
+ newConfig = Object.assign(Object.assign({}, this.formConfig), { fields: this.dataUnit.metadata.fields });
707
+ }
719
708
  this.setFormConfig(newConfig, true);
720
709
  if (this._formConfigManager == undefined) {
721
710
  this._formConfigManager = new SnkFormConfigManager(this.configName, this.resolveResourceID());
@@ -743,18 +732,22 @@ export class SnkSimpleCrud {
743
732
  description: "Cancela uma ação.", element: this._element
744
733
  });
745
734
  }
735
+ async handleFormConfigSaved() {
736
+ await this.loadFormConfig(true, true);
737
+ }
746
738
  renderTaskbarContent() {
747
739
  var _a;
748
740
  return (h("snk-taskbar", { class: this._currentViewMode === VIEW_MODE.FORM && "ez-box ez-box--shadow ez-padding--small", dataUnit: this.dataUnit, primaryButton: ((_a = this.dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", "data-element-id": "grid_left", messagesBuilder: this.messagesBuilder, buttons: this._taskbarProcessor.buttons, actionsList: this.getActionsList(), disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, "data-exporter-store-key": this.getDataExporterStoreKey(), slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }, h("slot", { name: "TASKBAR_CUSTOM_ELEMENTS" })));
749
741
  }
750
742
  /* istanbul ignore next */
751
743
  render() {
744
+ var _a;
752
745
  if (this.dataUnit == undefined) {
753
746
  return;
754
747
  }
755
748
  return (h("snk-data-unit", { ref: ref => this._snkDataUnit = ref, class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onCancelEdition: this.handleCancelEdit.bind(this), pageSize: this.getPageSize(), onInsertionMode: this.handleDataUnitOnInsertionMode.bind(this), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), ignoreSaveMessage: this._currentViewMode === VIEW_MODE.GRID, onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail, onDataUnitFieldsHidded: this.updateFormConfig.bind(this), domainMessagesBuilder: this.domainMessagesBuilder }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-box ez-box--shadow simple-crud__container-section" }, h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { class: "ez-margin-bottom--large", ref: ref => this._grid = ref, dataUnit: this.dataUnit, config: this.gridConfig, "no-header": true, multipleSelection: this.multipleSelection, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), onConfigChange: evt => this.gridConfigChangeHandler(evt), columnfilterDataSource: this.dataUnit.name && this.dataUnit.name.includes(InMemoryLoader.IN_MEMORY_DATA_UNIT_NAME)
756
749
  ? undefined
757
- : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large ${this.handleShowFormConfig() ? "simple-crud__form--hidden" : ""}`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), this.handleShowFormConfig() && h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this.dataUnit, configManager: this._formConfigManager, onConfigClose: () => this.closeFormConfig() })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
750
+ : this._multiSelectionListDataSource, useEnterLikeTab: this.useEnterLikeTab, autoFocus: this.autoFocus, enableGridInsert: this.enableGridInsert, enableContinuousInsert: this._enableContinuousInsert, enableLockManger: this.enableLockManger }, this.renderTaskbarContent(), h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, this.renderTaskbarContent(), h("ez-form", { ref: (ref) => this._form = ref, class: `ez-margin-top--large`, dataUnit: this.dataUnit, config: this.getFormConfig(), fieldToFocus: this._fieldToGetFocus, onEzFormSetFields: (evt) => this.handleFormSetFields(evt.detail), onEzFormRequestClearFieldToFocus: this.clearFieldToFocusHandler.bind(this) }), h("snk-simple-form-config", { ref: (ref) => this._snkSimpleFormConfig = ref, dataUnit: this.dataUnit, onSnkConfigSaved: this.handleFormConfigSaved.bind(this), configName: (_a = this.formLegacyConfigName) !== null && _a !== void 0 ? _a : this.configName })), this.messagesBuilder && h("snk-configurator", { ref: (ref) => this._snkConfigurator = ref, viewMode: this._currentViewMode, messagesBuilder: this.messagesBuilder, onConfigSelected: (evt) => this.goToView(evt.detail), onOpenConfig: (evt) => this.openConfig(evt.detail), showActionButtons: this.showConfiguratorButtons, onSave: evt => this.handleConfiguratorEvent(evt, 'SAVE'), onCancel: evt => this.handleConfiguratorEvent(evt, 'CANCEL'), resourceID: this.resolveResourceID(), customContainerId: this._customContainerId })), h("div", { id: `${this._customContainerId}` }, h("slot", { name: "SnkConfigContainerSlot" }))), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._showPopUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, h("snk-grid-config", { ref: ref => this._snkGridConfig = ref, config: this.gridConfig, "data-element-id": this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME), selectedIndex: 0, configName: this.configName, onConfigChange: (evt) => this.modalConfigChangeHandler(evt), onConfigCancel: () => this.closeGridConfig(), resourceID: this.resolveResourceID() }))));
758
751
  }
759
752
  static get is() { return "snk-simple-crud"; }
760
753
  static get encapsulation() { return "scoped"; }
@@ -1220,7 +1213,6 @@ export class SnkSimpleCrud {
1220
1213
  static get states() {
1221
1214
  return {
1222
1215
  "_showPopUpGridConfig": {},
1223
- "_showFormConfig": {},
1224
1216
  "_currentViewMode": {},
1225
1217
  "_config": {},
1226
1218
  "_fieldToGetFocus": {},
@@ -0,0 +1,22 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .config-container {
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ }
11
+
12
+ .config-lists {
13
+ margin-bottom: 12px;
14
+ }
15
+
16
+ .config-actions {
17
+ display: flex;
18
+ flex-direction: row;
19
+ justify-content: flex-end;
20
+ width: 100%;
21
+ gap: 12px;
22
+ }
@@ -0,0 +1,179 @@
1
+ import { h } from '@stencil/core';
2
+ import { FormConfigFetcher } from '../../lib';
3
+ export class SnkSimpleFormConfig {
4
+ constructor() {
5
+ this._formConfigFetcher = new FormConfigFetcher();
6
+ this.fieldsToSave = [];
7
+ this.dataUnit = undefined;
8
+ this.configName = undefined;
9
+ this.avaliableFields = [];
10
+ this.selectedFields = [];
11
+ }
12
+ /**
13
+ * Responsável por abrir o configurador.
14
+ */
15
+ async show() {
16
+ await this.initializeFormConfig();
17
+ this.ezPopupRef.opened = true;
18
+ }
19
+ ;
20
+ async initializeFormConfig() {
21
+ if (!this.configName)
22
+ return;
23
+ const allFields = this.getAllVisibleFieldsFromDataUnit();
24
+ const displayedFieldNameList = await this.getConfig();
25
+ //Quando não retorna dados, é por quê não existe configuração do usuário salva.
26
+ if (displayedFieldNameList.length === 0) {
27
+ this.avaliableFields = [];
28
+ this.selectedFields = [...allFields];
29
+ this.fieldsToSave = [...this.selectedFields];
30
+ return;
31
+ }
32
+ const selectedFieldsAux = this.sortDisplayedFields(displayedFieldNameList, allFields);
33
+ const avaliableFieldsAux = allFields.filter(field => !displayedFieldNameList.includes(field.id));
34
+ this.avaliableFields = [...avaliableFieldsAux];
35
+ this.selectedFields = [...selectedFieldsAux];
36
+ this.fieldsToSave = [...this.selectedFields];
37
+ }
38
+ async getConfig() {
39
+ const fieldList = await this._formConfigFetcher.fetchSimpleFormConfig(this.configName);
40
+ return [...this.removeDuplicates(fieldList)];
41
+ }
42
+ removeDuplicates(strings) {
43
+ return strings.filter((item, index) => strings.indexOf(item) === index);
44
+ }
45
+ sortDisplayedFields(displayedFieldNameList, allFields) {
46
+ const selectedFieldsAux = [];
47
+ //É preciso garantir a ordem na qual os campos vieram na resposta do fetchSimpleFormConfig.
48
+ displayedFieldNameList.forEach(fieldName => {
49
+ const field = allFields.find(field => field.id === fieldName);
50
+ if (!field)
51
+ return;
52
+ selectedFieldsAux.push(field);
53
+ });
54
+ return selectedFieldsAux;
55
+ }
56
+ getAllVisibleFieldsFromDataUnit() {
57
+ var _a, _b, _c;
58
+ const visibleFields = ((_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : []).filter(field => field.visible);
59
+ return visibleFields.map(field => {
60
+ return { id: field.name, label: field.label };
61
+ });
62
+ }
63
+ close() {
64
+ this.ezPopupRef.opened = false;
65
+ }
66
+ async handleResetConfigs() {
67
+ await this._formConfigFetcher.restoreFormConfig(this.configName);
68
+ await this.initializeFormConfig();
69
+ await this.handleSave();
70
+ }
71
+ handleCancel() {
72
+ this.close();
73
+ }
74
+ async handleSave() {
75
+ const saveList = this.fieldsToSave.map(field => field.id);
76
+ await this._formConfigFetcher.saveSimpleFormConfig(this.configName, saveList);
77
+ this.close();
78
+ this.snkConfigSaved.emit();
79
+ }
80
+ render() {
81
+ return (h("ez-popup", { ref: (ref) => this.ezPopupRef = ref, heightMode: 'auto', size: 'auto', ezTitle: 'Configurar formul\u00E1rio' }, h("div", { class: 'config-container' }, h("div", { class: 'config-lists' }, h("ez-double-list", { leftList: this.avaliableFields, leftTitle: 'Campos disponíveis', rightList: this.selectedFields, rightTitle: 'Campos selecionados', onEzRightListChanged: ({ detail }) => this.fieldsToSave = [...detail], entityLabel: 'campo', entityLabelPlural: 'campos' })), h("div", { class: 'config-actions' }, h("ez-button", { label: 'Restaurar', onClick: this.handleResetConfigs.bind(this), size: 'small' }), h("ez-button", { label: 'Cancelar', onClick: this.handleCancel.bind(this), size: 'small' }), h("ez-button", { label: 'Salvar', class: 'ez-button--primary', onClick: this.handleSave.bind(this), size: 'small' })))));
82
+ }
83
+ static get is() { return "snk-simple-form-config"; }
84
+ static get originalStyleUrls() {
85
+ return {
86
+ "$": ["snk-simple-form-config.css"]
87
+ };
88
+ }
89
+ static get styleUrls() {
90
+ return {
91
+ "$": ["snk-simple-form-config.css"]
92
+ };
93
+ }
94
+ static get properties() {
95
+ return {
96
+ "dataUnit": {
97
+ "type": "unknown",
98
+ "mutable": false,
99
+ "complexType": {
100
+ "original": "DataUnit",
101
+ "resolved": "DataUnit",
102
+ "references": {
103
+ "DataUnit": {
104
+ "location": "import",
105
+ "path": "@sankhyalabs/core"
106
+ }
107
+ }
108
+ },
109
+ "required": false,
110
+ "optional": false,
111
+ "docs": {
112
+ "tags": [],
113
+ "text": "Data unit respons\u00E1vel pelos campos dispon\u00EDveis"
114
+ }
115
+ },
116
+ "configName": {
117
+ "type": "string",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "string",
121
+ "resolved": "string",
122
+ "references": {}
123
+ },
124
+ "required": false,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "Chave que representa a configura\u00E7\u00E3o do formul\u00E1rio"
129
+ },
130
+ "attribute": "config-name",
131
+ "reflect": false
132
+ }
133
+ };
134
+ }
135
+ static get states() {
136
+ return {
137
+ "avaliableFields": {},
138
+ "selectedFields": {}
139
+ };
140
+ }
141
+ static get events() {
142
+ return [{
143
+ "method": "snkConfigSaved",
144
+ "name": "snkConfigSaved",
145
+ "bubbles": true,
146
+ "cancelable": true,
147
+ "composed": true,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": ""
151
+ },
152
+ "complexType": {
153
+ "original": "void",
154
+ "resolved": "void",
155
+ "references": {}
156
+ }
157
+ }];
158
+ }
159
+ static get methods() {
160
+ return {
161
+ "show": {
162
+ "complexType": {
163
+ "signature": "() => Promise<void>",
164
+ "parameters": [],
165
+ "references": {
166
+ "Promise": {
167
+ "location": "global"
168
+ }
169
+ },
170
+ "return": "Promise<void>"
171
+ },
172
+ "docs": {
173
+ "text": "Respons\u00E1vel por abrir o configurador.",
174
+ "tags": []
175
+ }
176
+ }
177
+ };
178
+ }
179
+ }