@sankhyalabs/sankhyablocks 3.3.0 → 3.4.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 (90) hide show
  1. package/dist/cjs/{ConfigStorage-8b5e3261.js → ConfigStorage-0a2db8e7.js} +61 -1
  2. package/dist/cjs/{SnkMessageBuilder-424f02f7.js → SnkMessageBuilder-e6dee2c2.js} +21 -1
  3. package/dist/cjs/{index-0e663819.js → index-f400b1d6.js} +34 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  6. package/dist/cjs/snk-application.cjs.entry.js +12 -12
  7. package/dist/cjs/snk-configurator_3.cjs.entry.js +2 -2
  8. package/dist/cjs/snk-crud.cjs.entry.js +2 -2
  9. package/dist/cjs/snk-data-exporter_8.cjs.entry.js +3 -3
  10. package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +3 -2
  12. package/dist/cjs/snk-filter-param-config.cjs.entry.js +255 -0
  13. package/dist/cjs/snk-form-config.cjs.entry.js +1 -1
  14. package/dist/cjs/snk-form.cjs.entry.js +2 -2
  15. package/dist/cjs/{taskbar-elements-d7eb170e.js → taskbar-elements-5e87cf44.js} +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender.js +3 -2
  18. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.js +1 -0
  19. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/ISystemFilterConfig.js +1 -0
  20. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IUserFilterConfig.js +1 -0
  21. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.css +12 -0
  22. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.js +258 -0
  23. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.js +55 -0
  24. package/dist/collection/lib/@types/index.js +34 -0
  25. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +49 -2
  26. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +10 -10
  27. package/dist/collection/lib/http/data-fetcher/interfaces/IClientEventResponse.js +1 -0
  28. package/dist/collection/lib/http/data-fetcher/recaller/DataFetcherRecaller.js +14 -0
  29. package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
  30. package/dist/collection/lib/message/resources/snk-filter-param-config.msg.js +18 -0
  31. package/dist/components/DataFetcher.js +62 -2
  32. package/dist/components/SnkMessageBuilder.js +21 -1
  33. package/dist/components/index.d.ts +1 -0
  34. package/dist/components/index.js +1 -0
  35. package/dist/{esm/index-1564817d.js → components/index2.js} +35 -1
  36. package/dist/components/snk-application2.js +10 -10
  37. package/dist/components/snk-crud.js +2 -1
  38. package/dist/components/snk-data-exporter2.js +2 -33
  39. package/dist/components/snk-exporter-email-sender2.js +3 -2
  40. package/dist/components/snk-filter-param-config.d.ts +11 -0
  41. package/dist/components/snk-filter-param-config.js +276 -0
  42. package/dist/components/snk-form2.js +2 -1
  43. package/dist/components/snk-grid2.js +2 -1
  44. package/dist/components/snk-taskbar2.js +2 -1
  45. package/dist/esm/{ConfigStorage-4654f57b.js → ConfigStorage-f9eaa4bc.js} +62 -2
  46. package/dist/esm/{SnkMessageBuilder-64821b88.js → SnkMessageBuilder-f0d50bd6.js} +21 -1
  47. package/dist/esm/index-bd13bdcf.js +67 -0
  48. package/dist/esm/loader.js +1 -1
  49. package/dist/esm/sankhyablocks.js +1 -1
  50. package/dist/esm/snk-application.entry.js +12 -12
  51. package/dist/esm/snk-configurator_3.entry.js +2 -2
  52. package/dist/esm/snk-crud.entry.js +2 -2
  53. package/dist/esm/snk-data-exporter_8.entry.js +3 -3
  54. package/dist/esm/snk-data-unit.entry.js +1 -1
  55. package/dist/esm/snk-exporter-email-sender.entry.js +3 -2
  56. package/dist/esm/snk-filter-param-config.entry.js +251 -0
  57. package/dist/esm/snk-form-config.entry.js +1 -1
  58. package/dist/esm/snk-form.entry.js +2 -2
  59. package/dist/esm/{taskbar-elements-dc968d8f.js → taskbar-elements-8400dbe7.js} +1 -1
  60. package/dist/sankhyablocks/p-22e44b9d.entry.js +1 -0
  61. package/dist/sankhyablocks/{p-a22a3a7a.entry.js → p-231da738.entry.js} +4 -4
  62. package/dist/sankhyablocks/{p-554db79e.entry.js → p-24a74ea9.entry.js} +1 -1
  63. package/dist/sankhyablocks/{p-d3fb34cb.js → p-32d02fa4.js} +1 -1
  64. package/dist/sankhyablocks/{p-6878464e.entry.js → p-445ff0af.entry.js} +1 -1
  65. package/dist/sankhyablocks/p-69562bcf.js +1 -0
  66. package/dist/sankhyablocks/{p-71b8562d.entry.js → p-69738f28.entry.js} +1 -1
  67. package/dist/sankhyablocks/{p-31b3217d.entry.js → p-7f195b37.entry.js} +1 -1
  68. package/dist/sankhyablocks/{p-d9c43eca.js → p-93c271e2.js} +1 -1
  69. package/dist/sankhyablocks/{p-afea1284.entry.js → p-943b9c98.entry.js} +1 -1
  70. package/dist/sankhyablocks/{p-93d8ea09.js → p-a0258616.js} +6 -6
  71. package/dist/sankhyablocks/{p-125c2d01.entry.js → p-bb445357.entry.js} +1 -1
  72. package/dist/sankhyablocks/p-c81ced8a.entry.js +1 -0
  73. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  74. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IExpressionItem.d.ts +13 -0
  75. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/ISystemFilterConfig.d.ts +4 -0
  76. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/interfaces/IUserFilterConfig.d.ts +5 -0
  77. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/snk-filter-param-config.d.ts +41 -0
  78. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-param-config/utils/PersonalizedFilterUtils.d.ts +15 -0
  79. package/dist/types/components.d.ts +16 -0
  80. package/dist/types/lib/@types/index.d.ts +30 -0
  81. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +7 -1
  82. package/dist/types/lib/http/data-fetcher/interfaces/IClientEventResponse.d.ts +4 -0
  83. package/dist/types/lib/http/data-fetcher/recaller/DataFetcherRecaller.d.ts +7 -0
  84. package/dist/types/lib/message/resources/snk-filter-param-config.msg.d.ts +1 -0
  85. package/package.json +1 -1
  86. package/react/components.d.ts +1 -0
  87. package/react/components.js +1 -0
  88. package/react/components.js.map +1 -1
  89. package/dist/sankhyablocks/p-5534e08c.js +0 -1
  90. package/dist/sankhyablocks/p-eb08de68.entry.js +0 -1
