@sankhyalabs/sankhyablocks 5.4.3 → 5.6.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 (223) hide show
  1. package/dist/cjs/{SnkMessageBuilder-115e8a80.js → SnkMessageBuilder-e64dce7f.js} +49 -1
  2. package/dist/cjs/{constants-ae0ed870.js → constants-3787fa32.js} +1 -0
  3. package/dist/cjs/dataunit-fetcher-8f5ade55.js +319 -0
  4. package/dist/cjs/index-8d94b7e0.js +7 -0
  5. package/dist/cjs/{index-fc7ca86c.js → index-de79181a.js} +2 -1
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  8. package/dist/cjs/snk-application.cjs.entry.js +3 -315
  9. package/dist/cjs/snk-attach.cjs.entry.js +450 -0
  10. package/dist/cjs/snk-config-options.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-configurator.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-crud.cjs.entry.js +23 -13
  13. package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
  14. package/dist/cjs/{snk-data-unit-aa613f3b.js → snk-data-unit-85d6565e.js} +4 -1
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-detail-view.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-expression-item.cjs.entry.js +213 -0
  18. package/dist/cjs/snk-field-config.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +435 -0
  20. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-grid-config.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-grid.cjs.entry.js +11 -3
  23. package/dist/cjs/{snk-guides-viewer-7db960c2.js → snk-guides-viewer-9784c527.js} +2 -2
  24. package/dist/cjs/snk-guides-viewer.cjs.entry.js +4 -4
  25. package/dist/cjs/snk-personalized-filter.cjs.entry.js +126 -0
  26. package/dist/cjs/snk-select-box.cjs.entry.js +1 -1
  27. package/dist/cjs/{snk-simple-crud.cjs.entry.js → snk-simple-bar_2.cjs.entry.js} +48 -5
  28. package/dist/cjs/snk-tab-config.cjs.entry.js +1 -1
  29. package/dist/cjs/snk-taskbar.cjs.entry.js +6 -4
  30. package/dist/cjs/{taskbar-elements-5e87cf44.js → taskbar-elements-bc2598f9.js} +4 -1
  31. package/dist/collection/collection-manifest.json +4 -1
  32. package/dist/collection/components/snk-attach/interfaces/index.js +1 -0
  33. package/dist/collection/components/snk-attach/snk-attach.css +8 -0
  34. package/dist/collection/components/snk-attach/snk-attach.js +202 -0
  35. package/dist/collection/components/snk-attach/structure/crud-config-builder.js +37 -0
  36. package/dist/collection/components/snk-attach/structure/data-unit-builder.js +106 -0
  37. package/dist/collection/components/snk-attach/structure/index.js +3 -0
  38. package/dist/collection/components/snk-attach/structure/taskbar-builder.js +47 -0
  39. package/dist/collection/components/snk-configurator/snk-configurator.js +3 -3
  40. package/dist/collection/components/snk-crud/snk-crud.js +22 -11
  41. package/dist/collection/components/snk-data-unit/snk-data-unit.js +21 -0
  42. package/dist/collection/components/snk-filter-field-search/snk-filter-field-search.js +62 -69
  43. package/dist/collection/components/snk-grid/snk-grid.js +11 -3
  44. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.css +4 -0
  45. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +87 -0
  46. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.js +34 -0
  47. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.css +97 -0
  48. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +298 -0
  49. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +2 -2
  50. package/dist/collection/components/snk-simple-bar/snk-simple-bar.js +37 -2
  51. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +65 -2
  52. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +3 -0
  53. package/dist/collection/components/snk-taskbar/snk-taskbar.js +4 -2
  54. package/dist/collection/lib/http/data-fetcher/fetchers/attach-fetcher.js +136 -0
  55. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.js +1 -0
  56. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.js +1 -0
  57. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.js +6 -0
  58. package/dist/collection/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.js +3 -0
  59. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +63 -0
  60. package/dist/collection/lib/message/SnkMessageBuilder.js +7 -1
  61. package/dist/collection/lib/message/resources/snk-attach.msg.js +27 -0
  62. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +12 -0
  63. package/dist/collection/lib/message/resources/snk-simple-bar.msg.js +3 -0
  64. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  65. package/dist/collection/lib/store/index.js +2 -1
  66. package/dist/collection/lib/utils/constants.js +1 -0
  67. package/dist/components/SnkMessageBuilder.js +49 -1
  68. package/dist/components/constants.js +1 -0
  69. package/dist/components/dataunit-fetcher.js +317 -0
  70. package/dist/components/index.d.ts +3 -0
  71. package/dist/components/index.js +3 -0
  72. package/dist/components/index2.js +1 -1
  73. package/dist/components/index3.js +199 -0
  74. package/dist/components/snk-application2.js +2 -314
  75. package/dist/components/snk-attach.d.ts +11 -0
  76. package/dist/components/snk-attach.js +6 -0
  77. package/dist/components/snk-attach2.js +498 -0
  78. package/dist/components/snk-crud.js +77 -48
  79. package/dist/components/snk-data-exporter2.js +1 -1
  80. package/dist/components/snk-data-unit2.js +4 -0
  81. package/dist/components/snk-expression-item.d.ts +11 -0
  82. package/dist/components/snk-expression-item.js +6 -0
  83. package/dist/components/snk-expression-item2.js +241 -0
  84. package/dist/components/snk-filter-field-search.js +1 -200
  85. package/dist/{esm/snk-filter-field-search.entry.js → components/snk-filter-field-search2.js} +65 -38
  86. package/dist/components/snk-filter-param-config.js +1 -273
  87. package/dist/{esm/snk-filter-param-config.entry.js → components/snk-filter-param-config2.js} +35 -11
  88. package/dist/components/snk-grid2.js +12 -4
  89. package/dist/components/snk-personalized-filter.d.ts +11 -0
  90. package/dist/components/snk-personalized-filter.js +158 -0
  91. package/dist/components/snk-simple-bar.js +1 -41
  92. package/dist/components/snk-simple-bar2.js +59 -0
  93. package/dist/components/snk-simple-crud.js +1 -328
  94. package/dist/{esm/snk-simple-crud.entry.js → components/snk-simple-crud2.js} +73 -18
  95. package/dist/components/snk-taskbar2.js +10 -199
  96. package/dist/esm/{SnkMessageBuilder-a15d22f8.js → SnkMessageBuilder-f3590f65.js} +49 -1
  97. package/dist/esm/{constants-15617e7d.js → constants-e916ccc3.js} +1 -0
  98. package/dist/esm/dataunit-fetcher-d32c6a47.js +317 -0
  99. package/dist/esm/{index-6519a79e.js → index-507e19ec.js} +1 -1
  100. package/dist/esm/index-620ac460.js +7 -0
  101. package/dist/esm/{index-e467ade5.js → index-8efbf198.js} +2 -1
  102. package/dist/esm/loader.js +1 -1
  103. package/dist/esm/sankhyablocks.js +1 -1
  104. package/dist/esm/snk-application.entry.js +3 -315
  105. package/dist/esm/snk-attach.entry.js +446 -0
  106. package/dist/esm/snk-config-options.entry.js +1 -1
  107. package/dist/esm/snk-configurator.entry.js +1 -1
  108. package/dist/esm/snk-crud.entry.js +25 -15
  109. package/dist/esm/snk-data-exporter.entry.js +4 -4
  110. package/dist/esm/{snk-data-unit-5ed93c0e.js → snk-data-unit-50b1660c.js} +4 -1
  111. package/dist/esm/snk-data-unit.entry.js +2 -2
  112. package/dist/esm/snk-detail-view.entry.js +6 -6
  113. package/dist/esm/snk-expression-item.entry.js +209 -0
  114. package/dist/esm/snk-field-config.entry.js +1 -1
  115. package/dist/esm/snk-filter-field-search_2.entry.js +430 -0
  116. package/dist/esm/snk-form-config.entry.js +1 -1
  117. package/dist/esm/snk-grid-config.entry.js +1 -1
  118. package/dist/esm/snk-grid.entry.js +13 -5
  119. package/dist/esm/{snk-guides-viewer-1e7c21f6.js → snk-guides-viewer-4d12f268.js} +3 -3
  120. package/dist/esm/snk-guides-viewer.entry.js +5 -5
  121. package/dist/esm/snk-personalized-filter.entry.js +122 -0
  122. package/dist/esm/snk-select-box.entry.js +1 -1
  123. package/dist/esm/snk-simple-bar_2.entry.js +325 -0
  124. package/dist/esm/snk-tab-config.entry.js +1 -1
  125. package/dist/esm/snk-taskbar.entry.js +7 -5
  126. package/dist/esm/{taskbar-elements-10d80c79.js → taskbar-elements-e6af3e93.js} +5 -2
  127. package/dist/sankhyablocks/p-17375123.js +1 -0
  128. package/dist/sankhyablocks/{p-b80cf644.entry.js → p-1c0ee011.entry.js} +1 -1
  129. package/dist/sankhyablocks/p-1dcfd32a.entry.js +1 -0
  130. package/dist/sankhyablocks/p-27e264d9.entry.js +1 -0
  131. package/dist/sankhyablocks/p-343699ad.entry.js +1 -0
  132. package/dist/sankhyablocks/p-3d3263b4.js +1 -0
  133. package/dist/sankhyablocks/p-3fbe2d69.entry.js +11 -0
  134. package/dist/sankhyablocks/p-433dfa63.entry.js +1 -0
  135. package/dist/sankhyablocks/{p-f132e371.js → p-4c2015a9.js} +1 -1
  136. package/dist/sankhyablocks/p-4eefe631.entry.js +1 -0
  137. package/dist/sankhyablocks/p-6a02e236.js +1 -0
  138. package/dist/sankhyablocks/{p-0a1e7f75.entry.js → p-6ac29569.entry.js} +1 -1
  139. package/dist/sankhyablocks/{p-f4d36823.entry.js → p-6f0b3cc0.entry.js} +1 -1
  140. package/dist/sankhyablocks/{p-6516f35a.entry.js → p-86f75e7a.entry.js} +1 -1
  141. package/dist/sankhyablocks/{p-32599159.entry.js → p-8b02b276.entry.js} +1 -1
  142. package/dist/sankhyablocks/p-8bdf5e57.entry.js +1 -0
  143. package/dist/sankhyablocks/{p-9bfa3cfb.entry.js → p-c4417efb.entry.js} +1 -1
  144. package/dist/sankhyablocks/p-c9477950.js +1 -0
  145. package/dist/sankhyablocks/{p-703dddb9.js → p-ccd26e3a.js} +1 -1
  146. package/dist/sankhyablocks/p-d410f45a.js +1 -0
  147. package/dist/sankhyablocks/p-df8f13b4.entry.js +1 -0
  148. package/dist/sankhyablocks/{p-3169584f.entry.js → p-e0b4aec3.entry.js} +1 -1
  149. package/dist/sankhyablocks/p-e9f42525.entry.js +1 -0
  150. package/dist/sankhyablocks/{p-1393dc00.entry.js → p-f344b811.entry.js} +1 -1
  151. package/dist/sankhyablocks/p-f4184ce7.js +1 -0
  152. package/dist/sankhyablocks/p-f821768b.js +74 -0
  153. package/dist/sankhyablocks/{p-f29caa0a.entry.js → p-f8c66aa3.entry.js} +1 -1
  154. package/dist/sankhyablocks/p-fd4ed40a.entry.js +1 -0
  155. package/dist/sankhyablocks/p-ff96b509.entry.js +27 -0
  156. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  157. package/dist/types/components/snk-attach/interfaces/index.d.ts +10 -0
  158. package/dist/types/components/snk-attach/snk-attach.d.ts +45 -0
  159. package/dist/types/components/snk-attach/structure/crud-config-builder.d.ts +7 -0
  160. package/dist/types/components/snk-attach/structure/data-unit-builder.d.ts +16 -0
  161. package/dist/types/components/snk-attach/structure/index.d.ts +3 -0
  162. package/dist/types/components/snk-attach/structure/taskbar-builder.d.ts +8 -0
  163. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +5 -0
  164. package/dist/types/components/snk-filter-field-search/interfaces/index.d.ts +14 -4
  165. package/dist/types/components/snk-filter-field-search/snk-filter-field-search.d.ts +13 -10
  166. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +20 -0
  167. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/filter-operands/filter-operands.d.ts +9 -0
  168. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +54 -0
  169. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +4 -2
  170. package/dist/types/components/snk-simple-bar/snk-simple-bar.d.ts +14 -0
  171. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  172. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +1 -0
  173. package/dist/types/components.d.ts +150 -9
  174. package/dist/types/global.d.ts +9 -0
  175. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +8 -2
  176. package/dist/types/lib/http/data-fetcher/fetchers/attach-fetcher.d.ts +14 -0
  177. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDelete.d.ts +9 -0
  178. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/IDownloadKey.d.ts +13 -0
  179. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/ISave.d.ts +26 -0
  180. package/dist/types/lib/http/data-fetcher/fetchers/fecthAttach/interfaces/index.d.ts +3 -0
  181. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +7 -0
  182. package/dist/types/lib/message/resources/snk-attach.msg.d.ts +2 -0
  183. package/dist/types/lib/message/resources/snk-personalized-filter.msg.d.ts +1 -0
  184. package/dist/types/lib/message/resources/snk-simple-bar.msg.d.ts +1 -0
  185. package/dist/types/lib/store/index.d.ts +1 -0
  186. package/dist/types/lib/utils/constants.d.ts +2 -1
  187. package/package.json +1 -1
  188. package/react/components.d.ts +3 -0
  189. package/react/components.js +3 -0
  190. package/react/components.js.map +1 -1
  191. package/dist/cjs/snk-filter-field-search.cjs.entry.js +0 -185
  192. package/dist/cjs/snk-filter-param-config.cjs.entry.js +0 -256
  193. package/dist/cjs/snk-simple-bar.cjs.entry.js +0 -30
  194. package/dist/esm/snk-simple-bar.entry.js +0 -26
  195. package/dist/sankhyablocks/p-1c17eecf.entry.js +0 -1
  196. package/dist/sankhyablocks/p-2ecf14ff.js +0 -1
  197. package/dist/sankhyablocks/p-340d6fb0.entry.js +0 -84
  198. package/dist/sankhyablocks/p-74724fa7.js +0 -1
  199. package/dist/sankhyablocks/p-79d22df0.entry.js +0 -1
  200. package/dist/sankhyablocks/p-79f01b63.entry.js +0 -1
  201. package/dist/sankhyablocks/p-81e85890.entry.js +0 -1
  202. package/dist/sankhyablocks/p-93d8fe00.entry.js +0 -1
  203. package/dist/sankhyablocks/p-94e6fc90.entry.js +0 -1
  204. package/dist/sankhyablocks/p-98f7f796.js +0 -1
  205. package/dist/sankhyablocks/p-b3e71248.entry.js +0 -1
  206. package/dist/sankhyablocks/p-bc281de0.js +0 -1
  207. package/dist/sankhyablocks/p-d61759a5.entry.js +0 -1
  208. package/dist/sankhyablocks/p-d65809d5.entry.js +0 -1
  209. package/dist/sankhyablocks/p-f587a454.js +0 -1
  210. package/dist/types/components/snk-application/snk-application.d.ts +0 -259
  211. package/dist/types/components/snk-crud/snk-crud.d.ts +0 -73
  212. package/dist/types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.d.ts +0 -40
  213. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +0 -27
  214. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +0 -23
  215. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +0 -23
  216. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +0 -29
  217. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -25
  218. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +0 -19
  219. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +0 -38
  220. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +0 -74
  221. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +0 -53
  222. package/dist/types/components/snk-grid/snk-grid.d.ts +0 -95
  223. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +0 -59
