@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-08202.0 → 0.0.0-bugfix-dev-KB-6165.0
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.
- package/README.md +10 -8
- package/dist/cjs/ez-combo-box.cjs.entry.js +3 -11
- package/dist/cjs/ez-form-view.cjs.entry.js +1 -37
- package/dist/cjs/ez-form.cjs.entry.js +1 -2
- package/dist/cjs/ez-grid.cjs.entry.js +38 -87
- package/dist/cjs/ez-multi-selection-list.cjs.entry.js +1 -3
- package/dist/cjs/ez-search.cjs.entry.js +1 -3
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +7 -30
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +3 -47
- package/dist/collection/components/ez-form/ez-form.js +0 -20
- package/dist/collection/components/ez-form-view/ez-form-view.js +0 -23
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +1 -4
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.js +1 -1
- package/dist/collection/components/ez-grid/ez-grid.js +39 -11
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +8 -50
- package/dist/collection/components/ez-multi-selection-list/ez-multi-selection-list.js +1 -21
- package/dist/collection/components/ez-search/ez-search.js +1 -39
- package/dist/collection/utils/form/DataBinder.js +1 -1
- package/dist/custom-elements/index.js +57 -178
- package/dist/esm/ez-combo-box.entry.js +3 -11
- package/dist/esm/ez-form-view.entry.js +1 -37
- package/dist/esm/ez-form.entry.js +1 -2
- package/dist/esm/ez-grid.entry.js +39 -88
- package/dist/esm/ez-multi-selection-list.entry.js +1 -3
- package/dist/esm/ez-search.entry.js +1 -3
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +7 -30
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-2a0e1679.entry.js +1 -0
- package/dist/ezui/p-4535da17.entry.js +1 -0
- package/dist/ezui/p-4c8b029b.entry.js +1 -0
- package/dist/ezui/p-4e31b69b.entry.js +1 -0
- package/dist/ezui/p-5495fa45.entry.js +1 -0
- package/dist/ezui/p-90fa4cb3.entry.js +1 -0
- package/dist/ezui/{p-964e5571.entry.js → p-fd54b5b4.entry.js} +2 -2
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +0 -9
- package/dist/types/components/ez-form/ez-form.d.ts +0 -5
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +0 -5
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomHeader.d.ts +1 -1
- package/dist/types/components/ez-grid/ez-grid.d.ts +5 -3
- package/dist/types/components/ez-grid/subcomponents/filter-column.d.ts +0 -8
- package/dist/types/components/ez-multi-selection-list/ez-multi-selection-list.d.ts +0 -4
- package/dist/types/components/ez-search/ez-search.d.ts +0 -8
- package/dist/types/components.d.ts +0 -51
- package/package.json +2 -2
- package/dist/collection/components/ez-form-view/structure/index.js +0 -29
- package/dist/collection/components/ez-grid/utils/InMemoryFilterColumnDataSource.js +0 -78
- package/dist/ezui/p-061f4d73.entry.js +0 -1
- package/dist/ezui/p-25562cf8.entry.js +0 -1
- package/dist/ezui/p-5e55a42b.entry.js +0 -1
- package/dist/ezui/p-6ab2f7c2.entry.js +0 -1
- package/dist/ezui/p-7526f2b6.entry.js +0 -1
- package/dist/ezui/p-8fdff9cd.entry.js +0 -1
- package/dist/types/components/ez-form-view/structure/index.d.ts +0 -14
- package/dist/types/components/ez-grid/utils/InMemoryFilterColumnDataSource.d.ts +0 -16
|
@@ -75,18 +75,10 @@ export declare class EzComboBox {
|
|
|
75
75
|
* Define o tamanho do campo.
|
|
76
76
|
*/
|
|
77
77
|
mode: "slim" | "regular";
|
|
78
|
-
/**
|
|
79
|
-
* Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
|
|
80
|
-
*/
|
|
81
|
-
hideErrorOnFocusOut: boolean;
|
|
82
78
|
/**
|
|
83
79
|
* Define um posicionamento fixo para a lista de opções do CheckBox.
|
|
84
80
|
*/
|
|
85
81
|
listOptionsPosition: IEzCheckBoxListPosition;
|
|
86
|
-
/**
|
|
87
|
-
* Informa se a pesquisa é do tipo texto.
|
|
88
|
-
*/
|
|
89
|
-
isTextSearch: boolean;
|
|
90
82
|
/**
|
|
91
83
|
* Emitido quando acontece a alteração de valor do campo.
|
|
92
84
|
*/
|
|
@@ -149,7 +141,6 @@ export declare class EzComboBox {
|
|
|
149
141
|
componentDidRender(): void;
|
|
150
142
|
componentDidLoad(): void;
|
|
151
143
|
private handlerIconClick;
|
|
152
|
-
private buildNumberArgument;
|
|
153
144
|
private onTextInputChangeHandler;
|
|
154
145
|
private clearDeboucingTimeout;
|
|
155
146
|
private onTextInputClickHandler;
|
|
@@ -2,7 +2,6 @@ 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";
|
|
6
5
|
export declare class EzForm {
|
|
7
6
|
private _element;
|
|
8
7
|
private _store;
|
|
@@ -25,10 +24,6 @@ export declare class EzForm {
|
|
|
25
24
|
* Evento disparado quando o formulário está disponível na DOM.
|
|
26
25
|
*/
|
|
27
26
|
ezReady: EventEmitter<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Responsável por notificar quando ocorrer a renderização de itens do formulário.
|
|
30
|
-
*/
|
|
31
|
-
formItemsReady: EventEmitter<FormItems>;
|
|
32
27
|
/**
|
|
33
28
|
* Realiza validação no conteúdo de todos os campos.
|
|
34
29
|
*/
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { IFormViewField } from './interfaces/IFormViewField';
|
|
3
|
-
import { FormItems } from './structure';
|
|
4
3
|
export declare class EzFormView {
|
|
5
4
|
_element: HTMLEzFormViewElement;
|
|
6
5
|
/**
|
|
7
6
|
* Evento emitido quando o componente foi totalmente carregado na DOM.
|
|
8
7
|
*/
|
|
9
8
|
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>;
|
|
14
9
|
/**
|
|
15
10
|
* Define a lista de metadados usada para criar os campos de user interface.
|
|
16
11
|
*/
|
|
@@ -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
|
|
5
|
+
showColumnFilter?: (leftPosition: string) => 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 { EzGridColumn, EzGridColumnConfig,
|
|
4
|
+
import { EzGridColumStateEvent, EzGridColumn, EzGridColumnConfig, 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
|
|
22
|
+
private _originalRecords;
|
|
23
23
|
/**
|
|
24
24
|
* Emitido quando acontece a alteração de estado das colunas do grid: Ordenação, largura, etc.
|
|
25
25
|
*/
|
|
@@ -133,7 +133,9 @@ export declare class EzGrid {
|
|
|
133
133
|
componentWillRender(): void;
|
|
134
134
|
componentDidRender(): void;
|
|
135
135
|
componentWillLoad(): void;
|
|
136
|
+
onDataUnitAction: (action: any) => void;
|
|
136
137
|
private getDataSource;
|
|
137
|
-
private
|
|
138
|
+
private buildDefaultDataSource;
|
|
139
|
+
private formatLabel;
|
|
138
140
|
render(): any;
|
|
139
141
|
}
|
|
@@ -5,8 +5,6 @@ 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;
|
|
10
8
|
private readonly DEFAULT_HEIGHT;
|
|
11
9
|
private ezPopoverElement;
|
|
12
10
|
private ezMultiSelectionList;
|
|
@@ -15,24 +13,19 @@ export declare class FilterColumn {
|
|
|
15
13
|
columnName: string;
|
|
16
14
|
columnLabel: string;
|
|
17
15
|
gridHeaderHidden: boolean;
|
|
18
|
-
noHeaderTaskBar: boolean;
|
|
19
16
|
dataSource: IMultiSelectionListDataSource;
|
|
20
17
|
dataUnit: DataUnit;
|
|
21
18
|
options: IMultiSelectionOption[];
|
|
22
19
|
selectedItems: IMultiSelectionOption[];
|
|
23
20
|
fieldDescriptor: FieldDescriptor;
|
|
24
21
|
useOptions: boolean;
|
|
25
|
-
isTextSearch: boolean;
|
|
26
22
|
hide(): Promise<void>;
|
|
27
23
|
/**
|
|
28
24
|
* Abre o filtro de coluna.
|
|
29
25
|
* @Params IFilterColumnConfigs informações para configurar o filtro
|
|
30
26
|
*/
|
|
31
27
|
show(configs: IFilterColumnConfigs): Promise<void>;
|
|
32
|
-
private calculateLeftPosition;
|
|
33
|
-
private buildIsTextSearch;
|
|
34
28
|
private calcTopPosition;
|
|
35
|
-
private buildReferenceTopPosition;
|
|
36
29
|
private clearConfigs;
|
|
37
30
|
private canShow;
|
|
38
31
|
private submit;
|
|
@@ -49,7 +42,6 @@ export interface IFilterColumnConfigs {
|
|
|
49
42
|
columnLabel: string;
|
|
50
43
|
leftPosition: string;
|
|
51
44
|
filteredOptions?: IMultiSelectionOption[];
|
|
52
|
-
fromIcon?: boolean;
|
|
53
45
|
}
|
|
54
46
|
export interface IAppliedFilterColumnOptions {
|
|
55
47
|
field: string;
|
|
@@ -27,10 +27,6 @@ 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;
|
|
34
30
|
/**
|
|
35
31
|
* Guarda o estado das opções de filtragem (check = true ou false).
|
|
36
32
|
* @private
|
|
@@ -43,18 +43,10 @@ export declare class EzSearch {
|
|
|
43
43
|
* Se false deixa de exibir a mensagem de erro dentro do campo.
|
|
44
44
|
*/
|
|
45
45
|
canShowError: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
|
|
48
|
-
*/
|
|
49
|
-
hideErrorOnFocusOut: boolean;
|
|
50
46
|
/**
|
|
51
47
|
* Define um posicionamento fixo para a lista de opções do CheckBox.
|
|
52
48
|
*/
|
|
53
49
|
listOptionsPosition: IEzCheckBoxListPosition;
|
|
54
|
-
/**
|
|
55
|
-
* Informa se a pesquisa é do tipo texto.
|
|
56
|
-
*/
|
|
57
|
-
isTextSearch: boolean;
|
|
58
50
|
/**
|
|
59
51
|
* Emitido quando acontece a alteração de valor do campo.
|
|
60
52
|
*/
|
|
@@ -15,7 +15,6 @@ 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";
|
|
19
18
|
import { IFormViewField } from "./components/ez-form-view/interfaces/IFormViewField";
|
|
20
19
|
import { EzGridColumn, EzGridColumnConfig, EzGridColumStateEvent, IGridConfig, IStatusResolver, StatusResolverFunction } from "./components/ez-grid/controller/EzGridController";
|
|
21
20
|
import { ISelection, ISelectionToastConfig } from "./components/ez-grid/interfaces";
|
|
@@ -345,18 +344,10 @@ export namespace Components {
|
|
|
345
344
|
*/
|
|
346
345
|
"errorMessage": string;
|
|
347
346
|
"getValueAsync": () => Promise<unknown>;
|
|
348
|
-
/**
|
|
349
|
-
* Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
|
|
350
|
-
*/
|
|
351
|
-
"hideErrorOnFocusOut": boolean;
|
|
352
347
|
/**
|
|
353
348
|
* Retorna se o conteúdo é inválido.
|
|
354
349
|
*/
|
|
355
350
|
"isInvalid": () => Promise<boolean>;
|
|
356
|
-
/**
|
|
357
|
-
* Informa se a pesquisa é do tipo texto.
|
|
358
|
-
*/
|
|
359
|
-
"isTextSearch": boolean;
|
|
360
351
|
/**
|
|
361
352
|
* Texto a ser apresentado como título do campo.
|
|
362
353
|
*/
|
|
@@ -915,10 +906,6 @@ export namespace Components {
|
|
|
915
906
|
* Classe que implementa o método fetchData, responsável por realizar a pesquisa dos dados, com base no termo informado pelo usuário.
|
|
916
907
|
*/
|
|
917
908
|
"dataSource": IMultiSelectionListDataSource;
|
|
918
|
-
/**
|
|
919
|
-
* Informa se a pesquisa é do tipo texto.
|
|
920
|
-
*/
|
|
921
|
-
"isTextSearch": boolean;
|
|
922
909
|
/**
|
|
923
910
|
* Opções de filtros a serem exibidas na listagem.
|
|
924
911
|
*/
|
|
@@ -1089,18 +1076,10 @@ export namespace Components {
|
|
|
1089
1076
|
*/
|
|
1090
1077
|
"errorMessage": string;
|
|
1091
1078
|
"getValueAsync": () => Promise<unknown>;
|
|
1092
|
-
/**
|
|
1093
|
-
* Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
|
|
1094
|
-
*/
|
|
1095
|
-
"hideErrorOnFocusOut": boolean;
|
|
1096
1079
|
/**
|
|
1097
1080
|
* Retorna se o conteúdo é inválido.
|
|
1098
1081
|
*/
|
|
1099
1082
|
"isInvalid": () => Promise<boolean>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Informa se a pesquisa é do tipo texto.
|
|
1102
|
-
*/
|
|
1103
|
-
"isTextSearch": boolean;
|
|
1104
1083
|
/**
|
|
1105
1084
|
* Texto a ser apresentado como título do campo.
|
|
1106
1085
|
*/
|
|
@@ -1504,7 +1483,6 @@ export namespace Components {
|
|
|
1504
1483
|
"dataUnit": DataUnit;
|
|
1505
1484
|
"gridHeaderHidden": boolean;
|
|
1506
1485
|
"hide": () => Promise<void>;
|
|
1507
|
-
"noHeaderTaskBar": boolean;
|
|
1508
1486
|
"opened": boolean;
|
|
1509
1487
|
"options": IMultiSelectionOption[];
|
|
1510
1488
|
/**
|
|
@@ -2294,14 +2272,6 @@ declare namespace LocalJSX {
|
|
|
2294
2272
|
* Define uma mensagem de orientação ao usuário, colocando o campo em modo inválido.
|
|
2295
2273
|
*/
|
|
2296
2274
|
"errorMessage"?: string;
|
|
2297
|
-
/**
|
|
2298
|
-
* Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
|
|
2299
|
-
*/
|
|
2300
|
-
"hideErrorOnFocusOut"?: boolean;
|
|
2301
|
-
/**
|
|
2302
|
-
* Informa se a pesquisa é do tipo texto.
|
|
2303
|
-
*/
|
|
2304
|
-
"isTextSearch"?: boolean;
|
|
2305
2275
|
/**
|
|
2306
2276
|
* Texto a ser apresentado como título do campo.
|
|
2307
2277
|
*/
|
|
@@ -2580,10 +2550,6 @@ declare namespace LocalJSX {
|
|
|
2580
2550
|
* Evento disparado quando o formulário está disponível na DOM.
|
|
2581
2551
|
*/
|
|
2582
2552
|
"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;
|
|
2587
2553
|
/**
|
|
2588
2554
|
* Define um validador responsável pela integridade dos registros.
|
|
2589
2555
|
*/
|
|
@@ -2598,10 +2564,6 @@ declare namespace LocalJSX {
|
|
|
2598
2564
|
* Evento emitido quando o componente foi totalmente carregado na DOM.
|
|
2599
2565
|
*/
|
|
2600
2566
|
"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;
|
|
2605
2567
|
}
|
|
2606
2568
|
interface EzGrid {
|
|
2607
2569
|
/**
|
|
@@ -2830,10 +2792,6 @@ declare namespace LocalJSX {
|
|
|
2830
2792
|
* Classe que implementa o método fetchData, responsável por realizar a pesquisa dos dados, com base no termo informado pelo usuário.
|
|
2831
2793
|
*/
|
|
2832
2794
|
"dataSource"?: IMultiSelectionListDataSource;
|
|
2833
|
-
/**
|
|
2834
|
-
* Informa se a pesquisa é do tipo texto.
|
|
2835
|
-
*/
|
|
2836
|
-
"isTextSearch"?: boolean;
|
|
2837
2795
|
/**
|
|
2838
2796
|
* Evento que informa que a lista de opções selecionadas sofreu alteração.
|
|
2839
2797
|
*/
|
|
@@ -2998,14 +2956,6 @@ declare namespace LocalJSX {
|
|
|
2998
2956
|
* Define uma mensagem de orientação ao usuário, colocando o campo em modo inválido.
|
|
2999
2957
|
*/
|
|
3000
2958
|
"errorMessage"?: string;
|
|
3001
|
-
/**
|
|
3002
|
-
* Quando verdadeiro deixa de exibir a mensagem de erro (se existente) quando focar em um elemento diferente.
|
|
3003
|
-
*/
|
|
3004
|
-
"hideErrorOnFocusOut"?: boolean;
|
|
3005
|
-
/**
|
|
3006
|
-
* Informa se a pesquisa é do tipo texto.
|
|
3007
|
-
*/
|
|
3008
|
-
"isTextSearch"?: boolean;
|
|
3009
2959
|
/**
|
|
3010
2960
|
* Texto a ser apresentado como título do campo.
|
|
3011
2961
|
*/
|
|
@@ -3350,7 +3300,6 @@ declare namespace LocalJSX {
|
|
|
3350
3300
|
"dataSource"?: IMultiSelectionListDataSource;
|
|
3351
3301
|
"dataUnit"?: DataUnit;
|
|
3352
3302
|
"gridHeaderHidden"?: boolean;
|
|
3353
|
-
"noHeaderTaskBar"?: boolean;
|
|
3354
3303
|
"onApplyFilterColumnOptions"?: (event: FilterColumnCustomEvent<IAppliedFilterColumnOptions>) => void;
|
|
3355
3304
|
"opened"?: boolean;
|
|
3356
3305
|
"options"?: IMultiSelectionOption[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sankhyalabs/ezui",
|
|
3
|
-
"version": "0.0.0-bugfix-dev-KB-
|
|
3
|
+
"version": "0.0.0-bugfix-dev-KB-6165.0",
|
|
4
4
|
"description": "Biblioteca de componentes Sankhya.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/custom-elements/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
|
-
"url": "https://
|
|
38
|
+
"url": "https://git.sankhya.com.br/sankhyalabs/ez-ui.git"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
class FormItem {
|
|
2
|
-
constructor(elem) {
|
|
3
|
-
this.elem = elem;
|
|
4
|
-
}
|
|
5
|
-
addRightElement(el) {
|
|
6
|
-
el.classList.add('ez-padding-left--small');
|
|
7
|
-
this.elem.classList.add('ez-col--nowrap');
|
|
8
|
-
this.elem.appendChild(el);
|
|
9
|
-
}
|
|
10
|
-
get fieldName() {
|
|
11
|
-
return this.elem.getAttribute('data-form-item');
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export class FormItems {
|
|
15
|
-
constructor(items, formId) {
|
|
16
|
-
this.items = new Map();
|
|
17
|
-
this.formId = formId;
|
|
18
|
-
items.forEach(item => {
|
|
19
|
-
const formItem = new FormItem(item);
|
|
20
|
-
this.items.set(formItem.fieldName, formItem);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
getItem(name) {
|
|
24
|
-
return this.items.get(name);
|
|
25
|
-
}
|
|
26
|
-
get formName() {
|
|
27
|
-
return this.formId;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Action, DataType, DateUtils, UserInterface } from '@sankhyalabs/core';
|
|
2
|
-
export default class InMemoryFilterColumnDataSource {
|
|
3
|
-
constructor(dataUnit) {
|
|
4
|
-
var _a;
|
|
5
|
-
this.onDataUnitAction = (action) => {
|
|
6
|
-
if (action.type === Action.DATA_SAVED || action.type === Action.RECORDS_REMOVED) {
|
|
7
|
-
this.originalRecords = this.dataUnit.records;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
this.dataUnit = dataUnit;
|
|
11
|
-
this.originalRecords = (_a = this.dataUnit.records) !== null && _a !== void 0 ? _a : [];
|
|
12
|
-
this.dataUnit.subscribe(this.onDataUnitAction);
|
|
13
|
-
}
|
|
14
|
-
fetchData(filterTerm, fieldName) {
|
|
15
|
-
return new Promise(resolve => {
|
|
16
|
-
const filteredRecords = this.originalRecords.filter(record => this.includesSearchTerm(record, fieldName, filterTerm));
|
|
17
|
-
const options = filteredRecords.map(item => this.buildFieldOption(item, fieldName));
|
|
18
|
-
resolve(this.removeDuplicatedOptions(options));
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
buildFieldOption(item, fieldName) {
|
|
22
|
-
return {
|
|
23
|
-
value: this.buildValue(item, fieldName),
|
|
24
|
-
label: this.formatLabel(fieldName, item[fieldName]),
|
|
25
|
-
check: true,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
buildValue(item, fieldName) {
|
|
29
|
-
var _a;
|
|
30
|
-
let value = item[fieldName];
|
|
31
|
-
if (((_a = this.dataUnit.getField(fieldName)) === null || _a === void 0 ? void 0 : _a.dataType) === DataType.OBJECT) {
|
|
32
|
-
value = value.value;
|
|
33
|
-
}
|
|
34
|
-
return value === null || value === void 0 ? void 0 : value.toString();
|
|
35
|
-
}
|
|
36
|
-
removeDuplicatedOptions(options) {
|
|
37
|
-
const noDuplicatedOptions = [];
|
|
38
|
-
options.forEach(option => {
|
|
39
|
-
if (!noDuplicatedOptions.find(({ label }) => label === option.label)) {
|
|
40
|
-
noDuplicatedOptions.push(option);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return noDuplicatedOptions;
|
|
44
|
-
}
|
|
45
|
-
includesSearchTerm(record, fieldName, filterTerm) {
|
|
46
|
-
let label = this.buildLabel(fieldName, record[fieldName]);
|
|
47
|
-
return label.toLowerCase().includes(filterTerm.toLowerCase());
|
|
48
|
-
}
|
|
49
|
-
buildLabel(fieldName, value) {
|
|
50
|
-
var _a;
|
|
51
|
-
const { dataType } = this.dataUnit.getField(fieldName);
|
|
52
|
-
if (dataType === DataType.NUMBER) {
|
|
53
|
-
return value === null || value === void 0 ? void 0 : value.toString().replace('.', ',');
|
|
54
|
-
}
|
|
55
|
-
if (dataType === DataType.DATE) {
|
|
56
|
-
return (typeof value === 'object')
|
|
57
|
-
? (_a = DateUtils.formatDate(this.dataUnit.valueFromString(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString()
|
|
58
|
-
: value === null || value === void 0 ? void 0 : value.toString();
|
|
59
|
-
}
|
|
60
|
-
if (dataType === DataType.OBJECT) {
|
|
61
|
-
return `${value === null || value === void 0 ? void 0 : value.value} - ${value === null || value === void 0 ? void 0 : value.label}`;
|
|
62
|
-
}
|
|
63
|
-
return value === null || value === void 0 ? void 0 : value.toString();
|
|
64
|
-
}
|
|
65
|
-
formatLabel(fieldName, value) {
|
|
66
|
-
var _a, _b;
|
|
67
|
-
const { userInterface, dataType } = this.dataUnit.getField(fieldName);
|
|
68
|
-
if (dataType === DataType.DATE) {
|
|
69
|
-
return (typeof value === 'object')
|
|
70
|
-
? DateUtils.formatDate(this.dataUnit.valueFromString(fieldName, value))
|
|
71
|
-
: value === null || value === void 0 ? void 0 : value.toString();
|
|
72
|
-
}
|
|
73
|
-
if (dataType === DataType.NUMBER && userInterface !== UserInterface.DECIMALNUMBER) {
|
|
74
|
-
return (_a = parseInt(this.dataUnit.getFormattedValue(fieldName, value))) === null || _a === void 0 ? void 0 : _a.toString();
|
|
75
|
-
}
|
|
76
|
-
return (_b = this.dataUnit.getFormattedValue(fieldName, value)) === null || _b === void 0 ? void 0 : _b.toString();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -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}}),h=class{constructor(s){t(this,s),this.applyFilterColumnOptions=i(this,"applyFilterColumnOptions",7),this.TOP_POSITION="65",this.TOP_POSITION_HEADER_HIDDEN="18",this.TOP_POSITION_NO_TASKBAR="32",this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN="20",this.DEFAULT_HEIGHT=430,this.opened=!0,this.columnName=void 0,this.columnLabel=void 0,this.gridHeaderHidden=!1,this.noHeaderTaskBar=!1,this.dataSource=void 0,this.dataUnit=void 0,this.options=void 0,this.selectedItems=void 0,this.fieldDescriptor=void 0,this.useOptions=!1,this.isTextSearch=!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.buildIsTextSearch(),this.setOptions(t.filteredOptions),this.columnName=t.columnName,this.columnLabel=t.columnLabel,await this.ezPopoverElement.show(this.calcTopPosition(),this.calculateLeftPosition(t)))}calculateLeftPosition(t){if(!t.fromIcon)return t.leftPosition;const i=this.ezPopoverElement.getBoundingClientRect().left,s=parseInt(t.leftPosition.replace("px",""))+16-i;return`${s>0?s:0}px`}buildIsTextSearch(){var t,i;const s=null!==(i=null===(t=this.fieldDescriptor)||void 0===t?void 0:t.userInterface)&&void 0!==i?i:e.SHORTTEXT;this.isTextSearch=!(s===e.DECIMALNUMBER||s===e.INTEGERNUMBER)}calcTopPosition(){const t=this.buildReferenceTopPosition(),i=parseInt(t)+this.DEFAULT_HEIGHT,s=Math.round(this.ezPopoverElement.getBoundingClientRect().top)+i,e=window.innerHeight;return e>s?`${t}px`:e-s+"px"}buildReferenceTopPosition(){return this.noHeaderTaskBar?this.gridHeaderHidden?this.TOP_POSITION_NO_TASKBAR_HEADER_HIDDEN:this.TOP_POSITION_NO_TASKBAR:this.gridHeaderHidden?this.TOP_POSITION_HEADER_HIDDEN:this.TOP_POSITION}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),isTextSearch:this.isTextSearch}),s("footer",{class:"filter-column__footer"},s("ez-button",{label:"Aplicar",class:"ez-button--primary",onClick:this.submit.bind(this)}))))}};h.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{h as filter_column}
|
|
@@ -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,this.isTextSearch=!1}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(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/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())}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()}buildNumberArgument(i){return this.isTextSearch?NaN:Number(i||void 0)}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=this.buildNumberArgument(o);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,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.isTextSearch=!1,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,this.searchInput.value=""}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),isTextSearch:this.isTextSearch}),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 t,c as i,h as e,f as s,H as n,g as r}from"./p-e318d280.js";import{DateUtils as o,Action as a,WaitingChangeException as h,ApplicationContext as l,DataUnitAction as c,StringUtils as u,DataUnit as d,ElementIDUtils as f}from"@sankhyalabs/core";import{b as v,R as p}from"./p-86a2036d.js";import"./p-f15ec3bb.js";import"./p-ab574d59.js";const b=/child\[([^\]]+)\]/,m=/\$\{.+\}/;class y{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}static getDetailName(t){const i=b.exec(t);return i?i[1]:void 0}getSheet(t){return this._sheets.get(t)}getAllSheets(){return this._sheets}addSheet(t){this._sheets.set(t.name,t)}addRequiredFields(t){this._requiredFields=this._requiredFields.concat(t)}getRequiredFields(){return this._requiredFields}addCleanOnCopyFields(t){this._cleanOnCopyFields=this._cleanOnCopyFields.concat(t)}getCleanOnCopyFields(){return this._cleanOnCopyFields}addDefaultValues(t){return this._defaultValues=Object.assign(Object.assign({},this._defaultValues),t)}getDefaultValues(){const t={};return Object.entries(this._defaultValues).forEach((([i,e])=>{if("string"==typeof e){const t=m.exec(e);t&&(e=this.getDefaultVar(t[0]))}t[i]=e})),t}getDefaultVar(t){return"${data}"===t?o.getToday():"${datahora}"===t?o.getToday(!0):this._defaultVars?this._defaultVars.get(t):void 0}setDefaultVars(t){this._defaultVars=t}}const _=(t,i)=>"__main"==t[0].label?-1:(t[0].order||1e4)-(i[0].order||1e4);class g{constructor(t){this.onDataUnitEvent=t=>{var i,e;switch(t.type){case a.DATA_LOADED:case a.DATA_SAVED:case a.RECORDS_REMOVED:case a.RECORDS_ADDED:case a.RECORDS_COPIED:case a.EDITION_CANCELED:case a.SELECTION_CHANGED:case a.NEXT_SELECTED:case a.PREVIOUS_SELECTED:this.clearInvalid();case a.DATA_CHANGED:case a.CHANGE_UNDONE:case a.CHANGE_REDONE:case a.RECORD_LOADED:null===(i=this._fields)||void 0===i||i.forEach((t=>{this.updateValue(t.fieldName,t.field)}));break;case a.FIELD_INVALIDATED:null===(e=this._fields)||void 0===e||e.forEach((t=>{this.updateErrorMessage(t.fieldName,t.field)}))}},this._fields=new Map,this._dataUnit=t,this.applyDefaultValues(),this._dataUnit.subscribe(this.onDataUnitEvent),this._dataUnit.addInterceptor(this)}applyDefaultValues(){const t=(this._dataUnit.getAddedRecords()||[]).map((t=>t.__record__id__));if(t.length>0){const i=this.getDefaultValues();i&&Object.keys(i).forEach((e=>{this._dataUnit.setFieldValue(e,i[e],t)}))}}bind(t,i,e,s){t.forEach((t=>{const{fieldName:e,contextName:s}=t.dataset;null!=s&&s!==i||this.updateBind(e,t)})),this._formMetadata=e,this._recordValidatorProcessor=new p(this._dataUnit,{getRequiredFields:()=>this._formMetadata.getRequiredFields(),markAsInvalid:t=>this.markInvalid(t),getMessageForField:t=>this.getErrorMessage(t)},s)}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent),this._dataUnit.removeInterceptor(this)}getCurrentRecordId(){const t=this._dataUnit.getSelectedRecord();return null==t?void 0:t.__record__id__}markInvalid(t){if(this._fields.has(t.name)){const i=this._fields.get(t.name).field;this.updateErrorMessage(t.name,i,t.message)}}clearInvalid(t){this._dataUnit.clearInvalid(t),this._fields.forEach((t=>{t.field.errorMessage=""}))}updateValue(t,i){const e=this._fields.get(t);try{e&&(e.listen=!1),i.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,i)}finally{e&&(e.listen=!0)}}validate(){return this._recordValidatorProcessor.validate()}updateErrorMessage(t,i,e){null==e&&(e=this._dataUnit.getInvalidMessage(this.getCurrentRecordId(),t)),i.errorMessage||(i.errorMessage=e)}getErrorMessage(t){if(this._fields.has(t))return this._fields.get(t).field.errorMessage}updateBind(t,i){const e=this._fields.get(t);e&&e.destroy(),i.value=this._dataUnit.getFieldValue(t),this.updateErrorMessage(t,i),this._fields.set(t,w.create(t,i,((t,i)=>this.changeStarted(t,i)),(t=>this.cancelWaitingChange(t)),((t,i)=>this.setFieldValue(t,i)))),this.bindSearchOptionsLoader(t,i),this.applyEzUploadContext(t,i)}changeStarted(t,i){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!i.blocking&&null==i.promise){const e=this._fields.get(t);e&&(i.promise=new Promise(((t,i)=>{e.waitingChangePromiseResolve=t,e.waitingChangePromiseReject=i})))}this._dataUnit.startChange(t,i)}cancelWaitingChange(t){if(this._dataUnit.waitingForChange(t)){this._dataUnit.cancelWaitingChange(t);const i=this._fields.get(t);i&&i.rejectWaitingChange(new h("Change canceled",t))}}setFieldValue(t,i){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.clearInvalid(this.getCurrentRecordId(),t),this._dataUnit.setFieldValue(t,i),this._dataUnit.waitingForChange(t)){const i=this._fields.get(t);i&&i.acceptWaitingChange()}}bindSearchOptionsLoader(t,i){if("EZ-SEARCH"===i.nodeName&&null==i.optionLoader){const e=l.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");e&&(i.optionLoader=i=>e(i,t,this._dataUnit))}}applyEzUploadContext(t,i){var e,s;if("EZ-UPLOAD"===i.nodeName){i.urlUpload=l.getContextValue("__EZUI__UPLOAD__ADD__URL__"),i.urlDelete=l.getContextValue("__EZUI__UPLOAD__DEL__URL__");const n=this._dataUnit.getField(t),r=null===(e=n.properties)||void 0===e?void 0:e.DESTINATION;r&&(i.requestHeaders={XTRAINF:`{"destination": "${r}"}`}),i.maxFiles=(null===(s=n.properties)||void 0===s?void 0:s.MAX_FILES)||0}}interceptAction(t){if(t.type===a.RECORDS_COPIED){const i=this._formMetadata.getCleanOnCopyFields();if(i)return new c(a.RECORDS_COPIED,t.payload.map((t=>{const e=Object.assign({},t);return i.forEach((t=>delete e[t])),e})))}if(t.type===a.SAVING_DATA)return new Promise((i=>{this.validate().then((()=>i(t))).catch((()=>{}))}));if(t.type===a.RECORDS_ADDED){const i=this.getDefaultValues();if(i)return new c(a.RECORDS_ADDED,t.payload.map((t=>Object.assign(Object.assign({},t),i))))}return t}getDefaultValues(){var t;const i=null===(t=this._formMetadata)||void 0===t?void 0:t.getDefaultValues();if(i){const t={};for(const e in i)t[e]=this._dataUnit.valueFromString(e,i[e]);return t}}}class w{constructor(){this.listen=!0,this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(t){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(t),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(t,i,e,s,n){const r=new w;return r.field=i,r.fieldName=t,r.startChangeListener=i=>{r.listen&&e(t,i.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.cancelWaitingChangeListener=()=>{r.listen&&s(t)},r.field.addEventListener(r.cancelWaitingChangeEventName,r.cancelWaitingChangeListener),r.changeListener=i=>{r.listen&&n(t,i.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}function E(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var O="function"==typeof Symbol&&Symbol.observable||"@@observable",C=function(){return Math.random().toString(36).substring(7).split("").join(".")},A={INIT:"@@redux/INIT"+C(),REPLACE:"@@redux/REPLACE"+C(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+C()}};function j(t){if("object"!=typeof t||null===t)return!1;for(var i=t;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return Object.getPrototypeOf(t)===i}function R(t,i,e){var s;if("function"==typeof i&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(E(0));if("function"==typeof i&&void 0===e&&(e=i,i=void 0),void 0!==e){if("function"!=typeof e)throw new Error(E(1));return e(R)(t,i)}if("function"!=typeof t)throw new Error(E(2));var n=t,r=i,o=[],a=o,h=!1;function l(){a===o&&(a=o.slice())}function c(){if(h)throw new Error(E(3));return r}function u(t){if("function"!=typeof t)throw new Error(E(4));if(h)throw new Error(E(5));var i=!0;return l(),a.push(t),function(){if(i){if(h)throw new Error(E(6));i=!1,l();var e=a.indexOf(t);a.splice(e,1),o=null}}}function d(t){if(!j(t))throw new Error(E(7));if(void 0===t.type)throw new Error(E(8));if(h)throw new Error(E(9));try{h=!0,r=n(r,t)}finally{h=!1}for(var i=o=a,e=0;e<i.length;e++)(0,i[e])();return t}function f(t){if("function"!=typeof t)throw new Error(E(10));n=t,d({type:A.REPLACE})}function v(){var t,i=u;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(E(11));function e(){t.next&&t.next(c())}return e(),{unsubscribe:i(e)}}})[O]=function(){return this},t}return d({type:A.INIT}),(s={dispatch:d,subscribe:u,getState:c,replaceReducer:f})[O]=v,s}const D={};function z(t=D,i){switch(i.type){case N.METADATA_LOADED:return Object.assign(Object.assign({},t),{formMetadata:i.payload,currentSheet:void 0});case N.CHANGE_TAB:return Object.assign(Object.assign({},t),{currentSheet:i.payload});default:return t}}function I(t){return t.formMetadata}var N;!function(t){t.METADATA_LOADED="FORM/METADATA_LOADED",t.CHANGE_TAB="FORM/CHANGE_TAB"}(N||(N={}));const x=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.formItemsReady=i(this,"formItemsReady",7),this.onDataUnitAction=t=>{t.type===a.METADATA_LOADED&&this.processMetadata()},this.dataUnit=void 0,this.config=void 0,this.recordsValidator=void 0}validate(){return this._dataBinder.validate()}observeConfig(){this.processMetadata()}getDynamicContent(){var t;const i=I(this._store.getState());if(!i)return null;const s=Array.from(i.getAllSheets().values()),n=function(t){const i=function(t){return t.currentSheet}(t);return i?t.formMetadata.getSheet(i):Array.from(t.formMetadata.getAllSheets().values())[0]}(null===(t=this._store)||void 0===t?void 0:t.getState());let r=[];if(s.length>1){const t=s.map(((t,i)=>({tabKey:t.name,label:t.label,index:i}))),i="selector";r.push(e("ez-tabselector",{tabs:this.buildIdTabSelector(t),onEzChange:t=>this._store.dispatch(function(t){return{type:N.CHANGE_TAB,payload:"string"==typeof t?t:t.tabKey}}(t.detail)),selectedTab:n.name,"data-element-id":i}))}return r=r.concat(this.buildFormContent(n)),r}buildFormContent(t){const i=null==t?void 0:t.fields;if(null==t)return;const s=`${u.replaceAccentuatedChars(u.toCamelCase(null==t?void 0:t.label),!1)}_selectorContainer`;return e("div",{class:"dynamic-content","data-element-id":s},e("ez-form-view",{class:"ez-row ez-padding-vertical--small",fields:i}))}processMetadata(){if(!this.isStatic()&&this.dataUnit&&this._store){const t=((t,i,e=!1)=>{var s,n;null!=t&&!0!==(null==t?void 0:t.emptyConfig)||(t=(t=>{const i=t.metadata;let e;return i&&(e=i.fields.filter((t=>!1!==t.visible)).map((t=>({name:t.name,defaultValue:t.defaultValue})))),{emptyConfig:!1,fields:e}})(i));const r=new Map,o=new Map,a=[],h=[],l={};null===(s=null==t?void 0:t.tabs)||void 0===s||s.forEach((t=>{o.has(t.label)||!1!==t.visible||o.set(t.label,t)})),null===(n=null==t?void 0:t.fields)||void 0===n||n.forEach((t=>{var e,s,n;if(!1!==t.visible){const c=((t,i)=>("string"==typeof t?Array.from(i.keys()).find((i=>i.label===t)):t)||{label:t,visible:!0})(t.tab||"__main",r);if(o.has(c.label))return;const u=i.getField(t.name);if(u&&c.visible){r.has(c)||r.set(c,[]);const i=v(u,t);r.get(c).push(i),i.required&&a.push(t.name),((null==t.cleanOnCopy?null===(e=u.properties)||void 0===e?void 0:e.cleanOnCopy:t.cleanOnCopy)||(null===(s=u.properties)||void 0===s?void 0:s.cleanOnCopy))&&h.push(t.name);let o=null==t.defaultValue?null===(n=u.properties)||void 0===n?void 0:n.defaultValue:t.defaultValue;if(o&&null!=o.value){const{type:i,value:e}=o;if(i)if("V"===i)o=e;else try{const t=JSON.parse(e);o=t&&"value"in t?t:e}catch(t){}l[t.name]=o}}}}));const c=new y;if(c.setDefaultVars(t.defaultVars),e){const t=i.metadata;null!=t&&null!=t.children&&t.children.forEach((t=>{const{label:i,name:e,fields:s}=(t=>({name:`child[${t.name}]`,label:t.label,fields:[]}))(t);r.set({name:e,label:i},s)}))}return Array.from(r.entries()).sort(_).forEach((([t,i])=>{c.addSheet({label:"__main"===t.label?"Principal":t.label,name:t.name||t.label,fields:i})})),c.addRequiredFields(a),c.addCleanOnCopyFields(h),c.addDefaultValues(l),c})(this.config,this.dataUnit);this._store.dispatch({type:N.METADATA_LOADED,payload:t})}}isStatic(){var t;return(null===(t=this._staticFields)||void 0===t?void 0:t.length)>0}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new d("ez-form")),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new g(this.dataUnit),this._store=R(z),this._store.subscribe((()=>s(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata(),f.addIDInfo(this._element,null,{dataUnit:this.dataUnit})}componentDidRender(){const t=I(this._store.getState());t.addRequiredFields(this._staticFields.filter((t=>t.dataset.required)).map((t=>t.dataset.fieldName))),this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")),this.dataUnit.dataUnitId,t,this.recordsValidator),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this._dataBinder.onDisconnectedCallback()}buildIdTabSelector(t){return t&&t.forEach((t=>t[f.DATA_ELEMENT_ID_ATTRIBUTE_NAME]=u.toCamelCase(t.label))),t}render(){return e(n,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};x.style=".sc-ez-form-h{display:flex;flex-direction:column;width:100%}.dynamic-content.sc-ez-form ez-collapsible-box.sc-ez-form{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{x as ez_form}
|
|
@@ -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,this.isTextSearch=!1}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,isTextSearch:this.isTextSearch})}get _elem(){return e(this)}static get watchers(){return{errorMessage:["observeErrorMessage"],value:["observeValue"]}}};r.style=":host{width:100%}";export{r as ez_search}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,r as a,c as l,H as t,g as o}from"./p-e318d280.js";import{ObjectUtils as n,UserInterface as r,ElementIDUtils as s}from"@sankhyalabs/core";import{R as d}from"./p-27a01a26.js";import{C as i}from"./p-b853763b.js";function c(a,l,t,o,n){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:!t,label:l,mode:n?i.SWITCH:i.REGULAR,"data-field-name":a,"data-context-name":o,key:a}))}function m(a,l,t,o,n,r,s){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-number-input",{enabled:!t,label:l,precision:o,prettyPrecision:n,"data-field-name":a,"data-context-name":r,key:a,canShowError:s}))}const z=({name:a,label:l,readOnly:t,contextName:o,canShowError:n})=>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":o,key:a,enabled:!t,canShowError:n})),h=new Map;h.set(r.CHECKBOX,(e=>c(e.name,e.label,e.readOnly,e.contextName,!1))),h.set(r.SWITCH,(e=>c(e.name,e.label,e.readOnly,e.contextName,!0))),h.set(r.OPTIONSELECTOR,(({name:a,label:l,readOnly:t,required:o,props:n,contextName:r,canShowError:s})=>{const d=null==n?void 0:n.options;let i;if("string"==typeof d){const e=JSON.parse(d);i=Object.keys(e).map((a=>({value:a,label:e[a]})))}else i=d;return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-combo-box",{enabled:!t,suppressEmptyOption:o,label:l,"data-field-name":a,"data-context-name":r,key:a,options:i,canShowError:s}))})),h.set(r.DATE,(({name:a,label:l,readOnly:t,canShowError:o})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-input",{enabled:!t,label:l,"data-field-name":a,key:a,canShowError:o})))),h.set(r.TIME,(({name:a,label:l,readOnly:t,canShowError:o})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-time-input",{enabled:!t,label:l,"data-field-name":a,key:a,canShowError:o})))),h.set(r.DATETIME,(({name:a,label:l,readOnly:t,contextName:o,canShowError:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-time-input",{enabled:!t,label:l,"data-field-name":a,"data-context-name":o,key:a,canShowError:n})))),h.set(r.FILE,(({name:a,label:l,readOnly:t,contextName:o,props:r})=>{const s=n.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:!t,label:l,"data-field-name":a,"data-context-name":o,key:a},s)))})),h.set(r.DECIMALNUMBER,(({name:e,label:a,readOnly:l,props:t,contextName:o,canShowError:n})=>{const r=Number((null==t?void 0:t.precision)||2);return m(e,a,l,r,Number((null==t?void 0:t.prettyPrecision)||r),o,n)})),h.set(r.INTEGERNUMBER,(({name:e,label:a,readOnly:l,contextName:t,canShowError:o})=>m(e,a,l,0,0,t,o))),h.set(r.SEARCH,(({name:a,label:l,readOnly:t,required:o,contextName:n,canShowError:r,optionLoader:s})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-search",{enabled:!t,suppressEmptyOption:o,label:l,"data-field-name":a,"data-context-name":n,key:a,canShowError:r,optionLoader:s})))),h.set(r.LONGTEXT,(({name:a,label:l,readOnly:t,contextName:o,rows:n,canShowError:r})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small",key:a},e("ez-text-area",{enabled:!t,label:l,"data-field-name":a,"data-context-name":o,rows:n,canShowError:r}))));const b=e=>{const a=h.get(e.userInterface)||z,l=e.required?`${e.label}${d}`:e.label,t=a(Object.assign(Object.assign({},e),{label:l}));return t.l["data-form-item"]=e.name,t};class p{constructor(e){this.elem=e}addRightElement(e){e.classList.add("ez-padding-left--small"),this.elem.classList.add("ez-col--nowrap"),this.elem.appendChild(e)}get fieldName(){return this.elem.getAttribute("data-form-item")}}class u{constructor(e,a){this.items=new Map,this.formId=a,e.forEach((e=>{const a=new p(e);this.items.set(a.fieldName,a)}))}getItem(e){return this.items.get(e)}get formName(){return this.formId}}const y=class{constructor(e){a(this,e),this.ezContentReady=l(this,"ezContentReady",7),this.formItemsReady=l(this,"formItemsReady",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 t=a.get(l);null==t&&(t=[],a.set(l,t)),t.push(e)}else a.set(e.name,e)})),a}componentDidRender(){this.ezContentReady.emit(Array.from(this._element.querySelectorAll("[data-field-name]")));const e=new u(Array.from(this._element.querySelectorAll("[data-form-item]")));this.formItemsReady.emit(e)}render(){if(s.addIDInfoIfNotExists(this._element,"ezFormView"),null!=this.fields)return e(t,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=>b(e)))):b(l))))}get _element(){return o(this)}};y.style=".sc-ez-form-view-h{display:flex;flex-direction:row;flex-wrap:wrap;width:100%}";export{y as ez_form_view}
|
|
@@ -1,14 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
}
|