@sankhyalabs/sankhyablocks 1.4.0-beta.7 → 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 (191) 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 +209 -6976
  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/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 +33 -3
  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/snk-filter-bar.css +1 -1
  42. package/dist/collection/components/snk-form/snk-form.css +4 -0
  43. package/dist/collection/components/snk-form/snk-form.js +108 -30
  44. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.css +9 -0
  45. package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +248 -0
  46. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.css +164 -0
  47. package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +140 -0
  48. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.css +185 -0
  49. package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +1062 -0
  50. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.css +272 -0
  51. package/dist/collection/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.js +476 -0
  52. package/dist/collection/components/snk-grid/snk-grid.js +92 -22
  53. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +9 -5
  54. package/dist/collection/components/snk-taskbar/snk-taskbar.js +35 -3
  55. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +106 -3
  56. package/dist/collection/lib/http/data-fetcher/fetchers/resource-fetcher.js +9 -1
  57. package/dist/collection/lib/message/SnkMessageBuilder.js +8 -1
  58. package/dist/collection/lib/message/resources/snk-configurator.msg.js +11 -0
  59. package/dist/collection/lib/message/resources/snk-form.msg.js +59 -2
  60. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -1
  61. package/dist/collection/lib/utils/constants.js +58 -0
  62. package/dist/components/SnkMessageBuilder.js +87 -11
  63. package/dist/components/_commonjsHelpers.js +17 -0
  64. package/dist/components/constants.js +60 -0
  65. package/dist/components/form-config-fetcher.js +6889 -0
  66. package/dist/components/index.d.ts +6 -0
  67. package/dist/components/index.js +6 -0
  68. package/dist/components/snk-application2.js +221 -6985
  69. package/dist/components/snk-config-modal.d.ts +11 -0
  70. package/dist/components/snk-config-modal.js +6 -0
  71. package/dist/components/snk-config-modal2.js +91 -0
  72. package/dist/components/snk-config-options.d.ts +11 -0
  73. package/dist/components/snk-config-options.js +6 -0
  74. package/dist/components/snk-config-options2.js +178 -0
  75. package/dist/components/snk-configurator.d.ts +11 -0
  76. package/dist/components/snk-configurator.js +6 -0
  77. package/dist/components/snk-configurator2.js +212 -0
  78. package/dist/components/snk-crud.js +62 -25
  79. package/dist/components/snk-field-config.d.ts +11 -0
  80. package/dist/components/snk-field-config.js +6 -0
  81. package/dist/components/snk-field-config2.js +70 -0
  82. package/dist/components/snk-filter-bar2.js +1 -1
  83. package/dist/components/snk-filter-personalized.js +2 -0
  84. package/dist/components/snk-form-config.d.ts +11 -0
  85. package/dist/components/snk-form-config.js +6 -0
  86. package/dist/components/snk-form-config2.js +996 -0
  87. package/dist/components/snk-form2.js +79 -29
  88. package/dist/components/snk-grid2.js +43 -24
  89. package/dist/components/snk-tab-config.d.ts +11 -0
  90. package/dist/components/snk-tab-config.js +6 -0
  91. package/dist/components/snk-tab-config2.js +7220 -0
  92. package/dist/components/snk-taskbar2.js +27 -9
  93. package/dist/esm/{SnkMessageBuilder-d440381c.js → SnkMessageBuilder-5792c260.js} +87 -11
  94. package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
  95. package/dist/esm/configurableElementsStorage-cdc144b5.js +18 -0
  96. package/dist/esm/constants-c4e3341e.js +60 -0
  97. package/dist/esm/draggable.bundle-41d56f06.js +6884 -0
  98. package/dist/esm/form-config-fetcher-96c6c2dc.js +6889 -0
  99. package/dist/esm/{index-81dda3cf.js → index-bafb2cef.js} +2 -1
  100. package/dist/esm/loader.js +2 -2
  101. package/dist/esm/sankhyablocks.js +2 -2
  102. package/dist/esm/snk-application.entry.js +220 -6987
  103. package/dist/esm/snk-config-modal.entry.js +58 -0
  104. package/dist/esm/snk-config-options.entry.js +159 -0
  105. package/dist/esm/{snk-filter-bar_5.entry.js → snk-configurator_6.entry.js} +194 -8
  106. package/dist/esm/snk-crud.entry.js +13 -11
  107. package/dist/esm/snk-data-unit.entry.js +2 -2
  108. package/dist/esm/snk-field-config_2.entry.js +130 -0
  109. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  110. package/dist/esm/snk-filter-detail.entry.js +1 -1
  111. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  112. package/dist/esm/snk-filter-number.entry.js +1 -1
  113. package/dist/esm/snk-filter-period.entry.js +1 -1
  114. package/dist/esm/snk-filter-personalized.entry.js +1 -1
  115. package/dist/esm/snk-filter-search.entry.js +1 -1
  116. package/dist/esm/snk-filter-text.entry.js +1 -1
  117. package/dist/esm/snk-form-config.entry.js +953 -0
  118. package/dist/esm/snk-form.entry.js +142 -0
  119. package/dist/esm/snk-pesquisa.entry.js +1 -1
  120. package/dist/esm/snk-tab-config.entry.js +317 -0
  121. package/dist/esm/{taskbar-elements-38eb5d51.js → taskbar-elements-2035b1c7.js} +10 -6
  122. package/dist/esm/taskbar-processor-aa6772c9.js +45 -0
  123. package/dist/esm/teste-pesquisa.entry.js +1 -1
  124. package/dist/sankhyablocks/p-03f9c407.js +1 -0
  125. package/dist/sankhyablocks/{p-ba426ea9.entry.js → p-04ad681a.entry.js} +1 -1
  126. package/dist/sankhyablocks/p-112455b1.js +1 -0
  127. package/dist/sankhyablocks/p-1963b46f.entry.js +1 -0
  128. package/dist/sankhyablocks/p-21c8929b.js +1 -0
  129. package/dist/sankhyablocks/p-26c503a6.entry.js +1 -0
  130. package/dist/sankhyablocks/{p-2e49afef.entry.js → p-31631fb6.entry.js} +1 -1
  131. package/dist/sankhyablocks/p-361299e8.js +26 -0
  132. package/dist/sankhyablocks/p-434e0dcf.entry.js +1 -0
  133. package/dist/sankhyablocks/{p-aecf3e0a.entry.js → p-6c61416a.entry.js} +1 -1
  134. package/dist/sankhyablocks/{p-49580cdd.entry.js → p-857c4735.entry.js} +1 -1
  135. package/dist/sankhyablocks/{p-4574a955.entry.js → p-8cd8977c.entry.js} +1 -1
  136. package/dist/sankhyablocks/{p-6386d720.entry.js → p-916068ff.entry.js} +1 -1
  137. package/dist/sankhyablocks/p-9f2c5fac.entry.js +1 -0
  138. package/dist/sankhyablocks/p-ad658f44.js +1 -0
  139. package/dist/sankhyablocks/p-ae302037.entry.js +75 -0
  140. package/dist/sankhyablocks/p-af11b0e7.js +1 -0
  141. package/dist/sankhyablocks/p-af306302.entry.js +1 -0
  142. package/dist/sankhyablocks/p-b6d6b172.js +1 -0
  143. package/dist/sankhyablocks/{p-40b27004.entry.js → p-cc85ba53.entry.js} +1 -1
  144. package/dist/sankhyablocks/{p-0352c0e2.entry.js → p-ccdf59eb.entry.js} +1 -1
  145. package/dist/sankhyablocks/p-ce789145.entry.js +1 -0
  146. package/dist/sankhyablocks/p-cf81e313.entry.js +1 -0
  147. package/dist/sankhyablocks/{p-0ea25487.entry.js → p-d1ae76ec.entry.js} +1 -1
  148. package/dist/sankhyablocks/p-d50651a3.js +1 -0
  149. package/dist/sankhyablocks/{p-fac2b6a9.js → p-ddb03141.js} +2 -2
  150. package/dist/sankhyablocks/p-ee906940.entry.js +1 -0
  151. package/dist/sankhyablocks/{p-5bdb8452.entry.js → p-f9084ecb.entry.js} +1 -1
  152. package/dist/sankhyablocks/p-fa75fba5.entry.js +1 -0
  153. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  154. package/dist/types/components/snk-application/snk-application.d.ts +29 -14
  155. package/dist/types/components/snk-configurator/snk-configurator.d.ts +46 -0
  156. package/dist/types/components/snk-configurator/subcomponents/configModalProvider/configurableElementsStorage.d.ts +8 -0
  157. package/dist/types/components/snk-configurator/subcomponents/snk-config-modal/snk-config-modal.d.ts +38 -0
  158. package/dist/types/components/snk-crud/snk-crud.d.ts +50 -0
  159. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +92 -0
  160. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +8 -6
  161. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +3 -3
  162. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +40 -0
  163. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +65 -0
  164. package/dist/types/components/snk-form/snk-form.d.ts +71 -0
  165. package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +41 -0
  166. package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +32 -0
  167. package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +139 -0
  168. package/dist/types/components/snk-form/subcomponents/snk-tab-config/snk-tab-config.d.ts +97 -0
  169. package/dist/types/components/snk-grid/snk-grid.d.ts +59 -0
  170. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +6 -5
  171. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -3
  172. package/dist/types/components.d.ts +358 -13
  173. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +21 -3
  174. package/dist/types/lib/http/data-fetcher/fetchers/resource-fetcher.d.ts +1 -0
  175. package/dist/types/lib/message/resources/snk-configurator.msg.d.ts +2 -0
  176. package/dist/types/lib/message/resources/snk-form.msg.d.ts +5 -2
  177. package/dist/types/lib/utils/constants.d.ts +62 -0
  178. package/dist/types/lib/utils/pesquisa.d.ts +2 -1
  179. package/package.json +4 -3
  180. package/react/components.d.ts +6 -0
  181. package/react/components.js +6 -0
  182. package/react/components.js.map +1 -1
  183. package/dist/cjs/snk-form_2.cjs.entry.js +0 -247
  184. package/dist/esm/snk-form_2.entry.js +0 -242
  185. package/dist/sankhyablocks/p-21e940aa.entry.js +0 -1
  186. package/dist/sankhyablocks/p-2eea7eea.js +0 -1
  187. package/dist/sankhyablocks/p-42036db1.entry.js +0 -84
  188. package/dist/sankhyablocks/p-77216252.entry.js +0 -1
  189. package/dist/sankhyablocks/p-86f15ffe.js +0 -1
  190. package/dist/sankhyablocks/p-97009a2c.entry.js +0 -1
  191. package/dist/sankhyablocks/p-a14c49db.entry.js +0 -1
