@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
@@ -5,6 +5,7 @@ class CSSVarsUtils {
5
5
  if (child) {
6
6
  CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--background-color');
7
7
  CSSVarsUtils.applyIfExists(host, child, '--ez-text-input__input--border-color');
8
+ CSSVarsUtils.applyIfExists(host, child, '--ez-text-input--height');
8
9
  }
9
10
  }
10
11
  static applyIfExists(host, element, varName) {
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Classe com utiliários comuns para Strings.
5
+ */
6
+ class StringUtils {
7
+ /**
8
+ * Verifica se a string está vazia.
9
+ * Valores null e undefined são considerados como vazio.
10
+ *
11
+ * @param value String para ser validada.
12
+ */
13
+ static isEmpty(value) {
14
+ if (value == undefined || value === null) {
15
+ return true;
16
+ }
17
+ value = value.toString();
18
+ value = value.trim();
19
+ if (value.length === 0) {
20
+ return true;
21
+ }
22
+ return false;
23
+ }
24
+ /**
25
+ * Remove acentos de vogais, substitui Ç por c e retorna a string em caixa alta.
26
+ *
27
+ * @param value String para ser transformada.
28
+ */
29
+ static replaceAccentuatedChars(text) {
30
+ text = text.toUpperCase();
31
+ text = text.replace(/[À]/, "A");
32
+ text = text.replace(/[Á]/, "A");
33
+ text = text.replace(/[Â]/, "A");
34
+ text = text.replace(/[Ã]/, "A");
35
+ text = text.replace(/[Ä]/, "A");
36
+ text = text.replace(/[È]/, "E");
37
+ text = text.replace(/[É]/, "E");
38
+ text = text.replace(/[Ê]/, "E");
39
+ text = text.replace(/[Ë]/, "E");
40
+ text = text.replace(/[Ì]/, "I");
41
+ text = text.replace(/[Í]/, "I");
42
+ text = text.replace(/[Î]/, "I");
43
+ text = text.replace(/[Ï]/, "I");
44
+ text = text.replace(/[Ò]/, "O");
45
+ text = text.replace(/[Ó]/, "O");
46
+ text = text.replace(/[Ô]/, "O");
47
+ text = text.replace(/[Ö]/, "O");
48
+ text = text.replace(/[Ù]/, "U");
49
+ text = text.replace(/[Ú]/, "U");
50
+ text = text.replace(/[Û]/, "U");
51
+ text = text.replace(/[Ü]/, "U");
52
+ text = text.replace(/[Ç]/, "C");
53
+ return text.replace(/[^a-z0-9]/gi, '');
54
+ }
55
+ }
56
+
57
+ exports.StringUtils = StringUtils;
@@ -0,0 +1,578 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-88286449.js');
6
+
7
+ 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;}";
8
+
9
+ let EzButton = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ /**
13
+ * Deixa o botão disponível ou não para interação com o usuário.
14
+ */
15
+ this.enabled = true;
16
+ /**
17
+ * Define o modo de uso do botão; opções: icon, link e regular
18
+ */
19
+ this.mode = "regular";
20
+ /**
21
+ * Quando em modo "icon" pode-se escolher entre [small,medium,large] (somente para o modo "icon")
22
+ */
23
+ this.size = "medium";
24
+ }
25
+ getIconSize() {
26
+ return this.size;
27
+ }
28
+ handleSlotChange(ev) {
29
+ const slot = ev.target;
30
+ const content = slot.assignedElements()[0];
31
+ if (this.mode == "link") {
32
+ content.style.display = "inline";
33
+ if (slot.name == "leftIcon") {
34
+ content.style.paddingRight = "var(--ez-button__inline__icon--padding)";
35
+ }
36
+ else if (slot.name == "rightIcon") {
37
+ content.style.paddingLeft = "var(--ez-button__inline__icon--padding)";
38
+ }
39
+ }
40
+ else {
41
+ content.style.setProperty('--ez-icon--color', 'var(--ez-icon--color)');
42
+ }
43
+ }
44
+ render() {
45
+ if (this.mode == "icon") {
46
+ return (index.h("button", { class: "icon " + this.size, type: "button", disabled: !this.enabled }, index.h("ez-icon", { class: "icon", href: this.image, iconName: this.iconName, size: this.getIconSize(), onClick: evt => {
47
+ if (!this.enabled)
48
+ evt.stopPropagation();
49
+ } })));
50
+ }
51
+ else if (this.mode == "label-icon") {
52
+ return (index.h("div", { class: "label-icon" }, index.h("button", { class: "icon", type: "button", disabled: !this.enabled }, index.h("ez-icon", { class: "icon", href: this.image, iconName: this.iconName, size: "large", onClick: evt => {
53
+ if (!this.enabled)
54
+ evt.stopPropagation();
55
+ } })), index.h("label", { title: this.label }, this.label)));
56
+ }
57
+ else if (this.mode == "link") {
58
+ return (index.h("a", null, index.h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, index.h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
59
+ }
60
+ else {
61
+ return (index.h("button", { type: "button", disabled: !this.enabled }, index.h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label, index.h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
62
+ }
63
+ }
64
+ };
65
+ EzButton.style = ezButtonCss;
66
+
67
+ 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}";
68
+
69
+ let EzList = class {
70
+ constructor(hostRef) {
71
+ index.registerInstance(this, hostRef);
72
+ this.ezChange = index.createEvent(this, "ezChange", 7);
73
+ this._listItems = [];
74
+ this._listGroupItems = [];
75
+ this._listItemsHistory = [];
76
+ /**
77
+ * Define a lista inicial do componente.
78
+ */
79
+ this.dataSource = [];
80
+ /**
81
+ * Define se o componente renderizará os itens separados em grupos..
82
+ */
83
+ this.useGroups = false;
84
+ /**
85
+ * Define se o componente terá o comportamento de arrasto de linhas.
86
+ */
87
+ this.ezDraggable = false;
88
+ /**
89
+ * Define se os items da lista serão selecionáveis.
90
+ */
91
+ this.ezSelectable = false;
92
+ }
93
+ createList() {
94
+ if (this.useGroups) {
95
+ let list = [...this.dataSource];
96
+ list.forEach(itemGroup => {
97
+ this.sortGroup(itemGroup);
98
+ });
99
+ this._listGroupItems = list;
100
+ }
101
+ else {
102
+ this._listItems = this._listItemsHistory.length > 0 ? this._listItemsHistory : [...this.dataSource];
103
+ }
104
+ }
105
+ sortGroup(itemGroup) {
106
+ if (itemGroup.sort) {
107
+ itemGroup.items.sort(function (a, b) {
108
+ return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
109
+ });
110
+ if (itemGroup.sort === "DSC") {
111
+ itemGroup.items.reverse();
112
+ }
113
+ }
114
+ }
115
+ /**
116
+ * 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).
117
+ */
118
+ async setSelection(selectedItem, scrollToOption) {
119
+ if (selectedItem && this.ezSelectable) {
120
+ if (this.useGroups) {
121
+ let newList = [...this._listGroupItems];
122
+ newList.forEach(groupItem => {
123
+ groupItem.items.forEach(item => {
124
+ if (item.label == selectedItem.label) {
125
+ item.selected = true;
126
+ }
127
+ else {
128
+ item.selected = false;
129
+ }
130
+ });
131
+ });
132
+ this._listGroupItems = newList;
133
+ }
134
+ else {
135
+ let newList = [...this._listItems];
136
+ newList.forEach(item => {
137
+ if (item.label === selectedItem.label) {
138
+ item.selected = true;
139
+ }
140
+ else {
141
+ item.selected = false;
142
+ }
143
+ });
144
+ this._listItems = newList;
145
+ }
146
+ if (scrollToOption) {
147
+ let liElem = this.useGroups ?
148
+ this._groupContainer.querySelector('li#item_' + this.getItemId(selectedItem.label))
149
+ : this._itemContainer.querySelector('li#item_' + this.getItemId(selectedItem.label));
150
+ if (liElem) {
151
+ liElem.scrollIntoView();
152
+ }
153
+ }
154
+ }
155
+ else {
156
+ this.removeSelection();
157
+ }
158
+ }
159
+ removeSelection() {
160
+ if (this.useGroups) {
161
+ let newList = [...this._listGroupItems];
162
+ newList.forEach(groupItem => {
163
+ groupItem.items.forEach(item => {
164
+ item.selected = false;
165
+ });
166
+ });
167
+ this._listGroupItems = newList;
168
+ }
169
+ else {
170
+ let newList = [...this._listItems];
171
+ newList.forEach(item => {
172
+ item.selected = false;
173
+ });
174
+ this._listItems = newList;
175
+ }
176
+ }
177
+ /**
178
+ * Retorna o item selecionado.
179
+ */
180
+ async getSelection() {
181
+ let selectedItem;
182
+ if (this.useGroups) {
183
+ this._listGroupItems.every(group => {
184
+ let item = group.items.find((item) => item.selected == true);
185
+ if (item) {
186
+ selectedItem = item;
187
+ return false;
188
+ }
189
+ return true;
190
+ });
191
+ }
192
+ else {
193
+ selectedItem = this._listItems.find((item) => item.selected == true);
194
+ }
195
+ return selectedItem;
196
+ }
197
+ /**
198
+ * Retorna a lista de items conforme o modo de uso.
199
+ */
200
+ async getList() {
201
+ if (this.useGroups) {
202
+ return this._listGroupItems;
203
+ }
204
+ return this._listItems;
205
+ }
206
+ componentWillLoad() {
207
+ this._listItemsHistory = [];
208
+ }
209
+ componentWillRender() {
210
+ this.createList();
211
+ }
212
+ onDrop(ev, dragEndItem) {
213
+ this.removeOverClass();
214
+ this.setSelection(undefined);
215
+ if (this._dragStartItem) {
216
+ if (this.useGroups) {
217
+ let newList = [...this._listGroupItems];
218
+ let groupEnd = this._listGroupItems.find(group => dragEndItem.groupName == group.group);
219
+ //Remove item arrastado
220
+ newList.find(group => group.group == this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
221
+ //Adiciona item arrastado
222
+ if (groupEnd.sort) {
223
+ newList.find(group => group.group == dragEndItem.groupName).items.push(this._dragStartItem.item);
224
+ newList.find(group => group.group == dragEndItem.groupName).items.sort(function (a, b) {
225
+ return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
226
+ });
227
+ if (groupEnd.sort === "DSC") {
228
+ newList.find(group => group.group == dragEndItem.groupName).items.reverse();
229
+ }
230
+ }
231
+ else {
232
+ let indexForAdd = (dragEndItem.index > this._dragStartItem.index) ? dragEndItem.index - 1 : dragEndItem.index;
233
+ newList.find(group => group.group == dragEndItem.groupName).items.splice(indexForAdd, 0, this._dragStartItem.item);
234
+ }
235
+ this._listGroupItems = newList;
236
+ this.ezChange.emit(this._listGroupItems);
237
+ }
238
+ else {
239
+ let newList = [...this._listItems];
240
+ newList.splice(this._dragStartItem.index, 1);
241
+ newList.splice(dragEndItem.index, 0, this._dragStartItem.item);
242
+ this._listItems = newList;
243
+ this._listItemsHistory = newList;
244
+ this.ezChange.emit(this._listItems);
245
+ }
246
+ }
247
+ ev.stopPropagation();
248
+ }
249
+ onDropLastIndex(ev, groupDropped) {
250
+ this.removeOverClass();
251
+ this.setSelection(undefined);
252
+ if (this._dragStartItem) {
253
+ if (this.useGroups) {
254
+ let newList = [...this._listGroupItems];
255
+ let groupEnd = this._listGroupItems.find(group => groupDropped.group == group.group);
256
+ //Remove item arrastado
257
+ newList.find(group => group.group == this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
258
+ //Adiciona item arrastado
259
+ newList.find(group => group.group == groupDropped.group).items.push(this._dragStartItem.item);
260
+ if (groupEnd.sort) {
261
+ newList.find(group => group.group == groupDropped.group).items.sort(function (a, b) {
262
+ return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;
263
+ });
264
+ if (groupEnd.sort === "DSC") {
265
+ newList.find(group => group.group == groupDropped.group).items.reverse();
266
+ }
267
+ }
268
+ this._listGroupItems = newList;
269
+ this.ezChange.emit(this._listGroupItems);
270
+ }
271
+ else {
272
+ let newList = [...this._listItems];
273
+ newList.splice(this._dragStartItem.index, 1);
274
+ newList.push(this._dragStartItem.item);
275
+ this._listItems = newList;
276
+ this._listItemsHistory = newList;
277
+ this.ezChange.emit(this._listItems);
278
+ }
279
+ }
280
+ ev.stopPropagation();
281
+ }
282
+ onDropGroup(groupSelected) {
283
+ var _a;
284
+ let newList = [...this._listGroupItems];
285
+ this.setSelection(undefined);
286
+ let newGroup = newList.find(group => group.group === groupSelected.group);
287
+ if (newGroup) {
288
+ if (((_a = newGroup.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
289
+ let newItem;
290
+ newGroup.items.forEach((item, index) => {
291
+ if (item.label === this._dragStartItem.item.label) {
292
+ newItem = { item: item, index: index };
293
+ }
294
+ });
295
+ if (newItem) {
296
+ newGroup.items.splice(newItem.index, 1);
297
+ newGroup.items.unshift(newItem.item);
298
+ this.sortGroup(newGroup);
299
+ }
300
+ else {
301
+ newGroup.items.unshift(this._dragStartItem.item);
302
+ this.sortGroup(newGroup);
303
+ newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
304
+ }
305
+ }
306
+ else {
307
+ newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
308
+ newGroup.items = [this._dragStartItem.item];
309
+ }
310
+ this._listGroupItems = newList;
311
+ }
312
+ }
313
+ onDragEnd() {
314
+ this._dragStartItem = undefined;
315
+ if (this.useGroups) {
316
+ this.hideOverlays();
317
+ }
318
+ if (this._draggingElement) {
319
+ try {
320
+ this._element.shadowRoot.removeChild(this._draggingElement);
321
+ }
322
+ catch (err) { }
323
+ this._draggingElement = undefined;
324
+ }
325
+ }
326
+ addOverClass(element) {
327
+ if ((element === null || element === void 0 ? void 0 : element.__proto__) == HTMLDivElement.prototype && element.classList.contains("draggable")) {
328
+ element.classList.add('over');
329
+ }
330
+ else if ((element === null || element === void 0 ? void 0 : element.parentElement) && !element.parentElement.classList.contains("draggable-list")) {
331
+ this.addOverClass(element.parentElement);
332
+ }
333
+ }
334
+ addOverGroupClass(ev, group) {
335
+ if (ev.target) {
336
+ let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
337
+ let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
338
+ if (group.items.length > 0) {
339
+ groupOverlay.setAttribute("style", "display:grid");
340
+ }
341
+ else {
342
+ groupOverlay.classList.add("presetedHeight");
343
+ groupOverlay.setAttribute("style", "display:grid");
344
+ groupOverlay.scrollIntoView(false);
345
+ }
346
+ }
347
+ }
348
+ removeOverClass() {
349
+ var _a, _b;
350
+ let overCollection;
351
+ let overLastDroppableCollection;
352
+ if (this.useGroups) {
353
+ overCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName('over');
354
+ overLastDroppableCollection = this._groupContainer.getElementsByClassName('last-droppable-space');
355
+ }
356
+ else {
357
+ overCollection = (_b = this._itemContainer) === null || _b === void 0 ? void 0 : _b.getElementsByClassName('over');
358
+ overLastDroppableCollection = this._itemContainer.getElementsByClassName('last-droppable-space');
359
+ }
360
+ if (overCollection) {
361
+ Array.from(overCollection).forEach(function (element) {
362
+ element.classList.remove('over');
363
+ });
364
+ }
365
+ if (overLastDroppableCollection) {
366
+ Array.from(overLastDroppableCollection).forEach(function (element) {
367
+ element.classList.remove('over');
368
+ });
369
+ }
370
+ }
371
+ removeOverGroupClass(ev, group) {
372
+ if (ev.target) {
373
+ let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
374
+ let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
375
+ if (groupOverlay) {
376
+ groupOverlay.classList.remove("presetedHeight");
377
+ groupOverlay.setAttribute("style", "display:none");
378
+ }
379
+ }
380
+ }
381
+ onDragStart(item, group, index) {
382
+ if (this._changeDeboucingTimeout) {
383
+ window.clearTimeout(this._changeDeboucingTimeout);
384
+ }
385
+ if (this.useGroups) {
386
+ this._dragStartItem = { groupName: group.group, item: item, index: index };
387
+ this._changeDeboucingTimeout = window.setTimeout(() => {
388
+ this.showOverlays(group);
389
+ }, 10);
390
+ }
391
+ else {
392
+ this._dragStartItem = { item: item.item, index: item.index };
393
+ }
394
+ }
395
+ selectFirstItem() {
396
+ if (this.useGroups) {
397
+ this.setSelection(this._listGroupItems[0].items[0]);
398
+ }
399
+ {
400
+ this.setSelection(this._listItems[0]);
401
+ }
402
+ }
403
+ nextOption(selectedItem) {
404
+ let nextItem = undefined;
405
+ if (this.useGroups) {
406
+ this._listGroupItems.every((group, groupIndex, listGroupItems) => {
407
+ let item = undefined;
408
+ let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
409
+ if (itemIndex != undefined && itemIndex != -1) {
410
+ if (itemIndex === group.items.length - 1) {
411
+ if (groupIndex + 1 <= listGroupItems.length - 1) {
412
+ item = { label: listGroupItems[groupIndex + 1].items[0].label };
413
+ }
414
+ }
415
+ else {
416
+ item = { label: group.items[itemIndex + 1].label };
417
+ }
418
+ }
419
+ if (item != undefined) {
420
+ nextItem = item;
421
+ return false;
422
+ }
423
+ return true;
424
+ });
425
+ }
426
+ else {
427
+ let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
428
+ if (itemIndex >= 0 && itemIndex < this._listItems.length) {
429
+ nextItem = this._listItems[itemIndex + 1];
430
+ }
431
+ }
432
+ this.setSelection(nextItem, true);
433
+ }
434
+ previousOption(selectedItem) {
435
+ let previousItem = undefined;
436
+ if (this.useGroups) {
437
+ this._listGroupItems.every((group, groupIndex, listGroupItems) => {
438
+ let item = undefined;
439
+ let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
440
+ if (itemIndex != undefined && itemIndex != -1) {
441
+ if (itemIndex === 0) {
442
+ if ((groupIndex - 1 >= 0)) {
443
+ item = { label: listGroupItems[groupIndex - 1].items[listGroupItems[groupIndex - 1].items.length - 1].label };
444
+ }
445
+ }
446
+ else {
447
+ item = { label: group.items[itemIndex - 1].label };
448
+ }
449
+ }
450
+ if (item != undefined) {
451
+ previousItem = item;
452
+ return false;
453
+ }
454
+ return true;
455
+ });
456
+ }
457
+ else {
458
+ let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
459
+ if (itemIndex > 0 && itemIndex < this._listItems.length) {
460
+ previousItem = this._listItems[itemIndex - 1];
461
+ }
462
+ }
463
+ this.setSelection(previousItem, true);
464
+ }
465
+ keyDownHandler(event) {
466
+ event.preventDefault();
467
+ this.getSelection().then(selectedItem => {
468
+ if (selectedItem) {
469
+ switch (event.key) {
470
+ case "ArrowDown":
471
+ this.nextOption(selectedItem);
472
+ break;
473
+ case "ArrowUp":
474
+ this.previousOption(selectedItem);
475
+ break;
476
+ }
477
+ }
478
+ else {
479
+ this.selectFirstItem();
480
+ }
481
+ });
482
+ event.stopPropagation();
483
+ }
484
+ getItemId(itemLabel) {
485
+ if (itemLabel) {
486
+ return itemLabel.replace(/[^a-z0-9_]/gi, "_");
487
+ }
488
+ return undefined;
489
+ }
490
+ getDivGroupId(groupName) {
491
+ if (groupName) {
492
+ return "group-" + groupName.replace(/[^a-z0-9_]/gi, "_");
493
+ }
494
+ return undefined;
495
+ }
496
+ getGroupOverlayId(groupName) {
497
+ if (groupName) {
498
+ return "group-overlay-" + groupName.replace(/[^a-z0-9_]/gi, "_");
499
+ }
500
+ return undefined;
501
+ }
502
+ onDragOverGroup(event, group) {
503
+ if (this._dragStartItem && this._dragStartItem.groupName !== group.group && group.sort) {
504
+ event.preventDefault();
505
+ this.addOverGroupClass(event, group);
506
+ }
507
+ }
508
+ onDragOverItem(event) {
509
+ if (this._dragStartItem) {
510
+ event.preventDefault();
511
+ this.addOverClass(event.target);
512
+ event.stopPropagation();
513
+ }
514
+ }
515
+ onDragOverLastIndex(ev) {
516
+ ev.preventDefault();
517
+ if (this._dragStartItem) {
518
+ ev.target.classList.add('over');
519
+ ev.stopPropagation();
520
+ }
521
+ }
522
+ showOverlays(groupDragStart) {
523
+ let groupOverlayCollection = this._groupContainer.getElementsByClassName("group-overlay");
524
+ Array.from(groupOverlayCollection).forEach(groupOverlay => {
525
+ let groupOverlayID = this.getGroupOverlayId(groupDragStart.group);
526
+ if (groupOverlayID && groupOverlay.getAttribute("id") && groupOverlayID != groupOverlay.getAttribute("id")) {
527
+ groupOverlay.classList.add("presetedHeight");
528
+ groupOverlay.setAttribute("style", "display:grid");
529
+ }
530
+ });
531
+ }
532
+ hideOverlays() {
533
+ var _a;
534
+ let groupOverlayCollection = (_a = this._groupContainer) === null || _a === void 0 ? void 0 : _a.getElementsByClassName("group-overlay");
535
+ Array.from(groupOverlayCollection).forEach(groupOverlay => {
536
+ groupOverlay.classList.remove("presetedHeight");
537
+ groupOverlay.setAttribute("style", "display:none");
538
+ });
539
+ }
540
+ render() {
541
+ return (index.h(index.Host, { ref: (el) => this._element = el }, this.useGroups ?
542
+ index.h("div", { class: "group-container", ref: (el) => this._groupContainer = el, tabIndex: 0, onKeyDown: (event) => { this.keyDownHandler(event); } }, this._listGroupItems.map(group => {
543
+ 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" }, 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) => {
544
+ return index.h("li", { id: 'item_' + this.getItemId(item.label), class: this.ezSelectable ? "selectable-container" : "", key: 'item_' + this.getItemId(item.label) }, index.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$1), onDragOver: (event) => { group.sort ? undefined : this.onDragOverItem(event); }, 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, index.h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label)), this.itemSlotBuilder ?
545
+ index.h("div", { class: "slot-item" }, this.itemSlotBuilder(item, group))
546
+ : undefined));
547
+ })), index.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 ?
548
+ index.h("div", { id: this.getGroupOverlayId(group.group), class: "group-overlay" }, "Mover para ", group.group)
549
+ : undefined));
550
+ }))
551
+ :
552
+ index.h("div", { class: "items-container", ref: (el) => this._itemContainer = el, tabIndex: 0, onKeyDown: (event) => { this.keyDownHandler(event); } }, index.h("div", { class: "draggable-list" }, this._listItems.map((item, index$1) => {
553
+ return index.h("li", { id: 'item_' + this.getItemId(item.label), class: this.ezSelectable ? "selectable-container" : "", key: 'item_' + this.getItemId(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: () => { this.setSelection(item); }, 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.ezDraggable ? index.h("span", { class: "draggable-icon" }) : undefined, index.h("p", { title: item.label, class: "person-name text--ellipsis" }, item.label)), this.itemSlotBuilder ?
554
+ index.h("div", null, this.itemSlotBuilder(item))
555
+ : undefined));
556
+ }), index.h("div", { class: "last-droppable-space", onDragLeave: () => this.removeOverClass(), onDragOver: (event) => { this.onDragOverLastIndex(event); }, onDragEnd: () => this.onDragEnd(), onDrop: (event) => this.onDropLastIndex(event) })))));
557
+ }
558
+ };
559
+ EzList.style = ezListCss;
560
+
561
+ 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}";
562
+
563
+ let SelectBox = class {
564
+ constructor(hostRef) {
565
+ index.registerInstance(this, hostRef);
566
+ this.ezChange = index.createEvent(this, "ezChange", 7);
567
+ this.selectedOption = { value: "na", label: "N/A" };
568
+ }
569
+ render() {
570
+ return (index.h("ez-combo-box", { class: "grid-config-combo inverted", label: "", value: this.selectedOption, enabled: true, canShowError: false, suppressEmptyOption: true }, index.h("option", { value: "na" }, "N/A"), index.h("option", { value: "asc" }, "A-Z"), index.h("option", { value: "desc" }, "Z-A")));
571
+ }
572
+ static get assetsDirs() { return ["../assets"]; }
573
+ };
574
+ SelectBox.style = selectBoxCss;
575
+
576
+ exports.ez_button = EzButton;
577
+ exports.ez_list = EzList;
578
+ exports.select_box = SelectBox;