@sankhyalabs/ezui 5.20.0-dev.3 → 5.20.0-dev.4

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 (62) hide show
  1. package/README.md +4 -5
  2. package/dist/cjs/ez-alert-list.cjs.entry.js +33 -28
  3. package/dist/cjs/ez-card-item.cjs.entry.js +52 -0
  4. package/dist/cjs/ez-combo-box.cjs.entry.js +155 -11
  5. package/dist/cjs/ez-filter-input_2.cjs.entry.js +137 -0
  6. package/dist/cjs/ez-form-view.cjs.entry.js +4 -2
  7. package/dist/cjs/ez-grid.cjs.entry.js +3 -3
  8. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  9. package/dist/cjs/ez-search.cjs.entry.js +31 -611
  10. package/dist/cjs/ez-split-panel.cjs.entry.js +3 -2
  11. package/dist/cjs/ezui.cjs.js +1 -1
  12. package/dist/cjs/index-a7b0c73d.js +6 -2
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/collection-manifest.json +2 -2
  15. package/dist/collection/components/ez-alert-list/ez-alert-list.js +33 -28
  16. package/dist/collection/components/ez-card-item/ez-card-item.css +0 -16
  17. package/dist/collection/components/ez-combo-box/ez-combo-box.js +173 -12
  18. package/dist/collection/components/ez-form-view/fieldbuilder/templates/FileInput.tpl.js +4 -2
  19. package/dist/collection/components/ez-grid/ez-grid.css +1 -0
  20. package/dist/collection/components/ez-grid/ez-grid.js +2 -2
  21. package/dist/collection/components/ez-icon/ez-icon.css +1 -1
  22. package/dist/collection/components/ez-search/ez-search.css +0 -330
  23. package/dist/collection/components/ez-search/ez-search.js +55 -689
  24. package/dist/collection/components/ez-split-panel/ez-split-panel.css +7 -0
  25. package/dist/collection/components/ez-split-panel/ez-split-panel.js +19 -1
  26. package/dist/custom-elements/index.js +240 -665
  27. package/dist/esm/ez-alert-list.entry.js +33 -28
  28. package/dist/esm/ez-card-item.entry.js +48 -0
  29. package/dist/esm/ez-combo-box.entry.js +156 -12
  30. package/dist/esm/ez-filter-input_2.entry.js +132 -0
  31. package/dist/esm/ez-form-view.entry.js +4 -2
  32. package/dist/esm/ez-grid.entry.js +3 -3
  33. package/dist/esm/ez-icon.entry.js +1 -1
  34. package/dist/esm/ez-search.entry.js +33 -613
  35. package/dist/esm/ez-split-panel.entry.js +3 -2
  36. package/dist/esm/ezui.js +1 -1
  37. package/dist/esm/index-baa5e267.js +6 -2
  38. package/dist/esm/loader.js +1 -1
  39. package/dist/ezui/ezui.esm.js +1 -1
  40. package/dist/ezui/p-05f5a778.entry.js +1 -0
  41. package/dist/ezui/p-13dbad96.entry.js +1 -0
  42. package/dist/ezui/p-5613fe63.entry.js +1 -0
  43. package/dist/ezui/p-60848ef6.entry.js +1 -0
  44. package/dist/ezui/{p-6e2f8e6b.entry.js → p-844ee673.entry.js} +1 -1
  45. package/dist/ezui/{p-f56dd1da.entry.js → p-93c3df4f.entry.js} +1 -1
  46. package/dist/ezui/p-940ed30b.entry.js +1 -0
  47. package/dist/ezui/p-a32aaac6.entry.js +1 -0
  48. package/dist/ezui/p-a5ac7151.entry.js +1 -0
  49. package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +1 -1
  50. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +15 -0
  51. package/dist/types/components/ez-search/ez-search.d.ts +10 -100
  52. package/dist/types/components.d.ts +22 -23
  53. package/dist/types/utils/interfaces/AbstractFieldMetadata.d.ts +1 -2
  54. package/package.json +16 -8
  55. package/dist/cjs/ez-card-item_3.cjs.entry.js +0 -182
  56. package/dist/esm/ez-card-item_3.entry.js +0 -176
  57. package/dist/ezui/p-133fae4a.entry.js +0 -1
  58. package/dist/ezui/p-43b03119.entry.js +0 -1
  59. package/dist/ezui/p-4a7f113d.entry.js +0 -1
  60. package/dist/ezui/p-76ba9d67.entry.js +0 -1
  61. package/dist/ezui/p-796c1a88.entry.js +0 -1
  62. package/dist/ezui/p-ba875f37.entry.js +0 -1
package/README.md CHANGED
@@ -15,13 +15,13 @@ Esse projeto é constituído por um monorepo com a seguinte hierarquia:
15
15
  -- .gitlab-ci.yml
