@sankhyalabs/ezui 5.11.0-dev.4 → 5.11.0-dev.6

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 (56) hide show
  1. package/dist/cjs/ez-combo-box.cjs.entry.js +8 -2
  2. package/dist/cjs/ez-form-view.cjs.entry.js +37 -1
  3. package/dist/cjs/ez-form.cjs.entry.js +1 -0
  4. package/dist/cjs/ez-grid.cjs.entry.js +87 -38
  5. package/dist/cjs/ez-multi-selection-list.cjs.entry.js +3 -1
  6. package/dist/cjs/ez-search.cjs.entry.js +2 -1
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/filter-column.cjs.entry.js +30 -7
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/components/ez-combo-box/ez-combo-box.js +26 -2
  11. package/dist/collection/components/ez-form/ez-form.js +20 -0
  12. package/dist/collection/components/ez-form-view/ez-form-view.js +23 -0
  13. package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +4 -1
  14. package/dist/collection/components/ez-form-view/structure/index.js +29 -0
  15. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
  16. package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
  17. package/dist/collection/components/ez-grid/ez-grid.js +11 -39
  18. package/dist/collection/components/ez-grid/subcomponents/filter-column.js +50 -8
  19. package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +78 -0
  20. package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +21 -1
  21. package/dist/collection/components/ez-search/ez-search.js +20 -1
  22. package/dist/custom-elements/index.js +173 -55
  23. package/dist/esm/ez-combo-box.entry.js +8 -2
  24. package/dist/esm/ez-form-view.entry.js +37 -1
  25. package/dist/esm/ez-form.entry.js +1 -0
  26. package/dist/esm/ez-grid.entry.js +88 -39
  27. package/dist/esm/ez-multi-selection-list.entry.js +3 -1
  28. package/dist/esm/ez-search.entry.js +2 -1
  29. package/dist/esm/ezui.js +1 -1
  30. package/dist/esm/filter-column.entry.js +30 -7
  31. package/dist/esm/loader.js +1 -1
  32. package/dist/ezui/ezui.esm.js +1 -1
  33. package/dist/ezui/p-061f4d73.entry.js +1 -0
  34. package/dist/ezui/p-25562cf8.entry.js +1 -0
  35. package/dist/ezui/p-5e55a42b.entry.js +1 -0
  36. package/dist/ezui/{p-9f41b414.entry.js → p-6ab2f7c2.entry.js} +1 -1
  37. package/dist/ezui/p-7526f2b6.entry.js +1 -0
  38. package/dist/ezui/p-8fdff9cd.entry.js +1 -0
  39. package/dist/ezui/{p-fd54b5b4.entry.js → p-964e5571.entry.js} +2 -2
  40. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -0
  41. package/dist/types/components/ez-form/ez-form.d.ts +5 -0
  42. package/dist/types/components/ez-form-view/ez-form-view.d.ts +5 -0
  43. package/dist/types/components/ez-form-view/structure/index.d.ts +14 -0
  44. package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
  45. package/dist/types/components/ez-grid/ez-grid.d.ts +3 -5
  46. package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +8 -0
  47. package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +16 -0
  48. package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +4 -0
  49. package/dist/types/components/ez-search/ez-search.d.ts +4 -0
  50. package/dist/types/components.d.ts +35 -0
  51. package/package.json +1 -1
  52. package/dist/ezui/p-2a0e1679.entry.js +0 -1
  53. package/dist/ezui/p-411f3579.entry.js +0 -1
  54. package/dist/ezui/p-4c8b029b.entry.js +0 -1
  55. package/dist/ezui/p-4e31b69b.entry.js +0 -1
  56. package/dist/ezui/p-5a1d8bf8.entry.js +0 -1
