@zeedhi/common 1.95.1 → 1.96.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.95.1",
3
+ "version": "1.96.1",
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": "61b544362928fc5b8e27258a628420d31345e6f3"
46
+ "gitHead": "5898cc8926fdb11f3fbc71af1e587cd0bb1f53b1"
47
47
  }
@@ -70,6 +70,7 @@ export * from './zd-increment/increment';
70
70
  export * from './zd-increment/interfaces';
71
71
  export * from './zd-input/input';
72
72
  export * from './zd-input/interfaces';
73
+ export * from './zd-input/input-factory';
73
74
  export * from './zd-iterable/column';
74
75
  export * from './zd-iterable/iterable';
75
76
  export * from './zd-iterable/column-not-found';
@@ -65,6 +65,7 @@ export declare class FileInput extends TextInput implements IFileInput {
65
65
  */
66
66
  protected internalValue: any;
67
67
  selectFileButton: IButton;
68
+ private viewGetFileSizes;
68
69
  /**
69
70
  * Create a new FileInput
70
71
  * @param props FileInput definition
@@ -95,4 +96,6 @@ export declare class FileInput extends TextInput implements IFileInput {
95
96
  * @param files File array
96
97
  */
97
98
  dropFiles(files: File[]): void;
99
+ setViewGetFileSizes(getFileSizes: () => object): void;
100
+ protected updateRules(): void;
98
101
  }
@@ -11,6 +11,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
11
11
  * Editable columns
12
12
  */
13
13
  columns: GridColumnEditable[];
14
+ currentColumn: GridColumnEditable;
14
15
  /**
15
16
  * Editing rows
16
17
  */
@@ -135,7 +136,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
135
136
  * @param column Column
136
137
  * @param row Row
137
138
  */
138
- isValid(column: IGridColumnEditable, row: IDictionary, revalidate?: boolean): boolean;
139
+ isValid(column: IGridColumnEditable, row: IDictionary, revalidate?: boolean): string | boolean;
139
140
  private newRowIdentifier;
140
141
  /**
141
142
  * Cancels all edited rows and enable grid components
@@ -160,6 +161,10 @@ export declare class GridEditable extends Grid implements IGridEditable {
160
161
  * @param revalidate Defines if the fields should be revalidated
161
162
  */
162
163
  isGridValid(revalidate?: boolean): boolean;
164
+ /**
165
+ * Checks whether the grid is valid while not in editing mode
166
+ */
167
+ private isViewGridValid;
163
168
  /**
164
169
  * Adds new row to the datasource data and pushes it to the editedRows
165
170
  * @param row Row
@@ -1,4 +1,4 @@
1
- import { IDictionary, IKeyMap } from '@zeedhi/core';
1
+ import { IDictionary, IEventParam, IKeyMap } from '@zeedhi/core';
2
2
  import { Component } from '../zd-component/component';
3
3
  import { IComponent, IComponentRender } from '../zd-component/interfaces';
4
4
  import { Iterable } from '../zd-iterable/iterable';
@@ -143,8 +143,8 @@ export declare class Grid extends Iterable implements IGrid {
143
143
  };
144
144
  cellSelection: boolean;
145
145
  currentColumn: Column | null;
146
- protected viewNavigate: ((direction: 'up' | 'down' | 'left' | 'right') => void) | null;
147
- setViewNavigate(viewNavigate: (up: 'up' | 'down' | 'left' | 'right') => void): void;
146
+ protected viewNavigate: ((direction: 'up' | 'down' | 'left' | 'right', event?: Event) => void) | null;
147
+ setViewNavigate(viewNavigate: (up: 'up' | 'down' | 'left' | 'right', event?: Event) => void): void;
148
148
  /**
149
149
  * Creates a new Grid.
150
150
  * @param props Grid properties
@@ -208,10 +208,15 @@ export declare class Grid extends Iterable implements IGrid {
208
208
  selectAll(isSelected: boolean): void;
209
209
  toggleRow(row: IDictionary): void;
210
210
  selectRow(row: IDictionary, select: boolean): void;
211
- navigateLeft(): void;
212
- navigateRight(): void;
211
+ navigateLeft({ event }: IEventParam<any>): void;
212
+ navigateRight({ event }: IEventParam<any>): void;
213
213
  navigateUp(): void;
214
214
  navigateDown(): void;
215
+ navigateDatasource(up: boolean): void;
216
+ navigateCurrentRow(up: boolean, rowIndex: number): void;
217
+ navigateInitial(up: boolean): void;
218
+ navigateFirst(): void;
219
+ navigateLast(): void;
215
220
  navigatePageUp(): void;
216
221
  navigatePageDown(): void;
217
222
  deleteRows(): Promise<any[]>;
@@ -0,0 +1,6 @@
1
+ import { IDictionary, INewable } from '@zeedhi/core';
2
+ export declare class InputFactory {
3
+ private static inputClasses;
4
+ static register(className: string, inputClass: INewable<any>): void;
5
+ static factory(props: IDictionary<any>): any;
6
+ }
@@ -74,7 +74,7 @@ export declare class Input extends ComponentRender implements IInput {
74
74
  /**
75
75
  * Rules that will validate the input value.
76
76
  */
