@zeedhi/common 1.109.0 → 1.110.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 +398 -239
- package/dist/zd-common.umd.js +397 -238
- package/package.json +2 -2
- package/types/components/zd-grid/grid-editable.d.ts +14 -0
- package/types/components/zd-iterable/column.d.ts +5 -0
- package/types/components/zd-select-multiple/select-multiple.d.ts +1 -4
- package/types/components/zd-select-tree/interfaces.d.ts +1 -0
- package/types/components/zd-select-tree/select-tree.d.ts +10 -1
- package/types/components/zd-select-tree-multiple/select-tree-multiple.d.ts +35 -4
- package/types/formatters/column-zdselect.d.ts +1 -0
- package/types/formatters/column-zdselectmultiple.d.ts +1 -0
- package/types/formatters/index.d.ts +2 -0
- package/types/index.d.ts +1 -0
- package/types/utils/report/report-type/base-report.d.ts +6 -6
- package/types/utils/report/report-type/csv-report.d.ts +1 -0
- package/types/utils/report/report-type/interfaces.d.ts +32 -0
- package/types/utils/report/report-type/pdf-report.d.ts +4 -2
- package/types/utils/report/report-type/report-column-transformer.d.ts +9 -0
- package/types/utils/report/report-type/xls-report.d.ts +1 -0
- package/types/utils/report/report-type/xls2-report.d.ts +1 -0
- package/types/utils/report/report-type/xls3-report.d.ts +1 -0
- package/types/utils/report/report.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.110.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": "fc3c2ff25bee46c565577b6749a4d0539762407f"
|
|
47
47
|
}
|
|
@@ -59,6 +59,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
59
59
|
protected addCancelColumn(): void;
|
|
60
60
|
protected getCancelColumnProps(): IGridColumnEditable;
|
|
61
61
|
protected instantiateCancelColumn(): GridColumnEditable;
|
|
62
|
+
protected registerDatasourceCallback(): void;
|
|
62
63
|
protected createGridController(): void;
|
|
63
64
|
/**
|
|
64
65
|
* Changes column order
|
|
@@ -140,6 +141,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
140
141
|
* If the row[column.name] has a selected value, pushes it
|
|
141
142
|
*/
|
|
142
143
|
private checkLookupData;
|
|
144
|
+
private pushLookupRow;
|
|
143
145
|
private checkCompValidity;
|
|
144
146
|
/**
|
|
145
147
|
* change event of editable components
|
|
@@ -164,6 +166,8 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
164
166
|
*/
|
|
165
167
|
isValid(column: IGridColumnEditable, row: IDictionary, revalidate?: boolean): string | boolean;
|
|
166
168
|
private newRowIdentifier;
|
|
169
|
+
private positionIdentifier;
|
|
170
|
+
private pageIdentifier;
|
|
167
171
|
/**
|
|
168
172
|
* Cancels all edited rows and enable grid components
|
|
169
173
|
*/
|
|
@@ -205,7 +209,17 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
205
209
|
* @param position whether the new Row will be inserted at the beginning or end of the data array
|
|
206
210
|
*/
|
|
207
211
|
addNewRow(row: IDictionary, position?: 'end' | 'start'): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Saves a row reference in editedRows and addedRows
|
|
214
|
+
* @param row Row to be saved
|
|
215
|
+
*/
|
|
208
216
|
protected saveRowReference(row: IDictionary<any>): void;
|
|
217
|
+
/**
|
|
218
|
+
* Inserts a row in datasource depending on the position
|
|
219
|
+
* @param row Row to be inserted
|
|
220
|
+
* @param position Position, 'end' or 'start'
|
|
221
|
+
* @returns the data containing the newly added row
|
|
222
|
+
*/
|
|
209
223
|
protected insertRowInDatasource(row: IDictionary<any>, position: 'end' | 'start'): IDictionary<any>[];
|
|
210
224
|
/**
|
|
211
225
|
* Gets the editable component name
|
|
@@ -89,4 +89,9 @@ export declare class Column extends Component implements IColumn {
|
|
|
89
89
|
*/
|
|
90
90
|
applyActionCondition(row: IDictionary<any>): IDictionary<IDictionary<any>>;
|
|
91
91
|
onBeforeDestroy(): void;
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves a row from lookup using its key
|
|
94
|
+
* @returns the row object when found, null when it is not found or empty
|
|
95
|
+
*/
|
|
96
|
+
getLookupRow(value: any): IDictionary | null;
|
|
92
97
|
}
|
|
@@ -26,6 +26,7 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
|
|
|
26
26
|
limit: number | null;
|
|
27
27
|
showSelectAll: boolean;
|
|
28
28
|
showCheckboxAll: boolean;
|
|
29
|
+
protected formatterFn: Function;
|
|
29
30
|
/**
|
|
30
31
|
* Create a new Select.
|
|
31
32
|
* @param props Select properties
|
|
@@ -78,10 +79,6 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
|
|
|
78
79
|
* Removes unselected inserts from datasource
|
|
79
80
|
*/
|
|
80
81
|
private removeInserts;
|
|
81
|
-
/**
|
|
82
|
-
* Return formatted dataText and values
|
|
83
|
-
*/
|
|
84
|
-
formatter(value: IDictionary<any>[]): any;
|
|
85
82
|
/**
|
|
86
83
|
* Returns the text shown when there's one or more selected items that doesn't fit in the input
|
|
87
84
|
*/
|
|
@@ -11,6 +11,7 @@ export interface ISelectTreeNode<T> {
|
|
|
11
11
|
isDefaultExpanded?: boolean;
|
|
12
12
|
children?: ISelectTreeNode<T>[] | null;
|
|
13
13
|
row?: IDictionary<any>;
|
|
14
|
+
isMatched?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export interface ISelectTree extends ITextInput, ISelectDataValueOut {
|
|
16
17
|
nodes?: ISelectTreeNode<IDictionary>[];
|
|
@@ -116,11 +116,20 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
116
116
|
* Defines the name of the form target to set using dataValueOut
|
|
117
117
|
*/
|
|
118
118
|
dataValueOutFormName: string;
|
|
119
|
+
private discreteProps?;
|
|
120
|
+
protected formatterFn: Function;
|
|
119
121
|
/**
|
|
120
122
|
* Creates a new instance of SelectTree
|
|
121
123
|
* @param props
|
|
122
124
|
*/
|
|
123
125
|
constructor(props: ISelectTree);
|
|
126
|
+
/**
|
|
127
|
+
* Returns the currentRow in the dataText key
|
|
128
|
+
*/
|
|
129
|
+
formatter(value?: string | IDictionary<any>, props?: {
|
|
130
|
+
dataText: string | any[];
|
|
131
|
+
dataTextSeparator: string;
|
|
132
|
+
}): any;
|
|
124
133
|
focus(event: Event, element: any): Promise<void>;
|
|
125
134
|
protected afterFocus(): Promise<void>;
|
|
126
135
|
private createDataStructure;
|
|
@@ -128,7 +137,6 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
128
137
|
createNodesFromDatasource(buildTree?: boolean): void;
|
|
129
138
|
private createNodeFromRow;
|
|
130
139
|
private createChildrenNodes;
|
|
131
|
-
private formatRow;
|
|
132
140
|
/**
|
|
133
141
|
* Triggered when the menu opens
|
|
134
142
|
*/
|
|
@@ -142,6 +150,7 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
142
150
|
*/
|
|
143
151
|
select(node: ISelectTreeNode<IDictionary>, element?: any): void;
|
|
144
152
|
private savedNodes?;
|
|
153
|
+
search: string;
|
|
145
154
|
/**
|
|
146
155
|
* Triggered after the search query changes
|
|
147
156
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IDictionary } from '@zeedhi/core';
|
|
2
2
|
import { SelectTree } from '../zd-select-tree/select-tree';
|
|
3
3
|
import { ISelectTreeMultiple, ISelectTreeMultipleNode, ISelectTreeMultipleEvents } from './interfaces';
|
|
4
|
+
import { ISelectTreeNode } from '../zd-select-tree/interfaces';
|
|
4
5
|
/**
|
|
5
6
|
* Base class for Select Tree Multiple component.
|
|
6
7
|
*/
|
|
@@ -46,11 +47,41 @@ export declare class SelectTreeMultiple extends SelectTree implements ISelectTre
|
|
|
46
47
|
get value(): any;
|
|
47
48
|
set value(value: any);
|
|
48
49
|
setValue(value: any): void;
|
|
49
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves all nodes in the tree as a flat array. Nodes that are not matched are excluded
|
|
52
|
+
* Nodes that are not matched but whose parent is matched are included
|
|
53
|
+
* @param nodes
|
|
54
|
+
* @param matched defines whether the parent of the current node branch is matched
|
|
55
|
+
* @returns all nodes in the tree as a flat array, filtering unmatched nodes
|
|
56
|
+
*/
|
|
57
|
+
getAllNodes(nodes?: ISelectTreeNode<IDictionary<any>>[], matched?: boolean): ISelectTreeNode<IDictionary<any>>[];
|
|
50
58
|
/**
|
|
51
59
|
* Dispatches select/unselect event
|
|
52
60
|
*/
|
|
53
|
-
onSelectAll(isSelected: boolean, event: Event, element: any): void;
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
onSelectAll(isSelected: boolean, event: Event, element: any, nodes?: ISelectTreeNode<IDictionary<any>>[]): void;
|
|
62
|
+
/**
|
|
63
|
+
* Selects all items in the tree \
|
|
64
|
+
* If the component is fetchOnDemand, it will select all values from datasource.data \
|
|
65
|
+
* If not, it will select all nodes from the tree, unless the nodes to be selected are specified
|
|
66
|
+
* @param nodes nodes to be selected. These are the nodes that are currently visible in the tree
|
|
67
|
+
* (if the user is searching, selects only the searched nodes)
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
selectAllItems(nodes?: ISelectTreeNode<IDictionary<any>>[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* Unelects all items in the tree \
|
|
73
|
+
* If the component is fetchOnDemand, it will select all values from datasource.data \
|
|
74
|
+
* If not, it will select all nodes from the tree, unless the nodes to be selected are specified
|
|
75
|
+
* @param nodes nodes to be selected. These are the nodes that are currently visible in the tree
|
|
76
|
+
* (if the user is searching, selects only the searched nodes)
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
unSelectAllItems(nodes?: ISelectTreeNode<IDictionary<any>>[]): void;
|
|
80
|
+
/**
|
|
81
|
+
* Takes two arrays and creates a map of the unique values
|
|
82
|
+
* @returns map of a merge between the two arrays, removing duplicates
|
|
83
|
+
*/
|
|
84
|
+
private createMergeMap;
|
|
85
|
+
getValueIds(): any;
|
|
86
|
+
getValueAsObject(): any;
|
|
56
87
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { IDictionary } from '@zeedhi/core';
|
|
2
2
|
import { IColumn } from '../../../components';
|
|
3
|
-
import { IReportType,
|
|
3
|
+
import { IReportType, MetadataFilter, LabelFormatter } from './interfaces';
|
|
4
|
+
import { ReportColumnTransformer } from './report-column-transformer';
|
|
4
5
|
export declare abstract class BaseReport implements IReportType {
|
|
6
|
+
reportColumnTransformer: ReportColumnTransformer;
|
|
7
|
+
constructor(labelFormatter?: LabelFormatter);
|
|
8
|
+
protected getReportColumnTransformer(labelFormatter?: LabelFormatter): ReportColumnTransformer;
|
|
9
|
+
abstract getFileType(): string;
|
|
5
10
|
abstract route: string;
|
|
6
11
|
abstract buildDataset(data: IDictionary<any>[], metadata?: any): any;
|
|
7
12
|
abstract buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>, portrait?: boolean): Promise<any>;
|
|
8
|
-
protected getColumnsWidth(columns: IColumn[]): {
|
|
9
|
-
widths: IDictionary<number>;
|
|
10
|
-
totalWidth: number;
|
|
11
|
-
};
|
|
12
|
-
protected buildColumns(columns: IColumn[]): MetadataColumn;
|
|
13
13
|
protected buildFilter(filter: IDictionary, columns: IColumn[]): MetadataFilter;
|
|
14
14
|
protected formatLangCode(lang?: string): string;
|
|
15
15
|
protected expressionZeedhiToXls: any;
|
|
@@ -2,6 +2,7 @@ import { IDictionary } from '@zeedhi/core';
|
|
|
2
2
|
import { IColumn } from '../../../components';
|
|
3
3
|
import { BaseReport } from './base-report';
|
|
4
4
|
export declare class CSVReport extends BaseReport {
|
|
5
|
+
getFileType(): string;
|
|
5
6
|
readonly route: string;
|
|
6
7
|
buildDataset(data: IDictionary<any>[], columns: IColumn[]): string;
|
|
7
8
|
buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>): Promise<string>;
|
|
@@ -45,3 +45,35 @@ export interface IMetadataObj {
|
|
|
45
45
|
xlsMergedCell?: any[];
|
|
46
46
|
xlsDefaultType?: string;
|
|
47
47
|
}
|
|
48
|
+
export declare type ReportFixFormat = {
|
|
49
|
+
type: 'fix';
|
|
50
|
+
params: {
|
|
51
|
+
mask: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare type ReportCurrencyFormat = {
|
|
55
|
+
type: 'currency';
|
|
56
|
+
symbol: string;
|
|
57
|
+
decimal: string;
|
|
58
|
+
thousands: string;
|
|
59
|
+
precision: number;
|
|
60
|
+
};
|
|
61
|
+
export declare type ReportNumberFormat = {
|
|
62
|
+
params: {
|
|
63
|
+
decimal: string;
|
|
64
|
+
thousands: string;
|
|
65
|
+
precision: number;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare type ReportFormat = ReportFixFormat | ReportCurrencyFormat | ReportNumberFormat;
|
|
69
|
+
export declare type GetFormatFn = (col: IColumn) => ReportFormat;
|
|
70
|
+
export declare type LabelFormatterParams = {
|
|
71
|
+
column: IColumn;
|
|
72
|
+
fileType: string;
|
|
73
|
+
};
|
|
74
|
+
export declare type LabelFormatter = ({ column, fileType }: LabelFormatterParams) => string;
|
|
75
|
+
export declare type ReportColumnTransformerParams = {
|
|
76
|
+
getFormatFn?: GetFormatFn;
|
|
77
|
+
labelFormatter?: LabelFormatter;
|
|
78
|
+
fileType: string;
|
|
79
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { IDictionary } from '@zeedhi/core';
|
|
2
2
|
import { IColumn } from '../../../components';
|
|
3
3
|
import { BaseReport } from './base-report';
|
|
4
|
-
import {
|
|
4
|
+
import { LabelFormatter } from './interfaces';
|
|
5
|
+
import { ReportColumnTransformer } from './report-column-transformer';
|
|
5
6
|
export declare class PDFReport extends BaseReport {
|
|
7
|
+
getFileType(): string;
|
|
6
8
|
readonly route: string;
|
|
9
|
+
protected getReportColumnTransformer(labelFormatter?: LabelFormatter): ReportColumnTransformer;
|
|
7
10
|
buildDataset(data: IDictionary<any>[]): string;
|
|
8
|
-
protected buildColumns(columns: IColumn[]): MetadataColumn;
|
|
9
11
|
private getFormatOfColumn;
|
|
10
12
|
private isNumberComponent;
|
|
11
13
|
private checkAccessor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MetadataColumn, ReportColumnTransformerParams } from './interfaces';
|
|
2
|
+
export declare class ReportColumnTransformer {
|
|
3
|
+
private getFormatFn?;
|
|
4
|
+
private labelFormatter?;
|
|
5
|
+
private fileType;
|
|
6
|
+
constructor({ getFormatFn, labelFormatter, fileType }: ReportColumnTransformerParams);
|
|
7
|
+
private getColumnsWidth;
|
|
8
|
+
transform(columns: any[]): MetadataColumn;
|
|
9
|
+
}
|
|
@@ -2,6 +2,7 @@ import { IDictionary } from '@zeedhi/core';
|
|
|
2
2
|
import { IColumn } from '../../../components';
|
|
3
3
|
import { BaseReport } from './base-report';
|
|
4
4
|
export declare class XLSReport extends BaseReport {
|
|
5
|
+
getFileType(): string;
|
|
5
6
|
readonly route: string;
|
|
6
7
|
buildDataset(data: IDictionary<any>[], columns: IColumn[]): string;
|
|
7
8
|
private formatRawDataSet;
|
|
@@ -3,6 +3,7 @@ import { IColumn } from '../../../components';
|
|
|
3
3
|
import { BaseReport } from './base-report';
|
|
4
4
|
import { IMetadataObj } from './interfaces';
|
|
5
5
|
export declare class XLS2Report extends BaseReport {
|
|
6
|
+
getFileType(): string;
|
|
6
7
|
readonly route: string;
|
|
7
8
|
buildDataset(data: IDictionary<any>[], metadata: IMetadataObj): string;
|
|
8
9
|
buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>): Promise<string>;
|
|
@@ -3,6 +3,7 @@ import { IColumn } from '../../../components';
|
|
|
3
3
|
import { BaseReport } from './base-report';
|
|
4
4
|
import { IMetadataObj } from './interfaces';
|
|
5
5
|
export declare class XLS3Report extends BaseReport {
|
|
6
|
+
getFileType(): string;
|
|
6
7
|
readonly route: string;
|
|
7
8
|
buildDataset(data: IDictionary<any>[], metadata: IMetadataObj): string;
|
|
8
9
|
buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>): Promise<string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IDictionary } from '@zeedhi/core';
|
|
2
2
|
import { Iterable } from '../../components';
|
|
3
|
+
import { LabelFormatter } from './report-type';
|
|
3
4
|
import { IBeforeReportEvent, IReport } from './interfaces';
|
|
4
5
|
export declare class Report implements IReport {
|
|
5
6
|
iterable: Iterable;
|
|
@@ -12,6 +13,6 @@ export declare class Report implements IReport {
|
|
|
12
13
|
private isToggleableComponent;
|
|
13
14
|
private getData;
|
|
14
15
|
private getReportType;
|
|
15
|
-
getReport(type: string, portrait?: boolean, rowObj?: any, beforeReportEvent?: IBeforeReportEvent): Promise<string>;
|
|
16
|
+
getReport(type: string, portrait?: boolean, rowObj?: any, beforeReportEvent?: IBeforeReportEvent, labelFormatter?: LabelFormatter): Promise<string>;
|
|
16
17
|
private filterColumns;
|
|
17
18
|
}
|