@@ -0,0 +1,298 @@
1
+ import { Host, h } from '@stencil/core';
2
+ import { ApplicationContext, UserInterface } from '@sankhyalabs/core';
3
+ import { SelectedItemType } from "../../../snk-filter-field-search/interfaces";
4
+ import { CheckMode, ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
5
+ import { fieldBuilder } from "@sankhyalabs/ezui/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder";
6
+ import { FilterOperand } from '../../../../lib/@types';
7
+ import { FilterOperandDefault, FilterOperandTypeTextSearch, FIELD_TYPE_SEARCH_AND_TEXT } from "./filter-operands/filter-operands";
8
+ import store from '../../../../lib/store';
9
+ export class SnkExpressionItem {
10
+ constructor() {
11
+ this.application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
12
+ this.filterOperandDefault = FilterOperandDefault;
13
+ this.filterOperandTypeTextSearch = FilterOperandTypeTextSearch;
14
+ this._showValueVariable = false;
15
+ this._fieldSelected = undefined;
16
+ this._optionNotNull = false;
17
+ this.expression = undefined;
18
+ this.canRemove = true;
19
+ this.messagesBuilder = undefined;
20
+ }
21
+ expressionChanged(newValue, oldValue) {
22
+ if (newValue !== oldValue) {
23
+ this.ezFilterItemChange.emit(newValue);
24
+ }
25
+ }
26
+ componentWillLoad() {
27
+ this._dataSourceFetcher = store.get("filterFieldsDataSource");
28
+ store.onChange('filterFieldsDataSource', () => {
29
+ this._dataSourceFetcher = store.get("filterFieldsDataSource");
30
+ });
31
+ }
32
+ setValueExpression(key, value) {
33
+ this.expression[key] = value;
34
+ this.expressionChanged(this.expression);
35
+ }
36
+ getMessage(key, params) {
37
+ return this.application.messagesBuilder.getMessage(key, params);
38
+ }
39
+ handleSelectItem(filterField) {
40
+ if (filterField.type === SelectedItemType.FIELD) {
41
+ const field = filterField;
42
+ this._fieldSelected = field;
43
+ this.setValueExpression("fieldName", field.name);
44
+ }
45
+ }
46
+ handleFocus() {
47
+ if (this._elFilterFieldSearch)
48
+ this._elFilterFieldSearch.show();
49
+ }
50
+ handleChangeFilterInput(evt) {
51
+ this._elFilterFieldSearch.applyFilter(evt.detail);
52
+ }
53
+ handleChangeValueVariable(showValueVariable) {
54
+ this._showValueVariable = showValueVariable;
55
+ if (this._elFieldDynamic) {
56
+ this._elFieldDynamic.value = undefined;
57
+ this._elFieldDynamic.enabled = !showValueVariable;
58
+ }
59
+ }
60
+ openSnkFilterParamConfig() {
61
+ var _a;
62
+ (_a = this._elFilterParamConfigRef) === null || _a === void 0 ? void 0 : _a.open(this.expression).then(this.onOpenPromiseReady.bind(this)).catch(error => {
63
+ console.error(error);
64
+ });
65
+ }
66
+ onOpenPromiseReady(changes) {
67
+ this.expression = changes;
68
+ }
69
+ buildOptionsOperator() {
70
+ var _a;
71
+ if (FIELD_TYPE_SEARCH_AND_TEXT.includes((_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.userInterface)) {
72
+ return this.filterOperandTypeTextSearch;
73
+ }
74
+ else {
75
+ return this.filterOperandDefault;
76
+ }
77
+ }
78
+ handleChangeOperator(optionSelected) {
79
+ this.checkOptionIsNull(optionSelected);
80
+ this.setValueExpression("operand", optionSelected);
81
+ }
82
+ checkOptionIsNull(optionSelected) {
83
+ if (optionSelected === FilterOperand.NULL || optionSelected === FilterOperand.NOT_NULL) {
84
+ this._optionNotNull = true;
85
+ if (this._elFieldDynamic) {
86
+ this._elFieldDynamic.enabled = false;
87
+ this._elFieldDynamic.value = undefined;
88
+ }
89
+ }
90
+ else {
91
+ this._optionNotNull = false;
92
+ if (this._elFieldDynamic) {
93
+ this._elFieldDynamic.enabled = this._showValueVariable ? false : true;
94
+ }
95
+ }
96
+ }
97
+ confirmRemove(evt) {
98
+ evt.preventDefault();
99
+ evt.stopPropagation();
100
+ ApplicationUtils.confirm(this.getMessage("snkPersonalizedFilter.confirm.title"), this.getMessage("snkPersonalizedFilter.confirm.description"))
101
+ .then((canRemove) => {
102
+ if (canRemove) {
103
+ this.ezFilterItemRemove.emit(this.expression);
104
+ }
105
+ });
106
+ }
107
+ buildFieldByType() {
108
+ var _a, _b;
109
+ if (!this._fieldSelected)
110
+ return;
111
+ const inputFieldData = (_a = fieldBuilder(this.configureFieldByType())) === null || _a === void 0 ? void 0 : _a.$children$.shift();
112
+ if (this._optionNotNull && inputFieldData || ((_b = this._elValueVariable) === null || _b === void 0 ? void 0 : _b.value) && inputFieldData) {
113
+ inputFieldData.$attrs$.enabled = false;
114
+ }
115
+ return h(inputFieldData.$tag$, Object.assign(Object.assign({}, inputFieldData.$attrs$), { ref: (el) => {
116
+ this._elFieldDynamic = el;
117
+ } }));
118
+ }
119
+ configureFieldByType() {
120
+ const field = {
121
+ userInterface: this._fieldSelected.userInterface,
122
+ name: this._fieldSelected.name,
123
+ label: this._fieldSelected.label,
124
+ canShowError: false
125
+ };
126
+ switch (field.userInterface) {
127
+ case UserInterface.OPTIONSELECTOR:
128
+ field.props = {
129
+ options: this._fieldSelected.properties.map(option => ({
130
+ value: option.value,
131
+ label: option.name,
132
+ })),
133
+ };
134
+ break;
135
+ case UserInterface.LONGTEXT:
136
+ field.rows = 1;
137
+ break;
138
+ case UserInterface.SEARCH:
139
+ field.optionLoader = searchArgument => this.setCriteriaSearch(searchArgument, this.application);
140
+ break;
141
+ default:
142
+ break;
143
+ }
144
+ return field;
145
+ }
146
+ setCriteriaSearch({ mode, argument }, application) {
147
+ if (application == undefined)
148
+ return;
149
+ const searchOptions = {
150
+ showInactives: false
151
+ };
152
+ const options = {
153
+ entity: this._fieldSelected.properties.ENTITYNAME,
154
+ searchOptions: searchOptions,
155
+ entityDescription: this._fieldSelected.label
156
+ };
157
+ return application.executePreparedSearch(mode, argument, options);
158
+ }
159
+ render() {
160
+ var _a;
161
+ return (h(Host, null, h("div", { class: "box" }, h("div", { class: "box__container" }, h("div", { class: "box__container--input-filter" }, h("ez-filter-input", { value: (_a = this._fieldSelected) === null || _a === void 0 ? void 0 : _a.path, label: this.getMessage("snkPersonalizedFilter.info.labelSearchField"), canShowError: false, onEzChange: (evt) => this.handleChangeFilterInput(evt), onFocus: () => this.handleFocus() }), h("snk-filter-field-search", { ref: ref => this._elFilterFieldSearch = ref, searchable: false, onEzSelectFilterItem: (ev) => this.handleSelectItem(ev.detail), fieldsDataSource: this._dataSourceFetcher })), h("div", { class: "box__container--input-operator" }, h("ez-combo-box", { label: this.getMessage("snkPersonalizedFilter.info.labelOperator"), canShowError: false, options: this.buildOptionsOperator(), onEzChange: (evt) => this.handleChangeOperator(evt.detail.value), suppressEmptyOption: true })), h("div", { class: "box__container--input-value" }, !this._fieldSelected ?
162
+ h("ez-number-input", { label: "Valor", canShowError: false, enabled: (!this._showValueVariable && !this._optionNotNull) }) :
163
+ this.buildFieldByType()), h("div", { class: "box__container--input-value-variable", title: this.getMessage("snkPersonalizedFilter.info.titleTooltip") }, !this._optionNotNull &&
164
+ h("ez-check", { ref: ref => this._elValueVariable = ref, label: this.getMessage("snkPersonalizedFilter.info.labelValueVarible"), mode: CheckMode.SWITCH, onEzChange: (evt) => this.handleChangeValueVariable(evt.detail) }), (this._showValueVariable && !this._optionNotNull) &&
165
+ h("ez-icon", { class: "box__container--input-value-variable--icon", size: "large", iconName: "settings-inverted", onClick: () => this.openSnkFilterParamConfig() }), h("snk-filter-param-config", { ref: (el) => this._elFilterParamConfigRef = el, messagesBuilder: this.messagesBuilder })), h("div", { class: "box__container--button-delete" }, h("div", { class: "box__container--button-delete--icon" }, this.canRemove && h("ez-button", { mode: "icon", iconName: "delete", onClick: (evt) => this.confirmRemove(evt) })))))));
166
+ }
167
+ static get is() { return "snk-expression-item"; }
168
+ static get encapsulation() { return "scoped"; }
169
+ static get originalStyleUrls() {
170
+ return {
171
+ "$": ["snk-expression-item.css"]
172
+ };
173
+ }
174
+ static get styleUrls() {
175
+ return {
176
+ "$": ["snk-expression-item.css"]
177
+ };
178
+ }
179
+ static get properties() {
180
+ return {
181
+ "expression": {
182
+ "type": "unknown",
183
+ "mutable": false,
184
+ "complexType": {
185
+ "original": "IExpressionItem",
186
+ "resolved": "IExpressionItem",
187
+ "references": {
188
+ "IExpressionItem": {
189
+ "location": "import",
190
+ "path": "../../../snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
191
+ }
192
+ }
193
+ },
194
+ "required": false,
195
+ "optional": false,
196
+ "docs": {
197
+ "tags": [],
198
+ "text": "Express\u00E3o que ser\u00E1 representada visualmente."
199
+ },
200
+ "defaultValue": "undefined"
201
+ },
202
+ "canRemove": {
203
+ "type": "boolean",
204
+ "mutable": false,
205
+ "complexType": {
206
+ "original": "boolean",
207
+ "resolved": "boolean",
208
+ "references": {}
209
+ },
210
+ "required": false,
211
+ "optional": false,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": "Controla a exibi\u00E7\u00E3o do bot\u00E3o Remover."
215
+ },
216
+ "attribute": "can-remove",
217
+ "reflect": true,
218
+ "defaultValue": "true"
219
+ },
220
+ "messagesBuilder": {
221
+ "type": "unknown",
222
+ "mutable": true,
223
+ "complexType": {
224
+ "original": "SnkMessageBuilder",
225
+ "resolved": "SnkMessageBuilder",
226
+ "references": {
227
+ "SnkMessageBuilder": {
228
+ "location": "import",
229
+ "path": "../../../../lib/message/SnkMessageBuilder"
230
+ }
231
+ }
232
+ },
233
+ "required": false,
234
+ "optional": false,
235
+ "docs": {
236
+ "tags": [],
237
+ "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
238
+ }
239
+ }
240
+ };
241
+ }
242
+ static get states() {
243
+ return {
244
+ "_showValueVariable": {},
245
+ "_fieldSelected": {},
246
+ "_optionNotNull": {}
247
+ };
248
+ }
249
+ static get events() {
250
+ return [{
251
+ "method": "ezFilterItemChange",
252
+ "name": "ezFilterItemChange",
253
+ "bubbles": true,
254
+ "cancelable": true,
255
+ "composed": true,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Emitido quando acontece altera\u00E7\u00F5es na express\u00E3o."
259
+ },
260
+ "complexType": {
261
+ "original": "IExpressionItem",
262
+ "resolved": "IExpressionItem",
263
+ "references": {
264
+ "IExpressionItem": {
265
+ "location": "import",
266
+ "path": "../../../snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
267
+ }
268
+ }
269
+ }
270
+ }, {
271
+ "method": "ezFilterItemRemove",
272
+ "name": "ezFilterItemRemove",
273
+ "bubbles": true,
274
+ "cancelable": true,
275
+ "composed": true,
276
+ "docs": {
277
+ "tags": [],
278
+ "text": "Emitido ao confirmar uma remo\u00E7\u00E3o."
279
+ },
280
+ "complexType": {
281
+ "original": "IExpressionItem",
282
+ "resolved": "IExpressionItem",
283
+ "references": {
284
+ "IExpressionItem": {
285
+ "location": "import",
286
+ "path": "../../../snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem"
287
+ }
288
+ }
289
+ }
290
+ }];
291
+ }
292
+ static get watchers() {
293
+ return [{
294
+ "propName": "expression",
295
+ "methodName": "expressionChanged"
296
+ }];
297
+ }
298
+ }
@@ -33,7 +33,8 @@ export class SnkFilterParamConfig {
33
33
  * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
34
34
  */
35
35
  getMessage(key, params) {
36
- return this.messagesBuilder.getMessage(key, params);
36
+ var _a;
37
+ return (_a = this.messagesBuilder) === null || _a === void 0 ? void 0 : _a.getMessage(key, params);
37
38
  }
38
39
  getConfigValue(configName, inputName, inputAlias = "") {
39
40
  var _a, _b, _c;
@@ -188,7 +189,6 @@ export class SnkFilterParamConfig {
188
189
  })))), h("ez-text-area", Object.assign({ ref: (ref) => this._expressionElement = ref, class: "snk-filter-param-config__expression", label: this.getMessage("snkFilterParamConfig.labelExpression"), enabled: false }, this.getElementID("presentationExpression"))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
189
190
  }