77
- rules: ((value: any) => boolean | string)[];
77
+ rules: ((value?: any) => boolean | string)[];
78
78
  /**
79
79
  * Shows input border.
80
80
  */
@@ -110,7 +110,7 @@ export declare class Input extends ComponentRender implements IInput {
110
110
  /**
111
111
  * Parsed field rules.
112
112
  */
113
- private parsedValidations;
113
+ protected parsedValidations: IDictionary<((value?: any) => boolean | string)>;
114
114
  protected formatterFn: Function;
115
115
  protected parserFn: Function;
116
116
  protected internalDisplayValue: string;
@@ -124,11 +124,11 @@ export declare class Input extends ComponentRender implements IInput {
124
124
  /**
125
125
  * Validates input.
126
126
  */
127
- validate(): boolean;
127
+ validate(): string | boolean;
128
128
  /**
129
129
  * Sets view validation method.
130
130
  */
131
- setViewValidate(viewValidate: () => boolean): void;
131
+ setViewValidate(viewValidate: () => boolean | string): void;
132
132
  /**
133
133
  * Sets view reset validation method.
134
134
  */
@@ -161,7 +161,7 @@ export declare class Input extends ComponentRender implements IInput {
161
161
  /**
162
162
  * Updates input rules.
163
163
  */
164
- private updateRules;
164
+ protected updateRules(): void;
165
165
  /**
166
166
  * Input value.
167
167
  */
@@ -188,7 +188,7 @@ export declare class Input extends ComponentRender implements IInput {
188
188
  * Checks the input value are valid to all applied rules.
189
189
  * @returns Input is valid
190
190
  */
191
- isValid(): boolean;
191
+ isValid(value?: any): boolean;
192
192
  /**
193
193
  * Triggered when the input value changes.
194
194
  * @param event DOM event
@@ -1,5 +1,12 @@
1
- import { IComponent } from '../zd-component/interfaces';
1
+ import { IEventParam } from '@zeedhi/core';
2
+ import { IComponent, IComponentEvents, EventDef } from '../zd-component/interfaces';
2
3
  import { IButton } from '../zd-button/interfaces';
4
+ import { Modal } from './modal';
5
+ export declare type IModalEvent = IEventParam<Modal>;
6
+ export interface IModalEvents<T = IEventParam<any>> extends IComponentEvents<T> {
7
+ onShow?: EventDef<T>;
8
+ onHide?: EventDef<T>;
9
+ }
3
10
  export interface IModalGrid {
4
11
  cols?: number | string;
5
12
  xs?: number | string;
@@ -21,6 +28,7 @@ export interface IModal extends IComponent {
21
28
  draggable?: boolean;
22
29
  dragHandle?: string;
23
30
  escKeydownStop?: boolean;
31
+ events?: IModalEvents;
24
32
  }
25
33
  export interface IModalCloseButton extends IButton {
26
34
  modalName: string;
@@ -1,4 +1,4 @@
1
- import { IModal, IModalGrid } from './interfaces';
1
+ import { IModal, IModalEvents, IModalGrid } from './interfaces';
2
2
  import { Component } from '../zd-component/component';
3
3
  /**
4
4
  * Base class for Modal component.
@@ -29,6 +29,10 @@ export declare class Modal extends Component implements IModal {
29
29
  * Set if esc keydown event should to stop propagation
30
30
  */
31
31
  escKeydownStop?: boolean;
32
+ /**
33
+ * Defines modal events.
34
+ */
35
+ events: IModalEvents;
32
36
  /**
33
37
  * Creates a new modal
34
38
  * @param props Modal structure
@@ -1,7 +1,7 @@
1
1
  import { IDatasource } from '@zeedhi/core';
2
2
  import { ITextInput } from '../zd-text-input/interfaces';
3
3
  import { IComponentRender } from '../zd-component/interfaces';
4
- export declare type SearchParam = 'SEARCH' | 'FILTER' | 'FIND';
4
+ export declare type SearchParam = 'SEARCH' | 'FILTER' | 'FIND' | 'DYNAMIC_FILTER';
5
5
  export interface ISelect extends ITextInput {
6
6
  autocomplete?: boolean;
7
7
  autoSelection?: boolean;
@@ -97,6 +97,15 @@ export declare class Select extends TextInput implements ISelect {
97
97
  [x: string]: any;
98
98
  };
99
99
  };
100
+ DYNAMIC_FILTER: (value: unknown, search_in: string) => {
101
+ dynamicFilter: {
102
+ [x: string]: {
103
+ operation: string;
104
+ relation: string;
105
+ value: any;
106
+ }[];
107
+ };
108
+ };
100
109
  };
101
110
  /**
102
111
  * Input search value
@@ -135,7 +144,7 @@ export declare class Select extends TextInput implements ISelect {
135
144
  * Finds and retrieves items searching by value
136
145
  * @param value Default value
137
146
  */
138
- protected getItemsBySearchValue(value: any, searchIn: string): Promise<any>;
147
+ protected getItemsBySearchValue(value: any, searchIn: string): Promise<any[]>;
139
148
  protected getCondition(filterValue: any): (row: any) => boolean;
140
149
  focus(event: Event, element: any): Promise<void>;
141
150
  protected afterFocus(): Promise<void>;
@@ -13,4 +13,6 @@ export interface ISelectMultiple extends ISelect {
13
13
  events?: ISelectMultipleEvents;
14
14
  maxRows?: string | number;
15
15
  limit?: number | null;
16
+ showCheckboxAll?: boolean;
17
+ checkboxAll?: boolean;
16
18
  }
@@ -24,6 +24,7 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
24
24
  */
25
25
  limit: number | null;
26
26
  showSelectAll: boolean;
27
+ showCheckboxAll: boolean;
27
28
  /**
28
29
  * Create a new Select.
29
30
  * @param props Select properties
@@ -34,6 +35,9 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
34
35
  */
35
36
  get selectValue(): IDictionary<any>[];
36
37
  set selectValue(rows: IDictionary<any>[]);
38
+ private checkboxAllValue;
39
+ get checkboxAll(): boolean;
40
+ set checkboxAll(value: boolean);
37
41
  /**
38
42
  * Removes item from array a and add it to array b if condition is satisfied
39
43
  */
@@ -104,4 +108,8 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
104
108
  protected checkValueOnBlur(): void;
105
109
  protected afterFocus(): Promise<void>;
106
110
  private setCache;
111
+ /**
112
+ * Updates input rules.
113
+ */
114
+ protected updateRules(): void;
107
115
  }
@@ -12,6 +12,7 @@ export interface ITextInput extends IInput {
12
12
  appendIcon?: string;
13
13
  appendOuterIcon?: string;
14
14
  events?: ITextInputEvents;
15
+ focusOnOuterIconClick?: boolean;
15
16
  prependIcon?: string;
16
17
  prependOuterIcon?: string;
17
18
  type?: string;
@@ -44,6 +44,10 @@ export declare class TextInput extends Input implements ITextInput {
44
44
  * Defines text input value should concat the suffix text.
45
45
  */
46
46
  valueWithSuffix: boolean;
47
+ /**
48
+ * Defines clicks on outer icon should focus the component.
49
+ */
50
+ focusOnOuterIconClick: boolean;
47
51
  protected formatterFn: Function;
48
52
  protected parserFn: Function;
49
53
  /**
@@ -8,6 +8,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
8
8
  * Editable columns
9
9
  */
10
10
  columns: GridColumnEditable[];
11
+ currentColumn: GridColumnEditable;
11
12
  /**
12
13
  * Editing rows
13
14
  */
@@ -126,7 +127,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
126
127
  * @param column Column
127
128
  * @param row Row
128
129
  */
129
- isValid(column: IGridColumnEditable, row: IDictionary, revalidate?: boolean): boolean;
130
+ isValid(column: IGridColumnEditable, row: IDictionary, revalidate?: boolean): string | boolean;
130
131
  /**
131
132
  * Cancels all edited rows and enable grid components
132
133
  */
@@ -84,14 +84,7 @@ export declare class TreeGrid extends Grid implements ITreeGrid {
84
84
  * @param collapse Should collapse
85
85
  */
86
86
  navigateToggle(collapse: boolean): void;
87
- /**
88
- * Navigate upwards
89
- */
90
- navigateUp(): void;
91
- /**
92
- * Navigate downwards
93
- */
94
- navigateDown(): void;
87
+ navigateDatasource(up: boolean): void;
95
88
  private removeDuplicates;
96
89
  /**
97
90
  * Select/deselect rows
@@ -0,0 +1,47 @@
1
+ import { IDictionary } from '@zeedhi/core';
2
+ declare type GroupHeader = {
3
+ group: boolean;
4
+ groupRow: IDictionary;
5
+ groupColumnName: string;
6
+ groupHeader: boolean;
7
+ groupIndex: number;
8
+ groupLabel: string;
9
+ groupValue: number | string;
10
+ groupOpened: boolean;
11
+ groupHeaders: GroupHeader[];
12
+ children: IDictionary[];
13
+ };
14
+ declare type GroupFooter = {
15
+ groupFooter: boolean;
16
+ groupIndex: number;
17
+ groupHeaders: GroupHeader[];
18
+ groupLabel: string;
19
+ groupValue: number | string;
20
+ groupSummary?: boolean;
21
+ [key: string]: any;
22
+ };
23
+ declare type DataItem = IDictionary & {
24
+ groupHeaders?: GroupHeader[];
25
+ };
26
+ export declare type InputDataEntry = GroupHeader | DataItem | GroupFooter;
27
+ declare type OutputGroupData = {
28
+ __group: boolean;
29
+ __groupHeader?: boolean;
30
+ __groupFooter?: boolean;
31
+ __groupIndex: number;
32
+ __groupLabel: string;
33
+ __groupValue: string;
34
+ __groupOpened?: boolean;
35
+ __groupSummary?: boolean;
36
+ [key: string]: any;
37
+ };
38
+ export declare type OutputDataEntry = OutputGroupData | IDictionary;
39
+ /**
40
+ * Class used to format grouped data into the ZhReports format
41
+ */
42
+ export declare class GroupedPDFFormatter {
43
+ format(data: InputDataEntry[]): OutputDataEntry[];
44
+ isGroupHeader(entry: InputDataEntry): entry is GroupHeader;
45
+ isGroupFooter(entry: InputDataEntry): entry is GroupFooter;
46
+ }
47
+ export {};
@@ -0,0 +1 @@
1
+ export * from './grouped-pdf-formatter';
@@ -6,3 +6,4 @@ export * from './report-type/xls-report';
6
6
  export * from './report-type/xls2-report';
7
7
  export * from './report-type/xls3-report';
8
8
  export * from './report-type/interfaces';
9
+ export * from './dataset-formatters';
@@ -11,5 +11,5 @@ export declare class Report implements IReport {
11
11
  private getData;
12
12
  private getReportType;
13
13
  getReport(type: string, portrait?: boolean, rowObj?: any, beforeReportEvent?: IBeforeReportEvent): Promise<string>;
14
- private removeColumns;
14
+ private filterColumns;
15
15
  }