16
16
  ```
17
17
 
18
- Observe que na raiz do ez-ui temos um packege.json que define as configurações de storybook para todos os componentes filhos dentro da hierarquia.
18
+ Observe que na raiz do ez-ui temos um packege.json que define as configurações de storybook para todos os componentes filhos dentro da hierarquia.
19
19
  Cada subpasta (component1, component2) são componentes [Stencil](https://stenciljs.com/).
20
20
 
21
21
  #### O EzUI foi baseado no [UiKit](https://xd.adobe.com/view/d45d91bf-f5a8-4814-899f-e781732807d1-810e/grid) disponibilizado pela equipe de UX da Sankhya.
22
22
 
23
23
  ## Executando o projeto
24
- Para iniciar o projeto, basta ir até a pasta do componente que deseja testar (ex: ez-ui/component1) e executar o comando: `npm install && npm run dev`
24
+ Para iniciar o projeto, basta ir até a pasta do componente que deseja testar (ex: ez-ui/component1) e executar o comando: `npm install && npm run dev`
25
25
  Este procedimento irá iniciar um servidor do storybook para testar o componente. A porta que o servidor estará sendo executado é apresentada no console ao final do comando.
26
26
 
27
27
  ## Padrão de commit e merge request:
@@ -41,10 +41,9 @@ Hoje estamos utilizando o padrão de semantic release baseado no [angular](https
41
41
  └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
42
42
  ```
43
43
 
44
- - Na solicitação de merge request deve ter um titulo com o seguinte padrão: SKA-111 - Titulo sugestivo da minha modificação, onde, SKA-111 é id do card do jira.
44
+ - Na solicitação de merge request deve ter um titulo com o seguinte padrão: KB-11111 - Titulo sugestivo da minha modificação, onde, KB-11111 é id do card do Kanbanize.
45
45
 
46
46
  ## Fontes notáveis
47
-
48
47
  - **ez-ui/.storybook/***: Nessa pasta temos arquivos de configuração do storybook. Essa pasta é utilizada em ambiente de produção.
49
48
  * **ez-ui/.storybook/preview-head.html**: Esse arquivo é responsável por fazer o import de módulos dos webcomponents e dos styles globais da aplicação. Esse arquivo é utilizado em ambiente de produção.
50
49
  - **ez-ui/.storybook-dev/***: Nessa pasta temos arquivos de configuração do storybook. Porém essa pasta é utilizada apenas em ambiente de desenvolvimento.
@@ -75,4 +74,4 @@ o build do ezui, link do react-output e ezui, build do react-output e a disponib
75
74
  - [Diretrizes de documentação](https://gitlab.sankhya.com.br/dti/design-system/ez-ui/-/wikis/Diretrizes-de-documenta%C3%A7%C3%A3o)
76
75
  - [Link ente projetos](https://gitlab.sankhya.com.br/dti/design-system/ez-ui/-/wikis/Link-ente-projetos)
77
76
  - [Definindo bons data-element-id de testabilidade no design system](https://gitlab.sankhya.com.br/dti/design-system/ez-ui/-/wikis/Definindo-bons-data-element-id-de-testabilidade-no-design-system)
78
- - [Criando exemplos de componentes](https://gitlab.sankhya.com.br/dti/design-system/ez-ui/-/wikis/Criando-exemplos-de-componentes)
77
+ - [Criando exemplos de componentes](https://gitlab.sankhya.com.br/dti/design-system/ez-ui/-/wikis/Criando-exemplos-de-componentes)
@@ -61,11 +61,13 @@ const EzAlertList = class {
61
61
  /**
62
62
  * Gerencia a exibição do overlay usando FloatingManager do Core.
63
63
  */
