@sankhyalabs/sankhyablocks 1.3.31-beta.6 → 1.3.31-beta.7

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.
@@ -7125,6 +7125,8 @@ class PesquisaFetcher {
7125
7125
  }`);
7126
7126
  }
7127
7127
  loadSearchOptions(entityName, argument, criteria, options) {
7128
+ const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
7129
+ argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
7128
7130
  return new Promise((resolve, reject) => {
7129
7131
  DataFetcher.get()
7130
7132
  .callGraphQL({
@@ -7389,17 +7391,16 @@ const SnkApplication = class {
7389
7391
  * Mostra o conteúdo passado em um Popup
7390
7392
  */
7391
7393
  async showPopUp(content) {
7394
+ this.clearPopUpContent();
7392
7395
  this._popUp.appendChild(content);
7393
- this._popUp["opened"] = true;
7396
+ this._popUp.opened = true;
7394
7397
  }
7395
7398
  /**
7396
7399
  * Fecha o popup, liberando o conteúdo.
7397
7400
  */
7398
7401
  async closePopUp() {
7399
- Array.from(this._popUp.children).forEach(c => {
7400
- this._popUp.removeChild(c);
7401
- });
7402
- this._popUp["opened"] = false;
7402
+ this.clearPopUpContent();
7403
+ this._popUp.opened = false;
7403
7404
  }
7404
7405
  /**
7405
7406
  * Verifica se a licença do cliente tem determinado opcional (produto)
@@ -7637,7 +7638,7 @@ const SnkApplication = class {
7637
7638
  pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
7638
7639
  pesquisaContent.selectItem = (option) => {
7639
7640
  accept(option);
7640
- this.cleanPopUpTitle();
7641
+ this.clearPopUpTitle();
7641
7642
  this.closePopUp();
7642
7643
  };
7643
7644
  this.setPopUpTitle(DESCRIPTIONENTITY);
@@ -7654,11 +7655,18 @@ const SnkApplication = class {
7654
7655
  accept(window['isDebugMode']);
7655
7656
  });
7656
7657
  }
7657
- cleanPopUpTitle() {
7658
- this._popUp['ezTitle'] = "";
7658
+ clearPopUpContent() {
7659
+ if (this._popUp) {
7660
+ Array.from(this._popUp.children).forEach(c => {
7661
+ this._popUp.removeChild(c);
7662
+ });
7663
+ }
7664
+ }
7665
+ clearPopUpTitle() {
7666
+ this._popUp.ezTitle = "";
7659
7667
  }
7660
7668
  setPopUpTitle(title) {
7661
- this._popUp['ezTitle'] = title;
7669
+ this._popUp.ezTitle = title;
7662
7670
  }
7663
7671
  componentWillLoad() {
7664
7672
  this._errorHandler = new SnkErrorHandler(this);
@@ -24,7 +24,10 @@ const SnkDataUnit = class {
24
24
  */
25
25
  this.autoLoad = true;
26
26
  this._dataUnitObserver = (action) => {
27
- let msg = this.getActionInfo(action.type);
27
+ let msg;
28
+ if (!this.isTransitionAction(action.type)) {
29
+ msg = this.getActionInfo(action.type);
30
+ }
28
31
  if (msg) {
29
32
  utils.ApplicationUtils.info(msg);
30
33
  }
@@ -120,7 +123,11 @@ const SnkDataUnit = class {
120
123
  .then((result) => resolve(result ? action : undefined));
121
124
  break;
122
125
  case core.Action.REMOVING_RECORDS:
123
- utils.ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
126
+ let msg = undefined;
127
+ if (this.messageBuilder) {
128
+ msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
129
+ }
130
+ utils.ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
124
131
  .then((result) => resolve(result ? action : undefined));
125
132
  break;
126
133
  default:
@@ -128,6 +135,18 @@ const SnkDataUnit = class {
128
135
  }
129
136
  });
130
137
  }
138
+ isTransitionAction(action) {
139
+ switch (action) {
140
+ case core.Action.LOADING_METADATA:
141
+ case core.Action.LOADING_DATA:
142
+ case core.Action.SAVING_DATA:
143
+ case core.Action.REMOVING_RECORDS:
144
+ case core.Action.CHANGING_DATA:
145
+ return true;
146
+ default:
147
+ return false;
148
+ }
149
+ }
131
150
  getActionInfo(action) {
132
151
  if (this.messageBuilder) {
133
152
  return this.messageBuilder(action, this.dataState, this.dataUnit);
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-532bcc28.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
 
8
- const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--text--primary, #626e82);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-medium, 12px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px) display: block;max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input-close.sc-snk-pesquisa{cursor:pointer}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}";
8
+ const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--title--primary, #2B3A54);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
9
9
 
10
10
  const SnkPesquisa = class {
11
11
  constructor(hostRef) {
@@ -299,7 +299,10 @@ const SnkPesquisa = class {
299
299
  : 'Os resultados de sua pesquisa aparecerão aqui...';
300
300
  }
301
301
  render() {
302
- return (index.h(index.Host, null, index.h("div", { class: "snk-pesquisa" }, index.h("div", { class: "snk-pesquisa__input" }, index.h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" }), index.h("ez-icon", { class: "snk-pesquisa__input-close", slot: "rightIcon", iconName: "close", onClick: () => { this.clearSearch(); } })), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), index.h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), index.h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
302
+ var _a;
303
+ return (index.h(index.Host, null, index.h("div", { class: "snk-pesquisa" }, index.h("div", { class: "snk-pesquisa__input" }, index.h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
304
+ ? index.h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
305
+ : undefined), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), index.h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), index.h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
303
306
  return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
304
307
  })))));
305
308
  }
@@ -123,17 +123,16 @@ export class SnkApplication {
123
123
  * Mostra o conteúdo passado em um Popup
124
124
  */
125
125
  async showPopUp(content) {
126
+ this.clearPopUpContent();
126
127
  this._popUp.appendChild(content);
127
- this._popUp["opened"] = true;
128
+ this._popUp.opened = true;
128
129
  }
129
130
  /**
130
131
  * Fecha o popup, liberando o conteúdo.
131
132
  */
132
133
  async closePopUp() {
133
- Array.from(this._popUp.children).forEach(c => {
134
- this._popUp.removeChild(c);
135
- });
136
- this._popUp["opened"] = false;
134
+ this.clearPopUpContent();
135
+ this._popUp.opened = false;
137
136
  }
138
137
  /**
139
138
  * Verifica se a licença do cliente tem determinado opcional (produto)
@@ -373,7 +372,7 @@ export class SnkApplication {
373
372
  pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
374
373
  pesquisaContent.selectItem = (option) => {
375
374
  accept(option);
376
- this.cleanPopUpTitle();
375
+ this.clearPopUpTitle();
377
376
  this.closePopUp();
378
377
  };
379
378
  this.setPopUpTitle(DESCRIPTIONENTITY);
@@ -390,11 +389,18 @@ export class SnkApplication {
390
389
  accept(window['isDebugMode']);
391
390
  });
392
391
  }
393
- cleanPopUpTitle() {
394
- this._popUp['ezTitle'] = "";
392
+ clearPopUpContent() {
393
+ if (this._popUp) {
394
+ Array.from(this._popUp.children).forEach(c => {
395
+ this._popUp.removeChild(c);
396
+ });
397
+ }
398
+ }
399
+ clearPopUpTitle() {
400
+ this._popUp.ezTitle = "";
395
401
  }
396
402
  setPopUpTitle(title) {
397
- this._popUp['ezTitle'] = title;
403
+ this._popUp.ezTitle = title;
398
404
  }
399
405
  componentWillLoad() {
400
406
  this._errorHandler = new SnkErrorHandler(this);
@@ -13,7 +13,10 @@ export class SnkDataUnit {
13
13
  */
14
14
  this.autoLoad = true;
15
15
  this._dataUnitObserver = (action) => {
16
- let msg = this.getActionInfo(action.type);
16
+ let msg;
17
+ if (!this.isTransitionAction(action.type)) {
18
+ msg = this.getActionInfo(action.type);
19
+ }
17
20
  if (msg) {
18
21
  ApplicationUtils.info(msg);
19
22
  }
@@ -109,7 +112,11 @@ export class SnkDataUnit {
109
112
  .then((result) => resolve(result ? action : undefined));
110
113
  break;
111
114
  case Action.REMOVING_RECORDS:
112
- ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
115
+ let msg = undefined;
116
+ if (this.messageBuilder) {
117
+ msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
118
+ }
119
+ ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
113
120
  .then((result) => resolve(result ? action : undefined));
114
121
  break;
115
122
  default:
@@ -117,6 +124,18 @@ export class SnkDataUnit {
117
124
  }
118
125
  });
119
126
  }
127
+ isTransitionAction(action) {
128
+ switch (action) {
129
+ case Action.LOADING_METADATA:
130
+ case Action.LOADING_DATA:
131
+ case Action.SAVING_DATA:
132
+ case Action.REMOVING_RECORDS:
133
+ case Action.CHANGING_DATA:
134
+ return true;
135
+ default:
136
+ return false;
137
+ }
138
+ }
120
139
  getActionInfo(action) {
121
140
  if (this.messageBuilder) {
122
141
  return this.messageBuilder(action, this.dataState, this.dataUnit);
@@ -1,30 +1,37 @@
1
1
  :host {
2
+ /* general */
2
3
  /*@doc Define o tamanho da fonte do componente.*/
3
4
  --snk-pesquisa--font-size: var(--text--medium, 14px);
4
-
5
5
  /*@doc Define a família da fonte do componente.*/
6
6
  --snk-pesquisa--font-family: var(--font-pattern, Arial);
7
-
8
7
  /*@doc Define o peso da fonte do componente.*/
9
8
  --snk-pesquisa--font-weight: var(--text-weight--medium, 400);
10
9
 
10
+ /* records */
11
11
  /*@doc Define a cor da fonte do indicador de registros do componente.*/
12
12
  --snk-pesquisa__records--color: var(--text--primary, #626e82);
13
-
14
13
  /*@doc Define o espaçamento vertical do indicador de registros do componente.*/
15
14
  --snk-pesquisa__records--padding-vertical: var(--space--medium, 12px);
16
15
 
16
+ /* content */
17
17
  /*@doc Define o espaçamento da direita no conteúdo do componente.*/
18
18
  --snk-pesquisa__content--padding-right: var(--space--small, 6px);
19
19
 
20
+ /* scrollbar */
20
21
  /*@doc Define a cor da barra de rolagem do componente.*/
21
- --snk-pesquisa__content-scrollbar--background-color: var(--text--primary, #626e82);
22
-
22
+ --snk-pesquisa__content-scrollbar--background-color: var(--title--primary, #2B3A54);
23
23
  /*@doc Define o raio da borda da barra de rolagem do componente.*/
24
- --snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-medium, 12px);
25
-
24
+ --snk-pesquisa__content-scrollbar--border-radius: var(--border--radius-small, 6px);
26
25
  /*@doc Define a largura da barra de rolagem do componente.*/
27
- --snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px) display: block;
26
+ --snk-pesquisa__content-scrollbar--width: var(--space--medium, 12px);
27
+
28
+ /* buttons */
29
+ /*@doc Define a cor do botão de pesquisa do componente.*/
30
+ --snk-pesquisa__btn--color: var(--title--primary, #2B3A54);
31
+ /*@doc Define a cor do botão de pesquisa do componente quando desabilitado.*/
32
+ --snk-pesquisa__btn-disabled--color: var(--text--disable, #AFB6C0);
33
+ /*@doc Define a cor do botão de pesquisa do componente quando o mouse está sobre ele.*/
34
+ --snk-pesquisa__btn-hover--color: var(--color--primary, #4e4e4e);
28
35
 
29
36
  max-height: 100%;
30
37
  height: 100%;
@@ -47,8 +54,11 @@
47
54
  padding-right: 4px;
48
55
  }
49
56
 
50
- .snk-pesquisa__input-close {
51
- cursor: pointer;
57
+ .snk-pesquisa__input ez-icon {
58
+ --ez-icon--color: inherit;
59
+
60
+ /*public*/
61
+ font-weight: var(--text-weight--large, 600);
52
62
  }
53
63
 
54
64
  .snk-pesquisa__content {
@@ -91,4 +101,33 @@
91
101
  color: var(--snk-pesquisa__records--color);
92
102
  padding-bottom: var(--snk-pesquisa__records--padding-vertical);
93
103
  padding-top: var(--snk-pesquisa__records--padding-vertical);
104
+ }
105
+
106
+ .snk-pesquisa__btn {
107
+ outline: none;
108
+ border: none;
109
+ background: none;
110
+ cursor: pointer;
111
+
112
+ /*public*/
113
+ color: var(--snk-pesquisa__btn--color);
114
+ }
115
+
116
+ .snk-pesquisa__btn:disabled {
117
+ cursor: unset;
118
+
119
+ /*public*/
120
+ color: var(--snk-pesquisa__btn-disabled--color);
121
+ }
122
+
123
+ .snk-pesquisa__btn:disabled:hover {
124
+ cursor: unset;
125
+
126
+ /*public*/
127
+ color: var(--snk-pesquisa__btn-disabled--color);
128
+ }
129
+
130
+ .snk-pesquisa__btn:hover {
131
+ /*public*/
132
+ color: var(--snk-pesquisa__btn-hover--color);
94
133
  }
@@ -291,12 +291,16 @@ export class SnkPesquisa {
291
291
  : 'Os resultados de sua pesquisa aparecerão aqui...';
292
292
  }
293
293
  render() {
294
+ var _a;
294
295
  return (h(Host, null,
295
296
  h("div", { class: "snk-pesquisa" },
296
297
  h("div", { class: "snk-pesquisa__input" },
297
298
  h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument },
298
299
  h("ez-icon", { slot: "leftIcon", iconName: "search" }),
299
- h("ez-icon", { class: "snk-pesquisa__input-close", slot: "rightIcon", iconName: "close", onClick: () => { this.clearSearch(); } })),
300
+ this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
301
+ ? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() },
302
+ h("ez-icon", { iconName: "close" }))
303
+ : undefined),
300
304
  h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })),
301
305
  h("label", { class: "snk-pesquisa__records" }, this.getMessageView()),
302
306
  h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
@@ -16,6 +16,8 @@ export class PesquisaFetcher {
16
16
  }`);