@@ -0,0 +1,137 @@
1
+ import { ApplicationContext } from '@sankhyalabs/core';
2
+ import { h, Host } from '@stencil/core';
3
+ import { VIEW_MODE } from '../../../../lib/utils/constants';
4
+ import ConfigurableElementsStorage from '../configModalProvider/configurableElementsStorage';
5
+ const GRID_MODE = VIEW_MODE.grid;
6
+ const FORM_MODE = VIEW_MODE.form;
7
+ export class SnkConfigModal {
8
+ constructor() {
9
+ /**
10
+ * Define se o modo grid está ativo.
11
+ */
12
+ this.gridMode = true;
13
+ }
14
+ dispatchChange(openConfig = false) {
15
+ const data = {
16
+ viewMode: this.gridMode ? GRID_MODE.index : FORM_MODE.index,
17
+ openConfig
18
+ };
19
+ this.changeConfig.emit(data);
20
+ }
21
+ closeConfig() {
22
+ this.cancelConfig.emit();
23
+ }
24
+ onChecked(evt) {
25
+ const value = evt === null || evt === void 0 ? void 0 : evt.detail;
26
+ this.gridMode = value === "G" ? true : false;
27
+ this.dispatchChange();
28
+ }
29
+ onClicked() {
30
+ this.dispatchChange(true);
31
+ }
32
+ /**
33
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
34
+ * através de um pequeno modulo na estrutura da aplicação:
35
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
36
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-configurator.msg.ts"
37
+ */
38
+ getMessage(key) {
39
+ return this._application.messagesBuilder.getMessage(key, {});
40
+ }
41
+ componentWillLoad() {
42
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
43
+ }
44
+ render() {
45
+ return (h(Host, null, h("div", { class: "snk-config-modal__header" }, h("label", { class: "snk-config-modal__title" }, this.getMessage("snkConfigModal.titleConfigurations")), h("div", { class: "snk-config-modal__button-close" }, h("ez-button", { mode: 'icon', iconName: "close", size: 'medium', onClick: () => this.closeConfig() }))), h("div", { class: "snk-config-modal__main" }, h("ez-radio-button", { class: "ez-margin-top--medium", label: this.getMessage("snkConfigModal.subTitleModeConfig"), value: this.gridMode ? "G" : "F", onEzChange: (evt) => this.onChecked(evt) }, ConfigurableElementsStorage.getForm(this.configName) && h("ez-radio-button-option", { label: this.getMessage("snkConfigModal.labelGrid"), value: "G" }), ConfigurableElementsStorage.getGrid(this.configName) && h("ez-radio-button-option", { label: this.getMessage("snkConfigModal.labelForm"), value: "F" })), h("ez-button", { mode: "slim", label: this.gridMode
46
+ ? this.getMessage("snkConfigModal.labelConfigGrid")
47
+ : this.getMessage("snkConfigModal.labelConfigForm"), class: "snk-config-modal__button-config ez-button--primary", onClick: () => this.onClicked() }), h("hr", { class: "ez-divider-horizontal ez-margin-vertical--medium" }))));
48
+ }
49
+ static get is() { return "snk-config-modal"; }
50
+ static get encapsulation() { return "scoped"; }
51
+ static get originalStyleUrls() {
52
+ return {
53
+ "$": ["snk-config-modal.css"]
54
+ };
55
+ }
56
+ static get styleUrls() {
57
+ return {
58
+ "$": ["snk-config-modal.css"]
59
+ };
60
+ }
61
+ static get properties() {
62
+ return {
63
+ "configName": {
64
+ "type": "string",
65
+ "mutable": false,
66
+ "complexType": {
67
+ "original": "string",
68
+ "resolved": "string",
69
+ "references": {}
70
+ },
71
+ "required": false,
72
+ "optional": false,
73
+ "docs": {
74
+ "tags": [],
75
+ "text": "Nome usado para guardar/recuperar as configura\u00E7\u00F5es do formul\u00E1rio"
76
+ },
77
+ "attribute": "config-name",
78
+ "reflect": false
79
+ },
80
+ "gridMode": {
81
+ "type": "boolean",
82
+ "mutable": false,
83
+ "complexType": {
84
+ "original": "boolean",
85
+ "resolved": "boolean",
86
+ "references": {}
87
+ },
88
+ "required": false,
89
+ "optional": false,
90
+ "docs": {
91
+ "tags": [],
92
+ "text": "Define se o modo grid est\u00E1 ativo."
93
+ },
94
+ "attribute": "grid-mode",
95
+ "reflect": false,
96
+ "defaultValue": "true"
97
+ }
98
+ };
99
+ }
100
+ static get events() {
101
+ return [{
102
+ "method": "cancelConfig",
103
+ "name": "cancelConfig",
104
+ "bubbles": true,
105
+ "cancelable": true,
106
+ "composed": true,
107
+ "docs": {
108
+ "tags": [],
109
+ "text": "Evento disparado quando o modal \u00E9 fechado."
110
+ },
111
+ "complexType": {
112
+ "original": "void",
113
+ "resolved": "void",
114
+ "references": {}
115
+ }
116
+ }, {
117
+ "method": "changeConfig",
118
+ "name": "changeConfig",
119
+ "bubbles": true,
120
+ "cancelable": true,
121
+ "composed": true,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "Evento disparado quando h\u00E1 altera\u00E7\u00E3o nas configura\u00E7\u00F5es."
125
+ },
126
+ "complexType": {
127
+ "original": "IConfigModal",
128
+ "resolved": "IConfigModal",
129
+ "references": {
130
+ "IConfigModal": {
131
+ "location": "local"
132
+ }
133
+ }
134
+ }
135
+ }];
136
+ }
137
+ }
@@ -1,7 +1,9 @@
1
1
  import { h } from '@stencil/core';
