@sankhyalabs/sankhyablocks 2.1.8 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/snk-application.cjs.entry.js +6 -4
- package/dist/cjs/snk-config-options.cjs.entry.js +3 -0
- package/dist/cjs/snk-configurator_3.cjs.entry.js +5 -1
- package/dist/cjs/snk-filter-bar_7.cjs.entry.js +37 -6
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +7 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +10 -1
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +7 -0
- package/dist/cjs/snk-filter-number.cjs.entry.js +7 -0
- package/dist/cjs/snk-filter-period.cjs.entry.js +7 -0
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +6 -0
- package/dist/cjs/snk-filter-search.cjs.entry.js +6 -0
- package/dist/cjs/snk-filter-text.cjs.entry.js +7 -0
- package/dist/cjs/snk-form-config.cjs.entry.js +7 -2
- package/dist/cjs/snk-form.cjs.entry.js +1 -1
- package/dist/cjs/snk-pesquisa.cjs.entry.js +4 -0
- package/dist/collection/components/snk-application/snk-application.js +10 -5
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +7 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +7 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +10 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +10 -2
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +10 -2
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +1 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +11 -2
- package/dist/collection/components/snk-form/snk-form.js +1 -1
- package/dist/collection/components/snk-form/subcomponents/snk-config-options/snk-config-options.js +4 -1
- package/dist/collection/components/snk-form/subcomponents/snk-field-config/snk-field-config.js +5 -1
- package/dist/collection/components/snk-form/subcomponents/snk-form-config/snk-form-config.js +8 -3
- package/dist/collection/components/snk-grid/snk-grid.js +1 -1
- package/dist/collection/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.js +9 -3
- package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +5 -1
- package/dist/components/snk-application2.js +6 -4
- package/dist/components/snk-config-options2.js +4 -1
- package/dist/components/snk-field-config2.js +5 -1
- package/dist/components/snk-filter-bar2.js +12 -3
- package/dist/components/snk-filter-binary-select.js +7 -0
- package/dist/components/snk-filter-detail2.js +10 -1
- package/dist/components/snk-filter-item2.js +10 -2
- package/dist/components/snk-filter-list2.js +10 -2
- package/dist/components/snk-filter-multi-select.js +7 -0
- package/dist/components/snk-filter-number.js +7 -0
- package/dist/components/snk-filter-period.js +7 -0
- package/dist/components/snk-filter-personalized.js +7 -1
- package/dist/components/snk-filter-search.js +7 -1
- package/dist/components/snk-filter-text.js +7 -0
- package/dist/components/snk-form-config2.js +8 -3
- package/dist/components/snk-form2.js +1 -1
- package/dist/components/snk-grid-config2.js +9 -3
- package/dist/components/snk-grid2.js +1 -1
- package/dist/components/snk-pesquisa2.js +5 -1
- package/dist/esm/snk-application.entry.js +6 -4
- package/dist/esm/snk-config-options.entry.js +4 -1
- package/dist/esm/snk-configurator_3.entry.js +6 -2
- package/dist/esm/snk-filter-bar_7.entry.js +38 -7
- package/dist/esm/snk-filter-binary-select.entry.js +8 -1
- package/dist/esm/snk-filter-detail.entry.js +11 -2
- package/dist/esm/snk-filter-multi-select.entry.js +8 -1
- package/dist/esm/snk-filter-number.entry.js +8 -1
- package/dist/esm/snk-filter-period.entry.js +8 -1
- package/dist/esm/snk-filter-personalized.entry.js +8 -2
- package/dist/esm/snk-filter-search.entry.js +8 -2
- package/dist/esm/snk-filter-text.entry.js +8 -1
- package/dist/esm/snk-form-config.entry.js +9 -4
- package/dist/esm/snk-form.entry.js +1 -1
- package/dist/esm/snk-pesquisa.entry.js +6 -2
- package/dist/sankhyablocks/{p-105cd4a8.entry.js → p-0ffee54f.entry.js} +1 -1
- package/dist/sankhyablocks/p-4f9aa0b0.entry.js +1 -0
- package/dist/sankhyablocks/p-570cc474.entry.js +1 -0
- package/dist/sankhyablocks/p-5fc34bc1.entry.js +1 -0
- package/dist/sankhyablocks/p-63229ecb.entry.js +1 -0
- package/dist/sankhyablocks/{p-639b8f6e.entry.js → p-6340d992.entry.js} +1 -1
- package/dist/sankhyablocks/p-7dcce5aa.entry.js +1 -0
- package/dist/sankhyablocks/p-7e79ab39.entry.js +1 -0
- package/dist/sankhyablocks/p-8fca7910.entry.js +1 -0
- package/dist/sankhyablocks/p-9b0f99fd.entry.js +1 -0
- package/dist/sankhyablocks/p-b4e199d9.entry.js +1 -0
- package/dist/sankhyablocks/p-b5799889.entry.js +1 -0
- package/dist/sankhyablocks/p-bc41625b.entry.js +1 -0
- package/dist/sankhyablocks/p-da0a0b8c.entry.js +1 -0
- package/dist/sankhyablocks/p-f50c6ef6.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -1
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-number.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-period.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +3 -0
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +3 -0
- package/dist/types/components/snk-form/subcomponents/snk-config-options/snk-config-options.d.ts +1 -0
- package/dist/types/components/snk-form/subcomponents/snk-field-config/snk-field-config.d.ts +2 -0
- package/dist/types/components/snk-form/subcomponents/snk-form-config/snk-form-config.d.ts +2 -0
- package/dist/types/components/snk-grid/subcomponents/snk-grid-config/snk-grid-config.d.ts +2 -0
- package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +2 -0
- package/dist/types/components.d.ts +1 -1
- package/package.json +1 -1
- package/dist/sankhyablocks/p-029ae4e4.entry.js +0 -1
- package/dist/sankhyablocks/p-12ad2a19.entry.js +0 -1
- package/dist/sankhyablocks/p-2dc76d79.entry.js +0 -1
- package/dist/sankhyablocks/p-3a276f3d.entry.js +0 -1
- package/dist/sankhyablocks/p-7481ab42.entry.js +0 -1
- package/dist/sankhyablocks/p-8dac0292.entry.js +0 -1
- package/dist/sankhyablocks/p-9465c10a.entry.js +0 -1
- package/dist/sankhyablocks/p-9dc4426d.entry.js +0 -1
- package/dist/sankhyablocks/p-ac71ef38.entry.js +0 -1
- package/dist/sankhyablocks/p-cc4bef9f.entry.js +0 -1
- package/dist/sankhyablocks/p-deb1f523.entry.js +0 -1
- package/dist/sankhyablocks/p-e9beab79.entry.js +0 -1
- package/dist/sankhyablocks/p-fa6ad58a.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-e4121713.js';
|
|
2
|
-
import { DataType, ObjectUtils, StringUtils, ErrorException, ApplicationContext, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
|
|
2
|
+
import { DataType, ObjectUtils, ElementIDUtils, StringUtils, ErrorException, ApplicationContext, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
|
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
4
4
|
import { ModalAction, ModalButtonStatus } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
|
|
5
5
|
import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
@@ -107,7 +107,7 @@ function buildPersonalized(item) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 2);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:
|
|
110
|
+
const snkFilterBarCss = ".sc-snk-filter-bar-h{display:grid;grid-template-columns:minmax(100px, 100%) 1fr 1fr}.snk-filter__popover-container.sc-snk-filter-bar{display:flex;cursor:auto}.snk-filter__popover.sc-snk-filter-bar{display:flex;flex-direction:column;position:absolute;width:fit-content;height:fit-content;min-width:265px;z-index:var(--more-visible, 2);background-color:var(--background--xlight, #fff);border-radius:var(--border--radius-medium, 12px);box-shadow:var(--shadow, 0px 0px 16px 0px #000)}.snk-filter-item__editor-header.sc-snk-filter-bar{flex-grow:1;font-weight:var(--text-weight--medium, 400);color:var(--color--title-primary, #2B3A54)}.snk-filter__popover-rule.sc-snk-filter-bar{border-style:solid;border-color:var(--color--disable-secondary, #F2F5F8);border-radius:1px;border-width:1px;width:100%}.editor__ez-check.sc-snk-filter-bar{--ez-check__label--padding-left:0}.snk-filter-item__editor-header-button.sc-snk-filter-bar{cursor:pointer;background-color:transparent;border:none;padding:3px;outline-color:var(--color--primary)}.snk-filter-bar__divider.sc-snk-filter-bar{margin-bottom:var(--space--small)}.snk-filter-bar__filter-list-items-container.sc-snk-filter-bar{overflow-y:auto;max-height:360px;margin-top:var(--space--small, 6px)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar{cursor:pointer;border-radius:var(--border--radius-small, 6px);border:none;background-color:transparent}.snk-filter-bar__filter-list-item__label.sc-snk-filter-bar{color:var(--title--primary)}.snk-filter-bar__filter-list-item__label--secondary.sc-snk-filter-bar{color:var(--text--primary)}.snk-filter-bar__filter-list-item__icon.sc-snk-filter-bar{--ez-icon--color:var(--title--primary)}.snk-filter-bar__filter-list-item__icon--secondary.sc-snk-filter-bar{--ez-icon--color:var(--text--secondary)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:focus-visible{outline:none;background-color:var(--background--medium)}.snk-filter-bar__filter-list-item.sc-snk-filter-bar:hover{background-color:var(--background--medium)}.snk-filter-bar__filter-list-items-container--empty.sc-snk-filter-bar{width:100%;height:100px;display:flex;justify-content:center;align-self:center;align-items:center}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar{position:relative}.snk-filter-bar__filter-list-items-button--active.sc-snk-filter-bar::after{display:flex;position:absolute;content:\"\";width:8px;height:8px;top:7px;left:17px;background-color:var(--icon--alert--color, #008561);border-radius:50%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar{--modal-item-border-width:2px;display:flex;flex-direction:row;margin-left:var(--modal-item-border-width);border-radius:var(--border--radius-medium, 12px);background-color:var(--background--medium, #f0f3f7);border:none;width:100%}.snk-filter-bar__filter-modal-item.sc-snk-filter-bar:focus-visible{outline:var(--color--primary) solid var(--modal-item-border-width)}.snk-filter-bar__filter-modal-item__check.sc-snk-filter-bar{width:auto}.snk-filter-bar__filter-modal-item__label.sc-snk-filter-bar{font-weight:var(--text-weight--medium)}.snk-filter-bar__filter-modal-content.sc-snk-filter-bar{display:grid;grid-template-rows:auto auto 1fr auto;width:99%;height:100%}";
|
|
111
111
|
|
|
112
112
|
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
113
113
|
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
@@ -157,6 +157,15 @@ const SnkFilterBar = class {
|
|
|
157
157
|
}
|
|
158
158
|
this.processAfterUpdateConfig();
|
|
159
159
|
}
|
|
160
|
+
componentDidLoad() {
|
|
161
|
+
if (this._element) {
|
|
162
|
+
const dataInfo = { dataUnit: this.dataUnit };
|
|
163
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
164
|
+
const dataElementIdFilterBar = this._element.getAttribute("data-element-id");
|
|
165
|
+
this._idSnkFilterItem = dataElementIdFilterBar;
|
|
166
|
+
this._idSnkFilterList = dataElementIdFilterBar;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
160
169
|
processPendingFilter() {
|
|
161
170
|
if (this._pendingFilters.length > 0 && this._currentPendingFilter == undefined) {
|
|
162
171
|
this._currentPendingFilter = this._element.querySelector("#filter-" + this._pendingFilters.pop());
|
|
@@ -468,7 +477,7 @@ const SnkFilterBar = class {
|
|
|
468
477
|
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
469
478
|
return undefined;
|
|
470
479
|
}
|
|
471
|
-
return (h(Host, null, h("ez-scroller", { direction: "horizontal", activeShadow: true, locked: this.scrollerLocked }, this.getFilterItems()), h("snk-filter-list", { id: APPLIED_FILTERS, onFocusin: () => this.itemFocused(APPLIED_FILTERS), items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail) }), h("snk-filter-list", { id: ADD_FILTER, onFocusin: () => this.itemFocused(ADD_FILTER), items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail) }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
480
|
+
return (h(Host, null, h("ez-scroller", { direction: "horizontal", activeShadow: true, locked: this.scrollerLocked }, this.getFilterItems()), h("snk-filter-list", { id: APPLIED_FILTERS, onFocusin: () => this.itemFocused(APPLIED_FILTERS), items: this.getAppliedListItems(), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyAppliedFiltersList"), findFilterText: this.getMessage("snkFilterBar.findFilter"), iconName: "filter", class: "ez-padding-left--medium", buttonClass: this.getActiveClass(), onSnkItemSelected: evt => this.appliedFilterHandler(evt.detail), "data-element-id": this._idSnkFilterList }), h("snk-filter-list", { id: ADD_FILTER, onFocusin: () => this.itemFocused(ADD_FILTER), items: this.getAddListItems(), label: this.getMessage("snkFilterBar.addFilter"), getMessage: (key, params) => this.getMessage(key, params), emptyText: this.getMessage("snkFilterBar.emptyFiltersList"), findFilterText: this.getMessage("snkFilterBar.findField"), class: "ez-padding-left--medium", onSnkItemSelected: evt => this.addFilterHandler(evt.detail), "data-element-id": this._idSnkFilterList }, h("ez-icon", { slot: "leftIcon", class: "ez-padding-right--small", iconName: "plus" }))));
|
|
472
481
|
}
|
|
473
482
|
get _element() { return getElement(this); }
|
|
474
483
|
static get watchers() { return {
|
|
@@ -612,6 +621,14 @@ const SnkFilterItem = class {
|
|
|
612
621
|
}
|
|
613
622
|
return label;
|
|
614
623
|
}
|
|
624
|
+
componentDidLoad() {
|
|
625
|
+
if (this._filterItemElement) {
|
|
626
|
+
ElementIDUtils.addIDInfo(this._filterItemElement);
|
|
627
|
+
const dataElementIdDoFilterItem = this._filterItemElement.getAttribute("data-element-id");
|
|
628
|
+
this._idSnkFilterDetail = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
|
629
|
+
this._idEzChip = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
615
632
|
componentDidRender() {
|
|
616
633
|
if (this._floatingID == undefined) {
|
|
617
634
|
if (this._popover) {
|
|
@@ -639,7 +656,7 @@ const SnkFilterItem = class {
|
|
|
639
656
|
}
|
|
640
657
|
render() {
|
|
641
658
|
const leftIcon = this.getLeftIconName();
|
|
642
|
-
return (h(Host, null, h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
|
|
659
|
+
return (h(Host, null, h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined, "data-element-id": this._idEzChip }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
|
|
643
660
|
}
|
|
644
661
|
get _filterItemElement() { return getElement(this); }
|
|
645
662
|
static get watchers() { return {
|
|
@@ -692,6 +709,11 @@ const SnkFilterList = class {
|
|
|
692
709
|
this.showDetail();
|
|
693
710
|
}
|
|
694
711
|
}
|
|
712
|
+
componentDidLoad() {
|
|
713
|
+
if (this._element) {
|
|
714
|
+
ElementIDUtils.addIDInfo(this._element);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
695
717
|
componentDidRender() {
|
|
696
718
|
if (this._floatingID == undefined) {
|
|
697
719
|
if (this._popover) {
|
|
@@ -701,7 +723,10 @@ const SnkFilterList = class {
|
|
|
701
723
|
}
|
|
702
724
|
buildItemElement(item) {
|
|
703
725
|
const itemId = ++this._selectableItemsCount;
|
|
704
|
-
|
|
726
|
+
if (this._buttonElement) {
|
|
727
|
+
ElementIDUtils.addIDInfo(this._buttonElement);
|
|
728
|
+
}
|
|
729
|
+
return (h("button", { id: `filter-item${itemId}`, onFocusin: () => this._preselection = itemId, class: `ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item`, onClick: () => this.itemSelected(item.name), ref: (el) => this._buttonElement = el }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
|
|
705
730
|
}
|
|
706
731
|
itemSelected(itemName) {
|
|
707
732
|
if (itemName === SHOW_MORE_ITEM_NAME) {
|
|
@@ -925,14 +950,16 @@ const EzGridConfig = class {
|
|
|
925
950
|
this._columListItems = [visibleGroup, hiddenGroup];
|
|
926
951
|
}
|
|
927
952
|
buildColumnListSlot(item, group) {
|
|
928
|
-
|
|
953
|
+
const dataElementId = `${this._element.getAttribute("data-element-id")}_configItem_${StringUtils.toCamelCase(item.label)}`;
|
|
954
|
+
return (h("div", null, h("ez-check", { mode: 'switch', id: 'switch' + ((item === null || item === void 0 ? void 0 : item.label) || '') + ((group === null || group === void 0 ? void 0 : group.group) || ''), value: group.group === this.getMessage("snkGridConfig.group.visible"), "data-element-id": dataElementId, onEzChange: (evt) => { this.switchColumnGroup(evt, item); } })));
|
|
929
955
|
}
|
|
930
956
|
buildOrderListSlot(item) {
|
|
957
|
+
const dataElementId = `${this._element.getAttribute("data-element-id")}_configItem_${StringUtils.toCamelCase(item.label)}`;
|
|
931
958
|
let selectedOption = ORDER_VALUES.none.value;
|
|
932
959
|
if ((item === null || item === void 0 ? void 0 : item.ascending) != undefined) {
|
|
933
960
|
selectedOption = item.ascending == true ? ORDER_VALUES.asc.value : ORDER_VALUES.desc.value;
|
|
934
961
|
}
|
|
935
|
-
return (h("div", null, h("snk-select-box", { selectedOption: selectedOption, key: 'snk-select-box-' + this._componenteInternalKey + '-' + item, onEzChange: (evt) => { evt.stopPropagation(); this.updateOrder(evt.detail, item.label); } })));
|
|
962
|
+
return (h("div", null, h("snk-select-box", { selectedOption: selectedOption, key: 'snk-select-box-' + this._componenteInternalKey + '-' + item, "data-element-id": dataElementId, onEzChange: (evt) => { evt.stopPropagation(); this.updateOrder(evt.detail, item.label); } })));
|
|
936
963
|
}
|
|
937
964
|
updateOrder(sortOrder, updatedItemLabel) {
|
|
938
965
|
var _a;
|
|
@@ -1282,10 +1309,14 @@ const EzGridConfig = class {
|
|
|
1282
1309
|
componentWillLoad() {
|
|
1283
1310
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
1284
1311
|
}
|
|
1312
|
+
componentDidLoad() {
|
|
1313
|
+
ElementIDUtils.addIDInfo(this._element);
|
|
1314
|
+
}
|
|
1285
1315
|
render() {
|
|
1286
1316
|
return (h(Host, null, h("div", { class: "grid-config__header" }, h("div", { class: "title-container" }, h("div", { class: "" }, h("label", { class: "title" }, this.getMessage("snkGridConfig.gridConfiguration")), h("label", { class: "subtitle" }, this.getMessage("snkGridConfig.columnVisibilityOrder"))), h("div", { class: "button-close" }, h("ez-button", { mode: 'icon', iconName: "close", size: 'medium', onClick: () => this.closeConfig() }))), h("div", { class: "tabselector-container" }, h("ez-tabselector", { selectedIndex: this.selectedIndex, onEzChange: (evt) => { this.handleTabChange(evt.detail); }, tabs: this.getColumnNames() })), h("div", null, h("ez-text-input", { ref: (el) => this._searchElement = el, label: this.getMessage("snkGridConfig.findColumn"), onKeyUp: (evt) => this.locateColumn(evt) }, h("ez-icon", { slot: "leftIcon", size: "medium", iconName: "search" })))), h("div", { class: "grid-config__main" }, h("ez-list", { ref: (el) => this._columnList = el, class: this.selectedIndex === 0 ? "" : "hidden", dataSource: this._columListItems, onEzChange: (evt) => this.handleColumnListChange(evt), ezDraggable: true, ezSelectable: true, itemSlotBuilder: (item, group) => this.buildColumnListSlot(item, group), useGroups: true }), h("div", { class: this.selectedIndex === 1 ? "group-name" : "hidden" }, this.getMessage("snkGridConfig.info.sortingSequence")), h("ez-list", { ref: (el) => this._orderList = el, class: this.selectedIndex === 1 ? "height-calc" : "hidden", dataSource: this._orderListItems, ezSelectable: true, onEzChange: (evt) => this.handleOrderListChange(evt), ezDraggable: true, itemSlotBuilder: (item) => this.buildOrderListSlot(item) })), h("div", { class: "grid-config__footer" }, h("ez-button", { class: "padding-right--medium", label: this.getMessage("snkGridConfig.cancel"), onClick: () => this.closeConfig() }), h("ez-button", { label: this.getMessage("snkGridConfig.complete"), class: "ez-button--primary", onClick: () => this.finish() }))));
|
|
1287
1317
|
}
|
|
1288
1318
|
static get assetsDirs() { return ["../assets"]; }
|
|
1319
|
+
get _element() { return getElement(this); }
|
|
1289
1320
|
};
|
|
1290
1321
|
EzGridConfig.style = snkGridConfigCss;
|
|
1291
1322
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-e4121713.js';
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
3
4
|
|
|
4
5
|
const SnkFilterBinarySelect = class {
|
|
@@ -14,6 +15,11 @@ const SnkFilterBinarySelect = class {
|
|
|
14
15
|
}
|
|
15
16
|
this.updateValue();
|
|
16
17
|
}
|
|
18
|
+
componentDidLoad() {
|
|
19
|
+
if (this._element) {
|
|
20
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
17
23
|
assertCheckedOption(updatingCheck) {
|
|
18
24
|
if (updatingCheck === this._checkOne) {
|
|
19
25
|
this._checkTwo.value = true;
|
|
@@ -41,6 +47,7 @@ const SnkFilterBinarySelect = class {
|
|
|
41
47
|
const [optOne, optTwo] = this.config.props.options;
|
|
42
48
|
return (h(Host, null, h("ez-check", { label: optOne.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkOne = ref, value: this.isSelected(optOne.name) }), h("ez-check", { label: optTwo.label, class: "sc-snk-filter-bar editor__ez-check", ref: (ref) => this._checkTwo = ref, value: this.isSelected(optTwo.name) })));
|
|
43
49
|
}
|
|
50
|
+
get _element() { return getElement(this); }
|
|
44
51
|
};
|
|
45
52
|
|
|
46
53
|
export { SnkFilterBinarySelect as snk_filter_binary_select };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-e4121713.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-e4121713.js';
|
|
2
2
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
4
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
4
5
|
|
|
5
6
|
const SnkFilterDetail = class {
|
|
6
7
|
constructor(hostRef) {
|
|
@@ -10,6 +11,13 @@ const SnkFilterDetail = class {
|
|
|
10
11
|
async show() {
|
|
11
12
|
this._editor["show"]();
|
|
12
13
|
}
|
|
14
|
+
componentDidLoad() {
|
|
15
|
+
if (this._element) {
|
|
16
|
+
ElementIDUtils.addIDInfo(this._element);
|
|
17
|
+
const dataElementIdDoFilterItem = this._element.getAttribute("data-element-id");
|
|
18
|
+
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
13
21
|
changeConfig(newConfig) {
|
|
14
22
|
this.filterChange.emit(newConfig);
|
|
15
23
|
}
|
|
@@ -95,8 +103,9 @@ const SnkFilterDetail = class {
|
|
|
95
103
|
}
|
|
96
104
|
render() {
|
|
97
105
|
const ContentEditor = this.getContentEditor();
|
|
98
|
-
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt) }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
|
106
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
|
99
107
|
}
|
|
108
|
+
get _element() { return getElement(this); }
|
|
100
109
|
};
|
|
101
110
|
|
|
102
111
|
export { SnkFilterDetail as snk_filter_detail };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-e4121713.js';
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
3
4
|
|
|
4
5
|
const SnkFilterMultiSelect = class {
|
|
@@ -11,12 +12,18 @@ const SnkFilterMultiSelect = class {
|
|
|
11
12
|
async show() {
|
|
12
13
|
this._comboElement.setFocus();
|
|
13
14
|
}
|
|
15
|
+
componentDidLoad() {
|
|
16
|
+
if (this._element) {
|
|
17
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
14
20
|
render() {
|
|
15
21
|
if (!this.config || this.config.type !== FilterItemType.MULTI_SELECT) {
|
|
16
22
|
return undefined;
|
|
17
23
|
}
|
|
18
24
|
return (h("ez-combo-box", { ref: ref => this._comboElement = ref, label: this.config.label, value: this.config.value, options: this.config.props.options }));
|
|
19
25
|
}
|
|
26
|
+
get _element() { return getElement(this); }
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
export { SnkFilterMultiSelect as snk_filter_multi_select };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-e4121713.js';
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
3
4
|
|
|
4
5
|
const SnkFilterPeriod = class {
|
|
@@ -11,6 +12,11 @@ const SnkFilterPeriod = class {
|
|
|
11
12
|
async show() {
|
|
12
13
|
this._numberElement.setFocus();
|
|
13
14
|
}
|
|
15
|
+
componentDidLoad() {
|
|
16
|
+
if (this._element) {
|
|
17
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
14
20
|
render() {
|
|
15
21
|
var _a;
|
|
16
22
|
if (!this.config || this.config.type !== FilterItemType.NUMBER) {
|
|
@@ -18,6 +24,7 @@ const SnkFilterPeriod = class {
|
|
|
18
24
|
}
|
|
19
25
|
return (h("ez-number-input", { ref: ref => this._numberElement = ref, label: this.config.label, value: this.config.value, precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }));
|
|
20
26
|
}
|
|
27
|
+
get _element() { return getElement(this); }
|
|
21
28
|
};
|
|
22
29
|
|
|
23
30
|
export { SnkFilterPeriod as snk_filter_number };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-e4121713.js';
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
3
4
|
|
|
4
5
|
const SnkFilterPeriod = class {
|
|
@@ -10,6 +11,11 @@ const SnkFilterPeriod = class {
|
|
|
10
11
|
const end = this._endDate.value;
|
|
11
12
|
this.value = (start || end ? { start, end } : undefined);
|
|
12
13
|
}
|
|
14
|
+
componentDidLoad() {
|
|
15
|
+
if (this._element) {
|
|
16
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
13
19
|
getDate(prop) {
|
|
14
20
|
const objValue = this.value ? this.value[prop] : null;
|
|
15
21
|
if (objValue instanceof Date) {
|
|
@@ -31,6 +37,7 @@ const SnkFilterPeriod = class {
|
|
|
31
37
|
}
|
|
32
38
|
return (h("div", { class: "ez-col ez-col--nowrap" }, h("ez-date-input", { label: this.config.label, ref: ref => this._startDate = ref, value: this.getDate("start") }), h("label", { class: "ez-text ez-text--medium ez-text--primary ez-margin--medium" }, "at\u00E9"), h("ez-date-input", { label: this.config.label, ref: ref => this._endDate = ref, value: this.getDate("end") })));
|
|
33
39
|
}
|
|
40
|
+
get _element() { return getElement(this); }
|
|
34
41
|
};
|
|
35
42
|
|
|
36
43
|
export { SnkFilterPeriod as snk_filter_period };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-e4121713.js';
|
|
2
|
-
import { UserInterface, ApplicationContext } from '@sankhyalabs/core';
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ElementIDUtils, UserInterface, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
|
|
4
4
|
import { CheckMode } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
@@ -8,6 +8,11 @@ const SnkFilterPersonalized = class {
|
|
|
8
8
|
constructor(hostRef) {
|
|
9
9
|
registerInstance(this, hostRef);
|
|
10
10
|
}
|
|
11
|
+
componentDidLoad() {
|
|
12
|
+
if (this._element) {
|
|
13
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
11
16
|
getValue(param, index) {
|
|
12
17
|
if (this.value && index >= 0 && index < this.value.length) {
|
|
13
18
|
const rawValue = this.value[index];
|
|
@@ -80,6 +85,7 @@ const SnkFilterPersonalized = class {
|
|
|
80
85
|
}
|
|
81
86
|
return (h(Host, null, this.getParamsInterface()));
|
|
82
87
|
}
|
|
88
|
+
get _element() { return getElement(this); }
|
|
83
89
|
};
|
|
84
90
|
|
|
85
91
|
export { SnkFilterPersonalized as snk_filter_personalized };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-e4121713.js';
|
|
2
|
-
import { ApplicationContext } from '@sankhyalabs/core';
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ElementIDUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
|
|
4
4
|
|
|
5
5
|
const SnkFilterSearch = class {
|
|
@@ -9,6 +9,11 @@ const SnkFilterSearch = class {
|
|
|
9
9
|
ezChangeListener(_evt) {
|
|
10
10
|
this.value = this._searchInput.value;
|
|
11
11
|
}
|
|
12
|
+
componentDidLoad() {
|
|
13
|
+
if (this._element) {
|
|
14
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
12
17
|
doSearch(mode, argument) {
|
|
13
18
|
const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
14
19
|
return new Promise((resolve, reject) => {
|
|
@@ -29,6 +34,7 @@ const SnkFilterSearch = class {
|
|
|
29
34
|
}
|
|
30
35
|
return (h("ez-search", { suppressEmptyOption: true, value: this.config.value, label: this.config.label, ref: ref => this._searchInput = ref, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument) }));
|
|
31
36
|
}
|
|
37
|
+
get _element() { return getElement(this); }
|
|
32
38
|
};
|
|
33
39
|
|
|
34
40
|
export { SnkFilterSearch as snk_filter_search };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-e4121713.js';
|
|
1
|
+
import { r as registerInstance, h, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
|
2
3
|
|
|
3
4
|
const SnkFilterText = class {
|
|
4
5
|
constructor(hostRef) {
|
|
@@ -7,12 +8,18 @@ const SnkFilterText = class {
|
|
|
7
8
|
ezChangeListener(evt) {
|
|
8
9
|
this.value = evt.detail;
|
|
9
10
|
}
|
|
11
|
+
componentDidLoad() {
|
|
12
|
+
if (this._element) {
|
|
13
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
10
16
|
render() {
|
|
11
17
|
if (!this.config) {
|
|
12
18
|
return undefined;
|
|
13
19
|
}
|
|
14
20
|
return (h("ez-text-input", { ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value }));
|
|
15
21
|
}
|
|
22
|
+
get _element() { return getElement(this); }
|
|
16
23
|
};
|
|
17
24
|
|
|
18
25
|
export { SnkFilterText as snk_filter_text };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host } from './index-e4121713.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-e4121713.js';
|
|
2
2
|
import { d as draggable_bundle } from './draggable.bundle-41d56f06.js';
|
|
3
|
-
import { ObjectUtils, ArrayUtils, ApplicationContext } from '@sankhyalabs/core';
|
|
3
|
+
import { ObjectUtils, ArrayUtils, ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
|
|
4
4
|
import { ApplicationUtils, DialogType } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import { C as CONFIG_EVENTS, T as TAB_NAMES, A as ACTION_CONFIG, D as DEFAULT_TYPE } from './constants-babe1a08.js';
|
|
6
6
|
import { a as UserConfigType, C as ConfigStorage } from './ConfigStorage-99025655.js';
|
|
@@ -238,8 +238,8 @@ const SnkFormConfig = class {
|
|
|
238
238
|
var _a;
|
|
239
239
|
return ((_a = group.fields) === null || _a === void 0 ? void 0 : _a.length) ? group.fields.map((field) => {
|
|
240
240
|
var _a, _b;
|
|
241
|
-
return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
|
|
242
|
-
h("div", { class: "ez-flex form-config__config-options" }, h("snk-config-options", { idConfig: field.name, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, onConfigOptionsChanged: (evt) => this.handleconfigOptionsChanged(evt.detail) })));
|
|
241
|
+
return h("div", { key: field.name, class: this.getFieldConfigStyle(field), "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, modeInsertion: false, fieldConfig: field, "data-element-id": this._element.getAttribute("data-element-id"), dataUnit: this.dataUnit, isConfigActive: ((_a = this._fieldConfigSelected) === null || _a === void 0 ? void 0 : _a.name) === field.name }), ((_b = this._fieldConfigSelected) === null || _b === void 0 ? void 0 : _b.name) === field.name &&
|
|
242
|
+
h("div", { class: "ez-flex form-config__config-options" }, h("snk-config-options", { idConfig: field.name, dataUnit: this.dataUnit, fieldConfig: this._fieldConfigSelected, "data-element-id": this._element.getAttribute("data-element-id"), onConfigOptionsChanged: (evt) => this.handleconfigOptionsChanged(evt.detail) })));
|
|
243
243
|
}) : h("div", { class: "form-config__add-group-container" }, h("div", { class: "form-config__add-group-content" }, h("div", { class: "form-config__add-group-label" }, h("label", { class: "ez-text ez-text--center ez-text--medium ez-text--primary ez-text--bold" }, this.getMessage("snkFormConfig.form.labelDropField")))));
|
|
244
244
|
}
|
|
245
245
|
handleconfigOptionsChanged(fieldEdited) {
|
|
@@ -942,6 +942,10 @@ const SnkFormConfig = class {
|
|
|
942
942
|
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
|
943
943
|
this.loadConfig();
|
|
944
944
|
}
|
|
945
|
+
componentDidLoad() {
|
|
946
|
+
const dataInfo = { dataUnit: this.dataUnit };
|
|
947
|
+
ElementIDUtils.addIDInfo(this._element, null, dataInfo);
|
|
948
|
+
}
|
|
945
949
|
render() {
|
|
946
950
|
var _a, _b, _c, _d;
|
|
947
951
|
const configOptions = this._formConfigOptions.map((option) => {
|
|
@@ -965,6 +969,7 @@ const SnkFormConfig = class {
|
|
|
965
969
|
}), this.renderTempGroupByTab(tab.tab))), h("div", { class: "form-config__btn-add-group ez-row" }, h("div", { class: "form-config__btn-add-group-container ez-col ez-col--sd-12 ez-col--tb-12 ez-align--center" }, h("ez-button", { label: this.getMessage("snkFormConfig.form.labelNewGroup"), class: "ez-padding-horizontal--small ez-button--primary", size: "small", onClick: () => this.addNewGroup() }, h("ez-icon", { class: "ez-margin-right--small", slot: "leftIcon", iconName: "plus" })))))), h("div", { class: "form-config__fields-available ez-col ez-col--sd-3 ez-col--tb-3" }, h("section", { class: "ez-box__container ez-col ez-col--pn-12" }, h("h1", { class: "ez-title ez-title--large ez-title--primary ez-padding-bottom--medium" }, this.getMessage("snkFormConfig.availableFields.title")), h("ez-filter-input", { ref: ref => this._filterFieldsAvailable = ref, label: this.getMessage("snkFormConfig.availableFields.labelSearchField"), onEzChange: evt => this.onFilterChange(evt.detail) }), h("span", { class: "ez-box__label-counter ez-text ez-text--medium ez-text--primary ez-margin-bottom--medium" }, this.handleLabelCounter((_c = this._fieldsAvailable) === null || _c === void 0 ? void 0 : _c.length)), ((_d = this._layoutFormConfig) === null || _d === void 0 ? void 0 : _d.length) > 0 &&
|
|
966
970
|
h("div", { id: CONTAINER_ID.fieldsAvailable, class: "ez-row", "data-draggable-parent": "field" }, this.orderFieldsAvailable(this._fieldsAvailable).map((field) => h("div", { key: field.name, class: this._fieldsAvailableStyle, "data-draggable-element": "field", onMouseDown: (evt) => this.controlMoveField(evt) }, h("snk-field-config", { onEzClickIcon: (evt) => { this.handleFieldConfigChange(evt); }, dataUnit: this.dataUnit, fieldConfig: field })))))))));
|
|
967
971
|
}
|
|
972
|
+
get _element() { return getElement(this); }
|
|
968
973
|
static get watchers() { return {
|
|
969
974
|
"formConfig": ["observeFormConfig"]
|
|
970
975
|
}; }
|
|
@@ -184,7 +184,7 @@ const SnkForm = class {
|
|
|
184
184
|
return undefined;
|
|
185
185
|
}
|
|
186
186
|
return (h("section", { class: "snk-form" }, h("div", { class: "snk-form__header snk-form__header--fixed ez-row" }, h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6", key: "formHeader" }, h("ez-button", { title: this.getMessage("snkForm.goBackTitle"), mode: "icon", iconName: "arrow_back", class: "ez-padding-right--medium", size: "small", onClick: () => this.exitForm() }), h("h1", { class: "ez-title ez-title--primary ez-title--xlarge ez-align--middle" }, this.getMessage("snkForm.title"))), h("div", { class: "ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right" }, h("snk-taskbar", { key: "formTaskbar", configName: this.configName, buttons: this._taskbarProcessor.buttons, disabledButtons: this._taskbarProcessor.disabledButtons, customButtons: this._taskbarProcessor.customButtons, actionsList: this.actionsList, primaryButton: ((_a = this._dataState) === null || _a === void 0 ? void 0 : _a.isDirty) ? "SAVE" : "INSERT", dataUnit: this._dataUnit }))), h("section", null, h("div", { class: "ez-row" }, h("div", { class: "ez-col ez-col--sd-12" }, h("ez-form", { key: "ezForm" + this._snkDataUnit.entityName, dataUnit: this._dataUnit, config: this.getFormConfig(), recordsValidator: this.recordsValidator, class: this._showFormConfig ? 'snk-form__form--hidden' : '' }), this._showFormConfig &&
|
|
187
|
-
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), configName: this.configName, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigClose: () => this.closeConfig() }))))));
|
|
187
|
+
h("snk-form-config", { dataUnit: this._dataUnit, formConfig: this.getFormConfig(), "data-element-id": this._element.getAttribute("data-element-id"), configName: this.configName, onConfigChange: (evt) => this.changeConfig(evt.detail), onConfigClose: () => this.closeConfig() }))))));
|
|
188
188
|
}
|
|
189
189
|
get _element() { return getElement(this); }
|
|
190
190
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host } from './index-e4121713.js';
|
|
2
|
-
import { ObjectUtils, StringUtils } from '@sankhyalabs/core';
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-e4121713.js';
|
|
2
|
+
import { ObjectUtils, StringUtils, ElementIDUtils } from '@sankhyalabs/core';
|
|
3
3
|
|
|
4
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-primary:var(--scrollbar--primary, #2B3A54);--snk-pesquisa__content-scrollbar--background-color-secondary:var(--scrollbar--secondary, #E5EAF0);--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;scrollbar-width:thin;scrollbar-color:var(--snk-pesquisa__content-scrollbar--background-color-primary) var(--snk-pesquisa__content-scrollbar--background-color-secondary);padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);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-primary);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:var(--snk-pesquisa__content-scrollbar--background-color-secondary);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
|
|
|
@@ -294,6 +294,9 @@ const SnkPesquisa = class {
|
|
|
294
294
|
: 'Nenhum registro encontrado'
|
|
295
295
|
: 'Os resultados de sua pesquisa aparecerão aqui...';
|
|
296
296
|
}
|
|
297
|
+
componentDidLoad() {
|
|
298
|
+
ElementIDUtils.addIDInfo(this._element);
|
|
299
|
+
}
|
|
297
300
|
render() {
|
|
298
301
|
var _a;
|
|
299
302
|
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)
|
|
@@ -302,6 +305,7 @@ const SnkPesquisa = class {
|
|
|
302
305
|
return (h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
|
|
303
306
|
})))));
|
|
304
307
|
}
|
|
308
|
+
get _element() { return getElement(this); }
|
|
305
309
|
static get watchers() { return {
|
|
306
310
|
"argument": ["observeArgument"]
|
|
307
311
|
}; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,c as i,h as t,g as e}from"./p-9ba3df4c.js";import{DateUtils as a,ObjectUtils as o,ApplicationContext as r}from"@sankhyalabs/core";import{T as n}from"./p-03f9c407.js";import{C as h}from"./p-6ba8f415.js";import"./p-112455b1.js";const
|
|
1
|
+
import{r as s,c as i,h as t,g as e}from"./p-9ba3df4c.js";import{DateUtils as a,ObjectUtils as o,ApplicationContext as r}from"@sankhyalabs/core";import{T as n}from"./p-03f9c407.js";import{C as h}from"./p-6ba8f415.js";import"./p-112455b1.js";const d=class{constructor(t){s(this,t),this.exit=i(this,"exit",7),this.actionClick=i(this,"actionClick",7),this._renderTimer=500,this._taskbarProcessor=new n({"snkForm.regular":["PREVIOUS","NEXT","DIVIDER","CLONE","REMOVE","MORE_OPTIONS","DIVIDER","GRID_MODE","CONFIGURATOR","INSERT"],"snkForm.finish_edition":["CANCEL","SAVE"]}),this._editionFormConfig={},this._insertionFormConfig={},this._showFormConfig=!1}async showConfig(){this._showFormConfig=!0}async hideConfig(){this._showFormConfig=!1}loadConfig(){h.get().loadFormConfig(this.configName).then((s=>{this.setConfig(s)||this.loadInsertionConfig()})).catch((s=>{console.warn(s)}))}setConfig(s){return null!=(null==s?void 0:s.fields)&&(setTimeout((async()=>{for(const i of s.fields)if(i.defaultValue&&"value"in i.defaultValue){const s=i.defaultValue.value;await this.getFormattedValue(s).then((s=>{i.defaultValue.formattedValue=s}))}this._editionFormConfig=s,this.loadInsertionConfig()}),this._renderTimer),!0)}async getFormattedValue(s){switch(s){case"${data}":return()=>a.getToday();case"${datahora}":return()=>a.getToday(!0);case"${usuario}":case"${usuario.empresa}":case"${usuario.vendedor}":case"${usuario.centroresultado}":let i;return await this._application.getDefaultValue(s).then((s=>{i=s})),i;default:return s}}loadInsertionConfig(){var s;if(this._dataUnit){const i=o.copy(this._editionFormConfig||{});i.fields=null===(s=i.fields)||void 0===s?void 0:s.filter((s=>{const i=this._dataUnit.getField(s.name);return!(null==i?void 0:i.readOnly)})),this._insertionFormConfig=i}}getFormConfig(){return this._dataState&&this._dataState.insertionMode?this._insertionFormConfig:this._editionFormConfig}exitForm(){this._dataUnit.isDirty()?this._dataUnit.cancelEdition({after:()=>this.exit.emit()}):this.exit.emit()}getMessage(s){return this._application.messagesBuilder.getMessage(s,this.getMessageParams())}getMessageParams(){var s;return(null===(s=this._dataState)||void 0===s?void 0:s.selectedRecords)?this._dataState.selectedRecords[0]:void 0}changeConfig(s){this._editionFormConfig={},this.setConfig(s)||this.loadInsertionConfig()}closeConfig(){this.hideConfig()}getDisabledButtons(){const s=[];return this._dataState.hasPrevious||s.push("PREVIOUS"),this._dataState.hasNext||s.push("NEXT"),s}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__");let s=this._element.parentElement;for(;s;){if("SNK-DATA-UNIT"===s.tagName.toUpperCase()){this._snkDataUnit=s,this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.loadInsertionConfig():this._snkDataUnit.addEventListener("dataUnitReady",(s=>{this._dataUnit=s.detail,this.loadInsertionConfig()})),this._snkDataUnit.addEventListener("dataStateChange",(s=>{this._dataState=s.detail}));break}s=s.parentElement}this.loadConfig()}componentWillRender(){var s;const i=(null===(s=this._dataState)||void 0===s?void 0:s.isDirty)?"snkForm.finish_edition":"snkForm.regular",t=[];this._dataState&&this._dataState.hasPrevious||t.push("PREVIOUS"),this._dataState&&this._dataState.hasNext||t.push("NEXT"),this._taskbarProcessor.process(i,this.taskbarManager,this._dataState,t)}render(){var s;if(this._dataUnit&&this._dataState)return t("section",{class:"snk-form"},t("div",{class:"snk-form__header snk-form__header--fixed ez-row"},t("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6",key:"formHeader"},t("ez-button",{title:this.getMessage("snkForm.goBackTitle"),mode:"icon",iconName:"arrow_back",class:"ez-padding-right--medium",size:"small",onClick:()=>this.exitForm()}),t("h1",{class:"ez-title ez-title--primary ez-title--xlarge ez-align--middle"},this.getMessage("snkForm.title"))),t("div",{class:"ez-col ez-col--sd-6 ez-col--tb-6 ez-align--right"},t("snk-taskbar",{key:"formTaskbar",configName:this.configName,buttons:this._taskbarProcessor.buttons,disabledButtons:this._taskbarProcessor.disabledButtons,customButtons:this._taskbarProcessor.customButtons,actionsList:this.actionsList,primaryButton:(null===(s=this._dataState)||void 0===s?void 0:s.isDirty)?"SAVE":"INSERT",dataUnit:this._dataUnit}))),t("section",null,t("div",{class:"ez-row"},t("div",{class:"ez-col ez-col--sd-12"},t("ez-form",{key:"ezForm"+this._snkDataUnit.entityName,dataUnit:this._dataUnit,config:this.getFormConfig(),recordsValidator:this.recordsValidator,class:this._showFormConfig?"snk-form__form--hidden":""}),this._showFormConfig&&t("snk-form-config",{dataUnit:this._dataUnit,formConfig:this.getFormConfig(),"data-element-id":this._element.getAttribute("data-element-id"),configName:this.configName,onConfigChange:s=>this.changeConfig(s.detail),onConfigClose:()=>this.closeConfig()})))))}get _element(){return e(this)}};d.style=".sc-snk-form-h{display:block}.snk-form.sc-snk-form{position:relative;padding:var(--space--large);padding-top:var(--space--medium)}.snk-form__header.sc-snk-form{position:relative;padding-top:var(--space--medium);padding-bottom:var(--space--medium);margin-bottom:var(--space--medium)}.snk-form__header--fixed.sc-snk-form{position:sticky;top:0;background:var(--background--body);z-index:var(--more-visible, 2);padding-left:var(--space--large);padding-right:var(--space--large);margin-left:calc(var(--space--large) * -1);margin-right:calc(var(--space--large) * -1);width:calc(100% + (var(--space--large) * 2))}.snk-form__form--hidden.sc-snk-form{display:none}";export{d as snk_form}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s,g as e}from"./p-9ba3df4c.js";import{ElementIDUtils as i}from"@sankhyalabs/core";import{F as o}from"./p-9dd2b8cb.js";const r=class{constructor(s){t(this,s)}ezChangeListener(t){this.value=t.detail.value}async show(){this._comboElement.setFocus()}componentDidLoad(){this._element&&i.addIDInfo(this._element,"filterContentEditor")}render(){if(this.config&&this.config.type===o.MULTI_SELECT)return s("ez-combo-box",{ref:t=>this._comboElement=t,label:this.config.label,value:this.config.value,options:this.config.props.options})}get _element(){return e(this)}};export{r as snk_filter_multi_select}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,c as e,h as t,H as l,g as s}from"./p-9ba3df4c.js";import{UserInterface as n,ObjectUtils as o,StringUtils as a,ApplicationContext as d,ElementIDUtils as r}from"@sankhyalabs/core";import{DataType as u,getConvertedValue as h}from"@sankhyalabs/core/dist/dataunit/metadata/DataType";import{CheckMode as c}from"@sankhyalabs/ezui/dist/collection/utils";import{V as v,D as p,a as b}from"./p-6673c77c.js";const g=class{constructor(t){i(this,t),this.configOptionsChanged=e(this,"configOptionsChanged",7),this.fieldConfig={}}onConfigDefault(i){null!=i&&(this._defaultType=i,this.fieldConfig.defaultValue={type:this._defaultType},this.configOptionsChanged.emit(this.fieldConfig))}buildOptions(){var i,e,t;let l=null===(t=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(null===(e=this.fieldConfig)||void 0===e?void 0:e.name))||void 0===t?void 0:t.userInterface;return l===n.SEARCH&&(l=n.INTEGERNUMBER),v.UserInterface[l]}enabledValueDefault(){var i,e,t;const l=null===(i=this.dataUnit)||void 0===i?void 0:i.getField(null===(e=this.fieldConfig)||void 0===e?void 0:e.name),s=null===(t=null==l?void 0:l.properties)||void 0===t?void 0:t.allowDefault,o=v.UserInterface.hasOwnProperty(null==l?void 0:l.userInterface)||(null==l?void 0:l.userInterface)===n.SEARCH;return!(null!=s&&"true"!==s||!o)}isAllowDefault(){var i,e;const t=null===(e=null===(i=this._fieldProperties)||void 0===i?void 0:i.properties)||void 0===e?void 0:e.allowDefault;return null==t||"true"===t}loadDefaultValue(){var i;null==this.fieldConfig?(this._defaultType=p.fixed,this.fieldConfig={defaultValue:{type:this._defaultType}}):null==(null===(i=this.fieldConfig.defaultValue)||void 0===i?void 0:i.type)?(this._defaultType=p.fixed,this.fieldConfig.defaultValue={type:this._defaultType}):this._defaultType=this.fieldConfig.defaultValue.type}getFieldProperties(i){var e;if(null!=i)return null===(e=this.dataUnit)||void 0===e?void 0:e.getField(i)}getMessage(i,e){return this._application.messagesBuilder.getMessage(i,e)}getDefaultType(){var i;return null!==(i=this.fieldConfig.defaultValue.type)&&void 0!==i?i:p.fixed}getEnabledByProperty(i){const e=this._fieldProperties;return null==e||!0!==e[i]}getValueByProperty(i){const e=this._fieldProperties;return null!=e&&!0===e[i]||this.fieldConfig[i]}getValidatedValue(i){var e,t;if(null==i)return;const l=null===(e=this.dataUnit)||void 0===e?void 0:e.getField(null===(t=this.fieldConfig)||void 0===t?void 0:t.name),s=null==l?void 0:l.dataType;if(null==s)return;const n=null!=(null==i?void 0:i.waitmessage)?void 0:s!==u.OBJECT&&s!==u.DATE&&"object"==typeof i?i.value:i;return s===u.OBJECT?JSON.stringify(n):n}buildInputDefault({value:i,enabled:e,label:l,name:s,required:a,userInterface:d},r,u){let h,c=0,v=0;const p=null==d||null==b[d]?b.DEFAULT:b[d];if(d===n.OPTIONSELECTOR){const i=null==r?void 0:r.options;if("string"==typeof i){const e=o.stringToObject(i);h=Object.keys(e).map((i=>({value:i,label:e[i]})))}else h=i}else d===n.DECIMALNUMBER&&(c=Number((null==r?void 0:r.precision)||2),v=Number((null==r?void 0:r.prettyPrecision)||c));return t(p,Object.assign({value:i,enabled:e,label:l,"data-field-name":s,key:s,onEzChange:i=>this.onChange(null==i?void 0:i.detail)},this.getConditionalAttributes(d,a,h,c,v,u)))}getConditionalAttributes(i,e,t,l,s,o){switch(i){case n.SEARCH:return{suppressEmptyOption:e,optionLoader:i=>this.onSearch(i)};case n.OPTIONSELECTOR:return{suppressEmptyOption:e,options:t};case n.CHECKBOX:case n.SWITCH:return{mode:o};case n.INTEGERNUMBER:case n.DECIMALNUMBER:return{precision:l,prettyPrecision:s,onEzStartChange:i=>this.onChange(null==i?void 0:i.detail)};case n.DATE:case n.DATETIME:case n.TIME:return{onEzStartChange:i=>this.onChange(null==i?void 0:i.detail)};default:return{}}}onChange(i){this.fieldConfig.defaultValue.value=this.getValidatedValue(i),this.configOptionsChanged.emit(this.fieldConfig)}onSearch(i){if(null!=this._application&&null!=this.fieldConfig)return this._application.executeSearch(i,this.fieldConfig.name,this.dataUnit)}buildField(i){const{config:e,descriptor:t}=i,{name:l,label:s,readOnly:o,required:d,defaultValue:r}=e,{userInterface:u,properties:v}=t;let p,b=a.getBooleanValue(null==v?void 0:v.allowDefault,!o);u===n.FILE&&(b=!1),b&&(p=null==r?void 0:r.value,null!=p&&(p=h(null==t?void 0:t.dataType,p)));const g={value:p,enabled:b,label:s,name:l,required:d,userInterface:u};switch(u){case n.SWITCH:return this.buildInputDefault(g,void 0,c.SWITCH);case n.CHECKBOX:return this.buildInputDefault(g,void 0,c.REGULAR);case n.OPTIONSELECTOR:case n.DECIMALNUMBER:return this.buildInputDefault(g,v);default:return this.buildInputDefault(g)}}componentWillLoad(){var i;this.loadDefaultValue(),this._application=d.getContextValue("__SNK__APPLICATION__"),this._fieldProperties=this.getFieldProperties(null===(i=this.fieldConfig)||void 0===i?void 0:i.name)}componentDidLoad(){r.addIDInfo(this._element,this.fieldConfig.name)}render(){var i,e;return t(l,null,t("div",{id:this.idConfig},t("div",{class:"ez-row ez-padding--medium"},t("div",{class:"ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small"},t("ez-text-input",{label:this.getMessage("snkConfigOptions.label.nameField"),value:null===(i=this.fieldConfig)||void 0===i?void 0:i.label,onEzChange:i=>{this.fieldConfig.label=i.detail,this.configOptionsChanged.emit(this.fieldConfig)}})),t("div",{class:"ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small"},t("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.typeValueDefault"),suppressEmptyOption:!0,enabled:this.enabledValueDefault(),onEzChange:i=>{var e;return this.onConfigDefault(null===(e=i.detail)||void 0===e?void 0:e.value)},value:this.getDefaultType()},t("option",{value:p.fixed},this.getMessage("snkConfigOptions.options.valueFixed")),t("option",{value:p.variable},this.getMessage("snkConfigOptions.options.variable")))),t("div",{class:"ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small"},this._defaultType===p.variable?t("ez-combo-box",{label:this.getMessage("snkConfigOptions.label.valueDefault"),enabled:this.isAllowDefault(),onEzChange:i=>{var e;this.fieldConfig.defaultValue.value=null===(e=i.detail)||void 0===e?void 0:e.value,this.configOptionsChanged.emit(this.fieldConfig)},value:this.fieldConfig.defaultValue.value,options:this.buildOptions()}):(null===(e=this._fieldProperties)||void 0===e?void 0:e.userInterface)&&this.buildField({descriptor:this._fieldProperties,config:this.fieldConfig}))),t("div",{class:"ez-row ez-padding--medium config-options__switch-row"},t("div",{class:"ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small"},t("ez-check",{mode:c.SWITCH,label:this.getMessage("snkConfigOptions.label.clearDuplicate"),value:this.fieldConfig.cleanOnCopy,onEzChange:i=>{this.fieldConfig.cleanOnCopy=i.detail,this.configOptionsChanged.emit(this.fieldConfig)}})),t("div",{class:"ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small"},t("ez-check",{mode:c.SWITCH,label:this.getMessage("snkConfigOptions.label.requiredField"),enabled:this.getEnabledByProperty("required"),value:this.getValueByProperty("required"),onEzChange:i=>{this.fieldConfig.required=i.detail,this.configOptionsChanged.emit(this.fieldConfig)}})),t("div",{class:"ez-col ez-col--sd-12 ez-col--tb-4 ez-padding--small"},t("ez-check",{mode:c.SWITCH,label:this.getMessage("snkConfigOptions.label.protectedField"),enabled:this.getEnabledByProperty("readOnly"),value:this.getValueByProperty("readOnly"),onEzChange:i=>{this.fieldConfig.readOnly=i.detail,this.configOptionsChanged.emit(this.fieldConfig)}})))))}get _element(){return s(this)}};g.style=".sc-snk-config-options-h{width:100%;border:2px solid var(--color--secondary-200);border-radius:15px}.config-options__switch-row.sc-snk-config-options{margin-top:-30px}";export{g as snk_config_options}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s,g as i}from"./p-9ba3df4c.js";import{ElementIDUtils as r}from"@sankhyalabs/core";import{F as e}from"./p-9dd2b8cb.js";const n=class{constructor(s){t(this,s)}ezChangeListener(t){this.value=t.detail}async show(){this._numberElement.setFocus()}componentDidLoad(){this._element&&r.addIDInfo(this._element,"filterContentEditor")}render(){var t;if(this.config&&this.config.type===e.NUMBER)return s("ez-number-input",{ref:t=>this._numberElement=t,label:this.config.label,value:this.config.value,precision:null===(t=this.config.props)||void 0===t?void 0:t.precision})}get _element(){return i(this)}};export{n as snk_filter_number}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,H as e,g as i}from"./p-9ba3df4c.js";import{ElementIDUtils as r}from"@sankhyalabs/core";import{F as h}from"./p-9dd2b8cb.js";const c=class{constructor(t){s(this,t)}isSelected(s){return null==this.value||this.value===s}ezChangeListener(s){s.detail||this.assertCheckedOption(s.target),this.updateValue()}componentDidLoad(){this._element&&r.addIDInfo(this._element,"filterContentEditor")}assertCheckedOption(s){s===this._checkOne?this._checkTwo.value=!0:this._checkOne.value=!0}updateValue(){if(this._checkOne.value&&this._checkTwo.value)this.value=void 0;else{const[s,t]=this.config.props.options;this.value=this._checkOne.value?s.name:t.name}}async show(){this._checkOne.setFocus()}render(){if(!this.config||this.config.type!==h.BINARY_SELECT)return;const[s,i]=this.config.props.options;return t(e,null,t("ez-check",{label:s.label,class:"sc-snk-filter-bar editor__ez-check",ref:s=>this._checkOne=s,value:this.isSelected(s.name)}),t("ez-check",{label:i.label,class:"sc-snk-filter-bar editor__ez-check",ref:s=>this._checkTwo=s,value:this.isSelected(i.name)}))}get _element(){return i(this)}};export{c as snk_filter_binary_select}
|
|
@@ -73,4 +73,4 @@ import{r as t,c as e,h as s}from"./p-9ba3df4c.js";import{WaitingChangeException
|
|
|
73
73
|
name
|
|
74
74
|
resource
|
|
75
75
|
}
|
|
76
|
-
}`)}async getParam(t){const e=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return l.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource)?"":t.resource}}const F=R;function R(t,e){const s=L();return(R=function(t){return s[t-=378]})(t,e)}function L(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(L=function(){return t})()}!function(){const t=R,e=L();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class j{[F(397)](t){const e=F;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new k("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class k{constructor(t){const e=F;this.isSup=t,this[e(384)]={}}[F(378)](t,e){this[F(384)][t]=e}[F(393)](t){const e=F;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class M extends g{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=a.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var x;function B(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>B(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=B(t[s]):delete e[s]})),e}}return t}!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(x||(x={}));class z extends g{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=B(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}class G extends g{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}const J=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new H}get parameters(){return this._parameters||(this._parameters=new O),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||U.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new V(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(x).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full"){this.clearContent(this._popUp),"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){U.openAppActivity(t,e)}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e){return new Promise(((s,i)=>{const r=this.getDuPromissesStack(e),n=r.length>0;if(r.push(new V(s,i)),!n){const s=this.dataUnitFetcher.getDataUnit(t,this.resourceID);s.loadMetadata().then((()=>{for(e&&this._duCache.set(e,s);r.length>0;)r.pop().resolve(s)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async getDataUnit(t,e){return new Promise(((s,i)=>{const r=this._duCache.get(e);r?s(r):this.createDataunit(t,e).then((t=>{s(t)})).catch((t=>i(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return _.alert(t,e,s,i)}async error(t,e,s,i){return _.error(t,e,s,i)}async success(t,e,s,i){return _.success(t,e,s,i)}async message(t,e,s,i){return _.message(t,e,s,i)}async confirm(t,e,s,i,r){return _.confirm(t,e,s,i,r)}async info(t,e){return _.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new j).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=v.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new b),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new w),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new I),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new E),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new S),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new M),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new z),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new G),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:c,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let p;const m={rootEntity:h,descriptionFieldName:c,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===d.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||o.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:p,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new D(this),this.messagesBuilder=new $,p.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${v.getUrlBase()}/mge/upload/file`),p.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),p.setContextValue("__EZUI__GRID_LICENSE__",N),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),m.init(),P.get(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){p.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}};class H{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class V{constructor(t,e){this.resolve=t,this.reject=e}}J.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{J as snk_application}
|
|
76
|
+
}`)}async getParam(t){const e=`param://application?params=${t}`;return y.get().callGraphQL({values:{name:e},query:this.templateByQuery.get("fetchParam")})}async asString(t){const e=await this.getParam(t);return this.getValue(e)}async asInteger(t){const e=await this.getParam(t);return parseInt(this.getValue(e))}async asFloat(t){const e=await this.getParam(t);return parseFloat(this.getValue(e))}async asBoolean(t){const e=await this.getParam(t);return this.getValue(e).includes('"S"')}async asDate(t){const e=await this.getParam(t);return l.strToDate(this.getValue(e))}async getBatchParams(t){const e=await this.getParam(t.join(",")),s={};return e.forEach((t=>s[t.name]=t.resource)),s}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),h.isEmpty(t.resource)?"":t.resource}}const F=R;function R(t,e){const s=L();return(R=function(t){return s[t-=378]})(t,e)}function L(){const t=["true","863GKWjmo","parse","56355fjjjAm","isSup","putAccess","4324480sjuCdS","hasOwnProperty","239748okvJLB","name","6055770tXeRaU","actions","forEach","7RPRvzn","1042CHxkUw","2988126NIwRMm","20MTNzmH","authorizationSf","item","string","hasAccess","isArray","Objeto não pode ser indefinido.","3071943fWslZp","parseFromJSON"];return(L=function(){return t})()}!function(){const t=R,e=L();for(;;)try{if(281287==parseInt(t(399))/1*(-parseInt(t(387))/2)+-parseInt(t(401))/3+parseInt(t(381))/4*(-parseInt(t(389))/5)+parseInt(t(388))/6*(-parseInt(t(386))/7)+parseInt(t(379))/8+parseInt(t(396))/9+parseInt(t(383))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class j{[F(397)](t){const e=F;if(typeof(t=utxt(t[e(390)]))==e(392)&&(t=JSON[e(400)](t)),null==t)throw Error(e(395));const s=new k("S"===t[e(402)]||!0===t[e(402)]);return Array[e(394)](t[e(391)])&&t[e(391)][e(385)]((t=>s.putAccess(t[e(382)],String(t.status)==e(398)))),s}}class k{constructor(t){const e=F;this.isSup=t,this[e(384)]={}}[F(378)](t,e){this[F(384)][t]=e}[F(393)](t){const e=F;if(this[e(402)])return!0;let s=!0;return this[e(384)][e(380)](t)&&(s=this.actions[t]),s}isUserSup(){return this.isSup}}class M extends g{getData(t){const e=`cfg://auth/${t}`;return new Promise(((t,s)=>{this.loadResource(e).then((e=>{let s=a.stringToObject(e);s&&"object"==typeof s&&t(s)})).catch((t=>{s(t)}))}))}}var x;function B(t){if(null==t)return t;if(t instanceof Date)return t.toISOString();if("object"==typeof t){if(t instanceof Array)return t.map((t=>B(t)));{const e=Object.assign({},t);return Object.keys(t).forEach((s=>{t[s]?e[s]=B(t[s]):delete e[s]})),e}}return t}!function(t){t.INSERT="I",t.UPDATE="A",t.REMOVE="E",t.SHOW="C",t.CONFIG="F",t.CONFIG_NUMBER="N",t.CLONE="D",t.CONFIG_GRID="G"}(x||(x={}));class z extends g{saveConfig(t,e,s){const i=t.map((t=>{const{id:e,value:s,fixed:i,visible:r}=t,n={id:e};return s&&(n.value=B(s)),i&&(n.fixed=i),r&&(n.visible=!0),n}));return this.saveResource(i,`cfg://filter/FilterBarState:${e}/${s}`)}getConfig(t,e){return new Promise(((s,i)=>{this.loadResource(`cfg://filter/FilterBarState:${t}/${e}`).then((t=>{let e;t&&(e=JSON.parse(t).items),s(e||[])})).catch((t=>{i(t)}))}))}}class G extends g{getDefaultValues(t){return new Promise(((e,s)=>{this.loadResource(`cfg://defaultValues/${t}`).then((t=>{let s;t&&(s=JSON.parse(t)),e(s)})).catch((t=>{s(t)}))}))}}const J=class{constructor(s){t(this,s),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7),this._authPromises=[],this._duCache=new Map,this._duPromises=new Map,this._requestListener=new H}get parameters(){return this._parameters||(this._parameters=new O),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||U.resourceID||"unknown.resource.id"),this._resourceID}get auth(){return this._auth?Promise.resolve(this._auth):new Promise(((t,e)=>{const s=this._authPromises.length>0;this._authPromises.push(new V(t,e)),s||this.authFetcher.getData(this.resourceID).then((t=>{for(this._auth=t;this._authPromises.length>0;)this._authPromises.pop().resolve(this._auth)})).catch((t=>{for(;this._authPromises.length>0;)this._authPromises.pop().reject(t)}))}))}async isUserSup(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{t(e.isSup)})).catch((t=>e(t)))}))}))}async hasAccess(t){return new Promise(((e,s)=>{this.auth.then((i=>{this.getAuthList(i).then((s=>{e(s.isSup||s.actions[t])})).catch((t=>s(t)))}))}))}async getAllAccess(){return new Promise(((t,e)=>{this.auth.then((s=>{this.getAuthList(s).then((e=>{const s={};s.isSup=e.isSup,Object.entries(x).forEach((t=>{s[t[0]]=e.actions[t[1]]||!1})),t(s)})).catch((t=>e(t)))}))}))}async getStringParam(t){return this.parameters.asString(t)}async getIntParam(t){return this.parameters.asInteger(t)}async getFloatParam(t){return this.parameters.asFloat(t)}async getBooleanParam(t){return this.parameters.asBoolean(t)}async getDateParam(t){return this.parameters.asDate(t)}async showPopUp(t,e="full",s=!0){this.clearContent(this._popUp),this._popUp.appendChild(t),this._popUp.opened=!0,this._popUp.heightMode=e,this._popUp.useHeader=s,"EZ-MODAL-CONTAINER"===t.tagName&&(this._popUp.useHeader=!1)}async showModal(t){this.clearContent(this._rightModal),this._rightModal.appendChild(t),this._rightModal.opened=!0}async closeModal(){this.clearContent(this._rightModal),this._rightModal.opened=!1}async closePopUp(){this.clearContent(this._popUp),this._popUp.opened=!1,this._popUp.useHeader=!0,this._popUp.heightMode="full"}async temOpcional(t){const e=t.split(",");return new Promise(((t,s)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{s(t)}))})).catch((t=>{s(t)}))}))}async getConfig(t){let e={serviceName:"SystemUtilsSP.getConf",requestBody:{config:{chave:t,tipo:"T"}}};return new Promise(((t,s)=>{y.get().callServiceBroker("SystemUtilsSP.getConf",JSON.stringify(e)).then((e=>{var s;return t(null===(s=e.config)||void 0===s?void 0:s.data)})).catch((t=>s(t)))}))}async saveConfig(t,e){let s={serviceName:"SystemUtilsSP.saveConf",requestBody:{config:{chave:t,tipo:"T",data:e}}};return new Promise(((t,e)=>{y.get().callServiceBroker("SystemUtilsSP.saveConf",JSON.stringify(s)).then((e=>t(e))).catch((t=>e(t)))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){U.openAppActivity(t,e)}getDuPromissesStack(t){let e;return t&&(e=this._duPromises.get(t),e||(e=[],this._duPromises.set(t,e))),e||[]}async createDataunit(t,e){return new Promise(((s,i)=>{const r=this.getDuPromissesStack(e),n=r.length>0;if(r.push(new V(s,i)),!n){const s=this.dataUnitFetcher.getDataUnit(t,this.resourceID);s.loadMetadata().then((()=>{for(e&&this._duCache.set(e,s);r.length>0;)r.pop().resolve(s)})).catch((t=>{for(;r.length>0;)r.pop().reject(t)}))}}))}async getDataUnit(t,e){return new Promise(((s,i)=>{const r=this._duCache.get(e);r?s(r):this.createDataunit(t,e).then((t=>{s(t)})).catch((t=>i(t)))}))}async getResourceID(){return Promise.resolve(this.resourceID)}async getUserID(){return Promise.resolve(window.UID)}async alert(t,e,s,i){return _.alert(t,e,s,i)}async error(t,e,s,i){return _.error(t,e,s,i)}async success(t,e,s,i){return _.success(t,e,s,i)}async message(t,e,s,i){return _.message(t,e,s,i)}async confirm(t,e,s,i,r){return _.confirm(t,e,s,i,r)}async info(t,e){return _.info(t,e)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}async loadGridConfig(t){return this.gridConfigFetcher.getConfig(t,this.resourceID)}async fetchUserAvailableConfigs(t){return this.formConfigFetcher.fetchUserAvailableConfigs(t,this.resourceID)}async fetchLegacyConfig(t){return this.formConfigFetcher.fetchLegacyConfig(t,this.resourceID)}async fetchDefaultConfig(t){return this.formConfigFetcher.fetchDefaultConfig(t,this.resourceID)}async loadTotals(t,e,s){return this.totalsFetcher.fetchTotals(t,e,s)}async saveGridConfig(t){return this.gridConfigFetcher.saveConfig(t,this.resourceID)}async getFilterBarConfig(t){return new Promise(((e,s)=>{this.configName===t&&this._filterBarConfig?e(this._filterBarConfig):this.configName===t&&null!=this._filterConfigPromise?Promise.all([this._filterConfigPromise]).then((t=>e(t[0]))).catch((t=>s(t[0]))):this.filterBarConfigFetcher.getConfig(this.resourceID,t).then((t=>e(t))).catch((t=>s(t)))}))}async saveFilterBarConfig(t,e){return this.filterBarConfigFetcher.saveConfig(t,this.resourceID,e)}async saveFormConfig(t,e){return this.formConfigFetcher.saveConfig(t,e,this.resourceID)}async getDefaultValues(){return this.defaultValuesFetcher.getDefaultValues(this.resourceID)}async getDefaultValue(t){return this._defaultValues&&this._defaultValues[t]}async getAuthList(t){return await(new j).parseFromJSON(t)}get urlParams(){return this._urlParams||(this._urlParams=v.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new b),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new w),this._formConfigFetcher}get gridConfigFetcher(){return this._gridConfigFetcher||(this._gridConfigFetcher=new I),this._gridConfigFetcher}get totalsFetcher(){return this._totalsFetcher||(this._totalsFetcher=new E),this._totalsFetcher}get pesquisaFetcher(){return this._pesquisaFetcher||(this._pesquisaFetcher=new S),this._pesquisaFetcher}get authFetcher(){return this._authFetcher||(this._authFetcher=new M),this._authFetcher}get filterBarConfigFetcher(){return this._filterBarConfigFetcher||(this._filterBarConfigFetcher=new z),this._filterBarConfigFetcher}get defaultValuesFetcher(){return this._defaultValuesFetcher||(this._defaultValuesFetcher=new G),this._defaultValuesFetcher}async executeSearch(t,e,s){const i=null==s?void 0:s.getField(e);if(i){const{mode:e,argument:r}=t,{ENTITYNAME:n,CODEFIELD:a,DESCRIPTIONFIELD:c,ROOTENTITY:h,DESCRIPTIONENTITY:u}=i.properties,l=i.dependencies;let p;const m={rootEntity:h,descriptionFieldName:c,codeFieldName:a,showInactives:!1};return null==l||l.filter((t=>{var e;return null===(e=t.masterFields)||void 0===e?void 0:e.every((t=>{var e;return null===(e=s.getField(t))||void 0===e?void 0:e.visible}))})).forEach((t=>{var e;t.type===d.SEARCHING&&(null===(e=t.masterFields)||void 0===e?void 0:e.length)>0&&(p={expression:t.expression,params:t.masterFields.map((t=>{const e=s.getField(t),i=(null==e?void 0:e.dataType)||o.TEXT,r=s.getFieldValue(t);if(null==r)throw this.alert("Erro ao pesquisar",`É necessario informar o campo ${e.label} para executar a pesquisa.`),new Error(`É necessario informar o campo ${e.label} para executar a pesquisa.`);return{name:t,value:r,dataType:i}}))})})),this.executePreparedSearch(e,r,{entity:n,entityDescription:u,criteria:p,searchOptions:m})}}async executePreparedSearch(t,e,s){const{entity:i,entityDescription:r,criteria:n,searchOptions:a}=s;return"ADVANCED"===t?new Promise((t=>{const s=document.createElement("snk-pesquisa");s["data-element-id"]=`entity_${i}`,s.argument=e,s.searchLoader=t=>this.pesquisaFetcher.loadAdvancedSearch(i,t,n,a),s.selectItem=e=>{t(e),this.clearPopUpTitle(),this.closePopUp()},this.setPopUpTitle(r),this.showPopUp(s)})):this.pesquisaFetcher.loadSearchOptions(i,e,n,a)}async isDebugMode(){return new Promise((t=>{t(window.isDebugMode)}))}clearContent(t){t&&Array.from(t.children).forEach((e=>{t.removeChild(e)}))}clearPopUpTitle(){this._popUp.ezTitle=""}setPopUpTitle(t){this._popUp.ezTitle=t}componentWillLoad(){this._errorHandler=new D(this),this.messagesBuilder=new $,p.setContextValue("__EZUI__UPLOAD__ADD__URL__",`${v.getUrlBase()}/mge/upload/file`),p.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",((t,e,s)=>this.executeSearch(t,e,s))),p.setContextValue("__EZUI__GRID_LICENSE__",N),this.configName&&(this._filterConfigPromise=new Promise(((t,e)=>{this.filterBarConfigFetcher.getConfig(this.resourceID,this.configName).then((e=>{this._filterBarConfig=e,t(e)})).catch((t=>e(t)))}))),m.init(),P.get(),this.getDefaultValues().then((t=>{this._defaultValues=t}))}connectedCallback(){p.setContextValue("__SNK__APPLICATION__",this),y.addRequestListener(this._requestListener)}disconnectedCallback(){y.removeRequestListener(this._requestListener)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return s("div",null,s("ez-loading-bar",{ref:t=>this._requestListener.loadingBar=t}),s("ez-popup",{opened:!1,ref:t=>this._popUp=t,onEzClosePopup:()=>this.closePopUp()}),s("ez-modal",{opened:!1,ref:t=>this._rightModal=t,"modal-size":"small",closeOutsideClick:!0,closeEsc:!0}))}};class H{constructor(){this._debounceTime=1e3,this._ignoredNameTypes=["totals"],this._countRequest=0}onRequestStart(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest++,this.loadingBar.show(),this._timerLoading&&clearTimeout(this._timerLoading))}onRequestEnd(t){this.isIgnoreLoadingOnRequest(t)||(this._countRequest--,this._timerLoading=setTimeout((()=>{this._countRequest<=0&&this.loadingBar.hide()}),this._debounceTime))}isIgnoreLoadingOnRequest(t){var e;if(1==(null===(e=null==t?void 0:t.requestBody)||void 0===e?void 0:e.length)){const{name:e}=t.requestBody[0].variables;if(e){const t=e.split(":");return this._ignoredNameTypes.indexOf(t[0])>=0}}return!1}}class V{constructor(t,e){this.resolve=t,this.reject=e}}J.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{J as snk_application}
|