@sankhyalabs/sankhyablocks 0.0.0-bugfix-dev-KB-78242.2 → 0.0.0-bugfix-dev-KB-74246.2

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 (106) hide show
  1. package/dist/cjs/{ConfigStorage-f079f5fd.js → ConfigStorage-9b965af9.js} +1 -1
  2. package/dist/cjs/{ContinuousInsertUtils-64e47516.js → ContinuousInsertUtils-42636ac1.js} +2 -2
  3. package/dist/cjs/{SnkFormConfigManager-63369164.js → SnkFormConfigManager-46e90d8d.js} +8 -6
  4. package/dist/cjs/{auth-fetcher-4f853233.js → auth-fetcher-a78242d1.js} +1 -1
  5. package/dist/cjs/{form-config-fetcher-39397ac5.js → form-config-fetcher-91fba2b1.js} +37 -0
  6. package/dist/cjs/index-f9e81701.js +4 -4
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/{pesquisa-fetcher-a9bfeb22.js → pesquisa-fetcher-2ec4811b.js} +3 -0
  9. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  10. package/dist/cjs/{snk-actions-button_4.cjs.entry.js → snk-actions-button_5.cjs.entry.js} +91 -3
  11. package/dist/cjs/snk-application.cjs.entry.js +4 -4
  12. package/dist/cjs/snk-attach.cjs.entry.js +11 -7
  13. package/dist/cjs/snk-config-options_3.cjs.entry.js +3 -3
  14. package/dist/cjs/snk-crud.cjs.entry.js +3 -3
  15. package/dist/cjs/snk-data-exporter.cjs.entry.js +6 -8
  16. package/dist/cjs/snk-detail-view.cjs.entry.js +5 -5
  17. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +5 -3
  18. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +2 -2
  19. package/dist/cjs/snk-grid.cjs.entry.js +4 -4
  20. package/dist/cjs/{snk-guides-viewer-2139481c.js → snk-guides-viewer-7d85e2fb.js} +3 -3
  21. package/dist/cjs/snk-guides-viewer.cjs.entry.js +5 -5
  22. package/dist/cjs/snk-personalized-filter.cjs.entry.js +2 -2
  23. package/dist/cjs/snk-simple-crud.cjs.entry.js +18 -25
  24. package/dist/collection/collection-manifest.json +1 -0
  25. package/dist/collection/components/snk-attach/structure/builder/taskbar-builder.js +8 -4
  26. package/dist/collection/components/snk-data-exporter/exporter-strategy/ClientSideExporterStrategy.js +3 -3
  27. package/dist/collection/components/snk-data-exporter/snk-data-exporter.js +1 -3
  28. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +3 -1
  29. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +6 -4
  30. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +13 -21
  31. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.css +22 -0
  32. package/dist/collection/components/snk-simple-form-config/snk-simple-form-config.js +179 -0
  33. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +41 -4
  34. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +4 -1
  35. package/dist/components/SnkFormConfigManager.js +6 -4
  36. package/dist/components/form-config-fetcher.js +37 -0
  37. package/dist/components/index.d.ts +1 -0
  38. package/dist/components/index.js +1 -0
  39. package/dist/components/pesquisa-fetcher.js +4 -1
  40. package/dist/components/snk-attach2.js +20 -34
  41. package/dist/components/snk-crud.js +61 -55
  42. package/dist/components/snk-data-exporter2.js +4 -6
  43. package/dist/components/snk-detail-view2.js +84 -93
  44. package/dist/components/snk-filter-modal.js +3 -1
  45. package/dist/components/snk-simple-crud2.js +25 -51
  46. package/dist/components/snk-simple-form-config.d.ts +11 -0
  47. package/dist/components/snk-simple-form-config.js +6 -0
  48. package/dist/components/snk-simple-form-config2.js +119 -0
  49. package/dist/esm/{ConfigStorage-6514d66e.js → ConfigStorage-ff99377a.js} +1 -1
  50. package/dist/esm/{ContinuousInsertUtils-b62906f9.js → ContinuousInsertUtils-071e0b6a.js} +2 -2
  51. package/dist/esm/{SnkFormConfigManager-b409c745.js → SnkFormConfigManager-035f2975.js} +8 -6
  52. package/dist/esm/{auth-fetcher-ca5d3a49.js → auth-fetcher-0b78ca31.js} +1 -1
  53. package/dist/esm/{form-config-fetcher-a7d3e277.js → form-config-fetcher-0c2620ef.js} +37 -0
  54. package/dist/esm/index-a7d3d3f1.js +4 -4
  55. package/dist/esm/loader.js +1 -1
  56. package/dist/esm/{pesquisa-fetcher-6bc2e41a.js → pesquisa-fetcher-24e5bba0.js} +4 -1
  57. package/dist/esm/sankhyablocks.js +1 -1
  58. package/dist/esm/{snk-actions-button_4.entry.js → snk-actions-button_5.entry.js} +91 -4
  59. package/dist/esm/snk-application.entry.js +4 -4
  60. package/dist/esm/snk-attach.entry.js +11 -7
  61. package/dist/esm/snk-config-options_3.entry.js +3 -3
  62. package/dist/esm/snk-crud.entry.js +3 -3
  63. package/dist/esm/snk-data-exporter.entry.js +6 -8
  64. package/dist/esm/snk-detail-view.entry.js +5 -5
  65. package/dist/esm/snk-filter-bar_4.entry.js +5 -3
  66. package/dist/esm/snk-filter-modal-item.entry.js +2 -2
  67. package/dist/esm/snk-grid.entry.js +4 -4
  68. package/dist/esm/{snk-guides-viewer-b7ed39eb.js → snk-guides-viewer-2fd50f6b.js} +3 -3
  69. package/dist/esm/snk-guides-viewer.entry.js +5 -5
  70. package/dist/esm/snk-personalized-filter.entry.js +2 -2
  71. package/dist/esm/snk-simple-crud.entry.js +18 -25
  72. package/dist/sankhyablocks/{p-4138da61.entry.js → p-262583c6.entry.js} +1 -1
  73. package/dist/sankhyablocks/p-29643bef.entry.js +1 -0
  74. package/dist/sankhyablocks/{p-fca0e5cc.entry.js → p-35882caf.entry.js} +1 -1
  75. package/dist/sankhyablocks/{p-7075b789.entry.js → p-365d8ed4.entry.js} +1 -1
  76. package/dist/sankhyablocks/{p-5d9788b3.entry.js → p-399e1b74.entry.js} +1 -1
  77. package/dist/sankhyablocks/{p-e97be1c8.js → p-4c5fde50.js} +1 -1
  78. package/dist/sankhyablocks/{p-ec43fcc8.entry.js → p-5136d9f0.entry.js} +1 -1
  79. package/dist/sankhyablocks/{p-1d3ce0d9.entry.js → p-65650e05.entry.js} +1 -1
  80. package/dist/sankhyablocks/p-70ed0b0f.js +1 -0
  81. package/dist/sankhyablocks/{p-9ffd9fc7.js → p-763edad2.js} +1 -1
  82. package/dist/sankhyablocks/p-82274cb0.js +1 -0
  83. package/dist/sankhyablocks/{p-0387d9d7.entry.js → p-8cf0a9fe.entry.js} +1 -1
  84. package/dist/sankhyablocks/p-acca8a69.js +26 -0
  85. package/dist/sankhyablocks/{p-e4391e16.js → p-c271fbf1.js} +1 -1
  86. package/dist/sankhyablocks/{p-a2c790ac.entry.js → p-c629c07a.entry.js} +1 -1
  87. package/dist/sankhyablocks/p-e6683406.js +6 -0
  88. package/dist/sankhyablocks/{p-bb8ef149.entry.js → p-e7067256.entry.js} +1 -1
  89. package/dist/sankhyablocks/{p-aa003d4e.entry.js → p-e9432f45.entry.js} +1 -1
  90. package/dist/sankhyablocks/{p-3728d2aa.entry.js → p-eda55eef.entry.js} +3 -3
  91. package/dist/sankhyablocks/p-ff6c8f52.entry.js +1 -0
  92. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  93. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +2 -3
  94. package/dist/types/components/snk-simple-form-config/snk-simple-form-config.d.ts +33 -0
  95. package/dist/types/components.d.ts +38 -0
  96. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +8 -2
  97. package/package.json +1 -1
  98. package/react/components.d.ts +1 -0
  99. package/react/components.js +1 -0
  100. package/react/components.js.map +1 -1
  101. package/dist/sankhyablocks/p-0e206e62.js +0 -1
  102. package/dist/sankhyablocks/p-126c58ea.js +0 -26
  103. package/dist/sankhyablocks/p-341465ce.js +0 -6
  104. package/dist/sankhyablocks/p-aaf94476.js +0 -1
  105. package/dist/sankhyablocks/p-af7f7b3e.entry.js +0 -1
  106. package/dist/sankhyablocks/p-eb7c9cf4.entry.js +0 -1
