@zeedhi/common 1.52.0 → 1.55.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.52.0",
3
+ "version": "1.55.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -37,5 +37,5 @@
37
37
  "lodash.times": "^4.3.2",
38
38
  "mockdate": "^3.0.2"
39
39
  },
40
- "gitHead": "7831436c706ebc6f781d756f5f80f393bf053b9b"
40
+ "gitHead": "832a10a71ea046b631344b008e676c1706617cec"
41
41
  }
@@ -72,6 +72,7 @@ export * from './zd-input/input';
72
72
  export * from './zd-input/interfaces';
73
73
  export * from './zd-iterable/column';
74
74
  export * from './zd-iterable/iterable';
75
+ export * from './zd-iterable/column-not-found';
75
76
  export * from './zd-iterable/iterable-columns-button';
76
77
  export * from './zd-iterable/iterable-columns-button-controller';
77
78
  export * from './zd-iterable/iterable-page-component';
@@ -3,6 +3,7 @@ import { ComponentRender } from '../zd-component/component-render';
3
3
  import { IButton } from '../zd-button/interfaces';
4
4
  import { Modal } from '../zd-modal/modal';
5
5
  import { IModal } from '../zd-modal/interfaces';
6
+ import { IComponentRender } from '../zd-component/interfaces';
6
7
  /**
7
8
  * Base class for Dashboard component.
8
9
  */
@@ -13,11 +14,12 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
13
14
  cards: IDashboardCard[];
14
15
  addModal?: Modal;
15
16
  editModal?: Modal;
16
- deleteCardId: string;
17
17
  overrideNamedProps: any;
18
18
  removePadding: boolean;
19
19
  height: string | number;
20
20
  heightAdjust: string | number;
21
+ cardFooterSlot?: IComponentRender[];
22
+ currentCardId?: string;
21
23
  addModalDef: IModal;
22
24
  editModalDef: IModal;
23
25
  /**
@@ -28,7 +30,8 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
28
30
  onMounted(element: any): void;
29
31
  onBeforeDestroy(): void;
30
32
  addCard(): void;
31
- deleteCard(): void;
33
+ deleteCard(cardId: string): void;
34
+ deleteAndCloseDialog(cardId: string): void;
32
35
  showDeleteCardDialog(cardId: string): void;
33
36
  private hideDialog;
34
37
  updateCard(): void;
@@ -50,7 +53,7 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
50
53
  local: boolean;
51
54
  overrideNamedProps: any;
52
55
  };
53
- getFooterRightSlot(cardId: string): ({
56
+ getFooterRightSlot(cardId: string): IComponentRender[] | ({
54
57
  name: string;
55
58
  component: string;
56
59
  bottom: boolean;
@@ -81,4 +84,5 @@ export declare class Dashboard extends ComponentRender implements IDashboard {
81
84
  }[];
82
85
  })[];
83
86
  private getCardId;
87
+ selectCard(cardId: string): void;
84
88
  }
@@ -18,6 +18,7 @@ export interface IDashboard extends IComponentRender {
18
18
  removePadding?: boolean;
19
19
  height?: string | number;
20
20
  heightAdjust?: string | number;
21
+ cardFooterSlot?: IComponentRender[];
21
22
  }
22
23
  export interface IDashboardCard extends Omit<ICard, 'name' | 'component'> {
23
24
  cardId: string;
@@ -55,7 +55,7 @@ export declare class Date extends TextInput implements IDate {
55
55
  /**
56
56
  * Determines the type of the picker - date for date picker, month for month picker.
57
57
  */
58
- pickerType: string;
58
+ protected pickerType: string;
59
59
  /**
60
60
  * Helper options.
61
61
  */
