@sankhyalabs/sankhyablocks 1.4.0-beta.7 → 1.4.0-beta.9

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 (194) hide show
  1. package/dist/cjs/{SnkMessageBuilder-b54dfb89.js → SnkMessageBuilder-6c2f7bcd.js} +87 -11
  2. package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
  3. package/dist/cjs/configurableElementsStorage-93459c72.js +20 -0
  4. package/dist/cjs/constants-9056ca9e.js +84 -0
  5. package/dist/cjs/draggable.bundle-82a25c06.js +6886 -0
  6. package/dist/cjs/form-config-fetcher-2de7c16a.js +6895 -0
  7. package/dist/cjs/{index-6fcf07f3.js → index-20e8b68a.js} +50 -2
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  10. package/dist/cjs/snk-application.cjs.entry.js +209 -6976
  11. package/dist/cjs/snk-config-modal.cjs.entry.js +62 -0
  12. package/dist/cjs/snk-config-options.cjs.entry.js +230 -0
  13. package/dist/cjs/{snk-filter-bar_5.cjs.entry.js → snk-configurator_6.cjs.entry.js} +194 -7
  14. package/dist/cjs/snk-crud.cjs.entry.js +13 -11
  15. package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
  16. package/dist/cjs/snk-field-config_2.cjs.entry.js +135 -0
  17. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  18. package/dist/cjs/snk-filter-detail.cjs.entry.js +1 -1
  19. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  20. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  21. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  22. package/dist/cjs/snk-filter-personalized.cjs.entry.js +3 -2
  23. package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
  24. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  25. package/dist/cjs/snk-form-config.cjs.entry.js +957 -0
  26. package/dist/cjs/snk-form.cjs.entry.js +146 -0
  27. package/dist/cjs/snk-pesquisa.cjs.entry.js +1 -1
  28. package/dist/cjs/snk-tab-config.cjs.entry.js +321 -0
  29. package/dist/cjs/{taskbar-elements-aedfeae6.js → taskbar-elements-9a4b1e19.js} +10 -6
  30. package/dist/cjs/taskbar-processor-6bd0d35c.js +47 -0
  31. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  32. package/dist/collection/collection-manifest.json +27 -1
  33. package/dist/collection/components/snk-application/snk-application.js +144 -23
  34. package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
  35. package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
  36. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
  37. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
  38. package/dist/collection/components/snk-crud/snk-crud.js +15 -13
  39. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +35 -4
  40. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +3 -3
  41. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +2 -1
  42. package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
  43. package/dist/collection/components/snk-form/snk-form.css +4 -0
  44. package/dist/collection/components/snk-form/snk-form.js +108 -30
  45. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
  46. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +315 -0
  47. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
  48. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
  49. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
  50. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
  51. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
  52. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
  53. package/dist/collection/components/snk-grid/snk-grid.js +92 -22
  54. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -5
  55. package/dist/collection/components/snk-taskbar/snk-taskbar.js +35 -3
  56. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
  57. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
  58. package/dist/collection/lib/message/SnkMessageBuilder.js +8 -1
  59. package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
  60. package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
  61. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
  62. package/dist/collection/lib/utils/constants.js +72 -0
  63. package/dist/components/SnkMessageBuilder.js +87 -11
  64. package/dist/components/_commonjsHelpers.js +17 -0
  65. package/dist/components/constants.js +74 -0
  66. package/dist/components/form-config-fetcher.js +6889 -0
  67. package/dist/components/index.d.ts +6 -0
  68. package/dist/components/index.js +6 -0
  69. package/dist/components/snk-application2.js +221 -6985
  70. package/dist/components/snk-config-modal.d.ts +11 -0
  71. package/dist/components/snk-config-modal.js +6 -0
  72. package/dist/components/snk-config-modal2.js +91 -0
  73. package/dist/components/snk-config-options.d.ts +11 -0
  74. package/dist/components/snk-config-options.js +6 -0
  75. package/dist/components/snk-config-options2.js +245 -0
  76. package/dist/components/snk-configurator.d.ts +11 -0
  77. package/dist/components/snk-configurator.js +6 -0
  78. package/dist/components/snk-configurator2.js +212 -0
  79. package/dist/components/snk-crud.js +62 -25
  80. package/dist/components/snk-field-config.d.ts +11 -0
  81. package/dist/components/snk-field-config.js +6 -0
  82. package/dist/components/snk-field-config2.js +70 -0
  83. package/dist/components/snk-filter-bar2.js +1 -1
  84. package/dist/components/snk-filter-modal2.js +2 -1
  85. package/dist/components/snk-filter-personalized.js +4 -1
  86. package/dist/components/snk-form-config.d.ts +11 -0
  87. package/dist/components/snk-form-config.js +6 -0
  88. package/dist/components/snk-form-config2.js +996 -0
  89. package/dist/components/snk-form2.js +79 -29
  90. package/dist/components/snk-grid2.js +43 -24
  91. package/dist/components/snk-tab-config.d.ts +11 -0
  92. package/dist/components/snk-tab-config.js +6 -0
  93. package/dist/components/snk-tab-config2.js +7220 -0
  94. package/dist/components/snk-taskbar2.js +27 -9
  95. package/dist/esm/{SnkMessageBuilder-d440381c.js → SnkMessageBuilder-5792c260.js} +87 -11
  96. package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
  97. package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
  98. package/dist/esm/constants-c6039d3d.js +74 -0
  99. package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
  100. package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
  101. package/dist/esm/{index-81dda3cf.js → index-e4121713.js} +50 -3
  102. package/dist/esm/loader.js +2 -2
  103. package/dist/esm/sankhyablocks.js +2 -2
  104. package/dist/esm/snk-application.entry.js +220 -6987
  105. package/dist/esm/snk-config-modal.entry.js +58 -0
  106. package/dist/esm/snk-config-options.entry.js +226 -0
  107. package/dist/esm/{snk-filter-bar_5.entry.js → snk-configurator_6.entry.js} +195 -9
  108. package/dist/esm/snk-crud.entry.js +13 -11
  109. package/dist/esm/snk-data-unit.entry.js +2 -2
  110. package/dist/esm/snk-field-config_2.entry.js +130 -0
  111. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  112. package/dist/esm/snk-filter-detail.entry.js +1 -1
  113. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  114. package/dist/esm/snk-filter-number.entry.js +1 -1
  115. package/dist/esm/snk-filter-period.entry.js +1 -1
  116. package/dist/esm/snk-filter-personalized.entry.js +3 -2
  117. package/dist/esm/snk-filter-search.entry.js +1 -1
  118. package/dist/esm/snk-filter-text.entry.js +1 -1
  119. package/dist/esm/snk-form-config.entry.js +953 -0
  120. package/dist/esm/snk-form.entry.js +142 -0
  121. package/dist/esm/snk-pesquisa.entry.js +1 -1
  122. package/dist/esm/snk-tab-config.entry.js +317 -0
  123. package/dist/esm/{taskbar-elements-38eb5d51.js → taskbar-elements-e2ed0536.js} +10 -6
  124. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  125. package/dist/esm/teste-pesquisa.entry.js +1 -1
  126. package/dist/sankhyablocks/{p-4574a955.entry.js → p-029ae4e4.entry.js} +1 -1
  127. package/dist/sankhyablocks/p-03f9c407.js +1 -0
  128. package/dist/sankhyablocks/p-112455b1.js +1 -0
  129. package/dist/sankhyablocks/p-12ad2a19.entry.js +1 -0
  130. package/dist/sankhyablocks/p-1feabfc7.entry.js +1 -0
  131. package/dist/sankhyablocks/p-21c8929b.js +1 -0
  132. package/dist/sankhyablocks/p-2284c850.entry.js +1 -0
  133. package/dist/sankhyablocks/p-2b891c4a.entry.js +1 -0
  134. package/dist/sankhyablocks/{p-0ea25487.entry.js → p-2dc76d79.entry.js} +1 -1
  135. package/dist/sankhyablocks/p-361299e8.js +26 -0
  136. package/dist/sankhyablocks/p-366aa0f5.entry.js +1 -0
  137. package/dist/sankhyablocks/p-36d2d9cf.entry.js +75 -0
  138. package/dist/sankhyablocks/{p-6386d720.entry.js → p-3a276f3d.entry.js} +1 -1
  139. package/dist/sankhyablocks/{p-0352c0e2.entry.js → p-44ce5b90.entry.js} +1 -1
  140. package/dist/sankhyablocks/{p-aecf3e0a.entry.js → p-6988f4a6.entry.js} +1 -1
  141. package/dist/sankhyablocks/p-776ff4d1.entry.js +1 -0
  142. package/dist/sankhyablocks/p-7b4a4a50.entry.js +1 -0
  143. package/dist/sankhyablocks/p-9ba3df4c.js +2 -0
  144. package/dist/sankhyablocks/{p-40b27004.entry.js → p-9dc4426d.entry.js} +1 -1
  145. package/dist/sankhyablocks/p-a17a4fca.entry.js +1 -0
  146. package/dist/sankhyablocks/p-a5b26df2.js +1 -0
  147. package/dist/sankhyablocks/p-b6d6b172.js +1 -0
  148. package/dist/sankhyablocks/{p-5bdb8452.entry.js → p-cc4bef9f.entry.js} +1 -1
  149. package/dist/sankhyablocks/{p-2e49afef.entry.js → p-d1ac09c9.entry.js} +1 -1
  150. package/dist/sankhyablocks/p-d50651a3.js +1 -0
  151. package/dist/sankhyablocks/p-d9fbb26f.js +1 -0
  152. package/dist/sankhyablocks/{p-49580cdd.entry.js → p-deb1f523.entry.js} +1 -1
  153. package/dist/sankhyablocks/p-e871aa92.entry.js +1 -0
  154. package/dist/sankhyablocks/{p-ba426ea9.entry.js → p-e9beab79.entry.js} +1 -1
  155. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  156. package/dist/types/components/snk-application/snk-application.d.ts +29 -14
  157. package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
  158. package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
  159. package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
  160. package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
  161. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
  162. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +8 -6
  163. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +3 -3
  164. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
  165. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +65 -0
  166. package/dist/types/components/snk-form/snk-form.d.ts +71 -0
  167. package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +51 -0
  168. package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
  169. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
  170. package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
  171. package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
  172. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +6 -5
  173. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -3
  174. package/dist/types/components.d.ts +358 -13
  175. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
  176. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  177. package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
  178. package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
  179. package/dist/types/lib/utils/constants.d.ts +76 -0
  180. package/dist/types/lib/utils/pesquisa.d.ts +2 -1
  181. package/package.json +4 -3
  182. package/react/components.d.ts +6 -0
  183. package/react/components.js +6 -0
  184. package/react/components.js.map +1 -1
  185. package/dist/cjs/snk-form_2.cjs.entry.js +0 -247
  186. package/dist/esm/snk-form_2.entry.js +0 -242
  187. package/dist/sankhyablocks/p-21e940aa.entry.js +0 -1
  188. package/dist/sankhyablocks/p-2eea7eea.js +0 -1
  189. package/dist/sankhyablocks/p-42036db1.entry.js +0 -84
  190. package/dist/sankhyablocks/p-77216252.entry.js +0 -1
  191. package/dist/sankhyablocks/p-86f15ffe.js +0 -1
  192. package/dist/sankhyablocks/p-97009a2c.entry.js +0 -1
  193. package/dist/sankhyablocks/p-a14c49db.entry.js +0 -1
  194. package/dist/sankhyablocks/p-fac2b6a9.js +0 -2