@@ -83,6 +83,10 @@ export declare class EzComboBox {
83
83
  * Define um posicionamento fixo para a lista de opções do CheckBox.
84
84
  */
85
85
  listOptionsPosition: IEzCheckBoxListPosition;
86
+ /**
87
+ * Informa se a pesquisa é do tipo texto.
88
+ */
89
+ isTextSearch: boolean;
86
90
  /**
87
91
  * Emitido quando acontece a alteração de valor do campo.
88
92
  */
@@ -145,6 +149,7 @@ export declare class EzComboBox {
145
149
  componentDidRender(): void;
146
150
  componentDidLoad(): void;
147
151
  private handlerIconClick;
152
+ private buildNumberArgument;
148
153
  private onTextInputChangeHandler;
149
154
  private clearDeboucingTimeout;
150
155
  private onTextInputClickHandler;
@@ -2,6 +2,7 @@ import { DataUnit } from "@sankhyalabs/core";
2
2
  import { EventEmitter } from "../../stencil-public-runtime";
3
3
  import { Tab } from "../ez-tabselector/ez-tabselector";
4
4
  import { IFormConfig, IRecordValidator } from "../../utils/form/interfaces";
5
+ import { FormItems } from "../ez-form-view/structure";
5
6
  export declare class EzForm {
6
7
  private _element;
7
8
  private _store;
@@ -24,6 +25,10 @@ export declare class EzForm {
24
25
  * Evento disparado quando o formulário está disponível na DOM.
25
26
  */
26
27
  ezReady: EventEmitter<void>;
28
+ /**
29
+ * Responsável por notificar quando ocorrer a renderização de itens do formulário.
30
+ */
31
+ formItemsReady: EventEmitter<FormItems>;
27
32
  /**
28
33
  * Realiza validação no conteúdo de todos os campos.
29
34
  */
@@ -1,11 +1,16 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
2
  import { IFormViewField } from './interfaces/IFormViewField';
3
+ import { FormItems } from './structure';
3
4
  export declare class EzFormView {
4
5
  _element: HTMLEzFormViewElement;
5
6
  /**
6
7
  * Evento emitido quando o componente foi totalmente carregado na DOM.
7
8
  */
8
9
  ezContentReady: EventEmitter<Array<HTMLElement>>;
10
+ /**
11
+ * Responsável por notificar quando ocorrer a renderização de itens do formulário.
12
+ */
13
+ formItemsReady: EventEmitter<FormItems>;
9
14
  /**
10
15
  * Define a lista de metadados usada para criar os campos de user interface.
11
16
  */
@@ -0,0 +1,14 @@
1
+ declare class FormItem {
2
+ private elem;
3
+ constructor(elem: HTMLElement);
4
+ addRightElement(el: Element): void;
5
+ get fieldName(): string;
6
+ }
7
+ export declare class FormItems {
8
+ items: Map<string, FormItem>;
9
+ private formId;
10
+ constructor(items: Array<HTMLElement>, formId?: string);
11
+ getItem(name: string): FormItem;
12
+ get formName(): string;
13
+ }
14
+ export {};
@@ -2,7 +2,7 @@ import { IHeaderParams } from 'ag-grid-community';
2
2
  export interface IEzGridCustomHeaderParams {
3
3
  tooltip?: string;
4
4
  hasFilter?: () => boolean;
5
- showColumnFilter?: (leftPosition: string) => void;
5
+ showColumnFilter?: (leftPosition: string, fromIcon: boolean) => void;
6
6
  }
7
7
  export declare class EzGridCustomHeader {
8
8
  private params;
@@ -1,7 +1,7 @@
1
1
  import { DataUnit } from '@sankhyalabs/core';
2
2
  import { EventEmitter } from '../../stencil-public-runtime';
3
3
  import { IMultiSelectionListDataSource } from '../ez-multi-selection-list/interfaces/IMultiSelectionListDataSource';
4
- import { EzGridColumStateEvent, EzGridColumn, EzGridColumnConfig, IGridConfig, IStatusResolver, StatusResolverFunction } from './controller/EzGridController';
4
+ import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver, StatusResolverFunction } from './controller/EzGridController';
5
5
  import { ISelection, ISelectionToastConfig } from './interfaces';
6
6
  import { IRecordValidator } from '../../utils/form/interfaces';
7
7
  export declare class EzGrid {
@@ -19,7 +19,7 @@ export declare class EzGrid {
19
19
  private _isAllSelection;
20
20
  private _currentPageSelected;
21
21
  private _selectionCount;
22
- private _originalRecords;
22
+ private _hasLeftButtons;
23
23
  /**
24
24
  * Emitido quando acontece a alteração de estado das colunas do grid: Ordenação, largura, etc.
25
25
  */
@@ -133,9 +133,7 @@ export declare class EzGrid {
133
133
  componentWillRender(): void;
134
134
  componentDidRender(): void;
135
135
  componentWillLoad(): void;
136
- onDataUnitAction: (action: any) => void;
137
136
  private getDataSource;
138
- private buildDefaultDataSource;
139
- private formatLabel;
137
+ private hideHeader;
140
138
  render(): any;
141
139
  }
@@ -5,6 +5,8 @@ import { IMultiSelectionOption } from '../../ez-multi-selection-list/interfaces/
5
5
  export declare class FilterColumn {
6
6
  private readonly TOP_POSITION;
7
7
  private readonly TOP_POSITION_HEADER_HIDDEN;
8
+ private readonly TOP_POSITION_NO_TASKBAR;
9
+ private readonly TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN;
8
10
  private readonly DEFAULT_HEIGHT;
9
11
  private ezPopoverElement;
10
12
  private ezMultiSelectionList;
@@ -13,19 +15,24 @@ export declare class FilterColumn {
13
15
  columnName: string;
14
16
  columnLabel: string;
15
17
  gridHeaderHidden: boolean;
18
+ noHeaderTaskBar: boolean;
16
19
  dataSource: IMultiSelectionListDataSource;
17
20
  dataUnit: DataUnit;
18
21
  options: IMultiSelectionOption[];
19
22
  selectedItems: IMultiSelectionOption[];
20
23
  fieldDescriptor: FieldDescriptor;
21
24
  useOptions: boolean;
25
+ isTextSearch: boolean;
22
26
  hide(): Promise<void>;
23
27
  /**
24
28
  * Abre o filtro de coluna.
25
29
  * @Params IFilterColumnConfigs informações para configurar o filtro
26
30
  */
27
31
  show(configs: IFilterColumnConfigs): Promise<void>;
32
+ private calculateLeftPosition;
33
+ private buildIsTextSearch;
28
34
  private calcTopPosition;
35
+ private buildReferenceTopPosition;
29
36
  private clearConfigs;
30
37
  private canShow;
31
38
  private submit;
@@ -42,6 +49,7 @@ export interface IFilterColumnConfigs {
42
49
  columnLabel: string;
43
50
  leftPosition: string;
44
51
  filteredOptions?: IMultiSelectionOption[];
52
+ fromIcon?: boolean;
45
53
  }
46
54
  export interface IAppliedFilterColumnOptions {
47
55
  field: string;
@@ -0,0 +1,16 @@
1
+ import { IMultiSelectionListDataSource } from '../../ez-multi-selection-list/interfaces/IMultiSelectionListDataSource';
2
+ import { IMultiSelectionOption } from '../../ez-multi-selection-list/interfaces/IMultiSelectionOption';
3
+ import { DataUnit } from '@sankhyalabs/core';
4
+ export default class InMemoryFilterColumnDataSource implements IMultiSelectionListDataSource {
5
+ private dataUnit;
6
+ private originalRecords;
7
+ constructor(dataUnit: DataUnit);
8
+ onDataUnitAction: (action: any) => void;
9
+ fetchData(filterTerm: string, fieldName: string): Promise<Array<IMultiSelectionOption>>;
10
+ private buildFieldOption;
11
+ private buildValue;
12
+ private removeDuplicatedOptions;
13
+ private includesSearchTerm;
14
+ private buildLabel;
15
+ private formatLabel;
16
+ }
@@ -27,6 +27,10 @@ export declare class EzMuiltiSelectionList {
27
27
  * Opções de filtros a serem exibidas na listagem.
28
28
  */
29
29
  options: IMultiSelectionOption[];
30
+ /**
31
+ * Informa se a pesquisa é do tipo texto.
32
+ */
33
+ isTextSearch: boolean;
30
34
  /**
31
35
  * Guarda o estado das opções de filtragem (check = true ou false).
32
36
  * @private
@@ -51,6 +51,10 @@ export declare class EzSearch {
51
51
  * Define um posicionamento fixo para a lista de opções do CheckBox.
52
52
  */
53
53
  listOptionsPosition: IEzCheckBoxListPosition;
54
+ /**
55
+ * Informa se a pesquisa é do tipo texto.
56
+ */
57
+ isTextSearch: boolean;
54
58
  /**
55
59
  * Emitido quando acontece a alteração de valor do campo.
56
60
  */
@@ -15,6 +15,7 @@ import { DataUnit, WaitingChange } from "@sankhyalabs/core";
15
15
  import { DialogType } from "./components/ez-dialog/DialogType";
16
16
  import { IDropdownItem, IDropdownSubAction } from "./components/ez-dropdown/structure/DropdownItem";
17
17
  import { IFormConfig, IRecordValidator } from "./utils/form/interfaces";
18
+ import { FormItems } from "./components/ez-form-view/structure";
18
19
  import { IFormViewField } from "./components/ez-form-view/interfaces/IFormViewField";
19
20
  import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver, StatusResolverFunction } from "./components/ez-grid/controller/EzGridController";
20
21
  import { ISelection, ISelectionToastConfig } from "./components/ez-grid/interfaces";
@@ -352,6 +353,10 @@ export namespace Components {
352
353
  * Retorna se o conteúdo é inválido.
353
354
  */
354
355
  "isInvalid": () => Promise<boolean>;
356
+ /**
357
+ * Informa se a pesquisa é do tipo texto.
358
+ */
359
+ "isTextSearch": boolean;
355
360
  /**
356
361
  * Texto a ser apresentado como título do campo.
357
362
  */
@@ -910,6 +915,10 @@ export namespace Components {
910
915
  * Classe que implementa o método fetchData, responsável por realizar a pesquisa dos dados, com base no termo informado pelo usuário.
911
916
  */
912
917
  "dataSource": IMultiSelectionListDataSource;
918
+ /**
919
+ * Informa se a pesquisa é do tipo texto.
920
+ */
921
+ "isTextSearch": boolean;
913
922
  /**
914
923
  * Opções de filtros a serem exibidas na listagem.
915
924
  */
@@ -1088,6 +1097,10 @@ export namespace Components {
1088
1097
  * Retorna se o conteúdo é inválido.
1089
1098
  */
1090
1099
  "isInvalid": () => Promise<boolean>;
1100
+ /**
1101
+ * Informa se a pesquisa é do tipo texto.
1102
+ */
1103
+ "isTextSearch": boolean;
1091
1104
  /**
1092
1105
  * Texto a ser apresentado como título do campo.
1093
1106
  */
@@ -1491,6 +1504,7 @@ export namespace Components {
1491
1504
  "dataUnit": DataUnit;
1492
1505
  "gridHeaderHidden": boolean;
1493
1506
  "hide": () => Promise<void>;
1507
+ "noHeaderTaskBar": boolean;
1494
1508
  "opened": boolean;
1495
1509
  "options": IMultiSelectionOption[];
1496
1510
  /**
@@ -2284,6 +2298,10 @@ declare namespace LocalJSX {
2284
2298
  * Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
2285
2299
  */
2286
2300
  "hideErrorOnFocusOut"?: boolean;
2301
+ /**
2302
+ * Informa se a pesquisa é do tipo texto.
2303
+ */
2304
+ "isTextSearch"?: boolean;
2287
2305
  /**
2288
2306
  * Texto a ser apresentado como título do campo.
2289
2307
  */
@@ -2562,6 +2580,10 @@ declare namespace LocalJSX {
2562
2580
  * Evento disparado quando o formulário está disponível na DOM.
2563
2581
  */
2564
2582
  "onEzReady"?: (event: EzFormCustomEvent<void>) => void;
2583
+ /**
2584
+ * Responsável por notificar quando ocorrer a renderização de itens do formulário.
2585
+ */
2586
+ "onFormItemsReady"?: (event: EzFormCustomEvent<FormItems>) => void;
2565
2587
  /**
2566
2588
  * Define um validador responsável pela integridade dos registros.
2567
2589
  */
@@ -2576,6 +2598,10 @@ declare namespace LocalJSX {
2576
2598
  * Evento emitido quando o componente foi totalmente carregado na DOM.
2577
2599
  */
2578
2600
  "onEzContentReady"?: (event: EzFormViewCustomEvent<Array<HTMLElement>>) => void;
2601
+ /**
2602
+ * Responsável por notificar quando ocorrer a renderização de itens do formulário.
2603
+ */
2604
+ "onFormItemsReady"?: (event: EzFormViewCustomEvent<FormItems>) => void;
2579
2605
  }
2580
2606
  interface EzGrid {
2581
2607
  /**
@@ -2804,6 +2830,10 @@ declare namespace LocalJSX {
2804
2830
  * Classe que implementa o método fetchData, responsável por realizar a pesquisa dos dados, com base no termo informado pelo usuário.
2805
2831
  */
2806
2832
  "dataSource"?: IMultiSelectionListDataSource;
2833
+ /**
2834
+ * Informa se a pesquisa é do tipo texto.
2835
+ */
2836
+ "isTextSearch"?: boolean;
2807
2837
  /**
2808
2838
  * Evento que informa que a lista de opções selecionadas sofreu alteração.
2809
2839
  */
@@ -2972,6 +3002,10 @@ declare namespace LocalJSX {
2972
3002
  * Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
2973
3003
  */
2974
3004
  "hideErrorOnFocusOut"?: boolean;
3005
+ /**
3006
+ * Informa se a pesquisa é do tipo texto.
3007
+ */
3008
+ "isTextSearch"?: boolean;
2975
3009
  /**
2976
3010
  * Texto a ser apresentado como título do campo.
2977
3011
  */
@@ -3316,6 +3350,7 @@ declare namespace LocalJSX {
3316
3350
  "dataSource"?: IMultiSelectionListDataSource;
3317
3351
  "dataUnit"?: DataUnit;
3318
3352
  "gridHeaderHidden"?: boolean;
3353
+ "noHeaderTaskBar"?: boolean;
3319
3354
  "onApplyFilterColumnOptions"?: (event: FilterColumnCustomEvent<IAppliedFilterColumnOptions>) => void;
3320
3355
  "opened"?: boolean;
3321
3356
  "options"?: IMultiSelectionOption[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/ezui",
3
- "version": "5.11.0-dev.4",
3
+ "version": "5.11.0-dev.6",
4
4
  "description": "Biblioteca de componentes Sankhya.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/custom-elements/index.js",
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s,F as e,H as h}from"./p-e318d280.js";import{ArrayUtils as l}from"@sankhyalabs/core";var o;!function(t){t.DATASOURCE_RESULTS="DATASOURCE_RESULTS",t.DATASOURCE_RESULTS_EMPTY="DATASOURCE_RESULTS_EMPTY",t.DATASOURCE_INIT="DATASOURCE_INIT",t.OPTIONS_EMPTY="OPTIONS_EMPTY",t.OPTIONS="OPTIONS"}(o||(o={}));const n=class{constructor(s){t(this,s),this.changeFilteredOptions=i(this,"changeFilteredOptions",7),this.columnName=void 0,this.dataSource=void 0,this.useOptions=!1,this.options=void 0,this.filteredOptions=void 0,this.displayOptions=void 0,this.viewScenario=void 0,this.displayOptionToCheckAllItems=!0}async clearFilteredOptions(){this.setInitialScenario(),this.filteredOptions=[],this.searchInput&&(this.searchInput.value=""),this.filterInput&&(this.filterInput.value="")}onChangeUseOptions(){this.setInitialScenario()}onChangeOptions(){this.options&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.options)),this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.setInitialScenario()}onChangeFilteredOptions(t){this.displayOptions=this.filteredOptions,this.displayOptionToCheckAllItems=this.filteredOptions.length>1,this.checkInput&&this.changeCheckAllValeuFromFilteredOptions(),this.changeFilteredOptions.emit(t)}componentDidRender(){this.changeCheckAllValeuFromFilteredOptions()}ordenationByCheckStateAndAlphabetically(t){const i=[],s=[];return t.forEach((t=>t.check?i.push(t):s.push(t))),[...l.sortAlphabetically(i),...l.sortAlphabetically(s)]}changeCheckAllValeuFromFilteredOptions(){var t,i,s,e;const h=null===(t=this.filteredOptions)||void 0===t?void 0:t.every((t=>!0===t.check)),l=null===(i=this.filteredOptions)||void 0===i?void 0:i.every((t=>!1===t.check)),o=(null===(s=this.filteredOptions)||void 0===s?void 0:s.some((t=>!1===t.check)))&&(null===(e=this.filteredOptions)||void 0===e?void 0:e.some((t=>!0===t.check)))&&(!h||!l);return this.checkInput&&h?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!0)):this.checkInput&&o?(this.checkInput.indeterminate=!0,void(this.checkInput.value=!1)):this.checkInput&&l?(this.checkInput.indeterminate=!1,void(this.checkInput.value=!1)):void 0}setInitialScenario(){if(this.useOptions)return this.viewScenario=o.OPTIONS,void this.changeCheckAllValeuFromFilteredOptions();this.viewScenario=this.options&&this.options.length>0?o.DATASOURCE_RESULTS:o.DATASOURCE_INIT}async searchWithDataSource(t,i){const{argument:s,mode:e}=t;if("PRELOAD"!==e)return this.dataSource.fetchData(s,i)}handleSearchOnDataSource(t){var i;const s=null!==(i=this.filteredOptions)&&void 0!==i?i:[];t.detail&&!s.some((i=>i.value==t.detail.value))&&(this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...s,t.detail])),this.viewScenario=o.DATASOURCE_RESULTS}handleRemoveItemFromOptions(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically(this.filteredOptions.filter((i=>i.value!==t.value))),0===this.filteredOptions.length&&(this.viewScenario=o.DATASOURCE_INIT),this.searchInput&&(this.searchInput.value="")}handleSearchOnOption(t){if(t.detail)return this.displayOptions=l.applyStringFilter(t.detail,this.filteredOptions,!0),void(this.viewScenario=0===this.displayOptions.length?o.OPTIONS_EMPTY:o.OPTIONS);this.displayOptions=this.filteredOptions,this.viewScenario=o.OPTIONS}handleChangeSelectAllItems(t){this.filteredOptions=this.ordenationByCheckStateAndAlphabetically([...this.filteredOptions.map((i=>(i.check=!!t.detail,i)))])}handleChangeSelectedItem(t){const{detail:i}=t;this.filteredOptions=this.filteredOptions.map((t=>t.label===i.label?Object.assign(Object.assign({},t),{check:i.check}):t)),this.clearInputs()}clearInputs(){this.filterInput?this.filterInput.value="":this.searchInput.value=""}buildViewList(t){return s(e,null,this.displayOptionToCheckAllItems&&s("ez-check",{ref:t=>this.checkInput=t,label:"Selecionar todos",class:"multi-selection__select-all",onEzChange:this.handleChangeSelectAllItems.bind(this)}),s("ez-list",{class:"multi-selection__list",dataSource:this.displayOptions,listMode:"check",hoverFeedback:!0,onEzCheckChange:this.handleChangeSelectedItem.bind(this),itemSlotBuilder:t?this.buildDeleteIconSlot.bind(this):null}))}buildDeleteIconSlot(t){return s("ez-icon",{style:{cursor:"pointer"},iconName:"delete",onClick:()=>this.handleRemoveItemFromOptions(t)})}buildInitViewWithDataSource(){return s("multi-selection-box-message",{message:"Selecione os valores a serem filtrados através do campo de busca."})}buildViewEmptyResults(){return s("multi-selection-box-message",{message:"Nenhum resultado encontrado."})}scenarioToDisplay(t){return{[o.DATASOURCE_INIT]:this.buildInitViewWithDataSource(),[o.DATASOURCE_RESULTS]:this.buildViewList(!0),[o.DATASOURCE_RESULTS_EMPTY]:this.buildViewEmptyResults(),[o.OPTIONS_EMPTY]:this.buildViewEmptyResults(),[o.OPTIONS]:this.buildViewList(!1)}[t]}render(){return s(h,null,s("div",{class:"multi-selection"},this.useOptions?s("ez-filter-input",{ref:t=>this.filterInput=t,label:"Buscar..",onEzChange:this.handleSearchOnOption.bind(this)}):s("ez-search",{class:"multi-selection__input",label:"Buscar...",ref:t=>this.searchInput=t,suppressEmptyOption:!0,showOptionValue:!1,showSelectedValue:!1,optionLoader:t=>this.searchWithDataSource(t,this.columnName),onEzChange:this.handleSearchOnDataSource.bind(this)}),s("ez-scroll",{class:"multi-selection__content-options"},this.scenarioToDisplay(this.viewScenario))))}static get watchers(){return{useOptions:["onChangeUseOptions"],options:["onChangeOptions"],filteredOptions:["onChangeFilteredOptions"]}}};n.style=".sc-ez-multi-selection-list-h{--ez-check--outter-gap:0px;display:block;width:304px;height:322px;max-height:calc(100vh - 350px)}.multi-selection__input.sc-ez-multi-selection-list{margin-bottom:var(--space--2xs, 8px)}.multi-selection__content-options.sc-ez-multi-selection-list{position:relative;top:-12px;left:-4px}.multi-selection__select-all.sc-ez-multi-selection-list{height:var(--space--xl);margin:0 var(--space--small, 6px)}.multi-selection__list.sc-ez-multi-selection-list{height:235px;max-height:calc(100vh - 435px);overflow-y:auto;overflow-x:clip}.multi-selection__list.sc-ez-multi-selection-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";export{n as ez_multi_selection_list}
@@ -1 +0,0 @@
1
- import{r as i,c as t,h as o,H as s,g as e}from"./p-e318d280.js";import{ObjectUtils as r,FloatingManager as l,StringUtils as a,ElementIDUtils as h}from"@sankhyalabs/core";import{A as n}from"./p-f15ec3bb.js";import{C as c}from"./p-7eb3e1a5.js";import"./p-ab574d59.js";import"./p-b853763b.js";import{R as b}from"./p-27a01a26.js";const d=class{constructor(o){i(this,o),this.ezChange=t(this,"ezChange",7),this._changeDeboucingTimeout=null,this._limitCharsToSearch=3,this._deboucingTime=300,this._maxWidthValue=0,this._tabPressed=!1,this._textEmptyList="Nenhum resultado encontrado",this._textEmptySearch="Nenhum resultado de {0} encontrado",this._lookupMode=!1,this._preSelection=void 0,this._visibleOptions=void 0,this._startLoading=!1,this._showLoading=!0,this._criteria=void 0,this.value=void 0,this.label=void 0,this.enabled=!0,this.options=void 0,this.errorMessage=void 0,this.searchMode=void 0,this.showSelectedValue=!1,this.showOptionValue=!1,this.suppressSearch=!1,this.optionLoader=void 0,this.suppressEmptyOption=!1,this.canShowError=!0,this.mode="regular",this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0}observeErrorMessage(){var i;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(i=this.errorMessage)||void 0===i?void 0:i.trim())||this.setInputValue())}observeValue(i,t){if(this._textInput&&i!=t)try{if(this.searchMode&&"string"==typeof i)return void this.setInputValue();const o=this.getSelectedOption(i),s=this.getSelectedOption(t),e=this.getSelectedOption(this.value);this.isDifferentValues(e,o)&&(this.value=o),this.isDifferentValues(o,s)&&(this.setInputValue(),this._lookupMode||this.ezChange.emit(null===o?void 0:o)),this.resetOptions()}finally{this._lookupMode=!1}}observeOptions(i,t){(null==i?void 0:i.join(""))!==(null==t?void 0:t.join(""))&&this.loadOptions(m.PRELOAD)}async getValueAsync(){return new Promise(this._showLoading?i=>{let t=setInterval((()=>{this._showLoading||(clearInterval(t),i(this.value))}),100)}:i=>i(this.value))}async setFocus(){this._textInput&&this._textInput.setFocus()}async setBlur(){this._textInput&&this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){this.clearSearch()}scrollListener(){var i;null!=this._floatingID&&((null===(i=this.listOptionsPosition)||void 0===i?void 0:i.hardPosition)?this.hideOptions():window.requestAnimationFrame((()=>{this.updateListPosition()})))}updateListPosition(){let{verticalPosition:i,horizontalPosition:t,fromBottom:o,fromRight:s,bottomLimit:e,hardPosition:r}=this.getListPosition();const l=this._listWrapper.getBoundingClientRect(),a=this._listContainer.getBoundingClientRect(),h=this._textInput.getBoundingClientRect(),n=e||window.innerHeight;!o&&(l.top<0||a.bottom+l.height>n)&&(o=!0),r||(i=i||0,t=t||0,o?i=window.innerHeight-h.top+i:i+=a.top,s?t=window.innerWidth-h.right+t:t+=a.left),null!=i&&(this._listWrapper.style[o?"bottom":"top"]=`${i}px`,this._listWrapper.style[o?"top":"bottom"]=""),null!=t&&(this._listWrapper.style[s?"right":"left"]=`${t}px`,this._listWrapper.style[s?"left":"right"]="")}getListPosition(){return this.listOptionsPosition?this.listOptionsPosition:{verticalPosition:this.errorMessage||!this.canShowError||"slim"===this.mode?6:-13}}isDifferentValues(i,t){return r.objectToString(i||{})!==r.objectToString(t||{})}getFormattedText(i){if(null!=i)return this.showSelectedValue&&null!=i.value?i.label?`${i.value} - ${i.label}`:i.value:i.label}getText(){const i=this.getSelectedOption(this.value),t=this.getFormattedText(i);if(null!=t)return String(t).replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"')}getSelectedOption(i){return"string"==typeof i||i instanceof String?this._visibleOptions.find((t=>t.value===i)):i}updateVisibleOptions(){let i=this._source||[];if(!this.searchMode&&this._criteria){const t=this._criteria.toUpperCase();i=i.filter((i=>i.label.toLocaleUpperCase().indexOf(t)>-1))}this._visibleOptions=this.suppressEmptyOption?i:[{value:void 0,label:""}].concat(i),this._maxWidthValue=this.getMaxWidthValue()}getMaxWidthValue(){var i;if(this.showOptionValue){const t=[];return null===(i=this._visibleOptions)||void 0===i||i.forEach((i=>{const o=this.getWidthValue(i.value);t.includes(o)||t.push(o)})),t.length>1?Math.max(...t):0}return 0}getWidthValue(i){if(null!=this._itemValueBasis){const t=this._itemValueBasis;if(null!=i)return t.innerHTML=i,t.clientWidth>0?t.clientWidth+2:0;t.innerHTML=""}return 0}buildItem(i,t){const s=this.showOptionValue&&this._maxWidthValue>0?`${this._maxWidthValue}px`:"";return i.label=i.label||i.value,o("li",{class:t===this._preSelection?"item preselected":"item",id:`item_${i.value}`,onMouseDown:()=>this.selectOption(i),onMouseOver:()=>this._preSelection=t},this.showOptionValue?o("span",{class:"item__value",title:i.value,style:{width:s,minWidth:s,maxWidth:s}},i.value):void 0,o("span",{class:"item__label "+(this.showOptionValue?"item__label--bold":""),title:i.label},i.label))}showOptions(){this.enabled&&(this.isOptionsVisible()||(this._resizeObserver&&this._resizeObserver.observe(this._textInput),this._floatingID=l.float(this._listWrapper,this._listContainer,{autoClose:!0,isFixed:!0,backClickListener:()=>this.hideOptions()}),this.setFocus(),window.requestAnimationFrame((()=>{this.updateListPosition(),this.listOptionsPosition||this._listWrapper.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}))))}hideOptions(){void 0!==this._floatingID&&l.close(this._floatingID),this._floatingID=void 0,this._resizeObserver&&this._resizeObserver.unobserve(this._textInput)}isOptionsVisible(){return void 0!==this._floatingID&&l.isFloating(this._floatingID)}nextOption(){this.searchMode&&!this.isOptionsVisible()||(this.showOptions(),this._preSelection=void 0===this._preSelection?0:Math.min(this._preSelection+1,this._visibleOptions.length-1),this.scrollToOption(this._visibleOptions[this._preSelection]))}previousOption(){this._preSelection=void 0===this._preSelection?0:Math.max(this._preSelection-1,0),this.scrollToOption(this._visibleOptions[this._preSelection])}scrollToOption(i){window.requestAnimationFrame((()=>{const t=(null==i?void 0:i.value)?this._optionsList.querySelector(`li#item_${i.value.replace(/[<>\[\]#=]/g,"\\$&").replace(/:/g,"\\:")}`):void 0;t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}))}selectCurrentOption(){void 0!==this._preSelection?(this.selectOption(this._visibleOptions[this._preSelection]),this._preSelection=void 0):this.controlListWithOnlyOne()}updateSource(i){this._startLoading=!1,i instanceof Promise?(this._showLoading=!0,i.then((i=>{this._showLoading=!1,this.updateSource(i)})).catch((()=>this._showLoading=!1)),this.updateVisibleOptions()):(this._showLoading=!1,Array.isArray(i)?(this._source=i,this.updateVisibleOptions(),this._tabPressed&&(this._tabPressed=!1,this.controlEmptySearch())):this.selectOption(i))}clearSource(){this._source=[],this.updateVisibleOptions()}selectOption(i){var t,o;const s=this.getSelectedOption(this.value);(null===(t=null==s?void 0:s.value)||void 0===t?void 0:t.toString())!==(null===(o=null==i?void 0:i.value)||void 0===o?void 0:o.toString())||null==s&&null!=i&&"value"in i?this.value=(null==i?void 0:i.value)?i:void 0:this.resetOptions(),this.searchMode&&(this._visibleOptions=[],this.clearSource()),this.setFocus()}loadOptions(i,t=""){this._criteria=t,this._startLoading=!0,this.updateSource(this.optionLoader?this.optionLoader({mode:i,argument:t}):this.options)}cancelPreselection(){!this._textInput.value&&this.value?this.selectOption(void 0):window.setTimeout((()=>{this.setInputValue()}),this._deboucingTime),this.resetOptions()}setInputValue(i=!0){const t=this.getText();(this._textInput.value||"")!==t&&(this._textInput.value=t,i&&(this.errorMessage=null))}clearSearch(){this.value=null}controlListWithOnlyOne(){var i;if(this.searchMode){const t=null===(i=this._visibleOptions)||void 0===i?void 0:i.filter((i=>""!==i.label&&null!=i.value));1===(null==t?void 0:t.length)&&this.selectOption(t[0])}}controlEmptySearch(){var i;this.searchMode&&((null===(i=this._visibleOptions)||void 0===i?void 0:i.length)?this.controlListWithOnlyOne():(this.clearSearch(),n.info(this._textEmptyList)))}validateDescriptionValue(){if(!this.searchMode||a.isEmpty(this.value))return;let i=this.value;"object"!=typeof i&&(a.isEmpty(i)||this.loadDescriptionValue(i))}async loadDescriptionValue(i){var t,o;if(null==i)return;if((null===(t=this.options)||void 0===t?void 0:t.length)>0)return void this.loadOptionValue(i);const s={mode:m.PREDICTIVE,argument:i},e=await(null===(o=this.optionLoader)||void 0===o?void 0:o.call(this,s));null!=e&&(e instanceof Promise?e.then((i=>{this.setDescriptionValue(i)})):this.setDescriptionValue(e))}setDescriptionValue(i){const t=(null==i?void 0:i[0])||i;null!=t&&Object.keys(t).length?(this._lookupMode=!0,this.value=t):this.showNoResultMessage()}loadOptionValue(i){var t;const o=null===(t=this.options)||void 0===t?void 0:t.find((t=>t.value===i));null!=o?this.selectOption(o):this.showNoResultMessage()}async showNoResultMessage(){this.clearSearch(),n.info(this._textEmptySearch.replace("{0}",this.getFieldLabel()))}getFieldLabel(){var i;return null===(i=this.label)||void 0===i?void 0:i.replace(b,"").toUpperCase()}resetOptions(){this.hideOptions(),this._criteria=void 0,this._preSelection=void 0,this.updateVisibleOptions()}componentWillLoad(){if(void 0===this.options){this.options=[];const i=this.el.querySelectorAll("option");i&&i.forEach((i=>{let t=i.innerText,o=i.getAttribute("value");o||(o=t),this.options.push({label:t,value:o}),i.hidden=!0}))}this.searchMode?this.updateSource([]):this.loadOptions(m.PRELOAD)}componentDidRender(){var i;void 0===this._floatingID&&this._listWrapper.remove(),null===(i=this._optionsList)||void 0===i||i.querySelectorAll(".item").forEach((i=>{h.addIDInfoIfNotExists(i,"itemComboBox")})),this.validateDescriptionValue()}componentDidLoad(){c.applyVarsTextInput(this.el,this._textInput),this.setInputValue(!1),this._resizeObserver=new ResizeObserver((i=>{window.requestAnimationFrame((()=>{if(!Array.isArray(i)||!i.length)return;const{clientWidth:t}=this._listContainer;t>0&&this._listWrapper&&(this._listWrapper.style.width=`${t}px`)}))}))}handlerIconClick(){this.searchMode?this.loadOptions(m.ADVANCED):this.showOptions()}onTextInputChangeHandler(i){var t;if(this.clearDeboucingTimeout(),this._startLoading)return void(this._changeDeboucingTimeout=window.setTimeout((()=>{this.onTextInputChangeHandler(i)}),this._deboucingTime));const o=null===(t=i.target.value)||void 0===t?void 0:t.trim(),s=Number(o||void 0);this._criteria||(this._textInput.value=i.data||o),this._criteria=o,o?this.searchMode?(this._showLoading=!1,this.clearSource(),!isNaN(s)||o.length>=this._limitCharsToSearch?(this._showLoading=!0,this._changeDeboucingTimeout=window.setTimeout((()=>{this.loadOptions(m.PREDICTIVE,isNaN(s)?o:s.toString())}),this._deboucingTime),this.showOptions()):this.hideOptions()):(this.updateVisibleOptions(),this.showOptions()):(this.hideOptions(),this.searchMode?(this._showLoading=!1,this.clearSource()):this.updateVisibleOptions())}clearDeboucingTimeout(){this._changeDeboucingTimeout&&(window.clearTimeout(this._changeDeboucingTimeout),this._changeDeboucingTimeout=null)}onTextInputClickHandler(){this.searchMode||this.showOptions()}keyDownHandler(i){switch(this._tabPressed=!1,i.ctrlKey&&("f"!==i.key&&"F"!==i.key||(this.loadOptions(m.ADVANCED),i.stopPropagation(),i.stopImmediatePropagation(),i.preventDefault())),i.key){case"ArrowDown":this.nextOption(),i.stopPropagation();break;case"ArrowUp":this.previousOption(),i.stopPropagation();break;case"Enter":this.selectCurrentOption();break;case"Escape":this.cancelPreselection();break;case"Tab":this._tabPressed=!0,this.controlListWithOnlyOne()}}onTextInputFocusOutHandler(){this.hideErrorOnFocusOut&&this.cancelPreselection()}canShowListOptions(){return!this._showLoading&&this._visibleOptions.length>0}render(){var i;return h.addIDInfoIfNotExists(this.el,"input"),o(s,null,o("ez-text-input",{"data-element-id":h.getInternalIDInfo("textInput"),class:this.suppressSearch?"suppressed-search-input":"",ref:i=>this._textInput=i,"data-slave-mode":"true",enabled:this.enabled&&!this.suppressSearch,onInput:i=>this.onTextInputChangeHandler(i),onClick:()=>this.onTextInputClickHandler(),onFocusout:()=>this.onTextInputFocusOutHandler(),onKeyDown:i=>this.keyDownHandler(i),label:this.label,canShowError:this.canShowError,errorMessage:this.errorMessage,mode:this.mode},o("button",{class:"btn",slot:this.searchMode?"leftIcon":"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.handlerIconClick()},o("ez-icon",{iconName:this.searchMode?"search":"chevron-down"})),this.searchMode&&(null===(i=this._textInput)||void 0===i?void 0:i.value)&&(this._criteria||this.value)?o("button",{class:"btn btn__close",slot:"rightIcon",disabled:!this.enabled,tabindex:-1,onClick:()=>this.clearSearch()},o("ez-icon",{iconName:"close"})):void 0),o("section",{class:"list-container",ref:i=>this._listContainer=i},o("div",{class:"list-wrapper",ref:i=>this._listWrapper=i},o("ul",{class:"list-options",ref:i=>this._optionsList=i},!this._showLoading&&0===this._visibleOptions.length&&o("div",{class:"message"},o("span",{class:"message__no-result"},this._textEmptyList)),this._showLoading&&o("div",{class:"message"},o("div",{class:"message__loading"})),this.showOptionValue?o("span",{class:"item__value item__value--hidden",ref:i=>this._itemValueBasis=i}):void 0,this.canShowListOptions()&&this._visibleOptions.map(((i,t)=>this.buildItem(i,t)))))))}get el(){return e(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"],options:["observeOptions"]}}};var m;!function(i){i.ADVANCED="ADVANCED",i.PRELOAD="PRELOAD",i.PREDICTIVE="PREDICTIVE"}(m||(m={})),d.style=":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)}}";export{d as ez_combo_box}
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s}from"./p-e318d280.js";import{UserInterface as e}from"@sankhyalabs/core";const o=window,l=new CustomEvent("onSubmitFilter",{detail:{showToast:!0}}),n=class{constructor(s){t(this,s),this.applyFilterColumnOptions=i(this,"applyFilterColumnOptions",7),this.TOP_POSITION="65px",this.TOP_POSITION_HEADER_HIDDEN="18",this.DEFAULT_HEIGHT=430,this.opened=!0,this.columnName=void 0,this.columnLabel=void 0,this.gridHeaderHidden=!1,this.dataSource=void 0,this.dataUnit=void 0,this.options=void 0,this.selectedItems=void 0,this.fieldDescriptor=void 0,this.useOptions=!1}async hide(){await this.ezPopoverElement.hide(),await this.clearConfigs()}async show(t){this.canShow(t)&&(await this.hide(),this.fieldDescriptor=this.dataUnit.getField(t.columnName),this.setOptions(t.filteredOptions),this.columnName=t.columnName,this.columnLabel=t.columnLabel,await this.ezPopoverElement.show(this.calcTopPosition(),t.leftPosition))}calcTopPosition(){const t=this.gridHeaderHidden?this.TOP_POSITION_HEADER_HIDDEN:this.TOP_POSITION.replace("px",""),i=parseInt(t)+this.DEFAULT_HEIGHT,s=Math.round(this.ezPopoverElement.getBoundingClientRect().top)+i,e=window.innerHeight;return e>s?t:e-s+"px"}async clearConfigs(){var t;await(null===(t=this.ezMultiSelectionList)||void 0===t?void 0:t.clearFilteredOptions()),this.options=null,this.columnName=null}canShow(t){return!this.ezPopoverElement.opened||t.columnName!==this.columnName}submit(){this.applyFilterColumnOptions.emit({field:this.columnName,values:this.selectedItems}),o.dispatchEvent(l),this.hide()}changeSelectedItems(t){this.selectedItems=t}hasToUseOptions(){return this.fieldDescriptor.userInterface===e.OPTIONSELECTOR||this.fieldDescriptor.userInterface===e.SWITCH||this.fieldDescriptor.userInterface===e.CHECKBOX}isCheckBoxOrSwitch(){return this.fieldDescriptor.userInterface===e.SWITCH||this.fieldDescriptor.userInterface===e.CHECKBOX}setOptions(t){const i=this.hasToUseOptions();this.useOptions=i,this.options=i?this.buildOptions(t):null!=t?t:null}buildOptions(t){var i,s;if(t&&t.length>0)return t;if(this.isCheckBoxOrSwitch())return[{label:"Sim",value:"true",check:!0},{label:"Não",value:"false",check:!0}];const e=JSON.parse(null===(s=null===(i=this.fieldDescriptor)||void 0===i?void 0:i.properties)||void 0===s?void 0:s.options);return Object.keys(e).map((t=>({label:e[t],value:t,check:!0})))}handleEzVisibilityChange(t){!1===t.detail&&this.clearConfigs()}render(){return s("ez-popover",{class:"filter-column__popover","overlay-type":"none",ref:t=>this.ezPopoverElement=t,autoClose:!0,onEzVisibilityChange:this.handleEzVisibilityChange.bind(this)},s("section",{class:"filter-column"},s("header",{class:"filter-column__header"},s("span",{class:"ez-text ez-text--medium filter-column__header-title"},"Filtro da coluna ",this.columnLabel),s("ez-button",{mode:"icon","icon-name":"close",class:"ez-button--tertiary",onClick:()=>this.hide()})),s("ez-multi-selection-list",{columnName:this.columnName,dataSource:this.dataSource,options:this.options,useOptions:this.useOptions,ref:t=>this.ezMultiSelectionList=t,onChangeFilteredOptions:t=>this.changeSelectedItems(t.detail)}),s("footer",{class:"filter-column__footer"},s("ez-button",{label:"Aplicar",class:"ez-button--primary",onClick:this.submit.bind(this)}))))}};n.style=".filter-column{padding:var(--space--2xs, 8px);position:relative}.filter-column__header{margin-bottom:var(--space--2xs, 8px);display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:var(--space--xl, 32px)}.filter-column__footer{position:relative;display:flex;flex-direction:row;justify-content:flex-end;align-items:center;width:100%;bottom:0;left:0;padding-top:var(--space--2xs, 8px);border-top:var(--border--medium) var(--color--disable-secondary)}.filter-column__popover{position:absolute}.filter-column__header-title{margin-left:8px}";export{n as filter_column}
@@ -1 +0,0 @@
1
- import{h as e,r as a,c as l,H as o,g as n}from"./p-e318d280.js";import{ObjectUtils as t,UserInterface as r,ElementIDUtils as d}from"@sankhyalabs/core";import{R as s}from"./p-27a01a26.js";import{C as c}from"./p-b853763b.js";function i(a,l,o,n,t){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large"},e("ez-check",{enabled:!o,label:l,mode:t?c.SWITCH:c.REGULAR,"data-field-name":a,"data-context-name":n,key:a}))}function m(a,l,o,n,t,r,d){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-number-input",{enabled:!o,label:l,precision:n,prettyPrecision:t,"data-field-name":a,"data-context-name":r,key:a,canShowError:d}))}const z=({name:a,label:l,readOnly:o,contextName:n,canShowError:t})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-text-input",{label:l,"data-field-name":a,"data-context-name":n,key:a,enabled:!o,canShowError:t})),b=new Map;b.set(r.CHECKBOX,(e=>i(e.name,e.label,e.readOnly,e.contextName,!1))),b.set(r.SWITCH,(e=>i(e.name,e.label,e.readOnly,e.contextName,!0))),b.set(r.OPTIONSELECTOR,(({name:a,label:l,readOnly:o,required:n,props:t,contextName:r,canShowError:d})=>{const s=null==t?void 0:t.options;let c;if("string"==typeof s){const e=JSON.parse(s);c=Object.keys(e).map((a=>({value:a,label:e[a]})))}else c=s;return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-combo-box",{enabled:!o,suppressEmptyOption:n,label:l,"data-field-name":a,"data-context-name":r,key:a,options:c,canShowError:d}))})),b.set(r.DATE,(({name:a,label:l,readOnly:o,canShowError:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-input",{enabled:!o,label:l,"data-field-name":a,key:a,canShowError:n})))),b.set(r.TIME,(({name:a,label:l,readOnly:o,canShowError:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-time-input",{enabled:!o,label:l,"data-field-name":a,key:a,canShowError:n})))),b.set(r.DATETIME,(({name:a,label:l,readOnly:o,contextName:n,canShowError:t})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-time-input",{enabled:!o,label:l,"data-field-name":a,"data-context-name":n,key:a,canShowError:t})))),b.set(r.FILE,(({name:a,label:l,readOnly:o,contextName:n,props:r})=>{const d=t.removeEmptyValues({subTitle:r.subTitle,requestHeaders:r.STORAGESTRATEGY?{STORAGESTRATEGY:r.STORAGESTRATEGY}:null});return e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small"},e("ez-upload",Object.assign({enabled:!o,label:l,"data-field-name":a,"data-context-name":n,key:a},d)))})),b.set(r.DECIMALNUMBER,(({name:e,label:a,readOnly:l,props:o,contextName:n,canShowError:t})=>{const r=Number((null==o?void 0:o.precision)||2);return m(e,a,l,r,Number((null==o?void 0:o.prettyPrecision)||r),n,t)})),b.set(r.INTEGERNUMBER,(({name:e,label:a,readOnly:l,contextName:o,canShowError:n})=>m(e,a,l,0,0,o,n))),b.set(r.SEARCH,(({name:a,label:l,readOnly:o,required:n,contextName:t,canShowError:r,optionLoader:d})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-search",{enabled:!o,suppressEmptyOption:n,label:l,"data-field-name":a,"data-context-name":t,key:a,canShowError:r,optionLoader:d})))),b.set(r.LONGTEXT,(({name:a,label:l,readOnly:o,contextName:n,rows:t,canShowError:r})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small",key:a},e("ez-text-area",{enabled:!o,label:l,"data-field-name":a,"data-context-name":n,rows:t,canShowError:r}))));const p=e=>{const a=b.get(e.userInterface)||z,l=e.required?`${e.label}${s}`:e.label;return a(Object.assign(Object.assign({},e),{label:l}))},h=class{constructor(e){a(this,e),this.ezContentReady=l(this,"ezContentReady",7),this.fields=void 0}async showUp(){this._element.scrollIntoView({behavior:"smooth",block:"start"})}groupFields(e){const a=new Map;return e.forEach((e=>{const l=e.group;if(l){let o=a.get(l);null==o&&(o=[],a.set(l,o)),o.push(e)}else a.set(e.name,e)})),a}componentDidRender(){this.ezContentReady.emit(Array.from(this._element.querySelectorAll("[data-field-name]")))}render(){if(d.addIDInfoIfNotExists(this._element,"ezFormView"),null!=this.fields)return e(o,null,Array.from(this.groupFields(this.fields).entries()).map((([a,l])=>Array.isArray(l)?e("ez-collapsible-box",{id:`group-${a}`,label:a,"header-size":"large",key:a},l.map((e=>p(e)))):p(l))))}get _element(){return n(this)}};h.style=".sc-ez-form-view-h{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}";export{h as ez_form_view}
@@ -1 +0,0 @@
1
- import{r as s,c as t,h as i,g as e}from"./p-e318d280.js";import{C as h}from"./p-7eb3e1a5.js";import{ElementIDUtils as o}from"@sankhyalabs/core";const r=class{constructor(i){s(this,i),this.ezChange=t(this,"ezChange",7),this.value=void 0,this.label=void 0,this.enabled=!0,this.errorMessage=void 0,this.optionLoader=void 0,this.showSelectedValue=!0,this.showOptionValue=!0,this.suppressEmptyOption=!1,this.mode="regular",this.canShowError=!0,this.hideErrorOnFocusOut=!0,this.listOptionsPosition=void 0}observeErrorMessage(){this._comboElement&&(this._comboElement.errorMessage=this.errorMessage)}observeValue(){this._comboElement&&(this._comboElement.value=this.value)}async setFocus(){this._comboElement.setFocus()}async setBlur(){this._comboElement.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}async clearValue(){var s,t;null===(t=null===(s=this._comboElement)||void 0===s?void 0:s.clearValue)||void 0===t||t.call(s)}async getValueAsync(){var s;return null===(s=this._comboElement)||void 0===s?void 0:s.getValueAsync()}onComboChange(s){s.stopPropagation(),this.value=s.detail,this.ezChange.emit(s.detail),this.errorMessage!==this._comboElement.errorMessage&&(this.errorMessage=this._comboElement.errorMessage)}componentDidLoad(){h.applyVarsTextInput(this._elem,this._comboElement)}render(){return o.addIDInfoIfNotExists(this._elem,"input"),i("ez-combo-box",{"data-element-id":o.getInternalIDInfo("combo"),ref:s=>this._comboElement=s,value:this.value,label:this.label,enabled:this.enabled,errorMessage:this.errorMessage,hideErrorOnFocusOut:this.hideErrorOnFocusOut,optionLoader:this.optionLoader,searchMode:!0,onEzChange:s=>this.onComboChange(s),showSelectedValue:this.showSelectedValue,showOptionValue:this.showOptionValue,suppressEmptyOption:this.suppressEmptyOption,mode:this.mode,canShowError:this.canShowError,listOptionsPosition:this.listOptionsPosition})}get _elem(){return e(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"]}}};r.style=":host{width:100%}";export{r as ez_search}