@zeedhi/common 1.108.1 → 1.109.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.108.1",
3
+ "version": "1.109.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": "9cd96dd092145062a963f12aaba1bb3e0d872cc8"
46
+ "gitHead": "7260f4ea8769c7f86c4f6c3e379e141f6ac401c0"
47
47
  }
@@ -140,6 +140,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
140
140
  * If the row[column.name] has a selected value, pushes it
141
141
  */
142
142
  private checkLookupData;
143
+ private pushLookupRow;
143
144
  private checkCompValidity;
144
145
  /**
145
146
  * change event of editable components
@@ -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
  }
@@ -1,25 +1,36 @@
1
1
  import { INumber } from './interfaces';
2
2
  import { TextInput } from '../zd-text-input/text-input';
3
+ export declare type AutoNumericObj = {
4
+ rawValue: string;
5
+ update(mask: any): any;
6
+ clear(): any;
7
+ setValue(value: number): any;
8
+ remove(): any;
9
+ };
3
10
  /**
4
11
  * Base class for Number component
5
12
  */
6
13
  export declare class Number extends TextInput implements INumber {
7
- mask: any;
8
14
  protected defaultMask: any;
9
15
  align: string;
10
16
  /**
11
17
  * AutoNumeric object
12
18
  */
13
- autoNumericObj: any;
19
+ autoNumericObj: AutoNumericObj;
14
20
  private formattedValue?;
15
21
  private localValue?;
16
22
  protected formatterFn: Function;
17
23
  protected parserFn: Function;
18
24
  private maskValid;
25
+ private internalMask;
19
26
  /**
20
27
  * Creates a new number input
21
28
  */
22
29
  constructor(props: INumber);
30
+ /**
31
+ * Merges two masks
32
+ */
33
+ private mergeMasks;
23
34
  validateMask(): void;
24
35
  get value(): any;
25
36
  set value(value: any);
@@ -28,6 +39,12 @@ export declare class Number extends TextInput implements INumber {
28
39
  */
29
40
  get displayValue(): any;
30
41
  set displayValue(value: any);
42
+ /**
43
+ * initializes a mask proxy to call update when the mask is changed
44
+ */
45
+ private initializeMaskProxy;
46
+ get mask(): any;
47
+ set mask(value: any);
31
48
  /**
32
49
  * Retrieves a formatted value with mask
33
50
  * @param value Any value
@@ -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
- getAllNodes(nodes?: import("..").ISelectTreeNode<IDictionary<any>>[]): import("..").ISelectTreeNode<IDictionary<any>>[];
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
- selectAllItems(): void;
55
- unSelectAllItems(): void;
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 {};
@@ -0,0 +1,2 @@
1
+ import './column-zdselect';
2
+ import './column-zdselectmultiple';
package/types/index.d.ts CHANGED
@@ -2,4 +2,5 @@ declare const AutoNumeric: any;
2
2
  export * from './components';
3
3
  export * from './services';
4
4
  export * from './utils';
5
+ export * from './formatters';
5
6
  export { AutoNumeric };
@@ -0,0 +1,12 @@
1
+ export interface IJSONObject {
2
+ path: string;
3
+ }
4
+ export declare class JsonCacheService {
5
+ /**
6
+ * jsons collection
7
+ */
8
+ static jsonCollection: IJSONObject[];
9
+ static saveJSONCache(jsonCollection: IJSONObject[]): Promise<void>;
10
+ static getJSONCache(path: string): any;
11
+ static clearJSONCache(jsonCollection: IJSONObject[]): void;
12
+ }