64
- async manageOverlay() {
65
- if (this.opened) {
64
+ manageOverlay() {
65
+ if (this.opened && this._container) {
66
66
  this._overlayId = core.FloatingManager.float(this._container, this._overlayRef, this.getFloatOptions());
67
67
  }
68
68
  else {
69
+ if (this._overlayId === undefined)
70
+ return;
69
71
  core.FloatingManager.close(this._overlayId);
70
72
  this._overlayId = undefined;
71
73
  }
@@ -74,8 +76,10 @@ const EzAlertList = class {
74
76
  * Atualiza a posição da lista.
75
77
  */
76
78
  updatePosition(right, bottom) {
77
- core.FloatingManager.updateFloatPosition(this._container, this._overlayRef, Object.assign(Object.assign({}, this.getFloatOptions()), { right,
78
- bottom }));
79
+ if (this.opened) {
80
+ core.FloatingManager.updateFloatPosition(this._container, this._overlayRef, Object.assign(Object.assign({}, this.getFloatOptions()), { right,
81
+ bottom }));
82
+ }
79
83
  }
80
84
  ;
81
85
  /**
@@ -84,7 +88,7 @@ const EzAlertList = class {
84
88
  getFloatOptions() {
85
89
  return {
86
90
  autoClose: false,
87
- isFixed: false,
91
+ isFixed: true,
88
92
  bottom: '10px',
89
93
  right: '10px',
90
94
  };
@@ -106,9 +110,9 @@ const EzAlertList = class {
106
110
  const boxHeight = this._container.getBoundingClientRect().height;
107
111
  return ((docHeight - boxHeight) / 2) + 'px';
108
112
  }
109
- componentDidRender() {
113
+ componentDidLoad() {
110
114
  this.manageOverlay();
111
- if (this.opened) {
115
+ if (this.opened && this._container) {
112
116
  this._container.focus();
113
117
  }
114
118
  }
@@ -116,27 +120,28 @@ const EzAlertList = class {
116
120
  this.dataElementId = core.ElementIDUtils.addIDInfo(this._element, 'EzAlertList');
117
121
  }
118
122
  render() {
119
- return (index.h(index.Host, Object.assign({}, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: this.dataElementId }), index.h("div", { ref: elem => (this._overlayRef = elem) }, index.h("div", { class: `alert-list__container ${this.expanded ? 'expanded' : ''}`, ref: elem => (this._container = elem) }, index.h("div", { class: "alert-list__content" }, index.h("div", { class: "alert-list__header" }, index.h("div", { class: "alert-list__title" }, `Avisos (${this.alerts.length})`), index.h("div", { class: "alert-list__header__buttons" }, this.enableExpand && (index.h("ez-button", { mode: "icon", size: "small", iconName: "expand", onClick: () => this.toggleExpandContainer(), "data-element-id": core.ElementIDUtils.getInternalIDInfo('expandButton'), title: this.expanded ? 'Resumir' : 'Expandir' })), index.h("ez-button", { mode: "icon", size: "small", iconName: "close", "data-element-id": core.ElementIDUtils.getInternalIDInfo('closeButton'), onClick: () => {
120
- this.opened = false;
121
- }, title: 'Fechar' }))), index.h("div", { class: "alert-list__expandable-content" }, index.h("ez-list", { hoverFeedback: true, itemLeftSlotBuilder: item => {
122
- return (index.h("a", { href: "#", style: {
123
- fontFamily: "var(--font-pattern, 'Roboto')",
124
- fontSize: 'var(--text--medium, 14px)',
125
- fontWeight: 'var(--text-weight--medium, 400)',
126
- color: 'var(--color--primary, #008561)',
127
- marginRight: '4px',
128
- cursor: 'pointer',
129
- display: 'flex',
130
- width: 'max-content',
131
- textDecoration: 'none'
132
- } }, this.getTitleText(item)));
133
- }, dataSource: this.alerts.map((alert, index) => {
134
- var _a;
135
- return {
136
- id: this.alertId(alert.title, index),
137
- label: (_a = alert.detail) !== null && _a !== void 0 ? _a : "",
138
- };
139
- }) })))))));
123
+ return (index.h(index.Host, Object.assign({}, { [core.ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: this.dataElementId }), this.opened ?
124
+ (index.h("div", { ref: elem => (this._overlayRef = elem) }, index.h("div", { class: `alert-list__container ${this.expanded ? 'expanded' : ''}`, ref: elem => (this._container = elem) }, index.h("div", { class: "alert-list__content" }, index.h("div", { class: "alert-list__header" }, index.h("div", { class: "alert-list__title" }, `Avisos (${this.alerts.length})`), index.h("div", { class: "alert-list__header__buttons" }, this.enableExpand && (index.h("ez-button", { mode: "icon", size: "small", iconName: "expand", onClick: () => this.toggleExpandContainer(), "data-element-id": core.ElementIDUtils.getInternalIDInfo('expandButton'), title: this.expanded ? 'Resumir' : 'Expandir' })), index.h("ez-button", { mode: "icon", size: "small", iconName: "close", "data-element-id": core.ElementIDUtils.getInternalIDInfo('closeButton'), onClick: () => {
125
+ this.opened = false;
126
+ }, title: 'Fechar' }))), index.h("div", { class: "alert-list__expandable-content" }, index.h("ez-list", { itemSlotBuilder: this.itemRightSlotBuilder, hoverFeedback: true, itemLeftSlotBuilder: item => {
127
+ return (index.h("a", { href: "#", style: {
128
+ fontFamily: "var(--font-pattern, 'Roboto')",
129
+ fontSize: 'var(--text--medium, 14px)',
130
+ fontWeight: 'var(--text-weight--medium, 400)',
131
+ color: 'var(--color--primary, #008561)',
132
+ marginRight: '4px',
133
+ cursor: 'pointer',
134
+ display: 'flex',
135
+ width: 'max-content',
136
+ textDecoration: 'none'
137
+ } }, this.getTitleText(item)));
138
+ }, dataSource: this.alerts.map((alert, index) => {
139
+ var _a;
140
+ return {
141
+ id: this.alertId(alert.title, index),
142
+ label: (_a = alert.detail) !== null && _a !== void 0 ? _a : "",
143
+ };
144
+ }) })))))) : null));
140
145
  }
141
146
  get _element() { return index.getElement(this); }
142
147
  static get watchers() { return {
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a7b0c73d.js');
6
+ const core = require('@sankhyalabs/core');
7
+
8
+ const ezCardItemCss = ":host{--ez-card-item--font-size:var(--text--medium, 14px);--ez-card-item--font-family:var(--font-pattern, Arial);--ez-card-item--font-weight:var(--text-weight--medium, 400);--ez-card-item--font-weight-large:var(--text-weight--large, 600);--ez-card-item--color:var(--title--primary, #2B3A54);--ez-card-item__key--color:var(--text--primary, #626e82);--ez-card-item__detail-label--color:var(--text--secondary, #A2ABB9);--ez-card-item__detail--padding-bottom:var(--space--extra-small, 3px);--ez-card-item__title--padding-bottom:var(--space--extra-small, 3px);--ez-card-item__highlight--color:var(--color--primary-300, #E2F4EF);width:100%;display:flex;cursor:pointer}.card-item{display:flex;flex-direction:column;width:100%;cursor:pointer;padding:12px;z-index:0;position:relative}.card-item:hover{background:#F0F3F7;border-radius:12px}.card-item__title{display:flex;align-items:center;line-height:18px;cursor:pointer;font-size:var(--ez-card-item--font-size);font-family:var(--ez-card-item--font-family);font-weight:var(--ez-card-item--font-weight-large);color:var(--ez-card-item--color);padding-bottom:var(--ez-card-item__title--padding-bottom);gap:var(--space--small, 6px)}.card-item__key{color:var(--ez-card-item__key--color)}.card-item__details{display:flex;cursor:pointer;justify-content:space-between;gap:var(--space--small, 6px)}.card-item__details-left{cursor:pointer;width:50%}.card-item__details-right{width:50%;cursor:pointer}.card-item__detail:not(:last-child){cursor:pointer;padding-bottom:var(--ez-card-item__detail--padding-bottom)}.card-item__detail-label{cursor:pointer;font-size:var(--ez-card-item--font-size);font-family:var(--ez-card-item--font-family);font-weight:var(--ez-card-item--font-weight);color:var(--ez-card-item__detail-label--color)}.card-item__detail-value{cursor:pointer;line-break:anywhere;font-size:var(--ez-card-item--font-size);font-family:var(--ez-card-item--font-family);font-weight:var(--ez-card-item--font-weight);color:var(--ez-card-item--color)}.card-item__highlight{position:relative;border-radius:8px;z-index:-1;background-color:var(--ez-card-item__highlight--color);outline:2px solid var(--ez-card-item__highlight--color);box-shadow:-4px 0px 0px 0px var(--ez-card-item__highlight--color), \n 4px 0px 0px 0px var(--ez-card-item__highlight--color)}";
9
+
10
+ const EzCardItem = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.ezClick = index.createEvent(this, "ezClick", 7);
14
+ this.item = undefined;
15
+ }
16
+ componentWillRender() {
17
+ this.createDetailList();
18
+ }
19
+ componentDidLoad() {
20
+ var _a, _b;
21
+ const dataInfo = { id: core.StringUtils.toCamelCase(((_a = this.item) === null || _a === void 0 ? void 0 : _a.key) || ((_b = this.item) === null || _b === void 0 ? void 0 : _b.title) || "") };
22
+ core.ElementIDUtils.addIDInfo(this._element, null, dataInfo);
23
+ }
24
+ createDetailList() {
25
+ var _a, _b, _c;
26
+ this._details = { detailsLeft: [], detailsRight: [] };
27
+ let cont = 0;
28
+ if ((_a = this.item) === null || _a === void 0 ? void 0 : _a.details) {
29
+ for (const attribute in this.item.details) {
30
+ cont < 3 ?
31
+ this._details.detailsLeft.push({ label: attribute, value: (_b = this.item.details[attribute]) === null || _b === void 0 ? void 0 : _b.toString() }) :
32
+ this._details.detailsRight.push({ label: attribute, value: (_c = this.item.details[attribute]) === null || _c === void 0 ? void 0 : _c.toString() });
33
+ cont++;
34
+ }
35
+ }
36
+ }
37
+ buildDetailContent(detail) {
38
+ return index.h("div", { class: "card-item__detail" }, index.h("label", { class: "card-item__detail-label" }, detail.label), ": ", index.h("label", { class: "card-item__detail-value", innerHTML: detail.value }));
39
+ }
40
+ render() {
41
+ return (index.h(index.Host, null, this.item &&
42
+ index.h("div", { class: "card-item", onClick: () => { this.ezClick.emit(this.item); } }, index.h("label", { class: "card-item__title" }, index.h("span", { class: "card-item__key", innerHTML: this.item.key }), index.h("span", { innerHTML: this.item.title })), index.h("div", { class: "card-item__details" }, index.h("div", { class: "card-item__details-left" }, this._details.detailsLeft.map(detail => {
43
+ return this.buildDetailContent(detail);
44
+ })), index.h("div", { class: "card-item__details-right" }, this._details.detailsRight.map(detail => {
45
+ return this.buildDetailContent(detail);
46
+ }))))));
47
+ }
48
+ get _element() { return index.getElement(this); }
49
+ };
50
+ EzCardItem.style = ezCardItemCss;
51
+
52
+ exports.ez_card_item = EzCardItem;
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-a7b0c73d.js');
6
6
  const core = require('@sankhyalabs/core');
7
- require('./ApplicationUtils-c9d1205c.js');
7
+ const ApplicationUtils = require('./ApplicationUtils-c9d1205c.js');
8
8
  const CSSVarsUtils = require('./CSSVarsUtils-b136a156.js');
9
9
  require('./DialogType-2114c337.js');
10
10
  require('./CheckMode-ecb90b87.js');
11
+ const constants = require('./constants-2714478b.js');
11
12
 
12
13
  const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box--line-height:calc(var(--text--medium, 14px) + 4px);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn--color:var(--title--primary, #2B3A54);--ez-combo-box__btn-disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-hover--color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #2B3A54);--ez-combo-box__list-title--primary:var(--title--primary, #2B3A54);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium) + 4px);--ez-combo-box__list-min-width:64px;--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);--ez-combo-box__scrollbar--color-default:var(--scrollbar--default, #626e82);--ez-combo-box__scrollbar--color-background:var(--scrollbar--background, #E5EAF0);--ez-combo-box__scrollbar--color-hover:var(--scrollbar--hover, #2B3A54);--ez-combo-box__scrollbar--color-clicked:var(--scrollbar--clicked, #a2abb9);--ez-combo-box__scrollbar--border-radius:var(--border--radius-small, 6px);--ez-combo-box__scrollbar--width:var(--space--medium, 12px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}ez-icon{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.suppressed-search-input{--ez-text-input__input--border-color:var(--color--strokes, #dce0e8);--ez-text-input__input--disabled--background-color:var(--background--xlight, #fff);--ez-text-input__input--disabled--color:var(--title--primary, #2B3A54)}.list-container{min-width:var(--ez-combo-box__list-min-width);position:relative;width:100%}.list-wrapper{display:flex;flex-direction:column;box-sizing:border-box;width:0;z-index:var(--more-visible, 2);max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small) + 9px);background-color:var(--ez-combo-box--background-color--xlight);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);padding:var(--ez-combo-box--space--small)}.list-options{box-sizing:border-box;width:100%;height:100%;padding:0;display:flex;flex-direction:column;scroll-behavior:smooth;overflow:auto;scrollbar-width:thin;gap:3px;scrollbar-color:var(--ez-combo-box__scrollbar--color-clicked) var(--ez-combo-box__scrollbar--color-background)}.list-options::-webkit-scrollbar{background-color:var(--ez-combo-box__scrollbar--color-background);width:var(--ez-combo-box__scrollbar--width);max-width:var(--ez-combo-box__scrollbar--width);min-width:var(--ez-combo-box__scrollbar--width)}.list-options::-webkit-scrollbar-track{background-color:var(--ez-combo-box__scrollbar--color-background);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb{background-color:var(--ez-combo-box__scrollbar--color-default);border-radius:var(--ez-combo-box__scrollbar--border-radius)}.list-options::-webkit-scrollbar-thumb:vertical:hover,.list-options::-webkit-scrollbar-thumb:horizontal:hover{background-color:var(--ez-combo-box__scrollbar--color-hover)}.list-options::-webkit-scrollbar-thumb:vertical:active,.list-options::-webkit-scrollbar-thumb:horizontal:active{background-color:var(--ez-combo-box__scrollbar--color-clicked)}.item{display:flex;align-items:center;width:100%;box-sizing:border-box;list-style-type:none;cursor:pointer;border-radius:var(--ez-combo-box--border-radius-small);padding:var(--ez-combo-box--space--small);min-height:var(--ez-combo-box__list-height);gap:var(--space--small, 6px)}.item__value,.item__label{flex-basis:auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size);line-height:var(--ez-combo-box--line-height)}.item__label{font-weight:var(--ez-combo-box--font-weight--medium)}.item__label--bold{font-weight:var(--ez-combo-box--font-weight--large)}.item__value{text-align:center;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large)}.item__value--hidden{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}.item__label{text-align:left}.message{text-align:center;display:flex;justify-content:center;align-items:center;list-style-type:none;min-height:var(--ez-combo-box__list-height)}.message__no-result{color:var(--ez-combo-box__list-title--primary);font-family:var(--ez-combo-box--font-family);font-size:var(--ez-combo-box--font-size)}.message__loading{border-radius:50%;width:14px;height:14px;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border:3px solid var(--ez-combo-box__list-title--primary);border-top:3px solid transparent}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn{outline:none;border:none;background:none;cursor:pointer;color:var(--ez-combo-box__btn--color)}.btn:disabled{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:disabled:hover{cursor:unset;color:var(--ez-combo-box__btn-disabled--color)}.btn:hover{color:var(--ez-combo-box__btn-hover--color)}.btn__close{visibility:hidden}ez-text-input:hover .btn__close,ez-text-input:focus .btn__close{visibility:visible}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
13
14
 
@@ -20,6 +21,7 @@ const EzComboBox = class {
20
21
  this._maxWidthValue = 0;
21
22
  this._tabPressed = false;
22
23
  this._textEmptyList = "Nenhum resultado encontrado";
24
+ this._textEmptySearch = "Nenhum resultado de {0} encontrado";
23
25
  this._lookupMode = false;
24
26
  this._preSelection = undefined;
25
27
  this._visibleOptions = undefined;
@@ -32,6 +34,7 @@ const EzComboBox = class {
32
34
  this.enabled = true;
33
35
  this.options = undefined;
34
36
  this.errorMessage = undefined;
37
+ this.searchMode = undefined;
35
38
  this.showSelectedValue = false;
36
39
  this.showOptionValue = false;
37
40
  this.suppressSearch = false;
@@ -55,7 +58,7 @@ const EzComboBox = class {
55
58
  observeValue(newValue, oldValue) {
56
59
  if (this._textInput && newValue != oldValue) {
57
60
  try {
58
- if (typeof newValue === "string") {
61
+ if (this.searchMode && typeof newValue === "string") {
59
62
  this.setInputValue();
60
63
  return;
61
64
  }
@@ -218,7 +221,7 @@ const EzComboBox = class {
218
221
  }
219
222
  updateVisibleOptions() {
220
223
  let opts = this._source || [];
221
- if (this._criteria) {
224
+ if (!this.searchMode && this._criteria) {
222
225
  const upperCriteria = this._criteria.toUpperCase();
223
226
  opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
224
227
  }
@@ -293,7 +296,7 @@ const EzComboBox = class {
293
296
  return this._floatingID !== undefined && core.FloatingManager.isFloating(this._floatingID);
294
297
  }
295
298
  nextOption() {
296
- if (!this.isOptionsVisible()) {
299
+ if (this.searchMode && !this.isOptionsVisible()) {
297
300
  return;
298
301
  }
299
302
  this.showOptions();
@@ -316,6 +319,9 @@ const EzComboBox = class {
316
319
  this.selectOption(this._visibleOptions[this._preSelection]);
317
320
  this._preSelection = undefined;
318
321
  }
322
+ else {
323
+ this.controlListWithOnlyOne();
324
+ }
319
325
  }
320
326
  updateSource(source) {
321
327
  this._startLoading = false;
@@ -334,6 +340,7 @@ const EzComboBox = class {
334
340
  this.updateVisibleOptions();
335
341
  if (this._tabPressed) {
336
342
  this._tabPressed = false;
343
+ this.controlEmptySearch();
337
344
  }
338
345
  }
339
346
  else {
@@ -341,6 +348,10 @@ const EzComboBox = class {
341
348
  }
342
349
  }
343
350
  }
351
+ clearSource() {
352
+ this._source = [];
353
+ this.updateVisibleOptions();
354
+ }
344
355
  selectOption(newOption) {
345
356
  var _a, _b;
346
357
  const currentValue = this.getSelectedOption(this.value);
@@ -352,6 +363,10 @@ const EzComboBox = class {
352
363
  else {
353
364
  this.resetOptions();
354
365
  }
366
+ if (this.searchMode) {
367
+ this._visibleOptions = [];
368
+ this.clearSource();
369
+ }
355
370
  }
356
371
  loadOptions(mode, argument = "") {
357
372
  this._criteria = argument;
@@ -387,6 +402,93 @@ const EzComboBox = class {
387
402
  clearSearch() {
388
403
  this.value = null;
389
404
  }
405
+ controlListWithOnlyOne() {
406
+ var _a;
407
+ if (this.searchMode) {
408
+ const source = (_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.filter((opt) => opt.label !== "" && opt.value != undefined);
409
+ if ((source === null || source === void 0 ? void 0 : source.length) === 1) {
410
+ this.selectOption(source[0]);
411
+ }
412
+ }
413
+ }
414
+ controlEmptySearch() {
415
+ var _a;
416
+ if (this.searchMode) {
417
+ if (!((_a = this._visibleOptions) === null || _a === void 0 ? void 0 : _a.length)) {
418
+ this.clearSearch();
419
+ ApplicationUtils.ApplicationUtils.info(this._textEmptyList);
420
+ }
421
+ else {
422
+ this.controlListWithOnlyOne();
423
+ }
424
+ }
425
+ }
426
+ validateDescriptionValue() {
427
+ if (!this.searchMode || core.StringUtils.isEmpty(this.value)) {
428
+ return;
429
+ }
430
+ let value = this.value;
431
+ if (typeof value === "object") {
432
+ return;
433
+ }
434
+ if (core.StringUtils.isEmpty(value)) {
435
+ return;
436
+ }
437
+ this.loadDescriptionValue(value);
438
+ }
439
+ async loadDescriptionValue(argument) {
440
+ var _a, _b;
441
+ if (argument == undefined) {
442
+ return;
443
+ }
444
+ if (((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) > 0) {
445
+ this.loadOptionValue(argument);
446
+ return;
447
+ }
448
+ const searchArgument = {
449
+ mode: SearchMode.PREDICTIVE,
450
+ argument
451
+ };
452
+ const source = await ((_b = this.optionLoader) === null || _b === void 0 ? void 0 : _b.call(this, searchArgument));
453
+ if (source == undefined) {
454
+ return;
455
+ }
456
+ if (source instanceof Promise) {
457
+ source.then((result) => {
458
+ this.setDescriptionValue(result);
459
+ });
460
+ }
461
+ else {
462
+ this.setDescriptionValue(source);
463
+ }
464
+ }
465
+ setDescriptionValue(source) {
466
+ const value = (source === null || source === void 0 ? void 0 : source[0]) || source;
467
+ if (value == undefined || !Object.keys(value).length) {
468
+ this.showNoResultMessage();
469
+ return;
470
+ }
471
+ this._lookupMode = true;
472
+ this.value = value;
473
+ }
474
+ loadOptionValue(argument) {
475
+ var _a;
476
+ const source = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.value === argument);
477
+ if (source != undefined) {
478
+ this.selectOption(source);
479
+ }
480
+ else {
481
+ this.showNoResultMessage();
482
+ }
483
+ }
484
+ async showNoResultMessage() {
485
+ this.clearSearch();
486
+ ApplicationUtils.ApplicationUtils.info(this._textEmptySearch.replace("{0}", this.getFieldLabel()));
487
+ }
488
+ getFieldLabel() {
489
+ var _a;
490
+ return (_a = this.label) === null || _a === void 0 ? void 0 : _a.replace(constants.REQUIRED_INFO, "").toUpperCase();
491
+ }
390
492
  resetOptions() {
391
493
  this.hideOptions();
392
494
  this._criteria = undefined;
@@ -412,7 +514,12 @@ const EzComboBox = class {
412
514
  });
413
515
  }
414
516
  }
415
- this.loadOptions(SearchMode.PRELOAD);
517
+ if (this.searchMode) {
518
+ this.updateSource([]);
519
+ }
520
+ else {
521
+ this.loadOptions(SearchMode.PRELOAD);
522
+ }
416
523
  }
417
524
  componentDidRender() {
418
525
  var _a;
@@ -422,6 +529,7 @@ const EzComboBox = class {
422
529
  (_a = this._optionsList) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".item").forEach((elem) => {
423
530
  core.ElementIDUtils.addIDInfoIfNotExists(elem, "itemComboBox");
424
531
  });
532
+ this.validateDescriptionValue();
425
533
  }
426
534
  componentDidLoad() {
427
535
  CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._textInput);
@@ -441,7 +549,13 @@ const EzComboBox = class {
441
549
  // Event handlers
442
550
  //---------------------------------------------
443
551
  handlerIconClick() {
444
- this.showOptions();
552
+ this.searchMode ? this.loadOptions(SearchMode.ADVANCED) : this.showOptions();
553
+ }
554
+ buildNumberArgument(argument) {
555
+ if (this.isTextSearch) {
556
+ return NaN;
557
+ }
558
+ return Number(argument || undefined);
445
559
  }
446
560
  onTextInputChangeHandler(event) {
447
561
  var _a;
@@ -458,12 +572,36 @@ const EzComboBox = class {
458
572
  }
459
573
  this._criteria = argument;
460
574
  if (argument) {
461
- this.updateVisibleOptions();
462
- this.showOptions();
575
+ if (this.searchMode) {
576
+ this._showLoading = false;
577
+ this.clearSource();
578
+ const enoughChars = argument.length >= this.limitCharsToSearch;
579
+ const argumentNumber = this.buildNumberArgument(argument);
580
+ if (enoughChars || !isNaN(argumentNumber)) {
581
+ this._showLoading = true;
582
+ this._changeDeboucingTimeout = window.setTimeout(() => {
583
+ this.loadOptions(SearchMode.PREDICTIVE, isNaN(argumentNumber) ? argument : argumentNumber.toString());
584
+ }, this._deboucingTime);
585
+ this.showOptions();
586
+ }
587
+ else {
588
+ this.hideOptions();
589
+ }
590
+ }
591
+ else {
592
+ this.updateVisibleOptions();
593
+ this.showOptions();
594
+ }
463
595
  }
464
596
  else {
465
597
  this.hideOptions();
466
- this.updateVisibleOptions();
598
+ if (this.searchMode) {
599
+ this._showLoading = false;
600
+ this.clearSource();
601
+ }
602
+ else {
603
+ this.updateVisibleOptions();
604
+ }
467
605
  }
468
606
  }
469
607
  clearDeboucingTimeout() {
@@ -473,7 +611,9 @@ const EzComboBox = class {
473
611
  }
474
612
  }
475
613
  onTextInputClickHandler() {
476
- this.showOptions();
614
+ if (!this.searchMode) {
615
+ this.showOptions();
616
+ }
477
617
  }
478
618
  keyDownHandler(event) {
479
619
  this._tabPressed = false;
@@ -505,6 +645,7 @@ const EzComboBox = class {
505
645
  break;
506
646
  case "Tab":
507
647
  this._tabPressed = true;
648
+ this.controlListWithOnlyOne();
508
649
  break;
509
650
  }
510
651
  //ATENÇÃO: Existe a necessidade de propagar o evento de teclado.
@@ -521,8 +662,11 @@ const EzComboBox = class {
521
662
  return !this._showLoading && this._visibleOptions.length > 0;
522
663
  }
523
664
  render() {
665
+ var _a;
524
666
  core.ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
525
- return (index.h(index.Host, null, index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, index.h("button", { class: "btn", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { iconName: "chevron-down" }))), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, index.h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this._showLoading
667
+ return (index.h(index.Host, null, index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), class: this.suppressSearch ? "suppressed-search-input" : "", ref: elem => this._textInput = elem, "data-slave-mode": "true", enabled: this.enabled && !this.suppressSearch, onInput: event => this.onTextInputChangeHandler(event), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onKeyDown: event => this.keyDownHandler(event), label: this.label, canShowError: this.canShowError, errorMessage: this.errorMessage, mode: this.mode }, index.h("button", { class: "btn", slot: this.searchMode ? "leftIcon" : "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.handlerIconClick() }, index.h("ez-icon", { iconName: this.searchMode ? "search" : "chevron-down" })), this.searchMode && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value) && (this._criteria || this.value)
668
+ ? index.h("button", { class: "btn btn__close", slot: "rightIcon", disabled: !this.enabled, tabindex: -1, onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
669
+ : undefined), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "list-wrapper", ref: elem => this._listWrapper = elem }, index.h("ul", { class: "list-options", ref: elem => this._optionsList = elem }, !this._showLoading
526
670
  && this._visibleOptions.length === 0
527
671
  && index.h("div", { class: "message" }, index.h("span", { class: "message__no-result" }, this._textEmptyList)), this._showLoading
528
672
  && index.h("div", { class: "message" }, index.h("div", { class: "message__loading" })), this.showOptionValue
@@ -0,0 +1,137 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a7b0c73d.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const CSSVarsUtils = require('./CSSVarsUtils-b136a156.js');
8
+
9
+ const ezFilterInputCss = ":host{display:block;width:100%}";
10
+
11
+ const EzFilterInput = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.ezChange = index.createEvent(this, "ezChange", 7);
15
+ this.ezSearching = index.createEvent(this, "ezSearching", 7);
16
+ this.ezFocusIn = index.createEvent(this, "ezFocusIn", 7);
17
+ this._searchingText = "";
18
+ this.handleFocus = () => {
19
+ if (this._searchingText === "") {
20
+ this._textInput.value = "";
21
+ }
22
+ else {
23
+ this._textInput.value = this._searchingText;
24
+ }
25
+ this.ezFocusIn.emit();
26
+ };
27
+ this.label = undefined;
28
+ this.value = undefined;
29
+ this.enabled = true;
30
+ this.errorMessage = undefined;
31
+ this.restrict = undefined;
32
+ this.mode = "regular";
33
+ this.asyncSearch = false;
34
+ this.canShowError = true;
35
+ }
36
+ observeLabel() {
37
+ if (this._textInput) {
38
+ this._textInput.label = this.label;
39
+ }
40
+ }
41
+ observeErrorMessage() {
42
+ if (this._textInput) {
43
+ this._textInput.errorMessage = this.errorMessage;
44
+ }
45
+ }
46
+ observeValue(newValue, oldValue) {
47
+ if (this._textInput && newValue != oldValue) {
48
+ this._textInput.value = newValue;
49
+ this.ezChange.emit(newValue);
50
+ }
51
+ }
52
+ /**
53
+ * Aplica o foco no campo.
54
+ */
55
+ async setFocus() {
56
+ this._textInput.setFocus();
57
+ }
58
+ /**
59
+ * Remove o foco do campo.
60
+ */
61
+ async setBlur() {
62
+ this._textInput.setBlur();
63
+ }
64
+ /**
65
+ * Retorna se o conteúdo é inválido.
66
+ */
67
+ async isInvalid() {
68
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
69
+ }
70
+ /**
71
+ * Método responsável por setar um novo valor ao campo.
72
+ */
73
+ async setValue(newValue) {
74
+ if (!this.asyncSearch || this._textInput == undefined) {
75
+ return;
76
+ }
77
+ if (newValue !== this.value) {
78
+ this.value = newValue;
79
+ this._searchingText = "";
80
+ }
81
+ else {
82
+ this._textInput.value = newValue;
83
+ }
84
+ }
85
+ /**
86
+ * Método responsável por resetar o valor do campo para o ultimo valor inputado.
87
+ */
88
+ async endSearch() {
89
+ if (!this.asyncSearch || this._textInput == undefined) {
90
+ return;
91
+ }
92
+ if (this._textInput.value !== this.value) {
93
+ this._textInput.value = this.value;
94
+ }
95
+ }
96
+ handleChange(evt) {
97
+ const newValue = evt.detail;
98
+ this.errorMessage = "";
99
+ if (this.asyncSearch) {
100
+ this._searchingText = newValue;
101
+ this.ezSearching.emit(newValue);
102
+ }
103
+ else if (newValue !== this.value) {
104
+ this.value = newValue;
105
+ }
106
+ }
107
+ componentDidLoad() {
108
+ CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
109
+ }
110
+ render() {
111
+ core.ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
112
+ return (index.h("ez-text-input", { "data-element-id": core.ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" })));
113
+ }
114
+ get _elem() { return index.getElement(this); }
115
+ static get watchers() { return {
116
+ "label": ["observeLabel"],
117
+ "errorMessage": ["observeErrorMessage"],
118
+ "value": ["observeValue"]
119
+ }; }
120
+ };
121
+ EzFilterInput.style = ezFilterInputCss;
122
+
123
+ const multiSelectionBoxMessageCss = ".multi-selection__message{display:flex;flex-direction:row;align-items:center;justify-content:center;width:100%;min-height:320px;text-align:center}.multi-selection__text-message{margin-top:-30px;font-family:var(--font-pattern);font-size:var(--text--meduim);padding:var(--space-xs);color:var(--text--primary)}";
124
+
125
+ const MultiSelectionBoxMessage = class {
126
+ constructor(hostRef) {
127
+ index.registerInstance(this, hostRef);
128
+ this.message = undefined;
129
+ }
130
+ render() {
131
+ return (index.h("div", { class: "multi-selection__message" }, index.h("span", { class: "multi-selection__text-message" }, this.message)));
132
+ }
133
+ };
134
+ MultiSelectionBoxMessage.style = multiSelectionBoxMessageCss;
135
+
136
+ exports.ez_filter_input = EzFilterInput;
137
+ exports.multi_selection_box_message = MultiSelectionBoxMessage;
@@ -48,9 +48,11 @@ const buildDateTime = ({ name, label, readOnly, contextName, canShowError }) =>
48
48
  const buildFile = ({ name, label, readOnly, contextName, props }) => {
49
49
  const uploadProps = core.ObjectUtils.removeEmptyValues({
50
50
  subTitle: props.subTitle,
51
- requestHeaders: props.STORAGESTRATEGY ? {
51
+ requestHeaders: Object.assign(Object.assign({}, (props.STORAGESTRATEGY && {
52
52
  STORAGESTRATEGY: props.STORAGESTRATEGY
53
- } : null
53
+ })), (props.INTERNAL_FILENAME && {
54
+ INTERNAL_FILENAME: props.INTERNAL_FILENAME
55
+ })),
54
56
  });
55
57
  return (index.h("div", { class: "ez-col ez-col--sd-12 ez-padding-horizontal--small" },
56
58
  index.h("ez-upload", Object.assign({ enabled: !readOnly, label: label, "data-field-name": name, "data-context-name": contextName, key: name }, uploadProps))));