@sankhyalabs/sankhyablocks 1.4.0-beta.4 → 1.4.0-beta.6
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/{SnkMessageBuilder-d8215915.js → SnkMessageBuilder-b54dfb89.js} +6 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +9 -3
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar_5.cjs.entry.js +122 -36
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +14 -3
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +4 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-personalized.cjs.entry.js +14 -7
- package/dist/cjs/snk-filter-search.cjs.entry.js +3 -0
- package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
- package/dist/collection/components/snk-application/snk-application.js +12 -3
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-multi-select.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-number.js +24 -1
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-period.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +34 -7
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +23 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-text.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +34 -3
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +37 -15
- package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +82 -8
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +30 -5
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.css +17 -4
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +18 -8
- package/dist/collection/lib/index.js +1 -0
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/crud-utils.msg.js +4 -0
- package/dist/collection/lib/utils/CrudUtils.js +73 -0
- package/dist/components/SnkMessageBuilder.js +6 -1
- package/dist/components/snk-application2.js +8 -2
- package/dist/components/snk-filter-bar2.js +19 -9
- package/dist/components/snk-filter-binary-select.js +5 -1
- package/dist/components/snk-filter-detail2.js +16 -4
- package/dist/components/snk-filter-item2.js +23 -16
- package/dist/components/snk-filter-list2.js +56 -10
- package/dist/components/snk-filter-modal2.js +30 -5
- package/dist/components/snk-filter-multi-select.js +6 -2
- package/dist/components/snk-filter-number.js +6 -2
- package/dist/components/snk-filter-period.js +5 -1
- package/dist/components/snk-filter-personalized.js +16 -8
- package/dist/components/snk-filter-search.js +5 -1
- package/dist/components/snk-filter-text.js +1 -1
- package/dist/esm/{SnkMessageBuilder-35a20271.js → SnkMessageBuilder-d440381c.js} +6 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +9 -3
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-filter-bar_5.entry.js +122 -36
- package/dist/esm/snk-filter-binary-select.entry.js +3 -0
- package/dist/esm/snk-filter-detail.entry.js +14 -3
- package/dist/esm/snk-filter-multi-select.entry.js +4 -1
- package/dist/esm/snk-filter-number.entry.js +4 -1
- package/dist/esm/snk-filter-period.entry.js +3 -0
- package/dist/esm/snk-filter-personalized.entry.js +14 -7
- package/dist/esm/snk-filter-search.entry.js +3 -0
- package/dist/esm/snk-filter-text.entry.js +1 -1
- package/dist/sankhyablocks/{p-01823784.entry.js → p-0ea25487.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8bbc0cbb.entry.js → p-1a58f45c.entry.js} +2 -2
- package/dist/sankhyablocks/p-21e940aa.entry.js +1 -0
- package/dist/sankhyablocks/{p-8f3c5709.entry.js → p-2e49afef.entry.js} +1 -1
- package/dist/sankhyablocks/{p-586e2522.js → p-2eea7eea.js} +1 -1
- package/dist/sankhyablocks/p-40b27004.entry.js +1 -0
- package/dist/sankhyablocks/p-4574a955.entry.js +1 -0
- package/dist/sankhyablocks/p-49580cdd.entry.js +1 -0
- package/dist/sankhyablocks/p-5bdb8452.entry.js +1 -0
- package/dist/sankhyablocks/p-6386d720.entry.js +1 -0
- package/dist/sankhyablocks/p-a14c49db.entry.js +1 -0
- package/dist/sankhyablocks/p-ba426ea9.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 +1 -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 +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-text.d.ts +1 -0
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +4 -0
- package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +7 -2
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +5 -2
- package/dist/types/components.d.ts +10 -1
- package/dist/types/lib/index.d.ts +1 -0
- package/dist/types/lib/message/resources/crud-utils.msg.d.ts +2 -0
- package/dist/types/lib/utils/CrudUtils.d.ts +6 -0
- package/package.json +1 -1
- package/dist/sankhyablocks/p-07ebda01.entry.js +0 -1
- package/dist/sankhyablocks/p-46caa101.entry.js +0 -1
- package/dist/sankhyablocks/p-6f8303f3.entry.js +0 -1
- package/dist/sankhyablocks/p-746fc78b.entry.js +0 -1
- package/dist/sankhyablocks/p-c1c3b5d8.entry.js +0 -1
- package/dist/sankhyablocks/p-c9eec639.entry.js +0 -1
- package/dist/sankhyablocks/p-eea6444c.entry.js +0 -1
- package/dist/sankhyablocks/p-fb705f81.entry.js +0 -1
|
@@ -102,11 +102,13 @@ function buildPersonalized(item) {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
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, 1);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;
|
|
105
|
+
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, 1);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:100%;height:100%}";
|
|
106
106
|
|
|
107
107
|
const PERSONALIZED_FILTER = "PERSONALIZED_FILTER";
|
|
108
108
|
const DEFAULT_FILTER = "DEFAULT_FILTER";
|
|
109
109
|
const CLEAR_ALL_FILTERS = "CLEAR_ALL_FILTERS";
|
|
110
|
+
const ADD_FILTER = "ADD_FILTER";
|
|
111
|
+
const APPLIED_FILTERS = "APPLIED_FILTERS";
|
|
110
112
|
const SnkFilterBar = class {
|
|
111
113
|
constructor(hostRef) {
|
|
112
114
|
registerInstance(this, hostRef);
|
|
@@ -205,13 +207,26 @@ const SnkFilterBar = class {
|
|
|
205
207
|
this.dataUnit.loadData();
|
|
206
208
|
}
|
|
207
209
|
}
|
|
210
|
+
itemFocused(selectedItem) {
|
|
211
|
+
this._element.querySelectorAll("snk-filter-item,snk-filter-list").forEach(item => {
|
|
212
|
+
if (item.id === selectedItem) {
|
|
213
|
+
if (item.tagName.toLowerCase() === "snk-filter-item" && item.getClientRects()[0].x < 0) {
|
|
214
|
+
item.scrollIntoView({ behavior: "auto", inline: 'nearest' });
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
item["hideDetail"]();
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
}
|
|
208
222
|
getFilterItems() {
|
|
209
223
|
const pinnedItems = [];
|
|
210
224
|
const unpinnedItems = [];
|
|
211
225
|
this.filterConfig
|
|
212
226
|
.filter(item => item.visible)
|
|
213
227
|
.forEach((item, index) => {
|
|
214
|
-
const
|
|
228
|
+
const itemId = `filter-${item.id}`;
|
|
229
|
+
const filterItem = (h("snk-filter-item", { onFocusin: () => this.itemFocused(itemId), id: itemId, config: item, class: index > 0 ? "ez-padding-left--medium" : "", getMessage: (key, props) => this.getMessage(key, props), key: item.id }));
|
|
215
230
|
if (item.fixed || item.hardFixed) {
|
|
216
231
|
pinnedItems.push(filterItem);
|
|
217
232
|
}
|
|
@@ -415,13 +430,8 @@ const SnkFilterBar = class {
|
|
|
415
430
|
this.openDefaultFilterModal();
|
|
416
431
|
}
|
|
417
432
|
else if (filterItem) {
|
|
433
|
+
this._pendingFilters.push(itemName);
|
|
418
434
|
this.updateFilter(Object.assign(Object.assign({}, filterItem), { visible: true }));
|
|
419
|
-
window.requestAnimationFrame(() => {
|
|
420
|
-
const filterItemElement = this._element.querySelector("#filter-" + itemName);
|
|
421
|
-
if (filterItemElement) {
|
|
422
|
-
filterItemElement.showUp();
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
435
|
}
|
|
426
436
|
}
|
|
427
437
|
appliedFilterHandler(itemName) {
|
|
@@ -452,7 +462,7 @@ const SnkFilterBar = class {
|
|
|
452
462
|
if (!this.dataUnit || !this.filterConfig || this.filterConfig.length === 0) {
|
|
453
463
|
return undefined;
|
|
454
464
|
}
|
|
455
|
-
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, this.getFilterItems()), h("snk-filter-list", { 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", { 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" }))));
|
|
465
|
+
return (h(Host, null, h("ez-scroller", { direction: "horizontal" }, 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" }))));
|
|
456
466
|
}
|
|
457
467
|
get _element() { return getElement(this); }
|
|
458
468
|
static get watchers() { return {
|
|
@@ -470,7 +480,6 @@ const SnkFilterItem = class {
|
|
|
470
480
|
return true;
|
|
471
481
|
}
|
|
472
482
|
this.detailIsVisible = false;
|
|
473
|
-
this.executeCloseCallback();
|
|
474
483
|
return false;
|
|
475
484
|
};
|
|
476
485
|
}
|
|
@@ -478,29 +487,36 @@ const SnkFilterItem = class {
|
|
|
478
487
|
return new Promise(resolve => {
|
|
479
488
|
this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
|
|
480
489
|
if (open) {
|
|
490
|
+
this._closeCallback = resolve;
|
|
481
491
|
window.requestAnimationFrame(() => {
|
|
482
|
-
this.
|
|
483
|
-
|
|
492
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
|
|
493
|
+
autoClose: true,
|
|
494
|
+
innerClickTest: this.innerClickCheck,
|
|
495
|
+
backClickListener: () => this.onDetailCloseCallback(),
|
|
496
|
+
left: this.getScrollOffset(),
|
|
497
|
+
useOverlay: true
|
|
498
|
+
});
|
|
499
|
+
this._popover.show();
|
|
500
|
+
this.detailIsVisible = true;
|
|
484
501
|
});
|
|
485
502
|
}
|
|
486
503
|
});
|
|
487
504
|
}
|
|
488
|
-
showDetail() {
|
|
489
|
-
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset(), useOverlay: true });
|
|
490
|
-
this.detailIsVisible = true;
|
|
491
|
-
}
|
|
492
505
|
getScrollOffset() {
|
|
493
|
-
|
|
506
|
+
const padding = getComputedStyle(this._filterItemElement).getPropertyValue("padding-left");
|
|
507
|
+
const rect = this._filterItemElement.getBoundingClientRect();
|
|
508
|
+
return `calc(${rect.left}px + ${padding})`;
|
|
494
509
|
}
|
|
495
|
-
hideDetail() {
|
|
496
|
-
if (this.
|
|
497
|
-
|
|
510
|
+
async hideDetail() {
|
|
511
|
+
if (this.detailIsVisible) {
|
|
512
|
+
if (this._floatingID != undefined) {
|
|
513
|
+
FloatingManager.close(this._floatingID);
|
|
514
|
+
}
|
|
498
515
|
}
|
|
516
|
+
}
|
|
517
|
+
onDetailCloseCallback() {
|
|
499
518
|
this._floatingID = undefined;
|
|
500
519
|
this.detailIsVisible = false;
|
|
501
|
-
this.executeCloseCallback();
|
|
502
|
-
}
|
|
503
|
-
executeCloseCallback() {
|
|
504
520
|
if (this._closeCallback) {
|
|
505
521
|
this._closeCallback();
|
|
506
522
|
this._closeCallback = undefined;
|
|
@@ -519,7 +535,7 @@ const SnkFilterItem = class {
|
|
|
519
535
|
this.hideDetail();
|
|
520
536
|
}
|
|
521
537
|
else {
|
|
522
|
-
this.
|
|
538
|
+
this.showUp(true);
|
|
523
539
|
}
|
|
524
540
|
}
|
|
525
541
|
evt.preventDefault();
|
|
@@ -624,6 +640,7 @@ const SnkFilterList = class {
|
|
|
624
640
|
constructor(hostRef) {
|
|
625
641
|
registerInstance(this, hostRef);
|
|
626
642
|
this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
|
|
643
|
+
this._preselection = -1;
|
|
627
644
|
this.innerClickCheck = (_floatingContainer, node) => {
|
|
628
645
|
if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
|
|
629
646
|
return true;
|
|
@@ -632,25 +649,34 @@ const SnkFilterList = class {
|
|
|
632
649
|
return false;
|
|
633
650
|
};
|
|
634
651
|
}
|
|
635
|
-
|
|
636
|
-
this.
|
|
652
|
+
showDetail() {
|
|
653
|
+
this._preselection = -1;
|
|
654
|
+
this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, {
|
|
655
|
+
autoClose: true,
|
|
656
|
+
innerClickTest: this.innerClickCheck,
|
|
657
|
+
backClickListener: () => this.onListCloseCallback(),
|
|
658
|
+
useOverlay: true
|
|
659
|
+
});
|
|
637
660
|
this._detailIsVisible = true;
|
|
638
661
|
this._showAll = false;
|
|
639
662
|
this._filterArgument = "";
|
|
663
|
+
this._filterInput.setFocus();
|
|
640
664
|
}
|
|
641
|
-
|
|
665
|
+
async hideDetail() {
|
|
642
666
|
if (this._floatingID != undefined) {
|
|
643
667
|
FloatingManager.close(this._floatingID);
|
|
644
668
|
}
|
|
669
|
+
}
|
|
670
|
+
onListCloseCallback() {
|
|
645
671
|
this._floatingID = undefined;
|
|
646
672
|
this._detailIsVisible = false;
|
|
647
673
|
}
|
|
648
674
|
buttonClick() {
|
|
649
675
|
if (this._detailIsVisible) {
|
|
650
|
-
this.
|
|
676
|
+
this.hideDetail();
|
|
651
677
|
}
|
|
652
678
|
else {
|
|
653
|
-
this.
|
|
679
|
+
this.showDetail();
|
|
654
680
|
}
|
|
655
681
|
}
|
|
656
682
|
componentDidRender() {
|
|
@@ -661,14 +687,15 @@ const SnkFilterList = class {
|
|
|
661
687
|
}
|
|
662
688
|
}
|
|
663
689
|
buildItemElement(item) {
|
|
664
|
-
|
|
690
|
+
const itemId = ++this._selectableItemsCount;
|
|
691
|
+
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) }, 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)));
|
|
665
692
|
}
|
|
666
693
|
itemSelected(itemName) {
|
|
667
694
|
if (itemName === SHOW_MORE_ITEM_NAME) {
|
|
668
695
|
this._showAll = true;
|
|
669
696
|
}
|
|
670
697
|
else {
|
|
671
|
-
this.
|
|
698
|
+
this.hideDetail();
|
|
672
699
|
this.snkItemSelected.emit(itemName);
|
|
673
700
|
}
|
|
674
701
|
}
|
|
@@ -682,13 +709,47 @@ const SnkFilterList = class {
|
|
|
682
709
|
items.splice(MAX_FILTERS);
|
|
683
710
|
items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
|
|
684
711
|
}
|
|
712
|
+
this._selectableItemsCount = 0;
|
|
685
713
|
return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
|
|
686
714
|
}
|
|
687
715
|
getFooterItems() {
|
|
688
716
|
return this.items.filter(item => item.kind === "FOOTER");
|
|
689
717
|
}
|
|
718
|
+
keyDownHandler(event) {
|
|
719
|
+
switch (event.key) {
|
|
720
|
+
case "ArrowDown":
|
|
721
|
+
this.changePreselection(this._preselection + 1);
|
|
722
|
+
//Paramos a propagação do evento para evitar scroll indesejado
|
|
723
|
+
event.stopImmediatePropagation();
|
|
724
|
+
event.stopPropagation();
|
|
725
|
+
event.preventDefault();
|
|
726
|
+
break;
|
|
727
|
+
case "ArrowUp":
|
|
728
|
+
this.changePreselection(this._preselection - 1);
|
|
729
|
+
//Paramos a propagação do evento para evitar scroll indesejado
|
|
730
|
+
event.stopImmediatePropagation();
|
|
731
|
+
event.stopPropagation();
|
|
732
|
+
event.preventDefault();
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
changePreselection(newSelection) {
|
|
737
|
+
if (newSelection < 0) {
|
|
738
|
+
newSelection = this._selectableItemsCount;
|
|
739
|
+
}
|
|
740
|
+
this._preselection = newSelection > this._selectableItemsCount ? 0 : newSelection;
|
|
741
|
+
if (this._preselection === 0) {
|
|
742
|
+
this._filterInput.setFocus();
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
const item = this._element.querySelector(`#filter-item${this._preselection}`);
|
|
746
|
+
if (item) {
|
|
747
|
+
item.focus();
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
690
751
|
render() {
|
|
691
|
-
return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
752
|
+
return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail, onFocus: () => this._preselection = 0 }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
|
|
692
753
|
}
|
|
693
754
|
get _element() { return getElement(this); }
|
|
694
755
|
};
|
|
@@ -697,9 +758,12 @@ const SnkFilterModal = class {
|
|
|
697
758
|
constructor(hostRef) {
|
|
698
759
|
registerInstance(this, hostRef);
|
|
699
760
|
}
|
|
700
|
-
updateValue(id, value) {
|
|
761
|
+
updateValue(id, value = undefined) {
|
|
701
762
|
this.items = this.items.map(item => {
|
|
702
763
|
if (item.id === id) {
|
|
764
|
+
if (value == undefined) {
|
|
765
|
+
value = !item.active;
|
|
766
|
+
}
|
|
703
767
|
return Object.assign(Object.assign({}, item), { active: value });
|
|
704
768
|
}
|
|
705
769
|
return item;
|
|
@@ -712,12 +776,34 @@ const SnkFilterModal = class {
|
|
|
712
776
|
}
|
|
713
777
|
return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
|
|
714
778
|
}
|
|
715
|
-
|
|
716
|
-
return
|
|
779
|
+
buildItems(list) {
|
|
780
|
+
return list.map(item => {
|
|
781
|
+
return (h("button", { onClick: () => this.updateValue(item.id), class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, h("ez-check", { id: `checkbox_${item.id}`, tabIndex: "-1", class: "sc-snk-filter-bar snk-filter-bar__filter-modal-item__check", onEzChange: evt => this.updateValue(item.id, evt.detail), enabled: item.enabled, value: item.active, mode: "switch" }), h("div", { class: "ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label" }, item.label)));
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
itemKeyBoardSelect(event, item) {
|
|
785
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
786
|
+
this.updateValue(item.id);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
modalActionListener(evt) {
|
|
790
|
+
const modalAction = evt.detail;
|
|
791
|
+
if (modalAction === ModalAction.LOAD) {
|
|
792
|
+
if (this._filterInput) {
|
|
793
|
+
this._filterInput.setFocus();
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
else {
|
|
797
|
+
this.processModalAction(modalAction);
|
|
798
|
+
}
|
|
717
799
|
}
|
|
718
800
|
render() {
|
|
719
801
|
const allowCancel = this.items.filter(item => item.active).length > 0;
|
|
720
|
-
|
|
802
|
+
const items = (this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items) : []);
|
|
803
|
+
return (h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.modalActionListener(evt), cancelButtonStatus: allowCancel ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED }, h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, h("div", null, this.useSearch ?
|
|
804
|
+
h("ez-filter-input", { ref: ref => this._filterInput = ref, label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail })
|
|
805
|
+
:
|
|
806
|
+
undefined), items.length > 0 ? h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, h("div", null, this.buildItems(items)), h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
|
|
721
807
|
}
|
|
722
808
|
};
|
|
723
809
|
|
|
@@ -7,6 +7,9 @@ const SnkFilterDetail = class {
|
|
|
7
7
|
registerInstance(this, hostRef);
|
|
8
8
|
this.filterChange = createEvent(this, "filterChange", 7);
|
|
9
9
|
}
|
|
10
|
+
async show() {
|
|
11
|
+
this._editor["show"]();
|
|
12
|
+
}
|
|
10
13
|
changeConfig(newConfig) {
|
|
11
14
|
this.filterChange.emit(newConfig);
|
|
12
15
|
}
|
|
@@ -35,10 +38,13 @@ const SnkFilterDetail = class {
|
|
|
35
38
|
return undefined;
|
|
36
39
|
}
|
|
37
40
|
return ([
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
this.buildIcon(this.getMessage("snkFilterBar.removeFilter"), "delete", () => this.removeItem()),
|
|
42
|
+
this.buildIcon(this.getMessage(this.config.fixed ? "snkFilterBar.unpinFilter" : "snkFilterBar.pinFilter"), this.config.fixed ? "un-pin" : "push-pin", () => this.changeConfig(Object.assign(Object.assign({}, this.config), { fixed: !this.config.fixed })))
|
|
40
43
|
]);
|
|
41
44
|
}
|
|
45
|
+
buildIcon(title, iconName, action) {
|
|
46
|
+
return (h("button", { onClick: () => action(), class: "sc-snk-filter-bar snk-filter-item__editor-header-button" }, h("ez-icon", { title: title, iconName: iconName })));
|
|
47
|
+
}
|
|
42
48
|
apply() {
|
|
43
49
|
var _a;
|
|
44
50
|
let value = this._editor["value"];
|
|
@@ -82,9 +88,14 @@ const SnkFilterDetail = class {
|
|
|
82
88
|
clear() {
|
|
83
89
|
this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
|
84
90
|
}
|
|
91
|
+
onKeyDonwListener(event) {
|
|
92
|
+
if (event.key === "Enter") {
|
|
93
|
+
this._applyButton.setFocus().then(() => this.apply());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
85
96
|
render() {
|
|
86
97
|
const ContentEditor = this.getContentEditor();
|
|
87
|
-
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 }), 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", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
|
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" }))));
|
|
88
99
|
}
|
|
89
100
|
};
|
|
90
101
|
|
|
@@ -8,11 +8,14 @@ const SnkFilterMultiSelect = class {
|
|
|
8
8
|
ezChangeListener(evt) {
|
|
9
9
|
this.value = evt.detail.value;
|
|
10
10
|
}
|
|
11
|
+
async show() {
|
|
12
|
+
this._comboElement.setFocus();
|
|
13
|
+
}
|
|
11
14
|
render() {
|
|
12
15
|
if (!this.config || this.config.type !== FilterItemType.MULTI_SELECT) {
|
|
13
16
|
return undefined;
|
|
14
17
|
}
|
|
15
|
-
return (h("ez-combo-box", { label: this.config.label, value: this.config.value, options: this.config.props.options }));
|
|
18
|
+
return (h("ez-combo-box", { ref: ref => this._comboElement = ref, label: this.config.label, value: this.config.value, options: this.config.props.options }));
|
|
16
19
|
}
|
|
17
20
|
};
|
|
18
21
|
|
|
@@ -8,12 +8,15 @@ const SnkFilterPeriod = class {
|
|
|
8
8
|
ezChangeListener(evt) {
|
|
9
9
|
this.value = evt.detail;
|
|
10
10
|
}
|
|
11
|
+
async show() {
|
|
12
|
+
this._numberElement.setFocus();
|
|
13
|
+
}
|
|
11
14
|
render() {
|
|
12
15
|
var _a;
|
|
13
16
|
if (!this.config || this.config.type !== FilterItemType.NUMBER) {
|
|
14
17
|
return undefined;
|
|
15
18
|
}
|
|
16
|
-
return (h("ez-number-input", { label: this.config.label, value: this.config.value, precision: (_a = this.config.props) === null || _a === void 0 ? void 0 : _a.precision }));
|
|
19
|
+
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 }));
|
|
17
20
|
}
|
|
18
21
|
};
|
|
19
22
|
|
|
@@ -45,27 +45,34 @@ const SnkFilterPersonalized = class {
|
|
|
45
45
|
const params = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.personalizedFilter) === null || _c === void 0 ? void 0 : _c.parameters;
|
|
46
46
|
return params.map((param, index) => {
|
|
47
47
|
var _a;
|
|
48
|
+
const elemId = 'param_' + index;
|
|
48
49
|
switch (param.type) {
|
|
49
50
|
case UserInterface.SEARCH:
|
|
50
|
-
return h("ez-search", { suppressEmptyOption: true, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
|
|
51
|
+
return h("ez-search", { id: elemId, suppressEmptyOption: true, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail), label: param.label, optionLoader: ({ mode, argument }) => this.doSearch(mode, argument, param) });
|
|
51
52
|
case UserInterface.SWITCH:
|
|
52
53
|
case UserInterface.CHECKBOX:
|
|
53
54
|
const mode = UserInterface.SWITCH === param.type ? "switch" : "regular";
|
|
54
|
-
return h("ez-check", { class: "ez-padding-bottom--medium", mode: mode, value: this.getValue(param, index), label: param.label, onEzChange: evt => this.setValue(index, evt.detail) });
|
|
55
|
+
return h("ez-check", { id: elemId, class: "ez-padding-bottom--medium", mode: mode, value: this.getValue(param, index), label: param.label, onEzChange: evt => this.setValue(index, evt.detail) });
|
|
55
56
|
case UserInterface.DECIMALNUMBER:
|
|
56
57
|
case UserInterface.INTEGERNUMBER:
|
|
57
|
-
return h("ez-number-input", { label: param.label, value: this.getValue(param, index), precision: (_a = param.props) === null || _a === void 0 ? void 0 : _a.precision, onEzChange: evt => this.setValue(index, evt.detail) });
|
|
58
|
+
return h("ez-number-input", { id: elemId, label: param.label, value: this.getValue(param, index), precision: (_a = param.props) === null || _a === void 0 ? void 0 : _a.precision, onEzChange: evt => this.setValue(index, evt.detail) });
|
|
58
59
|
case UserInterface.OPTIONSELECTOR:
|
|
59
|
-
return h("ez-combo-box", { label: param.label, value: this.getValue(param, index), options: param.options, onEzChange: evt => { var _a; return this.setValue(index, (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); } });
|
|
60
|
+
return h("ez-combo-box", { id: elemId, label: param.label, value: this.getValue(param, index), options: param.options, onEzChange: evt => { var _a; return this.setValue(index, (_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); } });
|
|
60
61
|
case UserInterface.DATE:
|
|
61
|
-
return h("ez-date-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
|
|
62
|
+
return h("ez-date-input", { id: elemId, label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
|
|
62
63
|
case UserInterface.DATETIME:
|
|
63
|
-
return h("ez-date-time-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
|
|
64
|
+
return h("ez-date-time-input", { id: elemId, label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
|
|
64
65
|
default:
|
|
65
|
-
return h("ez-text-input", { label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
|
|
66
|
+
return h("ez-text-input", { id: elemId, label: param.label, value: this.getValue(param, index), onEzChange: evt => this.setValue(index, evt.detail) });
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
}
|
|
70
|
+
async show() {
|
|
71
|
+
const elem = document.querySelector("#param_0");
|
|
72
|
+
if (elem) {
|
|
73
|
+
elem["setFocus"]();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
69
76
|
render() {
|
|
70
77
|
if (!this.config || this.config.type !== FilterItemType.PERSONALIZED) {
|
|
71
78
|
return undefined;
|
|
@@ -11,7 +11,7 @@ const SnkFilterText = class {
|
|
|
11
11
|
if (!this.config) {
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
|
-
return (h("ez-text-input", { label: this.config.label, value: this.config.value }));
|
|
14
|
+
return (h("ez-text-input", { ref: ref => this._textInputElement = ref, label: this.config.label, value: this.config.value }));
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,h as r}from"./p-fac2b6a9.js";import{ApplicationContext as t}from"@sankhyalabs/core";import{F as e}from"./p-9dd2b8cb.js";const i=class{constructor(r){s(this,r)}ezChangeListener(s){this.value=this._searchInput.value}doSearch(s,r){const e=t.getContextValue("__SNK__APPLICATION__");return new Promise(((t,i)=>{e.executePreparedSearch(s,r,this.config.props.searchContext).then((s=>{t(s)})).catch((s=>{i(s)}))}))}render(){if(this.config&&this.config.type===e.SEARCH)return r("ez-search",{suppressEmptyOption:!0,value:this.config.value,label:this.config.label,ref:s=>this._searchInput=s,optionLoader:({mode:s,argument:r})=>this.doSearch(s,r)})}};export{i as snk_filter_search}
|
|
1
|
+
import{r as s,h as r}from"./p-fac2b6a9.js";import{ApplicationContext as t}from"@sankhyalabs/core";import{F as e}from"./p-9dd2b8cb.js";const i=class{constructor(r){s(this,r)}ezChangeListener(s){this.value=this._searchInput.value}doSearch(s,r){const e=t.getContextValue("__SNK__APPLICATION__");return new Promise(((t,i)=>{e.executePreparedSearch(s,r,this.config.props.searchContext).then((s=>{t(s)})).catch((s=>{i(s)}))}))}async show(){this._searchInput.setFocus()}render(){if(this.config&&this.config.type===e.SEARCH)return r("ez-search",{suppressEmptyOption:!0,value:this.config.value,label:this.config.label,ref:s=>this._searchInput=s,optionLoader:({mode:s,argument:r})=>this.doSearch(s,r)})}};export{i as snk_filter_search}
|