@sankhyalabs/ezui 1.1.80 → 1.1.83

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 (91) hide show
  1. package/dist/cjs/ApplicationUtils-d1c1db56.js +35 -0
  2. package/dist/cjs/{AssetsUtils-02db4f46.js → AssetsUtils-caf95dab.js} +1 -1
  3. package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
  4. package/dist/cjs/ez-application.cjs.entry.js +1 -1
  5. package/dist/cjs/{ez-grid.cjs.entry.js → ez-button_11.cjs.entry.js} +1448 -22
  6. package/dist/cjs/ez-calendar.cjs.entry.js +217 -0
  7. package/dist/cjs/ez-collapsible-box_7.cjs.entry.js +853 -0
  8. package/dist/cjs/ez-combo-box.cjs.entry.js +254 -0
  9. package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
  10. package/dist/cjs/ez-form.cjs.entry.js +722 -0
  11. package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
  12. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-popup.cjs.entry.js +1 -1
  14. package/dist/cjs/ez-time-input.cjs.entry.js +3 -3
  15. package/dist/cjs/ez-toast.cjs.entry.js +1 -1
  16. package/dist/cjs/ezui.cjs.js +2 -2
  17. package/dist/cjs/{index-2003dec4.js → index-0bce1636.js} +3 -0
  18. package/dist/cjs/{index-a2266984.js → index-2fc1b5fa.js} +115 -72
  19. package/dist/cjs/loader.cjs.js +2 -2
  20. package/dist/collection/components/ez-form/DataBinder.js +7 -1
  21. package/dist/collection/components/ez-form/fieldbuilder/FieldBuilder.js +2 -1
  22. package/dist/collection/components/ez-form/fieldbuilder/tpl/DateInput.tpl.js +4 -0
  23. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +19 -25
  24. package/dist/collection/components/ez-grid/controller/DataUnitBridge.js +10 -7
  25. package/dist/collection/components/ez-grid/ez-grid.css +4 -1
  26. package/dist/collection/components/ez-grid/ez-grid.js +4 -0
  27. package/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.js +1 -1
  28. package/dist/collection/components/test-du/test-du.js +3 -27
  29. package/dist/custom-elements/index.js +150 -116
  30. package/dist/esm/ApplicationUtils-01280a9d.js +33 -0
  31. package/dist/esm/{AssetsUtils-76ca41e1.js → AssetsUtils-9b1d9c38.js} +1 -1
  32. package/dist/esm/ez-action-chip.entry.js +1 -1
  33. package/dist/esm/ez-application.entry.js +1 -1
  34. package/dist/esm/{ez-grid.entry.js → ez-button_11.entry.js} +1428 -12
  35. package/dist/esm/ez-calendar.entry.js +213 -0
  36. package/dist/esm/ez-collapsible-box_7.entry.js +843 -0
  37. package/dist/esm/ez-combo-box.entry.js +250 -0
  38. package/dist/esm/ez-dialog.entry.js +1 -1
  39. package/dist/esm/ez-form.entry.js +718 -0
  40. package/dist/esm/ez-label-chip.entry.js +1 -1
  41. package/dist/esm/ez-popover.entry.js +2 -2
  42. package/dist/esm/ez-popup.entry.js +1 -1
  43. package/dist/esm/ez-time-input.entry.js +3 -3
  44. package/dist/esm/ez-toast.entry.js +1 -1
  45. package/dist/esm/ezui.js +2 -2
  46. package/dist/esm/{index-afe19542.js → index-015d8d70.js} +116 -73
  47. package/dist/esm/{index-077c7fcf.js → index-d80a8d1f.js} +3 -0
  48. package/dist/esm/loader.js +2 -2
  49. package/dist/ezui/ezui.esm.js +1 -1
  50. package/dist/ezui/{p-5509ee41.entry.js → p-058b8138.entry.js} +46 -46
  51. package/dist/ezui/{p-7a1f2e0e.entry.js → p-07d2c50f.entry.js} +1 -1
  52. package/dist/ezui/{p-57ea4b84.entry.js → p-091b27f2.entry.js} +1 -1
  53. package/dist/ezui/{p-6d157776.entry.js → p-19d8a928.entry.js} +1 -1
  54. package/dist/ezui/{p-a4a39579.entry.js → p-39218c31.entry.js} +1 -1
  55. package/dist/ezui/{p-da31cd21.entry.js → p-6206515e.entry.js} +1 -1
  56. package/dist/ezui/p-62ee7026.entry.js +1 -0
  57. package/dist/ezui/p-7107d7ef.js +1 -0
  58. package/dist/ezui/{p-7de3c95d.js → p-7c101b34.js} +1 -1
  59. package/dist/ezui/{p-857ead8e.entry.js → p-8592635e.entry.js} +1 -1
  60. package/dist/ezui/p-93ce25bc.entry.js +1 -0
  61. package/dist/ezui/p-96c336db.js +1 -0
  62. package/dist/ezui/p-a06aa43a.entry.js +1 -0
  63. package/dist/ezui/{p-920bb8c9.entry.js → p-a52b3368.entry.js} +1 -1
  64. package/dist/ezui/{p-0a2056d9.entry.js → p-b678dc80.entry.js} +1 -1
  65. package/dist/ezui/p-ca3dac07.entry.js +1 -0
  66. package/dist/ezui/p-f87c7082.js +1 -0
  67. package/dist/types/components/ez-form/fieldbuilder/tpl/DateInput.tpl.d.ts +4 -0
  68. package/dist/types/components/ez-grid/controller/DataUnitBridge.d.ts +2 -1
  69. package/dist/types/components/test-du/test-du.d.ts +0 -6
  70. package/package.json +2 -2
  71. package/react/{readme.md → .keepfolder} +0 -0
  72. package/dist/cjs/DateUtils-716769e0.js +0 -46
  73. package/dist/cjs/ez-button_3.cjs.entry.js +0 -520
  74. package/dist/cjs/ez-calendar_13.cjs.entry.js +0 -2421
  75. package/dist/cjs/ez-date-time-input.cjs.entry.js +0 -133
  76. package/dist/cjs/ez-icon.cjs.entry.js +0 -30
  77. package/dist/cjs/ez-modal_2.cjs.entry.js +0 -370
  78. package/dist/esm/DateUtils-0a1bbd7a.js +0 -44
  79. package/dist/esm/ez-button_3.entry.js +0 -514
  80. package/dist/esm/ez-calendar_13.entry.js +0 -2405
  81. package/dist/esm/ez-date-time-input.entry.js +0 -129
  82. package/dist/esm/ez-icon.entry.js +0 -26
  83. package/dist/esm/ez-modal_2.entry.js +0 -365
  84. package/dist/ezui/p-00b837e2.js +0 -1
  85. package/dist/ezui/p-0d8368fc.entry.js +0 -1
  86. package/dist/ezui/p-1e36e3ff.entry.js +0 -1
  87. package/dist/ezui/p-446ec85b.js +0 -1
  88. package/dist/ezui/p-49f3432a.entry.js +0 -1
  89. package/dist/ezui/p-c89629eb.js +0 -1
  90. package/dist/ezui/p-d5699f29.entry.js +0 -1
  91. package/dist/ezui/p-d64a3939.entry.js +0 -1