@@ -15,8 +15,8 @@ export class SnkTaskbar {
15
15
  [TaskbarElement.CANCEL]: "snkTaskbar.titleCancel",
16
16
  [TaskbarElement.SAVE]: "snkTaskbar.titleSave",
17
17
  [TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
18
- [TaskbarElement.CONFIG_GRID]: "snkTaskbar.titleConfigGrid",
19
- [TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode"
18
+ [TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode",
19
+ [TaskbarElement.CONFIGURATOR]: "snkTaskbar.titleConfigurator"
20
20
  };
21
21
  }
22
22
  observeButtons() {
@@ -100,7 +100,7 @@ export class SnkTaskbar {
100
100
  className += "ez-padding-left--medium";
101
101
  }
102
102
  if (TaskbarElement[def.toString()]) {
103
- return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
103
+ return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList, this.configName);
104
104
  }
105
105
  else {
106
106
  return buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
@@ -156,6 +156,23 @@ export class SnkTaskbar {
156
156
  }
157
157
  static get properties() {
158
158
  return {
159
+ "configName": {
160
+ "type": "string",
161
+ "mutable": false,
162
+ "complexType": {
163
+ "original": "string",
164
+ "resolved": "string",
165
+ "references": {}
166
+ },
167
+ "required": false,
168
+ "optional": false,
169
+ "docs": {
170
+ "tags": [],
171
+ "text": "Nome usado para guardar/recuperar as configura\u00E7\u00F5es do formul\u00E1rio"
172
+ },
173
+ "attribute": "config-name",
174
+ "reflect": false
175
+ },
159
176
  "buttons": {
160
177
  "type": "string",
161
178
  "mutable": false,
@@ -296,6 +313,21 @@ export class SnkTaskbar {
296
313
  "resolved": "string",
297
314
  "references": {}
298
315
  }
316
+ }, {
317
+ "method": "actionChange",
318
+ "name": "actionChange",
319
+ "bubbles": true,
320
+ "cancelable": true,
321
+ "composed": true,
322
+ "docs": {
323
+ "tags": [],
324
+ "text": "Emitido sempre que houver altera\u00E7\u00E3o em algum elemento aberto pelo bot\u00E3o de a\u00E7\u00E3o"
325
+ },
326
+ "complexType": {
327
+ "original": "any",
328
+ "resolved": "any",
329
+ "references": {}
330
+ }
299
331
  }];
300
332
  }
301
333
  static get watchers() {
@@ -1,5 +1,34 @@
1
+ import { gql } from "graphql-request";
1
2
  import { ResourceFetcher } from "./resource-fetcher";
3
+ import { DataFetcher } from "../DataFetcher";
4
+ import { ObjectUtils } from "@sankhyalabs/core";
2
5
  export class FormConfigFetcher extends ResourceFetcher {
6
+ constructor() {
7
+ super();
8
+ this.queryConfig = new Map();
9
+ this.buildTemplatesConfig();
10
+ }
11
+ buildTemplatesConfig() {
12
+ this.queryConfig.set("fetchUserAvailableConfigs", gql `query($name: String!) {
13
+ $queryAlias$: fetchUserAvailableConfigs(name: $name){
14
+ name
15
+ origin
16
+ key
17
+ }
18
+ }`);
19
+ this.queryConfig.set("fetchLegacyConfig", gql `query($name: String!) {
20
+ $queryAlias$: fetchLegacyConfig(name: $name){
21
+ name
22
+ resource
23
+ }
24
+ }`);
25
+ this.queryConfig.set("fetchDefaultConfig", gql `query($name: String!) {
26
+ $queryAlias$: fetchDefaultConfig(name: $name){
27
+ name
28
+ resource
29
+ }
30
+ }`);
31
+ }
3
32
  loadFormConfig(formName, resourceID) {
4
33
  return new Promise((accept, reject) => {
5
34
  this.loadResource(`cfg://form/${resourceID}/${formName}`)
@@ -9,9 +38,17 @@ export class FormConfigFetcher extends ResourceFetcher {
9
38
  const { tabs, fields } = config;
10
39
  if (tabs) {
11
40
  const allTabs = new Map(tabs.map(t => [t.label, t]));
12
- fields.forEach(f => f.tab = allTabs.get(this.getTabName(f.tab)));
41
+ fields === null || fields === void 0 ? void 0 : fields.forEach(f => { var _a; return f.tab = ((_a = allTabs.get(this.getTabName(f.tab))) === null || _a === void 0 ? void 0 : _a.label) || allTabs.get(this.getTabName(f.tab)); });
13
42
  }
14
- accept(fields);
43
+ config.fields = fields === null || fields === void 0 ? void 0 : fields.map((field) => {
44
+ if ("readonly" in field) {
45
+ const readOnly = field['readonly'];
46
+ delete field['readonly'];
47
+ field.readOnly = readOnly;
48
+ }
49
+ return field;
50
+ });
51
+ accept(config);
15
52
  }
16
53
  else {
17
54
  reject(`Sem configuração pro formulário "${formName}".`);
@@ -23,9 +60,75 @@ export class FormConfigFetcher extends ResourceFetcher {
23
60
  });
24
61
  }
25
62
  getTabName(tab) {
26
- if (typeof tab === 'object') { // TabConfig type
63
+ if (typeof tab === 'object') { // ITabConfig type
27
64
  return tab.label;
28
65
  }
29
66
  return tab; //string type
30
67
  }
68
+ saveConfig(config, formName, resourceID) {
69
+ const completePath = `cfg://form/${resourceID}/${formName}`;
70
+ return new Promise((resolve, reject) => {
71
+ this.saveResource(config, completePath)
72
+ .then((resp) => {
73
+ resolve(resp);
74
+ })
75
+ .catch((error) => {
76
+ reject(error);
77
+ });
78
+ });
79
+ }
80
+ fetchUserAvailableConfigs(formName, resourceID) {
81
+ const name = `cfg://form/${resourceID}/${formName}`;
82
+ return new Promise((resolve, reject) => {
83
+ DataFetcher.get()
84
+ .callGraphQL({
85
+ values: { name },
86
+ query: this.queryConfig.get("fetchUserAvailableConfigs"),
87
+ })
88
+ .then((result) => {
89
+ resolve(result);
90
+ })
91
+ .catch((error) => {
92
+ reject(error);
93
+ });
94
+ });
95
+ }
96
+ fetchLegacyConfig(formName, resourceID) {
97
+ const name = `cfg://form/${resourceID}/${formName}`;
98
+ return new Promise((resolve, reject) => {
99
+ DataFetcher.get()
100
+ .callGraphQL({
101
+ values: { name },
102
+ query: this.queryConfig.get("fetchLegacyConfig"),
103
+ })
104
+ .then((result) => {
105
+ resolve(ObjectUtils.stringToObject((result === null || result === void 0 ? void 0 : result.resource) || ''));
106
+ })
107
+ .catch((error) => {
108
+ reject(error);
109
+ });
110
+ });
111
+ }
112
+ fetchDefaultConfig(formName, resourceID) {
113
+ const name = `cfg://form/${resourceID}/${formName}`;
114
+ return new Promise((resolve, reject) => {
115
+ DataFetcher.get()
116
+ .callGraphQL({
117
+ values: { name },
118
+ query: this.queryConfig.get("fetchDefaultConfig"),
119
+ })
120
+ .then((result) => {
121
+ resolve(ObjectUtils.stringToObject((result === null || result === void 0 ? void 0 : result.resource) || ''));
122
+ })
123
+ .catch((error) => {
124
+ reject(error);
125
+ });
126
+ });
127
+ }
31
128
  }
129
+ export var UserConfigType;
130
+ (function (UserConfigType) {
131
+ UserConfigType["USER"] = "USER";
132
+ UserConfigType["DEFAULT"] = "DEFAULT";
133
+ UserConfigType["SHARED"] = "SHARED";
134
+ })(UserConfigType || (UserConfigType = {}));
@@ -19,7 +19,10 @@ export class ResourceFetcher {
19
19
  }`);
20
20
  }
21
21
  loadResource(name) {
22
- return new Promise((resolve, reject) => {
22
+ if (ResourceFetcher._loadingResource.has(name)) {
23
+ return ResourceFetcher._loadingResource.get(name);
24
+ }
25
+ const promiseLoadResource = new Promise((resolve, reject) => {
23
26
  DataFetcher.get()
24
27
  .callGraphQL({
25
28
  values: { name },
@@ -27,11 +30,15 @@ export class ResourceFetcher {
27
30
  })
28
31
  .then((result) => {
29
32
  resolve(result === null || result === void 0 ? void 0 : result.resource);
33
+ ResourceFetcher._loadingResource.delete(name);
30
34
  })
31
35
  .catch((error) => {
32
36
  reject(error);
37
+ ResourceFetcher._loadingResource.delete(name);
33
38
  });
34
39
  });
40
+ ResourceFetcher._loadingResource.set(name, promiseLoadResource);
41
+ return promiseLoadResource;
35
42
  }
36
43
  saveResource(resource, name) {
37
44
  return new Promise((resolve, reject) => {
@@ -54,3 +61,4 @@ export class ResourceFetcher {
54
61
  });
55
62
  }
56
63
  }
64
+ ResourceFetcher._loadingResource = new Map();
@@ -1,15 +1,22 @@
1
1
  import snkDataUnitMessages from "./resources/snk-data-unit.msg.js";
2
2
  import snkFilterBarMessages from "./resources/snk-filter-bar.msg.js";
3
- import snkFormMessages from "./resources/snk-form.msg.js";
4
3
  import snkTaskbarMessages from "./resources/snk-taskbar.msg.js";
5
4
  import crudUtilsMessages from "./resources/crud-utils.msg.js";
5
+ import { snkFormMessages, snkFormConfigMessages, snkConfigOptionsMessages, snkFieldConfigMessages, snkTabConfigMessages } from "./resources/snk-form.msg.js";
6
+ import { snkConfiguratorMessages, snkConfigModalMessages } from "./resources/snk-configurator.msg.js";
6
7
  export class SnkMessageBuilder {
7
8
  constructor() {
8
9
  this._defaults = {
9
10
  snkDataUnit: snkDataUnitMessages,
10
11
  snkForm: snkFormMessages,
12
+ snkFormConfig: snkFormConfigMessages,
13
+ snkConfigOptions: snkConfigOptionsMessages,
11
14
  snkTaskbar: snkTaskbarMessages,
15
+ snkConfigModal: snkConfigModalMessages,
16
+ snkFieldConfig: snkFieldConfigMessages,
12
17
  snkFilterBar: snkFilterBarMessages,
18
+ snkConfigurator: snkConfiguratorMessages,
19
+ snkTabConfig: snkTabConfigMessages,
13
20
  crudUtils: crudUtilsMessages
14
21
  };
15
22
  this._currentOperation = OperationMap.CLEAN;
@@ -0,0 +1,11 @@
1
+ export const snkConfiguratorMessages = {
2
+ msgSaveSuccessfully: "As configurações foram salvas com sucesso!"
3
+ };
4
+ export const snkConfigModalMessages = {
5
+ titleConfigurations: "Configurações",
6
+ subTitleModeConfig: "Modo de visualização",
7
+ labelConfigGrid: "Configurar grade",
8
+ labelConfigForm: "Configurar formulário",
9
+ labelGrid: "Grade",
10
+ labelForm: "Formulário"
11
+ };
@@ -1,4 +1,4 @@
1
- const snkFormMessages = {
1
+ export const snkFormMessages = {
2
2
  title: {
3
3
  clone: "Duplicar registro",
4
4
  insert: "Cadastrar registro",
@@ -7,4 +7,61 @@ const snkFormMessages = {
7
7
  },
8
8
  goBackTitle: "Voltar"
9
9
  };
10
- export default snkFormMessages;
10
+ export const snkConfigOptionsMessages = {
11
+ label: {
12
+ nameField: "Nome do Campo *",
13
+ typeValueDefault: "Tipo de valor padrão *",
14
+ valueDefault: "Valor Padrão",
15
+ clearDuplicate: "Limpar ao Duplicar",
16
+ requiredField: "Campo Obrigatório",
17
+ protectedField: "Campo Protegido"
18
+ },
19
+ options: {
20
+ valueFixed: "Valor Fixo",
21
+ variable: "Variável"
22
+ }
23
+ };
24
+ export const snkFormConfigMessages = {
25
+ title: "Configuração do formulário",
26
+ applyConfig: "Aplicar configuração",
27
+ availableFields: {
28
+ title: "Campos disponíveis",
29
+ labelNoFields: "Nenhum campo disponível",
30
+ labelOneField: "1 campo disponível",
31
+ labelAvailableFields: "Campos disponíveis",
32
+ labelSearchField: "Procurar campo"
33
+ },
34
+ form: {
35
+ subTitleInfo: "Inclua estes campos nos grupos ou deixe-os separados no topo do formulário!",
36
+ labelDropField: "Arraste e solte um campo aqui",
37
+ labelNewGroup: "Adicionar novo grupo",
38
+ mainArea: "Área principal",
39
+ tabGeneral: "Geral"
40
+ },
41
+ confirm: {
42
+ title: "Aviso",
43
+ deleteTab: "A aba selecionada será excluída.<br/><br/> Tem certeza que deseja excluir aba",
44
+ cancel: "As alterações realizadas serão descartadas.<br/><br/><b>Gostaria de continuar?</b>",
45
+ exit: "Ao sair as alterações serão descartadas.<br/><br/><b>Você realmente gostaria de sair?</b>",
46
+ apply: "A <b>{0}</b> irá substituir a sua configuração {1}!<br/><br/><b>Deseja continuar?</b>",
47
+ group: "Não é possível salvar as configurações com um grupo vazio!",
48
+ labelYes: "Sim",
49
+ labelNo: "Não"
50
+ },
51
+ alert: {
52
+ titleGroupExists: "Já existe um grupo com título",
53
+ infoValidTitle: "Por favor, digite um título válido.",
54
+ inTab: "na aba"
55
+ }
56
+ };
57
+ export const snkFieldConfigMessages = {
58
+ titleRemove: "Remover",
59
+ titleConfigurations: "Configurações",
60
+ titleAdd: "Adicionar"
61
+ };
62
+ export const snkTabConfigMessages = {
63
+ labelRename: "Renomear",
64
+ labelHide: "Ocultar",
65
+ labelShow: "Exibir",
66
+ labelDelete: "Excluir"
67
+ };
@@ -11,7 +11,7 @@ const snkTaskbarMessages = {
11
11
  titleSave: "Salvar",
12
12
  titleGridMode: "Modo Grade",
13
13
  titleFormMode: "Modo Formulário",
14
- titleConfigGrid: "Configuração da grade",
14
+ titleConfigurator: "Configurações",
15
15
  forbidden: "Permissão não liberada"
16
16
  };
17
17
  export default snkTaskbarMessages;
@@ -0,0 +1,72 @@
1
+ export const VIEW_MODE = {
2
+ grid: {
3
+ index: 0,
4
+ name: "GRID_MODE"
5
+ },
6
+ form: {
7
+ index: 1,
8
+ name: "FORM_MODE"
9
+ }
10
+ };
11
+ export const ACTION_CONFIG = {
12
+ add: 'ADD',
13
+ remove: 'REMOVE',
14
+ configuration: 'CONFIGURATION'
15
+ };
16
+ export const VARS_BY_TYPE = {
17
+ UserInterface: {
18
+ DATE: [{ label: "Data atual", value: "${data}" }],
19
+ DATETIME: [{ label: "Data e hora atuais", value: "${datahora}" }],
20
+ INTEGERNUMBER: [
21
+ { label: "Código do usuário logado", value: "${usuario}" },
22
+ { label: "Empresa do usuário logado", value: "${usuario.empresa}" },
23
+ { label: "Vendedor para o usuário logado", value: "${usuario.vendedor}" },
24
+ { label: "Cent. Resultado usuário logado", value: "${usuario.centroresultado}" }
25
+ ]
26
+ }
27
+ };
28
+ export const DEFAULT_TYPE = {
29
+ fixed: "F",
30
+ variable: "V"
31
+ };
32
+ export const CONFIG_EVENTS = {
33
+ closeModal: "ezCloseModal",
34
+ cancelConfig: "cancelConfig",
35
+ changeConfig: "changeConfig",
36
+ configChanged: "configChanged",
37
+ fieldChanged: "ezChange",
38
+ dragStart: "sortable:start",
39
+ dragSort: "sortable:sort",
40
+ dragSorted: "sortable:sorted",
41
+ dragStop: "sortable:stop"
42
+ };
43
+ export const KEY_EVENTS = {
44
+ enter: "Enter",
45
+ arrowLeft: "ArrowLeft",
46
+ arrowRight: "ArrowRight",
47
+ tab: "Tab",
48
+ escape: "Escape"
49
+ };
50
+ export const TYPE_ACTIONS = {
51
+ rename: "RENAME",
52
+ hide: "HIDE",
53
+ show: "SHOW",
54
+ delete: "DELETE"
55
+ };
56
+ export const TAB_NAMES = {
57
+ main: "__main"
58
+ };
59
+ export const TAGS_BY_TYPE = {
60
+ LONGTEXT: "ez-text-area",
61
+ FILE: "ez-upload",
62
+ DATE: "ez-date-input",
63
+ TIME: "ez-time",
64
+ DATETIME: "ez-date-time-input",
65
+ DEFAULT: "ez-text-input",
66
+ SWITCH: "ez-check",
67
+ CHECKBOX: "ez-check",
68
+ OPTIONSELECTOR: "ez-combo-box",
69
+ SEARCH: "ez-search",
70
+ INTEGERNUMBER: "ez-number-input",
71
+ DECIMALNUMBER: "ez-number-input"
72
+ };
@@ -51,16 +51,6 @@ const snkFilterBarMessages = {
51
51
  "modalCancelButtonLabel": "Limpar"
52
52
  };
53
53
 
54
- const snkFormMessages = {
55
- title: {
56
- clone: "Duplicar registro",
57
- insert: "Cadastrar registro",
58
- update: "Alterar registro",
59
- clean: "{{ENTITY_NAME}}"
60
- },
61
- goBackTitle: "Voltar"
62
- };
63
-
64
54
  const snkTaskbarMessages = {
65
55
  titleUpdate: "Editar",
66
56
  titlePrevious: "Anterior",
@@ -74,7 +64,7 @@ const snkTaskbarMessages = {
74
64
  titleSave: "Salvar",
75
65
  titleGridMode: "Modo Grade",
76
66
  titleFormMode: "Modo Formulário",
77
- titleConfigGrid: "Configuração da grade",
67
+ titleConfigurator: "Configurações",
78
68
  forbidden: "Permissão não liberada"
79
69
  };
80
70
 
@@ -82,13 +72,99 @@ const crudUtilsMessages = {
82
72
  errorArray: "CrudUtils.find deve receber um array de fields, ou uma lista separada por virgula.",
83
73
  };
84
74
 
75
+ const snkFormMessages = {
76
+ title: {
77
+ clone: "Duplicar registro",
78
+ insert: "Cadastrar registro",
79
+ update: "Alterar registro",
80
+ clean: "{{ENTITY_NAME}}"
81
+ },
82
+ goBackTitle: "Voltar"
83
+ };
84
+ const snkConfigOptionsMessages = {
85
+ label: {
86
+ nameField: "Nome do Campo *",
87
+ typeValueDefault: "Tipo de valor padrão *",
88
+ valueDefault: "Valor Padrão",
89
+ clearDuplicate: "Limpar ao Duplicar",
90
+ requiredField: "Campo Obrigatório",
91
+ protectedField: "Campo Protegido"
92
+ },
93
+ options: {
94
+ valueFixed: "Valor Fixo",
95
+ variable: "Variável"
96
+ }
97
+ };
98
+ const snkFormConfigMessages = {
99
+ title: "Configuração do formulário",
100
+ applyConfig: "Aplicar configuração",
101
+ availableFields: {
102
+ title: "Campos disponíveis",
103
+ labelNoFields: "Nenhum campo disponível",
104
+ labelOneField: "1 campo disponível",
105
+ labelAvailableFields: "Campos disponíveis",
106
+ labelSearchField: "Procurar campo"
107
+ },
108
+ form: {
109
+ subTitleInfo: "Inclua estes campos nos grupos ou deixe-os separados no topo do formulário!",
110
+ labelDropField: "Arraste e solte um campo aqui",
111
+ labelNewGroup: "Adicionar novo grupo",
112
+ mainArea: "Área principal",
113
+ tabGeneral: "Geral"
114
+ },
115
+ confirm: {
116
+ title: "Aviso",
117
+ deleteTab: "A aba selecionada será excluída.<br/><br/> Tem certeza que deseja excluir aba",
118
+ cancel: "As alterações realizadas serão descartadas.<br/><br/><b>Gostaria de continuar?</b>",
119
+ exit: "Ao sair as alterações serão descartadas.<br/><br/><b>Você realmente gostaria de sair?</b>",
120
+ apply: "A <b>{0}</b> irá substituir a sua configuração {1}!<br/><br/><b>Deseja continuar?</b>",
121
+ group: "Não é possível salvar as configurações com um grupo vazio!",
122
+ labelYes: "Sim",
123
+ labelNo: "Não"
124
+ },
125
+ alert: {
126
+ titleGroupExists: "Já existe um grupo com título",
127
+ infoValidTitle: "Por favor, digite um título válido.",
128
+ inTab: "na aba"
129
+ }
130
+ };
131
+ const snkFieldConfigMessages = {
132
+ titleRemove: "Remover",
133
+ titleConfigurations: "Configurações",
134
+ titleAdd: "Adicionar"
135
+ };
136
+ const snkTabConfigMessages = {
137
+ labelRename: "Renomear",
138
+ labelHide: "Ocultar",
139
+ labelShow: "Exibir",
140
+ labelDelete: "Excluir"
141
+ };
142
+
143
+ const snkConfiguratorMessages = {
144
+ msgSaveSuccessfully: "As configurações foram salvas com sucesso!"
145
+ };
146
+ const snkConfigModalMessages = {
147
+ titleConfigurations: "Configurações",
148
+ subTitleModeConfig: "Modo de visualização",
149
+ labelConfigGrid: "Configurar grade",
150
+ labelConfigForm: "Configurar formulário",
151
+ labelGrid: "Grade",
152
+ labelForm: "Formulário"
153
+ };
154
+
85
155
  class SnkMessageBuilder {
86
156
  constructor() {
87
157
  this._defaults = {
88
158
  snkDataUnit: snkDataUnitMessages,
89
159
  snkForm: snkFormMessages,
160
+ snkFormConfig: snkFormConfigMessages,
161
+ snkConfigOptions: snkConfigOptionsMessages,
90
162
  snkTaskbar: snkTaskbarMessages,
163
+ snkConfigModal: snkConfigModalMessages,
164
+ snkFieldConfig: snkFieldConfigMessages,
91
165
  snkFilterBar: snkFilterBarMessages,
166
+ snkConfigurator: snkConfiguratorMessages,
167
+ snkTabConfig: snkTabConfigMessages,
92
168
  crudUtils: crudUtilsMessages
93
169
  };
94
170
  this._currentOperation = OperationMap.CLEAN;
@@ -0,0 +1,17 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ function createCommonjsModule(fn, basedir, module) {
4
+ return module = {
5
+ path: basedir,
6
+ exports: {},
7
+ require: function (path, base) {
8
+ return commonjsRequire();
9
+ }
10
+ }, fn(module, module.exports), module.exports;
11
+ }
12
+
13
+ function commonjsRequire () {
14
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
15
+ }
16
+
17
+ export { commonjsGlobal as a, createCommonjsModule as c };
@@ -0,0 +1,74 @@
1
+ const VIEW_MODE = {
2
+ grid: {
3
+ index: 0,
4
+ name: "GRID_MODE"
5
+ },
6
+ form: {
7
+ index: 1,
8
+ name: "FORM_MODE"
9
+ }
10
+ };
11
+ const ACTION_CONFIG = {
12
+ add: 'ADD',
13
+ remove: 'REMOVE',
14
+ configuration: 'CONFIGURATION'
15
+ };
16
+ const VARS_BY_TYPE = {
17
+ UserInterface: {
18
+ DATE: [{ label: "Data atual", value: "${data}" }],
19
+ DATETIME: [{ label: "Data e hora atuais", value: "${datahora}" }],
20
+ INTEGERNUMBER: [
21
+ { label: "Código do usuário logado", value: "${usuario}" },
22
+ { label: "Empresa do usuário logado", value: "${usuario.empresa}" },
23
+ { label: "Vendedor para o usuário logado", value: "${usuario.vendedor}" },
24
+ { label: "Cent. Resultado usuário logado", value: "${usuario.centroresultado}" }
25
+ ]
26
+ }
27
+ };
28
+ const DEFAULT_TYPE = {
29
+ fixed: "F",
30
+ variable: "V"
31
+ };
32
+ const CONFIG_EVENTS = {
33
+ closeModal: "ezCloseModal",
34
+ cancelConfig: "cancelConfig",
35
+ changeConfig: "changeConfig",
36
+ configChanged: "configChanged",
37
+ fieldChanged: "ezChange",
38
+ dragStart: "sortable:start",
39
+ dragSort: "sortable:sort",
40
+ dragSorted: "sortable:sorted",
41
+ dragStop: "sortable:stop"
42
+ };
43
+ const KEY_EVENTS = {
44
+ enter: "Enter",
45
+ arrowLeft: "ArrowLeft",
46
+ arrowRight: "ArrowRight",
47
+ tab: "Tab",
48
+ escape: "Escape"
49
+ };
50
+ const TYPE_ACTIONS = {
51
+ rename: "RENAME",
52
+ hide: "HIDE",
53
+ show: "SHOW",
54
+ delete: "DELETE"
55
+ };
56
+ const TAB_NAMES = {
57
+ main: "__main"
58
+ };
59
+ const TAGS_BY_TYPE = {
60
+ LONGTEXT: "ez-text-area",
61
+ FILE: "ez-upload",
62
+ DATE: "ez-date-input",
63
+ TIME: "ez-time",
64
+ DATETIME: "ez-date-time-input",
65
+ DEFAULT: "ez-text-input",
66
+ SWITCH: "ez-check",
67
+ CHECKBOX: "ez-check",
68
+ OPTIONSELECTOR: "ez-combo-box",
69
+ SEARCH: "ez-search",
70
+ INTEGERNUMBER: "ez-number-input",
71
+ DECIMALNUMBER: "ez-number-input"
72
+ };
73
+
74
+ export { ACTION_CONFIG as A, CONFIG_EVENTS as C, DEFAULT_TYPE as D, KEY_EVENTS as K, TAGS_BY_TYPE as T, VIEW_MODE as V, VARS_BY_TYPE as a, TAB_NAMES as b, TYPE_ACTIONS as c };