@sankhyalabs/sankhyablocks 1.1.24 → 1.1.25
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/ApplicationUtils-05b74ee9.js +39 -0
- package/dist/cjs/AssetsUtils-7e3c38f9.js +24 -0
- package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
- package/dist/cjs/ez-application.cjs.entry.js +26 -0
- package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +89 -0
- package/dist/cjs/ez-form.cjs.entry.js +463 -0
- package/dist/cjs/ez-grid.cjs.entry.js +647 -0
- package/dist/cjs/ez-icon.cjs.entry.js +41 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
- package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
- package/dist/cjs/ez-popover.cjs.entry.js +120 -0
- package/dist/cjs/ez-popup.cjs.entry.js +48 -0
- package/dist/cjs/ez-search.cjs.entry.js +64 -0
- package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
- package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
- package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
- package/dist/cjs/ez-toast.cjs.entry.js +44 -0
- package/dist/cjs/ez-upload.cjs.entry.js +356 -0
- package/dist/cjs/index-682c98b2.js +1771 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +6 -41
- package/dist/cjs/test-du.cjs.entry.js +76 -0
- package/dist/collection/collection-manifest.json +36 -1
- package/dist/collection/components/snk-application/snk-application.js +2 -1
- package/dist/{collection/temp → components}/ApplicationUtils.js +37 -36
- package/dist/components/AssetsUtils.js +22 -0
- package/dist/components/CSSVarsUtils.js +17 -0
- package/dist/components/ez-action-chip.js +44 -0
- package/dist/components/ez-application.js +39 -0
- package/dist/components/ez-button.js +6 -0
- package/dist/components/ez-button2.js +105 -0
- package/dist/components/ez-calendar.js +6 -0
- package/dist/components/ez-calendar2.js +242 -0
- package/dist/components/ez-check.js +6 -0
- package/dist/components/ez-check2.js +94 -0
- package/dist/components/ez-collapsible-box.js +67 -0
- package/dist/components/ez-combo-box.js +6 -0
- package/dist/components/ez-combo-box2.js +311 -0
- package/dist/components/ez-date-input.js +135 -0
- package/dist/components/ez-date-time-input.js +179 -0
- package/dist/components/ez-dialog.js +124 -0
- package/dist/components/ez-form.js +6 -0
- package/dist/components/ez-form2.js +485 -0
- package/dist/components/ez-grid.js +738 -0
- package/dist/components/ez-icon.js +6 -0
- package/dist/components/ez-icon2.js +56 -0
- package/dist/components/ez-label-chip.js +125 -0
- package/dist/components/ez-list.js +6 -0
- package/dist/components/ez-list2.js +523 -0
- package/dist/components/ez-modal.js +6 -0
- package/dist/components/ez-modal2.js +82 -0
- package/dist/components/ez-number-input.js +115 -0
- package/dist/components/ez-popover.js +145 -0
- package/dist/components/ez-popup.js +67 -0
- package/dist/components/ez-search.js +100 -0
- package/dist/components/ez-tabselector.js +6 -0
- package/dist/components/ez-tabselector2.js +213 -0
- package/dist/components/ez-text-area.js +137 -0
- package/dist/components/ez-text-input.js +6 -0
- package/dist/components/ez-text-input2.js +223 -0
- package/dist/components/ez-time-input.js +153 -0
- package/dist/components/ez-toast.js +64 -0
- package/dist/components/ez-upload.js +382 -0
- package/dist/components/grid-config.js +6 -0
- package/dist/components/grid-config2.js +318 -0
- package/dist/components/select-box.js +6 -0
- package/dist/components/select-box2.js +47 -0
- package/dist/components/snk-application.js +1 -36
- package/dist/components/test-du.js +101 -0
- package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
- package/dist/esm/AssetsUtils-6e6624dc.js +22 -0
- package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
- package/dist/esm/ez-action-chip.entry.js +23 -0
- package/dist/esm/ez-application.entry.js +22 -0
- package/dist/esm/ez-button_4.entry.js +653 -0
- package/dist/esm/ez-calendar.entry.js +219 -0
- package/dist/esm/ez-collapsible-box.entry.js +43 -0
- package/dist/esm/ez-combo-box.entry.js +274 -0
- package/dist/esm/ez-date-input.entry.js +98 -0
- package/dist/esm/ez-date-time-input.entry.js +141 -0
- package/dist/esm/ez-dialog.entry.js +85 -0
- package/dist/esm/ez-form.entry.js +459 -0
- package/dist/esm/ez-grid.entry.js +643 -0
- package/dist/esm/ez-icon.entry.js +37 -0
- package/dist/esm/ez-label-chip.entry.js +100 -0
- package/dist/esm/ez-modal_2.entry.js +311 -0
- package/dist/esm/ez-number-input.entry.js +82 -0
- package/dist/esm/ez-popover.entry.js +116 -0
- package/dist/esm/ez-popup.entry.js +44 -0
- package/dist/esm/ez-search.entry.js +60 -0
- package/dist/esm/ez-tabselector.entry.js +194 -0
- package/dist/esm/ez-text-area.entry.js +110 -0
- package/dist/esm/ez-text-input.entry.js +197 -0
- package/dist/esm/ez-time-input.entry.js +114 -0
- package/dist/esm/ez-toast.entry.js +40 -0
- package/dist/esm/ez-upload.entry.js +352 -0
- package/dist/esm/index-35088a3f.js +1740 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +2 -37
- package/dist/esm/test-du.entry.js +72 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/sankhyablocks/p-0183d259.entry.js +1 -0
- package/dist/sankhyablocks/p-01f23a70.entry.js +1 -0
- package/dist/sankhyablocks/p-07c32f68.entry.js +1 -0
- package/dist/sankhyablocks/p-0f90499d.entry.js +1 -0
- package/dist/sankhyablocks/p-105724a3.entry.js +1 -0
- package/dist/sankhyablocks/p-2ac02d48.entry.js +1 -0
- package/dist/sankhyablocks/p-35364a97.entry.js +1 -0
- package/dist/sankhyablocks/p-3f6aa9a7.entry.js +1 -0
- package/dist/sankhyablocks/p-5f9af495.entry.js +1 -0
- package/dist/sankhyablocks/p-60967cf0.js +1 -0
- package/dist/sankhyablocks/p-6ce33b60.entry.js +57 -0
- package/dist/sankhyablocks/p-70ad6c16.entry.js +1 -0
- package/dist/sankhyablocks/p-710bfffe.entry.js +1 -0
- package/dist/sankhyablocks/p-735440c1.entry.js +1 -0
- package/dist/sankhyablocks/p-811b4b9d.js +1 -0
- package/dist/sankhyablocks/p-813fe4f7.js +1 -0
- package/dist/sankhyablocks/p-85a9446b.js +2 -0
- package/dist/sankhyablocks/p-89a1100f.entry.js +1 -0
- package/dist/sankhyablocks/p-8b543003.entry.js +1 -0
- package/dist/sankhyablocks/p-9750632b.entry.js +1 -0
- package/dist/sankhyablocks/p-a96272f7.entry.js +1 -0
- package/dist/sankhyablocks/p-ac8842e5.entry.js +1 -0
- package/dist/sankhyablocks/p-ba64cc41.entry.js +1 -0
- package/dist/sankhyablocks/p-c1ede043.entry.js +1 -0
- package/dist/sankhyablocks/p-d90ebb85.entry.js +1 -0
- package/dist/sankhyablocks/p-e17dfaae.entry.js +1 -0
- package/dist/sankhyablocks/p-e5355a29.entry.js +1 -0
- package/dist/sankhyablocks/p-ef04b633.entry.js +1 -0
- package/dist/sankhyablocks/p-f6db07fb.entry.js +1 -0
- package/dist/sankhyablocks/p-fcd9bd92.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/package.json +1 -1
- package/react/components.d.ts +29 -0
- package/react/components.js +29 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/index-4720dab8.js +0 -735
- package/dist/esm/index-72d4e2e0.js +0 -709
- package/dist/sankhyablocks/p-45635e4f.entry.js +0 -57
- package/dist/sankhyablocks/p-a33afc3b.js +0 -2
- package/dist/types/temp/ApplicationUtils.d.ts +0 -11
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const ezListCss = ":host{--ez-list__host--z-index:var(--visible, 1);--ez-list__host--border-radius:var(--border--radius-medium, 12px);--ez-list__host--padding:var(--space--medium, 12px);--ez-list__icon__padding:var(--space--small, 6px);--ez-list__icon--color:#AFB6C0;--ez-list__item__margin:0 var(--space--small, 6px);--ez-list__item--color:var(--title--primary, #2b3a54);--ez-list__item--border-bottom:var(--border--small, 1px solid);--ez-list__item--border-color:var(--title--primary, #2b3a54);--ez-list__item--font-family:var(--font-pattern, \"Sora\");--ez-list__item--font-size:var(--text--medium, 14px);--ez-list__selectable--padding-right:var(--space--small, 6px);--ez-list__selectable--padding-left:var(--space--small, 6px);--ez-list__selected-item__border-radius:var(--border--radius-small, 6px);--ez-list__selected-item__background:var(--color--primary-300, #E2F4EF);--ez-list__group--font-family:var(--font-pattern, \"Sora\");--ez-list__group--font-size:var(--text--medium, 14px);--ez-list__group--font-weight:var(--text-weight--large, 600);--ez-list__group--padding-bottom:var(--space-small, 6px);--ez-list__group__overlay--font-family:var(--font-pattern, \"Sora\");--ez-list__group__overlay--font-size:var(--text--medium, 14px);--ez-list__group-container__scrollbar--border-radius:var(--border--radius-large, 24px);--ez-list__group-container__scrollbar--width:var(--space--medium, 12px);--ez-list__group-container__scrollbar--background-color:var(--text--primary, #626e82);--ez-list__over--border--color:var(--color--primary, #008561);--ez-list__draggable__list--padding-bottom:var(--space--small, 6px);--ez-list__last-droppable-space--height:var(--space--small, 6px);--ez-list__draggable__scrollbar--border-radius:var(--border--radius-large, 24px);--ez-list__draggable__scrollbar--width:var(--space--medium, 12px);--ez-list__draggable__scrollbar--background-color:var(--text--primary, #626e82);--ez-list__draggable__icon--image:url('data:image/svg+xml;utf8,<svg width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m 6.75,2.25 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z m -3,3 h 1.5 v 1.5 h -1.5 z m 3,0 h 1.5 v 1.5 h -1.5 z\"/></svg>');max-height:100%;width:100%;background-color:#fff;display:flex;z-index:var(--ez-list__host--z-index)}p{margin:0}.draggable{display:flex;align-items:center;border-top:1px dashed #fff;justify-content:space-between;background-color:#fff;font-family:var(--ez-list__item--font-family);font-size:var(--ez-list__item--font-size);flex:1}.dragging{background:#FFFFFF;border:1px solid #008561;box-sizing:border-box;box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122);border-radius:6px}.selectable{cursor:pointer;padding-right:var(--ez-list__selectable--padding-right);padding-left:var(--ez-list__selectable--padding-left)}.selectable-container{margin:0px !important}.item-content{display:flex;justify-content:center;align-items:center}.draggable-list{color:var(--text-color);padding:0;margin:0;width:100%;max-height:100%}.draggable-list li{background-color:#fff;display:flex;margin:var(--ez-list__item__margin);font-family:var(--ez-list__item--font-family);font-size:var(--ez-list__item--font-size);color:var(--ez-list__item--color);height:32px}.over{border-top:1px dashed var(--ez-list__over--border--color)}.last-droppable-space{height:var(--ez-list__last-droppable-space--height)}.draggable-selected{background-color:var(--background--strong) !important}.draggable-selected div:hover{background-color:var(--background--strong) !important}.draggable-list::-webkit-scrollbar-track{background-color:#f0f2f5}.draggable-list::-webkit-scrollbar-thumb{background-color:var(--ez-list__draggable__scrollbar--background-color);border-radius:var(--ez-list__draggable__scrollbar--border-radius)}.draggable-list::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-list__draggable__scrollbar--width);max-width:var(--ez-list__draggable__scrollbar--width);min-width:var(--ez-list__draggable__scrollbar--width)}.draggable-icon{align-items:flex-start;display:flex;outline:none;border:none;background-color:unset}.draggable-icon::after{content:'';display:flex;background-color:var(--ez-list__icon--color);width:18px;height:18px;-webkit-mask-image:var(--ez-list__draggable__icon--image);mask-image:var(--ez-list__draggable__icon--image)}*{box-sizing:border-box}.checkbox{width:fit-content}.text--ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.group-container{display:flex;flex-direction:column;max-height:100%;overflow-y:auto;outline:none;width:100%}.group-name{font-family:var(--ez-list__group--font-family);font-size:var(--ez-list__group--font-size);font-weight:var(--ez-list__group--font-weight);padding-bottom:var(--ez-list__group--padding-bottom);-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none}.group{display:flex;flex-direction:column}.group-container::-webkit-scrollbar-track{background-color:#f0f2f5}.group-container::-webkit-scrollbar-thumb{background-color:var(--ez-list__group-container__scrollbar--background-color);border-radius:var(--ez-list__group-container__scrollbar--border-radius)}.group-container::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-list__group-container__scrollbar--width);max-width:var(--ez-list__group-container__scrollbar--width);min-width:var(--ez-list__group-container__scrollbar--width)}.section-container{display:flex;position:relative;height:100%}.items-container{width:100%;max-height:100%;overflow-y:auto;outline:none}.group-items-container{width:100%;max-height:100%;height:100%;outline:none}.items-container::-webkit-scrollbar-track{background-color:#f0f2f5}.items-container::-webkit-scrollbar-thumb{background-color:var(--ez-list__draggable__scrollbar--background-color);border-radius:var(--ez-list__draggable__scrollbar--border-radius)}.items-container::-webkit-scrollbar{background-color:#f0f2f5;width:var(--ez-list__draggable__scrollbar--width);max-width:var(--ez-list__draggable__scrollbar--width);min-width:var(--ez-list__draggable__scrollbar--width)}.group-overlay{font-family:var(--ez-list__group__overlay--font-family);font-size:var(--ez-list__group__overlay--font-size);background:rgba(226, 244, 239, 0.8);border:1px solid #008561;border-radius:8px;position:absolute;display:none;place-items:center;top:0;bottom:0;left:0;right:0;z-index:2;margin:0;cursor:pointer}.presetedHeight{min-height:100px}.overlay-text{position:absolute;top:50%;left:50%;font-size:50px;color:white;transform:translate(-50%, -50%);-ms-transform:translate(-50%, -50%)}.selected-item{background:var(--ez-list__selected-item__background);border-radius:var(--ez-list__selected-item__border-radius)}.slot-item{align-items:flex-end}.overGroup{background:rgba(226, 244, 239, 0.8);border:1px solid #008561;box-sizing:border-box;border-radius:8px;padding-top:6px}";
|
|
4
|
+
|
|
5
|
+
const EzList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.ezChange = createEvent(this, "ezChange", 7);
|
|
11
|
+
this._listItems = [];
|
|
12
|
+
this._listGroupItems = [];
|
|
13
|
+
this._listItemsHistory = [];
|
|
14
|
+
/**
|
|
15
|
+
* Define a lista inicial do componente.
|
|
16
|
+
*/
|
|
17
|
+
this.dataSource = [];
|
|
18
|
+
/**
|
|
19
|
+
* Define se o componente renderizará os itens separados em grupos..
|
|
20
|
+
*/
|
|
21
|
+
this.useGroups = false;
|
|
22
|
+
/**
|
|
23
|
+
* Define se o componente terá o comportamento de arrasto de linhas.
|
|
24
|
+
*/
|
|
25
|
+
this.ezDraggable = false;
|
|
26
|
+
/**
|
|
27
|
+
* Define se os items da lista serão selecionáveis.
|
|
28
|
+
*/
|
|
29
|
+
this.ezSelectable = false;
|
|
30
|
+
}
|
|
31
|
+
createList() {
|
|
32
|
+
if (this.useGroups) {
|
|
33
|
+
let list = [...this.dataSource];
|
|
34
|
+
list.forEach(itemGroup => {
|
|
35
|
+
this.sortGroup(itemGroup);
|
|
36
|
+
});
|
|
37
|
+
this._listGroupItems = list;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this._listItems = this._listItemsHistory.length > 0 ? this._listItemsHistory : [...this.dataSource];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
sortGroup(itemGroup) {
|
|
44
|
+
if (itemGroup.sort) {
|
|
45
|
+
itemGroup.items.sort(function (a, b) {
|
|
46
|
+
return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
|
|
47
|
+
});
|
|
48
|
+
if (itemGroup.sort === "DSC") {
|
|
49
|
+
itemGroup.items.reverse();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Recebe como argumento um ListItem {label: string} e um booleano que define se o componente deve fazer scroll para exibir o item específico (opcional).
|
|
55
|
+
*/
|
|
56
|
+
async setSelection(selectedItem, scrollToOption) {
|
|
57
|
+
if (selectedItem && this.ezSelectable) {
|
|
58
|
+
if (this.useGroups) {
|
|
59
|
+
let newList = [...this._listGroupItems];
|
|
60
|
+
newList.forEach(groupItem => {
|
|
61
|
+
groupItem.items.forEach(item => {
|
|
62
|
+
if (item.label == selectedItem.label) {
|
|
63
|
+
item.selected = true;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
item.selected = false;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
this._listGroupItems = newList;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
let newList = [...this._listItems];
|
|
74
|
+
newList.forEach(item => {
|
|
75
|
+
if (item.label === selectedItem.label) {
|
|
76
|
+
item.selected = true;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
item.selected = false;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
this._listItems = newList;
|
|
83
|
+
}
|
|
84
|
+
if (scrollToOption) {
|
|
85
|
+
let liElem = this.useGroups ?
|
|
86
|
+
this._groupContainer.querySelector('li#item_' + this.getItemId(selectedItem.label))
|
|
87
|
+
: this._itemContainer.querySelector('li#item_' + this.getItemId(selectedItem.label));
|
|
88
|
+
if (liElem) {
|
|
89
|
+
liElem.scrollIntoView();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.removeSelection();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
removeSelection() {
|
|
98
|
+
if (this.useGroups) {
|
|
99
|
+
let newList = [...this._listGroupItems];
|
|
100
|
+
newList.forEach(groupItem => {
|
|
101
|
+
groupItem.items.forEach(item => {
|
|
102
|
+
item.selected = false;
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
this._listGroupItems = newList;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
let newList = [...this._listItems];
|
|
109
|
+
newList.forEach(item => {
|
|
110
|
+
item.selected = false;
|
|
111
|
+
});
|
|
112
|
+
this._listItems = newList;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Retorna o item selecionado.
|
|
117
|
+
*/
|
|
118
|
+
async getSelection() {
|
|
119
|
+
let selectedItem;
|
|
120
|
+
if (this.useGroups) {
|
|
121
|
+
this._listGroupItems.every(group => {
|
|
122
|
+
let item = group.items.find((item) => item.selected == true);
|
|
123
|
+
if (item) {
|
|
124
|
+
selectedItem = item;
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return true;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
selectedItem = this._listItems.find((item) => item.selected == true);
|
|
132
|
+
}
|
|
133
|
+
return selectedItem;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Retorna a lista de items conforme o modo de uso.
|
|
137
|
+
*/
|
|
138
|
+
async getList() {
|
|
139
|
+
if (this.useGroups) {
|
|
140
|
+
return this._listGroupItems;
|
|
141
|
+
}
|
|
142
|
+
return this._listItems;
|
|
143
|
+
}
|
|
144
|
+
componentWillLoad() {
|
|
145
|
+
this._listItemsHistory = [];
|
|
146
|
+
}
|
|
147
|
+
componentWillRender() {
|
|
148
|
+
this.createList();
|
|
149
|
+
}
|
|
150
|
+
onDrop(ev, dragEndItem) {
|
|
151
|
+
this.removeOverClass();
|
|
152
|
+
this.setSelection(undefined);
|
|
153
|
+
if (this._dragStartItem) {
|
|
154
|
+
if (this.useGroups) {
|
|
155
|
+
let newList = [...this._listGroupItems];
|
|
156
|
+
let groupEnd = this._listGroupItems.find(group => dragEndItem.groupName == group.group);
|
|
157
|
+
//Remove item arrastado
|
|
158
|
+
newList.find(group => group.group == this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
|
|
159
|
+
//Adiciona item arrastado
|
|
160
|
+
if (groupEnd.sort) {
|
|
161
|
+
newList.find(group => group.group == dragEndItem.groupName).items.push(this._dragStartItem.item);
|
|
162
|
+
newList.find(group => group.group == dragEndItem.groupName).items.sort(function (a, b) {
|
|
163
|
+
return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
|
|
164
|
+
});
|
|
165
|
+
if (groupEnd.sort === "DSC") {
|
|
166
|
+
newList.find(group => group.group == dragEndItem.groupName).items.reverse();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
let indexForAdd = (dragEndItem.index > this._dragStartItem.index) ? dragEndItem.index - 1 : dragEndItem.index;
|
|
171
|
+
newList.find(group => group.group == dragEndItem.groupName).items.splice(indexForAdd, 0, this._dragStartItem.item);
|
|
172
|
+
}
|
|
173
|
+
this._listGroupItems = newList;
|
|
174
|
+
this.ezChange.emit(this._listGroupItems);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
let newList = [...this._listItems];
|
|
178
|
+
newList.splice(this._dragStartItem.index, 1);
|
|
179
|
+
newList.splice(dragEndItem.index, 0, this._dragStartItem.item);
|
|
180
|
+
this._listItems = newList;
|
|
181
|
+
this._listItemsHistory = newList;
|
|
182
|
+
this.ezChange.emit(this._listItems);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
ev.stopPropagation();
|
|
186
|
+
}
|
|
187
|
+
onDropLastIndex(ev, groupDropped) {
|
|
188
|
+
this.removeOverClass();
|
|
189
|
+
this.setSelection(undefined);
|
|
190
|
+
if (this._dragStartItem) {
|
|
191
|
+
if (this.useGroups) {
|
|
192
|
+
let newList = [...this._listGroupItems];
|
|
193
|
+
let groupEnd = this._listGroupItems.find(group => groupDropped.group == group.group);
|
|
194
|
+
//Remove item arrastado
|
|
195
|
+
newList.find(group => group.group == this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
|
|
196
|
+
//Adiciona item arrastado
|
|
197
|
+
newList.find(group => group.group == groupDropped.group).items.push(this._dragStartItem.item);
|
|
198
|
+
if (groupEnd.sort) {
|
|
199
|
+
newList.find(group => group.group == groupDropped.group).items.sort(function (a, b) {
|
|
200
|
+
return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
|
|
201
|
+
});
|
|
202
|
+
if (groupEnd.sort === "DSC") {
|
|
203
|
+
newList.find(group => group.group == groupDropped.group).items.reverse();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
this._listGroupItems = newList;
|
|
207
|
+
this.ezChange.emit(this._listGroupItems);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
let newList = [...this._listItems];
|
|
211
|
+
newList.splice(this._dragStartItem.index, 1);
|
|
212
|
+
newList.push(this._dragStartItem.item);
|
|
213
|
+
this._listItems = newList;
|
|
214
|
+
this._listItemsHistory = newList;
|
|
215
|
+
this.ezChange.emit(this._listItems);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
ev.stopPropagation();
|
|
219
|
+
}
|
|
220
|
+
onDropGroup(groupSelected) {
|
|
221
|
+
var _a;
|
|
222
|
+
let newList = [...this._listGroupItems];
|
|
223
|
+
this.setSelection(undefined);
|
|
224
|
+
let newGroup = newList.find(group => group.group === groupSelected.group);
|
|
225
|
+
if (newGroup) {
|
|
226
|
+
if (((_a = newGroup.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
227
|
+
let newItem;
|
|
228
|
+
newGroup.items.forEach((item, index) => {
|
|
229
|
+
if (item.label === this._dragStartItem.item.label) {
|
|
230
|
+
newItem = { item: item, index: index };
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
if (newItem) {
|
|
234
|
+
newGroup.items.splice(newItem.index, 1);
|
|
235
|
+
newGroup.items.unshift(newItem.item);
|
|
236
|
+
this.sortGroup(newGroup);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
newGroup.items.unshift(this._dragStartItem.item);
|
|
240
|
+
this.sortGroup(newGroup);
|
|
241
|
+
newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
|
|
246
|
+
newGroup.items = [this._dragStartItem.item];
|
|
247
|
+
}
|
|
248
|
+
this._listGroupItems = newList;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
onDragEnd() {
|
|
252
|
+
this._dragStartItem = undefined;
|
|
253
|
+
if (this.useGroups) {
|
|
254
|
+
this.hideOverlays();
|
|
255
|
+
}
|
|
256
|
+
if (this._draggingElement) {
|
|
257
|
+
try {
|
|
258
|
+
this._element.shadowRoot.removeChild(this._draggingElement);
|
|
259
|
+
}
|
|
260
|
+
catch (err) { }
|
|
261
|
+
this._draggingElement = undefined;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
addOverClass(element) {
|
|
265
|
+
if ((element === null || element === void 0 ? void 0 : element.__proto__) == HTMLDivElement.prototype && element.classList.contains("draggable")) {
|
|
266
|
+
element.classList.add('over');
|
|
267
|
+
}
|
|
268
|
+
else if ((element === null || element === void 0 ? void 0 : element.parentElement) && !element.parentElement.classList.contains("draggable-list")) {
|
|
269
|
+
this.addOverClass(element.parentElement);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
addOverGroupClass(ev, group) {
|
|
273
|
+
if (ev.target) {
|
|
274
|
+
let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
|
|
275
|
+
let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
|
|
276
|
+
if (group.items.length > 0) {
|
|
277
|
+
groupOverlay.setAttribute("style", "display:grid");
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
groupOverlay.classList.add("presetedHeight");
|
|
281
|
+
groupOverlay.setAttribute("style", "display:grid");
|
|
282
|
+
groupOverlay.scrollIntoView(false);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
removeOverClass() {
|
|
287
|
+
var _a, _b;
|
|
288
|
+
let overCollection;
|
|
289
|
+
let overLastDroppableCollection;
|
|
290
|
+
if (this.useGroups) {
|
|
291
|
+
overCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName('over');
|
|
292
|
+
overLastDroppableCollection = this._groupContainer.getElementsByClassName('last-droppable-space');
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
overCollection = (_b = this._itemContainer) === null || _b === void 0 ? void 0 : _b.getElementsByClassName('over');
|
|
296
|
+
overLastDroppableCollection = this._itemContainer.getElementsByClassName('last-droppable-space');
|
|
297
|
+
}
|
|
298
|
+
if (overCollection) {
|
|
299
|
+
Array.from(overCollection).forEach(function (element) {
|
|
300
|
+
element.classList.remove('over');
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
if (overLastDroppableCollection) {
|
|
304
|
+
Array.from(overLastDroppableCollection).forEach(function (element) {
|
|
305
|
+
element.classList.remove('over');
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
removeOverGroupClass(ev, group) {
|
|
310
|
+
if (ev.target) {
|
|
311
|
+
let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
|
|
312
|
+
let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
|
|
313
|
+
if (groupOverlay) {
|
|
314
|
+
groupOverlay.classList.remove("presetedHeight");
|
|
315
|
+
groupOverlay.setAttribute("style", "display:none");
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
onDragStart(item, group, index) {
|
|
320
|
+
if (this._changeDeboucingTimeout) {
|
|
321
|
+
window.clearTimeout(this._changeDeboucingTimeout);
|
|
322
|
+
}
|
|
323
|
+
if (this.useGroups) {
|
|
324
|
+
this._dragStartItem = { groupName: group.group, item: item, index: index };
|
|
325
|
+
this._changeDeboucingTimeout = window.setTimeout(() => {
|
|
326
|
+
this.showOverlays(group);
|
|
327
|
+
}, 10);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this._dragStartItem = { item: item.item, index: item.index };
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
selectFirstItem() {
|
|
334
|
+
if (this.useGroups) {
|
|
335
|
+
this.setSelection(this._listGroupItems[0].items[0]);
|
|
336
|
+
}
|
|
337
|
+
{
|
|
338
|
+
this.setSelection(this._listItems[0]);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
nextOption(selectedItem) {
|
|
342
|
+
let nextItem = undefined;
|
|
343
|
+
if (this.useGroups) {
|
|
344
|
+
this._listGroupItems.every((group, groupIndex, listGroupItems) => {
|
|
345
|
+
let item = undefined;
|
|
346
|
+
let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
|
|
347
|
+
if (itemIndex != undefined && itemIndex != -1) {
|
|
348
|
+
if (itemIndex === group.items.length - 1) {
|
|
349
|
+
if (groupIndex + 1 <= listGroupItems.length - 1) {
|
|
350
|
+
item = { label: listGroupItems[groupIndex + 1].items[0].label };
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
item = { label: group.items[itemIndex + 1].label };
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (item != undefined) {
|
|
358
|
+
nextItem = item;
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
return true;
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
|
|
366
|
+
if (itemIndex >= 0 && itemIndex < this._listItems.length) {
|
|
367
|
+
nextItem = this._listItems[itemIndex + 1];
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
this.setSelection(nextItem, true);
|
|
371
|
+
}
|
|
372
|
+
previousOption(selectedItem) {
|
|
373
|
+
let previousItem = undefined;
|
|
374
|
+
if (this.useGroups) {
|
|
375
|
+
this._listGroupItems.every((group, groupIndex, listGroupItems) => {
|
|
376
|
+
let item = undefined;
|
|
377
|
+
let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
|
|
378
|
+
if (itemIndex != undefined && itemIndex != -1) {
|
|
379
|
+
if (itemIndex === 0) {
|
|
380
|
+
if ((groupIndex - 1 >= 0)) {
|
|
381
|
+
item = { label: listGroupItems[groupIndex - 1].items[listGroupItems[groupIndex - 1].items.length - 1].label };
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
item = { label: group.items[itemIndex - 1].label };
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (item != undefined) {
|
|
389
|
+
previousItem = item;
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
return true;
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
|
|
397
|
+
if (itemIndex > 0 && itemIndex < this._listItems.length) {
|
|
398
|
+
previousItem = this._listItems[itemIndex - 1];
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
this.setSelection(previousItem, true);
|
|
402
|
+
}
|
|
403
|
+
keyDownHandler(event) {
|
|
404
|
+
event.preventDefault();
|
|
405
|
+
this.getSelection().then(selectedItem => {
|
|
406
|
+
if (selectedItem) {
|
|
407
|
+
switch (event.key) {
|
|
408
|
+
case "ArrowDown":
|
|
409
|
+
this.nextOption(selectedItem);
|
|
410
|
+
break;
|
|
411
|
+
case "ArrowUp":
|
|
412
|
+
this.previousOption(selectedItem);
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
this.selectFirstItem();
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
event.stopPropagation();
|
|
421
|
+
}
|
|
422
|
+
getItemId(itemLabel) {
|
|
423
|
+
if (itemLabel) {
|
|
424
|
+
return itemLabel.replace(/[^a-z0-9_]/gi, "_");
|
|
425
|
+
}
|
|
426
|
+
return undefined;
|
|
427
|
+
}
|
|
428
|
+
getDivGroupId(groupName) {
|
|
429
|
+
if (groupName) {
|
|
430
|
+
return "group-" + groupName.replace(/[^a-z0-9_]/gi, "_");
|
|
431
|
+
}
|
|
432
|
+
return undefined;
|
|
433
|
+
}
|
|
434
|
+
getGroupOverlayId(groupName) {
|
|
435
|
+
if (groupName) {
|
|
436
|
+
return "group-overlay-" + groupName.replace(/[^a-z0-9_]/gi, "_");
|
|
437
|
+
}
|
|
438
|
+
return undefined;
|
|
439
|
+
}
|
|
440
|
+
onDragOverGroup(event, group) {
|
|
441
|
+
if (this._dragStartItem && this._dragStartItem.groupName !== group.group && group.sort) {
|
|
442
|
+
event.preventDefault();
|
|
443
|
+
this.addOverGroupClass(event, group);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
onDragOverItem(event) {
|
|
447
|
+
if (this._dragStartItem) {
|
|
448
|
+
event.preventDefault();
|
|
449
|
+
this.addOverClass(event.target);
|
|
450
|
+
event.stopPropagation();
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
onDragOverLastIndex(ev) {
|
|
454
|
+
ev.preventDefault();
|
|
455
|
+
if (this._dragStartItem) {
|
|
456
|
+
ev.target.classList.add('over');
|
|
457
|
+
ev.stopPropagation();
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
showOverlays(groupDragStart) {
|
|
461
|
+
let groupOverlayCollection = this._groupContainer.getElementsByClassName("group-overlay");
|
|
462
|
+
Array.from(groupOverlayCollection).forEach(groupOverlay => {
|
|
463
|
+
let groupOverlayID = this.getGroupOverlayId(groupDragStart.group);
|
|
464
|
+
if (groupOverlayID && groupOverlay.getAttribute("id") && groupOverlayID != groupOverlay.getAttribute("id")) {
|
|
465
|
+
groupOverlay.classList.add("presetedHeight");
|
|
466
|
+
groupOverlay.setAttribute("style", "display:grid");
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
hideOverlays() {
|
|
471
|
+
var _a;
|
|
472
|
+
let groupOverlayCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName("group-overlay");
|
|
473
|
+
Array.from(groupOverlayCollection).forEach(groupOverlay => {
|
|
474
|
+
groupOverlay.classList.remove("presetedHeight");
|
|
475
|
+
groupOverlay.setAttribute("style", "display:none");
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
render() {
|
|
479
|
+
return (h(Host, { ref: (el) => this._element = el }, this.useGroups ?
|
|
480
|
+
h("div", { class: "group-container", ref: (el) => this._groupContainer = el, tabIndex: 0, onKeyDown: (event) => { this.keyDownHandler(event); } }, this._listGroupItems.map(group => {
|
|
481
|
+
return h("div", { id: this.getDivGroupId(group.group), class: "group", key: group.group + group.items.length, onDrop: () => this.onDropGroup(group) }, h("label", { draggable: false, class: "group-name" }, group.group), h("section", { class: "section-container", onDragOver: (ev) => ev.preventDefault() }, h("div", { class: "group-items-container" }, h("div", { class: "draggable-list" }, group.items.map((item, index) => {
|
|
482
|
+
return h("li", { id: 'item_' + this.getItemId(item.label), class: this.ezSelectable ? "selectable-container" : "", key: 'item_' + this.getItemId(item.label) }, h("div", { class: "draggable" + (item.selected == true ? " selected-item " : "") + (this.ezSelectable == true ? " selectable " : ""), onClick: () => { this.setSelection(item); }, onDragLeave: () => { group.sort ? undefined : this.removeOverClass(); }, onDragEnd: () => this.onDragEnd(), onDragStart: () => this.onDragStart(item, group, index), onDragOver: (event) => { group.sort ? undefined : this.onDragOverItem(event); }, onDrop: (event) => this.onDrop(event, { groupName: group.group, item: item, index: index }), draggable: this.ezDraggable }, h("div", { class: "item-content" }, this.ezDraggable ? h("span", { class: "draggable-icon" }) : undefined, h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label)), this.itemSlotBuilder ?
|
|
483
|
+
h("div", { class: "slot-item" }, this.itemSlotBuilder(item, group))
|
|
484
|
+
: undefined));
|
|
485
|
+
})), h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: (event) => { this.onDragOverLastIndex(event); }, onDragEnd: () => this.onDragEnd(), onDrop: (event) => this.onDropLastIndex(event, group) })), group.sort ?
|
|
486
|
+
h("div", { id: this.getGroupOverlayId(group.group), class: "group-overlay" }, "Mover para ", group.group)
|
|
487
|
+
: undefined));
|
|
488
|
+
}))
|
|
489
|
+
:
|
|
490
|
+
h("div", { class: "items-container", ref: (el) => this._itemContainer = el, tabIndex: 0, onKeyDown: (event) => { this.keyDownHandler(event); } }, h("div", { class: "draggable-list" }, this._listItems.map((item, index) => {
|
|
491
|
+
return h("li", { id: 'item_' + this.getItemId(item.label), class: this.ezSelectable ? "selectable-container" : "", key: 'item_' + this.getItemId(item.label) }, h("div", { class: "draggable" + (item.selected == true ? " selected-item " : "") + (this.ezSelectable == true ? " selectable " : ""), onDragStart: () => this.onDragStart({ item: item, index: index }), onClick: () => { this.setSelection(item); }, onDragLeave: () => this.removeOverClass(), onDragOver: (event) => this.onDragOverItem(event), onDragEnd: () => this.onDragEnd(), onDrop: (event) => this.onDrop(event, { item: item, index: index }), draggable: this.ezDraggable }, h("div", { class: "item-content" }, this.ezDraggable ? h("span", { class: "draggable-icon" }) : undefined, h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label)), this.itemSlotBuilder ?
|
|
492
|
+
h("div", null, this.itemSlotBuilder(item))
|
|
493
|
+
: undefined));
|
|
494
|
+
}), h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: (event) => { this.onDragOverLastIndex(event); }, onDragEnd: () => this.onDragEnd(), onDrop: (event) => this.onDropLastIndex(event) })))));
|
|
495
|
+
}
|
|
496
|
+
static get style() { return ezListCss; }
|
|
497
|
+
}, [1, "ez-list", {
|
|
498
|
+
"dataSource": [1040],
|
|
499
|
+
"useGroups": [1540, "use-groups"],
|
|
500
|
+
"ezDraggable": [1028, "ez-draggable"],
|
|
501
|
+
"ezSelectable": [1028, "ez-selectable"],
|
|
502
|
+
"itemSlotBuilder": [1040],
|
|
503
|
+
"_listItems": [32],
|
|
504
|
+
"_listGroupItems": [32],
|
|
505
|
+
"setSelection": [64],
|
|
506
|
+
"getSelection": [64],
|
|
507
|
+
"getList": [64]
|
|
508
|
+
}]);
|
|
509
|
+
function defineCustomElement() {
|
|
510
|
+
if (typeof customElements === "undefined") {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
const components = ["ez-list"];
|
|
514
|
+
components.forEach(tagName => { switch (tagName) {
|
|
515
|
+
case "ez-list":
|
|
516
|
+
if (!customElements.get(tagName)) {
|
|
517
|
+
customElements.define(tagName, EzList);
|
|
518
|
+
}
|
|
519
|
+
break;
|
|
520
|
+
} });
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export { EzList as E, defineCustomElement as d };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const ezModalCss = ":host{--ez-modal-z-index:var(--most-visible, 3);--ez-modal-vertical-padding:var(--space--large, 24px);display:block}.modal{position:fixed;padding:var(--ez-modal-vertical-padding) 0;display:flex;top:0px;z-index:var(--ez-modal-z-index);left:0px;width:100%;box-sizing:border-box;height:100vh;backdrop-filter:blur(4px);background:rgba(0, 4, 12, 0.4)}@keyframes expand-modal--left{from{transform:translate(-100%)}}@keyframes expand-modal--right{from{transform:translate(100%)}}.modal__container{display:flex;flex-wrap:wrap;height:100%;box-sizing:border-box;width:100%;align-items:flex-start}.modal__container--right{animation:expand-modal--right .2s ease-in-out 1;justify-content:flex-end}.modal__container--left{animation:expand-modal--left .2s ease-in-out 1;justify-content:flex-start}.modal__content{display:flex;flex-wrap:wrap;max-height:calc(100% - 48px);height:100%;overflow-y:auto;background-color:rgb(255, 255, 255);padding:24px;border-radius:12px 0px 0px 12px;box-shadow:rgb(0 38 111 / 12%) 0px 0px 16px 0px}.modal__content--right{border-radius:12px 0px 0px 12px}.modal__content--left{border-radius:0px 12px 12px 0px}.modal__box__container{display:flex;flex-wrap:wrap;background-color:#fff;width:100%;border-radius:12px}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
|
|
4
|
+
|
|
5
|
+
const EzModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.ezCloseModal = createEvent(this, "ezCloseModal", 7);
|
|
11
|
+
/**
|
|
12
|
+
* Controle de exibição do Modal
|
|
13
|
+
*/
|
|
14
|
+
this.opened = true;
|
|
15
|
+
/**
|
|
16
|
+
* Define se o modal será fechado ao clicar ESC
|
|
17
|
+
*/
|
|
18
|
+
this.closeEsc = false;
|
|
19
|
+
/**
|
|
20
|
+
* Define se o modal será fechado ao clicar fora do conteúdo.
|
|
21
|
+
*/
|
|
22
|
+
this.closeOutsideClick = false;
|
|
23
|
+
this.handleKeyboardEvent = (ev) => {
|
|
24
|
+
if ((ev === null || ev === void 0 ? void 0 : ev.key) === "Escape" && this.closeEsc) {
|
|
25
|
+
this.closeModal();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
handleopenedChange() {
|
|
30
|
+
if (this.opened) {
|
|
31
|
+
document.addEventListener("keydown", this.handleKeyboardEvent);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
document.removeEventListener("keydown", this.handleKeyboardEvent);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
closeModal() {
|
|
38
|
+
this.opened = false;
|
|
39
|
+
this.ezCloseModal.emit(this.opened);
|
|
40
|
+
}
|
|
41
|
+
componentDidLoad() {
|
|
42
|
+
this.handleopenedChange();
|
|
43
|
+
}
|
|
44
|
+
onMouseDownHandler(event) {
|
|
45
|
+
if (this.closeOutsideClick && event.target === this._overlay) {
|
|
46
|
+
this.closeModal();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
const positionSufix = this.align === "left" ? "left" : "right";
|
|
51
|
+
return (h(Host, null, this.opened
|
|
52
|
+
?
|
|
53
|
+
h("div", { class: "modal", onMouseDown: evt => this.onMouseDownHandler(evt) }, h("div", { class: `modal__container modal__container--${positionSufix}`, ref: ref => this._overlay = ref }, h("div", { class: `modal__content modal__content--${positionSufix} ${this.modalSize}` }, h("slot", null))))
|
|
54
|
+
:
|
|
55
|
+
undefined));
|
|
56
|
+
}
|
|
57
|
+
static get watchers() { return {
|
|
58
|
+
"opened": ["handleopenedChange"]
|
|
59
|
+
}; }
|
|
60
|
+
static get style() { return ezModalCss; }
|
|
61
|
+
}, [1, "ez-modal", {
|
|
62
|
+
"modalSize": [1, "modal-size"],
|
|
63
|
+
"align": [1],
|
|
64
|
+
"opened": [1028],
|
|
65
|
+
"closeEsc": [4, "close-esc"],
|
|
66
|
+
"closeOutsideClick": [4, "close-outside-click"]
|
|
67
|
+
}]);
|
|
68
|
+
function defineCustomElement() {
|
|
69
|
+
if (typeof customElements === "undefined") {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const components = ["ez-modal"];
|
|
73
|
+
components.forEach(tagName => { switch (tagName) {
|
|
74
|
+
case "ez-modal":
|
|
75
|
+
if (!customElements.get(tagName)) {
|
|
76
|
+
customElements.define(tagName, EzModal);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
} });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { EzModal as E, defineCustomElement as d };
|