@@ -1,8 +1,8 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { WaitingChangeException, WarningException, ErrorException, ObjectUtils, DataType, DataUnit, StringUtils, ChangeOperation, DateUtils, DependencyType, ElementIDUtils, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
3
- import { d as dist, D as DataFetcher, R as ResourceFetcher, U as UrlUtils, F as FormConfigFetcher, G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage-4654f57b.js';
3
+ import { d as dist, D as DataFetcher, R as ResourceFetcher, U as UrlUtils, F as FormConfigFetcher, G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage-f9eaa4bc.js';
4
4
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
5
- import { S as SnkMessageBuilder } from './SnkMessageBuilder-64821b88.js';
5
+ import { S as SnkMessageBuilder } from './SnkMessageBuilder-f0d50bd6.js';
6
6
  import './_commonjsHelpers-9943807e.js';
7
7
 
8
8
  class SnkErrorHandler {
@@ -119,19 +119,19 @@ class PesquisaFetcher {
119
119
  })
120
120
  };
121
121
  }
122
+ const options = searchOptions != undefined
123
+ ? {
124
+ "pkFieldName": searchOptions.codeFieldName,
125
+ "label": searchOptions.descriptionFieldName,
126
+ "fieldName": searchOptions.codeFieldName,
127
+ "useDescriptionOptions": false,
128
+ "enableRowsCounter": true
129
+ }
130
+ : undefined;
122
131
  const reqBody = {
123
132
  "serviceName": serviceName,
124
133
  "requestBody": {
125
- "criteria": {
126
- "entityName": entityName,
127
- "compacted": false,
128
- "ignoreEntityCriteria": false,
129
- "limit": this._defaultPageSize,
130
- "query": { "$": argument },
131
- "orderByDesc": false,
132
- "externalCriteria": externalCriteria,
133
- "localEntityName": searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.rootEntity
134
- },
134
+ "criteria": Object.assign({ "entityName": entityName, "compacted": false, "ignoreEntityCriteria": false, "limit": this._defaultPageSize, "query": { "$": argument }, "orderByDesc": false, "externalCriteria": externalCriteria, "localEntityName": searchOptions === null || searchOptions === void 0 ? void 0 : searchOptions.rootEntity }, { options }),
135
135
  "clientEventList": {
136
136
  "clientEvent": []
137
137
  }
@@ -3,8 +3,8 @@ import { ApplicationContext, ElementIDUtils, DataType } from '@sankhyalabs/core'
3
3
  import { c as VIEW_MODE, A as ACTION_CONFIG } from './constants-965d7a7f.js';
4
4
  import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
5
5
  import { UserInterface } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
6
- import { C as ConfigStorage } from './ConfigStorage-4654f57b.js';
7
- import { P as PresentationMode } from './index-1564817d.js';
6
+ import { C as ConfigStorage } from './ConfigStorage-f9eaa4bc.js';
7
+ import { P as PresentationMode } from './index-bd13bdcf.js';
8
8
  import { T as TaskbarProcessor } from './taskbar-processor-c2a99aba.js';
9
9
  import { s as store } from './index-e467ade5.js';
10
10
  import './_commonjsHelpers-9943807e.js';
@@ -1,8 +1,8 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { c as VIEW_MODE } from './constants-965d7a7f.js';
4
- import { T as TaskbarElement } from './taskbar-elements-dc968d8f.js';
5
- import { P as PresentationMode } from './index-1564817d.js';
4
+ import { T as TaskbarElement } from './taskbar-elements-8400dbe7.js';
5
+ import { P as PresentationMode } from './index-bd13bdcf.js';
6
6
  import './index-e467ade5.js';
7
7
 
8
8
  const snkCrudCss = ".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";
@@ -1,16 +1,16 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-cfd4bb13.js';
2
2
  import { ObjectUtils, ApplicationContext, ElementIDUtils, DataType, StringUtils, ErrorException, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType, CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { D as DataExporterOption, a as DataExporterFormat, b as DataExporterType, P as PresentationMode } from './index-1564817d.js';
4
+ import { D as DataExporterOption, d as DataExporterFormat, e as DataExporterType, P as PresentationMode } from './index-bd13bdcf.js';
5
5
  import { d as KEY_PORT_EXPORT, W as WEB_CONNECTION, R as REPORT_LAUNCHER_RESOURCE_ID, O as ORDER_VALUES } from './constants-965d7a7f.js';
6
- import { D as DataFetcher, C as ConfigStorage } from './ConfigStorage-4654f57b.js';
6
+ import { D as DataFetcher, C as ConfigStorage } from './ConfigStorage-f9eaa4bc.js';
7
7
  import { EzScrollDirection } from '@sankhyalabs/ezui/dist/collection/components/ez-scroller/EzScrollDirection';
8
8
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
9
9
  import { ModalAction, ModalButtonStatus } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
10
10
  import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
11
11
  import { CheckMode as CheckMode$1 } from '@sankhyalabs/ezui/dist/collection/components/ez-check/CheckMode';
12
12
  import { A as AuthorizationConfig } from './AuthorizationConfig-dcbd207a.js';
13
- import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-dc968d8f.js';
13
+ import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-8400dbe7.js';
14
14
  import './_commonjsHelpers-9943807e.js';
15
15
  import './index-e467ade5.js';
16
16
 
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-cfd4bb13.js';
2
2
  import { Action, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
4
- import { O as OperationMap } from './SnkMessageBuilder-64821b88.js';
4
+ import { O as OperationMap } from './SnkMessageBuilder-f0d50bd6.js';
5
5
 
6
6
  const snkDataUnitCss = ".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";
7
7
 
@@ -1,5 +1,6 @@
1
1
  import { h, r as registerInstance, g as getElement } from './index-cfd4bb13.js';
2
2
  import { ElementIDUtils } from '@sankhyalabs/core';
3
+ import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
3
4
 
4
5
  const EmailInfoStep = ({ getMessage, changeInfo, data }) => {
5
6
  const { format, email } = data || {};
@@ -116,8 +117,8 @@ const SnkExporterEmailSender = class {
116
117
  }
117
118
  render() {
118
119
  ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkExporterEmailSender');
119
- return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: evt => {
120
- if (evt.detail === "CLOSE")
120
+ return (h("ez-popup", { useHeader: false, size: "x-small", heightMode: "auto", opened: this._opened }, h("ez-modal-container", { onEzModalAction: (evt) => {
121
+ if (evt.detail === ModalAction.CLOSE)
121
122
  this.close();
122
123
  }, modalTitle: this.getMessage("snkExporter.emailSenderTitle"), modalSubTitle: this.getStepMessage("subTitle") }, h("ez-view-stack", { ref: ref => this._viewStack = ref }, h("stack-item", null, h(OptionsStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateConfigInfo(field, value) })), h("stack-item", null, h(EmailInfoStep, { getMessage: this.getMessage, data: this._config, changeInfo: (field, value) => this.updateEmailInfo(field, value) }))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-button--tertiary ez-padding-right--medium", label: this.getStepMessage("firstButton"), onClick: () => this.executeButtonAction(true), enabled: this.checkButtonEnabled(true) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("firstButton")}` })), h("ez-button", Object.assign({ class: this.getSecondButtonClass(), label: this.getStepMessage("secondButton"), onClick: () => this.executeButtonAction(false), enabled: this.checkButtonEnabled(false) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("secondButton")}` }))))));
123
124
  }
@@ -0,0 +1,251 @@
1
+ import { r as registerInstance, h, g as getElement } from './index-cfd4bb13.js';
2
+ import { StringUtils, DataType, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
+ import { ModalAction } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
4
+ import { F as FilterOperand, a as FilterConfigType, b as FilterEntities, c as FilterUserConfigTypes } from './index-bd13bdcf.js';
5
+
6
+ class PersonalizedFilterUtils {
7
+ /**
8
+ * Cria uma expressão de filtro a partir de um IExpressionItem.
9
+ * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
10
+ * @returns Retorna a expressão de filtro.
11
+ */
12
+ static buildFilterExpression(expressionItem) {
13
+ if (expressionItem == undefined) {
14
+ return;
15
+ }
16
+ const value = this.buildVariableParameterValue(expressionItem);
17
+ let expression = expressionItem.expression || "";
18
+ switch (expressionItem.operand) {
19
+ case FilterOperand.IN:
20
+ expression += ` ${expressionItem.operand} (${value})`;
21
+ break;
22
+ case FilterOperand.NULL:
23
+ case FilterOperand.NOT_NULL:
24
+ expression += ` IS ${value}`;
25
+ break;
26
+ case FilterOperand.LIKE:
27
+ expression += ` LIKE '%${value}%'`;
28
+ break;
29
+ case FilterOperand.START_WITH:
30
+ expression += ` LIKE '${value}%'`;
31
+ break;
32
+ case FilterOperand.FINISHED_WITH:
33
+ expression += ` LIKE '%${value}'`;
34
+ break;
35
+ default:
36
+ expression += ` ${expressionItem.operand} ${value}`;
37
+ }
38
+ return expression;
39
+ }
40
+ /**
41
+ * Obtém o valor do parâmetro a partir de um IExpressionItem.
42
+ * @param expressionItem - Objeto com os parâmetros necessários para montar a expressão.
43
+ * @returns Retorna o valor do parâmetro.
44
+ */
45
+ static buildVariableParameterValue(expressionItem) {
46
+ if (expressionItem == undefined) {
47
+ return;
48
+ }
49
+ if (expressionItem.systemConfig != undefined) {
50
+ const systemConfig = expressionItem.systemConfig;
51
+ return `?:{entidade=${systemConfig.entity || ""};campo=${systemConfig.fieldName || ""}}`;
52
+ }
53
+ if (expressionItem.userConfig != undefined) {
54
+ const userConfig = expressionItem.userConfig;
55
+ return `?:{desc=${userConfig.description || ""};tipo=${userConfig.type || ""}}`;
56
+ }
57
+ return `?:{entidade=${expressionItem.entityName || ""};campo=${expressionItem.fieldName || ""}}`;
58
+ }
59
+ }
60
+
61
+ const snkFilterParamConfigCss = ".sc-snk-filter-param-config-h{--snk-filter-param-config__expression--color:var(--title--primary, #2b3a54);display:flex;position:relative}.snk-filter-param-config__expression.sc-snk-filter-param-config{--text-area__input--disabled--color:var(--snk-filter-param-config__expression--color)}";
62
+
63
+ const SnkFilterParamConfig = class {
64
+ constructor(hostRef) {
65
+ registerInstance(this, hostRef);
66
+ this._opened = false;
67
+ this._configType = FilterConfigType.SYSTEM_CONFIG;
68
+ this._expressionItem = undefined;
69
+ this._informedInstance = false;
70
+ this._canSave = false;
71
+ }
72
+ open(expressionItem) {
73
+ this._opened = true;
74
+ this._expressionItem = expressionItem;
75
+ this.loadValues();
76
+ return new Promise(accept => {
77
+ this._promiseResolver = accept;
78
+ });
79
+ }
80
+ close() {
81
+ this._opened = false;
82
+ return new Promise(accept => {
83
+ this._promiseResolver = accept;
84
+ });
85
+ }
86
+ /**
87
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
88
+ * através de um pequeno modulo na estrutura da aplicação:
89
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
90
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-filter-param-config.msg.ts"
91
+ */
92
+ getMessage(key, params) {
93
+ return this._application.messagesBuilder.getMessage(key, params);
94
+ }
95
+ getConfigValue(configName, inputName, inputAlias = "") {
96
+ var _a, _b, _c;
97
+ return ((_b = (_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a[configName]) === null || _b === void 0 ? void 0 : _b[inputName])
98
+ || ((_c = this._expressionItem) === null || _c === void 0 ? void 0 : _c[inputAlias || inputName]);
99
+ }
100
+ loadValues() {
101
+ var _a;
102
+ const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
103
+ const fieldName = this.getConfigValue("systemConfig", "fieldName");
104
+ const description = this.getConfigValue("userConfig", "description");
105
+ const type = this.getConfigValue("userConfig", "type");
106
+ if (((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.userConfig) != undefined) {
107
+ this._configType = FilterConfigType.USER_CONFIG;
108
+ }
109
+ else {
110
+ this._configType = FilterConfigType.SYSTEM_CONFIG;
111
+ }
112
+ if (!StringUtils.isEmpty(entityName) && !StringUtils.isEmpty(fieldName)) {
113
+ this._instanceElement.value = { value: entityName, label: "" };
114
+ this._fieldElement.value = { value: fieldName, label: "" };
115
+ }
116
+ if (!StringUtils.isEmpty(description) && !StringUtils.isEmpty(type)) {
117
+ this._descriptionElement.value = description;
118
+ this._typeElement.value = type;
119
+ }
120
+ this.buildFilterExpression();
121
+ }
122
+ changeDefinitionUsed(option) {
123
+ this._configType = option !== null && option !== void 0 ? option : FilterConfigType.SYSTEM_CONFIG;
124
+ if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
125
+ const entityName = this.getConfigValue("systemConfig", "entity", "entityName");
126
+ const fieldName = this.getConfigValue("systemConfig", "fieldName");
127
+ this._instanceElement.value = this._instanceElement.value || { value: entityName, label: "" };
128
+ this._fieldElement.value = this._fieldElement.value || { value: fieldName, label: "" };
129
+ }
130
+ else if (this._configType === FilterConfigType.USER_CONFIG) {
131
+ const description = this.getConfigValue("userConfig", "description");
132
+ const type = this.getConfigValue("userConfig", "type");
133
+ this._descriptionElement.value = this._descriptionElement.value || description;
134
+ this._typeElement.value = this._typeElement.value || type;
135
+ }
136
+ this.buildFilterExpression();
137
+ }
138
+ getTypeValue() {
139
+ var _a;
140
+ const value = (_a = this._typeElement) === null || _a === void 0 ? void 0 : _a.value;
141
+ return ((value === null || value === void 0 ? void 0 : value.value) || value);
142
+ }
143
+ getExpressionValues() {
144
+ var _a, _b, _c, _d, _e;
145
+ let systemConfig;
146
+ let userConfig;
147
+ if (this._configType === FilterConfigType.SYSTEM_CONFIG) {
148
+ const entity = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
149
+ const fieldName = (_d = (_c = this._fieldElement) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.value;
150
+ systemConfig = { entity, fieldName };
151
+ }
152
+ else if (this._configType === FilterConfigType.USER_CONFIG) {
153
+ const description = (_e = this._descriptionElement) === null || _e === void 0 ? void 0 : _e.value;
154
+ const type = this.getTypeValue();
155
+ userConfig = { description, type };
156
+ }
157
+ return Object.assign(Object.assign(Object.assign({}, this._expressionItem), { systemConfig }), { userConfig });
158
+ }
159
+ isEnabled(value) {
160
+ return this._configType === value;
161
+ }
162
+ isInformedInstance() {
163
+ var _a, _b;
164
+ return !StringUtils.isEmpty((_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value);
165
+ }
166
+ save() {
167
+ var _a;
168
+ this._expressionItem = Object.assign(Object.assign({}, this.getExpressionValues()), { expression: (_a = this._expressionElement) === null || _a === void 0 ? void 0 : _a.value });
169
+ this._promiseResolver(this._expressionItem);
170
+ this._opened = false;
171
+ }
172
+ buildFilterExpression() {
173
+ var _a;
174
+ this._informedInstance = this.isInformedInstance();
175
+ const expression = PersonalizedFilterUtils.buildFilterExpression(this.getExpressionValues());
176
+ this._expressionElement.value = expression || ((_a = this._expressionItem) === null || _a === void 0 ? void 0 : _a.expression);
177
+ this._canSave = this.getCanSave();
178
+ }
179
+ handleChangeInstance() {
180
+ this._informedInstance = this.isInformedInstance();
181
+ if (this._fieldElement != undefined && !StringUtils.isEmpty(this._fieldElement.value)) {
182
+ this._fieldElement.value = null;
183
+ }
184
+ this.buildFilterExpression();
185
+ }
186
+ getInstanceCriteria() {
187
+ var _a, _b;
188
+ const value = (_b = (_a = this._instanceElement) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.value;
189
+ return {
190
+ expression: "this.NOMETAB = (SELECT NOMETAB FROM TDDINS WHERE NOMEINSTANCIA = ?)",
191
+ params: [
192
+ {
193
+ name: "NOMEINSTANCIA",
194
+ dataType: DataType.TEXT,
195
+ value
196
+ }
197
+ ]
198
+ };
199
+ }
200
+ onSearch({ mode, argument }, entity) {
201
+ if (this._application == undefined) {
202
+ return;
203
+ }
204
+ const isField = entity === FilterEntities.FIELD;
205
+ const criteria = isField ? this.getInstanceCriteria() : undefined;
206
+ const messageKey = `snkFilterParamConfig.label${isField ? "Field" : "Instance"}`;
207
+ const entityDescription = this.getMessage(messageKey);
208
+ const searchOptions = {
209
+ descriptionFieldName: isField ? "DESCRCAMPO" : "DESCRINSTANCIA",
210
+ codeFieldName: isField ? "NOMECAMPO" : "NOMEINSTANCIA",
211
+ showInactives: false
212
+ };
213
+ const options = {
214
+ entity,
215
+ entityDescription,
216
+ criteria,
217
+ searchOptions
218
+ };
219
+ return this._application.executePreparedSearch(mode, argument, options);
220
+ }
221
+ getElementID(sufix) {
222
+ return {
223
+ [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(sufix)
224
+ };
225
+ }
226
+ getCanSave() {
227
+ var _a;
228
+ if (this._configType === FilterConfigType.USER_CONFIG) {
229
+ const description = (_a = this._descriptionElement) === null || _a === void 0 ? void 0 : _a.value;
230
+ const type = this.getTypeValue();
231
+ return !StringUtils.isEmpty(description) && !StringUtils.isEmpty(type);
232
+ }
233
+ return true;
234
+ }
235
+ componentWillLoad() {
236
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
237
+ }
238
+ render() {
239
+ ElementIDUtils.addIDInfoIfNotExists(this._element, 'snkFilterParamConfig');
240
+ return (h("ez-popup", Object.assign({ useHeader: false, size: "small", heightMode: "auto", opened: this._opened }, this.getElementID("popup")), h("ez-modal-container", Object.assign({ onEzModalAction: (evt) => {
241
+ if (evt.detail === ModalAction.CLOSE)
242
+ this.close();
243
+ }, modalTitle: this.getMessage("snkFilterParamConfig.modalTitle") }, this.getElementID("modalContainer")), h("div", { class: "ez-flex" }, h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("systemConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelSystemConfig"), value: FilterConfigType.SYSTEM_CONFIG })), h("ez-search", Object.assign({ ref: (ref) => this._instanceElement = ref, label: this.getMessage("snkFilterParamConfig.labelInstance"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.handleChangeInstance(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.INSTANCE) }, this.getElementID("configFindEntity"))), h("ez-search", Object.assign({ ref: (ref) => this._fieldElement = ref, label: this.getMessage("snkFilterParamConfig.labelField"), enabled: this.isEnabled(FilterConfigType.SYSTEM_CONFIG) && this._informedInstance, suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, onEzChange: () => this.buildFilterExpression(), optionLoader: (searchArgument) => this.onSearch(searchArgument, FilterEntities.FIELD) }, this.getElementID("configFindField")))), h("div", { class: "ez-flex ez-padding--medium" }, h("hr", { class: "ez-divider-vertical" })), h("div", { class: "ez-col ez-col--sd-6 ez-flex--column" }, h("ez-radio-button", Object.assign({ value: this._configType, onEzChange: (evt) => this.changeDefinitionUsed(evt.detail) }, this.getElementID("userConfigOption")), h("ez-radio-button-option", { label: this.getMessage("snkFilterParamConfig.labelUserConfig"), value: FilterConfigType.USER_CONFIG })), h("ez-text-input", Object.assign({ ref: (ref) => this._descriptionElement = ref, label: this.getMessage("snkFilterParamConfig.labelDescription"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamLabel"))), h("ez-combo-box", Object.assign({ ref: (ref) => this._typeElement = ref, label: this.getMessage("snkFilterParamConfig.labelType"), enabled: this.isEnabled(FilterConfigType.USER_CONFIG), suppressEmptyOption: true, onEzChange: () => this.buildFilterExpression() }, this.getElementID("configParamType")), Object.keys(FilterUserConfigTypes).map((configType) => {
244
+ return (h("option", { value: FilterUserConfigTypes[configType] }, this.getMessage(`snkFilterParamConfig.labelTypeValues.${configType.toLowerCase()}`)));
245
+ })))), h("ez-text-area", Object.assign({ ref: (ref) => this._expressionElement = ref, class: "snk-filter-param-config__expression", label: this.getMessage("snkFilterParamConfig.labelExpression"), enabled: false }, this.getElementID("presentationExpression"))), h("div", { class: "ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small" }, h("ez-button", Object.assign({ class: "ez-padding-right--medium", label: this.getMessage("snkFilterParamConfig.labelCancel"), onClick: () => this.close() }, this.getElementID("cancelEditParam"))), h("ez-button", Object.assign({ class: "ez-button--primary", label: this.getMessage("snkFilterParamConfig.labelSave"), onClick: () => this.save(), enabled: this._canSave }, this.getElementID("saveEditParam")))))));
246
+ }
247
+ get _element() { return getElement(this); }
248
+ };
249
+ SnkFilterParamConfig.style = snkFilterParamConfigCss;
250
+
251
+ export { SnkFilterParamConfig as snk_filter_param_config };
@@ -3,7 +3,7 @@ import { d as draggable_bundle } from './draggable.bundle-41d56f06.js';
3
3
  import { ObjectUtils, ElementIDUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
4
4
  import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
5
5
  import { C as CONFIG_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-965d7a7f.js';
6
- import { a as UserConfigType, C as ConfigStorage } from './ConfigStorage-4654f57b.js';
6
+ import { a as UserConfigType, C as ConfigStorage } from './ConfigStorage-f9eaa4bc.js';
7
7
  import './_commonjsHelpers-9943807e.js';
8
8
 
9
9
  const snkFormConfigCss = ".sc-snk-form-config-h{--snk-form-config--z-index:var(--more-visible, 2);--snk-form-config--background-color:var(--background--xlight, #fff);--snk-form-config__icon--color:var(--text--disable, #AFB6C0);--snk-form-config__label-counter--font-weight:var(--text-weight--extra-small, 200);--snk-form-config__add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__add-group-container--background-color:var(--background--medium, #d2dce9);--snk-form-config__add-group-container--padding:var(--space--small, 6px);--snk-form-config__add-group-content--border:2px dashed var(--color-strokes, #DCE0E8);--snk-form-config__add-group-content--border-radius:var(--border--radius-small, 6px);--snk-form-config__add-group-label--padding:var(--space--large, 24px);--snk-form-config__btn-add-group--padding:var(--space--large, 24px) var(--space--medium, 12px) 0;--snk-form-config__btn-add-group-container--padding:var(--space--medium, 12px);--snk-form-config__btn-add-group-container--border-radius:var(--border--radius-medium, 12px);--snk-form-config__btn-add-group-container--border:2px solid var(--color-strokes, #DCE0E8);--snk-form-config__btn-add-group-container--background-color:var(--background--body, #fafcff);display:flex;flex-direction:column;position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--snk-form-config--z-index);background-color:var(--snk-form-config--background-color)}.form-config__header-container.sc-snk-form-config{display:flex}.form-config__field-container.sc-snk-form-config{width:32%;padding:6px}.form-config__hide-content.sc-snk-form-config{display:none}ez-icon.sc-snk-form-config .left-icon.sc-snk-form-config{--ez-icon--color:var(--snk-form-config__icon--color)}.ez-box__label-counter.sc-snk-form-config{margin-top:-7px;font-weight:var(--snk-form-config__label-counter--font-weight)}.form-config__btn-options.sc-snk-form-config{--ez-button--min-width:300px;--ez-button--background-color:var(--snk-form-config--background-color)}[data-draggable-parent].sc-snk-form-config{position:relative}.form-config__field-config--selected.sc-snk-form-config{position:static}.form-config__field-config--dragged.sc-snk-form-config .draggable-mirror.sc-snk-form-config{z-index:var(--snk-form-config--z-index)}.form-config__config-options.sc-snk-form-config{position:relative;margin-top:-3px;min-width:100%;z-index:1}.form-config__tab-container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config{position:relative;height:100%;max-height:calc(100vh - 92px)}.form-config__tab-container.sc-snk-form-config .ez-box__container.sc-snk-form-config,.form-config__fields-available.sc-snk-form-config .ez-box__container.sc-snk-form-config{align-content:flex-start;height:100%}.form-config__fields-available.sc-snk-form-config [data-draggable-parent].sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:100%;max-height:calc(100% - 122px)}.form-config__tab-content.sc-snk-form-config{align-content:flex-start;overflow-y:auto;height:auto;max-height:calc(100% - 128px)}[data-draggable-element].sc-snk-form-config{cursor:grab}.form-config__actions-button.sc-snk-form-config{--ez-actions-button__btn-action--min-width:235px}.form-config__add-group.sc-snk-form-config{position:relative;min-height:120px;margin-bottom:10px}.form-config__add-group-container.sc-snk-form-config{position:absolute;display:flex;flex-wrap:wrap;width:100%;box-sizing:border-box;border-radius:var(--snk-form-config__add-group-container--border-radius);background-color:var(--snk-form-config__add-group-container--background-color);padding:var(--snk-form-config__add-group-container--padding)}.form-config__add-group-content.sc-snk-form-config{width:100%;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;box-sizing:border-box;border:var(--snk-form-config__add-group-content--border);border-radius:var(--snk-form-config__add-group-content--border-radius)}.form-config__add-group-label.sc-snk-form-config{display:flex;justify-content:center;box-sizing:border-box;padding:var(--snk-form-config__add-group-label--padding)}.form-config__btn-add-group.sc-snk-form-config{position:relative;padding:var(--snk-form-config__btn-add-group--padding)}.form-config__btn-add-group-container.sc-snk-form-config{padding:var(--snk-form-config__btn-add-group-container--padding);border-radius:var(--snk-form-config__btn-add-group-container--border-radius);border:var(--snk-form-config__btn-add-group-container--border);background-color:var(--snk-form-config__btn-add-group-container--background-color)}ez-collapsible-box.draggable-mirror.sc-snk-form-config{display:table;background-color:var(--snk-form-config--background-color)}ez-collapsible-box.sc-snk-form-config{margin-bottom:10px}@media screen and (min-width: 480px){.form-config__field-config--selected.sc-snk-form-config .ez-flex.form-config__config-options.sc-snk-form-config{min-width:calc(300% + 12px)}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+2) .ez-flex.form-config__config-options.sc-snk-form-config{transform:translate(calc(100% / 3 * -1))}.form-config__field-config--selected.sc-snk-form-config:nth-child(3n+3) .ez-flex.form-config__config-options.sc-snk-form-config{transform:translate(calc(100% / 3 * -2))}}";
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-cfd4bb13.js';
2
2
  import { DateUtils, ObjectUtils, ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
3
- import { C as ConfigStorage } from './ConfigStorage-4654f57b.js';
4
- import { P as PresentationMode } from './index-1564817d.js';
3
+ import { C as ConfigStorage } from './ConfigStorage-f9eaa4bc.js';
4
+ import { P as PresentationMode } from './index-bd13bdcf.js';
5
5
  import { T as TaskbarProcessor } from './taskbar-processor-c2a99aba.js';
6
6
  import './_commonjsHelpers-9943807e.js';
7
7
 
@@ -1,5 +1,5 @@
1
1
  import { h } from './index-cfd4bb13.js';
2
- import { P as PresentationMode } from './index-1564817d.js';
2
+ import { P as PresentationMode } from './index-bd13bdcf.js';
3
3
  import { s as store } from './index-e467ade5.js';
4
4
 
5
5
  var TaskbarElement;
@@ -0,0 +1 @@
1
+ import{h as e,r as t,g as n}from"./p-b9667fbe.js";import{ElementIDUtils as o}from"@sankhyalabs/core";import{ModalAction as i}from"@sankhyalabs/ezui/dist/collection/components/ez-modal-container";const s=({getMessage:t,changeInfo:n,data:i})=>{const{format:s,email:l}=i||{};return e("div",null,e("ez-text-input",Object.assign({label:`${t("snkExporter.emailSenderInfoStep_sendTo")} (obrigatório) *`,value:null==l?void 0:l.to,onEzChange:e=>{var t;return n("to",null===(t=e.detail)||void 0===t?void 0:t.trim())}},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("sendTo")}`})),e("ez-text-input",Object.assign({label:`${t("snkExporter.emailSenderInfoStep_subject")} (obrigatório) *`,value:null==l?void 0:l.subject,onEzChange:e=>{var t;return n("subject",null===(t=e.detail)||void 0===t?void 0:t.trim())}},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("subject")}`})),e("ez-text-area",Object.assign({label:t("snkExporter.emailSenderInfoStep_message"),value:null==l?void 0:l.message,onEzChange:e=>n("message",e.detail)},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("message")}`})),((null==l?void 0:l.attachments)||[]).map(((t,n)=>e("ez-file-item",Object.assign({class:"ez-padding-bottom--large",fileName:`${t.name}.${s}`,fileSize:t.size,canRemove:!1},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("fileItem_")+(n+1)}`})))))},l=({getMessage:t,changeInfo:n,data:i})=>{const s=(null==i?void 0:i.selectedRows)||0,l=[{label:t("snkExporter.emailSenderOptStep_formatPDF"),value:"pdf"},{label:t("snkExporter.emailSenderOptStep_formatXLSX"),value:"xlsx"}],a=[{label:t("snkExporter.emailSenderOptStep_allData"),value:"all"},{label:t("snkExporter.emailSenderOptStep_currentPage"),value:"page"}];if(s>0){const e=t(s>1?"snkExporter.emailSenderOptStep_someRecords":"snkExporter.emailSenderOptStep_oneRecord",{SELECTION_COUNT:s});a.push({label:e,value:"selection"})}return e("div",null,e("ez-radio-button",Object.assign({class:"ez-margin-bottom--large"},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("formato")}`},{label:t("snkExporter.emailSenderOptStep_lblFormat"),direction:"horizontal",value:null==i?void 0:i.format,onEzChange:e=>n("format",e.detail),options:l})),e("ez-radio-button",Object.assign({class:"ez-margin-bottom--large"},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("type")}`},{label:t("snkExporter.emailSenderOptStep_export"),value:(null==i?void 0:i.type)||"all",onEzChange:e=>n("type",e.detail),options:a})))},a=class{constructor(e){t(this,e),this._stepInfo=[{subTitle:"snkExporter.emailSenderOptStep_subtitle",firstButton:"snkExporter.emailSenderCancelButton",secondButton:"snkExporter.emailSenderNextButton",firstButtonAction:()=>this.close(),secondButtonAction:()=>this.changeStep(1)},{subTitle:"snkExporter.emailSenderInfoStep_subtitle",firstButton:"snkExporter.emailSenderBackButton",secondButton:"snkExporter.emailSenderSendButton",firstButtonAction:()=>this.changeStep(0),secondButtonAction:()=>this.send(),secondButtonEnabledTester:()=>this.isFilled(),secondButtonClass:"ez-button--primary"}],this._config=void 0,this._opened=!1,this._currentStep=0,this.getMessage=void 0}open(e){var t;return this._config=Object.assign(Object.assign({},e),{format:null!==(t=null==e?void 0:e.format)&&void 0!==t?t:"pdf"}),this._opened=!0,this.changeStep(0),new Promise((e=>{this._promiseResolver=e}))}close(){return this._opened=!1,new Promise((e=>{this._promiseResolver=e}))}getStepMessage(e){return this.getMessage((this._stepInfo[this._currentStep]||{})[e])}executeButtonAction(e){(this._stepInfo[this._currentStep]||{})[e?"firstButtonAction":"secondButtonAction"]()}checkButtonEnabled(e){const t=(this._stepInfo[this._currentStep]||{})[e?"firstButtonEnabledTester":"secondButtonEnabledTester"];return!t||t()}changeStep(e){this._currentStep=e,this._viewStack&&this._viewStack.show(this._currentStep)}send(){const{format:e,type:t,email:n,resolver:o}=this._config;o({format:e,type:t,email:n,report:void 0})}isFilled(){var e,t;return!(!(null===(e=this._config.email)||void 0===e?void 0:e.to)||!(null===(t=this._config.email)||void 0===t?void 0:t.subject))}updateEmailInfo(e,t){this._config=Object.assign(Object.assign({},this._config),{email:Object.assign(Object.assign({},this._config.email),{[e]:t})})}updateConfigInfo(e,t){this._config=Object.assign(Object.assign({},this._config),{[e]:t})}getSecondButtonClass(){return(this._stepInfo[this._currentStep]||{}).secondButtonClass||"ez-button--secondary"}render(){return o.addIDInfoIfNotExists(this._element,"snkExporterEmailSender"),e("ez-popup",{useHeader:!1,size:"x-small",heightMode:"auto",opened:this._opened},e("ez-modal-container",{onEzModalAction:e=>{e.detail===i.CLOSE&&this.close()},modalTitle:this.getMessage("snkExporter.emailSenderTitle"),modalSubTitle:this.getStepMessage("subTitle")},e("ez-view-stack",{ref:e=>this._viewStack=e},e("stack-item",null,e(l,{getMessage:this.getMessage,data:this._config,changeInfo:(e,t)=>this.updateConfigInfo(e,t)})),e("stack-item",null,e(s,{getMessage:this.getMessage,data:this._config,changeInfo:(e,t)=>this.updateEmailInfo(e,t)}))),e("div",{class:"ez-col ez-col--sd-12 ez-flex--justify-end ez-margin-vertical--small"},e("ez-button",Object.assign({class:"ez-button--tertiary ez-padding-right--medium",label:this.getStepMessage("firstButton"),onClick:()=>this.executeButtonAction(!0),enabled:this.checkButtonEnabled(!0)},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("firstButton")}`})),e("ez-button",Object.assign({class:this.getSecondButtonClass(),label:this.getStepMessage("secondButton"),onClick:()=>this.executeButtonAction(!1),enabled:this.checkButtonEnabled(!1)},{[o.DATA_ELEMENT_ID_ATTRIBUTE_NAME]:`${o.getInternalIDInfo("secondButton")}`})))))}get _element(){return n(this)}};export{a as snk_exporter_email_sender}
@@ -1,14 +1,14 @@
1
- import{r as t,c as e,h as s,g as i}from"./p-b9667fbe.js";import{WaitingChangeException as r,WarningException as n,ErrorException as a,ObjectUtils as o,DataType as c,DataUnit as h,StringUtils as u,ChangeOperation as l,DateUtils as d,DependencyType as p,ElementIDUtils as m,ApplicationContext as f,ErrorTracking as y}from"@sankhyalabs/core";import{d as g,D as w,R as v,U as I,F as $,G as _,C as P}from"./p-93d8ea09.js";import{ApplicationUtils as S}from"@sankhyalabs/ezui/dist/collection/utils";import{S as D}from"./p-d3fb34cb.js";import"./p-112455b1.js";class C{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const e=t.reason;e instanceof r||(e?this.processException(e):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t.errorCode+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t.errorCode+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t)),t instanceof r||t instanceof n?this._app.alert(t.title,t.message):t instanceof a?this._app.error(t.title,t.message):this._app.isDebugMode().then((e=>{if(e)if(t instanceof Error)this._app.error(t.name,t.message);else{const e=(null==t?void 0:t.title)||"Erro detectado",s="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(e,s)}}))}}class A{constructor(){this._defaultPageSize=100,this._templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this._templateByQuery.set("search",g.gql`query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
1
+ import{r as t,c as e,h as s,g as i}from"./p-b9667fbe.js";import{WaitingChangeException as r,WarningException as n,ErrorException as a,ObjectUtils as o,DataType as c,DataUnit as h,StringUtils as u,ChangeOperation as l,DateUtils as d,DependencyType as p,ElementIDUtils as m,ApplicationContext as f,ErrorTracking as y}from"@sankhyalabs/core";import{d as g,D as w,R as v,U as I,F as $,G as _,C as P}from"./p-a0258616.js";import{ApplicationUtils as D}from"@sankhyalabs/ezui/dist/collection/utils";import{S}from"./p-32d02fa4.js";import"./p-112455b1.js";class C{constructor(t){this._app=t,window.addEventListener("error",(t=>this.errorHandler(t))),window.addEventListener("unhandledrejection",(t=>this.rejectionHandler(t)))}rejectionHandler(t){const e=t.reason;e instanceof r||(e?this.processException(e):this._app.isDebugMode().then((t=>{t&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(t){this.processException(t.error)}buildErrorCodeHTML(t){return'<br><a href="#" onclick="try{window.workspace.openHelp(\'_tbcode:'+t.errorCode+"')} catch(e){alert('Não é possível abrir a ajuda fora do workspace Sankhya');}\">Código: "+t.errorCode+"</a>"}processException(t){t.errorCode&&(t.message+=this.buildErrorCodeHTML(t)),t instanceof r||t instanceof n?this._app.alert(t.title,t.message):t instanceof a?this._app.error(t.title,t.message):this._app.isDebugMode().then((e=>{if(e)if(t instanceof Error)this._app.error(t.name,t.message);else{const e=(null==t?void 0:t.title)||"Erro detectado",s="string"==typeof t?t:t.message||`Erro interno "${o.objectToString(t)}"`;this._app.error(e,s)}}))}}class A{constructor(){this._defaultPageSize=100,this._templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this._templateByQuery.set("search",g.gql`query($entityName: String! $argument: String $criteria: InputSearchCriteria $options: InputSearchOptions) {
2
2
  $queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria options: $options){
3
3
  value
4
4
  label
5
5
  }
6
- }`)}loadSearchOptions(t,e,s,i){const r=(null==e?void 0:e.toString().trim())||void 0;return e=isNaN(Number(r))&&r?`%${r}`:r,new Promise(((r,n)=>{w.get().callGraphQL({values:{argument:e,entityName:t,criteria:s,options:i},query:this._templateByQuery.get("search")}).then((t=>{r(t)})).catch((t=>{n(t)}))}))}loadAdvancedSearch(t,e,s,i){const r={query:{$:null==s?void 0:s.expression}};(null==s?void 0:s.params.length)>0&&(r.params={param:s.params.map((t=>{let e=t.value,s=t.dataType;return s===c.OBJECT?(e=e.value,s="S"):s=function(t){switch(t){case c.NUMBER:return"I";case c.DATE:return"D";default:return"S"}}(t.dataType),{$:e,type:s}}))});const n={serviceName:"PesquisaSP.getSuggestion",requestBody:{criteria:{entityName:t,compacted:!1,ignoreEntityCriteria:!1,limit:this._defaultPageSize,query:{$:e},orderByDesc:!1,externalCriteria:r,localEntityName:null==i?void 0:i.rootEntity},clientEventList:{clientEvent:[]}}};return new Promise(((t,e)=>{w.get().callServiceBroker("PesquisaSP.getSuggestion",JSON.stringify(n)).then((e=>t(e))).catch((t=>e(t)))}))}}function T(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(T=function(){return t})()}const b=N;function N(t,e){const s=T();return(N=function(t){return s[t-=392]})(t,e)}!function(){const t=N,e=T();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const E=b(396);class q{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchTotals",g.gql`query($filters: [InputFilter!] $name: String!) {
6
+ }`)}loadSearchOptions(t,e,s,i){const r=(null==e?void 0:e.toString().trim())||void 0;return e=isNaN(Number(r))&&r?`%${r}`:r,new Promise(((r,n)=>{w.get().callGraphQL({values:{argument:e,entityName:t,criteria:s,options:i},query:this._templateByQuery.get("search")}).then((t=>{r(t)})).catch((t=>{n(t)}))}))}loadAdvancedSearch(t,e,s,i){const r={query:{$:null==s?void 0:s.expression}};(null==s?void 0:s.params.length)>0&&(r.params={param:s.params.map((t=>{let e=t.value,s=t.dataType;return s===c.OBJECT?(e=e.value,s="S"):s=function(t){switch(t){case c.NUMBER:return"I";case c.DATE:return"D";default:return"S"}}(t.dataType),{$:e,type:s}}))});const n={serviceName:"PesquisaSP.getSuggestion",requestBody:{criteria:Object.assign({entityName:t,compacted:!1,ignoreEntityCriteria:!1,limit:this._defaultPageSize,query:{$:e},orderByDesc:!1,externalCriteria:r,localEntityName:null==i?void 0:i.rootEntity},{options:null!=i?{pkFieldName:i.codeFieldName,label:i.descriptionFieldName,fieldName:i.codeFieldName,useDescriptionOptions:!1,enableRowsCounter:!0}:void 0}),clientEventList:{clientEvent:[]}}};return new Promise(((t,e)=>{w.get().callServiceBroker("PesquisaSP.getSuggestion",JSON.stringify(n)).then((e=>t(e))).catch((t=>e(t)))}))}}function b(){const t=["2909523kXwted","CompanyName=Sankhya Jiva Tecnologia e Inovao Ltda,LicensedApplication=Sankhya Gestao,LicenseType=SingleApplication,LicensedConcurrentDeveloperCount=2,LicensedProductionInstancesCount=0,AssetReference=AG-019460,ExpiryDate=9_November_2022_[v2]_MTY2Nzk1MjAwMDAwMA==10487151e296ee4360f80961ca960869","1131048CARoeW","502909mLEPmu","447255iQEXuN","428UHbJwW","270AFTxAV","194369jhGqTI","1540nWuTrj","2044062GicUQI","30CkXPWg"];return(b=function(){return t})()}const N=T;function T(t,e){const s=b();return(T=function(t){return s[t-=392]})(t,e)}!function(){const t=T,e=b();for(;;)try{if(951926==-parseInt(t(398))/1+-parseInt(t(393))/2+parseInt(t(395))/3+-parseInt(t(400))/4*(parseInt(t(392))/5)+-parseInt(t(401))/6*(-parseInt(t(402))/7)+parseInt(t(397))/8+-parseInt(t(399))/9*(-parseInt(t(394))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const E=N(396);class q{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchTotals",g.gql`query($filters: [InputFilter!] $name: String!) {
7
7
  $queryAlias$: fetchTotals(name: $name, filters: $filters ){
8
8
  name
9
9
  value
10
10
  }
11
- }`)}async getTotals(t,e,s){let i={name:`totals://${t}/${e}`,filters:s};return w.get().callGraphQL({values:i,query:this.templateByQuery.get("fetchTotals")})}fetchTotals(t,e,s=[]){return new Promise(((i,r)=>{this.getTotals(t,e,s).then((t=>{if(t.length>0){const e=new Map;t.forEach((t=>{e.set(t.name,parseFloat(t.value))})),i(e)}else r("Não foi possível recuperar os totalizadores")})).catch((t=>{r(t)}))}))}}class U extends v{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}class O{constructor(){this.templateByQuery=new Map,this._loadDataTimeout={},this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",g.gql`query($name: String!) {
11
+ }`)}async getTotals(t,e,s){let i={name:`totals://${t}/${e}`,filters:s};return w.get().callGraphQL({values:i,query:this.templateByQuery.get("fetchTotals")})}fetchTotals(t,e,s=[]){return new Promise(((i,r)=>{this.getTotals(t,e,s).then((t=>{if(t.length>0){const e=new Map;t.forEach((t=>{e.set(t.name,parseFloat(t.value))})),i(e)}else r("Não foi possível recuperar os totalizadores")})).catch((t=>{r(t)}))}))}}class O extends v{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}class U{constructor(){this.templateByQuery=new Map,this._loadDataTimeout={},this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",g.gql`query($name: String!) {
12
12
  $queryAlias$: fetchDataUnit(name: $name){
13
13
  name
14
14
  fields{
@@ -80,4 +80,4 @@ import{r as t,c as e,h as s,g as i}from"./p-b9667fbe.js";import{WaitingChangeExc
80
80
  name
81
81
  resource
82
82
  }
83
- }`)}async getParam(t){const e=`param://application?params=${t}`;return w.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return d.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),u.isEmpty(t.resource)?"":t.resource}}const k=M;function M(t,e){const s=x();return(M=function(t){return s[t-=378]})(t,e)}function x(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(x=function(){return t})()}!function(){const t=M,e=x();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class B{[k(397)](t){const e=k;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new z("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class z{constructor(t){const e=k;this.isSup=t,this[e(384)]={}}[k(378)](t,e){this[k(384)][t]=e}[k(393)](t){const e=k;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class G extends v{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=o.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var J;function H(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>H(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=H(t[s]):delete e[s]})),e}}return t}!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(J||(J={}));class V extends v{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=H(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}const W=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new Z,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new j),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||R.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new K(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(J).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full",s=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=s,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{w.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{w.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){R.openAppActivity(t,e)}async webConnection(t,e,s){this.getStringParam(t).then((t=>{L.webConnectionCaller(t,e,s)}))}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e,s){return new Promise(((i,r)=>{const n=this.getDuPromissesStack(e),a=n.length>0;if(n.push(new K(i,r)),!a){const i=this.dataUnitFetcher.getDataUnit(t,this.resourceID,s);i.loadMetadata().then((()=>{for(e&&this._duCache.set(e,i);n.length>0;)n.pop().resolve(i)})).catch((t=>{for(;n.length>0;)n.pop().reject(t)}))}}))}async getDataUnit(t,e,s){return new Promise(((i,r)=>{const n=this._duCache.get(e);n?i(n):this.createDataunit(t,e,s).then((t=>{i(t)})).catch((t=>r(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return S.alert(t,e,s,i)}async error(t,e,s,i){return S.error(t,e,s,i)}async success(t,e,s,i){return S.success(t,e,s,i)}async message(t,e,s,i){return S.message(t,e,s,i)}async confirm(t,e,s,i,r){return S.confirm(t,e,s,i,r)}async info(t,e){return S.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new B).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=I.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new O),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new $),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new _),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new q),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new A),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new G),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new V),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new U),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let d;const m={rootEntity:h,descriptionFieldName:o,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===p.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(d={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||c.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:d,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s[m.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return R.getAppLabel(this._resourceID)}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new C(this),this.messagesBuilder=new D,f.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${I.getUrlBase()}/mge/upload/file`),f.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),f.setContextValue("__EZUI__GRID_LICENSE__",E),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),y.init(),P.get(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){f.setContextValue("__SNK__APPLICATION__",this),w.addRequestListener(this._requestListener)}disconnectedCallback(){w.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),m.addIDInfo(this._element,`resource_${this._resourceID}`)}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class Z{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class K{constructor(t,e){this.resolve=t,this.reject=e}}W.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{W as snk_application}
83
+ }`)}async getParam(t){const e=`param://application?params=${t}`;return w.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return d.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),u.isEmpty(t.resource)?"":t.resource}}const k=M;function M(t,e){const s=x();return(M=function(t){return s[t-=378]})(t,e)}function x(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(x=function(){return t})()}!function(){const t=M,e=x();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class B{[k(397)](t){const e=k;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new z("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class z{constructor(t){const e=k;this.isSup=t,this[e(384)]={}}[k(378)](t,e){this[k(384)][t]=e}[k(393)](t){const e=k;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class G extends v{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=o.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var J;function H(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>H(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=H(t[s]):delete e[s]})),e}}return t}!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(J||(J={}));class V extends v{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=H(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}const W=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new Z,this.messagesBuilder=void 0,this.configName=void 0}get parameters(){return this._parameters||(this._parameters=new j),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||R.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new K(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(J).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full",s=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=s,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{w.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{w.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){R.openAppActivity(t,e)}async webConnection(t,e,s){this.getStringParam(t).then((t=>{L.webConnectionCaller(t,e,s)}))}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e,s){return new Promise(((i,r)=>{const n=this.getDuPromissesStack(e),a=n.length>0;if(n.push(new K(i,r)),!a){const i=this.dataUnitFetcher.getDataUnit(t,this.resourceID,s);i.loadMetadata().then((()=>{for(e&&this._duCache.set(e,i);n.length>0;)n.pop().resolve(i)})).catch((t=>{for(;n.length>0;)n.pop().reject(t)}))}}))}async getDataUnit(t,e,s){return new Promise(((i,r)=>{const n=this._duCache.get(e);n?i(n):this.createDataunit(t,e,s).then((t=>{i(t)})).catch((t=>r(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return D.alert(t,e,s,i)}async error(t,e,s,i){return D.error(t,e,s,i)}async success(t,e,s,i){return D.success(t,e,s,i)}async message(t,e,s,i){return D.message(t,e,s,i)}async confirm(t,e,s,i,r){return D.confirm(t,e,s,i,r)}async info(t,e){return D.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new B).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=I.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new U),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new $),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new _),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new q),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new A),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new G),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new V),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new O),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:o,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let d;const m={rootEntity:h,descriptionFieldName:o,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===p.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(d={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||c.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:d,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s[m.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=`entity_${i}`,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}async getAppLabel(){return R.getAppLabel(this._resourceID)}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new C(this),this.messagesBuilder=new S,f.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${I.getUrlBase()}/mge/upload/file`),f.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),f.setContextValue("__EZUI__GRID_LICENSE__",E),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),y.init(),P.get(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){f.setContextValue("__SNK__APPLICATION__",this),w.addRequestListener(this._requestListener)}disconnectedCallback(){w.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)})),m.addIDInfo(this._element,`resource_${this._resourceID}`)}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}get _element(){return i(this)}};class Z{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class K{constructor(t,e){this.resolve=t,this.reject=e}}W.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{W as snk_application}