@zeedhi/common 1.113.0 → 1.115.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/dist/zd-common.esm.js +313 -127
- package/dist/zd-common.umd.js +314 -126
- package/package.json +2 -2
- package/types/components/zd-grid/grid-editable.d.ts +12 -0
- package/types/components/zd-input/input.d.ts +2 -0
- package/types/components/zd-input/interfaces.d.ts +2 -0
- package/types/components/zd-select/interfaces.d.ts +0 -1
- package/types/components/zd-select/select.d.ts +3 -3
- package/types/components/zd-select-tree/interfaces.d.ts +2 -1
- package/types/components/zd-select-tree/select-tree.d.ts +26 -3
- package/types/components/zd-select-tree-multiple/interfaces.d.ts +2 -0
- package/types/components/zd-select-tree-multiple/select-tree-multiple.d.ts +8 -6
- package/types/components/zd-tree-grid/tree-grid.d.ts +1 -0
- package/types/utils/datasource-searcher/datasource-searcher.d.ts +7 -0
- package/types/utils/datasource-searcher/index.d.ts +2 -0
- package/types/utils/datasource-searcher/interfaces.d.ts +5 -0
- package/types/utils/index.d.ts +2 -0
- package/types/utils/tree-data-structure/tree-data-structure.d.ts +1 -0
- package/types/utils/unique-by/index.d.ts +1 -0
- package/types/utils/unique-by/unique-by.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.115.0",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"lodash.times": "4.3.*",
|
|
44
44
|
"mockdate": "3.0.*"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "da156279690ae861153fc57e75030783d719487c"
|
|
47
47
|
}
|
|
@@ -119,7 +119,18 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
119
119
|
* @param element DOM Element
|
|
120
120
|
*/
|
|
121
121
|
selectAllClick(isSelected: boolean, event: Event, element: any): void;
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves the visible value of a cell, which is the corresponding cell in edited row or in the default row
|
|
124
|
+
*/
|
|
122
125
|
getVisibleValue(row: IDictionary, column: GridColumnEditable): any;
|
|
126
|
+
/**
|
|
127
|
+
* Retrieves the visible values of a row
|
|
128
|
+
* @param row
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
getVisibleRow(row: IDictionary): {
|
|
132
|
+
[x: string]: any;
|
|
133
|
+
};
|
|
123
134
|
/**
|
|
124
135
|
* Returns editable component properties based on the column definition
|
|
125
136
|
* @param column Column definition
|
|
@@ -147,6 +158,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
147
158
|
private checkLookupData;
|
|
148
159
|
private pushLookupRow;
|
|
149
160
|
private checkCompValidity;
|
|
161
|
+
private clearInvalidComponentsForRow;
|
|
150
162
|
/**
|
|
151
163
|
* change event of editable components
|
|
152
164
|
*/
|
|
@@ -2,6 +2,7 @@ import { IDictionary } from '@zeedhi/core';
|
|
|
2
2
|
import { ComponentRender } from '../zd-component/component-render';
|
|
3
3
|
import { Form } from '../zd-form/form';
|
|
4
4
|
import { IInput, IInputEvents } from './interfaces';
|
|
5
|
+
import { IFormGrid } from '../zd-form/interfaces';
|
|
5
6
|
/**
|
|
6
7
|
* Base class for Input component.
|
|
7
8
|
*/
|
|
@@ -120,6 +121,7 @@ export declare class Input extends ComponentRender implements IInput {
|
|
|
120
121
|
protected internalDisplayValue: string;
|
|
121
122
|
protected internalValue: any;
|
|
122
123
|
formParent?: Form;
|
|
124
|
+
grid: IFormGrid;
|
|
123
125
|
/**
|
|
124
126
|
* Creates a new Input.
|
|
125
127
|
* @param props Input properties
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IEventParam, IDictionary } from '@zeedhi/core';
|
|
2
2
|
import { Input } from './input';
|
|
3
3
|
import { IComponentEvents, IComponentRender, EventDef } from '../zd-component/interfaces';
|
|
4
|
+
import { IFormGrid } from '../zd-form/interfaces';
|
|
4
5
|
export declare type IInputEvent = IEventParam<Input>;
|
|
5
6
|
export interface IInputEvents<T = IEventParam<any>> extends IComponentEvents<T> {
|
|
6
7
|
change?: EventDef<T>;
|
|
@@ -36,4 +37,5 @@ export interface IInput extends IComponentRender {
|
|
|
36
37
|
validations?: IDictionary<IDictionary<string | number> | boolean>;
|
|
37
38
|
value?: any;
|
|
38
39
|
autoRegister?: boolean;
|
|
40
|
+
grid?: IFormGrid;
|
|
39
41
|
}
|
|
@@ -3,7 +3,6 @@ import { ITextInput } from '../zd-text-input/interfaces';
|
|
|
3
3
|
import { IComponentRender } from '../zd-component/interfaces';
|
|
4
4
|
import { ISelectDataValueOut } from '../../utils';
|
|
5
5
|
import { IColumn } from '../zd-iterable/interfaces';
|
|
6
|
-
export declare type SearchParam = 'SEARCH' | 'FILTER' | 'FIND' | 'DYNAMIC_FILTER';
|
|
7
6
|
export interface ISelect extends ITextInput, ISelectDataValueOut {
|
|
8
7
|
autocomplete?: boolean;
|
|
9
8
|
autoSelection?: boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Datasource, IDictionary, IDatasource } from '@zeedhi/core';
|
|
2
2
|
import { IComponentRender } from '../zd-component/interfaces';
|
|
3
|
-
import { ISelect
|
|
3
|
+
import { ISelect } from './interfaces';
|
|
4
4
|
import { TextInput } from '../zd-text-input/text-input';
|
|
5
5
|
import { ISelectDataValueOutItem } from '../../utils';
|
|
6
6
|
import { IColumn } from '../zd-iterable/interfaces';
|
|
7
7
|
import { IModal } from '../zd-modal/interfaces';
|
|
8
|
+
import { SearchParam } from '../../utils/datasource-searcher';
|
|
8
9
|
/**
|
|
9
10
|
* Base class for Select component.
|
|
10
11
|
*/
|
|
@@ -162,11 +163,10 @@ export declare class Select extends TextInput implements ISelect {
|
|
|
162
163
|
* Finds and retrieves items searching by value
|
|
163
164
|
* @param value Default value
|
|
164
165
|
*/
|
|
165
|
-
protected getItemsBySearchValue(value: any
|
|
166
|
+
protected getItemsBySearchValue(value: any): Promise<IDictionary<any>[]>;
|
|
166
167
|
protected getCondition(filterValue: any): (row: any) => boolean;
|
|
167
168
|
focus(event: Event, element: any): Promise<void>;
|
|
168
169
|
protected afterFocus(): Promise<void>;
|
|
169
|
-
protected uniqueBy(a: IDictionary[], key: string): IDictionary<any>[];
|
|
170
170
|
protected afterLoad(): void;
|
|
171
171
|
/**
|
|
172
172
|
* Field selected row
|
|
@@ -2,7 +2,7 @@ import { IDictionary, IEventParam, IDatasource } from '@zeedhi/core';
|
|
|
2
2
|
import { IComponentEvents, EventDef } from '../zd-component/interfaces';
|
|
3
3
|
import { SelectTree } from './select-tree';
|
|
4
4
|
import { ITextInput } from '../zd-text-input/interfaces';
|
|
5
|
-
import { ISelectDataValueOut } from '../../utils';
|
|
5
|
+
import { ISelectDataValueOut, SearchParam } from '../../utils';
|
|
6
6
|
export interface ISelectTreeNode<T> {
|
|
7
7
|
id: string | number;
|
|
8
8
|
label: string;
|
|
@@ -38,6 +38,7 @@ export interface ISelectTree extends ITextInput, ISelectDataValueOut {
|
|
|
38
38
|
fieldHasChild?: string;
|
|
39
39
|
menuMaxWidth?: number;
|
|
40
40
|
autoSelection?: boolean;
|
|
41
|
+
searchParam?: SearchParam;
|
|
41
42
|
}
|
|
42
43
|
export interface ISelectTreeCloseEvent extends IEventParam<SelectTree> {
|
|
43
44
|
selectedNodes: ISelectTreeNode<IDictionary>[];
|
|
@@ -2,6 +2,8 @@ import { IDictionary, Datasource } from '@zeedhi/core';
|
|
|
2
2
|
import { TextInput } from '../zd-text-input/text-input';
|
|
3
3
|
import { ISelectTree, ISelectTreeNode, ISelectTreeEvents } from './interfaces';
|
|
4
4
|
import { ISelectDataValueOutItem } from '../../utils';
|
|
5
|
+
import { SelectTreeValue } from '../zd-select-tree-multiple/interfaces';
|
|
6
|
+
import { SearchParam } from '../../utils/datasource-searcher';
|
|
5
7
|
/**
|
|
6
8
|
* Base class for Select Tree component.
|
|
7
9
|
*/
|
|
@@ -93,7 +95,7 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
93
95
|
* Defines if should wait and not execute GET method when Datasource is created
|
|
94
96
|
*/
|
|
95
97
|
private lazyLoad;
|
|
96
|
-
selectValue:
|
|
98
|
+
selectValue: IDictionary | null;
|
|
97
99
|
/**
|
|
98
100
|
* Uses delayed loading to load tree branches
|
|
99
101
|
*/
|
|
@@ -118,6 +120,10 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
118
120
|
dataValueOutFormName: string;
|
|
119
121
|
private discreteProps?;
|
|
120
122
|
protected formatterFn: Function;
|
|
123
|
+
/**
|
|
124
|
+
* Defines if data handling should be manual or automatic
|
|
125
|
+
*/
|
|
126
|
+
searchParam: SearchParam;
|
|
121
127
|
/**
|
|
122
128
|
* Creates a new instance of SelectTree
|
|
123
129
|
* @param props
|
|
@@ -135,7 +141,16 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
135
141
|
private createDataStructure;
|
|
136
142
|
/** create nodes from datasource object */
|
|
137
143
|
createNodesFromDatasource(buildTree?: boolean): void;
|
|
138
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Creates a Tree Node from a datasource row
|
|
146
|
+
*/
|
|
147
|
+
createNodeFromRow(row: IDictionary<any>): {
|
|
148
|
+
id: any;
|
|
149
|
+
label: any;
|
|
150
|
+
discreteLabel: any;
|
|
151
|
+
children: ISelectTreeNode<IDictionary<any>>[] | null | undefined;
|
|
152
|
+
row: IDictionary<any>;
|
|
153
|
+
};
|
|
139
154
|
private createChildrenNodes;
|
|
140
155
|
/**
|
|
141
156
|
* Triggered when the menu opens
|
|
@@ -173,9 +188,17 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
173
188
|
protected clearRow(row: IDictionary<any>): {
|
|
174
189
|
[x: string]: any;
|
|
175
190
|
};
|
|
191
|
+
clearNodeRow(row: IDictionary): {
|
|
192
|
+
[x: string]: any;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Finds and retrieves items searching by value
|
|
196
|
+
* @param value Default value
|
|
197
|
+
*/
|
|
198
|
+
protected getItemsBySearchValue(value: any): Promise<IDictionary<any>[]>;
|
|
176
199
|
get value(): any;
|
|
177
200
|
set value(value: any);
|
|
178
|
-
setValue(value
|
|
201
|
+
setValue(value?: SelectTreeValue): Promise<void>;
|
|
179
202
|
loadChildren(parentNode: ISelectTreeNode<IDictionary>): Promise<void>;
|
|
180
203
|
checkAutoSelection(): void;
|
|
181
204
|
}
|
|
@@ -7,6 +7,7 @@ export interface ISelectTreeMultipleNode<T> {
|
|
|
7
7
|
isDisabled?: boolean;
|
|
8
8
|
isDefaultExpanded?: boolean;
|
|
9
9
|
children?: ISelectTreeMultipleNode<T>[];
|
|
10
|
+
row?: IDictionary;
|
|
10
11
|
}
|
|
11
12
|
export interface ISelectTreeMultiple extends ISelectTree {
|
|
12
13
|
flat?: boolean;
|
|
@@ -27,3 +28,4 @@ export interface ISelectTreeMultipleEvents extends ISelectTreeEvents {
|
|
|
27
28
|
selectedAll?: IEvent<IEventParam<any>> | string;
|
|
28
29
|
unselectedAll?: IEvent<IEventParam<any>> | string;
|
|
29
30
|
}
|
|
31
|
+
export declare type SelectTreeValue = string | number | IDictionary | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDictionary } from '@zeedhi/core';
|
|
2
2
|
import { SelectTree } from '../zd-select-tree/select-tree';
|
|
3
|
-
import { ISelectTreeMultiple, ISelectTreeMultipleNode, ISelectTreeMultipleEvents } from './interfaces';
|
|
3
|
+
import { ISelectTreeMultiple, ISelectTreeMultipleNode, ISelectTreeMultipleEvents, SelectTreeValue } from './interfaces';
|
|
4
4
|
import { ISelectTreeNode } from '../zd-select-tree/interfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Base class for Select Tree Multiple component.
|
|
@@ -22,7 +22,7 @@ export declare class SelectTreeMultiple extends SelectTree implements ISelectTre
|
|
|
22
22
|
* Selected Nodes
|
|
23
23
|
*/
|
|
24
24
|
selectedNodes: ISelectTreeMultipleNode<IDictionary>[];
|
|
25
|
-
selectValue:
|
|
25
|
+
selectValue: IDictionary[];
|
|
26
26
|
/**
|
|
27
27
|
* Changes the behavior of checked nodes that will be displayed in the array of values
|
|
28
28
|
*/
|
|
@@ -46,7 +46,7 @@ export declare class SelectTreeMultiple extends SelectTree implements ISelectTre
|
|
|
46
46
|
deselect(node: ISelectTreeMultipleNode<IDictionary>, element?: any): void;
|
|
47
47
|
get value(): any;
|
|
48
48
|
set value(value: any);
|
|
49
|
-
setValue(value
|
|
49
|
+
setValue(value?: SelectTreeValue | SelectTreeValue[]): Promise<void>;
|
|
50
50
|
/**
|
|
51
51
|
* Retrieves all nodes in the tree as a flat array. Nodes that are not matched are excluded
|
|
52
52
|
* Nodes that are not matched but whose parent is matched are included
|
|
@@ -67,7 +67,7 @@ export declare class SelectTreeMultiple extends SelectTree implements ISelectTre
|
|
|
67
67
|
* (if the user is searching, selects only the searched nodes)
|
|
68
68
|
* @returns
|
|
69
69
|
*/
|
|
70
|
-
selectAllItems(nodes?: ISelectTreeNode<IDictionary<any>>[]): void
|
|
70
|
+
selectAllItems(nodes?: ISelectTreeNode<IDictionary<any>>[]): Promise<void>;
|
|
71
71
|
/**
|
|
72
72
|
* Unelects all items in the tree \
|
|
73
73
|
* If the component is fetchOnDemand, it will select all values from datasource.data \
|
|
@@ -76,12 +76,14 @@ export declare class SelectTreeMultiple extends SelectTree implements ISelectTre
|
|
|
76
76
|
* (if the user is searching, selects only the searched nodes)
|
|
77
77
|
* @returns
|
|
78
78
|
*/
|
|
79
|
-
unSelectAllItems(nodes?: ISelectTreeNode<IDictionary<any>>[]): void
|
|
79
|
+
unSelectAllItems(nodes?: ISelectTreeNode<IDictionary<any>>[]): Promise<void>;
|
|
80
80
|
/**
|
|
81
81
|
* Takes two arrays and creates a map of the unique values
|
|
82
82
|
* @returns map of a merge between the two arrays, removing duplicates
|
|
83
83
|
*/
|
|
84
84
|
private createMergeMap;
|
|
85
85
|
getValueIds(): any;
|
|
86
|
-
getValueAsObject():
|
|
86
|
+
getValueAsObject(): {
|
|
87
|
+
id: any;
|
|
88
|
+
}[];
|
|
87
89
|
}
|
|
@@ -70,6 +70,7 @@ export declare class TreeGrid extends Grid implements ITreeGrid {
|
|
|
70
70
|
* @returns The response is an array of promises.
|
|
71
71
|
*/
|
|
72
72
|
deleteRows(): Promise<any[]>;
|
|
73
|
+
loadChildren(row: IDictionary, rowIndex?: number): Promise<void>;
|
|
73
74
|
/**
|
|
74
75
|
* Expands or collapses a row
|
|
75
76
|
* @param row Row object
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Datasource, IDictionary } from '@zeedhi/core';
|
|
2
|
+
import { IDatasourceSearcher, SearchParam } from './interfaces';
|
|
3
|
+
export declare class DatasourceSearcher implements IDatasourceSearcher {
|
|
4
|
+
private dsSearch;
|
|
5
|
+
search(datasource: Datasource, searchValue: string | number | (string | number)[], searchIn: string, searchParam: SearchParam): Promise<IDictionary[]>;
|
|
6
|
+
private searchRequest;
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Datasource, IDictionary } from '@zeedhi/core';
|
|
2
|
+
export declare type SearchParam = 'SEARCH' | 'FILTER' | 'FIND' | 'DYNAMIC_FILTER';
|
|
3
|
+
export interface IDatasourceSearcher {
|
|
4
|
+
search(datasource: Datasource, search: string | number | (string | number)[], searchIn: string, searchParam: SearchParam): Promise<IDictionary[]>;
|
|
5
|
+
}
|
package/types/utils/index.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ export declare class TreeDataStructure {
|
|
|
103
103
|
* @returns next row index
|
|
104
104
|
*/
|
|
105
105
|
nextOpenedRow(rowIdx: number): number;
|
|
106
|
+
loadChildren(row: IDictionary, rowIndex?: number): Promise<IDictionary<any>[]>;
|
|
106
107
|
/**
|
|
107
108
|
* Expands or collapses a row
|
|
108
109
|
* @param row Row object
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './unique-by';
|