@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-72074.0 → 0.0.0-bugfix-dev-KB-74246.1

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 (138) hide show
  1. package/dist/cjs/{ConfigStorage-ecc0ed20.js → ConfigStorage-f079f5fd.js} +2 -2
  2. package/dist/cjs/{ContinuousInsertUtils-29b65619.js → ContinuousInsertUtils-64e47516.js} +29 -20
  3. package/dist/cjs/{DataFetcher-cadeef8e.js → DataFetcher-e059eb72.js} +7 -5
  4. package/dist/cjs/{SnkFormConfigManager-f1c92f79.js → SnkFormConfigManager-bff848f1.js} +5 -5
  5. package/dist/cjs/{auth-fetcher-d68841bc.js → auth-fetcher-4f853233.js} +1 -1
  6. package/dist/cjs/{dataunit-fetcher-f89461c1.js → dataunit-fetcher-228016f4.js} +3 -3
  7. package/dist/cjs/{form-config-fetcher-ed497282.js → form-config-fetcher-39397ac5.js} +1 -1
  8. package/dist/cjs/index-f9e81701.js +8 -28
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/{pesquisa-fetcher-ca89181c.js → pesquisa-fetcher-a9bfeb22.js} +7 -2
  11. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  12. package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
  13. package/dist/cjs/snk-application.cjs.entry.js +101 -59
  14. package/dist/cjs/snk-attach.cjs.entry.js +5 -5
  15. package/dist/cjs/{snk-form-config.cjs.entry.js → snk-config-options_3.cjs.entry.js} +365 -3
  16. package/dist/cjs/snk-crud.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-data-exporter.cjs.entry.js +5 -5
  18. package/dist/cjs/{snk-data-unit-668dc5e8.js → snk-data-unit-3d4d0e2a.js} +1 -1
  19. package/dist/cjs/snk-data-unit.cjs.entry.js +3 -3
  20. package/dist/cjs/snk-detail-view.cjs.entry.js +7 -7
  21. package/dist/cjs/{snk-filter-bar.cjs.entry.js → snk-filter-bar_4.cjs.entry.js} +688 -3
  22. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
  23. package/dist/cjs/snk-grid.cjs.entry.js +6 -6
  24. package/dist/cjs/{snk-guides-viewer-4236cb9d.js → snk-guides-viewer-2b44c804.js} +8 -5
  25. package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
  26. package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
  27. package/dist/cjs/snk-simple-crud.cjs.entry.js +10 -8
  28. package/dist/collection/collection-manifest.json +11 -31
  29. package/dist/collection/components/snk-application/request-listener/DebouncedRequestListener.js +28 -0
  30. package/dist/collection/components/snk-application/request-listener/RequestListenerFactory.js +16 -0
  31. package/dist/collection/components/snk-application/request-listener/RequestListenerLoadingBar.js +52 -0
  32. package/dist/collection/components/snk-application/snk-application.js +3 -53
  33. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +3 -0
  34. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +3 -3
  35. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +3 -1
  36. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -6
  37. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/DataUnitDataLoader.js +2 -2
  38. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +6 -1
  39. package/dist/collection/lib/utils/CrudUtils.js +25 -16
  40. package/dist/collection/sw.js +46 -0
  41. package/dist/components/ContinuousInsertUtils.js +25 -16
  42. package/dist/components/DataFetcher.js +7 -5
  43. package/dist/components/SnkFormConfigManager.js +3 -3
  44. package/dist/components/dataunit-fetcher.js +2 -2
  45. package/dist/components/pesquisa-fetcher.js +6 -1
  46. package/dist/components/snk-application2.js +95 -53
  47. package/dist/components/snk-detail-view2.js +3 -0
  48. package/dist/components/snk-simple-crud2.js +3 -1
  49. package/dist/esm/{ConfigStorage-7b36d041.js → ConfigStorage-6514d66e.js} +2 -2
  50. package/dist/esm/{ContinuousInsertUtils-30caa626.js → ContinuousInsertUtils-b62906f9.js} +29 -20
  51. package/dist/esm/{DataFetcher-a9c598f2.js → DataFetcher-5034df59.js} +7 -5
  52. package/dist/esm/{SnkFormConfigManager-139f09fa.js → SnkFormConfigManager-f0532f7d.js} +6 -6
  53. package/dist/esm/{auth-fetcher-749d880f.js → auth-fetcher-ca5d3a49.js} +1 -1
  54. package/dist/esm/{constants-8457af36.js → constants-7302ee87.js} +1 -1
  55. package/dist/esm/{dataunit-fetcher-c24c76c6.js → dataunit-fetcher-56cb648b.js} +3 -3
  56. package/dist/esm/{form-config-fetcher-adbe5d34.js → form-config-fetcher-a7d3e277.js} +1 -1
  57. package/dist/esm/index-a7d3d3f1.js +8 -28
  58. package/dist/esm/loader.js +1 -1
  59. package/dist/esm/{pesquisa-fetcher-8edaa8cd.js → pesquisa-fetcher-6bc2e41a.js} +7 -2
  60. package/dist/esm/sankhyablocks.js +1 -1
  61. package/dist/esm/snk-actions-button_4.entry.js +6 -6
  62. package/dist/esm/snk-application.entry.js +101 -59
  63. package/dist/esm/snk-attach.entry.js +6 -6
  64. package/dist/esm/{snk-form-config.entry.js → snk-config-options_3.entry.js} +366 -6
  65. package/dist/esm/snk-configurator.entry.js +1 -1
  66. package/dist/esm/snk-crud.entry.js +6 -6
  67. package/dist/esm/snk-data-exporter.entry.js +6 -6
  68. package/dist/esm/{snk-data-unit-0fdfb6c2.js → snk-data-unit-618e0b80.js} +1 -1
  69. package/dist/esm/snk-data-unit.entry.js +3 -3
  70. package/dist/esm/snk-detail-view.entry.js +8 -8
  71. package/dist/esm/snk-field-config.entry.js +1 -1
  72. package/dist/esm/{snk-filter-bar.entry.js → snk-filter-bar_4.entry.js} +687 -5
  73. package/dist/esm/snk-filter-modal-item.entry.js +3 -3
  74. package/dist/esm/snk-grid.entry.js +6 -6
  75. package/dist/esm/{snk-guides-viewer-8934c537.js → snk-guides-viewer-15c916a3.js} +9 -6
  76. package/dist/esm/snk-guides-viewer.entry.js +8 -8
  77. package/dist/esm/snk-personalized-filter.entry.js +3 -3
  78. package/dist/esm/snk-simple-crud.entry.js +11 -9
  79. package/dist/esm/snk-tab-config.entry.js +1 -1
  80. package/dist/sankhyablocks/{p-f3434fc4.js → p-00278e07.js} +1 -1
  81. package/dist/sankhyablocks/{p-06421fdb.js → p-126c58ea.js} +1 -1
  82. package/dist/sankhyablocks/{p-a75d242d.entry.js → p-1dbd5c18.entry.js} +1 -1
  83. package/dist/sankhyablocks/{p-8eb67fa4.entry.js → p-2d3f9482.entry.js} +1 -1
  84. package/dist/sankhyablocks/{p-1bf06cd3.js → p-341465ce.js} +2 -2
  85. package/dist/sankhyablocks/p-3858a2e4.entry.js +1 -0
  86. package/dist/sankhyablocks/{p-7663f597.entry.js → p-41793e17.entry.js} +1 -1
  87. package/dist/sankhyablocks/{p-7ac7932c.js → p-47d24ac8.js} +2 -2
  88. package/dist/sankhyablocks/{p-eb9f0407.entry.js → p-563b7c28.entry.js} +1 -1
  89. package/dist/sankhyablocks/{p-95df461f.entry.js → p-8b4fc28f.entry.js} +1 -1
  90. package/dist/sankhyablocks/{p-b0ef4383.js → p-95ce311a.js} +1 -1
  91. package/dist/sankhyablocks/{p-430e4d3c.entry.js → p-9c3138f5.entry.js} +1 -1
  92. package/dist/sankhyablocks/{p-4d9549cf.js → p-9ffd9fc7.js} +1 -1
  93. package/dist/sankhyablocks/p-a0ebd886.js +1 -0
  94. package/dist/sankhyablocks/{p-dcead955.entry.js → p-a2c790ac.entry.js} +1 -1
  95. package/dist/sankhyablocks/{p-5dd8cf4f.js → p-a75e9dcc.js} +1 -1
  96. package/dist/sankhyablocks/{p-212213d9.entry.js → p-aa003d4e.entry.js} +1 -1
  97. package/dist/sankhyablocks/p-aaf94476.js +1 -0
  98. package/dist/sankhyablocks/{p-16869f77.js → p-ae50d69f.js} +1 -1
  99. package/dist/sankhyablocks/p-bab79110.entry.js +1 -0
  100. package/dist/sankhyablocks/{p-b9c67e45.entry.js → p-c1adf0dd.entry.js} +1 -1
  101. package/dist/sankhyablocks/p-c88ad28e.entry.js +1 -0
  102. package/dist/sankhyablocks/p-d1da52e1.entry.js +1 -0
  103. package/dist/sankhyablocks/p-da87e42c.entry.js +11 -0
  104. package/dist/sankhyablocks/{p-be5d8fcb.entry.js → p-e41bd8ee.entry.js} +1 -1
  105. package/dist/sankhyablocks/p-e4391e16.js +1 -0
  106. package/dist/sankhyablocks/{p-92eadb1c.entry.js → p-f0aaad2b.entry.js} +1 -1
  107. package/dist/sankhyablocks/{p-fb34e0cf.entry.js → p-fca0e5cc.entry.js} +1 -1
  108. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  109. package/dist/types/components/snk-application/request-listener/DebouncedRequestListener.d.ts +11 -0
  110. package/dist/types/components/snk-application/request-listener/RequestListenerFactory.d.ts +12 -0
  111. package/dist/types/components/snk-application/request-listener/RequestListenerLoadingBar.d.ts +13 -0
  112. package/dist/types/components/snk-application/snk-application.d.ts +3 -12
  113. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +1 -0
  114. package/dist/types/lib/utils/CrudUtils.d.ts +1 -0
  115. package/package.json +3 -2
  116. package/dist/cjs/snk-config-options.cjs.entry.js +0 -239
  117. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -312
  118. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -152
  119. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -249
  120. package/dist/cjs/snk-form.cjs.entry.js +0 -144
  121. package/dist/esm/snk-config-options.entry.js +0 -235
  122. package/dist/esm/snk-filter-item.entry.js +0 -308
  123. package/dist/esm/snk-filter-list.entry.js +0 -148
  124. package/dist/esm/snk-filter-modal.entry.js +0 -245
  125. package/dist/esm/snk-form.entry.js +0 -140
  126. package/dist/sankhyablocks/p-01086ff7.entry.js +0 -1
  127. package/dist/sankhyablocks/p-2923c1b5.js +0 -1
  128. package/dist/sankhyablocks/p-3b60db06.entry.js +0 -1
  129. package/dist/sankhyablocks/p-49f1c9be.entry.js +0 -1
  130. package/dist/sankhyablocks/p-60b29483.entry.js +0 -1
  131. package/dist/sankhyablocks/p-70a4af56.entry.js +0 -1
  132. package/dist/sankhyablocks/p-a42e7a1e.entry.js +0 -11
  133. package/dist/sankhyablocks/p-afbb070d.js +0 -1
  134. package/dist/sankhyablocks/p-b9679243.entry.js +0 -1
  135. package/dist/sankhyablocks/p-ca5ec380.js +0 -1
  136. package/dist/sankhyablocks/p-d3f53df2.entry.js +0 -1
  137. package/dist/sankhyablocks/p-e8763234.entry.js +0 -1
  138. package/dist/sankhyablocks/p-feba9d4b.entry.js +0 -1
