@sankhyalabs/ezui 1.1.94 → 1.1.95

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.
Files changed (87) hide show
  1. package/dist/cjs/{CSSVarsUtils-66e86394.js → CSSVarsUtils-8fbdf2e0.js} +1 -0
  2. package/dist/cjs/StringUtils-0ba09df4.js +57 -0
  3. package/dist/cjs/ez-button_3.cjs.entry.js +578 -0
  4. package/dist/cjs/ez-calendar_14.cjs.entry.js +2625 -0
  5. package/dist/cjs/{ez-button_11.cjs.entry.js → ez-grid.cjs.entry.js} +20 -1510
  6. package/dist/cjs/ez-icon.cjs.entry.js +42 -0
  7. package/dist/cjs/ez-modal_2.cjs.entry.js +317 -0
  8. package/dist/cjs/ez-popover.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-time-input.cjs.entry.js +2 -2
  10. package/dist/cjs/ezui.cjs.js +1 -1
  11. package/dist/cjs/{index-5c8eb919.js → index-6164b259.js} +16 -16
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/collection/components/ez-check/ez-check.css +3 -3
  14. package/dist/collection/components/ez-combo-box/ez-combo-box.js +52 -3
  15. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +4 -1
  16. package/dist/collection/components/ez-form/fieldbuilder/tpl/CheckBox.tpl.js +4 -4
  17. package/dist/collection/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.js +2 -2
  18. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +2 -2
  19. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +2 -2
  20. package/dist/collection/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.js +6 -6
  21. package/dist/collection/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.js +2 -2
  22. package/dist/collection/components/ez-form/fieldbuilder/tpl/TextArea.tpl.js +2 -2
  23. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +10 -7
  24. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +3 -2
  25. package/dist/collection/components/ez-grid/ez-grid.css +8 -0
  26. package/dist/collection/components/ez-grid/ez-grid.js +3 -3
  27. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +28 -4
  28. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +6 -5
  29. package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -7
  30. package/dist/collection/components/ez-grid/subcomponents/select-box/select-box.js +12 -17
  31. package/dist/collection/components/ez-list/ez-list.js +2 -2
  32. package/dist/collection/components/ez-text-input/ez-text-input.css +2 -2
  33. package/dist/collection/components/ez-text-input/ez-text-input.js +24 -1
  34. package/dist/collection/components/test-du/test-du.js +1 -1
  35. package/dist/collection/utils/CSSVarsUtils.js +1 -0
  36. package/dist/custom-elements/index.js +79 -65
  37. package/dist/esm/{CSSVarsUtils-aeee9825.js → CSSVarsUtils-667e0016.js} +1 -0
  38. package/dist/esm/StringUtils-cbf10229.js +55 -0
  39. package/dist/esm/ez-button_3.entry.js +572 -0
  40. package/dist/esm/ez-calendar_14.entry.js +2608 -0
  41. package/dist/esm/{ez-button_11.entry.js → ez-grid.entry.js} +10 -1490
  42. package/dist/esm/ez-icon.entry.js +38 -0
  43. package/dist/esm/ez-modal_2.entry.js +312 -0
  44. package/dist/esm/ez-popover.entry.js +1 -1
  45. package/dist/esm/ez-time-input.entry.js +2 -2
  46. package/dist/esm/ezui.js +1 -1
  47. package/dist/esm/{index-4688c617.js → index-74a9c220.js} +17 -17
  48. package/dist/esm/loader.js +1 -1
  49. package/dist/ezui/ezui.esm.js +1 -1
  50. package/dist/ezui/p-0a8018c2.entry.js +1 -0
  51. package/dist/ezui/{p-4b5c4408.entry.js → p-2617733e.entry.js} +1 -1
  52. package/dist/ezui/p-2f84ba72.js +1 -0
  53. package/dist/ezui/{p-ca42d682.entry.js → p-6714a1b2.entry.js} +46 -46
  54. package/dist/ezui/p-90f6d8a0.entry.js +1 -0
  55. package/dist/ezui/p-a943d501.entry.js +1 -0
  56. package/dist/ezui/p-b139372f.entry.js +1 -0
  57. package/dist/ezui/{p-7ff8b7f7.js → p-c6762896.js} +1 -1
  58. package/dist/ezui/p-d54c157f.js +1 -0
  59. package/dist/ezui/{p-7e1d9c29.entry.js → p-ef393d36.entry.js} +1 -1
  60. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +8 -0
  61. package/dist/types/components/ez-form/ez-form.d.ts +6 -1
  62. package/dist/types/components/ez-form/fieldbuilder/tpl/ComboBox.tpl.d.ts +2 -1
  63. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +2 -1
  64. package/dist/types/components/ez-form/fieldbuilder/tpl/FileInput.tpl.d.ts +2 -1
  65. package/dist/types/components/ez-form/fieldbuilder/tpl/NumberInput.tpl.d.ts +4 -2
  66. package/dist/types/components/ez-form/fieldbuilder/tpl/SearchInput.tpl.d.ts +2 -1
  67. package/dist/types/components/ez-form/fieldbuilder/tpl/TextArea.tpl.d.ts +2 -1
  68. package/dist/types/components/ez-grid/subcomponents/select-box/select-box.d.ts +6 -4
  69. package/dist/types/components/ez-text-input/ez-text-input.d.ts +4 -0
  70. package/dist/types/components.d.ts +26 -2
  71. package/package.json +1 -1
  72. package/dist/cjs/ApplicationUtils-d1c1db56.js +0 -35
  73. package/dist/cjs/ez-calendar.cjs.entry.js +0 -224
  74. package/dist/cjs/ez-collapsible-box_7.cjs.entry.js +0 -853
  75. package/dist/cjs/ez-combo-box.cjs.entry.js +0 -254
  76. package/dist/cjs/ez-form.cjs.entry.js +0 -753
  77. package/dist/esm/ApplicationUtils-01280a9d.js +0 -33
  78. package/dist/esm/ez-calendar.entry.js +0 -220
  79. package/dist/esm/ez-collapsible-box_7.entry.js +0 -843
  80. package/dist/esm/ez-combo-box.entry.js +0 -250
  81. package/dist/esm/ez-form.entry.js +0 -749
  82. package/dist/ezui/p-278ce681.entry.js +0 -1
  83. package/dist/ezui/p-33d1247f.entry.js +0 -1
  84. package/dist/ezui/p-5793a2e1.entry.js +0 -1
  85. package/dist/ezui/p-68f6b75e.entry.js +0 -1
  86. package/dist/ezui/p-7107d7ef.js +0 -1
  87. package/dist/ezui/p-8b099482.js +0 -1