2
2
  import { ApplicationContext } from '@sankhyalabs/core';
3
- const GRID_MODE = 0;
4
- const FORM_MODE = 1;
3
+ import { VIEW_MODE } from '../../lib/utils/constants';
4
+ import { TaskbarElement } from '../snk-taskbar/elements/taskbar-elements';
5
+ const GRID_MODE = VIEW_MODE.grid;
6
+ const FORM_MODE = VIEW_MODE.form;
5
7
  /**
6
8
  * É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
7
9
  * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
@@ -15,15 +17,15 @@ export class SnkCrud {
15
17
  this.executeAction(mode);
16
18
  }
17
19
  async gridToForm(keepFormMode = false) {
18
- this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE;
19
- this._viewStack.show(FORM_MODE);
20
+ this._backToGrid = !keepFormMode && await this._viewStack.getSelectedIndex() === GRID_MODE.index;
21
+ this._viewStack.show(FORM_MODE.index);
20
22
  }
21
23
  async executeAction(act) {
22
- if (act === "GRID_MODE") {
23
- this._viewStack.show(GRID_MODE);
24
+ if (act === TaskbarElement.GRID_MODE) {
25
+ this._viewStack.show(GRID_MODE.index);
24
26
  }
25
- else if (act === "FORM_MODE" || act === "UPDATE") {
26
- this.gridToForm(act !== "UPDATE");
27
+ else if (act === TaskbarElement.FORM_MODE || act === TaskbarElement.UPDATE) {
28
+ this.gridToForm(act !== TaskbarElement.UPDATE);
27
29
  }
28
30
  }
29
31
  insertionModeHandler() {
@@ -31,7 +33,7 @@ export class SnkCrud {
31
33
  }
32
34
  cancelHandler() {
33
35
  if (this._backToGrid) {
34
- this._viewStack.show(GRID_MODE);
36
+ this._viewStack.show(GRID_MODE.index);
35
37
  }
36
38
  }
37
39
  componentWillLoad() {
@@ -61,7 +63,7 @@ export class SnkCrud {
61
63
  }
62
64
  }
63
65
  render() {
64
- return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
66
+ return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
65
67
  }
66
68
  static get is() { return "snk-crud"; }
67
69
  static get encapsulation() { return "scoped"; }
@@ -141,10 +143,10 @@ export class SnkCrud {
141
143
  "type": "unknown",
142
144
  "mutable": false,
143
145
  "complexType": {
144
- "original": "RecordValidator",
145
- "resolved": "RecordValidator",
146
+ "original": "IRecordValidator",
147
+ "resolved": "IRecordValidator",
146
148
  "references": {
147
- "RecordValidator": {
149
+ "IRecordValidator": {
148
150
  "location": "import",
149
151
  "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
150
152
  }
@@ -102,13 +102,13 @@ export class SnkFilterPersonalized {
102
102
  "type": "unknown",
103
103
  "mutable": true,
104
104
  "complexType": {
105
- "original": "Array<Option|boolean|string|number|Date>",
106
- "resolved": "(string | number | boolean | Date | Option)[]",
105
+ "original": "Array<IOption|boolean|string|number|Date>",
106
+ "resolved": "(string | number | boolean | Date | IOption)[]",
107
107
  "references": {
108
108
  "Array": {
109
109
  "location": "global"
110
110
  },
111
- "Option": {
111
+ "IOption": {
112
112
  "location": "import",
113
113
  "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
114
114
  },
@@ -123,6 +123,36 @@ export class SnkFilterPersonalized {
123
123
  "tags": [],
124
124
  "text": ""
125
125
  }
126
+ },
127
+ "fix": {
128
+ "type": "unknown",
129
+ "mutable": false,
130
+ "complexType": {
131
+ "original": "()=>void",
132
+ "resolved": "() => void",
133
+ "references": {}
134
+ },
135
+ "required": false,
136
+ "optional": false,
137
+ "docs": {
138
+ "tags": [],
139
+ "text": ""
140
+ }
141
+ },
142
+ "unfix": {
143
+ "type": "unknown",
144
+ "mutable": false,
145
+ "complexType": {
146
+ "original": "()=>void",
147
+ "resolved": "() => void",
148
+ "references": {}
149
+ },
150
+ "required": false,
151
+ "optional": false,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": ""
155
+ }
126
156
  }
127
157
  };
128
158
  }
@@ -52,10 +52,10 @@ export class SnkFilterSearch {
52
52
  "type": "unknown",
53
53
  "mutable": false,
54
54
  "complexType": {
55
- "original": "Option",
56
- "resolved": "Option",
55
+ "original": "IOption",
56
+ "resolved": "IOption",
57
57
  "references": {
58
- "Option": {
58
+ "IOption": {
59
59
  "location": "import",
60
60
  "path": "@sankhyalabs/ezui/dist/types/components/ez-combo-box/ez-combo-box"
61
61
  }
@@ -19,7 +19,7 @@
19
19
  min-width: 265px;
20
20
 
21
21
  /*public*/
