@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
@@ -0,0 +1,315 @@
1
+ import { h, Host } from "@stencil/core";
2
+ import { ApplicationContext, UserInterface, ObjectUtils } from '@sankhyalabs/core';
3
+ import { DataType, getConvertedValue } from "@sankhyalabs/core/dist/dataunit/metadata/DataType";
4
+ import { CheckMode } from "@sankhyalabs/ezui/dist/collection/utils";
5
+ import { DEFAULT_TYPE, TAGS_BY_TYPE, VARS_BY_TYPE } from "../../../../lib/utils/constants";
6
+ export class SnkConfigOptions {
7
+ constructor() {
8
+ /**
9
+ * Armazena as propriedades do campo
10
+ */
11
+ this.fieldConfig = {};
12
+ }
13
+ onConfigDefault(optionSelected) {
14
+ if (optionSelected != undefined) {
15
+ this._defaultType = optionSelected;
16
+ this.fieldConfig.defaultValue = {
17
+ type: this._defaultType
18
+ };
19
+ this.configOptionsChanged.emit(this.fieldConfig);
20
+ }
21
+ }
22
+ buildOptions() {
23
+ var _a, _b, _c;
24
+ const interfaceField = (_c = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name)) === null || _c === void 0 ? void 0 : _c.userInterface;
25
+ return VARS_BY_TYPE.UserInterface[interfaceField];
26
+ }
27
+ enabledValueDefault() {
28
+ var _a, _b, _c;
29
+ const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
30
+ const allowDefault = (_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault;
31
+ const hasVariableVar = VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface);
32
+ if ((allowDefault == undefined || allowDefault === "true") && hasVariableVar) {
33
+ return true;
34
+ }
35
+ return false;
36
+ }
37
+ isAllowDefault() {
38
+ var _a, _b;
39
+ const allowDefault = (_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault;
40
+ if (allowDefault == undefined) {
41
+ return true;
42
+ }
43
+ return allowDefault === "true";
44
+ }
45
+ loadDefaultValue() {
46
+ var _a;
47
+ if (this.fieldConfig == undefined) {
48
+ this._defaultType = DEFAULT_TYPE.fixed;
49
+ this.fieldConfig = {
50
+ defaultValue: {
51
+ type: this._defaultType
52
+ }
53
+ };
54
+ }
55
+ else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
56
+ this._defaultType = DEFAULT_TYPE.fixed;
57
+ this.fieldConfig.defaultValue = {
58
+ type: this._defaultType
59
+ };
60
+ }
61
+ else {
62
+ this._defaultType = this.fieldConfig.defaultValue.type;
63
+ }
64
+ }
65
+ getFieldProperties(field) {
66
+ var _a;
67
+ if (field != undefined) {
68
+ return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
69
+ }
70
+ }
71
+ getMessage(key, params) {
72
+ return this._application.messagesBuilder.getMessage(key, params);
73
+ }
74
+ getDefaultType() {
75
+ var _a;
76
+ return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : DEFAULT_TYPE.fixed;
77
+ }
78
+ getEnabledByProperty(property) {
79
+ const properties = this._fieldProperties;
80
+ if (properties != undefined && properties[property] === true) {
81
+ return false;
82
+ }
83
+ return true;
84
+ }
85
+ getValueByProperty(property) {
86
+ const properties = this._fieldProperties;
87
+ if (properties != undefined && properties[property] === true) {
88
+ return true;
89
+ }
90
+ return this.fieldConfig[property];
91
+ }
92
+ getValidatedValue(fieldValue) {
93
+ var _a, _b;
94
+ if (fieldValue == undefined) {
95
+ return;
96
+ }
97
+ const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
98
+ const dataType = field === null || field === void 0 ? void 0 : field.dataType;
99
+ if (dataType == undefined) {
100
+ return;
101
+ }
102
+ const value = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) != undefined ? undefined :
103
+ dataType !== DataType.OBJECT && dataType !== DataType.DATE
104
+ && typeof fieldValue === "object"
105
+ ? fieldValue.value
106
+ : fieldValue;
107
+ return dataType === DataType.OBJECT ? JSON.stringify(value) : value;
108
+ }
109
+ buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
110
+ let options;
111
+ let precision = 0;
112
+ let prettyPrecision = 0;
113
+ const TagName = userInterface == undefined || TAGS_BY_TYPE[userInterface] == undefined
114
+ ? TAGS_BY_TYPE.DEFAULT
115
+ : TAGS_BY_TYPE[userInterface];
116
+ if (userInterface === UserInterface.OPTIONSELECTOR) {
117
+ const prop = properties === null || properties === void 0 ? void 0 : properties.options;
118
+ if (typeof prop === "string") {
119
+ const parsed = ObjectUtils.stringToObject(prop);
120
+ options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
121
+ }
122
+ else {
123
+ options = prop;
124
+ }
125
+ }
126
+ else if (userInterface === UserInterface.DECIMALNUMBER) {
127
+ precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
128
+ prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
129
+ }
130
+ return h(TagName, Object.assign({ value: value, enabled: enabled, label: label, "data-field-name": name, key: name, onEzChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail) }, (this.getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode))));
131
+ }
132
+ getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
133
+ switch (userInterface) {
134
+ case UserInterface.SEARCH:
135
+ return {
136
+ suppressEmptyOption: required,
137
+ optionLoader: (searchArgument) => this.onSearch(searchArgument)
138
+ };
139
+ case UserInterface.OPTIONSELECTOR:
140
+ return {
141
+ suppressEmptyOption: required,
142
+ options
143
+ };
144
+ case UserInterface.CHECKBOX:
145
+ case UserInterface.SWITCH:
146
+ return {
147
+ mode
148
+ };
149
+ case UserInterface.INTEGERNUMBER:
150
+ case UserInterface.DECIMALNUMBER:
151
+ return {
152
+ precision,
153
+ prettyPrecision,
154
+ onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
155
+ };
156
+ case UserInterface.DATE:
157
+ case UserInterface.DATETIME:
158
+ case UserInterface.TIME:
159
+ return {
160
+ onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
161
+ };
162
+ default:
163
+ return {};
164
+ }
165
+ }
166
+ onChange(fieldValue) {
167
+ this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
168
+ this.configOptionsChanged.emit(this.fieldConfig);
169
+ }
170
+ onSearch(searchArgument) {
171
+ if (this._application != undefined && this.fieldConfig != undefined) {
172
+ return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
173
+ }
174
+ }
175
+ buildField(field) {
176
+ const { config, descriptor } = field;
177
+ const { name, label, readOnly, required, defaultValue } = config;
178
+ const { userInterface, properties } = descriptor;
179
+ const enabled = (properties === null || properties === void 0 ? void 0 : properties.allowDefault) != undefined ? properties.allowDefault === "true" : !readOnly;
180
+ let value;
181
+ if (enabled) {
182
+ value = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value;
183
+ if (value != undefined) {
184
+ value = getConvertedValue(descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType, value);
185
+ }
186
+ }
187
+ const configField = { value, enabled, label, name, required, userInterface };
188
+ switch (userInterface) {
189
+ case UserInterface.SWITCH:
190
+ return this.buildInputDefault(configField, undefined, CheckMode.SWITCH);
191
+ case UserInterface.CHECKBOX:
192
+ return this.buildInputDefault(configField, undefined, CheckMode.REGULAR);
193
+ case UserInterface.OPTIONSELECTOR:
194
+ case UserInterface.DECIMALNUMBER:
195
+ return this.buildInputDefault(configField, properties);
196
+ default:
197
+ return this.buildInputDefault(configField);
198
+ }
199
+ }
200
+ componentWillLoad() {
201
+ var _a;
202
+ this.loadDefaultValue();
203
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
204
+ this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
205
+ }
206
+ render() {
207
+ var _a, _b;
208
+ return (h(Host, null, h("div", { id: this.idConfig }, h("div", { class: "ez-row ez-padding--medium" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-text-input", { label: this.getMessage("snkConfigOptions.label.nameField"), value: (_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.label, onEzChange: (evt) => { this.fieldConfig.label = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.typeValueDefault"), suppressEmptyOption: true, enabled: this.enabledValueDefault(), onEzChange: (evt) => { var _a; return this.onConfigDefault((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); }, value: this.getDefaultType() }, h("option", { value: DEFAULT_TYPE.fixed }, this.getMessage("snkConfigOptions.options.valueFixed")), h("option", { value: DEFAULT_TYPE.variable }, this.getMessage("snkConfigOptions.options.variable")))), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, this._defaultType === DEFAULT_TYPE.variable ?
209
+ h("ez-combo-box", { label: this.getMessage("snkConfigOptions.label.valueDefault"), enabled: this.isAllowDefault(), onEzChange: (evt) => { var _a; this.fieldConfig.defaultValue.value = (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value; this.configOptionsChanged.emit(this.fieldConfig); }, value: this.fieldConfig.defaultValue.value, options: this.buildOptions() })
210
+ :
211
+ ((_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.userInterface) &&
212
+ this.buildField({
213
+ descriptor: this._fieldProperties,
214
+ config: this.fieldConfig
215
+ }))), h("div", { class: "ez-row ez-padding--medium config-options__switch-row" }, h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.clearDuplicate"), value: this.fieldConfig.cleanOnCopy, onEzChange: (evt) => { this.fieldConfig.cleanOnCopy = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.requiredField"), enabled: this.getEnabledByProperty("required"), value: this.getValueByProperty("required"), onEzChange: (evt) => { this.fieldConfig.required = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } })), h("div", { class: "ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small" }, h("ez-check", { mode: CheckMode.SWITCH, label: this.getMessage("snkConfigOptions.label.protectedField"), enabled: this.getEnabledByProperty("readOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
216
+ }
217
+ static get is() { return "snk-config-options"; }
218
+ static get encapsulation() { return "scoped"; }
219
+ static get originalStyleUrls() {
220
+ return {
221
+ "$": ["snk-config-options.css"]
222
+ };
223
+ }
224
+ static get styleUrls() {
225
+ return {
226
+ "$": ["snk-config-options.css"]
227
+ };
228
+ }
229
+ static get properties() {
230
+ return {
231
+ "fieldConfig": {
232
+ "type": "unknown",
233
+ "mutable": false,
234
+ "complexType": {
235
+ "original": "IFieldConfig",
236
+ "resolved": "IFieldConfig",
237
+ "references": {
238
+ "IFieldConfig": {
239
+ "location": "import",
240
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
241
+ }
242
+ }
243
+ },
244
+ "required": false,
245
+ "optional": false,
246
+ "docs": {
247
+ "tags": [],
248
+ "text": "Armazena as propriedades do campo"
249
+ },
250
+ "defaultValue": "{} as IFieldConfig"
251
+ },
252
+ "idConfig": {
253
+ "type": "string",
254
+ "mutable": false,
255
+ "complexType": {
256
+ "original": "string",
257
+ "resolved": "string",
258
+ "references": {}
259
+ },
260
+ "required": false,
261
+ "optional": false,
262
+ "docs": {
263
+ "tags": [],
264
+ "text": "Armazena a chave de op\u00E7\u00F5es de configura\u00E7\u00E3o"
265
+ },
266
+ "attribute": "id-config",
267
+ "reflect": true
268
+ },
269
+ "dataUnit": {
270
+ "type": "unknown",
271
+ "mutable": false,
272
+ "complexType": {
273
+ "original": "DataUnit",
274
+ "resolved": "DataUnit",
275
+ "references": {
276
+ "DataUnit": {
277
+ "location": "import",
278
+ "path": "@sankhyalabs/core"
279
+ }
280
+ }
281
+ },
282
+ "required": false,
283
+ "optional": false,
284
+ "docs": {
285
+ "tags": [],
286
+ "text": "Reposit\u00F3rio de dados respons\u00E1vel por controlar a manipula\u00E7\u00E3o dos dados"
287
+ }
288
+ }
289
+ };
290
+ }
291
+ static get states() {
292
+ return {
293
+ "_defaultType": {}
294
+ };
295
+ }
296
+ static get events() {
297
+ return [{
298
+ "method": "configOptionsChanged",
299
+ "name": "configOptionsChanged",
300
+ "bubbles": true,
301
+ "cancelable": true,
302
+ "composed": true,
303
+ "docs": {
304
+ "tags": [],
305
+ "text": "Evento disparado ao realizar alguma altera\u00E7\u00E3o nos campos"
306
+ },
307
+ "complexType": {
308
+ "original": "any",
309
+ "resolved": "any",
310
+ "references": {}
311
+ }
312
+ }];
313
+ }
314
+ static get elementRef() { return "_element"; }
315
+ }
@@ -0,0 +1,164 @@
1
+ :host {
2
+ /* dimensions */
3
+ /*@doc Define a altura do componente.*/
4
+ --snk-field-config--height: 42px;
5
+ /*@doc Define a largura do componente.*/
6
+ --snk-field-config--width: 100%;
7
+ /*@doc Define a largura do slot que contém o ícone.*/
8
+ --snk-field-config__icon--width: 48px;
9
+ /*@doc Define a altura do componente em modo "slim".*/
10
+ --snk-field-config--height--slim: 32px;
11
+
12
+ /* general */
13
+ /*@doc Define o raio da borda do input do componente.*/
14
+ --snk-field-config--border-radius: var(--border--radius-medium, 12px);
15
+ /*@doc Define o tamanho da fonte do input e label do componente.*/
16
+ --snk-field-config--font-size: var(--text--medium, 14px);
17
+ /*@doc Define a família da fonte do input, label e caixa de mensagem do componente.*/
18
+ --snk-field-config--font-family: var(--font-pattern, Arial);
19
+ /*@doc Define o peso da fonte do label do componente.*/
20
+ --snk-field-config--font-weight: var(--text-weight--medium, 400);
21
+ /*@doc Define a cor da fonte do input e label do componente.*/
22
+ --snk-field-config--color: var(--title--primary, #000);
23
+
24
+ /* input */
25
+ /*@doc Define a cor de fundo do input.*/
26
+ --snk-field-config__input--background-color: var(--background--medium, #e0e0e0);
27
+ /*@doc Define o estilo da borda do input.*/
28
+ --snk-field-config__input--border: var(--border--medium, 2px solid);
29
+ /*@doc Define a cor da borda do input.*/
30
+ --snk-field-config__input--border-color: var(--background--xlight, #fff);
31
+ /*no modo normal usamos a borda com a mesma cor do bg*/
32
+ --snk-field-config__required--color: var(--color--error, #FF0000);
33
+
34
+ /*no modo normal usamos a borda com a mesma cor do bg*/
35
+ --snk-field-config__transition--visibility: var(--transition, 0.2s linear);
36
+ --snk-field-config__transition--opacity: var(--transition, 0.15s linear);
37
+
38
+ /***************
39
+ host style
40
+ ***************/
41
+ /*private*/
42
+ display: flex;
43
+ flex-wrap: wrap;
44
+ position: relative;
45
+
46
+ /*public*/
47
+ width: var(--snk-field-config--width);
48
+ }
49
+
50
+ .field-config {
51
+ /*private*/
52
+ width: 100%;
53
+ box-sizing: border-box;
54
+ display: flex;
55
+ align-items: center;
56
+
57
+ /*public*/
58
+ padding-left: var(--space--medium, 6px);
59
+ font-weight: var(--snk-field-config--font-weight);
60
+ height: var(--snk-field-config--height);
61
+ border-radius: var(--snk-field-config--border-radius);
62
+ font-family: var(--snk-field-config--font-family);
63
+ font-size: var(--snk-field-config--font-size);
64
+ border: var(--snk-field-config__input--border);
65
+ border-color: var(--snk-field-config__input--border-color);
66
+ background-color: var(--snk-field-config__input--background-color);
67
+ color: var(--snk-field-config--color);
68
+ }
69
+
70
+ .field-config__config-popover {
71
+ width: 40px;
72
+ margin-left: auto;
73
+ z-index: var(--more-visible, 2);
74
+ }
75
+
76
+ .field-config__required-label {
77
+ padding-left: var(--space--extra-small, 3px);
78
+
79
+ /*public*/
80
+ color: var(--snk-field-config__required--color);
81
+ }
82
+
83
+ .field-config__add {
84
+ display: flex;
85
+ margin-left: auto;
86
+
87
+ visibility:hidden;
88
+ opacity:0;
89
+ transition: visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity);
90
+ }
91
+
92
+
93
+ .field-config__options {
94
+ display: flex;
95
+ margin-left: auto;
96
+
97
+ visibility:hidden;
98
+ opacity:0;
99
+ transition: visibility var(--snk-field-config__transition--visibility), opacity var(--snk-field-config__transition--opacity);
100
+ }
101
+
102
+ .field-config__options--is-active {
103
+ display: flex;
104
+ visibility:visible;
105
+ opacity:1;
106
+ }
107
+
108
+ .field-config__remove-icon {
109
+ margin-right: -15px;
110
+ }
111
+
112
+ .field-config:hover .field-config__options {
113
+ display: flex;
114
+ visibility:visible;
115
+ opacity:1;
116
+ }
117
+
118
+ .field-config:hover .field-config__add {
119
+ visibility:visible;
120
+ opacity:1;
121
+ }
122
+
123
+
124
+ .field-config__draggable {
125
+ padding-right: var(--space--small, 6px);
126
+ }
127
+
128
+ .field-config__config-outer-arrow {
129
+ background-color: var(--color--secondary-200);
130
+ clip-path: polygon(50% 0, 90% 100%, 10% 100%);
131
+ border-radius: 0.25em 0 0 0;
132
+ width: 30px;
133
+ height: 15px;
134
+ padding-top: 3px;
135
+ border-bottom: 1px solid #FFFFFF;
136
+ }
137
+
138
+ .field-config__config-inner-arrow {
139
+ background-color: #FFFFFF;
140
+ clip-path: polygon(50% 0, 90% 100%, 10% 100%);
141
+ border-radius: 0.25em 0 0 0;
142
+ width: 30px;
143
+ height: 15px;
144
+ }
145
+
146
+ .ez-box__container ez-collapsible-box {
147
+ --snk-collapsible-box__header--padding-left: 6px;
148
+ }
149
+
150
+ ez-icon {
151
+ /*public*/
152
+ --snk-icon--color: var(--snk-field-config--color)
153
+ }
154
+
155
+ ez-popover {
156
+ --snk-popover__box--background-color: transparent;
157
+ --snk-popover__box--box-shadow: none
158
+ }
159
+
160
+ .field-config__options ez-button {
161
+ --snk-button--background-color: transparent;
162
+ --snk-button--focus--border: none;
163
+ --snk-button--focus--box-shadow: none;
164
+ }
@@ -0,0 +1,140 @@
1
+ import { ApplicationContext } from "@sankhyalabs/core";
2
+ import { h, Host } from "@stencil/core";
3
+ import { ACTION_CONFIG } from "../../../../lib/utils/constants";
4
+ export class SnkFieldConfig {
5
+ constructor() {
6
+ /**
7
+ * Define se o popover de configuração está ativo.
8
+ */
9
+ this.isConfigActive = false;
10
+ /**
11
+ * Define se o componente está em modo de inserção
12
+ */
13
+ this.modeInsertion = true;
14
+ }
15
+ handleAction(evt, type) {
16
+ evt.preventDefault();
17
+ evt.stopPropagation();
18
+ const field = this.fieldConfig;
19
+ if (type !== ACTION_CONFIG.configuration) {
20
+ field.group = undefined;
21
+ }
22
+ this.ezClickIcon.emit({ field, type });
23
+ }
24
+ /**
25
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
26
+ * através de um pequeno modulo na estrutura da aplicação:
27
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
28
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
29
+ */
30
+ getMessage(key) {
31
+ return this._application.messagesBuilder.getMessage(key, {});
32
+ }
33
+ componentWillLoad() {
34
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
35
+ }
36
+ render() {
37
+ if (this.fieldConfig == undefined) {
38
+ return;
39
+ }
40
+ return (h(Host, null, h("div", { class: "field-config" }, h("div", { class: "field-config__draggable" }, h("ez-icon", { iconName: "drag-indicator", size: "small" })), h("div", null, this.fieldConfig.label, this.fieldConfig.required && h("span", { class: "field-config__required-label" }, "*")), this.modeInsertion ?
41
+ h("div", { class: "field-config__add" }, h("ez-button", { onClick: (evt) => this.handleAction(evt, ACTION_CONFIG.add), mode: "icon", class: "ez-button--tertiary", iconName: "plus", size: "large", title: this.getMessage("snkFieldConfig.titleAdd") })) :
42
+ h("div", { class: "field-config__options" + (this.isConfigActive ? " field-config__options--is-active" : " ") }, h("ez-button", { mode: "icon", class: "ez-button--tertiary field-config__remove-icon", onClick: (evt) => this.handleAction(evt, ACTION_CONFIG.remove), iconName: "minus", size: "large", title: this.getMessage("snkFieldConfig.titleRemove") }), h("ez-button", { id: "buttonConfig_" + this.fieldConfig.name, mode: "icon", class: "ez-button--tertiary", onClick: (evt) => this.handleAction(evt, ACTION_CONFIG.configuration), iconName: this.isConfigActive ? "chevron-up" : "settings-inverted", size: "large", title: this.getMessage("snkFieldConfig.titleConfigurations") }))), this.isConfigActive && h("div", { class: "field-config__config-popover" }, h("div", { class: "field-config__config-outer-arrow" }, h("div", { class: "field-config__config-inner-arrow" })))));
43
+ }
44
+ static get is() { return "snk-field-config"; }
45
+ static get encapsulation() { return "scoped"; }
46
+ static get originalStyleUrls() {
47
+ return {
48
+ "$": ["snk-field-config.css"]
49
+ };
50
+ }
51
+ static get styleUrls() {
52
+ return {
53
+ "$": ["snk-field-config.css"]
54
+ };
55
+ }
56
+ static get properties() {
57
+ return {
58
+ "isConfigActive": {
59
+ "type": "unknown",
60
+ "mutable": false,
61
+ "complexType": {
62
+ "original": "Boolean",
63
+ "resolved": "Boolean",
64
+ "references": {
65
+ "Boolean": {
66
+ "location": "global"
67
+ }
68
+ }
69
+ },
70
+ "required": false,
71
+ "optional": false,
72
+ "docs": {
73
+ "tags": [],
74
+ "text": "Define se o popover de configura\u00E7\u00E3o est\u00E1 ativo."
75
+ },
76
+ "defaultValue": "false"
77
+ },
78
+ "fieldConfig": {
79
+ "type": "unknown",
80
+ "mutable": false,
81
+ "complexType": {
82
+ "original": "IFieldConfig",
83
+ "resolved": "IFieldConfig",
84
+ "references": {
85
+ "IFieldConfig": {
86
+ "location": "import",
87
+ "path": "@sankhyalabs/ezui/dist/types/components/ez-form/ez-form"
88
+ }
89
+ }
90
+ },
91
+ "required": false,
92
+ "optional": false,
93
+ "docs": {
94
+ "tags": [],
95
+ "text": "Armazena as propriedades do campo"
96
+ }
97
+ },
98
+ "modeInsertion": {
99
+ "type": "boolean",
100
+ "mutable": false,
101
+ "complexType": {
102
+ "original": "boolean",
103
+ "resolved": "boolean",
104
+ "references": {}
105
+ },
106
+ "required": false,
107
+ "optional": false,
108
+ "docs": {
109
+ "tags": [],
110
+ "text": "Define se o componente est\u00E1 em modo de inser\u00E7\u00E3o"
111
+ },
112
+ "attribute": "mode-insertion",
113
+ "reflect": true,
114
+ "defaultValue": "true"
115
+ }
116
+ };
117
+ }
118
+ static get events() {
119
+ return [{
120
+ "method": "ezClickIcon",
121
+ "name": "ezClickIcon",
122
+ "bubbles": true,
123
+ "cancelable": true,
124
+ "composed": true,
125
+ "docs": {
126
+ "tags": [],
127
+ "text": "Evento disparado ao pressionar button icon(onEzClickIcon)"
128
+ },
129
+ "complexType": {
130
+ "original": "Object",
131
+ "resolved": "Object",
132
+ "references": {
133
+ "Object": {
134
+ "location": "global"
135
+ }
136
+ }
137
+ }
138
+ }];
139
+ }
140
+ }