190
191
  static get is() { return "snk-filter-param-config"; }
191
- static get encapsulation() { return "scoped"; }
192
192
  static get originalStyleUrls() {
193
193
  return {
194
194
  "$": ["snk-filter-param-config.css"]
@@ -1,17 +1,32 @@
1
1
  import { h } from '@stencil/core';
2
- import { ElementIDUtils } from '@sankhyalabs/core';
2
+ import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
3
  export class SnkSimpleBar {
4
4
  constructor() {
5
5
  this.label = undefined;
6
6
  this.breadcrumbItens = undefined;
7
+ this.messagesBuilder = undefined;
8
+ }
9
+ /**
10
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
11
+ * através de um pequeno modulo na estrutura da aplicação:
12
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
13
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-simple-bar.msg.ts"
14
+ */
15
+ getMessage(key, params) {
16
+ var _a;
17
+ if (this.messagesBuilder)
18
+ return this.messagesBuilder.getMessage(key, params);
19
+ if ((_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder)
20
+ return this._application.messagesBuilder.getMessage(key, params);
7
21
  }
8
22
  componentDidLoad() {
9
23
  if (!this._element)
10
24
  return;
11
25
  ElementIDUtils.addIDInfo(this._element);
26
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
12
27
  }
13
28
  render() {
14
- return (h("div", { class: "simple-bar__container ez-margin-vertical--medium ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
29
+ return (h("div", { class: "simple-bar__container ez-margin-vertical--medium ez-padding--extra-small" }, h("div", { class: "simple-bar__left-slot" }, h("ez-button", { class: "ez-padding-right--medium", title: this.getMessage('snkSimpleBar.backTitle'), mode: 'icon', iconName: "arrow_back", size: 'medium', onClick: () => this.exit.emit() }), h("div", { class: "simple-bar__column" }, h("h1", { class: "ez-title ez-title--primary ez-title--extra-large" }, this.label), h("ez-breadcrumb", { items: this.breadcrumbItens, onSelectedItem: ({ detail }) => this.clickBreadcrumbItem.emit(detail) }))), h("div", { class: "simple-bar__right-slot" }, h("slot", { name: "rightSlot" }))));
15
30
  }
16
31
  static get is() { return "snk-simple-bar"; }
17
32
  static get encapsulation() { return "scoped"; }
@@ -66,6 +81,26 @@ export class SnkSimpleBar {
66
81
  "tags": [],
67
82
  "text": "Define os itens que ser\u00E3o apresentados pelo breadcrumb"
68
83
  }
84
+ },
85
+ "messagesBuilder": {
86
+ "type": "unknown",
87
+ "mutable": true,
88
+ "complexType": {
89
+ "original": "SnkMessageBuilder",
90
+ "resolved": "SnkMessageBuilder",
91
+ "references": {
92
+ "SnkMessageBuilder": {
93
+ "location": "import",
94
+ "path": "../../lib/message/SnkMessageBuilder"
95
+ }
96
+ }
97
+ },
98
+ "required": false,
99
+ "optional": false,
100
+ "docs": {
101
+ "tags": [],
102
+ "text": "Respons\u00E1vel por flexibilizar e padronizar o uso de mensagens nos blocos de constru\u00E7\u00E3o."
103
+ }
69
104
  }
70
105
  };
71
106
  }
@@ -21,6 +21,9 @@ export class SnkSimpleCrud {
21
21
  this.dataState = undefined;
22
22
  this.dataUnit = undefined;
23
23
  this.mode = SIMPLE_CRUD_MODE.SERVER;
24
+ this.gridConfig = undefined;
25
+ this.formConfig = undefined;
26
+ this.useCancelConfirm = true;
24
27
  this.taskbarManager = undefined;
25
28
  this.messagesBuilder = undefined;
26
29
  }
@@ -125,7 +128,9 @@ export class SnkSimpleCrud {
125
128
  fieldMetadata.push(field);
126
129
  });
127
130
  if (fieldMetadata.length > 0) {
128
- this._config = formConfig;
131
+ if (!this.formConfig) {
132
+ this.formConfig = formConfig;
133
+ }
129
134
  this._metadata = {
130
135
  name: "SimpleCrud",
131
136
  label: "SimpleCrud",
@@ -149,7 +154,7 @@ export class SnkSimpleCrud {
149
154
  }
150
155
  render() {
151
156
  var _a;
152
- return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "simple-crud__taskbar ez-box ez-box--shadow ez-padding--medium", 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, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), "no-header": true }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this._config }))))));
157
+ return (h("snk-data-unit", { class: "simple-crud__container", dataUnit: this.dataUnit, useCancelConfirm: this.useCancelConfirm, onDataStateChange: evt => this.onDataStateChange(evt), onInsertionMode: () => this.goToView(VIEW_MODE.FORM), onDataUnitReady: (evt) => this.dataUnitReady.emit(evt.detail), onMessagesBuilderUpdated: evt => this.messagesBuilder = evt.detail }, h("header", null, h("slot", { name: "snkSimpleCrudHeader" })), h("section", { class: "ez-flex ez-box ez-box--shadow" }, h("snk-taskbar", { class: "simple-crud__taskbar ez-box ez-box--shadow ez-padding--medium", 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, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, slot: "leftButtons", presentationMode: PresentationMode.SECONDARY }), h("ez-view-stack", { class: "ez-flex ez-flex--column", ref: (ref) => this._viewStack = ref, "data-element-id": "simple-crud" }, h("stack-item", null, h("ez-grid", { dataUnit: this.dataUnit, onEzDoubleClick: () => this.goToView(VIEW_MODE.FORM), config: this.gridConfig, "no-header": true }, h("div", { slot: "footer" }, h("slot", { name: "snkSimpleCrudFooter" })))), h("stack-item", null, h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig }))))));
153
158
  }