@@ -16,7 +16,6 @@ export interface IDate extends ITextInput {
16
16
  fullWidth?: boolean;
17
17
  locale?: string;
18
18
  inputFormat?: string;
19
- pickerType?: string;
20
19
  scrollable?: boolean;
21
20
  showDatePicker?: boolean;
22
21
  showWeek?: boolean;
@@ -18,6 +18,13 @@ export declare class GridEditable extends Grid implements IGridEditable {
18
18
  * Enter edit mode on double click
19
19
  */
20
20
  doubleClickEdit: boolean;
21
+ /**
22
+ * Function to check if row can be edited
23
+ */
24
+ canEditRow?: (args: {
25
+ row: IDictionary<any>;
26
+ component: GridEditable;
27
+ }) => boolean;
21
28
  /**
22
29
  * Edited rows
23
30
  * @private
@@ -62,7 +69,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
62
69
  * @param event DOM event
63
70
  * @param element DOM Element
64
71
  */
65
- cellClick(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any): void;
72
+ cellClick(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any, canEdit?: boolean): void;
66
73
  cellClickEvent(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any): void;
67
74
  /**
68
75
  * Dispatches select/unselect event
@@ -176,4 +183,5 @@ export declare class GridEditable extends Grid implements IGridEditable {
176
183
  * @param value Value to be set in the cell
177
184
  */
178
185
  private changeCell;
186
+ callCanEditRow(row: IDictionary<any>): boolean;
179
187
  }
@@ -105,6 +105,15 @@ export declare class Grid extends Iterable implements IGrid {
105
105
  * @public
106
106
  */
107
107
  resizeColumns: boolean;
108
+ /**
109
+ * Disable selection of specific rows using controller
110
+ * @public
111
+ */
112
+ disableSelection?: (args: {
113
+ row: IDictionary<any>;
114
+ component: Grid;
115
+ }) => boolean;
116
+ showSelectAll: boolean;
108
117
  /**
109
118
  * Creates a new Grid.
110
119
  * @param props Grid properties
@@ -167,4 +176,5 @@ export declare class Grid extends Iterable implements IGrid {
167
176
  deleteRows(): Promise<any[]>;
168
177
  getActionComponent(actionComponent: IComponent, column: GridColumn, row: IDictionary, parentPath?: string): IComponent;
169
178
  protected changeDefaultSlotNames(slot: IComponentRender[]): IComponentRender[];
179
+ callDisableSelection(row: IDictionary<any>): boolean;
170
180
  }
@@ -2,6 +2,7 @@ import { IEventParam, IDictionary, IEvent } from '@zeedhi/core';
2
2
  import { Grid } from './grid';
3
3
  import { IIterable, IColumn, IIterableEvents } from '../zd-iterable/interfaces';
4
4
  import { IComponentRender } from '../zd-component/interfaces';
5
+ import { GridEditable } from './grid-editable';
5
6
  export interface IGridEvent extends IEventParam<Grid> {
6
7
  row: IDictionary;
7
8
  column: IColumn;
@@ -40,6 +41,11 @@ export interface IGrid extends IIterable {
40
41
  loadingText?: string;
41
42
  noDataText?: string;
42
43
  noResultsText?: string;
44
+ disableSelection?: (args: {
45
+ row: IDictionary<any>;
46
+ component: Grid;
47
+ }) => boolean;
48
+ showSelectAll?: boolean;
43
49
  }
44
50
  export interface IGridColumn extends IColumn {
45
51
  children?: IChildrenActionColumn[];
@@ -53,4 +59,9 @@ export interface IGridColumnEditable extends IGridColumn {
53
59
  export interface IGridEditable extends IGrid {
54
60
  columns?: IGridColumnEditable[];
55
61
  doubleClickEdit?: boolean;
62
+ events?: IGridEditableEvents;
63
+ canEditRow?: (args: {
64
+ row: IDictionary<any>;
65
+ component: GridEditable;
66
+ }) => boolean;
56
67
  }
@@ -16,10 +16,11 @@ export declare class Month extends Date implements IMonth {
16
16
  * Defines the month input format.
17
17
  */
18
18
  inputFormat?: string;
19
+ protected isoFormat: string;
19
20
  /**
20
21
  * Determines the type of the picker - month for month picker.
21
22
  */
22
- pickerType: string;
23
+ protected pickerType: string;
23
24
  protected formatterFn: Function;
24
25
  protected parserFn: Function;
25
26
  /**
@@ -27,5 +28,4 @@ export declare class Month extends Date implements IMonth {
27
28
  * @param props Month properties
28
29
  */
29
30
  constructor(props: IMonth);
30
- protected maskFormat(format: string): string;
31
31
  }
@@ -19,4 +19,5 @@ export interface ITime extends ITextInput {
19
19
  timeFormat?: string;
20
20
  useSeconds?: boolean;
21
21
  valueFormat?: string;
22
+ inputFormat?: string;
22
23
  }
@@ -59,34 +59,77 @@ export declare class Time extends TextInput implements ITime {
59
59
  width: number | string;
60
60
  protected formatterFn: Function;
61
61
  protected parserFn: Function;
62
+ private isoFormatValue;
63
+ private valueFormatInternal;
64
+ private displayFormatInternal;
62
65
  /**
63
- * Map of the mask functions
66
+ * Defines the time input format.
64
67
  */
65
- protected maskFunctions: IDictionary<(value: string) => (string | RegExp)[]>;
66
- /**
67
- * Format used in time value
68
- */
69
- valueFormat: string;
70
- /**
71
- * Format used to display the value
72
- */
73
- displayFormat: string;
68
+ inputFormat?: string;
74
69
  /**
75
70
  * True when displayValue is valid
76
71
  */
77
72
  protected isDisplayValid: boolean;
73
+ protected initialMask?: string;
74
+ protected isSimpleDisplay: boolean;
75
+ protected timeError: boolean;
78
76
  /**
79
77
  * Create a new Time Picker.
80
78
  * @param props Time properties
81
79
  */
82
80
  constructor(props: ITime);
83
- protected createFormatAccessors(): void;
84
- protected get defaultValueFmt(): string;
85
- protected get defaultDisplayFmt(): string;
81
+ get displayFormat(): string;
82
+ set displayFormat(value: string);
83
+ get valueFormat(): string;
84
+ set valueFormat(value: string);
85
+ private get isoFormat();
86
86
  protected get defaultFormats(): IDictionary<string>;
87
- protected ampmMask(): (string | RegExp)[];
88
- protected fullTimeMask(value: string): (string | RegExp)[];
89
- protected getMask(value: string): (string | RegExp)[];
87
+ private getInitialMask;
88
+ formatter(value: string): string;
89
+ parser(value: string): any;
90
+ /**
91
+ * Triggered when date is clicked.
92
+ * @param event
93
+ * @param element
94
+ */
95
+ selectTime(time: string, event?: Event, element?: any): void;
96
+ get displayValue(): string;
97
+ set displayValue(newValue: string);
98
+ /**
99
+ * Assign the updated mask to mask property
100
+ */
101
+ updateMask(): any;
102
+ /**
103
+ * Gets the updated masked, based on displayFormat if the initial mask is undefined
104
+ */
105
+ protected getUpdatedMask(): string;
106
+ protected maskFormat(format: string): string;
107
+ setTimeValue(displayValue: string): void;
108
+ isValidTime(value: string, format: string | undefined, strict?: boolean): boolean;
109
+ get isoValue(): string;
110
+ set isoValue(newValue: string);
111
+ formatISOTimeValue(value: string): string;
112
+ parseISOTimeValue(value: string): any;
113
+ /**
114
+ * Checks if a time format is simple.
115
+ * Simple time formats are the ones that consists only of 'HH', 'mm', 'mm' or 'YYYY', and mask delimiters
116
+ * @param format The format to be checked
117
+ * @returns true if it is simple, false otherwise
118
+ */
119
+ protected isSimpleFormat(format: string): boolean;
120
+ timeValidation(): boolean | string;
121
+ timeAllowedValidation(): boolean | string;
122
+ click(event?: Event, element?: any): void;
123
+ blur(event: Event, element: any): void;
124
+ focus(event: Event, element: any): void;
125
+ /**
126
+ * Add date mask
127
+ */
128
+ protected addTimeMask(): void;
129
+ /**
130
+ * Removes the component mask if value is valid
131
+ */
132
+ protected removeTimeMask(): void;
90
133
  /**
91
134
  * Checks if value is valid according to valueFormat and if displayValue
92
135
  * is true
@@ -95,18 +138,11 @@ export declare class Time extends TextInput implements ITime {
95
138
  /**
96
139
  * Last invalid value passed to formatter
97
140
  */
98
- private lastInvalid;
99
- formatter(value: string): string;
100
- parser(value: string): any;
101
- isValidTime(value: string, format?: string): boolean;
102
141
  isTimeAllowed(value?: string): boolean;
103
142
  isSameOrAfterMin(value: string): boolean;
104
143
  isSameOrBeforeMax(value: string): boolean;
105
144
  isHourAllowed(value: string): boolean;
106
145
  isMinuteAllowed(value: string): boolean;
107
146
  isSecondAllowed(value: string): boolean;
108
- timeValidation(): boolean | string;
109
- timeAllowedValidation(): boolean | string;
110
- click(event?: Event): void;
111
147
  clear(): void;
112
148
  }
@@ -64,4 +64,8 @@ export interface ITree extends IComponentRender {
64
64
  checkedField?: string;
65
65
  openLevelOnLoad?: number | boolean;
66
66
  checkbox?: boolean;
67
+ disableCheckbox?: (args: {
68
+ node: ITreeNode<IDictionary>;
69
+ component: Tree;
70
+ }) => boolean;
67
71
  }
@@ -47,6 +47,13 @@ export declare class Tree extends ComponentRender implements ITree {
47
47
  * Allow row check
48
48
  */
49
49
  checkbox?: boolean | undefined;
50
+ /**
51
+ * Function to check if node check should be disabled
52
+ */
53
+ disableCheckbox?: (args: {
54
+ node: ITreeNode<IDictionary>;
55
+ component: Tree;
56
+ }) => boolean;
50
57
  /** SlVueTree component */
51
58
  private tree;
52
59
  /** SlVueTree component */
@@ -114,4 +121,5 @@ export declare class Tree extends ComponentRender implements ITree {
114
121
  getNode(path: number[]): ITreeNodeModel<IDictionary<any>> | undefined;
115
122
  getParentNode(node: ITreeNode<IDictionary>): any;
116
123
  private searchPath;
124
+ callDisableCheckbox(node: ITreeNode<IDictionary>): boolean;
117
125
  }
@@ -1,8 +1,17 @@
1
- import { IGrid, IGridEditable } from '../zd-grid/interfaces';
1
+ import { IDictionary } from '@zeedhi/core';
2
+ import { IGrid, IGridColumnEditable, IGridEditableEvents } from '../zd-grid/interfaces';
3
+ import { TreeGridEditable } from './tree-grid-editable';
2
4
  export interface ITreeGrid extends IGrid {
3
5
  parentField?: string;
4
6
  openLevelOnLoad?: number | boolean;
5
7
  fetchOnDemand?: boolean;
6
8
  }
7
- export interface ITreeGridEditable extends IGridEditable {
9
+ export interface ITreeGridEditable extends ITreeGrid {
10
+ columns?: IGridColumnEditable[];
11
+ doubleClickEdit?: boolean;
12
+ events?: IGridEditableEvents;
13
+ canEditRow?: (args: {
14
+ row: IDictionary<any>;
15
+ component: TreeGridEditable;
16
+ }) => boolean;
8
17
  }
@@ -12,6 +12,13 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
12
12
  * Editing rows
13
13
  */
14
14
  editing: boolean;
15
+ /**
16
+ * Function to check if row can be edited
17
+ */
18
+ canEditRow?: (args: {
19
+ row: IDictionary<any>;
20
+ component: TreeGridEditable;
21
+ }) => boolean;
15
22
  /**
16
23
  * Edited rows
17
24
  * @private
@@ -55,7 +62,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
55
62
  * @param event DOM event
56
63
  * @param element DOM Element
57
64
  */
58
- cellClick(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any): void;
65
+ cellClick(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any, canEdit?: boolean): void;
59
66
  cellClickEvent(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any): void;
60
67
  /**
61
68
  * Dispatches select/unselect event
@@ -165,4 +172,5 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
165
172
  * @param value Value to be set in the cell
166
173
  */
167
174
  private changeCell;
175
+ callCanEditRow(row: IDictionary<any>): boolean;
168
176
  }
@@ -75,4 +75,6 @@ export declare class TreeGrid extends Grid implements ITreeGrid {
75
75
  * @param isSelected row is selected
76
76
  */
77
77
  selectRow(row: IDictionary<any>, isSelected: boolean): void;
78
+ private selectParents;
79
+ private unselectParents;
78
80
  }
@@ -5,11 +5,12 @@ export declare abstract class BaseReport implements IReportType {
5
5
  abstract route: string;
6
6
  abstract buildDataset(data: IDictionary<any>[], metadata?: any): any;
7
7
  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
+ };
8
12
  protected buildColumns(columns: IColumn[]): MetadataColumn;
9
- private isNumberComponent;
10
- private checkAccessor;
11
- private getFormatOfColumn;
12
- protected buildFilter(filter: IDictionary): MetadataFilter;
13
+ protected buildFilter(filter: IDictionary, columns: IColumn[]): MetadataFilter;
13
14
  protected formatLangCode(lang?: string): string;
14
15
  protected expressionZeedhiToXls: any;
15
16
  protected colunmXLS: string;
@@ -40,6 +40,7 @@ export interface IMetadataObj {
40
40
  staticData: {};
41
41
  groups: Array<any>;
42
42
  reportXLS?: boolean;
43
+ formatXLS?: 'F1' | 'F2' | 'F3';
43
44
  type?: string;
44
45
  xlsMergedCell?: any[];
45
46
  }
@@ -1,9 +1,14 @@
1
1
  import { IDictionary } from '@zeedhi/core';
2
2
  import { IColumn } from '../../../components';
3
3
  import { BaseReport } from './base-report';
4
+ import { MetadataColumn } from './interfaces';
4
5
  export declare class PDFReport extends BaseReport {
5
6
  readonly route: string;
6
7
  buildDataset(data: IDictionary<any>[]): string;
8
+ protected buildColumns(columns: IColumn[]): MetadataColumn;
9
+ private getFormatOfColumn;
10
+ private isNumberComponent;
11
+ private checkAccessor;
7
12
  buildMetadata(name: string, title: string, columns: IColumn[], filter?: IDictionary<any>, portrait?: boolean): Promise<string>;
8
13
  private toDataURL;
9
14
  }
@@ -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): Promise<string>;
14
- private removeActionColumns;
14
+ private removeColumns;
15
15
  }