@@ -0,0 +1,22 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .config-container {
6
+ display: flex;
7
+ flex-direction: column;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ }
11
+
12
+ .config-lists {
13
+ margin-bottom: 12px;
14
+ }
15
+
16
+ .config-actions {
17
+ display: flex;
18
+ flex-direction: row;
19
+ justify-content: flex-end;
20
+ width: 100%;
21
+ gap: 12px;
22
+ }
@@ -0,0 +1,179 @@
1
+ import { h } from '@stencil/core';
2
+ import { FormConfigFetcher } from '../../lib';
3
+ export class SnkSimpleFormConfig {
4
+ constructor() {
5
+ this._formConfigFetcher = new FormConfigFetcher();
6
+ this.fieldsToSave = [];
7
+ this.dataUnit = undefined;
8
+ this.configName = undefined;
9
+ this.avaliableFields = [];
10
+ this.selectedFields = [];
11
+ }
12
+ /**
13
+ * Responsável por abrir o configurador.
14
+ */
15
+ async show() {
16
+ await this.initializeFormConfig();
17
+ this.ezPopupRef.opened = true;
18
+ }
19
+ ;
20
+ async initializeFormConfig() {
21
+ if (!this.configName)
22
+ return;
23
+ const allFields = this.getAllVisibleFieldsFromDataUnit();
24
+ const displayedFieldNameList = await this.getConfig();
25
+ //Quando não retorna dados, é por quê não existe configuração do usuário salva.
26
+ if (displayedFieldNameList.length === 0) {
27
+ this.avaliableFields = [];
28
+ this.selectedFields = [...allFields];
29
+ this.fieldsToSave = [...this.selectedFields];
30
+ return;
31
+ }
32
+ const selectedFieldsAux = this.sortDisplayedFields(displayedFieldNameList, allFields);
33
+ const avaliableFieldsAux = allFields.filter(field => !displayedFieldNameList.includes(field.id));
34
+ this.avaliableFields = [...avaliableFieldsAux];
35
+ this.selectedFields = [...selectedFieldsAux];
36
+ this.fieldsToSave = [...this.selectedFields];
37
+ }
38
+ async getConfig() {
39
+ const fieldList = await this._formConfigFetcher.fetchSimpleFormConfig(this.configName);
40
+ return [...this.removeDuplicates(fieldList)];
41
+ }
42
+ removeDuplicates(strings) {
43
+ return strings.filter((item, index) => strings.indexOf(item) === index);
44
+ }
45
+ sortDisplayedFields(displayedFieldNameList, allFields) {
46
+ const selectedFieldsAux = [];
47
+ //É preciso garantir a ordem na qual os campos vieram na resposta do fetchSimpleFormConfig.
48
+ displayedFieldNameList.forEach(fieldName => {
49
+ const field = allFields.find(field => field.id === fieldName);
50
+ if (!field)
51
+ return;
52
+ selectedFieldsAux.push(field);
53
+ });
54
+ return selectedFieldsAux;
55
+ }
56
+ getAllVisibleFieldsFromDataUnit() {
57
+ var _a, _b, _c;
58
+ const visibleFields = ((_c = (_b = (_a = this.dataUnit) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : []).filter(field => field.visible);
59
+ return visibleFields.map(field => {
60
+ return { id: field.name, label: field.label };
61
+ });
62
+ }
63
+ close() {
64
+ this.ezPopupRef.opened = false;
65
+ }
66
+ async handleResetConfigs() {
67
+ await this._formConfigFetcher.restoreFormConfig(this.configName);
68
+ await this.initializeFormConfig();
69
+ await this.handleSave();
70
+ }
71
+ handleCancel() {
72
+ this.close();
73
+ }
74
+ async handleSave() {
75
+ const saveList = this.fieldsToSave.map(field => field.id);
76
+ await this._formConfigFetcher.saveSimpleFormConfig(this.configName, saveList);
77
+ this.close();
78
+ this.snkConfigSaved.emit();
79
+ }
80
+ render() {
81
+ return (h("ez-popup", { ref: (ref) => this.ezPopupRef = ref, heightMode: 'auto', size: 'auto', ezTitle: 'Configurar formul\u00E1rio' }, h("div", { class: 'config-container' }, h("div", { class: 'config-lists' }, h("ez-double-list", { leftList: this.avaliableFields, leftTitle: 'Campos disponíveis', rightList: this.selectedFields, rightTitle: 'Campos selecionados', onEzRightListChanged: ({ detail }) => this.fieldsToSave = [...detail], entityLabel: 'campo', entityLabelPlural: 'campos' })), h("div", { class: 'config-actions' }, h("ez-button", { label: 'Restaurar', onClick: this.handleResetConfigs.bind(this), size: 'small' }), h("ez-button", { label: 'Cancelar', onClick: this.handleCancel.bind(this), size: 'small' }), h("ez-button", { label: 'Salvar', class: 'ez-button--primary', onClick: this.handleSave.bind(this), size: 'small' })))));
82
+ }
83
+ static get is() { return "snk-simple-form-config"; }
84
+ static get originalStyleUrls() {
85
+ return {
86
+ "$": ["snk-simple-form-config.css"]
87
+ };
88
+ }
89
+ static get styleUrls() {
90
+ return {
91
+ "$": ["snk-simple-form-config.css"]
92
+ };
93
+ }
94
+ static get properties() {
95
+ return {
96
+ "dataUnit": {
97
+ "type": "unknown",
98
+ "mutable": false,
99
+ "complexType": {
100
+ "original": "DataUnit",
101
+ "resolved": "DataUnit",
102
+ "references": {
103
+ "DataUnit": {
104
+ "location": "import",
105
+ "path": "@sankhyalabs/core"
106
+ }
107
+ }
108
+ },
109
+ "required": false,
110
+ "optional": false,
111
+ "docs": {
112
+ "tags": [],
113
+ "text": "Data unit respons\u00E1vel pelos campos dispon\u00EDveis"
114
+ }
115
+ },
116
+ "configName": {
117
+ "type": "string",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "string",
121
+ "resolved": "string",
122
+ "references": {}
123
+ },
124
+ "required": false,
125
+ "optional": false,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "Chave que representa a configura\u00E7\u00E3o do formul\u00E1rio"
129
+ },
130
+ "attribute": "config-name",
131
+ "reflect": false
132
+ }
133
+ };
134
+ }
135
+ static get states() {
136
+ return {
137
+ "avaliableFields": {},
138
+ "selectedFields": {}
139
+ };
140
+ }
141
+ static get events() {
142
+ return [{
143
+ "method": "snkConfigSaved",
144
+ "name": "snkConfigSaved",
145
+ "bubbles": true,
146
+ "cancelable": true,
147
+ "composed": true,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": ""
151
+ },
152
+ "complexType": {
153
+ "original": "void",
154
+ "resolved": "void",
155
+ "references": {}
156
+ }
157
+ }];
158
+ }
159
+ static get methods() {
160
+ return {
161
+ "show": {
162
+ "complexType": {
163
+ "signature": "() => Promise<void>",
164
+ "parameters": [],
165
+ "references": {
166
+ "Promise": {
167
+ "location": "global"
168
+ }
169
+ },
170
+ "return": "Promise<void>"
171
+ },
172
+ "docs": {
173
+ "text": "Respons\u00E1vel por abrir o configurador.",
174
+ "tags": []
175
+ }
176
+ }
177
+ };
178
+ }
179
+ }
@@ -1,7 +1,7 @@
1
- import { gql } from "graphql-request";
2
- import { ObjectUtils } from "@sankhyalabs/core";
3
- import { ResourceFetcher } from "./resource-fetcher";
4
- import { DataFetcher } from "../DataFetcher";
1
+ import { gql } from 'graphql-request';
2
+ import { ObjectUtils } from '@sankhyalabs/core';
3
+ import { ResourceFetcher } from './resource-fetcher';
4
+ import { DataFetcher } from '../DataFetcher';
5
5
  export class FormConfigFetcher extends ResourceFetcher {
6
6
  constructor() {
7
7
  super();
@@ -178,6 +178,43 @@ export class FormConfigFetcher extends ResourceFetcher {
178
178
  return undefined;
179
179
  return this.buildLegacyConfigurableForm(response);
180
180
  }
181
+ async fetchSimpleFormConfig(configName) {
182
+ const payload = { 'requestBody': { 'formConfig': { 'configName': configName } } };
183
+ const response = await DataFetcher.get().callServiceBroker('FormConfig.getFormConfig', JSON.stringify(payload));
184
+ return this.processConfig(response);
185
+ }
186
+ async saveSimpleFormConfig(configName, fieldList) {
187
+ const payload = this.buildSaveSimpleFormConfigPayload(configName, fieldList);
188
+ const response = await DataFetcher.get().callServiceBroker('FormConfig.saveFormConfig', JSON.stringify(payload));
189
+ this.processConfig(response);
190
+ }
191
+ processConfig(response) {
192
+ if (ObjectUtils.isEmpty(response))
193
+ return [];
194
+ const fields = this.getResponseAsArray(response);
195
+ return fields.map(field => field.name);
196
+ }
197
+ getResponseAsArray(response) {
198
+ var _a, _b, _c;
199
+ const rawFields = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
200
+ return Array.isArray(rawFields) ? rawFields : [rawFields];
201
+ }
202
+ buildSaveSimpleFormConfigPayload(configName, fieldNameList) {
203
+ const fieldList = fieldNameList.map(fieldName => { return { name: fieldName }; });
204
+ return {
205
+ formConfig: {
206
+ configName,
207
+ layout: {
208
+ field: fieldList,
209
+ },
210
+ metadata: { field: [] },
211
+ }
212
+ };
213
+ }
214
+ async restoreFormConfig(configName) {
215
+ const payload = { 'requestBody': { 'formConfig': { 'configName': configName } } };
216
+ await DataFetcher.get().callServiceBroker('FormConfig.restoreFormConfig', JSON.stringify(payload));
217
+ }
181
218
  buildLegacyConfigurableForm(config) {
182
219
  var _a, _b, _c;
183
220
  const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, DataType } from "@sankhyalabs/core";
1
+ import { ApplicationContext, DataType, ErrorException } from "@sankhyalabs/core";
2
2
  import { gql } from "graphql-request";
3
3
  import { DataFetcher } from "../DataFetcher";
4
4
  export class PesquisaFetcher {
@@ -73,6 +73,9 @@ export class PesquisaFetcher {
73
73
  value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
74
74
  }
75
75
  }
76
+ if (param.dataType === DataType.NUMBER && value === undefined) {
77
+ throw new ErrorException("Falha detectada", `O campo ${param.name} deve ser informado.`);
78
+ }
76
79
  let type = param.dataType;
77
80
  if (type === DataType.OBJECT) {
78
81
  value = value.value;
@@ -88,13 +88,15 @@ class SnkFormConfigManager {
88
88
  const fields = (_a = this._config) === null || _a === void 0 ? void 0 : _a.fields;
89
89
  const hasConfig = this.hasConfig();
90
90
  if (hasConfig && !forceEmptyConfig) {
91
- return fields.map(({ label, name, readOnly, visible, required, tab }) => {
91
+ return fields.map(({ label, name, readOnly, visible, required, tab, group }) => {
92
92
  var _a;
93
93
  if (label == undefined) {
94
94
  const currentField = (_a = this._dataUnit) === null || _a === void 0 ? void 0 : _a.getField(name);
95
- return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab });
95
+ if (!currentField)
96
+ return;
97
+ return Object.assign(Object.assign({}, currentField), { name: name !== null && name !== void 0 ? name : currentField.name, readOnly: readOnly !== null && readOnly !== void 0 ? readOnly : currentField.readOnly, visible: visible !== null && visible !== void 0 ? visible : currentField.visible, required: required !== null && required !== void 0 ? required : currentField.required, tab: tab, group: group });
96
98
  }
97
- return { name, label, readOnly, visible, required, tab };
99
+ return { name, label, readOnly, visible, required, tab, group };
98
100
  })
99
101
  .filter(field => this.isFieldVisible(field, descriptionFilter));
100
102
  }
@@ -107,7 +109,7 @@ class SnkFormConfigManager {
107
109
  return filteredFields;
108
110
  }
109
111
  isFieldVisible(field, descriptionFilter) {
110
- if (field.visible === false) {
112
+ if (field === undefined || field.visible === false) {
111
113
  return false;
112
114
  }
113
115
  if (descriptionFilter == undefined) {
@@ -240,6 +240,43 @@ class FormConfigFetcher extends ResourceFetcher {
240
240
  return undefined;
241
241
  return this.buildLegacyConfigurableForm(response);
242
242
  }
243
+ async fetchSimpleFormConfig(configName) {
244
+ const payload = { 'requestBody': { 'formConfig': { 'configName': configName } } };
245
+ const response = await DataFetcher.get().callServiceBroker('FormConfig.getFormConfig', JSON.stringify(payload));
246
+ return this.processConfig(response);
247
+ }
248
+ async saveSimpleFormConfig(configName, fieldList) {
249
+ const payload = this.buildSaveSimpleFormConfigPayload(configName, fieldList);
250
+ const response = await DataFetcher.get().callServiceBroker('FormConfig.saveFormConfig', JSON.stringify(payload));
251
+ this.processConfig(response);
252
+ }
253
+ processConfig(response) {
254
+ if (ObjectUtils.isEmpty(response))
255
+ return [];
256
+ const fields = this.getResponseAsArray(response);
257
+ return fields.map(field => field.name);
258
+ }
259
+ getResponseAsArray(response) {
260
+ var _a, _b, _c;
261
+ const rawFields = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
262
+ return Array.isArray(rawFields) ? rawFields : [rawFields];
263
+ }
264
+ buildSaveSimpleFormConfigPayload(configName, fieldNameList) {
265
+ const fieldList = fieldNameList.map(fieldName => { return { name: fieldName }; });
266
+ return {
267
+ formConfig: {
268
+ configName,
269
+ layout: {
270
+ field: fieldList,
271
+ },
272
+ metadata: { field: [] },
273
+ }
274
+ };
275
+ }
276
+ async restoreFormConfig(configName) {
277
+ const payload = { 'requestBody': { 'formConfig': { 'configName': configName } } };
278
+ await DataFetcher.get().callServiceBroker('FormConfig.restoreFormConfig', JSON.stringify(payload));
279
+ }
243
280
  buildLegacyConfigurableForm(config) {
244
281
  var _a, _b, _c;
245
282
  const rawFields = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.formConfig) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.field) !== null && _c !== void 0 ? _c : [];
@@ -47,6 +47,7 @@ export { SnkPrintSelector as SnkPrintSelector } from '../types/components/snk-pr
47
47
  export { SelectBox as SnkSelectBox } from '../types/components/snk-grid-config/snk-select-box/snk-select-box';
48
48
  export { SnkSimpleBar as SnkSimpleBar } from '../types/components/snk-simple-bar/snk-simple-bar';
49
49
  export { SnkSimpleCrud as SnkSimpleCrud } from '../types/components/snk-simple-crud/snk-simple-crud';
50
+ export { SnkSimpleFormConfig as SnkSimpleFormConfig } from '../types/components/snk-simple-form-config/snk-simple-form-config';
50
51
  export { SnkTabConfig as SnkTabConfig } from '../types/components/snk-form-config/subcomponents/snk-tab-config/snk-tab-config';
51
52
  export { SnkTaskbar as SnkTaskbar } from '../types/components/snk-taskbar/snk-taskbar';
52
53
  export { TaskbarActionsButton as TaskbarActionsButton } from '../types/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button';
@@ -47,6 +47,7 @@ export { SnkPrintSelector, defineCustomElement as defineCustomElementSnkPrintSel
47
47
  export { SnkSelectBox, defineCustomElement as defineCustomElementSnkSelectBox } from './snk-select-box.js';
48
48
  export { SnkSimpleBar, defineCustomElement as defineCustomElementSnkSimpleBar } from './snk-simple-bar.js';
49
49
  export { SnkSimpleCrud, defineCustomElement as defineCustomElementSnkSimpleCrud } from './snk-simple-crud.js';
50
+ export { SnkSimpleFormConfig, defineCustomElement as defineCustomElementSnkSimpleFormConfig } from './snk-simple-form-config.js';
50
51
  export { SnkTabConfig, defineCustomElement as defineCustomElementSnkTabConfig } from './snk-tab-config.js';
51
52
  export { SnkTaskbar, defineCustomElement as defineCustomElementSnkTaskbar } from './snk-taskbar.js';
52
53
  export { TaskbarActionsButton, defineCustomElement as defineCustomElementTaskbarActionsButton } from './taskbar-actions-button.js';
@@ -1,4 +1,4 @@
1
- import { DataType, ApplicationContext } from '@sankhyalabs/core';
1
+ import { DataType, ApplicationContext, ErrorException } from '@sankhyalabs/core';
2
2
  import { d as dist, D as DataFetcher } from './DataFetcher.js';
3
3
 
4
4
  class PesquisaFetcher {
@@ -73,6 +73,9 @@ class PesquisaFetcher {
73
73
  value = ApplicationContext.getContextValue(`__SNK__APPLICATION__FILTER__CONTEXT(${match[1]})__`);
74
74
  }
75
75
  }
76
+ if (param.dataType === DataType.NUMBER && value === undefined) {
77
+ throw new ErrorException("Falha detectada", `O campo ${param.name} deve ser informado.`);
78
+ }
76
79
  let type = param.dataType;
77
80
  if (type === DataType.OBJECT) {
78
81
  value = value.value;
@@ -9,19 +9,16 @@ import './form-config-fetcher.js';
9
9
  import { V as VIEW_MODE } from './constants.js';
10
10
  import { A as AutorizationType } from './auth-fetcher.js';
11
11
  import { T as TaskbarElement, d as defineCustomElement$2 } from './snk-taskbar2.js';
12
- import { d as defineCustomElement$f } from './snk-actions-button2.js';
13
- import { d as defineCustomElement$e } from './snk-config-options2.js';
14
- import { d as defineCustomElement$d } from './snk-configurator2.js';
15
- import { d as defineCustomElement$c } from './snk-data-exporter2.js';
16
- import { d as defineCustomElement$b } from './snk-data-unit2.js';
17
- import { d as defineCustomElement$a } from './snk-exporter-email-sender2.js';
18
- import { d as defineCustomElement$9 } from './snk-field-config2.js';
19
- import { d as defineCustomElement$8 } from './snk-form-config2.js';
12
+ import { d as defineCustomElement$c } from './snk-actions-button2.js';
13
+ import { d as defineCustomElement$b } from './snk-configurator2.js';
14
+ import { d as defineCustomElement$a } from './snk-data-exporter2.js';
15
+ import { d as defineCustomElement$9 } from './snk-data-unit2.js';
16
+ import { d as defineCustomElement$8 } from './snk-exporter-email-sender2.js';
20
17
  import { d as defineCustomElement$7 } from './snk-grid-config2.js';
21
18
  import { d as defineCustomElement$6 } from './snk-select-box2.js';
22
19
  import { d as defineCustomElement$5 } from './snk-simple-bar2.js';
23
20
  import { d as defineCustomElement$4 } from './snk-simple-crud2.js';
24
- import { d as defineCustomElement$3 } from './snk-tab-config2.js';
21
+ import { d as defineCustomElement$3 } from './snk-simple-form-config2.js';
25
22
  import { d as defineCustomElement$1 } from './taskbar-actions-button2.js';
26
23
 
27
24
  const SERVICE$1 = {
@@ -557,14 +554,18 @@ const buildTaskBarManager = () => {
557
554
  ];
558
555
  return {
559
556
  getButtons: (_, dataState, currentButtons) => {
560
- if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty))
557
+ const refreshBtnIndex = currentButtons.indexOf(TaskbarElement.REFRESH);
558
+ if ((dataState === null || dataState === void 0 ? void 0 : dataState.insertionMode) || (dataState === null || dataState === void 0 ? void 0 : dataState.isDirty)) {
561
559
  return currentButtons.reverse();
562
- else
563
- currentButtons.splice(currentButtons.indexOf(TaskbarElement.REFRESH), 1);
560
+ }
561
+ else if (refreshBtnIndex !== -1) {
562
+ currentButtons.splice(refreshBtnIndex, 1);
563
+ }
564
564
  const { selectedRecord } = dataState || {};
565
565
  const taskbarTobeAdded = !!(selectedRecord === null || selectedRecord === void 0 ? void 0 : selectedRecord.LINK) ? TaskbarAttachButtons.LINK : TaskbarAttachButtons.DOWNLOAD;
566
566
  currentButtons.splice(currentButtons.indexOf(TaskbarElement.DIVIDER) + 1, 0, TaskbarElement.REMOVE, taskbarTobeAdded, TaskbarElement.DIVIDER);
567
- const updatedButtons = Array.from(new Set(currentButtons.filter(button => button !== TaskbarElement.CLONE)));
567
+ const buttonsToRemove = [TaskbarElement.CLONE, TaskbarElement.DATA_EXPORTER];
568
+ const updatedButtons = Array.from(new Set(currentButtons.filter((button) => !buttonsToRemove.includes(button))));
568
569
  updatedButtons.splice(updatedButtons.indexOf(taskbarTobeAdded) + 1, 0, TaskbarElement.DIVIDER);
569
570
  return updatedButtons;
570
571
  },
@@ -869,7 +870,7 @@ function defineCustomElement() {
869
870
  if (typeof customElements === "undefined") {
870
871
  return;
871
872
  }
872
- const components = ["snk-attach", "snk-actions-button", "snk-config-options", "snk-configurator", "snk-data-exporter", "snk-data-unit", "snk-exporter-email-sender", "snk-field-config", "snk-form-config", "snk-grid-config", "snk-select-box", "snk-simple-bar", "snk-simple-crud", "snk-tab-config", "snk-taskbar", "taskbar-actions-button"];
873
+ const components = ["snk-attach", "snk-actions-button", "snk-configurator", "snk-data-exporter", "snk-data-unit", "snk-exporter-email-sender", "snk-grid-config", "snk-select-box", "snk-simple-bar", "snk-simple-crud", "snk-simple-form-config", "snk-taskbar", "taskbar-actions-button"];
873
874
  components.forEach(tagName => { switch (tagName) {
874
875
  case "snk-attach":
875
876
  if (!customElements.get(tagName)) {
@@ -877,41 +878,26 @@ function defineCustomElement() {
877
878
  }
878
879
  break;
879
880
  case "snk-actions-button":
880
- if (!customElements.get(tagName)) {
881
- defineCustomElement$f();
882
- }
883
- break;
884
- case "snk-config-options":
885
- if (!customElements.get(tagName)) {
886
- defineCustomElement$e();
887
- }
888
- break;
889
- case "snk-configurator":
890
- if (!customElements.get(tagName)) {
891
- defineCustomElement$d();
892
- }
893
- break;
894
- case "snk-data-exporter":
895
881
  if (!customElements.get(tagName)) {
896
882
  defineCustomElement$c();
897
883
  }
898
884
  break;
899
- case "snk-data-unit":
885
+ case "snk-configurator":
900
886
  if (!customElements.get(tagName)) {
901
887
  defineCustomElement$b();
902
888
  }
903
889
  break;
904
- case "snk-exporter-email-sender":
890
+ case "snk-data-exporter":
905
891
  if (!customElements.get(tagName)) {
906
892
  defineCustomElement$a();
907
893
  }
908
894
  break;
909
- case "snk-field-config":
895
+ case "snk-data-unit":
910
896
  if (!customElements.get(tagName)) {
911
897
  defineCustomElement$9();
912
898
  }
913
899
  break;
914
- case "snk-form-config":
900
+ case "snk-exporter-email-sender":
915
901
  if (!customElements.get(tagName)) {
916
902
  defineCustomElement$8();
917
903
  }
@@ -936,7 +922,7 @@ function defineCustomElement() {
936
922
  defineCustomElement$4();
937
923
  }
938
924
  break;
939
- case "snk-tab-config":
925
+ case "snk-simple-form-config":
940
926
  if (!customElements.get(tagName)) {
941
927
  defineCustomElement$3();
942
928
  }