@@ -1,235 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
- import { UserInterface, ObjectUtils, StringUtils, ApplicationContext, ElementIDUtils } 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 { V as VARS_BY_TYPE, D as DEFAULT_TYPE, b as TAGS_BY_TYPE } from './constants-8457af36.js';
6
-
7
- const snkConfigOptionsCss = ".sc-snk-config-options-h{--snk-config-options--border:2px solid var(--color--secondary-200, #D2D3DA);width:100%;border-radius:15px;border:var(--snk-config-options--border)}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";
8
-
9
- const SnkConfigOptions = class {
10
- constructor(hostRef) {
11
- registerInstance(this, hostRef);
12
- this.configOptionsChanged = createEvent(this, "configOptionsChanged", 7);
13
- this._defaultType = undefined;
14
- this.fieldConfig = {};
15
- this.idConfig = undefined;
16
- this.dataUnit = undefined;
17
- this.messagesBuilder = undefined;
18
- }
19
- onConfigDefault(optionSelected) {
20
- if (optionSelected != undefined) {
21
- this._defaultType = optionSelected;
22
- this.fieldConfig.defaultValue = {
23
- type: this._defaultType
24
- };
25
- this.configOptionsChanged.emit(this.fieldConfig);
26
- }
27
- }
28
- buildOptions() {
29
- var _a, _b, _c;
30
- let 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;
31
- if (interfaceField === UserInterface.SEARCH) {
32
- interfaceField = UserInterface.INTEGERNUMBER;
33
- }
34
- return VARS_BY_TYPE.UserInterface[interfaceField];
35
- }
36
- enabledValueDefault() {
37
- var _a, _b, _c;
38
- const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
39
- const allowDefault = (_c = field === null || field === void 0 ? void 0 : field.properties) === null || _c === void 0 ? void 0 : _c.allowDefault;
40
- const hasVariableVar = VARS_BY_TYPE.UserInterface.hasOwnProperty(field === null || field === void 0 ? void 0 : field.userInterface)
41
- || (field === null || field === void 0 ? void 0 : field.userInterface) === UserInterface.SEARCH;
42
- if ((allowDefault == undefined || allowDefault === "true") && hasVariableVar) {
43
- return true;
44
- }
45
- return false;
46
- }
47
- isAllowDefault() {
48
- var _a, _b;
49
- const allowDefault = (_b = (_a = this._fieldProperties) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.allowDefault;
50
- if (allowDefault == undefined) {
51
- return true;
52
- }
53
- return allowDefault === "true";
54
- }
55
- loadDefaultValue() {
56
- var _a;
57
- if (this.fieldConfig == undefined) {
58
- this._defaultType = DEFAULT_TYPE.fixed;
59
- this.fieldConfig = {
60
- defaultValue: {
61
- type: this._defaultType
62
- }
63
- };
64
- }
65
- else if (((_a = this.fieldConfig.defaultValue) === null || _a === void 0 ? void 0 : _a.type) == undefined) {
66
- this._defaultType = DEFAULT_TYPE.fixed;
67
- this.fieldConfig.defaultValue = {
68
- type: this._defaultType
69
- };
70
- }
71
- else {
72
- this._defaultType = this.fieldConfig.defaultValue.type;
73
- }
74
- }
75
- getFieldProperties(field) {
76
- var _a;
77
- if (field != undefined) {
78
- return (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField(field);
79
- }
80
- }
81
- getMessage(key, params) {
82
- return this.messagesBuilder.getMessage(key, params);
83
- }
84
- getDefaultType() {
85
- var _a;
86
- return (_a = this.fieldConfig.defaultValue.type) !== null && _a !== void 0 ? _a : DEFAULT_TYPE.fixed;
87
- }
88
- getEnabledByProperty(attribName, propertyName) {
89
- const fieldDescriptor = this._fieldProperties;
90
- if (fieldDescriptor == undefined) {
91
- return true;
92
- }
93
- const fieldProperties = fieldDescriptor.properties || {};
94
- return fieldProperties.hasOwnProperty(propertyName) ? fieldProperties[propertyName] !== "S" : fieldDescriptor[attribName] !== true;
95
- }
96
- getValueByProperty(property) {
97
- const properties = this._fieldProperties;
98
- if (properties != undefined && properties[property] === true) {
99
- return true;
100
- }
101
- return this.fieldConfig[property];
102
- }
103
- getValidatedValue(fieldValue) {
104
- var _a, _b;
105
- if (fieldValue == undefined) {
106
- return;
107
- }
108
- const field = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.getField((_b = this.fieldConfig) === null || _b === void 0 ? void 0 : _b.name);
109
- const dataType = field === null || field === void 0 ? void 0 : field.dataType;
110
- if (dataType == undefined) {
111
- return;
112
- }
113
- const value = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.waitmessage) != undefined ? undefined :
114
- dataType !== DataType.OBJECT && dataType !== DataType.DATE
115
- && typeof fieldValue === "object"
116
- ? fieldValue.value
117
- : fieldValue;
118
- return dataType === DataType.OBJECT ? JSON.stringify(value) : value;
119
- }
120
- buildInputDefault({ value, enabled, label, name, required, userInterface }, properties = undefined, mode = undefined) {
121
- let options;
122
- let precision = 0;
123
- let prettyPrecision = 0;
124
- const TagName = userInterface == undefined || TAGS_BY_TYPE[userInterface] == undefined
125
- ? TAGS_BY_TYPE.DEFAULT
126
- : TAGS_BY_TYPE[userInterface];
127
- if (userInterface === UserInterface.OPTIONSELECTOR) {
128
- const prop = properties === null || properties === void 0 ? void 0 : properties.options;
129
- if (typeof prop === "string") {
130
- const parsed = ObjectUtils.stringToObject(prop);
131
- options = Object.keys(parsed).map(key => { return { value: key, label: parsed[key] }; });
132
- }
133
- else {
134
- options = prop;
135
- }
136
- }
137
- else if (userInterface === UserInterface.DECIMALNUMBER) {
138
- precision = Number((properties === null || properties === void 0 ? void 0 : properties.precision) || 2);
139
- prettyPrecision = Number((properties === null || properties === void 0 ? void 0 : properties.prettyPrecision) || precision);
140
- }
141
- 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))));
142
- }
143
- getConditionalAttributes(userInterface, required, options, precision, prettyPrecision, mode) {
144
- switch (userInterface) {
145
- case UserInterface.SEARCH:
146
- return {
147
- suppressEmptyOption: required,
148
- optionLoader: (searchArgument) => this.onSearch(searchArgument)
149
- };
150
- case UserInterface.OPTIONSELECTOR:
151
- return {
152
- suppressEmptyOption: required,
153
- options
154
- };
155
- case UserInterface.CHECKBOX:
156
- case UserInterface.SWITCH:
157
- return {
158
- mode
159
- };
160
- case UserInterface.INTEGERNUMBER:
161
- case UserInterface.DECIMALNUMBER:
162
- return {
163
- precision,
164
- prettyPrecision,
165
- onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
166
- };
167
- case UserInterface.DATE:
168
- case UserInterface.DATETIME:
169
- case UserInterface.TIME:
170
- return {
171
- onEzStartChange: (evt) => this.onChange(evt === null || evt === void 0 ? void 0 : evt.detail)
172
- };
173
- default:
174
- return {};
175
- }
176
- }
177
- onChange(fieldValue) {
178
- this.fieldConfig.defaultValue.value = this.getValidatedValue(fieldValue);
179
- this.configOptionsChanged.emit(this.fieldConfig);
180
- }
181
- onSearch(searchArgument) {
182
- if (this._application != undefined && this.fieldConfig != undefined) {
183
- return this._application.executeSearch(searchArgument, this.fieldConfig.name, this.dataUnit);
184
- }
185
- }
186
- buildField(descriptor, config) {
187
- const { name, label, readOnly, required, defaultValue } = config;
188
- const { userInterface, properties } = descriptor;
189
- const allowDefault = properties === null || properties === void 0 ? void 0 : properties.allowDefault;
190
- let value;
191
- let enabled = StringUtils.getBooleanValue(allowDefault, !readOnly);
192
- if (userInterface === UserInterface.FILE) {
193
- enabled = false;
194
- }
195
- if (enabled) {
196
- value = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value;
197
- if (value != undefined) {
198
- value = getConvertedValue(descriptor === null || descriptor === void 0 ? void 0 : descriptor.dataType, value);
199
- }
200
- }
201
- const configField = { value, enabled, label, name, required, userInterface };
202
- switch (userInterface) {
203
- case UserInterface.SWITCH:
204
- return this.buildInputDefault(configField, undefined, CheckMode.SWITCH);
205
- case UserInterface.CHECKBOX:
206
- return this.buildInputDefault(configField, undefined, CheckMode.REGULAR);
207
- case UserInterface.OPTIONSELECTOR:
208
- case UserInterface.DECIMALNUMBER:
209
- return this.buildInputDefault(configField, properties);
210
- default:
211
- return this.buildInputDefault(configField);
212
- }
213
- }
214
- componentWillLoad() {
215
- var _a;
216
- this.loadDefaultValue();
217
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
218
- this._fieldProperties = this.getFieldProperties((_a = this.fieldConfig) === null || _a === void 0 ? void 0 : _a.name);
219
- }
220
- componentDidLoad() {
221
- ElementIDUtils.addIDInfo(this._element, this.fieldConfig.name);
222
- }
223
- render() {
224
- var _a, _b;
225
- 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 ?
226
- 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() })
227
- :
228
- ((_b = this._fieldProperties) === null || _b === void 0 ? void 0 : _b.userInterface) &&
229
- this.buildField(this._fieldProperties, this.fieldConfig))), 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", "systemRequired"), 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", "systemReadOnly"), value: this.getValueByProperty("readOnly"), onEzChange: (evt) => { this.fieldConfig.readOnly = evt.detail; this.configOptionsChanged.emit(this.fieldConfig); } }))))));
230
- }
231
- get _element() { return getElement(this); }
232
- };
233
- SnkConfigOptions.style = snkConfigOptionsCss;
234
-
235
- export { SnkConfigOptions as snk_config_options };
@@ -1,308 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a7d3d3f1.js';
2
- import { FloatingManager, DateUtils, ElementIDUtils } from '@sankhyalabs/core';
3
- import { F as FilterItemType } from './filter-item-type.enum-d45e026f.js';
4
- import { F as FilterNumberVariation } from './filterNumberVariation-8cee02ea.js';
5
-
6
- const SnkFilterItem = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.visibleChanged = createEvent(this, "visibleChanged", 7);
10
- this.filterChange = createEvent(this, "filterChange", 3);
11
- this.innerClickCheck = (_floatingContainer, node) => {
12
- if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
13
- return true;
14
- }
15
- this.detailIsVisible = false;
16
- return false;
17
- };
18
- this.detailIsVisible = undefined;
19
- this.config = undefined;
20
- this.getMessage = undefined;
21
- this.showChips = true;
22
- }
23
- observeDetailIsVisible(value) {
24
- this.visibleChanged.emit(value);
25
- }
26
- /**
27
- * Exibe os detalhes de um item da lista.
28
- */
29
- async showUp(open = false) {
30
- return new Promise(resolve => {
31
- this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
32
- if (open) {
33
- this._closeCallback = resolve;
34
- window.requestAnimationFrame(() => {
35
- this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, this.getFloatOptions());
36
- this._popover.show();
37
- this.detailIsVisible = true;
38
- });
39
- }
40
- });
41
- }
42
- updatePosition() {
43
- if (this._floatingID == undefined) {
44
- return;
45
- }
46
- FloatingManager.updateFloatPosition(this._popover, this._popoverContainer, this.getFloatOptions());
47
- }
48
- getFloatOptions() {
49
- return {
50
- autoClose: true,
51
- innerClickTest: this.innerClickCheck,
52
- backClickListener: () => this.onDetailCloseCallback(),
53
- left: this.getOffsetLeft(),
54
- top: this.getOffsetTop(),
55
- useOverlay: true,
56
- overlayClassName: 'ez-scrim ez-scrim--light',
57
- isFixed: true
58
- };
59
- }
60
- getOffsetLeft() {
61
- const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
62
- const rect = this._filterItemElement.getBoundingClientRect();
63
- // Width baseado no conteudo do snk-filter-detail. Nesse momento ele retorna 0px pois ainda não foi criado em tela.
64
- const filterDetailWidth = 430;
65
- const adjustRightPosition = filterDetailWidth - (document.body.clientWidth - rect.left);
66
- return `calc(${rect.x}px + ${padding} - ${adjustRightPosition > 0 ? adjustRightPosition : 0}px)`;
67
- }
68
- getOffsetTop() {
69
- const rect = this._filterItemElement.getBoundingClientRect();
70
- return (rect.y + rect.height) + "px";
71
- }
72
- controlScrollPage() {
73
- window.removeEventListener("scroll", this.updatePosition.bind(this));
74
- window.addEventListener("scroll", this.updatePosition.bind(this));
75
- }
76
- getConfigChanges() {
77
- var _a;
78
- const configToBeCleared = this.config;
79
- if (!!((_a = configToBeCleared.groupedItems) === null || _a === void 0 ? void 0 : _a.length)) {
80
- configToBeCleared.visible = false;
81
- configToBeCleared.groupedItems = configToBeCleared.groupedItems.map(item => (Object.assign(Object.assign({}, item), { visible: false })));
82
- }
83
- const hasMultiValues = configToBeCleared.type === FilterItemType.MULTI_LIST && Array.isArray(configToBeCleared.value);
84
- const newValue = hasMultiValues ? configToBeCleared.value.map((valueItem) => (Object.assign(Object.assign({}, valueItem), { check: false }))) : undefined;
85
- return Object.assign(Object.assign({}, configToBeCleared), { value: newValue });
86
- }
87
- /**
88
- * Oculta os detalhes de um item da lista.
89
- */
90
- async hideDetail() {
91
- if (this.detailIsVisible) {
92
- if (this._floatingID != undefined) {
93
- FloatingManager.close(this._floatingID);
94
- }
95
- }
96
- }
97
- onDetailCloseCallback() {
98
- this._floatingID = undefined;
99
- this.detailIsVisible = false;
100
- if (this._closeCallback) {
101
- this._closeCallback();
102
- this._closeCallback = undefined;
103
- }
104
- }
105
- //---------------------------------------------
106
- // Event handlers
107
- //---------------------------------------------
108
- clickListener(evt) {
109
- if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
110
- if (evt.target === this._rightIconElement && this.canClearFilter()) {
111
- const configChanged = this.getConfigChanges();
112
- this.filterChange.emit(configChanged);
113
- }
114
- else {
115
- if (this.detailIsVisible) {
116
- this.hideDetail();
117
- }
118
- else {
119
- this.showUp(true);
120
- }
121
- }
122
- evt.preventDefault();
123
- evt.stopImmediatePropagation();
124
- evt.stopPropagation();
125
- }
126
- }
127
- mouseDownListener(evt) {
128
- if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
129
- evt.preventDefault();
130
- evt.stopImmediatePropagation();
131
- evt.stopPropagation();
132
- }
133
- }
134
- getLabel(isTooltipLabel = false) {
135
- var _a, _b;
136
- const { type, value, label, props, groupedItems = [] } = this.config;
137
- if (value || groupedItems.length) {
138
- if (type === FilterItemType.BINARY_SELECT) {
139
- const [optOne, optTwo] = props.options;
140
- const tooltip = this.getMessage('snkFilterBar.binarySelectTooltip');
141
- if (optOne.name === value) {
142
- return isTooltipLabel ? `${tooltip} ${String(optOne.label).toLowerCase()}` : optOne.label;
143
- }
144
- if (optTwo.name === value) {
145
- return isTooltipLabel ? `${tooltip} ${String(optTwo.label).toLowerCase()}` : optTwo.label;
146
- }
147
- }
148
- if (type === FilterItemType.MULTI_SELECT) {
149
- const opt = props.options.find(opt => opt.value === value);
150
- return `${label}: ${opt.label}`;
151
- }
152
- if (type === FilterItemType.PERIOD) {
153
- let { end, start } = value;
154
- if (typeof end === "string") {
155
- end = new Date(end);
156
- end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
157
- }
158
- if (typeof start === "string") {
159
- start = new Date(start);
160
- start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
161
- }
162
- const dateFormater = new Intl.DateTimeFormat("pt-BR");
163
- if (end && start) {
164
- const isSameYear = start.getFullYear() === end.getFullYear();
165
- const formatOptions = Object.assign({ day: '2-digit', month: '2-digit' }, ((!isSameYear || isTooltipLabel) && { year: '2-digit' }));
166
- const startLabel = DateUtils.formatDate(start, formatOptions);
167
- const endLabel = DateUtils.formatDate(end, formatOptions);
168
- if (isTooltipLabel) {
169
- return this.getMessage('snkFilterBar.fullPeriodTooltip', { LABEL: label, START_LABEL: startLabel, END_LABEL: endLabel });
170
- }
171
- return `${label}: ${startLabel} \u2192 ${endLabel}`;
172
- }
173
- else {
174
- if (start) {
175
- return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${dateFormater.format(start)}`;
176
- }
177
- else if (end) {
178
- return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${dateFormater.format(end)}`;
179
- }
180
- else {
181
- return label;
182
- }
183
- }
184
- }
185
- if (type === FilterItemType.SEARCH) {
186
- return `${label}: ${value.value} - ${value.label}`;
187
- }
188
- if (type === FilterItemType.PERSONALIZED) {
189
- const activeCount = this.calculateActiveCount(groupedItems);
190
- if (activeCount <= 0)
191
- return label;
192
- return `${label}: ${this.getMessage('snkFilterBar.personalizedCount', { activeCount })}`;
193
- }
194
- if (type === FilterItemType.MULTI_LIST) {
195
- const selectedOptions = ((_a = value.elements) !== null && _a !== void 0 ? _a : value).filter(item => item === null || item === void 0 ? void 0 : item.check);
196
- return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
197
- }
198
- if (type === FilterItemType.CHECK_BOX_LIST) {
199
- const selectedValues = Object.entries(value !== null && value !== void 0 ? value : {})
200
- .filter(([_, value]) => value === true)
201
- .map(([key, _]) => key);
202
- const options = (_b = props.options) !== null && _b !== void 0 ? _b : [];
203
- const selectedOptions = options.filter(option => selectedValues.includes(option.name));
204
- return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
205
- }
206
- if (type === FilterItemType.NUMBER && props.variation === FilterNumberVariation.INTERVAL) {
207
- const { start, end } = value;
208
- if (start && end) {
209
- return this.getMessage('snkFilterBar.fullIntervalTooltip', { LABEL: label, START_LABEL: start, END_LABEL: end });
210
- }
211
- if (start) {
212
- return `${label}: ${this.getMessage('snkFilterBar.onlyStartToltip')} ${Number(start)}`;
213
- }
214
- if (end) {
215
- return `${label}: ${this.getMessage('snkFilterBar.onlyEndToltip')} ${Number(end)}`;
216
- }
217
- }
218
- return `${label}: ${value}`;
219
- }
220
- return label;
221
- }
222
- getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel) {
223
- const checkedAmount = selectedOptions.length;
224
- if (checkedAmount === 0) {
225
- return `${label}`;
226
- }
227
- if (checkedAmount > 1) {
228
- if (isTooltipLabel) {
229
- const selectedOptionsDescrptions = selectedOptions.map(item => item.label);
230
- return `${label}: ${selectedOptionsDescrptions.join(',')}`;
231
- }
232
- return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
233
- }
234
- return `${label}: ${selectedOptions[0].label}`;
235
- }
236
- calculateActiveCount(groupedItems) {
237
- return groupedItems.reduce((total, item) => {
238
- if (!!item.visible)
239
- return total + 1;
240
- return total;
241
- }, 0);
242
- }
243
- componentDidLoad() {
244
- if (this._filterItemElement) {
245
- ElementIDUtils.addIDInfo(this._filterItemElement);
246
- this._idSnkFilterDetail = `filterDetail_${this.config.id}`;
247
- }
248
- this.controlScrollPage();
249
- }
250
- componentDidRender() {
251
- if (this._floatingID == undefined) {
252
- if (this._popover) {
253
- this._popover.remove();
254
- }
255
- }
256
- }
257
- /**
258
- * Emitido quando o estado do filtro é alterado.
259
- */
260
- filterChangeListener() {
261
- this.hideDetail();
262
- }
263
- canClearFilter() {
264
- const { value, groupedItems = [] } = this.config;
265
- if (value != undefined && this.config.type === FilterItemType.MULTI_LIST) {
266
- return value.some((item) => item.check);
267
- }
268
- return value !== undefined || groupedItems.some(item => item.visible);
269
- }
270
- getRightIconName() {
271
- if (this.canClearFilter())
272
- return "close";
273
- return this.detailIsVisible ? "chevron-up" : "chevron-down";
274
- }
275
- getLeftIconName() {
276
- switch (this.config.type) {
277
- case FilterItemType.PERIOD:
278
- return "calendar";
279
- case FilterItemType.PERSONALIZED:
280
- return "tune";
281
- }
282
- return undefined;
283
- }
284
- hasActiveElements(value) {
285
- var _a, _b, _c;
286
- return ((_c = (_b = ((_a = value === null || value === void 0 ? void 0 : value.elements) !== null && _a !== void 0 ? _a : value)) === null || _b === void 0 ? void 0 : _b.filter(val => val === null || val === void 0 ? void 0 : val.check)) === null || _c === void 0 ? void 0 : _c.length) > 0;
287
- }
288
- hasActiveValue(config) {
289
- return (config.type !== FilterItemType.MULTI_LIST && config.value !== undefined) || this.hasActiveElements(config.value);
290
- }
291
- getEnabledChip() {
292
- if (this.config.type === FilterItemType.PERSONALIZED) {
293
- const { groupedItems = [] } = this.config;
294
- return groupedItems.some(item => item.visible);
295
- }
296
- return this.hasActiveValue(this.config);
297
- }
298
- render() {
299
- const leftIcon = this.getLeftIconName();
300
- return (h(Host, null, this.showChips && (h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.getEnabledChip() }, leftIcon && (h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" })), h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" }))), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small ez-elevation--16", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail, showHardFixed: this.showChips }))));
301
- }
302
- get _filterItemElement() { return getElement(this); }
303
- static get watchers() { return {
304
- "detailIsVisible": ["observeDetailIsVisible"]
305
- }; }
306
- };
307
-
308
- export { SnkFilterItem as snk_filter_item };