154
159
  static get is() { return "snk-simple-crud"; }
155
160
  static get encapsulation() { return "scoped"; }
@@ -228,6 +233,64 @@ export class SnkSimpleCrud {
228
233
  "reflect": false,
229
234
  "defaultValue": "SIMPLE_CRUD_MODE.SERVER"
230
235
  },
236
+ "gridConfig": {
237
+ "type": "unknown",
238
+ "mutable": false,
239
+ "complexType": {
240
+ "original": "IGridConfig",
241
+ "resolved": "IGridConfig",
242
+ "references": {
243
+ "IGridConfig": {
244
+ "location": "import",
245
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-grid/controller/EzGridController"
246
+ }
247
+ }
248
+ },
249
+ "required": false,
250
+ "optional": false,
251
+ "docs": {
252
+ "tags": [],
253
+ "text": ""
254
+ }
255
+ },
256
+ "formConfig": {
257
+ "type": "unknown",
258
+ "mutable": false,
259
+ "complexType": {
260
+ "original": "IFormConfig",
261
+ "resolved": "IFormConfig",
262
+ "references": {
263
+ "IFormConfig": {
264
+ "location": "import",
265
+ "path": "@sankhyalabs/ezui/dist/types/utils/form/interfaces"
266
+ }
267
+ }
268
+ },
269
+ "required": false,
270
+ "optional": false,
271
+ "docs": {
272
+ "tags": [],
273
+ "text": ""
274
+ }
275
+ },
276
+ "useCancelConfirm": {
277
+ "type": "boolean",
278
+ "mutable": false,
279
+ "complexType": {
280
+ "original": "boolean",
281
+ "resolved": "boolean",
282
+ "references": {}
283
+ },
284
+ "required": false,
285
+ "optional": false,
286
+ "docs": {
287
+ "tags": [],
288
+ "text": ""
289
+ },
290
+ "attribute": "use-cancel-confirm",
291
+ "reflect": false,
292
+ "defaultValue": "true"
293
+ },
231
294
  "taskbarManager": {
232
295
  "type": "unknown",
233
296
  "mutable": false,
@@ -18,6 +18,7 @@ export var TaskbarElement;
18
18
  TaskbarElement["DIVIDER"] = "DIVIDER";
19
19
  TaskbarElement["CONFIGURATOR"] = "CONFIGURATOR";
20
20
  TaskbarElement["DATA_EXPORTER"] = "DATA_EXPORTER";
21
+ TaskbarElement["ATTACH"] = "ATTACH";
21
22
  })(TaskbarElement || (TaskbarElement = {}));
