@sankhyalabs/ezui 4.18.2 → 4.19.0
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/constants-3a1d64fb.js +7 -0
- package/dist/cjs/ez-check.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +2 -2
- package/dist/cjs/ez-filter-input_2.cjs.entry.js +137 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +1 -1
- package/dist/cjs/ez-grid.cjs.entry.js +373 -282
- package/dist/cjs/ez-list.cjs.entry.js +85 -72
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +181 -0
- package/dist/cjs/{ez-filter-input_4.cjs.entry.js → ez-scroller_3.cjs.entry.js} +0 -116
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +108 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/ez-check/ez-check.css +1 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +186 -119
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridUtils.js +8 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +8 -1
- package/dist/collection/components/ez-grid/ez-grid.css +14 -4
- package/dist/collection/components/ez-grid/ez-grid.js +49 -20
- package/dist/collection/components/ez-grid/subcomponents/filter-column.css +34 -0
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +297 -0
- package/dist/collection/components/ez-list/ez-list.css +0 -1
- package/dist/collection/components/ez-list/ez-list.js +88 -77
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.css +36 -0
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +318 -0
- package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.js +1 -0
- package/dist/collection/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.js +1 -0
- package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.css +18 -0
- package/dist/collection/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.js +41 -0
- package/dist/collection/utils/constants.js +1 -0
- package/dist/custom-elements/index.d.ts +18 -0
- package/dist/custom-elements/index.js +761 -362
- package/dist/esm/constants-6dab64f7.js +4 -0
- package/dist/esm/ez-check.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +2 -2
- package/dist/esm/ez-filter-input_2.entry.js +132 -0
- package/dist/esm/ez-form-view.entry.js +1 -1
- package/dist/esm/ez-grid.entry.js +373 -282
- package/dist/esm/ez-list.entry.js +85 -72
- package/dist/esm/ez-multi-selection-list.entry.js +177 -0
- package/dist/esm/{ez-filter-input_4.entry.js → ez-scroller_3.entry.js} +3 -118
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +104 -0
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-06b3c6cd.entry.js +1 -0
- package/dist/ezui/{p-967758ac.entry.js → p-0dc118f3.entry.js} +1 -1
- package/dist/ezui/p-27a01a26.js +1 -0
- package/dist/ezui/p-353be5eb.entry.js +1 -0
- package/dist/ezui/p-3e25ecbc.entry.js +1 -0
- package/dist/ezui/{p-b945133d.entry.js → p-4186ca4f.entry.js} +1 -1
- package/dist/ezui/{p-b2056805.entry.js → p-5c0ac5ba.entry.js} +1 -1
- package/dist/ezui/{p-9334e296.entry.js → p-b7dd1382.entry.js} +2 -2
- package/dist/ezui/p-c72a799e.entry.js +1 -0
- package/dist/ezui/p-e04e9dbd.entry.js +1 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +5 -1
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +14 -5
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridUtils.d.ts +1 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +9 -7
- package/dist/types/components/ez-grid/ez-grid.d.ts +14 -4
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +45 -0
- package/dist/types/components/ez-list/ez-list.d.ts +5 -5
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +64 -0
- package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionListDataSource.d.ts +4 -0
- package/dist/types/components/ez-multi-selection-list/interfaces/IMultiSelectionOption.d.ts +4 -0
- package/dist/types/components/ez-multi-selection-list/subcomponents/multi-selection-box-message.d.ts +4 -0
- package/dist/types/components.d.ts +117 -1
- package/dist/types/utils/constants.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +3 -0
- package/react/components.js +3 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/constants-5a75e2f3.js +0 -5
- package/dist/esm/constants-ca136201.js +0 -3
- package/dist/ezui/p-3f4ae3a3.js +0 -1
- package/dist/ezui/p-4ebb1d15.entry.js +0 -1
- package/dist/ezui/p-afea6e50.entry.js +0 -1
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-7854a33d.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
|
|
8
|
-
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, \"Roboto\");--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-color:var(--color--primary-300, #E2F4EF);--ez-list__group--font-family:var(--font-pattern, \"Roboto\");--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, \"Roboto\");--ez-list__group-overlay--font-size:var(--text--medium, 14px);--ez-list__over--border--color:var(--color--primary, #008561);--ez-list__last-droppable-space--height:var(--space--small, 6px);--ez-list__draggable-list--padding-bottom:var(--space--small, 6px);--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>');--ez-list__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-list__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-list__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-list__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-list__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-list__scrollbar--width:var(--space--medium, 12px);max-height:100%;width:100%;background-color:#fff;display:flex;z-index:var(--ez-list__host--z-index)}p{margin:0}.draggable{width:100%;display:grid;grid-template-columns:minmax(0px, auto) minmax(0px, auto);place-items:center;border-top:1px dashed #fff;justify-content:space-between;font-family:var(--ez-list__item--font-family);font-size:var(--ez-list__item--font-size)}.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}.hover-feedback:hover{background-color:var(--background--medium);border-radius:var(--border--radius-regular)}.item-content{display:flex;overflow:hidden;justify-content:flex-start;align-items:center;width:100%}.draggable-list{padding:0;margin:0;width:100%;max-height:100%;scrollbar-width:thin;color:var(--text-color);scrollbar-color:var(--ez-list__scrollbar--color-clicked) var(--ez-list__scrollbar--color-background)}.draggable-list li{display:flex;height:32px;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)}.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{background-color:var(--ez-list__scrollbar--color-background);width:var(--ez-list__scrollbar--width);max-width:var(--ez-list__scrollbar--width);min-width:var(--ez-list__scrollbar--width)}.draggable-list::-webkit-scrollbar-track{background-color:var(--ez-list__scrollbar--color-background);border-radius:var(--ez-list__scrollbar--border-radius)}.draggable-list::-webkit-scrollbar-thumb{background-color:var(--ez-list__scrollbar--color-default);border-radius:var(--ez-list__scrollbar--border-radius)}.draggable-list::-webkit-scrollbar-thumb:vertical:hover,.draggable-list::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-list__scrollbar--color-hover)}.draggable-list::-webkit-scrollbar-thumb:vertical:active,.draggable-list::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-list__scrollbar--color-clicked)}.draggable-icon{align-items:flex-start;display:flex;outline:none;border:none;background-color:unset}.draggable-icon::after{content:'';display:flex;width:18px;height:18px;background-color:var(--ez-list__icon--color);-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%;scrollbar-width:thin;scrollbar-color:var(--ez-list__scrollbar--color-clicked) var(--ez-list__scrollbar--color-background)}.group-name{-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--title--primary);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)}.group{display:flex;flex-direction:column}.group-container::-webkit-scrollbar{background-color:var(--ez-list__scrollbar--color-background);width:var(--ez-list__scrollbar--width);max-width:var(--ez-list__scrollbar--width);min-width:var(--ez-list__scrollbar--width)}.group-container::-webkit-scrollbar-track{background-color:var(--ez-list__scrollbar--color-background);border-radius:var(--ez-list__scrollbar--border-radius)}.group-container::-webkit-scrollbar-thumb{background-color:var(--ez-list__scrollbar--color-default);border-radius:var(--ez-list__scrollbar--border-radius)}.group-container::-webkit-scrollbar-thumb:vertical:hover,.group-container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-list__scrollbar--color-hover)}.group-container::-webkit-scrollbar-thumb:vertical:active,.group-container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-list__scrollbar--color-clicked)}.section-container{display:flex;position:relative;height:100%}.items-container{width:100%;max-height:100%;
|
|
8
|
+
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, \"Roboto\");--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-color:var(--color--primary-300, #E2F4EF);--ez-list__group--font-family:var(--font-pattern, \"Roboto\");--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, \"Roboto\");--ez-list__group-overlay--font-size:var(--text--medium, 14px);--ez-list__over--border--color:var(--color--primary, #008561);--ez-list__last-droppable-space--height:var(--space--small, 6px);--ez-list__draggable-list--padding-bottom:var(--space--small, 6px);--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>');--ez-list__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-list__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-list__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-list__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-list__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-list__scrollbar--width:var(--space--medium, 12px);max-height:100%;width:100%;background-color:#fff;display:flex;z-index:var(--ez-list__host--z-index)}p{margin:0}.draggable{width:100%;display:grid;grid-template-columns:minmax(0px, auto) minmax(0px, auto);place-items:center;border-top:1px dashed #fff;justify-content:space-between;font-family:var(--ez-list__item--font-family);font-size:var(--ez-list__item--font-size)}.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}.hover-feedback:hover{background-color:var(--background--medium);border-radius:var(--border--radius-regular)}.item-content{display:flex;overflow:hidden;justify-content:flex-start;align-items:center;width:100%}.draggable-list{padding:0;margin:0;width:100%;max-height:100%;scrollbar-width:thin;color:var(--text-color);scrollbar-color:var(--ez-list__scrollbar--color-clicked) var(--ez-list__scrollbar--color-background)}.draggable-list li{display:flex;height:32px;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)}.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{background-color:var(--ez-list__scrollbar--color-background);width:var(--ez-list__scrollbar--width);max-width:var(--ez-list__scrollbar--width);min-width:var(--ez-list__scrollbar--width)}.draggable-list::-webkit-scrollbar-track{background-color:var(--ez-list__scrollbar--color-background);border-radius:var(--ez-list__scrollbar--border-radius)}.draggable-list::-webkit-scrollbar-thumb{background-color:var(--ez-list__scrollbar--color-default);border-radius:var(--ez-list__scrollbar--border-radius)}.draggable-list::-webkit-scrollbar-thumb:vertical:hover,.draggable-list::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-list__scrollbar--color-hover)}.draggable-list::-webkit-scrollbar-thumb:vertical:active,.draggable-list::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-list__scrollbar--color-clicked)}.draggable-icon{align-items:flex-start;display:flex;outline:none;border:none;background-color:unset}.draggable-icon::after{content:'';display:flex;width:18px;height:18px;background-color:var(--ez-list__icon--color);-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%;scrollbar-width:thin;scrollbar-color:var(--ez-list__scrollbar--color-clicked) var(--ez-list__scrollbar--color-background)}.group-name{-webkit-user-select:none;-moz-user-select:-moz-none;-ms-user-select:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--title--primary);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)}.group{display:flex;flex-direction:column}.group-container::-webkit-scrollbar{background-color:var(--ez-list__scrollbar--color-background);width:var(--ez-list__scrollbar--width);max-width:var(--ez-list__scrollbar--width);min-width:var(--ez-list__scrollbar--width)}.group-container::-webkit-scrollbar-track{background-color:var(--ez-list__scrollbar--color-background);border-radius:var(--ez-list__scrollbar--border-radius)}.group-container::-webkit-scrollbar-thumb{background-color:var(--ez-list__scrollbar--color-default);border-radius:var(--ez-list__scrollbar--border-radius)}.group-container::-webkit-scrollbar-thumb:vertical:hover,.group-container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-list__scrollbar--color-hover)}.group-container::-webkit-scrollbar-thumb:vertical:active,.group-container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-list__scrollbar--color-clicked)}.section-container{display:flex;position:relative;height:100%}.items-container{width:100%;max-height:100%;outline:none;scrollbar-width:thin;scrollbar-color:var(--ez-list__scrollbar--color-clicked) var(--ez-list__scrollbar--color-background)}.group-items-container{width:100%;max-height:100%;height:100%;outline:none}.items-container::-webkit-scrollbar{background-color:var(--ez-list__scrollbar--color-background);width:var(--ez-list__scrollbar--width);max-width:var(--ez-list__scrollbar--width);min-width:var(--ez-list__scrollbar--width)}.items-container::-webkit-scrollbar-track{background-color:var(--ez-list__scrollbar--color-background);border-radius:var(--ez-list__scrollbar--border-radius)}.items-container::-webkit-scrollbar-thumb{background-color:var(--ez-list__scrollbar--color-default);border-radius:var(--ez-list__scrollbar--border-radius)}.items-container::-webkit-scrollbar-thumb:vertical:hover,.items-container::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-list__scrollbar--color-hover)}.items-container::-webkit-scrollbar-thumb:vertical:active,.items-container::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-list__scrollbar--color-clicked)}.group-overlay{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;font-family:var(--ez-list__group-overlay--font-family);font-size:var(--ez-list__group-overlay--font-size)}.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-color);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}";
|
|
9
9
|
|
|
10
10
|
const EzList = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -17,7 +17,7 @@ const EzList = class {
|
|
|
17
17
|
this._listItems = [];
|
|
18
18
|
this._listGroupItems = [];
|
|
19
19
|
this.dataSource = [];
|
|
20
|
-
this.listMode =
|
|
20
|
+
this.listMode = 'regular';
|
|
21
21
|
this.useGroups = false;
|
|
22
22
|
this.ezDraggable = false;
|
|
23
23
|
this.ezSelectable = false;
|
|
@@ -35,10 +35,10 @@ const EzList = class {
|
|
|
35
35
|
*/
|
|
36
36
|
async scrollToTop() {
|
|
37
37
|
if (this.useGroups) {
|
|
38
|
-
this._element.shadowRoot.querySelector(
|
|
38
|
+
this._element.shadowRoot.querySelector('.group-container').scrollTop = 0;
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
this._element.shadowRoot.querySelector(
|
|
41
|
+
this._element.shadowRoot.querySelector('.items-container').scrollTop = 0;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
@@ -74,9 +74,9 @@ const EzList = class {
|
|
|
74
74
|
this._listItems = newList;
|
|
75
75
|
}
|
|
76
76
|
if (scrollToOption) {
|
|
77
|
-
let liElem = this.useGroups
|
|
78
|
-
this._groupContainer.querySelector(
|
|
79
|
-
: this._itemContainer.querySelector(
|
|
77
|
+
let liElem = this.useGroups
|
|
78
|
+
? this._groupContainer.querySelector('li#item_' + this.getItemId(selectedItem.label))
|
|
79
|
+
: this._itemContainer.querySelector('li#item_' + this.getItemId(selectedItem.label));
|
|
80
80
|
if (liElem) {
|
|
81
81
|
liElem.scrollIntoView();
|
|
82
82
|
}
|
|
@@ -93,7 +93,7 @@ const EzList = class {
|
|
|
93
93
|
let selectedItem;
|
|
94
94
|
if (this.useGroups) {
|
|
95
95
|
this._listGroupItems.every(group => {
|
|
96
|
-
let item = group.items.find(
|
|
96
|
+
let item = group.items.find(item => item.selected == true);
|
|
97
97
|
if (item) {
|
|
98
98
|
selectedItem = item;
|
|
99
99
|
return false;
|
|
@@ -102,7 +102,7 @@ const EzList = class {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
|
-
selectedItem = this._listItems.find(
|
|
105
|
+
selectedItem = this._listItems.find(item => item.selected == true);
|
|
106
106
|
}
|
|
107
107
|
return selectedItem;
|
|
108
108
|
}
|
|
@@ -132,7 +132,7 @@ const EzList = class {
|
|
|
132
132
|
itemGroup.items.sort(function (a, b) {
|
|
133
133
|
return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
|
|
134
134
|
});
|
|
135
|
-
if (itemGroup.sort ===
|
|
135
|
+
if (itemGroup.sort === 'DSC') {
|
|
136
136
|
itemGroup.items.reverse();
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -157,19 +157,19 @@ const EzList = class {
|
|
|
157
157
|
}
|
|
158
158
|
buildIdDraggableListAndSelectable() {
|
|
159
159
|
const shadow = this._element.shadowRoot;
|
|
160
|
-
const draggableList = shadow.querySelectorAll(
|
|
160
|
+
const draggableList = shadow.querySelectorAll('.draggable-list');
|
|
161
161
|
draggableList === null || draggableList === void 0 ? void 0 : draggableList.forEach((draggable, index) => {
|
|
162
162
|
var _a, _b;
|
|
163
|
-
let suffix =
|
|
163
|
+
let suffix = 'draggableList';
|
|
164
164
|
const group = (_b = (_a = this._listGroupItems) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.group;
|
|
165
165
|
if (this.useGroups && group) {
|
|
166
166
|
suffix = suffix.concat('_', group);
|
|
167
167
|
}
|
|
168
168
|
core.ElementIDUtils.addIDInfoIfNotExists(draggable, suffix);
|
|
169
169
|
});
|
|
170
|
-
const selectable = shadow.querySelectorAll(
|
|
170
|
+
const selectable = shadow.querySelectorAll('.selectable-container');
|
|
171
171
|
selectable === null || selectable === void 0 ? void 0 : selectable.forEach((item) => {
|
|
172
|
-
core.ElementIDUtils.addIDInfoIfNotExists(item,
|
|
172
|
+
core.ElementIDUtils.addIDInfoIfNotExists(item, 'selectable');
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
componentWillLoad() {
|
|
@@ -196,15 +196,17 @@ const EzList = class {
|
|
|
196
196
|
//Adiciona item arrastado
|
|
197
197
|
if (groupEnd.sort) {
|
|
198
198
|
newList.find(group => group.group == dragEndItem.groupName).items.push(this._dragStartItem.item);
|
|
199
|
-
newList
|
|
199
|
+
newList
|
|
200
|
+
.find(group => group.group == dragEndItem.groupName)
|
|
201
|
+
.items.sort(function (a, b) {
|
|
200
202
|
return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
|
|
201
203
|
});
|
|
202
|
-
if (groupEnd.sort ===
|
|
204
|
+
if (groupEnd.sort === 'DSC') {
|
|
203
205
|
newList.find(group => group.group == dragEndItem.groupName).items.reverse();
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
else {
|
|
207
|
-
let indexForAdd =
|
|
209
|
+
let indexForAdd = dragEndItem.index > this._dragStartItem.index ? dragEndItem.index - 1 : dragEndItem.index;
|
|
208
210
|
newList.find(group => group.group == dragEndItem.groupName).items.splice(indexForAdd, 0, this._dragStartItem.item);
|
|
209
211
|
}
|
|
210
212
|
this._listGroupItems = newList;
|
|
@@ -233,10 +235,12 @@ const EzList = class {
|
|
|
233
235
|
//Adiciona item arrastado
|
|
234
236
|
newList.find(group => group.group == groupDropped.group).items.push(this._dragStartItem.item);
|
|
235
237
|
if (groupEnd.sort) {
|
|
236
|
-
newList
|
|
238
|
+
newList
|
|
239
|
+
.find(group => group.group == groupDropped.group)
|
|
240
|
+
.items.sort(function (a, b) {
|
|
237
241
|
return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
|
|
238
242
|
});
|
|
239
|
-
if (groupEnd.sort ===
|
|
243
|
+
if (groupEnd.sort === 'DSC') {
|
|
240
244
|
newList.find(group => group.group == groupDropped.group).items.reverse();
|
|
241
245
|
}
|
|
242
246
|
}
|
|
@@ -299,23 +303,23 @@ const EzList = class {
|
|
|
299
303
|
}
|
|
300
304
|
}
|
|
301
305
|
addOverClass(element) {
|
|
302
|
-
if ((element === null || element === void 0 ? void 0 : element.__proto__) == HTMLDivElement.prototype && element.classList.contains(
|
|
303
|
-
element.classList.add(
|
|
306
|
+
if ((element === null || element === void 0 ? void 0 : element.__proto__) == HTMLDivElement.prototype && element.classList.contains('draggable')) {
|
|
307
|
+
element.classList.add('over');
|
|
304
308
|
}
|
|
305
|
-
else if ((element === null || element === void 0 ? void 0 : element.parentElement) && !element.parentElement.classList.contains(
|
|
309
|
+
else if ((element === null || element === void 0 ? void 0 : element.parentElement) && !element.parentElement.classList.contains('draggable-list')) {
|
|
306
310
|
this.addOverClass(element.parentElement);
|
|
307
311
|
}
|
|
308
312
|
}
|
|
309
313
|
addOverGroupClass(ev, group) {
|
|
310
314
|
if (ev.target) {
|
|
311
|
-
let groupContainer = this._groupContainer.querySelector(
|
|
312
|
-
let groupOverlay = groupContainer.getElementsByClassName(
|
|
315
|
+
let groupContainer = this._groupContainer.querySelector('div#' + this.getDivGroupId(group.group));
|
|
316
|
+
let groupOverlay = groupContainer.getElementsByClassName('group-overlay')[0];
|
|
313
317
|
if (group.items.length > 0) {
|
|
314
|
-
groupOverlay.setAttribute(
|
|
318
|
+
groupOverlay.setAttribute('style', 'display:grid');
|
|
315
319
|
}
|
|
316
320
|
else {
|
|
317
|
-
groupOverlay.classList.add(
|
|
318
|
-
groupOverlay.setAttribute(
|
|
321
|
+
groupOverlay.classList.add('presetedHeight');
|
|
322
|
+
groupOverlay.setAttribute('style', 'display:grid');
|
|
319
323
|
groupOverlay.scrollIntoView(false);
|
|
320
324
|
}
|
|
321
325
|
}
|
|
@@ -325,31 +329,31 @@ const EzList = class {
|
|
|
325
329
|
let overCollection;
|
|
326
330
|
let overLastDroppableCollection;
|
|
327
331
|
if (this.useGroups) {
|
|
328
|
-
overCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName(
|
|
329
|
-
overLastDroppableCollection = this._groupContainer.getElementsByClassName(
|
|
332
|
+
overCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName('over');
|
|
333
|
+
overLastDroppableCollection = this._groupContainer.getElementsByClassName('last-droppable-space');
|
|
330
334
|
}
|
|
331
335
|
else {
|
|
332
|
-
overCollection = (_b = this._itemContainer) === null || _b === void 0 ? void 0 : _b.getElementsByClassName(
|
|
333
|
-
overLastDroppableCollection = this._itemContainer.getElementsByClassName(
|
|
336
|
+
overCollection = (_b = this._itemContainer) === null || _b === void 0 ? void 0 : _b.getElementsByClassName('over');
|
|
337
|
+
overLastDroppableCollection = this._itemContainer.getElementsByClassName('last-droppable-space');
|
|
334
338
|
}
|
|
335
339
|
if (overCollection) {
|
|
336
340
|
Array.from(overCollection).forEach(function (element) {
|
|
337
|
-
element.classList.remove(
|
|
341
|
+
element.classList.remove('over');
|
|
338
342
|
});
|
|
339
343
|
}
|
|
340
344
|
if (overLastDroppableCollection) {
|
|
341
345
|
Array.from(overLastDroppableCollection).forEach(function (element) {
|
|
342
|
-
element.classList.remove(
|
|
346
|
+
element.classList.remove('over');
|
|
343
347
|
});
|
|
344
348
|
}
|
|
345
349
|
}
|
|
346
350
|
removeOverGroupClass(ev, group) {
|
|
347
351
|
if (ev.target) {
|
|
348
|
-
let groupContainer = this._groupContainer.querySelector(
|
|
349
|
-
let groupOverlay = groupContainer.getElementsByClassName(
|
|
352
|
+
let groupContainer = this._groupContainer.querySelector('div#' + this.getDivGroupId(group.group));
|
|
353
|
+
let groupOverlay = groupContainer.getElementsByClassName('group-overlay')[0];
|
|
350
354
|
if (groupOverlay) {
|
|
351
|
-
groupOverlay.classList.remove(
|
|
352
|
-
groupOverlay.setAttribute(
|
|
355
|
+
groupOverlay.classList.remove('presetedHeight');
|
|
356
|
+
groupOverlay.setAttribute('style', 'display:none');
|
|
353
357
|
}
|
|
354
358
|
}
|
|
355
359
|
}
|
|
@@ -414,7 +418,7 @@ const EzList = class {
|
|
|
414
418
|
let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
|
|
415
419
|
if (itemIndex != undefined && itemIndex != -1) {
|
|
416
420
|
if (itemIndex === 0) {
|
|
417
|
-
if (
|
|
421
|
+
if (groupIndex - 1 >= 0) {
|
|
418
422
|
item = { label: listGroupItems[groupIndex - 1].items[listGroupItems[groupIndex - 1].items.length - 1].label };
|
|
419
423
|
}
|
|
420
424
|
}
|
|
@@ -442,10 +446,10 @@ const EzList = class {
|
|
|
442
446
|
this.getSelection().then(selectedItem => {
|
|
443
447
|
if (selectedItem) {
|
|
444
448
|
switch (event.key) {
|
|
445
|
-
case
|
|
449
|
+
case 'ArrowDown':
|
|
446
450
|
this.nextOption(selectedItem);
|
|
447
451
|
break;
|
|
448
|
-
case
|
|
452
|
+
case 'ArrowUp':
|
|
449
453
|
this.previousOption(selectedItem);
|
|
450
454
|
break;
|
|
451
455
|
}
|
|
@@ -458,19 +462,19 @@ const EzList = class {
|
|
|
458
462
|
}
|
|
459
463
|
getItemId(itemLabel) {
|
|
460
464
|
if (itemLabel) {
|
|
461
|
-
return itemLabel.replace(/[^a-z0-9_]/gi,
|
|
465
|
+
return itemLabel.replace(/[^a-z0-9_]/gi, '_');
|
|
462
466
|
}
|
|
463
467
|
return undefined;
|
|
464
468
|
}
|
|
465
469
|
getDivGroupId(groupName) {
|
|
466
470
|
if (groupName) {
|
|
467
|
-
return
|
|
471
|
+
return 'group-' + groupName.replace(/[^a-z0-9_]/gi, '_');
|
|
468
472
|
}
|
|
469
473
|
return undefined;
|
|
470
474
|
}
|
|
471
475
|
getGroupOverlayId(groupName) {
|
|
472
476
|
if (groupName) {
|
|
473
|
-
return
|
|
477
|
+
return 'group-overlay-' + groupName.replace(/[^a-z0-9_]/gi, '_');
|
|
474
478
|
}
|
|
475
479
|
return undefined;
|
|
476
480
|
}
|
|
@@ -490,26 +494,26 @@ const EzList = class {
|
|
|
490
494
|
onDragOverLastIndex(ev) {
|
|
491
495
|
ev.preventDefault();
|
|
492
496
|
if (this._dragStartItem) {
|
|
493
|
-
ev.target.classList.add(
|
|
497
|
+
ev.target.classList.add('over');
|
|
494
498
|
ev.stopPropagation();
|
|
495
499
|
}
|
|
496
500
|
}
|
|
497
501
|
showOverlays(groupDragStart) {
|
|
498
|
-
let groupOverlayCollection = this._groupContainer.getElementsByClassName(
|
|
502
|
+
let groupOverlayCollection = this._groupContainer.getElementsByClassName('group-overlay');
|
|
499
503
|
Array.from(groupOverlayCollection).forEach(groupOverlay => {
|
|
500
504
|
let groupOverlayID = this.getGroupOverlayId(groupDragStart.group);
|
|
501
|
-
if (groupOverlayID && groupOverlay.getAttribute(
|
|
502
|
-
groupOverlay.classList.add(
|
|
503
|
-
groupOverlay.setAttribute(
|
|
505
|
+
if (groupOverlayID && groupOverlay.getAttribute('id') && groupOverlayID != groupOverlay.getAttribute('id')) {
|
|
506
|
+
groupOverlay.classList.add('presetedHeight');
|
|
507
|
+
groupOverlay.setAttribute('style', 'display:grid');
|
|
504
508
|
}
|
|
505
509
|
});
|
|
506
510
|
}
|
|
507
511
|
hideOverlays() {
|
|
508
512
|
var _a;
|
|
509
|
-
let groupOverlayCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName(
|
|
513
|
+
let groupOverlayCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName('group-overlay');
|
|
510
514
|
Array.from(groupOverlayCollection).forEach(groupOverlay => {
|
|
511
|
-
groupOverlay.classList.remove(
|
|
512
|
-
groupOverlay.setAttribute(
|
|
515
|
+
groupOverlay.classList.remove('presetedHeight');
|
|
516
|
+
groupOverlay.setAttribute('style', 'display:none');
|
|
513
517
|
});
|
|
514
518
|
}
|
|
515
519
|
getContainerItemBuilder(item, group, className) {
|
|
@@ -520,30 +524,39 @@ const EzList = class {
|
|
|
520
524
|
if (customContent == undefined) {
|
|
521
525
|
return;
|
|
522
526
|
}
|
|
523
|
-
if (typeof customContent !==
|
|
524
|
-
return
|
|
527
|
+
if (typeof customContent !== 'string') {
|
|
528
|
+
return index.h("div", { class: className }, customContent);
|
|
525
529
|
}
|
|
526
|
-
return
|
|
530
|
+
return index.h("div", { class: className, innerHTML: customContent });
|
|
527
531
|
}
|
|
528
532
|
render() {
|
|
529
|
-
return (index.h(index.Host, { ref:
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
533
|
+
return (index.h(index.Host, { ref: el => (this._element = el) }, this.useGroups ? (index.h("div", { class: "group-container", ref: el => (this._groupContainer = el), tabIndex: 0, onKeyDown: event => {
|
|
534
|
+
this.keyDownHandler(event);
|
|
535
|
+
} }, this._listGroupItems.map(group => {
|
|
536
|
+
return (index.h("div", { id: this.getDivGroupId(group.group), class: "group", key: group.group + group.items.length, onDrop: () => this.onDropGroup(group) }, index.h("label", { draggable: false, class: "group-name", title: group.group }, group.group), index.h("section", { class: "section-container", onDragOver: ev => ev.preventDefault() }, index.h("div", { class: "group-items-container" }, index.h("div", { class: "draggable-list" }, group.items.map((item, index$1) => (index.h("li", Object.assign({ id: 'item_' + this.getItemId(item.label), class: {
|
|
537
|
+
'selectable-container': this.ezSelectable,
|
|
538
|
+
'hover-feedback': this.hoverFeedback,
|
|
539
|
+
}, key: 'item_' + this.getItemId(item.label) }, {
|
|
540
|
+
[core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(`ezListItem__${core.StringUtils.replaceAccentuatedChars(item.label)}`),
|
|
541
|
+
}), index.h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onClick: () => {
|
|
542
|
+
this.setSelection(item);
|
|
543
|
+
}, onDragLeave: () => {
|
|
544
|
+
group.sort ? undefined : this.removeOverClass();
|
|
545
|
+
}, onDragEnd: () => this.onDragEnd(), onDragStart: () => this.onDragStart(item, group, index$1), onDragOver: event => {
|
|
546
|
+
group.sort ? undefined : this.onDragOverItem(event);
|
|
547
|
+
}, onDrop: event => this.onDrop(event, { groupName: group.group, item: item, index: index$1 }), draggable: this.ezDraggable }, index.h("div", { class: "item-content" }, this.ezDraggable ? index.h("span", { class: "draggable-icon" }) : undefined, this.listMode === 'regular' ? (index.h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label)) : (index.h("ez-check", { label: item.label, value: item.check, onEzChange: evt => this.ezCheckChange.emit({ id: item.id, label: item.label, check: evt.detail }) }))), this.itemSlotBuilder ? this.getContainerItemBuilder(item, group, 'slot-item') : undefined))))), index.h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: event => {
|
|
548
|
+
this.onDragOverLastIndex(event);
|
|
549
|
+
}, onDragEnd: () => this.onDragEnd(), onDrop: event => this.onDropLastIndex(event, group) })), group.sort ? (index.h("div", { id: this.getGroupOverlayId(group.group), class: "group-overlay" }, "Mover para ", group.group)) : undefined)));
|
|
550
|
+
}))) : (index.h("div", { class: "items-container", ref: el => (this._itemContainer = el), tabIndex: 0, onKeyDown: event => {
|
|
551
|
+
this.keyDownHandler(event);
|
|
552
|
+
} }, index.h("div", { class: "draggable-list" }, this._listItems.map((item, index$1) => (index.h("li", Object.assign({ id: 'item_' + this.getItemId(item.label), class: {
|
|
553
|
+
'selectable-container': this.ezSelectable,
|
|
554
|
+
'hover-feedback': this.hoverFeedback,
|
|
555
|
+
}, key: 'item_' + this.getItemId(item.label) }, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: core.ElementIDUtils.getInternalIDInfo(`ezListItem__${core.StringUtils.replaceAccentuatedChars(item.label)}`) }), index.h("div", { class: 'draggable' + (item.selected == true ? ' selected-item ' : '') + (this.ezSelectable == true ? ' selectable ' : ''), onDragStart: () => this.onDragStart({ item: item, index: index$1 }), onClick: () => {
|
|
556
|
+
this.setSelection(item);
|
|
557
|
+
}, onDragLeave: () => this.removeOverClass(), onDragOver: event => this.onDragOverItem(event), onDragEnd: () => this.onDragEnd(), onDrop: event => this.onDrop(event, { item: item, index: index$1 }), draggable: this.ezDraggable }, index.h("div", { class: "item-content" }, this.listMode === 'regular' ? (index.h(index.Fragment, null, this.ezDraggable ? index.h("span", { class: "draggable-icon" }) : undefined, index.h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label))) : (index.h(index.Fragment, null, this.ezDraggable ? index.h("span", { class: "draggable-icon" }) : undefined, index.h("ez-check", { label: item.label, value: item.check, onEzChange: evt => this.ezCheckChange.emit({ id: item.id, label: item.label, check: evt.detail }) })))), this.itemSlotBuilder ? this.getContainerItemBuilder(item) : undefined)))), index.h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: event => {
|
|
558
|
+
this.onDragOverLastIndex(event);
|
|
559
|
+
}, onDragEnd: () => this.onDragEnd(), onDrop: event => this.onDropLastIndex(event) }))))));
|
|
547
560
|
}
|
|
548
561
|
};
|
|
549
562
|
EzList.style = ezListCss;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-7854a33d.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const ezMultiSelectionListCss = ".sc-ez-multi-selection-list-h{--ez-check--outter-gap:0px;display:block;width:304px;height:322px;max-height:calc(100vh - 350px)}.multi-selection__input.sc-ez-multi-selection-list{margin-bottom:var(--space--2xs, 8px)}.multi-selection__content-options.sc-ez-multi-selection-list{position:relative;top:-12px;left:-4px}.multi-selection__select-all.sc-ez-multi-selection-list{height:var(--space--xl);margin:0 var(--space--small, 6px)}.multi-selection__list.sc-ez-multi-selection-list{height:235px;max-height:calc(100vh - 435px);overflow-y:auto;overflow-x:clip}.multi-selection__list.sc-ez-multi-selection-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
|
9
|
+
|
|
10
|
+
var ViewScenarios;
|
|
11
|
+
(function (ViewScenarios) {
|
|
12
|
+
ViewScenarios["DATASOURCE_RESULTS"] = "DATASOURCE_RESULTS";
|
|
13
|
+
ViewScenarios["DATASOURCE_RESULTS_EMPTY"] = "DATASOURCE_RESULTS_EMPTY";
|
|
14
|
+
ViewScenarios["DATASOURCE_INIT"] = "DATASOURCE_INIT";
|
|
15
|
+
ViewScenarios["OPTIONS_EMPTY"] = "OPTIONS_EMPTY";
|
|
16
|
+
ViewScenarios["OPTIONS"] = "OPTIONS";
|
|
17
|
+
})(ViewScenarios || (ViewScenarios = {}));
|
|
18
|
+
const EzMuiltiSelectionList = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
index.registerInstance(this, hostRef);
|
|
21
|
+
this.changeFilteredOptions = index.createEvent(this, "changeFilteredOptions", 7);
|
|
22
|
+
this.columnName = undefined;
|
|
23
|
+
this.dataSource = undefined;
|
|
24
|
+
this.useOptions = false;
|
|
25
|
+
this.options = undefined;
|
|
26
|
+
this.filteredOptions = undefined;
|
|
27
|
+
this.displayOptions = undefined;
|
|
28
|
+
this.viewScenario = undefined;
|
|
29
|
+
this.displayOptionToCheckAllItems = true;
|
|
30
|
+
}
|
|
31
|
+
async clearFilteredOptions() {
|
|
32
|
+
this.setInitialScenario();
|
|
33
|
+
this.filteredOptions = [];
|
|
34
|
+
if (this.searchInput) {
|
|
35
|
+
this.searchInput.value = '';
|
|
36
|
+
}
|
|
37
|
+
if (this.filterInput) {
|
|
38
|
+
this.filterInput.value = '';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
onChangeUseOptions() {
|
|
42
|
+
this.setInitialScenario();
|
|
43
|
+
}
|
|
44
|
+
onChangeOptions() {
|
|
45
|
+
if (this.options) {
|
|
46
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.options);
|
|
47
|
+
}
|
|
48
|
+
this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
|
|
49
|
+
this.setInitialScenario();
|
|
50
|
+
}
|
|
51
|
+
onChangeFilteredOptions(optionsListUpdated) {
|
|
52
|
+
this.displayOptions = this.filteredOptions;
|
|
53
|
+
this.displayOptionToCheckAllItems = this.filteredOptions.length > 1;
|
|
54
|
+
this.checkInput && this.changeCheckAllValeuFromFilteredOptions();
|
|
55
|
+
this.changeFilteredOptions.emit(optionsListUpdated);
|
|
56
|
+
}
|
|
57
|
+
componentDidRender() {
|
|
58
|
+
this.changeCheckAllValeuFromFilteredOptions();
|
|
59
|
+
}
|
|
60
|
+
ordenationByCheckStateAndAlphabetically(filteredOptions) {
|
|
61
|
+
const listWithSelectChecked = [];
|
|
62
|
+
const listWithNotSelectChecked = [];
|
|
63
|
+
filteredOptions.forEach(item => (item.check ? listWithSelectChecked.push(item) : listWithNotSelectChecked.push(item)));
|
|
64
|
+
return [...core.ArrayUtils.sortAlphabetically(listWithSelectChecked), ...core.ArrayUtils.sortAlphabetically(listWithNotSelectChecked)];
|
|
65
|
+
}
|
|
66
|
+
changeCheckAllValeuFromFilteredOptions() {
|
|
67
|
+
var _a, _b, _c, _d;
|
|
68
|
+
const selectAll = (_a = this.filteredOptions) === null || _a === void 0 ? void 0 : _a.every(item => item.check === true);
|
|
69
|
+
const notSelectAll = (_b = this.filteredOptions) === null || _b === void 0 ? void 0 : _b.every(item => item.check === false);
|
|
70
|
+
const selectIndeterminated = ((_c = this.filteredOptions) === null || _c === void 0 ? void 0 : _c.some(item => item.check === false)) && ((_d = this.filteredOptions) === null || _d === void 0 ? void 0 : _d.some(item => item.check === true)) && (!selectAll || !notSelectAll);
|
|
71
|
+
if (this.checkInput && selectAll) {
|
|
72
|
+
this.checkInput.indeterminate = false;
|
|
73
|
+
this.checkInput.value = true;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (this.checkInput && selectIndeterminated) {
|
|
77
|
+
this.checkInput.indeterminate = true;
|
|
78
|
+
this.checkInput.value = false;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (this.checkInput && notSelectAll) {
|
|
82
|
+
this.checkInput.indeterminate = false;
|
|
83
|
+
this.checkInput.value = false;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
setInitialScenario() {
|
|
88
|
+
if (this.useOptions) {
|
|
89
|
+
this.viewScenario = ViewScenarios.OPTIONS;
|
|
90
|
+
this.changeCheckAllValeuFromFilteredOptions();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.viewScenario = this.options && this.options.length > 0 ? ViewScenarios.DATASOURCE_RESULTS : ViewScenarios.DATASOURCE_INIT;
|
|
94
|
+
}
|
|
95
|
+
async searchWithDataSource(searchArgument, fieldName) {
|
|
96
|
+
const { argument, mode } = searchArgument;
|
|
97
|
+
if (mode !== 'PRELOAD') {
|
|
98
|
+
return this.dataSource.fetchData(argument, fieldName);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
handleSearchOnDataSource(event) {
|
|
102
|
+
var _a;
|
|
103
|
+
const optionsToSort = (_a = this.filteredOptions) !== null && _a !== void 0 ? _a : [];
|
|
104
|
+
if (event.detail && !optionsToSort.some(item => item.value == event.detail.value)) {
|
|
105
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([...optionsToSort, event.detail]);
|
|
106
|
+
}
|
|
107
|
+
this.viewScenario = ViewScenarios.DATASOURCE_RESULTS;
|
|
108
|
+
}
|
|
109
|
+
handleRemoveItemFromOptions(item) {
|
|
110
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter(i => i.value !== item.value));
|
|
111
|
+
if (this.filteredOptions.length === 0) {
|
|
112
|
+
this.viewScenario = ViewScenarios.DATASOURCE_INIT;
|
|
113
|
+
}
|
|
114
|
+
if (this.searchInput) {
|
|
115
|
+
this.searchInput.value = '';
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
handleSearchOnOption(event) {
|
|
119
|
+
if (event.detail) {
|
|
120
|
+
this.displayOptions = core.ArrayUtils.applyStringFilter(event.detail, this.filteredOptions, true);
|
|
121
|
+
this.viewScenario = this.displayOptions.length === 0 ? ViewScenarios.OPTIONS_EMPTY : ViewScenarios.OPTIONS;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.displayOptions = this.filteredOptions;
|
|
125
|
+
this.viewScenario = ViewScenarios.OPTIONS;
|
|
126
|
+
}
|
|
127
|
+
handleChangeSelectAllItems(event) {
|
|
128
|
+
this.filteredOptions = this.ordenationByCheckStateAndAlphabetically([
|
|
129
|
+
...this.filteredOptions.map(item => {
|
|
130
|
+
item.check = !!event.detail;
|
|
131
|
+
return item;
|
|
132
|
+
}),
|
|
133
|
+
]);
|
|
134
|
+
}
|
|
135
|
+
handleChangeSelectedItem(event) {
|
|
136
|
+
const { detail: itemCheckSelected } = event;
|
|
137
|
+
this.filteredOptions = this.filteredOptions.map(item => {
|
|
138
|
+
if (item.label === itemCheckSelected.label) {
|
|
139
|
+
return Object.assign(Object.assign({}, item), { check: itemCheckSelected.check });
|
|
140
|
+
}
|
|
141
|
+
return item;
|
|
142
|
+
});
|
|
143
|
+
this.clearInputs();
|
|
144
|
+
}
|
|
145
|
+
clearInputs() {
|
|
146
|
+
this.filterInput ? (this.filterInput.value = '') : (this.searchInput.value = '');
|
|
147
|
+
}
|
|
148
|
+
buildViewList(hasDelete) {
|
|
149
|
+
return (index.h(index.Fragment, null, this.displayOptionToCheckAllItems && (index.h("ez-check", { ref: (element) => (this.checkInput = element), label: "Selecionar todos", class: "multi-selection__select-all", onEzChange: this.handleChangeSelectAllItems.bind(this) })), index.h("ez-list", { class: "multi-selection__list", dataSource: this.displayOptions, listMode: "check", hoverFeedback: true, onEzCheckChange: this.handleChangeSelectedItem.bind(this), itemSlotBuilder: hasDelete ? this.buildDeleteIconSlot.bind(this) : null })));
|
|
150
|
+
}
|
|
151
|
+
buildDeleteIconSlot(item) {
|
|
152
|
+
return index.h("ez-icon", { style: { cursor: 'pointer' }, iconName: "delete", onClick: () => this.handleRemoveItemFromOptions(item) });
|
|
153
|
+
}
|
|
154
|
+
buildInitViewWithDataSource() {
|
|
155
|
+
return index.h("multi-selection-box-message", { message: "Selecione os valores a serem filtrados atrav\u00E9s do campo de busca." });
|
|
156
|
+
}
|
|
157
|
+
buildViewEmptyResults() {
|
|
158
|
+
return index.h("multi-selection-box-message", { message: "Nenhum resultado encontrado." });
|
|
159
|
+
}
|
|
160
|
+
scenarioToDisplay(view) {
|
|
161
|
+
const scenarios = {
|
|
162
|
+
[ViewScenarios.DATASOURCE_INIT]: this.buildInitViewWithDataSource(),
|
|
163
|
+
[ViewScenarios.DATASOURCE_RESULTS]: this.buildViewList(true),
|
|
164
|
+
[ViewScenarios.DATASOURCE_RESULTS_EMPTY]: this.buildViewEmptyResults(),
|
|
165
|
+
[ViewScenarios.OPTIONS_EMPTY]: this.buildViewEmptyResults(),
|
|
166
|
+
[ViewScenarios.OPTIONS]: this.buildViewList(false),
|
|
167
|
+
};
|
|
168
|
+
return scenarios[view];
|
|
169
|
+
}
|
|
170
|
+
render() {
|
|
171
|
+
return (index.h(index.Host, null, index.h("div", { class: "multi-selection" }, this.useOptions ? (index.h("ez-filter-input", { ref: (element) => (this.filterInput = element), label: `Buscar..`, onEzChange: this.handleSearchOnOption.bind(this) })) : (index.h("ez-search", { class: "multi-selection__input", label: `Buscar...`, ref: (element) => (this.searchInput = element), suppressEmptyOption: true, showOptionValue: false, showSelectedValue: false, optionLoader: (search) => this.searchWithDataSource(search, this.columnName), onEzChange: this.handleSearchOnDataSource.bind(this) })), index.h("ez-scroll", { class: "multi-selection__content-options" }, this.scenarioToDisplay(this.viewScenario)))));
|
|
172
|
+
}
|
|
173
|
+
static get watchers() { return {
|
|
174
|
+
"useOptions": ["onChangeUseOptions"],
|
|
175
|
+
"options": ["onChangeOptions"],
|
|
176
|
+
"filteredOptions": ["onChangeFilteredOptions"]
|
|
177
|
+
}; }
|
|
178
|
+
};
|
|
179
|
+
EzMuiltiSelectionList.style = ezMultiSelectionListCss;
|
|
180
|
+
|
|
181
|
+
exports.ez_multi_selection_list = EzMuiltiSelectionList;
|