@sankhyalabs/sankhyablocks 1.4.0-beta.6 → 1.4.0-beta.8

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-aebcc2f5.js +69 -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-188190ee.js} +2 -0
  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 +240 -6972
  11. package/dist/cjs/snk-config-modal.cjs.entry.js +62 -0
  12. package/dist/cjs/snk-config-options.cjs.entry.js +163 -0
  13. package/dist/cjs/{snk-filter-bar_5.cjs.entry.js → snk-configurator_6.cjs.entry.js} +193 -6
  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 +1 -1
  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-4c2c6704.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/errorhandler/snk-error-handler.js +1 -1
  34. package/dist/collection/components/snk-application/snk-application.js +144 -23
  35. package/dist/collection/components/snk-configurator/snk-configurator.js +261 -0
  36. package/dist/collection/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.js +16 -0
  37. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.css +122 -0
  38. package/dist/collection/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.js +137 -0
  39. package/dist/collection/components/snk-crud/snk-crud.js +15 -13
  40. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +33 -3
  41. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +3 -3
  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 +248 -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/dataunit-fetcher.js +35 -0
  57. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
  58. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
  59. package/dist/collection/lib/message/SnkMessageBuilder.js +8 -1
  60. package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
  61. package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
  62. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
  63. package/dist/collection/lib/utils/constants.js +58 -0
  64. package/dist/components/SnkMessageBuilder.js +87 -11
  65. package/dist/components/_commonjsHelpers.js +17 -0
  66. package/dist/components/constants.js +60 -0
  67. package/dist/components/form-config-fetcher.js +6889 -0
  68. package/dist/components/index.d.ts +6 -0
  69. package/dist/components/index.js +6 -0
  70. package/dist/components/snk-application2.js +225 -6954
  71. package/dist/components/snk-config-modal.d.ts +11 -0
  72. package/dist/components/snk-config-modal.js +6 -0
  73. package/dist/components/snk-config-modal2.js +91 -0
  74. package/dist/components/snk-config-options.d.ts +11 -0
  75. package/dist/components/snk-config-options.js +6 -0
  76. package/dist/components/snk-config-options2.js +178 -0
  77. package/dist/components/snk-configurator.d.ts +11 -0
  78. package/dist/components/snk-configurator.js +6 -0
  79. package/dist/components/snk-configurator2.js +212 -0
  80. package/dist/components/snk-crud.js +62 -25
  81. package/dist/components/snk-field-config.d.ts +11 -0
  82. package/dist/components/snk-field-config.js +6 -0
  83. package/dist/components/snk-field-config2.js +70 -0
  84. package/dist/components/snk-filter-bar2.js +1 -1
  85. package/dist/components/snk-filter-personalized.js +2 -0
  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-c4e3341e.js +60 -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-bafb2cef.js} +2 -1
  102. package/dist/esm/loader.js +2 -2
  103. package/dist/esm/sankhyablocks.js +2 -2
  104. package/dist/esm/snk-application.entry.js +224 -6956
  105. package/dist/esm/snk-config-modal.entry.js +58 -0
  106. package/dist/esm/snk-config-options.entry.js +159 -0
  107. package/dist/esm/{snk-filter-bar_5.entry.js → snk-configurator_6.entry.js} +194 -8
  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 +1 -1
  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-2035b1c7.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-03f9c407.js +1 -0
  127. package/dist/sankhyablocks/{p-ba426ea9.entry.js → p-04ad681a.entry.js} +1 -1
  128. package/dist/sankhyablocks/p-112455b1.js +1 -0
  129. package/dist/sankhyablocks/p-1963b46f.entry.js +1 -0
  130. package/dist/sankhyablocks/p-21c8929b.js +1 -0
  131. package/dist/sankhyablocks/p-26c503a6.entry.js +1 -0
  132. package/dist/sankhyablocks/{p-2e49afef.entry.js → p-31631fb6.entry.js} +1 -1
  133. package/dist/sankhyablocks/p-361299e8.js +26 -0
  134. package/dist/sankhyablocks/p-434e0dcf.entry.js +1 -0
  135. package/dist/sankhyablocks/{p-aecf3e0a.entry.js → p-6c61416a.entry.js} +1 -1
  136. package/dist/sankhyablocks/{p-49580cdd.entry.js → p-857c4735.entry.js} +1 -1
  137. package/dist/sankhyablocks/{p-4574a955.entry.js → p-8cd8977c.entry.js} +1 -1
  138. package/dist/sankhyablocks/{p-6386d720.entry.js → p-916068ff.entry.js} +1 -1
  139. package/dist/sankhyablocks/p-9f2c5fac.entry.js +1 -0
  140. package/dist/sankhyablocks/p-ad658f44.js +1 -0
  141. package/dist/sankhyablocks/p-ae302037.entry.js +75 -0
  142. package/dist/sankhyablocks/p-af11b0e7.js +1 -0
  143. package/dist/sankhyablocks/p-af306302.entry.js +1 -0
  144. package/dist/sankhyablocks/p-b6d6b172.js +1 -0
  145. package/dist/sankhyablocks/{p-40b27004.entry.js → p-cc85ba53.entry.js} +1 -1
  146. package/dist/sankhyablocks/{p-0352c0e2.entry.js → p-ccdf59eb.entry.js} +1 -1
  147. package/dist/sankhyablocks/p-ce789145.entry.js +1 -0
  148. package/dist/sankhyablocks/p-cf81e313.entry.js +1 -0
  149. package/dist/sankhyablocks/{p-0ea25487.entry.js → p-d1ae76ec.entry.js} +1 -1
  150. package/dist/sankhyablocks/p-d50651a3.js +1 -0
  151. package/dist/sankhyablocks/{p-fac2b6a9.js → p-ddb03141.js} +2 -2
  152. package/dist/sankhyablocks/p-ee906940.entry.js +1 -0
  153. package/dist/sankhyablocks/{p-5bdb8452.entry.js → p-f9084ecb.entry.js} +1 -1
  154. package/dist/sankhyablocks/p-fa75fba5.entry.js +1 -0
  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 +41 -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/dataunit-fetcher.d.ts +1 -0
  176. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
  177. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  178. package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
  179. package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
  180. package/dist/types/lib/utils/constants.d.ts +62 -0
  181. package/dist/types/lib/utils/pesquisa.d.ts +2 -1
  182. package/package.json +4 -3
  183. package/react/components.d.ts +6 -0
  184. package/react/components.js +6 -0
  185. package/react/components.js.map +1 -1
  186. package/dist/cjs/snk-form_2.cjs.entry.js +0 -247
  187. package/dist/esm/snk-form_2.entry.js +0 -242
  188. package/dist/sankhyablocks/p-1a58f45c.entry.js +0 -74
  189. package/dist/sankhyablocks/p-21e940aa.entry.js +0 -1
  190. package/dist/sankhyablocks/p-2eea7eea.js +0 -1
  191. package/dist/sankhyablocks/p-77216252.entry.js +0 -1
  192. package/dist/sankhyablocks/p-86f15ffe.js +0 -1
  193. package/dist/sankhyablocks/p-97009a2c.entry.js +0 -1
  194. package/dist/sankhyablocks/p-a14c49db.entry.js +0 -1
