@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-76362.0 → 0.0.0-bugfix-dev-KB-74224.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/cjs/{ConfigStorage-f079f5fd.js → ConfigStorage-ecc0ed20.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-29b65619.js} +20 -29
  3. package/dist/cjs/{DataFetcher-e059eb72.js → DataFetcher-cadeef8e.js} +5 -7
  4. package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-f1c92f79.js} +2 -2
  5. package/dist/cjs/{SnkMessageBuilder-7691a2c1.js → SnkMessageBuilder-bae64d0d.js} +0 -10
  6. package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-d68841bc.js} +1 -1
  7. package/dist/cjs/{dataunit-fetcher-228016f4.js → dataunit-fetcher-f89461c1.js} +3 -3
  8. package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-ed497282.js} +1 -1
  9. package/dist/cjs/index-f9e81701.js +28 -16
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-ca89181c.js} +2 -7
  12. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  13. package/dist/cjs/snk-actions-button_4.cjs.entry.js +30 -27
  14. package/dist/cjs/snk-application.cjs.entry.js +60 -102
  15. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  16. package/dist/cjs/snk-config-options.cjs.entry.js +239 -0
  17. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  18. package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -6
  19. package/dist/cjs/{snk-data-unit-7dbdad0e.js → snk-data-unit-668dc5e8.js} +2 -2
  20. package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
  21. package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
  22. package/dist/cjs/{snk-filter-bar_4.cjs.entry.js → snk-filter-bar.cjs.entry.js} +3 -688
  23. package/dist/cjs/snk-filter-item.cjs.entry.js +312 -0
  24. package/dist/cjs/snk-filter-list.cjs.entry.js +152 -0
  25. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  26. package/dist/cjs/snk-filter-modal.cjs.entry.js +249 -0
  27. package/dist/cjs/{snk-config-options_3.cjs.entry.js → snk-form-config.cjs.entry.js} +3 -365
  28. package/dist/cjs/snk-form.cjs.entry.js +144 -0
  29. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  30. package/dist/cjs/{snk-guides-viewer-eee43c8b.js → snk-guides-viewer-4236cb9d.js} +5 -8
  31. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  32. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  33. package/dist/cjs/snk-simple-crud.cjs.entry.js +14 -14
  34. package/dist/collection/collection-manifest.json +31 -14
  35. package/dist/collection/components/snk-actions-button/snk-actions-button.js +27 -26
  36. package/dist/collection/components/snk-application/snk-application.js +53 -3
  37. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +0 -3
  38. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +7 -7
  39. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +6 -8
  40. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
  41. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +1 -6
  42. package/dist/collection/lib/message/SnkMessageBuilder.js +0 -2
  43. package/dist/collection/lib/utils/CrudUtils.js +16 -25
  44. package/dist/components/ContinuousInsertUtils.js +16 -25
  45. package/dist/components/DataFetcher.js +5 -7
  46. package/dist/components/SnkMessageBuilder.js +0 -10
  47. package/dist/components/dataunit-fetcher.js +2 -2
  48. package/dist/components/index.d.ts +0 -3
  49. package/dist/components/index.js +0 -3
  50. package/dist/components/pesquisa-fetcher.js +1 -6
  51. package/dist/components/snk-actions-button2.js +27 -26
  52. package/dist/components/snk-application2.js +53 -95
  53. package/dist/components/snk-detail-view2.js +0 -3
  54. package/dist/components/snk-simple-crud2.js +7 -7
  55. package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-7b36d041.js} +2 -2
  56. package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-30caa626.js} +20 -29
  57. package/dist/esm/{DataFetcher-5034df59.js → DataFetcher-a9c598f2.js} +5 -7
  58. package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-139f09fa.js} +3 -3
  59. package/dist/esm/{SnkMessageBuilder-7ace6803.js → SnkMessageBuilder-6fff4a4c.js} +0 -10
  60. package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-749d880f.js} +1 -1
  61. package/dist/esm/{constants-7302ee87.js → constants-8457af36.js} +1 -1
  62. package/dist/esm/{dataunit-fetcher-56cb648b.js → dataunit-fetcher-c24c76c6.js} +3 -3
  63. package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-adbe5d34.js} +1 -1
  64. package/dist/esm/index-a7d3d3f1.js +28 -16
  65. package/dist/esm/loader.js +1 -1
  66. package/dist/esm/{pesquisa-fetcher-6bc2e41a.js → pesquisa-fetcher-8edaa8cd.js} +2 -7
  67. package/dist/esm/sankhyablocks.js +1 -1
  68. package/dist/esm/snk-actions-button_4.entry.js +32 -29
  69. package/dist/esm/snk-application.entry.js +60 -102
  70. package/dist/esm/snk-attach.entry.js +6 -6
  71. package/dist/esm/snk-config-options.entry.js +235 -0
  72. package/dist/esm/snk-configurator.entry.js +1 -1
  73. package/dist/esm/snk-crud.entry.js +6 -6
  74. package/dist/esm/snk-data-exporter.entry.js +7 -7
  75. package/dist/esm/{snk-data-unit-7a579dbd.js → snk-data-unit-0fdfb6c2.js} +2 -2
  76. package/dist/esm/snk-data-unit.entry.js +4 -4
  77. package/dist/esm/snk-detail-view.entry.js +9 -9
  78. package/dist/esm/snk-field-config.entry.js +1 -1
  79. package/dist/esm/{snk-filter-bar_4.entry.js → snk-filter-bar.entry.js} +5 -687
  80. package/dist/esm/snk-filter-item.entry.js +308 -0
  81. package/dist/esm/snk-filter-list.entry.js +148 -0
  82. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  83. package/dist/esm/snk-filter-modal.entry.js +245 -0
  84. package/dist/esm/{snk-config-options_3.entry.js → snk-form-config.entry.js} +6 -366
  85. package/dist/esm/snk-form.entry.js +140 -0
  86. package/dist/esm/snk-grid.entry.js +6 -6
  87. package/dist/esm/{snk-guides-viewer-e8ca764a.js → snk-guides-viewer-8934c537.js} +6 -9
  88. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  89. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  90. package/dist/esm/snk-simple-crud.entry.js +15 -15
  91. package/dist/esm/snk-tab-config.entry.js +1 -1
  92. package/dist/sankhyablocks/p-01086ff7.entry.js +1 -0
  93. package/dist/sankhyablocks/{p-126c58ea.js → p-06421fdb.js} +1 -1
  94. package/dist/sankhyablocks/{p-e3a285a2.js → p-16869f77.js} +1 -1
  95. package/dist/sankhyablocks/p-17425c72.js +1 -0
  96. package/dist/sankhyablocks/{p-341465ce.js → p-1bf06cd3.js} +2 -2
  97. package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-212213d9.entry.js} +1 -1
  98. package/dist/sankhyablocks/p-2923c1b5.js +1 -0
  99. package/dist/sankhyablocks/p-3b60db06.entry.js +1 -0
  100. package/dist/sankhyablocks/{p-00f9fe5c.entry.js → p-430e4d3c.entry.js} +1 -1
  101. package/dist/sankhyablocks/{p-9ffd9fc7.js → p-4d9549cf.js} +1 -1
  102. package/dist/sankhyablocks/p-4f35399c.entry.js +1 -0
  103. package/dist/sankhyablocks/{p-c75fae8e.js → p-5dd8cf4f.js} +1 -1
  104. package/dist/sankhyablocks/p-60b29483.entry.js +1 -0
  105. package/dist/sankhyablocks/p-70a4af56.entry.js +1 -0
  106. package/dist/sankhyablocks/{p-41793e17.entry.js → p-7663f597.entry.js} +1 -1
  107. package/dist/sankhyablocks/{p-47d24ac8.js → p-7ac7932c.js} +2 -2
  108. package/dist/sankhyablocks/{p-2d3f9482.entry.js → p-8eb67fa4.entry.js} +1 -1
  109. package/dist/sankhyablocks/{p-f0aaad2b.entry.js → p-92eadb1c.entry.js} +1 -1
  110. package/dist/sankhyablocks/{p-8b4fc28f.entry.js → p-95df461f.entry.js} +1 -1
  111. package/dist/sankhyablocks/p-a42e7a1e.entry.js +11 -0
  112. package/dist/sankhyablocks/p-a724e798.entry.js +1 -0
  113. package/dist/sankhyablocks/{p-1dbd5c18.entry.js → p-a75d242d.entry.js} +1 -1
  114. package/dist/sankhyablocks/{p-0e206e62.js → p-afbb070d.js} +1 -1
  115. package/dist/sankhyablocks/{p-95ce311a.js → p-b0ef4383.js} +1 -1
  116. package/dist/sankhyablocks/p-b9679243.entry.js +1 -0
  117. package/dist/sankhyablocks/{p-f4e221b2.entry.js → p-b9c67e45.entry.js} +1 -1
  118. package/dist/sankhyablocks/{p-b389ed49.entry.js → p-be5d8fcb.entry.js} +1 -1
  119. package/dist/sankhyablocks/p-ca5ec380.js +1 -0
  120. package/dist/sankhyablocks/p-d3f53df2.entry.js +1 -0
  121. package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-dcead955.entry.js} +1 -1
  122. package/dist/sankhyablocks/p-e8763234.entry.js +1 -0
  123. package/dist/sankhyablocks/{p-00278e07.js → p-f3434fc4.js} +1 -1
  124. package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-fb34e0cf.entry.js} +1 -1
  125. package/dist/sankhyablocks/p-feba9d4b.entry.js +1 -0
  126. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  127. package/dist/types/components/snk-actions-button/interfaces/index.d.ts +3 -0
  128. package/dist/types/components/snk-actions-button/snk-actions-button.d.ts +3 -2
  129. package/dist/types/components/snk-application/snk-application.d.ts +12 -3
  130. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +1 -0
  131. package/dist/types/components.d.ts +1 -393
  132. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +0 -1
  133. package/dist/types/lib/utils/CrudUtils.d.ts +0 -1
  134. package/package.json +2 -3
  135. package/react/components.d.ts +0 -3
  136. package/react/components.js +0 -3
  137. package/react/components.js.map +1 -1
  138. package/dist/cjs/input-distinct-search_2.cjs.entry.js +0 -471
  139. package/dist/cjs/snk-distinct-search.cjs.entry.js +0 -123
  140. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +0 -28
  141. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +0 -16
  142. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +0 -52
  143. package/dist/collection/components/snk-distinct-search/snk-distinct-search.css +0 -4
  144. package/dist/collection/components/snk-distinct-search/snk-distinct-search.js +0 -372
  145. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.css +0 -110
  146. package/dist/collection/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.js +0 -544
  147. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.css +0 -28
  148. package/dist/collection/components/snk-distinct-search/subcomponents/search-modal/search-modal.js +0 -593
  149. package/dist/collection/components/snk-distinct-search/utils/filter-distinct-search.js +0 -15
  150. package/dist/collection/lib/http/data-fetcher/fetchers/distinct-search-fetcher.js +0 -25
  151. package/dist/collection/lib/message/resources/snk-distinct-search.msg.js +0 -9
  152. package/dist/collection/sw.js +0 -46
  153. package/dist/components/filter-distinct-search.js +0 -17
  154. package/dist/components/input-distinct-search.d.ts +0 -11
  155. package/dist/components/input-distinct-search.js +0 -6
  156. package/dist/components/input-distinct-search2.js +0 -264
  157. package/dist/components/search-modal.d.ts +0 -11
  158. package/dist/components/search-modal.js +0 -6
  159. package/dist/components/search-modal2.js +0 -264
  160. package/dist/components/snk-distinct-search.d.ts +0 -11
  161. package/dist/components/snk-distinct-search.js +0 -163
  162. package/dist/esm/input-distinct-search_2.entry.js +0 -466
  163. package/dist/esm/snk-distinct-search.entry.js +0 -119
  164. package/dist/sankhyablocks/p-0e250436.entry.js +0 -1
  165. package/dist/sankhyablocks/p-154aa2a6.entry.js +0 -11
  166. package/dist/sankhyablocks/p-18cb1acb.entry.js +0 -1
  167. package/dist/sankhyablocks/p-30ebcbe0.entry.js +0 -1
  168. package/dist/sankhyablocks/p-3755b46f.entry.js +0 -1
  169. package/dist/sankhyablocks/p-3858a2e4.entry.js +0 -1
  170. package/dist/sankhyablocks/p-42130213.entry.js +0 -1
  171. package/dist/sankhyablocks/p-563b7c28.entry.js +0 -1
  172. package/dist/sankhyablocks/p-aaf94476.js +0 -1
  173. package/dist/sankhyablocks/p-d8665750.js +0 -1
  174. package/dist/sankhyablocks/p-e4391e16.js +0 -1
  175. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +0 -11
  176. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +0 -12
  177. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +0 -13
  178. package/dist/types/components/snk-distinct-search/snk-distinct-search.d.ts +0 -83
  179. package/dist/types/components/snk-distinct-search/subcomponents/input-distinct-search/input-distinct-search.d.ts +0 -105
  180. package/dist/types/components/snk-distinct-search/subcomponents/search-modal/search-modal.d.ts +0 -127
  181. package/dist/types/components/snk-distinct-search/types/index.d.ts +0 -12
  182. package/dist/types/components/snk-distinct-search/utils/filter-distinct-search.d.ts +0 -4
  183. package/dist/types/lib/http/data-fetcher/fetchers/distinct-search-fetcher.d.ts +0 -6
  184. package/dist/types/lib/message/resources/snk-distinct-search.msg.d.ts +0 -2
  185. /package/dist/collection/components/{snk-distinct-search/types → snk-actions-button/interfaces}/index.js +0 -0