@@ -0,0 +1,572 @@
1
+ import { r as registerInstance, h, c as createEvent, H as Host } from './index-6b8bfbeb.js';
2
+
3
+ const ezButtonCss = ":host{--ez-button--min-width:100px;--ez-button--height:42px;--ez-button__icon--width:18px;--ez-button__inline__icon--padding:12px;--ez-button--padding-top:var(--space--medium, 12px);--ez-button--padding-bottom:var(--space--medium, 12px);--ez-button--padding-right:var(--space--large, 24px);--ez-button--padding-left:var(--space--large, 24px);--ez-button--color:var(--text--primary, #FFF);--ez-button--font-size:var(--text--medium, 14px);--ez-button--font-family:var(--font-pattern, Arial);--ez-button--font-weight:var(--text-weight--large);--ez-button--background-color:var(--background--medium, #c0c0c0);--ez-button--border-radius:var(--border--radius-large, 12px);--ez-button--border:none;--ez-button--hover--background-color:var(--background--strong, var(--ez-button--background-color));--ez-button--disabled-color:var(--text--disable);--ez-button--disabled--background-color:var(--color--disable-secondary);--ez-button--focus--border:var(--ez-button--border);--ez-button--focus--box-shadow:none;--ez-button--link-color:var(--title--primary, '#C0C0C0')}ez-icon{--ez-icon--color:inherit}button{display:flex;align-items:center;justify-content:center;margin:0;cursor:pointer;transition:background-color 0.2s linear;min-width:var(--ez-button--min-width);height:var(--ez-button--height);font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);padding:var(--ez-button--padding-top) var(--ez-button--padding-right) var(--ez-button--padding-bottom) var(--ez-button--padding-left);border-radius:var(--ez-button--border-radius);background-color:var(--ez-button--background-color);color:var(--ez-button--color);fill:var(--ez-button--color);border:var(--ez-button--border)}button:hover{background-color:var(--ez-button--hover--background-color)}button:focus{outline:none;border:var(--ez-button--focus--border);box-shadow:var(--ez-button--focus--box-shadow)}button:disabled{background-color:var(--ez-button--disabled--background-color);color:var(--ez-button--disabled-color);fill:var(--ez-button--disabled-color);border:none;cursor:no-drop}button.icon{padding:0px}button.small{width:32px;min-width:32px;height:32px}button.medium{width:42px;min-width:42px;height:42px}button.large{width:52px;min-width:52px;height:52px}.label-icon{display:flex;flex-direction:column;align-items:center;color:var(--ez-button--color)}.label-icon label{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer;font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight)}a{font-family:var(--ez-button--font-family);font-size:var(--ez-button--font-size);font-weight:var(--ez-button--font-weight);color:var(--ez-button--link-color);cursor:pointer;display:flex;align-items:center;justify-content:center;}";
4
+
5
+ let EzButton = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ /**
9
+ * Deixa o botão disponível ou não para interação com o usuário.
10
+ */
11
+ this.enabled = true;
12
+ /**
13
+ * Define o modo de uso do botão; opções: icon, link e regular
14
+ */
15
+ this.mode = "regular";
16
+ /**
17
+ * Quando em modo "icon" pode-se escolher entre [small,medium,large] (somente para o modo "icon")
18
+ */
19
+ this.size = "medium";
20
+ }
21
+ getIconSize() {
22
+ return this.size;
23
+ }
24
+ handleSlotChange(ev) {
25
+ const slot = ev.target;
26
+ const content = slot.assignedElements()[0];
27
+ if (this.mode == "link") {
28
+ content.style.display = "inline";
29
+ if (slot.name == "leftIcon") {
30
+ content.style.paddingRight = "var(--ez-button__inline__icon--padding)";
31
+ }
32
+ else if (slot.name == "rightIcon") {
33
+ content.style.paddingLeft = "var(--ez-button__inline__icon--padding)";
34
+ }
35
+ }
36
+ else {
37
+ content.style.setProperty('--ez-icon--color', 'var(--ez-icon--color)');
38
+ }
39
+ }
40
+ render() {
41
+ if (this.mode == "icon") {
42
+ return (h("button", { class: "icon " + this.size, type: "button", disabled: !this.enabled }, h("ez-icon", { class: "icon", href: this.image, iconName: this.iconName, size: this.getIconSize(), onClick: evt => {
43
+ if (!this.enabled)
44
+ evt.stopPropagation();
45
+ } })));
46
+ }
47
+ else if (this.mode == "label-icon") {
48
+ return (h("div", { class: "label-icon" }, h("button", { class: "icon", type: "button", disabled: !this.enabled }, h("ez-icon", { class: "icon", href: this.image, iconName: this.iconName, size: "large", onClick: evt => {
49
+ if (!this.enabled)
50
+ evt.stopPropagation();
51
+ } })), h("label", { title: this.label }, this.label)));
52
+ }
53
+ else if (this.mode == "link") {
54
+ return (h("a", null, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
55
+ }
56
+ else {
57
+ return (h("button", { type: "button", disabled: !this.enabled }, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
58
+ }
59
+ }
60
+ };
61
+ EzButton.style = ezButtonCss;
62
+
63
+ 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}";
64
+
65
+ let EzList = class {
66
+ constructor(hostRef) {
67
+ registerInstance(this, hostRef);
68
+ this.ezChange = createEvent(this, "ezChange", 7);
69
+ this._listItems = [];
70
+ this._listGroupItems = [];
71
+ this._listItemsHistory = [];
72
+ /**
73
+ * Define a lista inicial do componente.
74
+ */
75
+ this.dataSource = [];
76
+ /**
77
+ * Define se o componente renderizará os itens separados em grupos..
78
+ */
79
+ this.useGroups = false;
80
+ /**
81
+ * Define se o componente terá o comportamento de arrasto de linhas.
82
+ */
83
+ this.ezDraggable = false;
84
+ /**
85
+ * Define se os items da lista serão selecionáveis.
86
+ */
87
+ this.ezSelectable = false;
88
+ }
89
+ createList() {
90
+ if (this.useGroups) {
91
+ let list = [...this.dataSource];
92
+ list.forEach(itemGroup => {
93
+ this.sortGroup(itemGroup);
94
+ });
95
+ this._listGroupItems = list;
96
+ }
97
+ else {
98
+ this._listItems = this._listItemsHistory.length > 0 ? this._listItemsHistory : [...this.dataSource];
99
+ }
100
+ }
101
+ sortGroup(itemGroup) {
102
+ if (itemGroup.sort) {
103
+ itemGroup.items.sort(function (a, b) {
104
+ return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
105
+ });
106
+ if (itemGroup.sort === "DSC") {
107
+ itemGroup.items.reverse();
108
+ }
109
+ }
110
+ }
111
+ /**
112
+ * 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).
113
+ */
114
+ async setSelection(selectedItem, scrollToOption) {
115
+ if (selectedItem && this.ezSelectable) {
116
+ if (this.useGroups) {
117
+ let newList = [...this._listGroupItems];
118
+ newList.forEach(groupItem => {
119
+ groupItem.items.forEach(item => {
120
+ if (item.label == selectedItem.label) {
121
+ item.selected = true;
122
+ }
123
+ else {
124
+ item.selected = false;
125
+ }
126
+ });
127
+ });
128
+ this._listGroupItems = newList;
129
+ }
130
+ else {
131
+ let newList = [...this._listItems];
132
+ newList.forEach(item => {
133
+ if (item.label === selectedItem.label) {
134
+ item.selected = true;
135
+ }
136
+ else {
137
+ item.selected = false;
138
+ }
139
+ });
140
+ this._listItems = newList;
141
+ }
142
+ if (scrollToOption) {
143
+ let liElem = this.useGroups ?
144
+ this._groupContainer.querySelector('li#item_' + this.getItemId(selectedItem.label))
145
+ : this._itemContainer.querySelector('li#item_' + this.getItemId(selectedItem.label));
146
+ if (liElem) {
147
+ liElem.scrollIntoView();
148
+ }
149
+ }
150
+ }
151
+ else {
152
+ this.removeSelection();
153
+ }
154
+ }
155
+ removeSelection() {
156
+ if (this.useGroups) {
157
+ let newList = [...this._listGroupItems];
158
+ newList.forEach(groupItem => {
159
+ groupItem.items.forEach(item => {
160
+ item.selected = false;
161
+ });
162
+ });
163
+ this._listGroupItems = newList;
164
+ }
165
+ else {
166
+ let newList = [...this._listItems];
167
+ newList.forEach(item => {
168
+ item.selected = false;
169
+ });
170
+ this._listItems = newList;
171
+ }
172
+ }
173
+ /**
174
+ * Retorna o item selecionado.
175
+ */
176
+ async getSelection() {
177
+ let selectedItem;
178
+ if (this.useGroups) {
179
+ this._listGroupItems.every(group => {
180
+ let item = group.items.find((item) => item.selected == true);
181
+ if (item) {
182
+ selectedItem = item;
183
+ return false;
184
+ }
185
+ return true;
186
+ });
187
+ }
188
+ else {
189
+ selectedItem = this._listItems.find((item) => item.selected == true);
190
+ }
191
+ return selectedItem;
192
+ }
193
+ /**
194
+ * Retorna a lista de items conforme o modo de uso.
195
+ */
196
+ async getList() {
197
+ if (this.useGroups) {
198
+ return this._listGroupItems;
199
+ }
200
+ return this._listItems;
201
+ }
202
+ componentWillLoad() {
203
+ this._listItemsHistory = [];
204
+ }
205
+ componentWillRender() {
206
+ this.createList();
207
+ }
208
+ onDrop(ev, dragEndItem) {
209
+ this.removeOverClass();
210
+ this.setSelection(undefined);
211
+ if (this._dragStartItem) {
212
+ if (this.useGroups) {
213
+ let newList = [...this._listGroupItems];
214
+ let groupEnd = this._listGroupItems.find(group => dragEndItem.groupName == group.group);
215
+ //Remove item arrastado
216
+ newList.find(group => group.group == this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
217
+ //Adiciona item arrastado
218
+ if (groupEnd.sort) {
219
+ newList.find(group => group.group == dragEndItem.groupName).items.push(this._dragStartItem.item);
220
+ newList.find(group => group.group == dragEndItem.groupName).items.sort(function (a, b) {
221
+ return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
222
+ });
223
+ if (groupEnd.sort === "DSC") {
224
+ newList.find(group => group.group == dragEndItem.groupName).items.reverse();
225
+ }
226
+ }
227
+ else {
228
+ let indexForAdd = (dragEndItem.index > this._dragStartItem.index) ? dragEndItem.index - 1 : dragEndItem.index;
229
+ newList.find(group => group.group == dragEndItem.groupName).items.splice(indexForAdd, 0, this._dragStartItem.item);
230
+ }
231
+ this._listGroupItems = newList;
232
+ this.ezChange.emit(this._listGroupItems);
233
+ }
234
+ else {
235
+ let newList = [...this._listItems];
236
+ newList.splice(this._dragStartItem.index, 1);
237
+ newList.splice(dragEndItem.index, 0, this._dragStartItem.item);
238
+ this._listItems = newList;
239
+ this._listItemsHistory = newList;
240
+ this.ezChange.emit(this._listItems);
241
+ }
242
+ }
243
+ ev.stopPropagation();
244
+ }
245
+ onDropLastIndex(ev, groupDropped) {
246
+ this.removeOverClass();
247
+ this.setSelection(undefined);
248
+ if (this._dragStartItem) {
249
+ if (this.useGroups) {
250
+ let newList = [...this._listGroupItems];
251
+ let groupEnd = this._listGroupItems.find(group => groupDropped.group == group.group);
252
+ //Remove item arrastado
253
+ newList.find(group => group.group == this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
254
+ //Adiciona item arrastado
255
+ newList.find(group => group.group == groupDropped.group).items.push(this._dragStartItem.item);
256
+ if (groupEnd.sort) {
257
+ newList.find(group => group.group == groupDropped.group).items.sort(function (a, b) {
258
+ return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
259
+ });
260
+ if (groupEnd.sort === "DSC") {
261
+ newList.find(group => group.group == groupDropped.group).items.reverse();
262
+ }
263
+ }
264
+ this._listGroupItems = newList;
265
+ this.ezChange.emit(this._listGroupItems);
266
+ }
267
+ else {
268
+ let newList = [...this._listItems];
269
+ newList.splice(this._dragStartItem.index, 1);
270
+ newList.push(this._dragStartItem.item);
271
+ this._listItems = newList;
272
+ this._listItemsHistory = newList;
273
+ this.ezChange.emit(this._listItems);
274
+ }
275
+ }
276
+ ev.stopPropagation();
277
+ }
278
+ onDropGroup(groupSelected) {
279
+ var _a;
280
+ let newList = [...this._listGroupItems];
281
+ this.setSelection(undefined);
282
+ let newGroup = newList.find(group => group.group === groupSelected.group);
283
+ if (newGroup) {
284
+ if (((_a = newGroup.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
285
+ let newItem;
286
+ newGroup.items.forEach((item, index) => {
287
+ if (item.label === this._dragStartItem.item.label) {
288
+ newItem = { item: item, index: index };
289
+ }
290
+ });
291
+ if (newItem) {
292
+ newGroup.items.splice(newItem.index, 1);
293
+ newGroup.items.unshift(newItem.item);
294
+ this.sortGroup(newGroup);
295
+ }
296
+ else {
297
+ newGroup.items.unshift(this._dragStartItem.item);
298
+ this.sortGroup(newGroup);
299
+ newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
300
+ }
301
+ }
302
+ else {
303
+ newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
304
+ newGroup.items = [this._dragStartItem.item];
305
+ }
306
+ this._listGroupItems = newList;
307
+ }
308
+ }
309
+ onDragEnd() {
310
+ this._dragStartItem = undefined;
311
+ if (this.useGroups) {
312
+ this.hideOverlays();
313
+ }
314
+ if (this._draggingElement) {
315
+ try {
316
+ this._element.shadowRoot.removeChild(this._draggingElement);
317
+ }
318
+ catch (err) { }
319
+ this._draggingElement = undefined;
320
+ }
321
+ }
322
+ addOverClass(element) {
323
+ if ((element === null || element === void 0 ? void 0 : element.__proto__) == HTMLDivElement.prototype && element.classList.contains("draggable")) {
324
+ element.classList.add('over');
325
+ }
326
+ else if ((element === null || element === void 0 ? void 0 : element.parentElement) && !element.parentElement.classList.contains("draggable-list")) {
327
+ this.addOverClass(element.parentElement);
328
+ }
329
+ }
330
+ addOverGroupClass(ev, group) {
331
+ if (ev.target) {
332
+ let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
333
+ let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
334
+ if (group.items.length > 0) {
335
+ groupOverlay.setAttribute("style", "display:grid");
336
+ }
337
+ else {
338
+ groupOverlay.classList.add("presetedHeight");
339
+ groupOverlay.setAttribute("style", "display:grid");
340
+ groupOverlay.scrollIntoView(false);
341
+ }
342
+ }
343
+ }
344
+ removeOverClass() {
345
+ var _a, _b;
346
+ let overCollection;
347
+ let overLastDroppableCollection;
348
+ if (this.useGroups) {
349
+ overCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName('over');
350
+ overLastDroppableCollection = this._groupContainer.getElementsByClassName('last-droppable-space');
351
+ }
352
+ else {
353
+ overCollection = (_b = this._itemContainer) === null || _b === void 0 ? void 0 : _b.getElementsByClassName('over');
354
+ overLastDroppableCollection = this._itemContainer.getElementsByClassName('last-droppable-space');
355
+ }
356
+ if (overCollection) {
357
+ Array.from(overCollection).forEach(function (element) {
358
+ element.classList.remove('over');
359
+ });
360
+ }
361
+ if (overLastDroppableCollection) {
362
+ Array.from(overLastDroppableCollection).forEach(function (element) {
363
+ element.classList.remove('over');
364
+ });
365
+ }
366
+ }
367
+ removeOverGroupClass(ev, group) {
368
+ if (ev.target) {
369
+ let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
370
+ let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
371
+ if (groupOverlay) {
372
+ groupOverlay.classList.remove("presetedHeight");
373
+ groupOverlay.setAttribute("style", "display:none");
374
+ }
375
+ }
376
+ }
377
+ onDragStart(item, group, index) {
378
+ if (this._changeDeboucingTimeout) {
379
+ window.clearTimeout(this._changeDeboucingTimeout);
380
+ }
381
+ if (this.useGroups) {
382
+ this._dragStartItem = { groupName: group.group, item: item, index: index };
383
+ this._changeDeboucingTimeout = window.setTimeout(() => {
384
+ this.showOverlays(group);
385
+ }, 10);
386
+ }
387
+ else {
388
+ this._dragStartItem = { item: item.item, index: item.index };
389
+ }
390
+ }
391
+ selectFirstItem() {
392
+ if (this.useGroups) {
393
+ this.setSelection(this._listGroupItems[0].items[0]);
394
+ }
395
+ {
396
+ this.setSelection(this._listItems[0]);
397
+ }
398
+ }
399
+ nextOption(selectedItem) {
400
+ let nextItem = undefined;
401
+ if (this.useGroups) {
402
+ this._listGroupItems.every((group, groupIndex, listGroupItems) => {
403
+ let item = undefined;
404
+ let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
405
+ if (itemIndex != undefined && itemIndex != -1) {
406
+ if (itemIndex === group.items.length - 1) {
407
+ if (groupIndex + 1 <= listGroupItems.length - 1) {
408
+ item = { label: listGroupItems[groupIndex + 1].items[0].label };
409
+ }
410
+ }
411
+ else {
412
+ item = { label: group.items[itemIndex + 1].label };
413
+ }
414
+ }
415
+ if (item != undefined) {
416
+ nextItem = item;
417
+ return false;
418
+ }
419
+ return true;
420
+ });
421
+ }
422
+ else {
423
+ let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
424
+ if (itemIndex >= 0 && itemIndex < this._listItems.length) {
425
+ nextItem = this._listItems[itemIndex + 1];
426
+ }
427
+ }
428
+ this.setSelection(nextItem, true);
429
+ }
430
+ previousOption(selectedItem) {
431
+ let previousItem = undefined;
432
+ if (this.useGroups) {
433
+ this._listGroupItems.every((group, groupIndex, listGroupItems) => {
434
+ let item = undefined;
435
+ let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
436
+ if (itemIndex != undefined && itemIndex != -1) {
437
+ if (itemIndex === 0) {
438
+ if ((groupIndex - 1 >= 0)) {
439
+ item = { label: listGroupItems[groupIndex - 1].items[listGroupItems[groupIndex - 1].items.length - 1].label };
440
+ }
441
+ }
442
+ else {
443
+ item = { label: group.items[itemIndex - 1].label };
444
+ }
445
+ }
446
+ if (item != undefined) {
447
+ previousItem = item;
448
+ return false;
449
+ }
450
+ return true;
451
+ });
452
+ }
453
+ else {
454
+ let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
455
+ if (itemIndex > 0 && itemIndex < this._listItems.length) {
456
+ previousItem = this._listItems[itemIndex - 1];
457
+ }
458
+ }
459
+ this.setSelection(previousItem, true);
460
+ }
461
+ keyDownHandler(event) {
462
+ event.preventDefault();
463
+ this.getSelection().then(selectedItem => {
464
+ if (selectedItem) {
465
+ switch (event.key) {
466
+ case "ArrowDown":
467
+ this.nextOption(selectedItem);
468
+ break;
469
+ case "ArrowUp":
470
+ this.previousOption(selectedItem);
471
+ break;
472
+ }
473
+ }
474
+ else {
475
+ this.selectFirstItem();
476
+ }
477
+ });
478
+ event.stopPropagation();
479
+ }
480
+ getItemId(itemLabel) {
481
+ if (itemLabel) {
482
+ return itemLabel.replace(/[^a-z0-9_]/gi, "_");
483
+ }
484
+ return undefined;
485
+ }
486
+ getDivGroupId(groupName) {
487
+ if (groupName) {
488
+ return "group-" + groupName.replace(/[^a-z0-9_]/gi, "_");
489
+ }
490
+ return undefined;
491
+ }
492
+ getGroupOverlayId(groupName) {
493
+ if (groupName) {
494
+ return "group-overlay-" + groupName.replace(/[^a-z0-9_]/gi, "_");
495
+ }
496
+ return undefined;
497
+ }
498
+ onDragOverGroup(event, group) {
499
+ if (this._dragStartItem && this._dragStartItem.groupName !== group.group && group.sort) {
500
+ event.preventDefault();
501
+ this.addOverGroupClass(event, group);
502
+ }
503
+ }
504
+ onDragOverItem(event) {
505
+ if (this._dragStartItem) {
506
+ event.preventDefault();
507
+ this.addOverClass(event.target);
508
+ event.stopPropagation();
509
+ }
510
+ }
511
+ onDragOverLastIndex(ev) {
512
+ ev.preventDefault();
513
+ if (this._dragStartItem) {
514
+ ev.target.classList.add('over');
515
+ ev.stopPropagation();
516
+ }
517
+ }
518
+ showOverlays(groupDragStart) {
519
+ let groupOverlayCollection = this._groupContainer.getElementsByClassName("group-overlay");
520
+ Array.from(groupOverlayCollection).forEach(groupOverlay => {
521
+ let groupOverlayID = this.getGroupOverlayId(groupDragStart.group);
522
+ if (groupOverlayID && groupOverlay.getAttribute("id") && groupOverlayID != groupOverlay.getAttribute("id")) {
523
+ groupOverlay.classList.add("presetedHeight");
524
+ groupOverlay.setAttribute("style", "display:grid");
525
+ }
526
+ });
527
+ }
528
+ hideOverlays() {
529
+ var _a;
530
+ let groupOverlayCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName("group-overlay");
531
+ Array.from(groupOverlayCollection).forEach(groupOverlay => {
532
+ groupOverlay.classList.remove("presetedHeight");
533
+ groupOverlay.setAttribute("style", "display:none");
534
+ });
535
+ }
536
+ render() {
537
+ return (h(Host, { ref: (el) => this._element = el }, this.useGroups ?
538
+ h("div", { class: "group-container", ref: (el) => this._groupContainer = el, tabIndex: 0, onKeyDown: (event) => { this.keyDownHandler(event); } }, this._listGroupItems.map(group => {
539
+ 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) => {
540
+ 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 ?
541
+ h("div", { class: "slot-item" }, this.itemSlotBuilder(item, group))
542
+ : undefined));
543
+ })), 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 ?
544
+ h("div", { id: this.getGroupOverlayId(group.group), class: "group-overlay" }, "Mover para ", group.group)
545
+ : undefined));
546
+ }))
547
+ :
548
+ 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) => {
549
+ 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 ?
550
+ h("div", null, this.itemSlotBuilder(item))
551
+ : undefined));
552
+ }), h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: (event) => { this.onDragOverLastIndex(event); }, onDragEnd: () => this.onDragEnd(), onDrop: (event) => this.onDropLastIndex(event) })))));
553
+ }
554
+ };
555
+ EzList.style = ezListCss;
556
+
557
+ const selectBoxCss = "ez-combo-box{width:100px}.grid-config-combo{--ez-text-input--height:28px;--ez-text-input__input--background-color:#fff;--ez-text-input__input--border-color:#dce0e8}";
558
+
559
+ let SelectBox = class {
560
+ constructor(hostRef) {
561
+ registerInstance(this, hostRef);
562
+ this.ezChange = createEvent(this, "ezChange", 7);
563
+ this.selectedOption = { value: "na", label: "N/A" };
564
+ }
565
+ render() {
566
+ return (h("ez-combo-box", { class: "grid-config-combo inverted", label: "", value: this.selectedOption, enabled: true, canShowError: false, suppressEmptyOption: true }, h("option", { value: "na" }, "N/A"), h("option", { value: "asc" }, "A-Z"), h("option", { value: "desc" }, "Z-A")));
567
+ }
568
+ static get assetsDirs() { return ["../assets"]; }
569
+ };
570
+ SelectBox.style = selectBoxCss;
571
+
572
+ export { EzButton as ez_button, EzList as ez_list, SelectBox as select_box };