@@ -30,7 +30,7 @@ export class SnkErrorHandler {
30
30
  return '<br><a href="#" onclick="' + onclick + '">Código: ' + exception.errorCode + '</a>';
31
31
  }
32
32
  processException(exception) {
33
- if (exception.errorCode != "") {
33
+ if (exception.errorCode) {
34
34
  exception.message += this.buildErrorCodeHTML(exception);
35
35
  }
36
36
  if (exception instanceof WaitingChangeException) {
@@ -1,22 +1,20 @@
1
1
  import { h } from "@stencil/core";
2
- import { DataType, ErrorTracking } from "@sankhyalabs/core";
3
- import { DependencyType } from "@sankhyalabs/core";
4
- import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
2
+ import { DataType, ErrorTracking, DependencyType, ApplicationContext } from "@sankhyalabs/core";
5
3
  import { DataFetcher } from "../../lib/http/data-fetcher/DataFetcher";
6
- import UrlUtils from "../../lib/utils/urlutils";
7
- import Workspace from "../../lib/workspace/workspace";
8
- import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
9
4
  import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
5
+ import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
10
6
  import { FormConfigFetcher } from "../../lib/http/data-fetcher/fetchers/form-config-fetcher";
11
- import { ApplicationContext } from "@sankhyalabs/core";
12
- import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
13
7
  import { PesquisaFetcher } from "../../lib/http/data-fetcher/fetchers/pesquisa-fetcher";
14
- import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
15
- import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
16
- import { SnkErrorHandler } from "./errorhandler/snk-error-handler";
17
8
  import { agGridLicense } from '../../lib/licenses/sankhyalicense.module';
18
9
  import { TotalsFetcher } from "../../lib/http/data-fetcher/fetchers/totals-fetcher";
19
10
  import { SnkMessageBuilder } from "../../lib/message/SnkMessageBuilder";
11
+ import DataUnitFetcher from "../../lib/http/data-fetcher/fetchers/dataunit-fetcher";
12
+ import UrlUtils from "../../lib/utils/urlutils";
13
+ import Workspace from "../../lib/workspace/workspace";
14
+ import ParametersFetcher from "../../lib/http/data-fetcher/fetchers/parameters-fecher";
15
+ import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
16
+ import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
17
+ import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
20
18
  import FilterBarConfigFetcher from "../../lib/http/data-fetcher/fetchers/filter-bar-config-fetcher";
21
19
  /**
22
20
  * É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
@@ -356,6 +354,24 @@ export class SnkApplication {
356
354
  async loadGridConfig(name) {
357
355
  return this.gridConfigFetcher.getConfig(name, this.resourceID);
358
356
  }
357
+ /**
358
+ * Busca lista de configurações de formulário do usuário.
359
+ */
360
+ async fetchUserAvailableConfigs(name) {
361
+ return this.formConfigFetcher.fetchUserAvailableConfigs(name, this.resourceID);
362
+ }
363
+ /**
364
+ * Busca a configuração de formulário do usuário.
365
+ */
366
+ async fetchLegacyConfig(name) {
367
+ return this.formConfigFetcher.fetchLegacyConfig(name, this.resourceID);
368
+ }
369
+ /**
370
+ * Busca a configuração padrão de formulário.
371
+ */
372
+ async fetchDefaultConfig(name) {
373
+ return this.formConfigFetcher.fetchDefaultConfig(name, this.resourceID);
374
+ }
359
375
  /**
360
376
  * Busca os totalizadores da grade.
361
377
  */
@@ -394,6 +410,12 @@ export class SnkApplication {
394
410
  async saveFilterBarConfig(config, name) {
395
411
  return this.filterBarConfigFetcher.saveConfig(config, this.resourceID, name);
396
412
  }
413
+ /**
414
+ * Salva a configuração de formulário.
415
+ */
416
+ async saveFormConfig(config, name) {
417
+ return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
418
+ }
397
419
  async getAuthList(_auth) {
398
420
  return await (new MGEAuthorization()).parseFromJSON(_auth);
399
421
  }
@@ -1248,7 +1270,7 @@ export class SnkApplication {
1248
1270
  },
1249
1271
  "loadFormConfig": {
1250
1272
  "complexType": {
1251
- "signature": "(name: string) => Promise<Array<FieldConfig>>",
1273
+ "signature": "(name: string) => Promise<IFormConfig>",
1252
1274
  "parameters": [{
1253
1275
  "tags": [],
1254
1276
  "text": ""
@@ -1257,15 +1279,12 @@ export class SnkApplication {
1257
1279
  "Promise": {
1258
1280
  "location": "global"
1259
1281
  },
1260
- "FieldConfig": {
1282
+ "IFormConfig": {
1261
1283
  "location": "import",
1262
1284
  "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
1263
- },
1264
- "Array": {
1265
- "location": "global"
1266
1285
  }
1267
1286
  },
1268
- "return": "Promise<FieldConfig[]>"
1287
+ "return": "Promise<IFormConfig>"
1269
1288
  },
1270
1289
  "docs": {
1271
1290
  "text": "Busca a configura\u00E7\u00E3o de formul\u00E1rio.",
@@ -1295,6 +1314,78 @@ export class SnkApplication {
1295
1314
  "tags": []
1296
1315
  }
1297
1316
  },
1317
+ "fetchUserAvailableConfigs": {
1318
+ "complexType": {
1319
+ "signature": "(name: string) => Promise<Array<IUserConfig>>",
1320
+ "parameters": [{
1321
+ "tags": [],
1322
+ "text": ""
1323
+ }],
1324
+ "references": {
1325
+ "Promise": {
1326
+ "location": "global"
1327
+ },
1328
+ "IUserConfig": {
1329
+ "location": "import",
1330
+ "path": "../../lib/http/data-fetcher/fetchers/form-config-fetcher"
1331
+ },
1332
+ "Array": {
1333
+ "location": "global"
1334
+ }
1335
+ },
1336
+ "return": "Promise<IUserConfig[]>"
1337
+ },
1338
+ "docs": {
1339
+ "text": "Busca lista de configura\u00E7\u00F5es de formul\u00E1rio do usu\u00E1rio.",
1340
+ "tags": []
1341
+ }
1342
+ },
1343
+ "fetchLegacyConfig": {
1344
+ "complexType": {
1345
+ "signature": "(name: string) => Promise<IFormConfig>",
1346
+ "parameters": [{
1347
+ "tags": [],
1348
+ "text": ""
1349
+ }],
1350
+ "references": {
1351
+ "Promise": {
1352
+ "location": "global"
1353
+ },
1354
+ "IFormConfig": {
1355
+ "location": "import",
1356
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
1357
+ }
1358
+ },
1359
+ "return": "Promise<IFormConfig>"
1360
+ },
1361
+ "docs": {
1362
+ "text": "Busca a configura\u00E7\u00E3o de formul\u00E1rio do usu\u00E1rio.",
1363
+ "tags": []
1364
+ }
1365
+ },
1366
+ "fetchDefaultConfig": {
1367
+ "complexType": {
1368
+ "signature": "(name: string) => Promise<IFormConfig>",
1369
+ "parameters": [{
1370
+ "tags": [],
1371
+ "text": ""
1372
+ }],
1373
+ "references": {
1374
+ "Promise": {
1375
+ "location": "global"
1376
+ },
1377
+ "IFormConfig": {
1378
+ "location": "import",
1379
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
1380
+ }
1381
+ },
1382
+ "return": "Promise<IFormConfig>"
1383
+ },
1384
+ "docs": {
1385
+ "text": "Busca a configura\u00E7\u00E3o padr\u00E3o de formul\u00E1rio.",
1386
+ "tags": []
1387
+ }
1388
+ },
1298
1389
  "loadTotals": {
1299
1390
  "complexType": {
1300
1391
  "signature": "(name: string, resourceID: string, filters: Array<Filter>) => Promise<Map<string, number>>",
@@ -1408,9 +1499,35 @@ export class SnkApplication {
1408
1499
  "tags": []
1409
1500
  }
1410
1501
  },
1502
+ "saveFormConfig": {
1503
+ "complexType": {
1504
+ "signature": "(config: IFormConfig, name: string) => Promise<boolean>",
1505
+ "parameters": [{
1506
+ "tags": [],
1507
+ "text": ""
1508
+ }, {
1509
+ "tags": [],
1510
+ "text": ""
1511
+ }],
1512
+ "references": {
1513
+ "Promise": {
1514
+ "location": "global"
1515
+ },
1516
+ "IFormConfig": {
1517
+ "location": "import",
1518
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
1519
+ }
1520
+ },
1521
+ "return": "Promise<boolean>"
1522
+ },
1523
+ "docs": {
1524
+ "text": "Salva a configura\u00E7\u00E3o de formul\u00E1rio.",
1525
+ "tags": []
1526
+ }
1527
+ },
1411
1528
  "executeSearch": {
1412
1529
  "complexType": {
1413
- "signature": "(searchArgument: any, fieldName: string, dataUnit: DataUnit) => Promise<Array<Option> | Option>",
1530
+ "signature": "(searchArgument: ISearchArgument, fieldName: string, dataUnit: DataUnit) => Promise<Array<IOption> | IOption>",
1414
1531
  "parameters": [{
1415
1532
  "tags": [],
1416
1533
  "text": ""
@@ -1425,7 +1542,11 @@ export class SnkApplication {
1425
1542
  "Promise": {
1426
1543
  "location": "global"
1427
1544
  },
1428
- "Option": {
1545
+ "IOption": {
1546
+ "location": "import",
1547
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
1548
+ },
1549
+ "ISearchArgument": {
1429
1550
  "location": "import",
1430
1551
  "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
1431
1552
  },
@@ -1441,7 +1562,7 @@ export class SnkApplication {
1441
1562
  "path": "../../lib/http/data-fetcher/fetchers/pesquisa-fetcher"
1442
1563
  }
1443
1564
  },
1444
- "return": "Promise<Option | Option[]>"
1565
+ "return": "Promise<IOption | IOption[]>"
1445
1566
  },
1446
1567
  "docs": {
1447
1568
  "text": "",
@@ -1450,7 +1571,7 @@ export class SnkApplication {
1450
1571
  },
1451
1572
  "executePreparedSearch": {
1452
1573
  "complexType": {
1453
- "signature": "(mode: string, argument: string, options: any) => Promise<Array<Option> | Option>",
1574
+ "signature": "(mode: string, argument: string, options: any) => Promise<Array<IOption> | IOption>",
1454
1575
  "parameters": [{
1455
1576
  "tags": [],
1456
1577
  "text": ""
@@ -1465,7 +1586,7 @@ export class SnkApplication {
1465
1586
  "Promise": {
1466
1587
  "location": "global"
1467
1588
  },
1468
- "Option": {
1589
+ "IOption": {
1469
1590
  "location": "import",
1470
1591
  "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
1471
1592
  },
@@ -1476,7 +1597,7 @@ export class SnkApplication {
1476
1597
  "location": "global"
1477
1598
  }
1478
1599
  },
1479
- "return": "Promise<Option | Option[]>"
1600
+ "return": "Promise<IOption | IOption[]>"
1480
1601
  },
1481
1602
  "docs": {
1482
1603
  "text": "",
@@ -0,0 +1,261 @@
1
+ import { ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
2
+ import { h } from '@stencil/core';
3
+ import { ApplicationUtils } from "@sankhyalabs/ezui/dist/collection/utils";
4
+ import { CONFIG_EVENTS, VIEW_MODE } from '../../lib/utils/constants';
5
+ import ConfigurableElementsStorage from './subcomponents/configModalProvider/configurableElementsStorage';
6
+ const GRID_MODE = VIEW_MODE.grid;
7
+ const FORM_MODE = VIEW_MODE.form;
8
+ export class SnkConfigurator {
9
+ constructor() {
10
+ /**
11
+ * Nome do componente que será vinculado ao `data-configurator-parent` para controlar o modal de configurações.
12
+ */
13
+ this.name = "snkConfigurator";
14
+ /**
15
+ * Define se o campo está habilitado.
16
+ */
17
+ this.enabled = true;
18
+ }
19
+ /**
20
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
21
+ * através de um pequeno modulo na estrutura da aplicação:
22
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
23
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
24
+ */
25
+ getMessage(key) {
26
+ return this._application.messagesBuilder.getMessage(key, {});
27
+ }
28
+ controlConfigModal(opened) {
29
+ var _a;
30
+ if (this._modal != undefined) {
31
+ this._modal.opened = opened;
32
+ if (this._configModal != undefined) {
33
+ this._configModal.gridMode = ((_a = this._grid) === null || _a === void 0 ? void 0 : _a.offsetParent) != undefined;
34
+ }
35
+ }
36
+ }
37
+ changeConfigModal(evt) {
38
+ const data = evt === null || evt === void 0 ? void 0 : evt.detail;
39
+ if (data === null || data === void 0 ? void 0 : data.openConfig) {
40
+ this.controlConfigModal(false);
41
+ this.callShowConfig(data === null || data === void 0 ? void 0 : data.viewMode);
42
+ }
43
+ else if ((data === null || data === void 0 ? void 0 : data.viewMode) === GRID_MODE.index) {
44
+ this.changeViewMode.emit(GRID_MODE.name);
45
+ }
46
+ else if ((data === null || data === void 0 ? void 0 : data.viewMode) === FORM_MODE.index) {
47
+ this.changeViewMode.emit(FORM_MODE.name);
48
+ }
49
+ }
50
+ callShowConfig(viewMode) {
51
+ if (viewMode === GRID_MODE.index) {
52
+ if (this._grid == undefined) {
53
+ this.findGrid();
54
+ }
55
+ if (this._grid != undefined) {
56
+ this._grid.setShowGridConfig(true);
57
+ }
58
+ }
59
+ else if (viewMode === FORM_MODE.index) {
60
+ if (this._form == undefined) {
61
+ this.findForm();
62
+ }
63
+ if (this._form != undefined) {
64
+ this._form.setShowFormConfig(true);
65
+ }
66
+ }
67
+ }
68
+ getConfigModal() {
69
+ const modalContainer = document.createElement("ez-modal");
70
+ modalContainer.modalSize = "small";
71
+ modalContainer.opened = false;
72
+ modalContainer.closeEsc = false;
73
+ modalContainer.closeOutsideClick = false;
74
+ modalContainer.dataset.configuratorModal = this.name;
75
+ modalContainer.addEventListener(CONFIG_EVENTS.closeModal, () => {
76
+ this.controlConfigModal(false);
77
+ });
78
+ const modalContent = document.createElement("snk-config-modal");
79
+ modalContent.addEventListener(CONFIG_EVENTS.cancelConfig, () => {
80
+ this.controlConfigModal(false);
81
+ });
82
+ modalContent.addEventListener(CONFIG_EVENTS.changeConfig, (evt) => {
83
+ this.changeConfigModal(evt);
84
+ });
85
+ modalContent.configName = this.configName;
86
+ modalContainer.append(modalContent);
87
+ return modalContainer;
88
+ }
89
+ findConfigModal() {
90
+ let modalContainer = document.body.querySelector(`[data-configurator-modal="${this.name}"]`);
91
+ if (modalContainer == undefined) {
92
+ modalContainer = this.getConfigModal();
93
+ document.body.appendChild(modalContainer);
94
+ }
95
+ this._modal = modalContainer;
96
+ this._configModal = modalContainer.querySelector("snk-config-modal");
97
+ }
98
+ findGrid() {
99
+ if (this._grid != undefined) {
100
+ return;
101
+ }
102
+ this._grid = ConfigurableElementsStorage.getGrid(this.configName);
103
+ if (this._grid != undefined && this._grid.dataset.eventConfigChanged == undefined) {
104
+ this._grid.dataset.eventConfigChanged = "true";
105
+ this._grid.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
106
+ this.saveConfig(evt);
107
+ });
108
+ }
109
+ }
110
+ findForm() {
111
+ if (this._form != undefined) {
112
+ return;
113
+ }
114
+ this._form = ConfigurableElementsStorage.getForm(this.configName);
115
+ if (this._form != undefined && this._form.dataset.eventConfigChanged == undefined) {
116
+ this._form.dataset.eventConfigChanged = "true";
117
+ this._form.addEventListener(CONFIG_EVENTS.configChanged, (evt) => {
118
+ this.saveConfig(evt);
119
+ });
120
+ }
121
+ }
122
+ saveConfig(evt) {
123
+ const config = evt === null || evt === void 0 ? void 0 : evt.detail;
124
+ if (this._application != undefined && config != undefined) {
125
+ if ((config === null || config === void 0 ? void 0 : config.fields) != undefined) {
126
+ this._application.saveFormConfig(config, this.configName)
127
+ .then((response) => {
128
+ if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
129
+ this.loadFormConfig(true);
130
+ }
131
+ });
132
+ }
133
+ else if ((config === null || config === void 0 ? void 0 : config.columns) != undefined) {
134
+ this._application.saveGridConfig(config)
135
+ .then((response) => {
136
+ if ((response === null || response === void 0 ? void 0 : response.resource) != undefined) {
137
+ this.setGridConfig(response.resource);
138
+ }
139
+ });
140
+ }
141
+ }
142
+ }
143
+ setGridConfig(strConfig) {
144
+ if (this._grid != undefined) {
145
+ const config = ObjectUtils.stringToObject(strConfig);
146
+ this._grid.setConfig(config).then(() => {
147
+ ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
148
+ });
149
+ }
150
+ }
151
+ loadGridConfig() {
152
+ if (this._application != undefined && this.configName != undefined && this._grid != undefined) {
153
+ this._application.loadGridConfig(this.configName).then((config) => {
154
+ this._grid.setConfig(config);
155
+ });
156
+ }
157
+ }
158
+ loadFormConfig(showInfoSuccess = false) {
159
+ if (this._application != undefined && this.configName != undefined && this._form != undefined) {
160
+ this._application.loadFormConfig(this.configName).then((config) => {
161
+ this._form.setConfig(config).then(() => {
162
+ if (showInfoSuccess) {
163
+ ApplicationUtils.info(this.getMessage("snkConfigurator.msgSaveSuccessfully"), { iconName: "check" });
164
+ }
165
+ });
166
+ });
167
+ }
168
+ }
169
+ loadConfig() {
170
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
171
+ this.loadGridConfig();
172
+ this.loadFormConfig();
173
+ }
174
+ componentDidLoad() {
175
+ this.findConfigModal();
176
+ this.findGrid();
177
+ this.findForm();
178
+ this.loadConfig();
179
+ }
180
+ render() {
181
+ return (h("ez-button", { mode: "icon", iconName: "settings-inverted", size: "small", enabled: this.enabled, onClick: () => this.controlConfigModal(true) }));
182
+ }
183
+ static get is() { return "snk-configurator"; }
184
+ static get encapsulation() { return "scoped"; }
185
+ static get properties() {
186
+ return {
187
+ "configName": {
188
+ "type": "string",
189
+ "mutable": false,
190
+ "complexType": {
191
+ "original": "string",
192
+ "resolved": "string",
193
+ "references": {}
194
+ },
195
+ "required": false,
196
+ "optional": false,
197
+ "docs": {
198
+ "tags": [],
199
+ "text": "Nome usado para guardar/recuperar as configura\u00E7\u00F5es do formul\u00E1rio"
200
+ },
201
+ "attribute": "config-name",
202
+ "reflect": false
203
+ },
204
+ "name": {
205
+ "type": "string",
206
+ "mutable": false,
207
+ "complexType": {
208
+ "original": "string",
209
+ "resolved": "string",
210
+ "references": {}
211
+ },
212
+ "required": false,
213
+ "optional": false,
214
+ "docs": {
215
+ "tags": [],
216
+ "text": "Nome do componente que ser\u00E1 vinculado ao `data-configurator-parent` para controlar o modal de configura\u00E7\u00F5es."
217
+ },
218
+ "attribute": "name",
219
+ "reflect": false,
220
+ "defaultValue": "\"snkConfigurator\""
221
+ },
222
+ "enabled": {
223
+ "type": "boolean",
224
+ "mutable": false,
225
+ "complexType": {
226
+ "original": "boolean",
227
+ "resolved": "boolean",
228
+ "references": {}
229
+ },
230
+ "required": false,
231
+ "optional": false,
232
+ "docs": {
233
+ "tags": [],
234
+ "text": "Define se o campo est\u00E1 habilitado."
235
+ },
236
+ "attribute": "enabled",
237
+ "reflect": false,
238
+ "defaultValue": "true"
239
+ }
240
+ };
241
+ }
242
+ static get events() {
243
+ return [{
244
+ "method": "changeViewMode",
245
+ "name": "changeViewMode",
246
+ "bubbles": true,
247
+ "cancelable": true,
248
+ "composed": true,
249
+ "docs": {
250
+ "tags": [],
251
+ "text": "Evento disparado quando h\u00E1 altera\u00E7\u00E3o no modo de visualiza\u00E7\u00E3o."
252
+ },
253
+ "complexType": {
254
+ "original": "string",
255
+ "resolved": "string",
256
+ "references": {}
257
+ }
258
+ }];
259
+ }
260
+ static get elementRef() { return "_element"; }
261
+ }
@@ -0,0 +1,16 @@
1
+ export default class ConfigurableElementsStorage {
2
+ static setGrid(id, grid) {
3
+ this._gridById.set(id, grid);
4
+ }
5
+ static setForm(id, form) {
6
+ this._formById.set(id, form);
7
+ }
8
+ static getGrid(id) {
9
+ return this._gridById.get(id);
10
+ }
11
+ static getForm(id) {
12
+ return this._formById.get(id);
13
+ }
14
+ }
15
+ ConfigurableElementsStorage._gridById = new Map();
16
+ ConfigurableElementsStorage._formById = new Map();
@@ -0,0 +1,122 @@
1
+ :host {
2
+ /*@doc Define o espaçamento utilizado à esquerda do botão de fechar do componente.*/
3
+ --snk-config-modal__button-close--padding-left: var(--space--medium, 12px);
4
+
5
+ /*@doc Define a cor do texto utilizado para o titulo do componente.*/
6
+ --snk-config-modal__title--color: var(--title--primary, #2B3A54);
7
+
8
+ /*@doc Define o estilo da fonte utilizada para o titulo do componente.*/
9
+ --snk-config-modal__title--font-family: var(--font-pattern, "Sora");
10
+
11
+ /*@doc Define o tamanho da fonte utilizada para o titulo do componente.*/
12
+ --snk-config-modal__title--font-size: var(--title--large, 20px);
13
+
14
+ /*@doc Define o peso da fonte utilizada para o titulo do componente.*/
15
+ --snk-config-modal__title--font-weight: var(--text-weight--extra-large, 700);
16
+
17
+ /*@doc Define a cor do texto utilizado para o subtitulo do componente.*/
18
+ --snk-config-modal__subtitle--color: var(--title--primary, #2B3A54);
19
+
20
+ /*@doc Define o estilo da fonte utilizada para o subtitulo do componente.*/
21
+ --snk-config-modal__subtitle--font-family: var(--font-pattern, "Sora");
22
+
23
+ /*@doc Define o tamanho da fonte utilizada para o subtitulo do componente.*/
24
+ --snk-config-modal__subtitle--font-size: var(--text--medium, 14px);
25
+
26
+ /*@doc Define o peso da fonte utilizada para o subtitulo do componente.*/
27
+ --snk-config-modal__subtitle--font-weight: var(--text-weight--large, 600);
28
+
29
+ /*@doc Define o raio da borda da barra de rolagem do componente.*/
30
+ --snk-config-modal__scrollbar--border-radius: var(--border--radius-small, 6px);
31
+
32
+ /*@doc Define a largura da barra de rolagem do componente.*/
33
+ --snk-config-modal__scrollbar--width: var(--space--medium, 12px);
34
+
35
+ /*@doc Define a cor da barra de rolagem do componente.*/
36
+ --snk-config-modal__scrollbar--background-color-primary: var(--scrollbar--primary, #2B3A54);
37
+
38
+ /*@doc Define a cor de fundo da barra de rolagem do componente.*/
39
+ --snk-config-modal__scrollbar--background-color-secondary: var(--scrollbar--secondary, #E5EAF0);
40
+
41
+ display: grid;
42
+ grid-template-rows: auto 1fr auto;
43
+ max-height: 100%;
44
+ width: 100%;
45
+ }
46
+
47
+ @media screen and (min-width: 480px) {
48
+ :host {
49
+ width: 359px;
50
+ max-width: 359px;
51
+ }
52
+ }
53
+
54
+ .snk-config-modal__button-config {
55
+ --ez-button--min-width: 100%;
56
+ }
57
+
58
+ .snk-config-modal__header {
59
+ display: flex;
60
+ justify-content: space-between;
61
+ align-items: center;
62
+ width: 100%;
63
+ }
64
+
65
+ .snk-config-modal__title {
66
+ display: flex;
67
+ margin: 0;
68
+ line-height: normal;
69
+ letter-spacing: 0em;
70
+ text-align: left;
71
+
72
+ /*public*/
73
+ color: var(--snk-config-modal__title--color);
74
+ font-size: var(--snk-config-modal__title--font-size);
75
+ font-family: var(--snk-config-modal__title--font-family);
76
+ font-weight: var(--snk-config-modal__title--font-weight);
77
+ }
78
+
79
+ .snk-config-modal__subtitle {
80
+ display: flex;
81
+ margin: 0;
82
+
83
+ /*public*/
84
+ padding-top: var(--space--medium);
85
+ padding-bottom: var(--space--small);
86
+ color: var(--snk-config-modal__subtitle--color);
87
+ font-size: var(--snk-config-modal__subtitle--font-size);
88
+ font-family: var(--snk-config-modal__subtitle--font-family);
89
+ font-weight: var(--snk-config-modal__subtitle--font-weight);
90
+ }
91
+
92
+ .snk-config-modal__button-close {
93
+ /*public*/
94
+ padding-left: var(--snk-config-modal__button-close--padding-left);
95
+ }
96
+
97
+ .snk-config-modal__main {
98
+ overflow-y: auto;
99
+ scrollbar-width: thin;
100
+
101
+ /*public*/
102
+ scrollbar-color: var(--snk-config-modal__scrollbar--background-color-primary) var(--snk-config-modal__scrollbar--background-color-secondary);
103
+ }
104
+
105
+ .snk-config-modal__main::-webkit-scrollbar-track {
106
+ /*public*/
107
+ background-color: var(--snk-config-modal__scrollbar--background-color-secondary);
108
+ }
109
+
110
+ .snk-config-modal__main::-webkit-scrollbar-thumb {
111
+ /*public*/
112
+ background-color: var(--snk-config-modal__scrollbar--background-color-primary);
113
+ border-radius: var(--snk-config-modal__scrollbar--border-radius);
114
+ }
115
+
116
+ .snk-config-modal__main::-webkit-scrollbar {
117
+ /*public*/
118
+ background-color: var(--snk-config-modal__scrollbar--background-color-secondary);
119
+ width: var(--snk-config-modal__scrollbar--width);
120
+ max-width: var(--snk-config-modal__scrollbar--width);
121
+ min-width: var(--snk-config-modal__scrollbar--width);
122
+ }