@@ -0,0 +1,245 @@
1
+ import { r as registerInstance, h } from './index-a7d3d3f1.js';
2
+ import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
3
+ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
+ import { F as FilterType } from './filter-type.enum-a80c1b6b.js';
5
+ import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
6
+ import { ObjectUtils } from '@sankhyalabs/core';
7
+ import { P as PersonalizedFilterUtils } from './PersonalizedFilterUtils-e2b38ef7.js';
8
+ import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
9
+ import './index-ae591a44.js';
10
+
11
+ const snkFilterModalCss = "ez-modal{--ez-modal-content-padding:24px 12px}.snk-filter-modal__container{width:344px;max-width:344px;min-width:344px;overflow:hidden}.snk-filter-modal__content{display:flex;flex-direction:column;gap:var(--space--medium, 12px);padding-right:var(--space--3xs, 4px)}.snk-filter-modal__collapsible-box{border:var(--border--small, 1px solid) var(--color--strokes, #DCE0E8);border-radius:var(--border--radius-medium);padding:var(--space--medium, 12px) var(--space--small, 6px)}.snk-filter-modal__rendered-items{max-height:760px;overflow-x:clip;overflow-y:auto}.snk-filter-modal__rendered-items::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
12
+
13
+ const SnkFilterModal = class {
14
+ constructor(hostRef) {
15
+ registerInstance(this, hostRef);
16
+ this.getMessage = undefined;
17
+ this.configName = undefined;
18
+ this.filters = undefined;
19
+ this.applyFilters = undefined;
20
+ this.closeModal = undefined;
21
+ this.addPersonalizedFilter = undefined;
22
+ this.editPersonalizedFilter = undefined;
23
+ this.deletePersonalizedFilter = undefined;
24
+ this.filtersToDelete = [];
25
+ this.disablePersonalizedFilter = undefined;
26
+ }
27
+ /**
28
+ * Emitido quando um filtro personalizado é deletado.
29
+ */
30
+ deletePersonalizedFilterListener(event) {
31
+ this.filtersToDelete.push(event.detail);
32
+ }
33
+ getCustomMessage(key, params) {
34
+ var _a;
35
+ return (_a = this.getMessage) === null || _a === void 0 ? void 0 : _a.call(this, `snkFilterBar.filterModal.${key}`, params);
36
+ }
37
+ //TODO: tratar clear all dos filtros personalizados
38
+ handleClearAll() {
39
+ const { customFilters, quickFilters, otherFilters, multiListFilters } = this.filters.reduce((acc, filter) => {
40
+ if (filter.type === FilterItemType.MULTI_LIST) {
41
+ acc.multiListFilters.push(filter);
42
+ return acc;
43
+ }
44
+ if (filter.filterType === FilterType.QUICK_FILTER) {
45
+ acc.quickFilters.push(filter);
46
+ return acc;
47
+ }
48
+ if (filter.filterType === FilterType.CUSTOM_FILTER) {
49
+ acc.customFilters.push(filter);
50
+ return acc;
51
+ }
52
+ if (filter.filterType === FilterType.OTHER_FILTERS) {
53
+ acc.otherFilters.push(filter);
54
+ return acc;
55
+ }
56
+ return acc;
57
+ }, { quickFilters: [], customFilters: [], otherFilters: [], multiListFilters: [] });
58
+ this.handleClearFilterList(quickFilters);
59
+ this.handleClearCustomFilters(customFilters);
60
+ this.handleClearOthersFilters(otherFilters);
61
+ multiListFilters.forEach(multiListFilter => this.handleClearSigleFilter(multiListFilter));
62
+ }
63
+ handleClearOthersFilters(otherFilters) {
64
+ this.filters = this.filters.map(filter => otherFilters.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
65
+ }
66
+ handleClearCustomFilters(customFilters) {
67
+ this.filters.forEach((filter, index) => {
68
+ if (filter.filterType === FilterType.CUSTOM_FILTER)
69
+ this.filters[index] = this.clearAllCustomFilter(customFilters).shift();
70
+ });
71
+ }
72
+ clearAllCustomFilter(filterConfigSnapshot) {
73
+ return filterConfigSnapshot.map(filterItem => {
74
+ const copy = Object.assign({}, filterItem);
75
+ delete copy.value;
76
+ copy.visible = false;
77
+ if (copy.groupedItems) {
78
+ copy.groupedItems = this.clearAllCustomFilter(copy.groupedItems);
79
+ }
80
+ return copy;
81
+ });
82
+ }
83
+ handleClose() {
84
+ const hasChangesToSave = ObjectUtils.objectToString(this.filters) !== ObjectUtils.objectToString(this._originalFilterConfig);
85
+ if (!hasChangesToSave) {
86
+ this.closeModal();
87
+ return;
88
+ }
89
+ return ApplicationUtils.confirm(this.getCustomMessage('validations.notSaved.title'), this.getCustomMessage('validations.notSaved.message')).then((cancelAction) => {
90
+ if (cancelAction)
91
+ this.closeModal();
92
+ });
93
+ }
94
+ handleApplyFilters() {
95
+ const filterPersonalized = this.filters.find(filter => filter.filterType === FilterType.CUSTOM_FILTER);
96
+ if (this.isValidCustomFilter(filterPersonalized)) {
97
+ this.applyFilters(this.filters);
98
+ }
99
+ if (this.filtersToDelete.length > 0) {
100
+ this.filtersToDelete.forEach(filter => {
101
+ this.deletePersonalizedFilter(filter, this.configName);
102
+ });
103
+ this.filtersToDelete = [];
104
+ }
105
+ }
106
+ isValidCustomFilter(filterPersonalized) {
107
+ const isValid = PersonalizedFilterUtils.validateVariableValues(filterPersonalized);
108
+ if (!isValid) {
109
+ ApplicationUtils.alert(this.getCustomMessage('validations.notFullFilled.title'), this.getCustomMessage('validations.notFullFilled.message'));
110
+ return false;
111
+ }
112
+ return true;
113
+ }
114
+ modalActionListener(evt) {
115
+ const modalAction = evt.detail;
116
+ switch (modalAction) {
117
+ case ModalAction.CANCEL:
118
+ this.handleClearAll();
119
+ break;
120
+ case ModalAction.OK:
121
+ this.handleApplyFilters();
122
+ break;
123
+ case ModalAction.CLOSE:
124
+ this.handleClose();
125
+ break;
126
+ }
127
+ }
128
+ handleFilterChange(filterConfig) {
129
+ this.filters = this.filters.map(filter => filter.id === filterConfig.id ? filterConfig : filter);
130
+ }
131
+ handleClearFilterList(filterList) {
132
+ this.filters = this.filters.map(filter => filterList.includes(filter) ? (Object.assign(Object.assign({}, filter), { value: undefined })) : filter);
133
+ }
134
+ handleClearSigleFilter(filterItem) {
135
+ if (FilterItemType.MULTI_LIST === filterItem.type) {
136
+ let filterItemCopy = ObjectUtils.copy(filterItem);
137
+ this.uncheckFilterValues(filterItemCopy.value);
138
+ const filterListCopy = ObjectUtils.copy(this.filters);
139
+ const index = filterListCopy.findIndex(item => item.id === filterItem.id);
140
+ filterListCopy.splice(index, 1, filterItemCopy);
141
+ this.filters = ObjectUtils.copy(filterListCopy);
142
+ return;
143
+ }
144
+ if (FilterItemType.CHECK_BOX_LIST === filterItem.type) {
145
+ const filterListCopy = ObjectUtils.copy(this.filters);
146
+ filterListCopy.find(filter => filter.id === filterItem.id).value = undefined;
147
+ this.filters = ObjectUtils.copy(filterListCopy);
148
+ return;
149
+ }
150
+ this.filters.find(filter => filter.id === filterItem.id).value = undefined;
151
+ }
152
+ uncheckFilterValues(valueList) {
153
+ valueList.forEach(value => {
154
+ if (!!value) {
155
+ value.check = false;
156
+ }
157
+ });
158
+ return valueList;
159
+ }
160
+ renderFilterItem(filterItem, fullRow) {
161
+ return (h("snk-filter-modal-item", { class: fullRow ? 'ez-col ez-col--sd-12' : 'ez-col ez-col--sd-6 ez-padding--small', filterItem: filterItem, configName: this.configName, onFilterChange: (event) => this.handleFilterChange(event.detail), onEditPersonalizedFilter: evt => this.editPersonalizedFilter(evt.detail), onAddPersonalizedFilter: () => this.addPersonalizedFilter() }));
162
+ }
163
+ isDefaultFilterNumberVariation(filter) {
164
+ var _a;
165
+ return filter.type === FilterItemType.NUMBER
166
+ && (!filter.props.variation || ((_a = filter.props) === null || _a === void 0 ? void 0 : _a.variation) === FilterNumberVariation.DEFAULT);
167
+ }
168
+ mountFiltersLines(filters) {
169
+ const MAX_LINE_LENGTH = 2;
170
+ let currentLine = 0;
171
+ let forceAddCurrent = false;
172
+ const filtersLines = {};
173
+ for (let curr = 0; curr < filters.length; curr++) {
174
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
175
+ const item = filters[curr];
176
+ const isLast = curr === filters.length - 1;
177
+ const currentItemMatch = item.type === FilterItemType.TEXT || this.isDefaultFilterNumberVariation(item);
178
+ const nextItemMatch = isLast ? false : filters[curr + 1].type === FilterItemType.TEXT || this.isDefaultFilterNumberVariation(filters[curr + 1]);
179
+ if ((currentItemMatch && nextItemMatch) || forceAddCurrent) {
180
+ filtersLines[currentLine].push(item);
181
+ forceAddCurrent = filtersLines[currentLine].length < MAX_LINE_LENGTH;
182
+ if (filtersLines[currentLine].length === MAX_LINE_LENGTH)
183
+ ++currentLine;
184
+ continue;
185
+ }
186
+ filtersLines[currentLine] = filtersLines[currentLine] || [];
187
+ filtersLines[currentLine].push(item);
188
+ ++currentLine;
189
+ }
190
+ return Object.values(filtersLines);
191
+ }
192
+ renderFilterLine(filters) {
193
+ const fullLine = filters.length === 1;
194
+ return filters.map((filter) => this.renderFilterItem(filter, fullLine));
195
+ }
196
+ getIformedFiltersCount(listItems) {
197
+ let countInformedItens = 0;
198
+ listItems.forEach(item => {
199
+ var _a, _b, _c, _d, _e, _f;
200
+ if (FilterItemType.MULTI_LIST === item.type) {
201
+ countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
202
+ return;
203
+ }
204
+ if (FilterItemType.CHECK_BOX_LIST === item.type) {
205
+ countInformedItens += Object.entries((_f = item.value) !== null && _f !== void 0 ? _f : {})
206
+ .filter(([_, value]) => value === true)
207
+ .map(([key, _]) => key).length;
208
+ return;
209
+ }
210
+ if (item.groupedItems != undefined) {
211
+ countInformedItens = item.groupedItems.filter(item => item.visible).length;
212
+ return;
213
+ }
214
+ if (!!item.value) {
215
+ countInformedItens++;
216
+ }
217
+ });
218
+ return countInformedItens;
219
+ }
220
+ renderCollapsibleFilterBox(label, listItems, isSingleItem, shouldRenderFooter = true) {
221
+ if (!listItems.length)
222
+ return null;
223
+ const appliedFilters = this.getIformedFiltersCount(listItems);
224
+ const lines = this.mountFiltersLines(listItems);
225
+ return (h("ez-collapsible-box", { class: "snk-filter-modal__collapsible-box", headerSize: "medium", value: true, label: label }, !!appliedFilters && (h("ez-badge", { class: "ez-badge--primary-subtle", slot: "rightSlot", label: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toString() })), h("div", { class: "ez-row snk-filter-modal__rendered-items" }, lines.map(this.renderFilterLine.bind(this))), shouldRenderFooter && (h("div", { class: "ez-flex ez-flex--justify-end grow" }, h("ez-button", { class: "ez-button--tertiary", size: "medium", label: "Limpar", onClick: () => isSingleItem ? this.handleClearSigleFilter(listItems[0]) : this.handleClearFilterList(listItems) })))));
226
+ }
227
+ componentWillRender() {
228
+ this._modalTitle = this.getCustomMessage('title');
229
+ this._okButtonLabel = this.getCustomMessage('okButtonLabel');
230
+ this._cancelButtonLabel = this.getCustomMessage('cancelButtonLabel');
231
+ }
232
+ componentDidLoad() {
233
+ if (!this._originalFilterConfig)
234
+ this._originalFilterConfig = this.filters;
235
+ }
236
+ render() {
237
+ const customFilters = this.filters.filter(filter => filter.filterType === FilterType.CUSTOM_FILTER);
238
+ const quickFilters = this.filters.filter(filter => filter.filterType === FilterType.QUICK_FILTER);
239
+ const otherFilters = this.filters.filter(filter => filter.filterType === FilterType.OTHER_FILTERS);
240
+ return (h("ez-modal-container", { class: "snk-filter-modal__container", modalTitle: this._modalTitle, cancelButtonLabel: this._cancelButtonLabel, okButtonLabel: this._okButtonLabel, onEzModalAction: this.modalActionListener.bind(this) }, h("div", { class: "snk-filter-modal__content ez-col--sd-12" }, !this.disablePersonalizedFilter && this.renderCollapsibleFilterBox(this.getCustomMessage('customFilters'), customFilters, false, false), this.renderCollapsibleFilterBox(this.getCustomMessage('quickFilters'), quickFilters, false), otherFilters.map(filter => this.renderCollapsibleFilterBox(filter.label, [filter], true)))));
241
+ }
242
+ };
243
+ SnkFilterModal.style = snkFilterModalCss;
244
+
245
+ export { SnkFilterModal as snk_filter_modal };
@@ -1,374 +1,14 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
- import { UserInterface, ObjectUtils, StringUtils, ApplicationContext, ElementIDUtils, ArrayUtils } from '@sankhyalabs/core';
3
- import { DataType, getConvertedValue } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
4
- import { CheckMode, ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
- import { c as VARS_BY_TYPE, D as DEFAULT_TYPE, d as TAGS_BY_TYPE, C as CONFIG_EVENTS, a as CONFIG_SORTABLE_EVENTS, b as TAB_NAMES, A as ACTION_CONFIG } from './constants-7302ee87.js';
6
- import { S as SnkFormConfigManager } from './SnkFormConfigManager-b409c745.js';
7
- import { R as ResourceIDUtils } from './ResourceIDUtils-a114189a.js';
8
2
  import { S as Sortable } from './Sortable-83960219.js';
9
- import { U as UserConfigType } from './form-config-fetcher-a7d3e277.js';
3
+ import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
4
+ import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
+ import { C as CONFIG_EVENTS, a as CONFIG_SORTABLE_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-8457af36.js';
6
+ import { U as UserConfigType } from './form-config-fetcher-adbe5d34.js';
10
7
  import { buildFormConfigFromDataUnit } from '@sankhyalabs/ezui/dist/collection/utils/form';
11
- import './ConfigStorage-6514d66e.js';
12
- import './filter-item-type.enum-d45e026f.js';
13
- import './DataFetcher-5034df59.js';
8
+ import './DataFetcher-a9c598f2.js';
14
9
  import './PrintUtils-3e4ff0f5.js';
15
10
  import '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
16
11
 
17
- const snkConfigOptionsCss = ".sc-snk-config-options-h{--snk-config-options--border:2px solid var(--color--secondary-200, #D2D3DA);width:100%;border-radius:15px;border:var(--snk-config-options--border)}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
18
-
19
- const SnkConfigOptions = class {
20
- constructor(hostRef) {
21
- registerInstance(this, hostRef);
22
- this.configOptionsChanged = createEvent(this, "configOptionsChanged", 7);
23
- this._defaultType = undefined;
24
- this.fieldConfig = {};
25
- this.idConfig = undefined;
26
- this.dataUnit = undefined;
27
- this.messagesBuilder = undefined;
28
- }
29
- onConfigDefault(optionSelected) {
30
- if (optionSelected != undefined) {
31
- this._defaultType = optionSelected;
32
- this.fieldConfig.defaultValue = {
33
- type: this._defaultType
34
- };
35
- this.configOptionsChanged.emit(this.fieldConfig);
36
- }
37
- }
38
- buildOptions() {
39
- var _a, _b, _c;
40
- let interfaceField = (_c = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name)) === null || _c === void 0 ? void 0 : _c.userInterface;
41
- if (interfaceField === UserInterface.SEARCH) {
42
- interfaceField = UserInterface.INTEGERNUMBER;
43
- }
44
- return VARS_BY_TYPE.UserInterface[interfaceField];
45
- }
46
- enabledValueDefault() {
47
- var _a, _b, _c;
48
- const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
49
- const allowDefault = (_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault;
50
- const hasVariableVar = VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface)
51
- || (field === null || field === void 0 ? void 0 : field.userInterface) === UserInterface.SEARCH;
52
- if ((allowDefault == undefined || allowDefault === "true") && hasVariableVar) {
53
- return true;
54
- }
55
- return false;
56
- }
57
- isAllowDefault() {
58
- var _a, _b;
59
- const allowDefault = (_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault;
60
- if (allowDefault == undefined) {
61
- return true;
62
- }
63
- return allowDefault === "true";
64
- }
65
- loadDefaultValue() {
66
- var _a;
67
- if (this.fieldConfig == undefined) {
68
- this._defaultType = DEFAULT_TYPE.fixed;
69
- this.fieldConfig = {
70
- defaultValue: {
71
- type: this._defaultType
72
- }
73
- };
74
- }
75
- else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
76
- this._defaultType = DEFAULT_TYPE.fixed;
77
- this.fieldConfig.defaultValue = {
78
- type: this._defaultType
79
- };
80
- }
81
- else {
82
- this._defaultType = this.fieldConfig.defaultValue.type;
83
- }
84
- }
85
- getFieldProperties(field) {
86
- var _a;
87
- if (field != undefined) {
88
- return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
89
- }
90
- }
91
- getMessage(key, params) {
92
- return this.messagesBuilder.getMessage(key, params);
93
- }
94
- getDefaultType() {
95
- var _a;
96
- return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : DEFAULT_TYPE.fixed;
97
- }
98
- getEnabledByProperty(attribName, propertyName) {
99
- const fieldDescriptor = this._fieldProperties;
100
- if (fieldDescriptor == undefined) {
101
- return true;
102
- }
103
- const fieldProperties = fieldDescriptor.properties || {};
104
- return fieldProperties.hasOwnProperty(propertyName) ? fieldProperties[propertyName] !== "S" : fieldDescriptor[attribName] !== true;
105
- }
106
- getValueByProperty(property) {
107
- const properties = this._fieldProperties;
108
- if (properties != undefined && properties[property] === true) {
109
- return true;
110
- }
111
- return this.fieldConfig[property];
112
- }
113
- getValidatedValue(fieldValue) {
114
- var _a, _b;
115
- if (fieldValue == undefined) {
116
- return;
117
- }
118
- const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
119
- const dataType = field === null || field === void 0 ? void 0 : field.dataType;
120
- if (dataType == undefined) {
121
- return;
122
- }
123
- const value = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) != undefined ? undefined :
124
- dataType !== DataType.OBJECT && dataType !== DataType.DATE
125
- && typeof fieldValue === "object"
126
- ? fieldValue.value
127
- : fieldValue;
128
- return dataType === DataType.OBJECT ? JSON.stringify(value) : value;
129
- }
130
- buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
131
- let options;
132
- let precision = 0;
133
- let prettyPrecision = 0;
134
- const TagName = userInterface == undefined || TAGS_BY_TYPE[userInterface] == undefined
135
- ? TAGS_BY_TYPE.DEFAULT
136
- : TAGS_BY_TYPE[userInterface];
137
- if (userInterface === UserInterface.OPTIONSELECTOR) {
138
- const prop = properties === null || properties === void 0 ? void 0 : properties.options;
139
- if (typeof prop === "string") {
140
- const parsed = ObjectUtils.stringToObject(prop);
141
- options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
142
- }
143
- else {
144
- options = prop;
145
- }
146
- }
147
- else if (userInterface === UserInterface.DECIMALNUMBER) {
148
- precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
149
- prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
150
- }
151
- return h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
152
- }
153
- getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
154
- switch (userInterface) {
155
- case UserInterface.SEARCH:
156
- return {
157
- suppressEmptyOption: required,
158
- optionLoader: (searchArgument) => this.onSearch(searchArgument)
159
- };
160
- case UserInterface.OPTIONSELECTOR:
161
- return {
162
- suppressEmptyOption: required,
163
- options
164
- };
165
- case UserInterface.CHECKBOX:
166
- case UserInterface.SWITCH:
167
- return {
168
- mode
169
- };
170
- case UserInterface.INTEGERNUMBER:
171
- case UserInterface.DECIMALNUMBER:
172
- return {
173
- precision,
174
- prettyPrecision,
175
- onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
176
- };
177
- case UserInterface.DATE:
178
- case UserInterface.DATETIME:
179
- case UserInterface.TIME:
180
- return {
181
- onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
182
- };
183
- default:
184
- return {};
185
- }
186
- }
187
- onChange(fieldValue) {
188
- this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
189
- this.configOptionsChanged.emit(this.fieldConfig);
190
- }
191
- onSearch(searchArgument) {
192
- if (this._application != undefined && this.fieldConfig != undefined) {
193
- return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
194
- }
195
- }
196
- buildField(descriptor, config) {
197
- const { name, label, readOnly, required, defaultValue } = config;
198
- const { userInterface, properties } = descriptor;
199
- const allowDefault = properties === null || properties === void 0 ? void 0 : properties.allowDefault;
200
- let value;
201
- let enabled = StringUtils.getBooleanValue(allowDefault, !readOnly);
202
- if (userInterface === UserInterface.FILE) {
203
- enabled = false;
204
- }
205
- if (enabled) {
206
- value = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value;
207
- if (value != undefined) {
208
- value = getConvertedValue(descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType, value);
209
- }
210
- }
211
- const configField = { value, enabled, label, name, required, userInterface };
212
- switch (userInterface) {
213
- case UserInterface.SWITCH:
214
- return this.buildInputDefault(configField, undefined, CheckMode.SWITCH);
215
- case UserInterface.CHECKBOX:
216
- return this.buildInputDefault(configField, undefined, CheckMode.REGULAR);
217
- case UserInterface.OPTIONSELECTOR:
218
- case UserInterface.DECIMALNUMBER:
219
- return this.buildInputDefault(configField, properties);
220
- default:
221
- return this.buildInputDefault(configField);
222
- }
223
- }
224
- componentWillLoad() {
225
- var _a;
226
- this.loadDefaultValue();
227
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
228
- this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
229
- }
230
- componentDidLoad() {
231
- ElementIDUtils.addIDInfo(this._element, this.fieldConfig.name);
232
- }
233
- render() {
234
- var _a, _b;
235
- return (h(Host, null, h("div", { id: this.idConfig }, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-text-input", { label: this.getMessage("snkConfigOptions.label.nameField"), value: (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.label, onEzChange: (evt) => { this.fieldConfig.label = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled: this.enabledValueDefault(), onEzChange: (evt) => { var _a; return this.onConfigDefault((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, value: this.getDefaultType() }, h("option", { value: DEFAULT_TYPE.fixed }, this.getMessage("snkConfigOptions.options.valueFixed")), h("option", { value: DEFAULT_TYPE.variable }, this.getMessage("snkConfigOptions.options.variable")))), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, this._defaultType === DEFAULT_TYPE.variable ?
236
- h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.isAllowDefault(), onEzChange: (evt) => { var _a; this.fieldConfig.defaultValue.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value; this.configOptionsChanged.emit(this.fieldConfig); }, value: this.fieldConfig.defaultValue.value, options: this.buildOptions() })
237
- :
238
- ((_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.userInterface) &&
239
- this.buildField(this._fieldProperties, this.fieldConfig))), h("div", { class: "ez-row ez-padding--medium config-options__switch-row" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.clearDuplicate"), value: this.fieldConfig.cleanOnCopy, onEzChange: (evt) => { this.fieldConfig.cleanOnCopy = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.requiredField"), enabled: this.getEnabledByProperty("required", "systemRequired"), value: this.getValueByProperty("required"), onEzChange: (evt) => { this.fieldConfig.required = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.protectedField"), enabled: this.getEnabledByProperty("readOnly", "systemReadOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
240
- }
241
- get _element() { return getElement(this); }
242
- };
243
- SnkConfigOptions.style = snkConfigOptionsCss;
244
-
245
- const snkFormCss = ".sc-snk-form-h{--snk-form__header--min-height:94px;display:block}.snk-form__form--hidden.sc-snk-form{display:none}";
246
-
247
- const SnkForm = class {
248
- constructor(hostRef) {
249
- registerInstance(this, hostRef);
250
- this.exit = createEvent(this, "exit", 7);
251
- this.actionClick = createEvent(this, "actionClick", 7);
252
- this.formItemsReady = createEvent(this, "formItemsReady", 7);
253
- this._customEditors = new Map();
254
- this._dataUnit = undefined;
255
- this._dataState = undefined;
256
- this._showFormConfig = false;
257
- this._configManager = undefined;
258
- this.configName = undefined;
259
- this.recordsValidator = undefined;
260
- this.messagesBuilder = undefined;
261
- this.formLegacyConfigName = undefined;
262
- this.resourceID = undefined;
263
- }
264
- /**
265
- * Exibe a janela de configurações do formulário.
266
- */
267
- async showConfig() {
268
- this._showFormConfig = true;
269
- }
270
- /**
271
- * Fecha a janela de configurações do formulário.
272
- */
273
- async hideConfig() {
274
- this._showFormConfig = false;
275
- }
276
- /**
277
- * Registra um editor customizado para campos da grade e formulário.
278
- */
279
- async addCustomEditor(fieldName, customEditor) {
280
- if (this._form) {
281
- this._form.addCustomEditor(fieldName, customEditor);
282
- return;
283
- }
284
- const newCustomEditors = new Map(this._customEditors);
285
- newCustomEditors.set(fieldName, customEditor);
286
- this._customEditors = newCustomEditors;
287
- }
288
- /**
289
- * Altera/adiciona uma propriedade nos metadados do campo.
290
- */
291
- async setFieldProp(fieldName, propName, value) {
292
- await this._form.setFieldProp(fieldName, propName, value);
293
- }
294
- closeConfig() {
295
- this.hideConfig();
296
- }
297
- dataunitReady() {
298
- const dataInfo = { dataUnit: this._dataUnit };
299
- ElementIDUtils.addIDInfo(this._element, null, dataInfo);
300
- }
301
- setCustomEditors() {
302
- if (!this._form) {
303
- return;
304
- }
305
- for (const [fieldName, customEditor] of this._customEditors) {
306
- this._form.addCustomEditor(fieldName, customEditor);
307
- this._customEditors.delete(fieldName);
308
- }
309
- }
310
- async componentDidRender() {
311
- this.setCustomEditors();
312
- }
313
- async componentWillLoad() {
314
- let parent = this._element.parentElement;
315
- while (parent) {
316
- if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
317
- this._snkDataUnit = parent;
318
- this._dataUnit = this._snkDataUnit.dataUnit;
319
- this._dataState = this._snkDataUnit.dataState;
320
- if (this._dataUnit) {
321
- this.dataunitReady();
322
- }
323
- else {
324
- this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
325
- this._dataUnit = evt.detail;
326
- });
327
- }
328
- this._snkDataUnit.addEventListener("dataStateChange", this.handleDataStateChange.bind(this));
329
- break;
330
- }
331
- parent = parent.parentElement;
332
- }
333
- if (this.resourceID == undefined) {
334
- this.resourceID = await ResourceIDUtils.getResourceID();
335
- }
336
- this._configManager = new SnkFormConfigManager(this.configName, this.resourceID, undefined, this._dataUnit);
337
- this.addFormLegacyConfig();
338
- await this._configManager.loadConfig();
339
- }
340
- async handleDataStateChange(evt) {
341
- var _a;
342
- this._dataState = evt.detail;
343
- const fieldsWithRmPrecision = await this._snkDataUnit.getFieldsWithRmPrecision();
344
- for (const field of fieldsWithRmPrecision || []) {
345
- if (!field) {
346
- continue;
347
- }
348
- const rmPrecision = (_a = this._dataState.rowMetadata) === null || _a === void 0 ? void 0 : _a.getProp('rm_precision', field);
349
- if (!rmPrecision && rmPrecision !== 0) {
350
- continue;
351
- }
352
- await this.setFieldProp(field, 'precision', rmPrecision);
353
- await this.setFieldProp(field, 'prettyPrecision', rmPrecision);
354
- }
355
- }
356
- addFormLegacyConfig() {
357
- if (this.formLegacyConfigName) {
358
- this._configManager.addFormLegacyConfig(this.formLegacyConfigName);
359
- }
360
- }
361
- render() {
362
- if (!this._dataUnit || !this._dataState) {
363
- return undefined;
364
- }
365
- return (h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { ref: (ref) => this._form = ref, key: "ezForm" + this._snkDataUnit.entityName, "data-element-id": "embedded", dataUnit: this._dataUnit, config: this._configManager.getConfig(this._dataUnit), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
366
- h("snk-form-config", { messagesBuilder: this.messagesBuilder, dataUnit: this._dataUnit, configManager: this._configManager, onConfigClose: () => this.closeConfig() })))));
367
- }
368
- get _element() { return getElement(this); }
369
- };
370
- SnkForm.style = snkFormCss;
371
-
372
12
  const snkFormConfigCss = ".sc-snk-form-config-h{--snk-form-config--z-index:var(--more-visible, 2);--snk-form-config--background-color:var(--background--xlight, #fff);--snk-form-config__icon--color:var(--text--disable, #AFB6C0);--snk-form-config__label-counter--font-weight:var(--text-weight--extra-small, 200);--snk-form-config__add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__add-group-container--background-color:var(--background--medium, #d2dce9);--snk-form-config__add-group-container--padding:var(--space--small, 6px);--snk-form-config__add-group-content--border:2px dashed var(--color-strokes, #DCE0E8);--snk-form-config__add-group-content--border-radius:var(--border--radius-small, 6px);--snk-form-config__add-group-label--padding:var(--space--large, 24px);--snk-form-config__btn-add-group--padding:var(--space--large, 24px) var(--space--medium, 12px) 0;--snk-form-config__btn-add-group-container--padding:var(--space--medium, 12px);--snk-form-config__btn-add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__btn-add-group-container--border:2px solid var(--color-strokes, #DCE0E8);--snk-form-config__btn-add-group-container--background-color:var(--background--body, #fafcff);display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--snk-form-config--z-index);background-color:var(--snk-form-config--background-color)}div.sc-snk-form-config:focus-visible,div.sc-snk-form-config:focus{outline:none}.form-config__header-container.sc-snk-form-config{display:flex}.form-config__field-container.sc-snk-form-config{width:32%;padding:6px}.form-config__hide-content.sc-snk-form-config{display:none}ez-icon.sc-snk-form-config .left-icon.sc-snk-form-config{--ez-icon--color:var(--snk-form-config__icon--color)}.ez-box__label-counter.sc-snk-form-config{margin-top:-7px;font-weight:var(--snk-form-config__label-counter--font-weight)}.form-config__btn-options.sc-snk-form-config{--ez-button--min-width:300px;--ez-button--background-color:var(--snk-form-config--background-color)}[data-draggable-parent].sc-snk-form-config{position:relative}.form-config__field-config--selected.sc-snk-form-config{position:static}.form-config__field-config--dragged.sc-snk-form-config .draggable-mirror.sc-snk-form-config{z-index:var(--snk-form-config--z-index)}.form-config__config-options.sc-snk-form-config{position:relative;margin-top:-3px;min-width:100%;z-index:1}.form-config__tab-container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config{position:relative;height:100%;max-height:calc(100vh - 92px)}.form-config__tab-container.sc-snk-form-config .ez-box__container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config .ez-box__container.sc-snk-form-config{align-content:flex-start;height:100%}.form-config__fields-available.sc-snk-form-config [data-draggable-parent].sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:100%;max-height:calc(100% - 122px)}.form-config__tab-content.sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:auto;max-height:calc(100% - 128px)}[data-draggable-element].sc-snk-form-config{cursor:grab}.form-config__actions-button.sc-snk-form-config{--ez-actions-button__btn-action--min-width:235px}.form-config__add-group.sc-snk-form-config{position:relative;min-height:120px;margin-bottom:10px}.form-config__add-group-container.sc-snk-form-config{position:absolute;display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box;border-radius:var(--snk-form-config__add-group-container--border-radius);background-color:var(--snk-form-config__add-group-container--background-color);padding:var(--snk-form-config__add-group-container--padding)}.form-config__add-group-content.sc-snk-form-config{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;box-sizing:border-box;border:var(--snk-form-config__add-group-content--border);border-radius:var(--snk-form-config__add-group-content--border-radius)}.form-config__add-group-label.sc-snk-form-config{display:flex;justify-content:center;box-sizing:border-box;padding:var(--snk-form-config__add-group-label--padding)}.form-config__btn-add-group.sc-snk-form-config{position:relative;padding:var(--snk-form-config__btn-add-group--padding)}.form-config__btn-add-group-container.sc-snk-form-config{padding:var(--snk-form-config__btn-add-group-container--padding);border-radius:var(--snk-form-config__btn-add-group-container--border-radius);border:var(--snk-form-config__btn-add-group-container--border);background-color:var(--snk-form-config__btn-add-group-container--background-color)}ez-collapsible-box.draggable-mirror.sc-snk-form-config{display:table;background-color:var(--snk-form-config--background-color)}ez-collapsible-box.sc-snk-form-config{margin-bottom:10px}@media screen and (min-width: 480px){.form-config__field-config--selected.sc-snk-form-config .ez-flex.form-config__config-options.sc-snk-form-config{min-width:calc(300% + 12px)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+2) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -1)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+3) .ez-flex.form-config__config-options.sc-snk-form-config{left:calc(100% / 1 * -2)}}";
373
13
 
374
14
  const CONTAINER_ID = {
@@ -1367,4 +1007,4 @@ const SnkFormConfig = class {
1367
1007
  };
1368
1008
  SnkFormConfig.style = snkFormConfigCss;
1369
1009
 
1370
- export { SnkConfigOptions as snk_config_options, SnkForm as snk_form, SnkFormConfig as snk_form_config };
1010
+ export { SnkFormConfig as snk_form_config };