17
17
  }
18
18
  loadSearchOptions(entityName, argument, criteria, options) {
19
+ const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
20
+ argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
19
21
  return new Promise((resolve, reject) => {
20
22
  DataFetcher.get()
21
23
  .callGraphQL({
@@ -7122,6 +7122,8 @@ class PesquisaFetcher {
7122
7122
  }`);
7123
7123
  }
7124
7124
  loadSearchOptions(entityName, argument, criteria, options) {
7125
+ const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
7126
+ argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
7125
7127
  return new Promise((resolve, reject) => {
7126
7128
  DataFetcher.get()
7127
7129
  .callGraphQL({
@@ -7387,17 +7389,16 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7387
7389
  * Mostra o conteúdo passado em um Popup
7388
7390
  */
7389
7391
  async showPopUp(content) {
7392
+ this.clearPopUpContent();
7390
7393
  this._popUp.appendChild(content);
7391
- this._popUp["opened"] = true;
7394
+ this._popUp.opened = true;
7392
7395
  }
7393
7396
  /**
7394
7397
  * Fecha o popup, liberando o conteúdo.
7395
7398
  */
7396
7399
  async closePopUp() {
7397
- Array.from(this._popUp.children).forEach(c => {
7398
- this._popUp.removeChild(c);
7399
- });
7400
- this._popUp["opened"] = false;
7400
+ this.clearPopUpContent();
7401
+ this._popUp.opened = false;
7401
7402
  }
7402
7403
  /**
7403
7404
  * Verifica se a licença do cliente tem determinado opcional (produto)
@@ -7635,7 +7636,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7635
7636
  pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
7636
7637
  pesquisaContent.selectItem = (option) => {
7637
7638
  accept(option);
7638
- this.cleanPopUpTitle();
7639
+ this.clearPopUpTitle();
7639
7640
  this.closePopUp();
7640
7641
  };
7641
7642
  this.setPopUpTitle(DESCRIPTIONENTITY);
@@ -7652,11 +7653,18 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
7652
7653
  accept(window['isDebugMode']);
7653
7654
  });
7654
7655
  }
7655
- cleanPopUpTitle() {
7656
- this._popUp['ezTitle'] = "";
7656
+ clearPopUpContent() {
7657
+ if (this._popUp) {
7658
+ Array.from(this._popUp.children).forEach(c => {
7659
+ this._popUp.removeChild(c);
7660
+ });
7661
+ }
7662
+ }
7663
+ clearPopUpTitle() {
7664
+ this._popUp.ezTitle = "";
7657
7665
  }
7658
7666
  setPopUpTitle(title) {
7659
- this._popUp['ezTitle'] = title;
7667
+ this._popUp.ezTitle = title;
7660
7668
  }
7661
7669
  componentWillLoad() {
7662
7670
  this._errorHandler = new SnkErrorHandler(this);
@@ -21,7 +21,10 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
21
21
  */
22
22
  this.autoLoad = true;
23
23
  this._dataUnitObserver = (action) => {
24
- let msg = this.getActionInfo(action.type);
24
+ let msg;
25
+ if (!this.isTransitionAction(action.type)) {
26
+ msg = this.getActionInfo(action.type);
27
+ }
25
28
  if (msg) {
26
29
  ApplicationUtils.info(msg);
27
30
  }
@@ -117,7 +120,11 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
117
120
  .then((result) => resolve(result ? action : undefined));
118
121
  break;
119
122
  case Action.REMOVING_RECORDS:
120
- ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
123
+ let msg = undefined;
124
+ if (this.messageBuilder) {
125
+ msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
126
+ }
127
+ ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
121
128
  .then((result) => resolve(result ? action : undefined));
122
129
  break;
123
130
  default:
@@ -125,6 +132,18 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
125
132
  }
126
133
  });
127
134
  }
135
+ isTransitionAction(action) {
136
+ switch (action) {
137
+ case Action.LOADING_METADATA:
138
+ case Action.LOADING_DATA:
139
+ case Action.SAVING_DATA:
140
+ case Action.REMOVING_RECORDS:
141
+ case Action.CHANGING_DATA:
142
+ return true;
143
+ default:
144
+ return false;
145
+ }
146
+ }
128
147
  getActionInfo(action) {
129
148
  if (this.messageBuilder) {
130
149
  return this.messageBuilder(action, this.dataState, this.dataUnit);
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
3
3
 
4
- const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--text--primary, #626e82);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-medium, 12px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px) display: block;max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input-close.sc-snk-pesquisa{cursor:pointer}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}";
4
+ const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--title--primary, #2B3A54);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
5
5
 
6
6
  const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -296,7 +296,10 @@ const SnkPesquisa = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
296
296
  : 'Os resultados de sua pesquisa aparecerão aqui...';
297
297
  }
298
298
  render() {
299
- return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), h("ez-icon", { class: "snk-pesquisa__input-close", slot: "rightIcon", iconName: "close", onClick: () => { this.clearSearch(); } })), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
299
+ var _a;
300
+ return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
301
+ ? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
302
+ : undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
300
303
  return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
301
304
  })))));
302
305
  }
@@ -7121,6 +7121,8 @@ class PesquisaFetcher {
7121
7121
  }`);
7122
7122
  }
7123
7123
  loadSearchOptions(entityName, argument, criteria, options) {
7124
+ const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
7125
+ argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
7124
7126
  return new Promise((resolve, reject) => {
7125
7127
  DataFetcher.get()
7126
7128
  .callGraphQL({
@@ -7385,17 +7387,16 @@ const SnkApplication = class {
7385
7387
  * Mostra o conteúdo passado em um Popup
7386
7388
  */
7387
7389
  async showPopUp(content) {
7390
+ this.clearPopUpContent();
7388
7391
  this._popUp.appendChild(content);
7389
- this._popUp["opened"] = true;
7392
+ this._popUp.opened = true;
7390
7393
  }
7391
7394
  /**
7392
7395
  * Fecha o popup, liberando o conteúdo.
7393
7396
  */
7394
7397
  async closePopUp() {
7395
- Array.from(this._popUp.children).forEach(c => {
7396
- this._popUp.removeChild(c);
7397
- });
7398
- this._popUp["opened"] = false;
7398
+ this.clearPopUpContent();
7399
+ this._popUp.opened = false;
7399
7400
  }
7400
7401
  /**
7401
7402
  * Verifica se a licença do cliente tem determinado opcional (produto)
@@ -7633,7 +7634,7 @@ const SnkApplication = class {
7633
7634
  pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
7634
7635
  pesquisaContent.selectItem = (option) => {
7635
7636
  accept(option);
7636
- this.cleanPopUpTitle();
7637
+ this.clearPopUpTitle();
7637
7638
  this.closePopUp();
7638
7639
  };
7639
7640
  this.setPopUpTitle(DESCRIPTIONENTITY);
@@ -7650,11 +7651,18 @@ const SnkApplication = class {
7650
7651
  accept(window['isDebugMode']);
7651
7652
  });
7652
7653
  }
7653
- cleanPopUpTitle() {
7654
- this._popUp['ezTitle'] = "";
7654
+ clearPopUpContent() {
7655
+ if (this._popUp) {
7656
+ Array.from(this._popUp.children).forEach(c => {
7657
+ this._popUp.removeChild(c);
7658
+ });
7659
+ }
7660
+ }
7661
+ clearPopUpTitle() {
7662
+ this._popUp.ezTitle = "";
7655
7663
  }
7656
7664
  setPopUpTitle(title) {
7657
- this._popUp['ezTitle'] = title;
7665
+ this._popUp.ezTitle = title;
7658
7666
  }
7659
7667
  componentWillLoad() {
7660
7668
  this._errorHandler = new SnkErrorHandler(this);
@@ -20,7 +20,10 @@ const SnkDataUnit = class {
20
20
  */
21
21
  this.autoLoad = true;
22
22
  this._dataUnitObserver = (action) => {
23
- let msg = this.getActionInfo(action.type);
23
+ let msg;
24
+ if (!this.isTransitionAction(action.type)) {
25
+ msg = this.getActionInfo(action.type);
26
+ }
24
27
  if (msg) {
25
28
  ApplicationUtils.info(msg);
26
29
  }
@@ -116,7 +119,11 @@ const SnkDataUnit = class {
116
119
  .then((result) => resolve(result ? action : undefined));
117
120
  break;
118
121
  case Action.REMOVING_RECORDS:
119
- ApplicationUtils.confirm(this.i18n("components.delete"), this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
122
+ let msg = undefined;
123
+ if (this.messageBuilder) {
124
+ msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
125
+ }
126
+ ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
120
127
  .then((result) => resolve(result ? action : undefined));
121
128
  break;
122
129
  default:
@@ -124,6 +131,18 @@ const SnkDataUnit = class {
124
131
  }
125
132
  });
126
133
  }
134
+ isTransitionAction(action) {
135
+ switch (action) {
136
+ case Action.LOADING_METADATA:
137
+ case Action.LOADING_DATA:
138
+ case Action.SAVING_DATA:
139
+ case Action.REMOVING_RECORDS:
140
+ case Action.CHANGING_DATA:
141
+ return true;
142
+ default:
143
+ return false;
144
+ }
145
+ }
127
146
  getActionInfo(action) {
128
147
  if (this.messageBuilder) {
129
148
  return this.messageBuilder(action, this.dataState, this.dataUnit);
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, h, H as Host } from './index-0b078db7.js';
2
2
  import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
3
3
 
4
- const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--text--primary, #626e82);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-medium, 12px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px) display: block;max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input-close.sc-snk-pesquisa{cursor:pointer}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}";
4
+ const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--title--primary, #2B3A54);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
5
5
 
6
6
  const SnkPesquisa = class {
7
7
  constructor(hostRef) {
@@ -295,7 +295,10 @@ const SnkPesquisa = class {
295
295
  : 'Os resultados de sua pesquisa aparecerão aqui...';
296
296
  }
297
297
  render() {
298
- return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), h("ez-icon", { class: "snk-pesquisa__input-close", slot: "rightIcon", iconName: "close", onClick: () => { this.clearSearch(); } })), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
298
+ var _a;
299
+ return (h(Host, null, h("div", { class: "snk-pesquisa" }, h("div", { class: "snk-pesquisa__input" }, h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
300
+ ? h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, h("ez-icon", { iconName: "close" }))
301
+ : undefined), h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
299
302
  return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
300
303
  })))));
301
304
  }
@@ -0,0 +1 @@
1
+ import{r as s,h as t,H as e}from"./p-a45dba1a.js";import{ObjectUtils as i,StringUtils as r}from"@sankhyalabs/core";const n=class{constructor(t){s(this,t),this._mdByName={},this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._specialCharsRegex=/[[.\-\$\+\*,_\&\(\)%\/\\#@!:\|\=\'\"]/gim,this._charsWithAccentuation="ÁÉÍÓÚ_ÃÕ_ÂÊÎÔÛ_ÀÈÌÒÙ_Ü_Ç_áéíóú_ãõ_âêîôû_àèìòù_ü_ç",this._charsWithoutAccentuation="AEIOU_AO_AEIOU_AEIOU_U_C_aeiou_ao_aeiou_aeiou_u_c",this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=450,this._startLoading=!1}observeArgument(){this._textInput&&(this._textInput.value=this.argument)}clearSearch(){this.argument="",this._itemList=void 0}buildDetails(s,t){let e={};for(let i=0;i<s.length;i++){const r=s[i],n=t[r.fieldName];e[r.description]=this.highlightValue(t.__matchFields,r.options&&r.options[n]||n,s,!0)}return e}buildFirstFields(s,t,e=6){return s&&Array.isArray(s)&&s.forEach((s=>{let e=this.removeReference(t,this._mdByName[s]);e&&t.unshift(e)})),t=t.slice(0,e)}doSearch(s){this.searchLoader&&"function"==typeof this.searchLoader&&(this._startLoading=!0,this.searchLoader(s).then((s=>{if(this._startLoading=!1,s){let t=(s=i.stringToObject(s.json.$)).descriptionField,e=s.pkField;if(t&&e){let i=[];s.data.forEach((r=>{var n;let a=this.filterFieldsMetadata(s,r),o=this.buildFirstFields(r.__matchFields,a),l={key:this.highlightValue(r.__matchFields,null===(n=r[e])||void 0===n?void 0:n.toString(),o,!0),title:this.highlightValue(r.__matchFields,r[t],o,!0),details:this.buildDetails(o,r)};i.push(l)})),this._itemList=i}}})).catch((s=>{this._startLoading=!1,this._itemList=[],console.warn(s)})))}filterFieldsMetadata(s,t){return s.fieldsMetadata.filter((e=>{let i=!r.isEmpty(t[e.fieldName])&&!1!==e.visible&&"B"!==e.type&&s.pkField!==e.fieldName&&s.descriptionField!==e.fieldName&&(e.isPrimaryKey||!e.isLinkField)&&!("S"===e.type&&"H"===e.presentationType);return i&&(this._mdByName[e.fieldName]=e),("string"!=typeof t[e.fieldName]||!(t[e.fieldName].indexOf("<img")>-1||t[e.fieldName].indexOf("<svg")>-1))&&i}))}removeAtIndex(s,t){if(t>=0&&t<s.length)return s.splice(t,1)[0]}removeReference(s,t){let e=this.indexOf(s,t);return this.removeAtIndex(s,e)}indexOf(s,t){let e=-1;return Array.isArray(s)&&this.find(s,((s,i)=>(e=i,this.equals(t,s)))),e}equals(s,t){return i.objectToString(s)===i.objectToString(t)}find(s,t){if(s)for(let e=0,i=s.length;e<i;e++)if(t(s[e],e,s))return s[e]}highlightValue(s,t,e,i){let r=this.replaceHtmlEntities(t);if(this.argument&&(i||this.isIn(s,e.fieldName))){const s=this.getArgumentNumber();let t=(isNaN(s)?this.argument:s.toString()).split(/%|,|\s+/),i=0,n=this.replaceAccentuatedChars(r);t.forEach((s=>{if(s){s=this.replaceAccentuatedChars(s);let t=this.getSpecialCharacters(s);null!=t&&t.length>0&&(s=this.removeSpecialCharacters(s)),(e.mask||"CGC_CPF"===e.uiType||"Phone"===e.uiType)&&(s=s.split("").join("\\.?\\-?\\/?\\(?\\)?"));let a=new RegExp(s,"ig");a.lastIndex=i;let o=a.exec(n);if(o&&o.length>0){i=o.index;let s=o[0].length,t=r.substring(i,i+s),e=(null==t?void 0:t.trim())?this._startHighlightTag+t+this._endHighlightTag:"",a=r.substring(0,i),l=r.substring(i+s);r=a+e+l,i+=e.length,n=this.replaceAccentuatedChars(r)}}}))}return r}replaceHtmlEntities(s){return null==s?s:String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}replaceAccentuatedChars(s){return null==s?s:this.replaceToSpace(s,["&amp;","&lt;","&gt;","&quot;"]).replace(/[^\w ]/g,(s=>{let t=this._charsWithAccentuation.indexOf(s);return t>-1&&(s=this._charsWithoutAccentuation.charAt(t)),s||""}))}replaceToSpace(s,t=[]){return null==s||t.forEach((t=>{const e=new RegExp(t,"g");let i="";for(let s=0;s<t.length;s++)i+=" ";s=String(s).replace(e,i)})),s}isIn(s,t){return this.indexOf(s,t)>-1}getSpecialCharacters(s){let t,e=[];for(;t=this._specialCharsRegex.exec(s);)e.push(s[t.index]);return e}removeSpecialCharacters(s){return this.getSpecialCharacters(s).forEach((t=>{s=this.replaceAll(s,t,"")})),s}replaceAll(s,t,e){let i=(null!=s?s:"").indexOf(t);for(;i>-1;)i=(s=s.replace(t,e)).indexOf(t);return s}getArgumentNumber(){return Number(this.argument||void 0)}createOption(s){const{key:t,title:e}=s,i=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g"),n={value:null==t?void 0:t.replace(i,"").replace(r,""),label:null==e?void 0:e.replace(i,"").replace(r,"")};this.selectItem(n)}onChangeValue(s){if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=setTimeout((()=>{this.onChangeValue(s)}),this._deboucingTime));this.argument=(s.detail||"").trim();const t=this.getArgumentNumber();this.argument&&(!isNaN(t)||this.argument.length>=this._limitCharsToSearch)?this._changeDeboucingTimeout=setTimeout((()=>{this.doSearch(isNaN(t)?this.argument:t.toString())}),this._deboucingTime):this._itemList=void 0}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=void 0)}onClickSearch(){this.doSearch((this.argument||"").trim())}getMessageView(){return this._startLoading?"Aguarde, buscando registros...":this._itemList?this._itemList.length>=1?`${this._itemList.length} ${this._itemList.length>1?"registros encontrados":"registro encontrado"}`:"Nenhum registro encontrado":"Os resultados de sua pesquisa aparecerão aqui..."}render(){var s;return t(e,null,t("div",{class:"snk-pesquisa"},t("div",{class:"snk-pesquisa__input"},t("ez-text-input",{label:"Buscar",class:"ez-margin-right--medium",canShowError:!1,ref:s=>this._textInput=s,onEzChange:s=>this.onChangeValue(s),value:this.argument},t("ez-icon",{slot:"leftIcon",iconName:"search"}),this.argument&&(null===(s=this._textInput)||void 0===s?void 0:s.value)?t("button",{slot:"rightIcon",class:"snk-pesquisa__btn",onClick:()=>this.clearSearch()},t("ez-icon",{iconName:"close"})):void 0),t("ez-button",{class:"ez-button--primary",label:"Pesquisar",onClick:()=>this.onClickSearch()})),t("label",{class:"snk-pesquisa__records"},this.getMessageView()),t("div",{class:"snk-pesquisa__content"},this._itemList&&this._itemList.map((s=>t("ez-card-item",{onEzClick:s=>this.createOption(s.detail),item:s}))))))}static get watchers(){return{argument:["observeArgument"]}}};n.style=".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--title--primary, #2B3A54);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";export{n as snk_pesquisa}
@@ -0,0 +1 @@
1
+ import{r as t,c as s,h as e,g as i,H as a}from"./p-a45dba1a.js";import{Action as n,ApplicationContext as o}from"@sankhyalabs/core";import{ApplicationUtils as h}from"@sankhyalabs/ezui/dist/collection/utils";const r=class{constructor(e){t(this,e),this.dataStateChange=s(this,"dataStateChange",7),this.dataUnitReady=s(this,"dataUnitReady",7),this.insertionMode=s(this,"insertionMode",7),this._onDataUnitResolve=[],this.pageSize=150,this.autoLoad=!0,this._dataUnitObserver=t=>{let s;this.isTransitionAction(t.type)||(s=this.getActionInfo(t.type)),s&&h.info(s),t.type!==n.RECORDS_ADDED&&t.type!==n.RECORDS_COPIED||this.insertionMode.emit();const e={insertionMode:!1,hasNext:this.dataUnit.hasNext(),hasPrevious:this.dataUnit.hasPrevious(),copyMode:!1,isDirty:this.dataUnit.isDirty(),selectedRecords:this.dataUnit.getSelectedRecords()};this.dataUnit.records.forEach((t=>{t.__record__id__.startsWith("NEW_")&&(e.insertionMode=!0,e.copyMode||(e.copyMode=null!=t.__record__source__id__))})),this.dataState=e}}observePageSize(){this.dataUnit&&(this.dataUnit.pageSize=this.pageSize)}observeDataUnitName(t,s){s!=t&&(this.dataUnit=void 0,this.dataUnitName=t,this.loadDataUnit())}observeEntityName(t,s){s!=t&&(this.dataUnit=void 0,this.entityName=t,this.loadDataUnit())}observeDataState(t,s){s!=t&&this.dataStateChange.emit(t)}observeDataUnit(){this.dataUnitReady.emit(this.dataUnit)}async getDataUnit(){return new Promise((t=>{this.dataUnit?t(this.dataUnit):this._onDataUnitResolve.push(t)}))}async interceptAction(t){return new Promise((s=>{switch(t.type){case n.SAVING_DATA:if(this.beforeSave){const e=this.beforeSave(this.dataUnit);e instanceof Promise?e.then((e=>s(e?t:void 0))):s(e?t:void 0)}else s(t);break;case n.DATA_SAVED:this.afterSave?this.afterSave(this.dataUnit):s(t);break;case n.EDITION_CANCELED:h.confirm(this.i18n("components.warning"),this.i18n("components.confirmCancelEdition")).then((e=>s(e?t:void 0)));break;case n.REMOVING_RECORDS:let e;this.messageBuilder&&(e=this.messageBuilder(t.type,this.dataState,this.dataUnit)),h.confirm(this.i18n("components.delete"),e||this.i18n("components.confirmRemoveRecord"),"delete",!0,{btnConfirmDanger:!0}).then((e=>s(e?t:void 0)));break;default:s(t)}}))}isTransitionAction(t){switch(t){case n.LOADING_METADATA:case n.LOADING_DATA:case n.SAVING_DATA:case n.REMOVING_RECORDS:case n.CHANGING_DATA:return!0;default:return!1}}getActionInfo(t){return this.messageBuilder?this.messageBuilder(t,this.dataState,this.dataUnit):t===n.EDITION_CANCELED?this.i18n("components.editionCanceled"):void 0}async loadDataUnit(){if(!this.dataUnit){const t=o.getContextValue("__SNK__APPLICATION__");if(t&&this.entityName){const s=this.dataUnitName?this.dataUnitName:this.entityName;let e;for(this.dataUnit=await t.getDataUnit(this.entityName,s),this.dataUnit.pageSize=this.pageSize,this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this._dataUnitObserver);e=this._onDataUnitResolve.pop();)e(this.dataUnit);this.autoLoad&&this.dataUnit.loadData()}}}i18n(t){return{"components.warning":"Aviso","components.delete":"Excluir","components.confirmRemoveRecord":"Deseja realmente excluir o registro atual?","components.confirmCancelEdition":"As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de sair?</b>","components.editionCanceled":"Todas as alterações foram descartadas."}[t]}componentDidRender(){this.loadDataUnit()}render(){return e(a,null)}get element(){return i(this)}static get watchers(){return{pageSize:["observePageSize"],dataUnitName:["observeDataUnitName"],entityName:["observeEntityName"],dataState:["observeDataState"],dataUnit:["observeDataUnit"]}}};r.style=".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";export{r as snk_data_unit}
@@ -66,4 +66,4 @@ import{r as e,c as t,h as n}from"./p-a45dba1a.js";import{ErrorException as i,Str
66
66
  value
67
67
  label
68
68
  }
69
- }`)}loadSearchOptions(e,t,n,i){return new Promise(((r,s)=>{ee.get().callGraphQL({values:{argument:t,entityName:e,criteria:n,options:i},query:this._templateByQuery.get("search")}).then((e=>{r(e)})).catch((e=>{s(e)}))}))}loadAdvancedSearch(e,t,n,i){const r={query:{$:null==n?void 0:n.expression}};(null==n?void 0:n.params.length)>0&&(r.params={param:n.params.map((e=>({$:e.value,type:ce(e.dataType)})))});const s={serviceName:"PesquisaSP.getSuggestion",requestBody:{criteria:{entityName:e,compacted:!1,ignoreEntityCriteria:!1,limit:this._defaultPageSize,query:{$:t},orderByDesc:!1,externalCriteria:r,localEntityName:null==i?void 0:i.rootEntity},clientEventList:{clientEvent:[]}}};return new Promise(((e,t)=>{ee.get().callServiceBroker("PesquisaSP.getSuggestion",JSON.stringify(s)).then((t=>e(t))).catch((e=>t(e)))}))}}function ce(e){switch(e){case o.NUMBER:return"I";case o.DATE:return"D";default:return"S"}}class he extends se{getData(e){const t=`cfg://auth/${e}`;return new Promise(((e,n)=>{this.loadResource(t).then((t=>{let n=c.stringToObject(t);n&&"object"==typeof n&&e(n)})).catch((e=>{n(e)}))}))}}!function(e){e.INSERT="I",e.UPDATE="A",e.REMOVE="E",e.SHOW="C",e.CONFIG="F",e.CONFIG_NUMBER="N",e.CLONE="D",e.CONFIG_GRID="G"}(w||(w={}));const le=fe;function fe(e,t){const n=de();return(fe=function(e){return n[e-=378]})(e,t)}function de(){const e=["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(de=function(){return e})()}!function(){const e=fe,t=de();for(;;)try{if(281287==parseInt(e(399))/1*(-parseInt(e(387))/2)+-parseInt(e(401))/3+parseInt(e(381))/4*(-parseInt(e(389))/5)+parseInt(e(388))/6*(-parseInt(e(386))/7)+parseInt(e(379))/8+parseInt(e(396))/9+parseInt(e(383))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class ve{[le(397)](e){const t=le;if(typeof(e=utxt(e[t(390)]))==t(392)&&(e=JSON[t(400)](e)),null==e)throw Error(t(395));const n=new pe("S"===e[t(402)]||!0===e[t(402)]);return Array[t(394)](e[t(391)])&&e[t(391)][t(385)]((e=>n.putAccess(e[t(382)],String(e.status)==t(398)))),n}}class pe{constructor(e){const t=le;this.isSup=e,this[t(384)]={}}[le(378)](e,t){this[le(384)][e]=t}[le(393)](e){const t=le;if(this[t(402)])return!0;let n=!0;return this[t(384)][t(380)](e)&&(n=this.actions[e]),n}isUserSup(){return this.isSup}}class me{constructor(e){this._app=e,window.addEventListener("error",(e=>this.errorHandler(e))),window.addEventListener("unhandledrejection",(e=>this.rejectionHandler(e)))}rejectionHandler(e){const t=e.reason;t instanceof h||(t?this.processException(t):this._app.isDebugMode().then((e=>{e&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(e){this.processException(e.error)}processException(e){e instanceof h||e instanceof l?this._app.alert(e.title,e.message):e instanceof i?this._app.error(e.title,e.message):this._app.isDebugMode().then((t=>{t&&(e instanceof Error?this._app.error(e.name,e.message):this._app.error((null==e?void 0:e.title)||"Erro detectado","string"==typeof e?e:e.message||`Erro interno "${e}"`))}))}}function ye(){const e=["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(ye=function(){return e})()}const be=we;function we(e,t){const n=ye();return(we=function(e){return n[e-=392]})(e,t)}!function(){const e=we,t=ye();for(;;)try{if(951926==-parseInt(e(398))/1+-parseInt(e(393))/2+parseInt(e(395))/3+-parseInt(e(400))/4*(parseInt(e(392))/5)+-parseInt(e(401))/6*(-parseInt(e(402))/7)+parseInt(e(397))/8+-parseInt(e(399))/9*(-parseInt(e(394))/10))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const ge=be(396),Oe=class{constructor(n){e(this,n),this.applicationLoaded=t(this,"applicationLoaded",7),this.applicationLoading=t(this,"applicationLoading",7),this._duCache=new Map,this._requestListener=new Se}get parameters(){return this._parameters||(this._parameters=new re),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||ie.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return new Promise(((e,t)=>{this._auth?e(this._auth):this.authFetcher.getData(this._resourceID).then((t=>{this._auth=t,e(t)})).catch((e=>t(e)))}))}async isUserSup(){return new Promise(((e,t)=>{this.auth.then((n=>{this.getAuthList(n).then((t=>{e(t.isSup)})).catch((e=>t(e)))}))}))}async hasAccess(e){return new Promise(((t,n)=>{this.auth.then((i=>{this.getAuthList(i).then((n=>{t(n.isSup||n.actions[e])})).catch((e=>n(e)))}))}))}async getAllAccess(){return new Promise(((e,t)=>{this.auth.then((n=>{this.getAuthList(n).then((t=>{const n={};n.isSup=t.isSup,Object.entries(w).forEach((e=>{n[e[0]]=t.actions[e[1]]||!1})),e(n)})).catch((e=>t(e)))}))}))}async getStringParam(e){return this.parameters.asString(e,this.resourceID)}async getIntParam(e){return this.parameters.asInteger(e,this.resourceID)}async getFloatParam(e){return this.parameters.asFloat(e,this.resourceID)}async getBooleanParam(e){return this.parameters.asBoolean(e,this.resourceID)}async getDateParam(e){return this.parameters.asDate(e,this.resourceID)}async showPopUp(e){this._popUp.appendChild(e),this._popUp.opened=!0}async closePopUp(){Array.from(this._popUp.children).forEach((e=>{this._popUp.removeChild(e)})),this._popUp.opened=!1}async temOpcional(e){const t=e.split(",");return new Promise(((e,n)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?e(!0):Promise.all(t.map((e=>this.getAttributeFromHTMLWrapper("opc"+e)))).then((t=>{e(t.includes("1"))})).catch((e=>{n(e)}))})).catch((e=>{n(e)}))}))}async getConfig(e){let t={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:e,tipo:"T"}}};return new Promise(((e,n)=>{ee.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(t)).then((t=>{var n;return e(null===(n=t.config)||void 0===n?void 0:n.data)})).catch((e=>n(e)))}))}async saveConfig(e,t){let n={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:e,tipo:"T",data:t}}};return new Promise(((e,t)=>{ee.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(n)).then((t=>e(t))).catch((e=>t(e)))}))}async getAttributeFromHTMLWrapper(e){return Promise.resolve(window[e])}async openApp(e,t){ie.openAppActivity(e,t)}async createDataunit(e){return new Promise((t=>{const n=this.dataUnitFetcher.getDataUnit(e,this.resourceID);n.loadMetadata().then((()=>t(n)))}))}async getDataUnit(e,t){return new Promise(((n,i)=>{const r=this._duCache.get(t);r?n(r):this.createDataunit(e).then((e=>{t&&this._duCache.set(t,e),n(e)})).catch((e=>i(e)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async alert(e,t,n,i){return p.alert(e,t,n,i)}async error(e,t,n,i){return p.error(e,t,n,i)}async confirm(e,t,n,i,r){return p.confirm(e,t,n,i,r)}async info(e,t){return p.info(e,t)}async loadFormConfig(e){return this.formConfigFetcher.loadFormConfig(e,this.resourceID)}async loadGridConfig(e){return this.gridConfigFetcher.getConfig(e,this.resourceID)}async saveGridConfig(e){return this.gridConfigFetcher.saveConfig(e,this.resourceID)}async getAuthList(e){return await(new ve).parseFromJSON(e)}get urlParams(){return this._urlParams||(this._urlParams=Z.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new ne),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new oe),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new ae),this._gridConfigFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new ue),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new he),this._authFetcher}async executeSearch(e,t,n){const i=null==n?void 0:n.getField(t);if(i){const{mode:t,argument:r}=e,{ENTITYNAME:s,CODEFIELD:a,DESCRIPTIONFIELD:u,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,l=i.dependencies;let d;const v={rootEntity:c,descriptionFieldName:u,codeFieldName:a,showInactives:!1};return null==l||l.filter((e=>{var t;return null===(t=e.masterFields)||void 0===t?void 0:t.every((e=>{var t;return null===(t=n.getField(e))||void 0===t?void 0:t.visible}))})).forEach((e=>{var t;e.type===f.SEARCHING&&(null===(t=e.masterFields)||void 0===t?void 0:t.length)>0&&(d={expression:e.expression,params:e.masterFields.map((e=>{const t=n.getField(e),i=(null==t?void 0:t.dataType)||o.TEXT,r=n.getFieldValue(e);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${t.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${t.label} para executar a pesquisa.`);return{name:e,value:r,dataType:i}}))})})),"ADVANCED"===t?new Promise((e=>{const t=document.createElement("snk-pesquisa");t.argument=r,t.searchLoader=e=>this.pesquisaFetcher.loadAdvancedSearch(s,e,d,v),t.selectItem=t=>{e(t),this.cleanPopUpTitle(),this.closePopUp()},this.setPopUpTitle(h),this.showPopUp(t)})):this.pesquisaFetcher.loadSearchOptions(s,r,d,v)}}async isDebugMode(){return new Promise((e=>{e(window.isDebugMode)}))}cleanPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(e){this._popUp.ezTitle=e}componentWillLoad(){this._errorHandler=new me(this),d.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${Z.getUrlBase()}/mge/upload/file`),d.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((e,t,n)=>this.executeSearch(e,t,n))),d.setContextValue("__EZUI__GRID_LICENSE__",ge),v.init(),d.setContextValue("__SNK__APPLICATION__",this)}connectedCallback(){ee.addRequestListener(this._requestListener)}disconnectedCallback(){ee.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return n("div",null,n("ez-loading-bar",{ref:e=>this._requestListener.loadingBar=e}),n("ez-popup",{opened:!1,ref:e=>this._popUp=e,onEzClosePopup:()=>this.closePopUp()}))}};class Se{constructor(){this._debounceTime=1e3,this._countRequest=0}onRequestStart(){this.loadingBar.show(),this._countRequest++,this._timerLoading&&clearTimeout(this._timerLoading)}onRequestEnd(){this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime)}}Oe.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{Oe as snk_application}
69
+ }`)}loadSearchOptions(e,t,n,i){const r=(null==t?void 0:t.trim())||void 0;return t=isNaN(Number(r))&&r?`%${r}`:r,new Promise(((r,s)=>{ee.get().callGraphQL({values:{argument:t,entityName:e,criteria:n,options:i},query:this._templateByQuery.get("search")}).then((e=>{r(e)})).catch((e=>{s(e)}))}))}loadAdvancedSearch(e,t,n,i){const r={query:{$:null==n?void 0:n.expression}};(null==n?void 0:n.params.length)>0&&(r.params={param:n.params.map((e=>({$:e.value,type:ce(e.dataType)})))});const s={serviceName:"PesquisaSP.getSuggestion",requestBody:{criteria:{entityName:e,compacted:!1,ignoreEntityCriteria:!1,limit:this._defaultPageSize,query:{$:t},orderByDesc:!1,externalCriteria:r,localEntityName:null==i?void 0:i.rootEntity},clientEventList:{clientEvent:[]}}};return new Promise(((e,t)=>{ee.get().callServiceBroker("PesquisaSP.getSuggestion",JSON.stringify(s)).then((t=>e(t))).catch((e=>t(e)))}))}}function ce(e){switch(e){case o.NUMBER:return"I";case o.DATE:return"D";default:return"S"}}class he extends se{getData(e){const t=`cfg://auth/${e}`;return new Promise(((e,n)=>{this.loadResource(t).then((t=>{let n=c.stringToObject(t);n&&"object"==typeof n&&e(n)})).catch((e=>{n(e)}))}))}}!function(e){e.INSERT="I",e.UPDATE="A",e.REMOVE="E",e.SHOW="C",e.CONFIG="F",e.CONFIG_NUMBER="N",e.CLONE="D",e.CONFIG_GRID="G"}(w||(w={}));const le=fe;function fe(e,t){const n=de();return(fe=function(e){return n[e-=378]})(e,t)}function de(){const e=["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(de=function(){return e})()}!function(){const e=fe,t=de();for(;;)try{if(281287==parseInt(e(399))/1*(-parseInt(e(387))/2)+-parseInt(e(401))/3+parseInt(e(381))/4*(-parseInt(e(389))/5)+parseInt(e(388))/6*(-parseInt(e(386))/7)+parseInt(e(379))/8+parseInt(e(396))/9+parseInt(e(383))/10)break;t.push(t.shift())}catch(e){t.push(t.shift())}}();class ve{[le(397)](e){const t=le;if(typeof(e=utxt(e[t(390)]))==t(392)&&(e=JSON[t(400)](e)),null==e)throw Error(t(395));const n=new pe("S"===e[t(402)]||!0===e[t(402)]);return Array[t(394)](e[t(391)])&&e[t(391)][t(385)]((e=>n.putAccess(e[t(382)],String(e.status)==t(398)))),n}}class pe{constructor(e){const t=le;this.isSup=e,this[t(384)]={}}[le(378)](e,t){this[le(384)][e]=t}[le(393)](e){const t=le;if(this[t(402)])return!0;let n=!0;return this[t(384)][t(380)](e)&&(n=this.actions[e]),n}isUserSup(){return this.isSup}}class me{constructor(e){this._app=e,window.addEventListener("error",(e=>this.errorHandler(e))),window.addEventListener("unhandledrejection",(e=>this.rejectionHandler(e)))}rejectionHandler(e){const t=e.reason;t instanceof h||(t?this.processException(t):this._app.isDebugMode().then((e=>{e&&this._app.error("Promise rejeitada","Erro interno: Uma promise foi rejeitada sem razão determinada.")})))}errorHandler(e){this.processException(e.error)}processException(e){e instanceof h||e instanceof l?this._app.alert(e.title,e.message):e instanceof i?this._app.error(e.title,e.message):this._app.isDebugMode().then((t=>{t&&(e instanceof Error?this._app.error(e.name,e.message):this._app.error((null==e?void 0:e.title)||"Erro detectado","string"==typeof e?e:e.message||`Erro interno "${e}"`))}))}}function ye(){const e=["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(ye=function(){return e})()}const be=we;function we(e,t){const n=ye();return(we=function(e){return n[e-=392]})(e,t)}!function(){const e=we,t=ye();for(;;)try{if(951926==-parseInt(e(398))/1+-parseInt(e(393))/2+parseInt(e(395))/3+-parseInt(e(400))/4*(parseInt(e(392))/5)+-parseInt(e(401))/6*(-parseInt(e(402))/7)+parseInt(e(397))/8+-parseInt(e(399))/9*(-parseInt(e(394))/10))break;t.push(t.shift())}catch(e){t.push(t.shift())}}();const ge=be(396),Oe=class{constructor(n){e(this,n),this.applicationLoaded=t(this,"applicationLoaded",7),this.applicationLoading=t(this,"applicationLoading",7),this._duCache=new Map,this._requestListener=new Se}get parameters(){return this._parameters||(this._parameters=new re),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||ie.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return new Promise(((e,t)=>{this._auth?e(this._auth):this.authFetcher.getData(this._resourceID).then((t=>{this._auth=t,e(t)})).catch((e=>t(e)))}))}async isUserSup(){return new Promise(((e,t)=>{this.auth.then((n=>{this.getAuthList(n).then((t=>{e(t.isSup)})).catch((e=>t(e)))}))}))}async hasAccess(e){return new Promise(((t,n)=>{this.auth.then((i=>{this.getAuthList(i).then((n=>{t(n.isSup||n.actions[e])})).catch((e=>n(e)))}))}))}async getAllAccess(){return new Promise(((e,t)=>{this.auth.then((n=>{this.getAuthList(n).then((t=>{const n={};n.isSup=t.isSup,Object.entries(w).forEach((e=>{n[e[0]]=t.actions[e[1]]||!1})),e(n)})).catch((e=>t(e)))}))}))}async getStringParam(e){return this.parameters.asString(e,this.resourceID)}async getIntParam(e){return this.parameters.asInteger(e,this.resourceID)}async getFloatParam(e){return this.parameters.asFloat(e,this.resourceID)}async getBooleanParam(e){return this.parameters.asBoolean(e,this.resourceID)}async getDateParam(e){return this.parameters.asDate(e,this.resourceID)}async showPopUp(e){this.clearPopUpContent(),this._popUp.appendChild(e),this._popUp.opened=!0}async closePopUp(){this.clearPopUpContent(),this._popUp.opened=!1}async temOpcional(e){const t=e.split(",");return new Promise(((e,n)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?e(!0):Promise.all(t.map((e=>this.getAttributeFromHTMLWrapper("opc"+e)))).then((t=>{e(t.includes("1"))})).catch((e=>{n(e)}))})).catch((e=>{n(e)}))}))}async getConfig(e){let t={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:e,tipo:"T"}}};return new Promise(((e,n)=>{ee.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(t)).then((t=>{var n;return e(null===(n=t.config)||void 0===n?void 0:n.data)})).catch((e=>n(e)))}))}async saveConfig(e,t){let n={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:e,tipo:"T",data:t}}};return new Promise(((e,t)=>{ee.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(n)).then((t=>e(t))).catch((e=>t(e)))}))}async getAttributeFromHTMLWrapper(e){return Promise.resolve(window[e])}async openApp(e,t){ie.openAppActivity(e,t)}async createDataunit(e){return new Promise((t=>{const n=this.dataUnitFetcher.getDataUnit(e,this.resourceID);n.loadMetadata().then((()=>t(n)))}))}async getDataUnit(e,t){return new Promise(((n,i)=>{const r=this._duCache.get(t);r?n(r):this.createDataunit(e).then((e=>{t&&this._duCache.set(t,e),n(e)})).catch((e=>i(e)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async alert(e,t,n,i){return p.alert(e,t,n,i)}async error(e,t,n,i){return p.error(e,t,n,i)}async confirm(e,t,n,i,r){return p.confirm(e,t,n,i,r)}async info(e,t){return p.info(e,t)}async loadFormConfig(e){return this.formConfigFetcher.loadFormConfig(e,this.resourceID)}async loadGridConfig(e){return this.gridConfigFetcher.getConfig(e,this.resourceID)}async saveGridConfig(e){return this.gridConfigFetcher.saveConfig(e,this.resourceID)}async getAuthList(e){return await(new ve).parseFromJSON(e)}get urlParams(){return this._urlParams||(this._urlParams=Z.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new ne),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new oe),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new ae),this._gridConfigFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new ue),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new he),this._authFetcher}async executeSearch(e,t,n){const i=null==n?void 0:n.getField(t);if(i){const{mode:t,argument:r}=e,{ENTITYNAME:s,CODEFIELD:a,DESCRIPTIONFIELD:u,ROOTENTITY:c,DESCRIPTIONENTITY:h}=i.properties,l=i.dependencies;let d;const v={rootEntity:c,descriptionFieldName:u,codeFieldName:a,showInactives:!1};return null==l||l.filter((e=>{var t;return null===(t=e.masterFields)||void 0===t?void 0:t.every((e=>{var t;return null===(t=n.getField(e))||void 0===t?void 0:t.visible}))})).forEach((e=>{var t;e.type===f.SEARCHING&&(null===(t=e.masterFields)||void 0===t?void 0:t.length)>0&&(d={expression:e.expression,params:e.masterFields.map((e=>{const t=n.getField(e),i=(null==t?void 0:t.dataType)||o.TEXT,r=n.getFieldValue(e);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${t.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${t.label} para executar a pesquisa.`);return{name:e,value:r,dataType:i}}))})})),"ADVANCED"===t?new Promise((e=>{const t=document.createElement("snk-pesquisa");t.argument=r,t.searchLoader=e=>this.pesquisaFetcher.loadAdvancedSearch(s,e,d,v),t.selectItem=t=>{e(t),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(h),this.showPopUp(t)})):this.pesquisaFetcher.loadSearchOptions(s,r,d,v)}}async isDebugMode(){return new Promise((e=>{e(window.isDebugMode)}))}clearPopUpContent(){this._popUp&&Array.from(this._popUp.children).forEach((e=>{this._popUp.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(e){this._popUp.ezTitle=e}componentWillLoad(){this._errorHandler=new me(this),d.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${Z.getUrlBase()}/mge/upload/file`),d.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((e,t,n)=>this.executeSearch(e,t,n))),d.setContextValue("__EZUI__GRID_LICENSE__",ge),v.init(),d.setContextValue("__SNK__APPLICATION__",this)}connectedCallback(){ee.addRequestListener(this._requestListener)}disconnectedCallback(){ee.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return n("div",null,n("ez-loading-bar",{ref:e=>this._requestListener.loadingBar=e}),n("ez-popup",{opened:!1,ref:e=>this._popUp=e,onEzClosePopup:()=>this.closePopUp()}))}};class Se{constructor(){this._debounceTime=1e3,this._countRequest=0}onRequestStart(){this.loadingBar.show(),this._countRequest++,this._timerLoading&&clearTimeout(this._timerLoading)}onRequestEnd(){this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime)}}Oe.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{Oe as snk_application}
@@ -1 +1 @@
1
- import{p as a,b as t}from"./p-a45dba1a.js";(()=>{const t=import.meta.url,e={};return""!==t&&(e.resourcesUrl=new URL(".",t).href),a(e)})().then((a=>t([["p-a8305c35",[[1,"teste-pesquisa"]]],["p-9c225717",[[2,"snk-form",{formTitle:[1,"form-title"],configName:[1,"config-name"],actionsList:[16],_dataUnit:[32],_configLoaded:[32],_dataState:[32]}]]],["p-560fdf54",[[6,"snk-grid",{configName:[1,"config-name"],actionsList:[16],_dataUnit:[32],_configLoaded:[32],_dataState:[32]}]]],["p-3fce3190",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],messageBuilder:[16],beforeSave:[16],afterSave:[16],autoLoad:[4,"auto-load"],getDataUnit:[64]}]]],["p-a670853c",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-3cb106f7",[[2,"snk-application",{isUserSup:[64],hasAccess:[64],getAllAccess:[64],getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],showPopUp:[64],closePopUp:[64],temOpcional:[64],getConfig:[64],saveConfig:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getDataUnit:[64],getResourceID:[64],alert:[64],error:[64],confirm:[64],info:[64],loadFormConfig:[64],loadGridConfig:[64],saveGridConfig:[64],executeSearch:[64],isDebugMode:[64]}]]],["p-8f7b9a85",[[6,"snk-taskbar",{buttons:[1],actionsList:[16],primaryButton:[1,"primary-button"],disabledButtons:[16],dataUnit:[16],_permissions:[32]}]]]],a)));
1
+ import{p as a,b as t}from"./p-a45dba1a.js";(()=>{const t=import.meta.url,e={};return""!==t&&(e.resourcesUrl=new URL(".",t).href),a(e)})().then((a=>t([["p-a8305c35",[[1,"teste-pesquisa"]]],["p-9c225717",[[2,"snk-form",{formTitle:[1,"form-title"],configName:[1,"config-name"],actionsList:[16],_dataUnit:[32],_configLoaded:[32],_dataState:[32]}]]],["p-560fdf54",[[6,"snk-grid",{configName:[1,"config-name"],actionsList:[16],_dataUnit:[32],_configLoaded:[32],_dataState:[32]}]]],["p-21c2457b",[[2,"snk-data-unit",{dataState:[1040],dataUnitName:[1,"data-unit-name"],entityName:[1,"entity-name"],pageSize:[2,"page-size"],dataUnit:[1040],messageBuilder:[16],beforeSave:[16],afterSave:[16],autoLoad:[4,"auto-load"],getDataUnit:[64]}]]],["p-1c19b89c",[[2,"snk-pesquisa",{searchLoader:[16],selectItem:[16],argument:[1025],_itemList:[32],_startLoading:[32]}]]],["p-bc14f01e",[[2,"snk-application",{isUserSup:[64],hasAccess:[64],getAllAccess:[64],getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],showPopUp:[64],closePopUp:[64],temOpcional:[64],getConfig:[64],saveConfig:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getDataUnit:[64],getResourceID:[64],alert:[64],error:[64],confirm:[64],info:[64],loadFormConfig:[64],loadGridConfig:[64],saveGridConfig:[64],executeSearch:[64],isDebugMode:[64]}]]],["p-8f7b9a85",[[6,"snk-taskbar",{buttons:[1],actionsList:[16],primaryButton:[1,"primary-button"],disabledButtons:[16],dataUnit:[16],_permissions:[32]}]]]],a)));
@@ -21,7 +21,7 @@ export declare class SnkApplication {
21
21
  _pesquisaFetcher: PesquisaFetcher;
22
22
  _authFetcher: AuthFetcher;
23
23
  _resourceID: string;
24
- _popUp: HTMLElement;
24
+ _popUp: HTMLEzPopupElement;
25
25
  _errorHandler: SnkErrorHandler;
26
26
  _duCache: Map<string, DataUnit>;
27
27
  _requestListener: RequestListenerLoadingBar;
@@ -147,8 +147,9 @@ export declare class SnkApplication {
147
147
  private get authFetcher();
148
148
  executeSearch(searchArgument: any, fieldName: string, dataUnit: DataUnit): Promise<Array<Option> | Option>;
149
149
  isDebugMode(): Promise<boolean>;
150
- cleanPopUpTitle(): void;
151
- setPopUpTitle(title: string): void;
150
+ private clearPopUpContent;
151
+ private clearPopUpTitle;
152
+ private setPopUpTitle;
152
153
  componentWillLoad(): void;
153
154
  connectedCallback(): void;
154
155
  disconnectedCallback(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/sankhyablocks",
3
- "version": "1.3.31-beta.6",
3
+ "version": "1.3.31-beta.7",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as e,g as i,H as a}from"./p-a45dba1a.js";import{Action as n,ApplicationContext as o}from"@sankhyalabs/core";import{ApplicationUtils as r}from"@sankhyalabs/ezui/dist/collection/utils";const h=class{constructor(e){t(this,e),this.dataStateChange=s(this,"dataStateChange",7),this.dataUnitReady=s(this,"dataUnitReady",7),this.insertionMode=s(this,"insertionMode",7),this._onDataUnitResolve=[],this.pageSize=150,this.autoLoad=!0,this._dataUnitObserver=t=>{let s=this.getActionInfo(t.type);s&&r.info(s),t.type!==n.RECORDS_ADDED&&t.type!==n.RECORDS_COPIED||this.insertionMode.emit();const e={insertionMode:!1,hasNext:this.dataUnit.hasNext(),hasPrevious:this.dataUnit.hasPrevious(),copyMode:!1,isDirty:this.dataUnit.isDirty(),selectedRecords:this.dataUnit.getSelectedRecords()};this.dataUnit.records.forEach((t=>{t.__record__id__.startsWith("NEW_")&&(e.insertionMode=!0,e.copyMode||(e.copyMode=null!=t.__record__source__id__))})),this.dataState=e}}observePageSize(){this.dataUnit&&(this.dataUnit.pageSize=this.pageSize)}observeDataUnitName(t,s){s!=t&&(this.dataUnit=void 0,this.dataUnitName=t,this.loadDataUnit())}observeEntityName(t,s){s!=t&&(this.dataUnit=void 0,this.entityName=t,this.loadDataUnit())}observeDataState(t,s){s!=t&&this.dataStateChange.emit(t)}observeDataUnit(){this.dataUnitReady.emit(this.dataUnit)}async getDataUnit(){return new Promise((t=>{this.dataUnit?t(this.dataUnit):this._onDataUnitResolve.push(t)}))}async interceptAction(t){return new Promise((s=>{switch(t.type){case n.SAVING_DATA:if(this.beforeSave){const e=this.beforeSave(this.dataUnit);e instanceof Promise?e.then((e=>s(e?t:void 0))):s(e?t:void 0)}else s(t);break;case n.DATA_SAVED:this.afterSave?this.afterSave(this.dataUnit):s(t);break;case n.EDITION_CANCELED:r.confirm(this.i18n("components.warning"),this.i18n("components.confirmCancelEdition")).then((e=>s(e?t:void 0)));break;case n.REMOVING_RECORDS:r.confirm(this.i18n("components.delete"),this.i18n("components.confirmRemoveRecord"),"delete",!0,{btnConfirmDanger:!0}).then((e=>s(e?t:void 0)));break;default:s(t)}}))}getActionInfo(t){return this.messageBuilder?this.messageBuilder(t,this.dataState,this.dataUnit):t===n.EDITION_CANCELED?this.i18n("components.editionCanceled"):void 0}async loadDataUnit(){if(!this.dataUnit){const t=o.getContextValue("__SNK__APPLICATION__");if(t&&this.entityName){const s=this.dataUnitName?this.dataUnitName:this.entityName;let e;for(this.dataUnit=await t.getDataUnit(this.entityName,s),this.dataUnit.pageSize=this.pageSize,this.dataUnit.unsubscribe(this._dataUnitObserver),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this._dataUnitObserver);e=this._onDataUnitResolve.pop();)e(this.dataUnit);this.autoLoad&&this.dataUnit.loadData()}}}i18n(t){return{"components.warning":"Aviso","components.delete":"Excluir","components.confirmRemoveRecord":"Deseja realmente excluir o registro atual?","components.confirmCancelEdition":"As alterações realizadas serão descartadas<br/><br/><b>Você realmente gostaria de sair?</b>","components.editionCanceled":"Todas as alterações foram descartadas."}[t]}componentDidRender(){this.loadDataUnit()}render(){return e(a,null)}get element(){return i(this)}static get watchers(){return{pageSize:["observePageSize"],dataUnitName:["observeDataUnitName"],entityName:["observeEntityName"],dataState:["observeDataState"],dataUnit:["observeDataUnit"]}}};h.style=".sc-snk-data-unit-h{display:flex;flex-direction:column;height:100%}";export{h as snk_data_unit}
@@ -1 +0,0 @@
1
- import{r as s,h as t,H as i}from"./p-a45dba1a.js";import{ObjectUtils as e,StringUtils as r}from"@sankhyalabs/core";const a=class{constructor(t){s(this,t),this._mdByName={},this._startHighlightTag="<span class='card-item__highlight'>",this._endHighlightTag="</span>",this._specialCharsRegex=/[[.\-\$\+\*,_\&\(\)%\/\\#@!:\|\=\'\"]/gim,this._charsWithAccentuation="ÁÉÍÓÚ_ÃÕ_ÂÊÎÔÛ_ÀÈÌÒÙ_Ü_Ç_áéíóú_ãõ_âêîôû_àèìòù_ü_ç",this._charsWithoutAccentuation="AEIOU_AO_AEIOU_AEIOU_U_C_aeiou_ao_aeiou_aeiou_u_c",this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=450,this._startLoading=!1}observeArgument(){this._textInput&&(this._textInput.value=this.argument)}clearSearch(){this.argument="",this._itemList=void 0}buildDetails(s,t){let i={};for(let e=0;e<s.length;e++){const r=s[e],a=t[r.fieldName];i[r.description]=this.highlightValue(t.__matchFields,r.options&&r.options[a]||a,s,!0)}return i}buildFirstFields(s,t,i=6){return s&&Array.isArray(s)&&s.forEach((s=>{let i=this.removeReference(t,this._mdByName[s]);i&&t.unshift(i)})),t=t.slice(0,i)}doSearch(s){this.searchLoader&&"function"==typeof this.searchLoader&&(this._startLoading=!0,this.searchLoader(s).then((s=>{if(this._startLoading=!1,s){let t=(s=e.stringToObject(s.json.$)).descriptionField,i=s.pkField;if(t&&i){let e=[];s.data.forEach((r=>{var a;let n=this.filterFieldsMetadata(s,r),o=this.buildFirstFields(r.__matchFields,n),l={key:this.highlightValue(r.__matchFields,null===(a=r[i])||void 0===a?void 0:a.toString(),o,!0),title:this.highlightValue(r.__matchFields,r[t],o,!0),details:this.buildDetails(o,r)};e.push(l)})),this._itemList=e}}})).catch((s=>{this._startLoading=!1,this._itemList=[],console.warn(s)})))}filterFieldsMetadata(s,t){return s.fieldsMetadata.filter((i=>{let e=!r.isEmpty(t[i.fieldName])&&!1!==i.visible&&"B"!==i.type&&s.pkField!==i.fieldName&&s.descriptionField!==i.fieldName&&(i.isPrimaryKey||!i.isLinkField)&&!("S"===i.type&&"H"===i.presentationType);return e&&(this._mdByName[i.fieldName]=i),("string"!=typeof t[i.fieldName]||!(t[i.fieldName].indexOf("<img")>-1||t[i.fieldName].indexOf("<svg")>-1))&&e}))}removeAtIndex(s,t){if(t>=0&&t<s.length)return s.splice(t,1)[0]}removeReference(s,t){let i=this.indexOf(s,t);return this.removeAtIndex(s,i)}indexOf(s,t){let i=-1;return Array.isArray(s)&&this.find(s,((s,e)=>(i=e,this.equals(t,s)))),i}equals(s,t){return e.objectToString(s)===e.objectToString(t)}find(s,t){if(s)for(let i=0,e=s.length;i<e;i++)if(t(s[i],i,s))return s[i]}highlightValue(s,t,i,e){let r=this.replaceHtmlEntities(t);if(this.argument&&(e||this.isIn(s,i.fieldName))){const s=this.getArgumentNumber();let t=(isNaN(s)?this.argument:s.toString()).split(/%|,|\s+/),e=0,a=this.replaceAccentuatedChars(r);t.forEach((s=>{if(s){s=this.replaceAccentuatedChars(s);let t=this.getSpecialCharacters(s);null!=t&&t.length>0&&(s=this.removeSpecialCharacters(s)),(i.mask||"CGC_CPF"===i.uiType||"Phone"===i.uiType)&&(s=s.split("").join("\\.?\\-?\\/?\\(?\\)?"));let n=new RegExp(s,"ig");n.lastIndex=e;let o=n.exec(a);if(o&&o.length>0){e=o.index;let s=o[0].length,t=r.substring(e,e+s),i=(null==t?void 0:t.trim())?this._startHighlightTag+t+this._endHighlightTag:"",n=r.substring(0,e),l=r.substring(e+s);r=n+i+l,e+=i.length,a=this.replaceAccentuatedChars(r)}}}))}return r}replaceHtmlEntities(s){return null==s?s:String(s).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}replaceAccentuatedChars(s){return null==s?s:this.replaceToSpace(s,["&amp;","&lt;","&gt;","&quot;"]).replace(/[^\w ]/g,(s=>{let t=this._charsWithAccentuation.indexOf(s);return t>-1&&(s=this._charsWithoutAccentuation.charAt(t)),s||""}))}replaceToSpace(s,t=[]){return null==s||t.forEach((t=>{const i=new RegExp(t,"g");let e="";for(let s=0;s<t.length;s++)e+=" ";s=String(s).replace(i,e)})),s}isIn(s,t){return this.indexOf(s,t)>-1}getSpecialCharacters(s){let t,i=[];for(;t=this._specialCharsRegex.exec(s);)i.push(s[t.index]);return i}removeSpecialCharacters(s){return this.getSpecialCharacters(s).forEach((t=>{s=this.replaceAll(s,t,"")})),s}replaceAll(s,t,i){let e=(null!=s?s:"").indexOf(t);for(;e>-1;)e=(s=s.replace(t,i)).indexOf(t);return s}getArgumentNumber(){return Number(this.argument||void 0)}createOption(s){const{key:t,title:i}=s,e=new RegExp(this._startHighlightTag,"g"),r=new RegExp(this._endHighlightTag,"g"),a={value:null==t?void 0:t.replace(e,"").replace(r,""),label:null==i?void 0:i.replace(e,"").replace(r,"")};this.selectItem(a)}onChangeValue(s){if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=setTimeout((()=>{this.onChangeValue(s)}),this._deboucingTime));this.argument=(s.detail||"").trim();const t=this.getArgumentNumber();this.argument&&(!isNaN(t)||this.argument.length>=this._limitCharsToSearch)?this._changeDeboucingTimeout=setTimeout((()=>{this.doSearch(isNaN(t)?this.argument:t.toString())}),this._deboucingTime):this._itemList=void 0}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=void 0)}onClickSearch(){this.doSearch((this.argument||"").trim())}getMessageView(){return this._startLoading?"Aguarde, buscando registros...":this._itemList?this._itemList.length>=1?`${this._itemList.length} ${this._itemList.length>1?"registros encontrados":"registro encontrado"}`:"Nenhum registro encontrado":"Os resultados de sua pesquisa aparecerão aqui..."}render(){return t(i,null,t("div",{class:"snk-pesquisa"},t("div",{class:"snk-pesquisa__input"},t("ez-text-input",{label:"Buscar",class:"ez-margin-right--medium",canShowError:!1,ref:s=>this._textInput=s,onEzChange:s=>this.onChangeValue(s),value:this.argument},t("ez-icon",{slot:"leftIcon",iconName:"search"}),t("ez-icon",{class:"snk-pesquisa__input-close",slot:"rightIcon",iconName:"close",onClick:()=>{this.clearSearch()}})),t("ez-button",{class:"ez-button--primary",label:"Pesquisar",onClick:()=>this.onClickSearch()})),t("label",{class:"snk-pesquisa__records"},this.getMessageView()),t("div",{class:"snk-pesquisa__content"},this._itemList&&this._itemList.map((s=>t("ez-card-item",{onEzClick:s=>this.createOption(s.detail),item:s}))))))}static get watchers(){return{argument:["observeArgument"]}}};a.style=".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--text--primary, #626e82);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-medium, 12px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px) display: block;max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input-close.sc-snk-pesquisa{cursor:pointer}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}";export{a as snk_pesquisa}