22
- z-index: var(--more-visible, 1);
22
+ z-index: var(--more-visible, 2);
23
23
  background-color: var(--background--xlight, #fff);
24
24
  border-radius: var(--border--radius-medium, 12px);
25
25
  box-shadow: var(--shadow, 0px 0px 16px 0px #000);
@@ -31,4 +31,8 @@
31
31
  margin-left: calc(var(--space--large) * -1);
32
32
  margin-right: calc(var(--space--large) * -1);
33
33
  width: calc(100% + (var(--space--large) * 2));
34
+ }
35
+
36
+ .snk-form__form--hidden {
37
+ display: none;
34
38
  }
@@ -1,26 +1,37 @@
1
- import { ApplicationContext } from '@sankhyalabs/core';
1
+ import { ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
2
2
  import { h } from '@stencil/core';
3
+ import ConfigurableElementsStorage from '../snk-configurator/subcomponents/configModalProvider/configurableElementsStorage';
3
4
  import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
4
5
  export class SnkForm {
5
6
  constructor() {
7
+ this._renderTimer = 500;
6
8
  this._taskbarProcessor = new TaskbarProcessor({
7
- "snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "INSERT"],
9
+ "snkForm.regular": ["PREVIOUS", "NEXT", "DIVIDER", "CLONE", "REMOVE", "MORE_OPTIONS", "DIVIDER", "GRID_MODE", "CONFIGURATOR", "INSERT"],
8
10
  "snkForm.finish_edition": ["CANCEL", "SAVE"]
9
11
  });
12
+ this._editionFormConfig = {};
13
+ this._insertionFormConfig = {};
14
+ this._showFormConfig = false;
15
+ }
16
+ /**
17
+ * Método responsável em abrir ou fechar o modal de configurações do form.
18
+ */
19
+ async setShowFormConfig(value) {
20
+ this._showFormConfig = value;
21
+ }
22
+ /**
23
+ * Método responsável por setar as configurações do form.
24
+ */
25
+ async setConfig(config) {
26
+ this._editionFormConfig = {};
27
+ setTimeout(() => {
28
+ this._editionFormConfig = config != undefined ? config : {};
29
+ this.loadInsertionConfig();
30
+ }, this._renderTimer);
10
31
  }
11
32
  getFormConfig() {
12
33
  return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
13
34
  }
14
- getInsertionHiddenFields(formConfig) {
15
- const hiddenFields = [];
16
- formConfig === null || formConfig === void 0 ? void 0 : formConfig.forEach(cfg => {
17
- const def = this._dataUnit.getField(cfg.name);
18
- if (def === null || def === void 0 ? void 0 : def.readOnly) {
19
- hiddenFields.push(cfg.name);
20
- }
21
- });
22
- return hiddenFields;
23
- }
24
35
  exitForm() {
25
36
  if (this._dataUnit.isDirty()) {
26
37
  this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
@@ -40,14 +51,17 @@ export class SnkForm {
40
51
  return disabled;
41
52
  }
42
53
  loadInsertionConfig() {
43
- if (this._dataUnit && this._configLoaded) {
44
- this._insertionFormConfig = this._editionFormConfig.filter(fieldCfg => {
54
+ var _a;
55
+ if (this._dataUnit) {
56
+ const copyFormConfig = ObjectUtils.copy(this._editionFormConfig || {});
57
+ copyFormConfig.fields = (_a = copyFormConfig.fields) === null || _a === void 0 ? void 0 : _a.filter(fieldCfg => {
45
58
  const def = this._dataUnit.getField(fieldCfg.name);
46
59
  if (def === null || def === void 0 ? void 0 : def.readOnly) {
47
60
  return false;
48
61
  }
49
62
  return true;
50
63
  });
64
+ this._insertionFormConfig = copyFormConfig;
51
65
  }
52
66
  }
53
67
  /**
@@ -63,17 +77,14 @@ export class SnkForm {
63
77
  var _a;
64
78
  return ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.selectedRecords) ? this._dataState.selectedRecords[0] : undefined;
65
79
  }
80
+ changeConfig(config) {
81
+ this.configChanged.emit(config);
82
+ }
83
+ componentDidRender() {
84
+ ConfigurableElementsStorage.setForm(this.configName, this._element);
85
+ }
66
86
  componentWillLoad() {
67
87
  this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
68
- if (this._application) {
69
- this._application.loadFormConfig(this.configName).then(cfg => {
70
- this._configLoaded = true;
71
- this._editionFormConfig = cfg;
72
- this.loadInsertionConfig();
73
- });
74
- //Forçamos a carga dos acessos pra aproveitar a request inicial.
75
- this._application.getAllAccess();
76
- }
77
88
  let parent = this._element.parentElement;
78
89
  while (parent) {
79
90
  if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
@@ -111,10 +122,11 @@ export class SnkForm {
111
122
  }
112
123
  render() {
113
124
  var _a;
114
- if (!this._configLoaded || !this._dataUnit || !this._dataState) {
125
+ if (!this._dataUnit || !this._dataState) {
115
126
  return undefined;
116
127
  }
117
- return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator }))))));
128
+ return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
129
+ h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), parentForm: this._element, onConfigChange: (evt) => { this.changeConfig(evt.detail); } }))))));
118
130
  }
119
131
  static get is() { return "snk-form"; }
120
132
  static get encapsulation() { return "scoped"; }
@@ -151,10 +163,10 @@ export class SnkForm {
151
163
  "type": "unknown",
152
164
  "mutable": false,
153
165
  "complexType": {
154
- "original": "RecordValidator",
155
- "resolved": "RecordValidator",
166
+ "original": "IRecordValidator",
167
+ "resolved": "IRecordValidator",
156
168
  "references": {
157
- "RecordValidator": {
169
+ "IRecordValidator": {
158
170
  "location": "import",
159
171
  "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
160
172
  }
@@ -215,10 +227,10 @@ export class SnkForm {
215
227
  static get states() {
216
228
  return {
217
229
  "_dataUnit": {},
218
- "_configLoaded": {},
219
230
  "_dataState": {},
220
231
  "_editionFormConfig": {},
221
- "_insertionFormConfig": {}
232
+ "_insertionFormConfig": {},
233
+ "_showFormConfig": {}
222
234
  };
223
235
  }
224
236
  static get events() {
@@ -252,7 +264,73 @@ export class SnkForm {
252
264
  "resolved": "string",
253
265
  "references": {}
254
266
  }
267
+ }, {
268
+ "method": "configChanged",
269
+ "name": "configChanged",
270
+ "bubbles": true,
271
+ "cancelable": true,
272
+ "composed": true,
273
+ "docs": {
274
+ "tags": [],
275
+ "text": "Evento disparado quando as configura\u00E7\u00F5es s\u00E3o alteradas."
276
+ },
277
+ "complexType": {
278
+ "original": "IFormConfig",
279
+ "resolved": "IFormConfig",
280
+ "references": {
281
+ "IFormConfig": {
282
+ "location": "import",
283
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
284
+ }
285
+ }
286
+ }
255
287
  }];
256
288
  }
289
+ static get methods() {
290
+ return {
291
+ "setShowFormConfig": {
292
+ "complexType": {
293
+ "signature": "(value: boolean) => Promise<void>",
294
+ "parameters": [{
295
+ "tags": [],
296
+ "text": ""
297
+ }],
298
+ "references": {
299
+ "Promise": {
300
+ "location": "global"
301
+ }
302
+ },
303
+ "return": "Promise<void>"
304
+ },
305
+ "docs": {
306
+ "text": "M\u00E9todo respons\u00E1vel em abrir ou fechar o modal de configura\u00E7\u00F5es do form.",
307
+ "tags": []
308
+ }
309
+ },
310
+ "setConfig": {
311
+ "complexType": {
312
+ "signature": "(config: IFormConfig) => Promise<void>",
313
+ "parameters": [{
314
+ "tags": [],
315
+ "text": ""
316
+ }],
317
+ "references": {
318
+ "Promise": {
319
+ "location": "global"
320
+ },
321
+ "IFormConfig": {
322
+ "location": "import",
323
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
324
+ }
325
+ },
326
+ "return": "Promise<void>"
327
+ },
328
+ "docs": {
329
+ "text": "M\u00E9todo respons\u00E1vel por setar as configura\u00E7\u00F5es do form.",
330
+ "tags": []
331
+ }
332
+ }
333
+ };
334
+ }
257
335
  static get elementRef() { return "_element"; }
258
336
  }
@@ -0,0 +1,9 @@
1
+ :host {
2
+ width: 100%;
3
+ border: 2px solid var(--color--secondary-200);
4
+ border-radius: 15px;
5
+ }
6
+
7
+ .config-options__switch-row {
8
+ margin-top: -30px;
9
+ }