@sankhyalabs/sankhyablocks 1.3.31-beta.6 → 1.3.31-beta.8
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.
- package/dist/cjs/snk-application.cjs.entry.js +17 -9
- package/dist/cjs/snk-data-unit.cjs.entry.js +29 -4
- package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -2
- package/dist/collection/components/snk-application/snk-application.js +15 -9
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +29 -4
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +49 -10
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +5 -1
- package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +2 -0
- package/dist/components/snk-application2.js +17 -9
- package/dist/components/snk-data-unit.js +29 -4
- package/dist/components/snk-pesquisa2.js +5 -2
- package/dist/esm/snk-application.entry.js +17 -9
- package/dist/esm/snk-data-unit.entry.js +29 -4
- package/dist/esm/snk-pesquisa.entry.js +5 -2
- package/dist/sankhyablocks/p-1c19b89c.entry.js +1 -0
- package/dist/sankhyablocks/{p-3cb106f7.entry.js → p-bc14f01e.entry.js} +1 -1
- package/dist/sankhyablocks/p-eaa0772f.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +4 -3
- package/package.json +1 -1
- package/dist/sankhyablocks/p-3fce3190.entry.js +0 -1
- package/dist/sankhyablocks/p-a670853c.entry.js +0 -1
|
@@ -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
|
|
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
|
-
|
|
7400
|
-
|
|
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.
|
|
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
|
-
|
|
7658
|
-
this._popUp
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -37,6 +40,7 @@ const SnkDataUnit = class {
|
|
|
37
40
|
hasPrevious: this.dataUnit.hasPrevious(),
|
|
38
41
|
copyMode: false,
|
|
39
42
|
isDirty: this.dataUnit.isDirty(),
|
|
43
|
+
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
|
40
44
|
selectedRecords: this.dataUnit.getSelectedRecords()
|
|
41
45
|
};
|
|
42
46
|
this.dataUnit.records.forEach(r => {
|
|
@@ -116,11 +120,20 @@ const SnkDataUnit = class {
|
|
|
116
120
|
}
|
|
117
121
|
break;
|
|
118
122
|
case core.Action.EDITION_CANCELED:
|
|
119
|
-
|
|
120
|
-
.
|
|
123
|
+
if (this.dataState.hasDirtyRecords) {
|
|
124
|
+
utils.ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
125
|
+
.then((result) => resolve(result ? action : undefined));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
resolve(action);
|
|
129
|
+
}
|
|
121
130
|
break;
|
|
122
131
|
case core.Action.REMOVING_RECORDS:
|
|
123
|
-
|
|
132
|
+
let msg = undefined;
|
|
133
|
+
if (this.messageBuilder) {
|
|
134
|
+
msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
|
|
135
|
+
}
|
|
136
|
+
utils.ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
|
|
124
137
|
.then((result) => resolve(result ? action : undefined));
|
|
125
138
|
break;
|
|
126
139
|
default:
|
|
@@ -128,6 +141,18 @@ const SnkDataUnit = class {
|
|
|
128
141
|
}
|
|
129
142
|
});
|
|
130
143
|
}
|
|
144
|
+
isTransitionAction(action) {
|
|
145
|
+
switch (action) {
|
|
146
|
+
case core.Action.LOADING_METADATA:
|
|
147
|
+
case core.Action.LOADING_DATA:
|
|
148
|
+
case core.Action.SAVING_DATA:
|
|
149
|
+
case core.Action.REMOVING_RECORDS:
|
|
150
|
+
case core.Action.CHANGING_DATA:
|
|
151
|
+
return true;
|
|
152
|
+
default:
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
131
156
|
getActionInfo(action) {
|
|
132
157
|
if (this.messageBuilder) {
|
|
133
158
|
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(--
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
134
|
-
|
|
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.
|
|
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
|
-
|
|
394
|
-
this._popUp
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -26,6 +29,7 @@ export class SnkDataUnit {
|
|
|
26
29
|
hasPrevious: this.dataUnit.hasPrevious(),
|
|
27
30
|
copyMode: false,
|
|
28
31
|
isDirty: this.dataUnit.isDirty(),
|
|
32
|
+
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
|
29
33
|
selectedRecords: this.dataUnit.getSelectedRecords()
|
|
30
34
|
};
|
|
31
35
|
this.dataUnit.records.forEach(r => {
|
|
@@ -105,11 +109,20 @@ export class SnkDataUnit {
|
|
|
105
109
|
}
|
|
106
110
|
break;
|
|
107
111
|
case Action.EDITION_CANCELED:
|
|
108
|
-
|
|
109
|
-
.
|
|
112
|
+
if (this.dataState.hasDirtyRecords) {
|
|
113
|
+
ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
114
|
+
.then((result) => resolve(result ? action : undefined));
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
resolve(action);
|
|
118
|
+
}
|
|
110
119
|
break;
|
|
111
120
|
case Action.REMOVING_RECORDS:
|
|
112
|
-
|
|
121
|
+
let msg = undefined;
|
|
122
|
+
if (this.messageBuilder) {
|
|
123
|
+
msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
|
|
124
|
+
}
|
|
125
|
+
ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
|
|
113
126
|
.then((result) => resolve(result ? action : undefined));
|
|
114
127
|
break;
|
|
115
128
|
default:
|
|
@@ -117,6 +130,18 @@ export class SnkDataUnit {
|
|
|
117
130
|
}
|
|
118
131
|
});
|
|
119
132
|
}
|
|
133
|
+
isTransitionAction(action) {
|
|
134
|
+
switch (action) {
|
|
135
|
+
case Action.LOADING_METADATA:
|
|
136
|
+
case Action.LOADING_DATA:
|
|
137
|
+
case Action.SAVING_DATA:
|
|
138
|
+
case Action.REMOVING_RECORDS:
|
|
139
|
+
case Action.CHANGING_DATA:
|
|
140
|
+
return true;
|
|
141
|
+
default:
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
120
145
|
getActionInfo(action) {
|
|
121
146
|
if (this.messageBuilder) {
|
|
122
147
|
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(--
|
|
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-
|
|
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)
|
|
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-
|
|
51
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
7398
|
-
|
|
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.
|
|
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
|
-
|
|
7656
|
-
this._popUp
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -34,6 +37,7 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
34
37
|
hasPrevious: this.dataUnit.hasPrevious(),
|
|
35
38
|
copyMode: false,
|
|
36
39
|
isDirty: this.dataUnit.isDirty(),
|
|
40
|
+
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
|
37
41
|
selectedRecords: this.dataUnit.getSelectedRecords()
|
|
38
42
|
};
|
|
39
43
|
this.dataUnit.records.forEach(r => {
|
|
@@ -113,11 +117,20 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
113
117
|
}
|
|
114
118
|
break;
|
|
115
119
|
case Action.EDITION_CANCELED:
|
|
116
|
-
|
|
117
|
-
.
|
|
120
|
+
if (this.dataState.hasDirtyRecords) {
|
|
121
|
+
ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
122
|
+
.then((result) => resolve(result ? action : undefined));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
resolve(action);
|
|
126
|
+
}
|
|
118
127
|
break;
|
|
119
128
|
case Action.REMOVING_RECORDS:
|
|
120
|
-
|
|
129
|
+
let msg = undefined;
|
|
130
|
+
if (this.messageBuilder) {
|
|
131
|
+
msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
|
|
132
|
+
}
|
|
133
|
+
ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
|
|
121
134
|
.then((result) => resolve(result ? action : undefined));
|
|
122
135
|
break;
|
|
123
136
|
default:
|
|
@@ -125,6 +138,18 @@ const SnkDataUnit$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
125
138
|
}
|
|
126
139
|
});
|
|
127
140
|
}
|
|
141
|
+
isTransitionAction(action) {
|
|
142
|
+
switch (action) {
|
|
143
|
+
case Action.LOADING_METADATA:
|
|
144
|
+
case Action.LOADING_DATA:
|
|
145
|
+
case Action.SAVING_DATA:
|
|
146
|
+
case Action.REMOVING_RECORDS:
|
|
147
|
+
case Action.CHANGING_DATA:
|
|
148
|
+
return true;
|
|
149
|
+
default:
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
128
153
|
getActionInfo(action) {
|
|
129
154
|
if (this.messageBuilder) {
|
|
130
155
|
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(--
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
7396
|
-
|
|
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.
|
|
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
|
-
|
|
7654
|
-
this._popUp
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -33,6 +36,7 @@ const SnkDataUnit = class {
|
|
|
33
36
|
hasPrevious: this.dataUnit.hasPrevious(),
|
|
34
37
|
copyMode: false,
|
|
35
38
|
isDirty: this.dataUnit.isDirty(),
|
|
39
|
+
hasDirtyRecords: this.dataUnit.hasDirtyRecords(),
|
|
36
40
|
selectedRecords: this.dataUnit.getSelectedRecords()
|
|
37
41
|
};
|
|
38
42
|
this.dataUnit.records.forEach(r => {
|
|
@@ -112,11 +116,20 @@ const SnkDataUnit = class {
|
|
|
112
116
|
}
|
|
113
117
|
break;
|
|
114
118
|
case Action.EDITION_CANCELED:
|
|
115
|
-
|
|
116
|
-
.
|
|
119
|
+
if (this.dataState.hasDirtyRecords) {
|
|
120
|
+
ApplicationUtils.confirm(this.i18n("components.warning"), this.i18n("components.confirmCancelEdition"))
|
|
121
|
+
.then((result) => resolve(result ? action : undefined));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
resolve(action);
|
|
125
|
+
}
|
|
117
126
|
break;
|
|
118
127
|
case Action.REMOVING_RECORDS:
|
|
119
|
-
|
|
128
|
+
let msg = undefined;
|
|
129
|
+
if (this.messageBuilder) {
|
|
130
|
+
msg = this.messageBuilder(action.type, this.dataState, this.dataUnit);
|
|
131
|
+
}
|
|
132
|
+
ApplicationUtils.confirm(this.i18n("components.delete"), msg || this.i18n("components.confirmRemoveRecord"), "delete", true, { btnConfirmDanger: true })
|
|
120
133
|
.then((result) => resolve(result ? action : undefined));
|
|
121
134
|
break;
|
|
122
135
|
default:
|
|
@@ -124,6 +137,18 @@ const SnkDataUnit = class {
|
|
|
124
137
|
}
|
|
125
138
|
});
|
|
126
139
|
}
|
|
140
|
+
isTransitionAction(action) {
|
|
141
|
+
switch (action) {
|
|
142
|
+
case Action.LOADING_METADATA:
|
|
143
|
+
case Action.LOADING_DATA:
|
|
144
|
+
case Action.SAVING_DATA:
|
|
145
|
+
case Action.REMOVING_RECORDS:
|
|
146
|
+
case Action.CHANGING_DATA:
|
|
147
|
+
return true;
|
|
148
|
+
default:
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
127
152
|
getActionInfo(action) {
|
|
128
153
|
if (this.messageBuilder) {
|
|
129
154
|
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(--
|
|
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
|
-
|
|
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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}replaceAccentuatedChars(s){return null==s?s:this.replaceToSpace(s,["&","<",">","""]).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}
|
|
@@ -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}
|
|
@@ -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(),hasDirtyRecords:this.dataUnit.hasDirtyRecords(),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:this.dataState.hasDirtyRecords?h.confirm(this.i18n("components.warning"),this.i18n("components.confirmCancelEdition")).then((e=>s(e?t:void 0))):s(t);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}
|
|
@@ -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-
|
|
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-eaa0772f",[[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:
|
|
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
|
-
|
|
151
|
-
|
|
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 +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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}replaceAccentuatedChars(s){return null==s?s:this.replaceToSpace(s,["&","<",">","""]).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}
|