@@ -1,520 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-2003dec4.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, 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, 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__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)}.draggable{display:flex;align-items:center;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%;padding-bottom:var(--space--small)}.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)}.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)}.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}.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 = !item.selected;
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 = !item.selected;
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(ev);
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
- newList.find(group => group.group == dragEndItem.groupName).items.splice(dragEndItem.index, 0, this._dragStartItem.item);
233
- }
234
- this._listGroupItems = newList;
235
- this.ezChange.emit(this._listGroupItems);
236
- }
237
- else {
238
- let newList = [...this._listItems];
239
- newList.splice(this._dragStartItem.index, 1);
240
- newList.splice(dragEndItem.index, 0, this._dragStartItem.item);
241
- this._listItems = newList;
242
- this._listItemsHistory = newList;
243
- this.ezChange.emit(this._listItems);
244
- }
245
- }
246
- ev.stopPropagation();
247
- }
248
- onDropGroup(groupSelected) {
249
- var _a;
250
- let newList = [...this._listGroupItems];
251
- this.setSelection(undefined);
252
- let newGroup = newList.find(group => group.group === groupSelected.group);
253
- if (newGroup) {
254
- if (((_a = newGroup.items) === null || _a === void 0 ? void 0 : _a.length) > 0) {
255
- let newItem;
256
- newGroup.items.forEach((item, index) => {
257
- if (item.label === this._dragStartItem.item.label) {
258
- newItem = { item: item, index: index };
259
- }
260
- });
261
- if (newItem) {
262
- newGroup.items.splice(newItem.index, 1);
263
- newGroup.items.unshift(newItem.item);
264
- this.sortGroup(newGroup);
265
- }
266
- else {
267
- newGroup.items.unshift(this._dragStartItem.item);
268
- this.sortGroup(newGroup);
269
- newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
270
- }
271
- }
272
- else {
273
- newList.find(group => group.group === this._dragStartItem.groupName).items.splice(this._dragStartItem.index, 1);
274
- newGroup.items = [this._dragStartItem.item];
275
- }
276
- this._listGroupItems = newList;
277
- }
278
- }
279
- onDragEnd() {
280
- this._dragStartItem = undefined;
281
- if (this._draggingElement) {
282
- try {
283
- this._element.shadowRoot.removeChild(this._draggingElement);
284
- }
285
- catch (err) { }
286
- this._draggingElement = undefined;
287
- }
288
- }
289
- addOverClass(ev) {
290
- if (ev.target.__proto__ == HTMLDivElement.prototype && ev.target.classList.contains("draggable")) {
291
- ev.target.classList.add('over');
292
- }
293
- }
294
- addOverGroupClass(ev, group) {
295
- if (ev.target) {
296
- let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
297
- if (group.items.length > 0) {
298
- let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
299
- groupOverlay.setAttribute("style", "display:grid");
300
- }
301
- else {
302
- groupContainer === null || groupContainer === void 0 ? void 0 : groupContainer.classList.add('overGroup');
303
- }
304
- }
305
- }
306
- removeOverClass(ev) {
307
- ev.target.classList.remove('over');
308
- }
309
- removeOverGroupClass(ev, group) {
310
- if (ev.target) {
311
- let groupContainer = this._groupContainer.querySelector("div#" + this.getDivGroupId(group.group));
312
- if (group.items.length > 0) {
313
- let groupOverlay = groupContainer.getElementsByClassName("group-overlay")[0];
314
- groupOverlay.setAttribute("style", "display:none");
315
- }
316
- else {
317
- groupContainer === null || groupContainer === void 0 ? void 0 : groupContainer.classList.remove('overGroup');
318
- }
319
- }
320
- }
321
- onDragStart(event, item, group, index) {
322
- if (this.useGroups) {
323
- this._dragStartItem = { groupName: group.group, item: item, index: index };
324
- }
325
- else {
326
- this._dragStartItem = { item: item.item, index: item.index };
327
- }
328
- let sourceElement = event.srcElement.cloneNode(true);
329
- this._draggingElement = event.srcElement.cloneNode(true);
330
- this._draggingElement.style.position = "absolute";
331
- this._draggingElement.style.top = (event.clientY + 5) + 'px';
332
- this._draggingElement.style.left = (event.clientX + 5) + 'px';
333
- this._draggingElement.style.height = event.srcElement.clientHeight + 'px';
334
- this._draggingElement.style.width = event.srcElement.clientWidth + 'px';
335
- this._draggingElement.style.background = "#FFFFFF";
336
- this._draggingElement.style.border = "1px solid #008561";
337
- this._draggingElement.style["box-sizing"] = "border-box";
338
- this._draggingElement.style["box-shadow"] = "0px 0px 16px rgba(0, 38, 111, 0.122)";
339
- this._draggingElement.style["border-radius"] = "6px";
340
- this._element.shadowRoot.appendChild(this._draggingElement);
341
- event.dataTransfer.setDragImage(sourceElement, -10000, -10000);
342
- }
343
- onDrag(event) {
344
- if (this._draggingElement) {
345
- this._draggingElement.style.top = (event.clientY + 5) + 'px';
346
- this._draggingElement.style.left = (event.clientX + 5) + 'px';
347
- }
348
- }
349
- selectFirstItem() {
350
- if (this.useGroups) {
351
- this.setSelection(this._listGroupItems[0].items[0]);
352
- }
353
- {
354
- this.setSelection(this._listItems[0]);
355
- }
356
- }
357
- nextOption(selectedItem) {
358
- let nextItem = undefined;
359
- if (this.useGroups) {
360
- this._listGroupItems.every((group, groupIndex, listGroupItems) => {
361
- let item = undefined;
362
- let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
363
- if (itemIndex != undefined && itemIndex != -1) {
364
- if (itemIndex === group.items.length - 1) {
365
- if (groupIndex + 1 <= listGroupItems.length - 1) {
366
- item = { label: listGroupItems[groupIndex + 1].items[0].label };
367
- }
368
- }
369
- else {
370
- item = { label: group.items[itemIndex + 1].label };
371
- }
372
- }
373
- if (item != undefined) {
374
- nextItem = item;
375
- return false;
376
- }
377
- return true;
378
- });
379
- }
380
- else {
381
- let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
382
- if (itemIndex >= 0 && itemIndex < this._listItems.length) {
383
- nextItem = this._listItems[itemIndex + 1];
384
- }
385
- }
386
- this.setSelection(nextItem, true);
387
- }
388
- previousOption(selectedItem) {
389
- let previousItem = undefined;
390
- if (this.useGroups) {
391
- this._listGroupItems.every((group, groupIndex, listGroupItems) => {
392
- let item = undefined;
393
- let itemIndex = group.items.findIndex(item => item.label == selectedItem.label);
394
- if (itemIndex != undefined && itemIndex != -1) {
395
- if (itemIndex === 0) {
396
- if ((groupIndex - 1 >= 0)) {
397
- item = { label: listGroupItems[groupIndex - 1].items[listGroupItems[groupIndex - 1].items.length - 1].label };
398
- }
399
- }
400
- else {
401
- item = { label: group.items[itemIndex - 1].label };
402
- }
403
- }
404
- if (item != undefined) {
405
- previousItem = item;
406
- return false;
407
- }
408
- return true;
409
- });
410
- }
411
- else {
412
- let itemIndex = this._listItems.findIndex(item => item.label === selectedItem.label);
413
- if (itemIndex > 0 && itemIndex < this._listItems.length) {
414
- previousItem = this._listItems[itemIndex - 1];
415
- }
416
- }
417
- this.setSelection(previousItem, true);
418
- }
419
- keyDownHandler(event) {
420
- event.preventDefault();
421
- this.getSelection().then(selectedItem => {
422
- if (selectedItem) {
423
- switch (event.key) {
424
- case "ArrowDown":
425
- this.nextOption(selectedItem);
426
- break;
427
- case "ArrowUp":
428
- this.previousOption(selectedItem);
429
- break;
430
- }
431
- }
432
- else {
433
- this.selectFirstItem();
434
- }
435
- });
436
- event.stopPropagation();
437
- }
438
- getItemId(itemLabel) {
439
- if (itemLabel) {
440
- return itemLabel.replace(/[^a-z0-9_]/gi, "_");
441
- }
442
- return undefined;
443
- }
444
- getDivGroupId(groupName) {
445
- if (groupName) {
446
- return "group-" + groupName.replace(/[^a-z0-9_]/gi, "_");
447
- }
448
- return undefined;
449
- }
450
- onDragOverGroup(event, group) {
451
- if (this._dragStartItem && this._dragStartItem.groupName !== group.group) {
452
- event.preventDefault();
453
- this.addOverGroupClass(event, group);
454
- }
455
- }
456
- onDragOverItem(event, group) {
457
- if (this._dragStartItem) {
458
- event.preventDefault();
459
- if (group) {
460
- group.sort ?
461
- () => {
462
- this.addOverGroupClass(event, group);
463
- }
464
- : this.addOverClass(event);
465
- }
466
- else {
467
- this.addOverClass(event);
468
- }
469
- event.stopPropagation();
470
- }
471
- }
472
- render() {
473
- return (index.h(index.Host, { ref: (el) => this._element = el }, this.useGroups ?
474
- index.h("div", { class: "group-container", ref: (el) => this._groupContainer = el, tabIndex: 0, onKeyDown: (event) => { this.keyDownHandler(event); } }, this._listGroupItems.map(group => {
475
- return index.h("div", { id: this.getDivGroupId(group.group), class: "group", key: group.group + group.items.length, onDragLeave: (event) => { this.removeOverGroupClass(event, group); }, onDragEnd: (event) => { this.onDragEnd(); this.removeOverGroupClass(event, group); }, onDragOver: (event) => { this.onDragOverGroup(event, group); }, onDrop: () => this.onDropGroup(group) }, index.h("label", { class: "group-name", onDragLeave: (event) => { this.removeOverGroupClass(event, group); }, onDragOver: (event) => { this.onDragOverGroup(event, group); }, onDragEnd: (event) => { this.onDragEnd(); this.removeOverGroupClass(event, group); }, onDrop: () => this.onDropGroup(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) => {
476
- 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: (event) => { group.sort ? undefined : this.removeOverClass(event); }, onDragEnd: () => this.onDragEnd(), onDragStart: (event) => this.onDragStart(event, item, group, index$1), onDragOver: (event) => this.onDragOverItem(event, group), onDrop: (event) => this.onDrop(event, { groupName: group.group, item: item, index: index$1 }), onDrag: (event) => this.onDrag(event), 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 ?
477
- index.h("div", { class: "slot-item" }, this.itemSlotBuilder(item, group))
478
- : undefined));
479
- }))), index.h("div", { class: "group-overlay" }, index.h("div", { id: "overlay-text" }, index.h("b", null, "Mover"), " para ", group.group))));
480
- }))
481
- :
482
- 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) => {
483
- 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: (event) => this.onDragStart(event, { item: item, index: index$1 }), onClick: () => { this.setSelection(item); }, onDragLeave: event => this.removeOverClass(event), onDragOver: (event) => this.onDragOverItem(event), onDragEnd: () => this.onDragEnd(), onDrop: (event) => this.onDrop(event, { item: item, index: index$1 }), onDrag: (event) => this.onDrag(event), 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 ?
484
- index.h("div", null, this.itemSlotBuilder(item))
485
- : undefined));
486
- })))));
487
- }
488
- };
489
- EzList.style = ezListCss;
490
-
491
- const selectBoxCss = "select{border:1px solid #DCE0E8;font-family:'Sora';border-radius:3px;outline:none;cursor:pointer}";
492
-
493
- let SelectBox = class {
494
- constructor(hostRef) {
495
- index.registerInstance(this, hostRef);
496
- this.ezChange = index.createEvent(this, "ezChange", 7);
497
- }
498
- changeSelection() {
499
- this.ezChange.emit(this._selectElem.value);
500
- }
501
- componentDidRender() {
502
- if (this._selectElem) {
503
- if (this.selectedOption) {
504
- this._selectElem.value = this.selectedOption;
505
- }
506
- else {
507
- this._selectElem.value = "na";
508
- }
509
- }
510
- }
511
- render() {
512
- return (index.h("select", { ref: (el) => this._selectElem = el, onChange: () => { this.changeSelection(); } }, index.h("option", { value: "na" }, "N/A"), index.h("option", { value: "asc" }, "A-Z"), index.h("option", { value: "desc" }, "Z-A")));
513
- }
514
- static get assetsDirs() { return ["../assets"]; }
515
- };
516
- SelectBox.style = selectBoxCss;
517
-
518
- exports.ez_button = EzButton;
519
- exports.ez_list = EzList;
520
- exports.select_box = SelectBox;