22
23
  export var AuthorizationElements;
23
24
  (function (AuthorizationElements) {
@@ -90,6 +91,8 @@ export const buildElem = (element, className, dataElementId, getTitle, action, i
90
91
  case TaskbarElement.DATA_EXPORTER:
91
92
  const provider = (_a = store.get("exporterProviders")) === null || _a === void 0 ? void 0 : _a[configName];
92
93
  return h("snk-data-exporter", { class: className, provider: provider, "data-element-id": dataElementId });
94
+ case TaskbarElement.ATTACH:
95
+ return iconButton("anexo", element, className, dataElementId, title, action, isEnabled);
93
96
  }
94
97
  };
95
98
  function textButton(name, className, dataElementId, text, title, action, isEnabled) {
@@ -18,7 +18,8 @@ export class SnkTaskbar {
18
18
  [TaskbarElement.SAVE]: "snkTaskbar.titleSave",
19
19
  [TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
20
20
  [TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode",
21
- [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator"
21
+ [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator",
22
+ [TaskbarElement.ATTACH]: "snkTaskbar.titleAttach",
22
23
  };
23
24
  this._permissions = undefined;
24
25
  this.configName = undefined;
@@ -125,7 +126,8 @@ export class SnkTaskbar {
125
126
  if (index > 1) {
126
127
  className += "ez-padding-left--medium";
127
128
  }
128
- if (TaskbarElement[def.toString()]) {
129
+ const taskbarElement = TaskbarElement[def.toString()];
130
+ if (taskbarElement) {
129
131
  return buildElem(def, className, this.getIdElemBtnNative(def), elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList, this.configName, this.presentationMode);
130
132
  }
131
133
  else {
@@ -0,0 +1,136 @@
1
+ import { DataFetcher } from "../DataFetcher";
2
+ import { SaveErrorsEnum } from "./fecthAttach/interfaces";
3
+ export class AttachFetcher {
4
+ constructor(entityName, registerKey, dataUnitName) {
5
+ var _a;
6
+ this.entityName = entityName;
7
+ this.registerKey = registerKey;
8
+ this.dataUnitName = dataUnitName;
9
+ this.validateFields = (fields) => {
10
+ if (!!fields.LINK && !!fields.NOMEARQUIVO)
11
+ throw new Error(SaveErrorsEnum.LINK_AND_FILE_AT_THE_SAME_TIME);
12
+ if (!fields.LINK && !fields.NOMEARQUIVO)
13
+ throw new Error(SaveErrorsEnum.ANY_LINK_OR_FILE_FILLED);
14
+ if (!this.registerKey)
15
+ throw new Error('Register key can not be null');
16
+ };
17
+ this.resourceID = (window["resourceID"] || ((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID));
18
+ }
19
+ async save(change) {
20
+ var _a, _b;
21
+ const serviceName = "AnexoSistemaSP.salvar";
22
+ let { updatingFields: fields } = change;
23
+ fields = Object.assign(Object.assign({}, fields), { NOMEARQUIVO: (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0] });
24
+ try {
25
+ this.validateFields(fields);
26
+ const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
27
+ const reqBody = {
28
+ serviceName,
29
+ requestBody: {
30
+ params: {
31
+ resourceID: this.resourceID,
32
+ description: fields.DESCRICAO,
33
+ fileSelect: fileInfo ? 1 : 0,
34
+ keySession: (_b = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _b === void 0 ? void 0 : _b.fileNameTmp,
35
+ nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
36
+ link: fields.LINK,
37
+ nameEntity: this.entityName,
38
+ pkEntity: this.registerKey,
39
+ typeAcess: fields.TIPOACESSO,
40
+ typeApres: fields.TIPOAPRES,
41
+ }
42
+ }
43
+ };
44
+ const result = await DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
45
+ return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
46
+ }
47
+ catch (error) {
48
+ return Promise.reject(error);
49
+ }
50
+ }
51
+ async edit(change) {
52
+ var _a, _b, _c;
53
+ const serviceName = "AnexoSistemaSP.salvar";
54
+ let { updatingFields: fields, record } = change;
55
+ const getFieldValue = (fieldValue) => {
56
+ if (fields[fieldValue] !== undefined)
57
+ return fields[fieldValue];
58
+ return record[fieldValue];
59
+ };
60
+ const attachField = getFieldValue('NOMEARQUIVO');
61
+ const hasNewAttachment = (_b = (_a = fields.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.downloadURL;
62
+ fields = Object.assign(Object.assign({}, fields), { DESCRICAO: getFieldValue('DESCRICAO'), LINK: getFieldValue('LINK'), TIPOACESSO: getFieldValue('TIPOACESSO'), TIPOAPRES: getFieldValue('TIPOAPRES'), CHAVEARQUIVO: record.CHAVEARQUIVO, NOMEARQUIVO: attachField === null || attachField === void 0 ? void 0 : attachField[0] });
63
+ const fileInfo = !fields.LINK ? fields.NOMEARQUIVO : null;
64
+ try {
65
+ this.validateFields(fields);
66
+ const reqBody = {
67
+ serviceName,
68
+ requestBody: {
69
+ params: {
70
+ resourceID: this.resourceID,
71
+ nuAttach: record === null || record === void 0 ? void 0 : record.NUATTACH,
72
+ description: fields.DESCRICAO,
73
+ fileSelect: hasNewAttachment ? 1 : 0,
74
+ keySession: (_c = fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.properties) === null || _c === void 0 ? void 0 : _c.fileNameTmp,
75
+ keyAttach: fields.CHAVEARQUIVO,
76
+ nameAttach: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name,
77
+ link: fields.LINK,
78
+ nameEntity: this.entityName,
79
+ pkEntity: this.registerKey,
80
+ typeAcess: fields.TIPOACESSO,
81
+ typeApres: fields.TIPOAPRES,
82
+ }
83
+ }
84
+ };
85
+ const result = await DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody));
86
+ return Promise.resolve([Object.assign(Object.assign(Object.assign({}, result), fields), { ARQUIVOOULINK: !!fields.LINK ? fields.LINK : fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.name, __owner__dataunit__name__: this.dataUnitName })]);
87
+ }
88
+ catch (error) {
89
+ return Promise.reject(error);
90
+ }
91
+ }
92
+ delete(record) {
93
+ var _a;
94
+ const serviceName = "AnexoSistemaSP.excluir";
95
+ const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
96
+ const reqBody = {
97
+ serviceName,
98
+ requestBody: {
99
+ paramsDelete: {
100
+ keyAttach: record.CHAVEARQUIVO,
101
+ nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
102
+ nameEntity: record.NOMEINSTANCIA,
103
+ nuAttach: record.NUATTACH,
104
+ pkEntity: record.PKREGISTRO
105
+ }
106
+ }
107
+ };
108
+ return new Promise((resolve, reject) => {
109
+ DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
110
+ .then(result => resolve(result))
111
+ .catch(error => reject(error));
112
+ });
113
+ }
114
+ getDownloadKey(record) {
115
+ var _a;
116
+ const serviceName = "AnexoSistemaSP.baixar";
117
+ const attachField = ((_a = record.NOMEARQUIVO) === null || _a === void 0 ? void 0 : _a[0]) || {};
118
+ const reqBody = {
119
+ serviceName,
120
+ requestBody: {
121
+ paramsDown: {
122
+ nameAttach: attachField === null || attachField === void 0 ? void 0 : attachField.name,
123
+ nameEntity: record.NOMEINSTANCIA,
124
+ nuAttach: record.NUATTACH,
125
+ pkEntity: record.PKREGISTRO,
126
+ keyAttach: record.CHAVEARQUIVO,
127
+ }
128
+ }
129
+ };
130
+ return new Promise((resolve, reject) => {
131
+ DataFetcher.get().callServiceBroker(serviceName, JSON.stringify(reqBody))
132
+ .then(result => resolve(result))
133
+ .catch(error => reject(error));
134
+ });
135
+ }
136
+ }
@@ -0,0 +1,6 @@
1
+ export var SaveErrorsEnum;
2
+ (function (SaveErrorsEnum) {
3
+ SaveErrorsEnum["LINK_AND_FILE_AT_THE_SAME_TIME"] = "LINK_AND_FILE_AT_THE_SAME_TIME";
4
+ SaveErrorsEnum["ANY_LINK_OR_FILE_FILLED"] = "ANY_LINK_OR_FILE_FILLED";
5
+ SaveErrorsEnum["UNKNOWN"] = "UNKNOWN";
6
+ })(SaveErrorsEnum || (SaveErrorsEnum = {}));
@@ -0,0 +1,3 @@
1
+ export * from './ISave';
2
+ export * from './IDelete';
3
+ export * from './IDownloadKey';