@zeedhi/common 1.86.1 → 1.87.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/dist/zd-common.esm.js +32 -3
- package/dist/zd-common.umd.js +32 -3
- package/package.json +2 -2
- package/types/components/zd-menu/interfaces.d.ts +1 -0
- package/types/components/zd-menu/menu.d.ts +1 -0
- package/types/components/zd-select/interfaces.d.ts +1 -0
- package/types/components/zd-select/select.d.ts +9 -1
- package/types/components/zd-select-tree/interfaces.d.ts +1 -0
- package/types/components/zd-select-tree/select-tree.d.ts +6 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -7301,6 +7301,10 @@ class Select extends TextInput {
|
|
|
7301
7301
|
* Field used to display values
|
|
7302
7302
|
*/
|
|
7303
7303
|
this.dataText = '';
|
|
7304
|
+
/**
|
|
7305
|
+
* Field used to display values when the select is closed
|
|
7306
|
+
*/
|
|
7307
|
+
this.dataTextDiscrete = '';
|
|
7304
7308
|
/**
|
|
7305
7309
|
* Value used to join display values
|
|
7306
7310
|
*/
|
|
@@ -7396,6 +7400,7 @@ class Select extends TextInput {
|
|
|
7396
7400
|
this.debounceSearch = debounce(this.doSearch, 500);
|
|
7397
7401
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'expand');
|
|
7398
7402
|
this.dataText = this.getInitValue('dataText', props.dataText, this.dataText);
|
|
7403
|
+
this.dataTextDiscrete = this.getInitValue('dataTextDiscrete', props.dataTextDiscrete, this.dataTextDiscrete);
|
|
7399
7404
|
this.dataTextSeparator = this.getInitValue('dataTextSeparator', props.dataTextSeparator, this.dataTextSeparator);
|
|
7400
7405
|
this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
|
|
7401
7406
|
this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
|
|
@@ -7414,6 +7419,12 @@ class Select extends TextInput {
|
|
|
7414
7419
|
}
|
|
7415
7420
|
if (this.dataText && !Array.isArray(this.dataText))
|
|
7416
7421
|
this.dataText = [this.dataText];
|
|
7422
|
+
if (this.dataTextDiscrete && !Array.isArray(this.dataTextDiscrete))
|
|
7423
|
+
this.dataTextDiscrete = [this.dataTextDiscrete];
|
|
7424
|
+
this.discreteProps = {
|
|
7425
|
+
dataText: this.dataTextDiscrete,
|
|
7426
|
+
dataTextSeparator: this.dataTextSeparator,
|
|
7427
|
+
};
|
|
7417
7428
|
const defaultDatasource = this.getDefaultDatasource(props);
|
|
7418
7429
|
this.datasource = DatasourceFactory.factory(defaultDatasource);
|
|
7419
7430
|
this.overrideGet();
|
|
@@ -7464,7 +7475,10 @@ class Select extends TextInput {
|
|
|
7464
7475
|
}
|
|
7465
7476
|
set search(value) {
|
|
7466
7477
|
this.searchValue = value || '';
|
|
7467
|
-
|
|
7478
|
+
const searchValue = this.dataTextDiscrete.length === 0
|
|
7479
|
+
? this.formatter(this.selectValue)
|
|
7480
|
+
: this.formatter(this.selectValue, this.discreteProps);
|
|
7481
|
+
if (this.searchValue === '' || this.searchValue !== searchValue) {
|
|
7468
7482
|
this.dirtySearchValue = this.searchValue;
|
|
7469
7483
|
if (this.isFocused)
|
|
7470
7484
|
this.debounceSearch(this.searchValue);
|
|
@@ -7595,7 +7609,7 @@ class Select extends TextInput {
|
|
|
7595
7609
|
/**
|
|
7596
7610
|
* Returns the currentRow in the dataText key
|
|
7597
7611
|
*/
|
|
7598
|
-
formatter(value) { return this.formatterFn(value, this); }
|
|
7612
|
+
formatter(value, props) { return this.formatterFn(value, props !== null && props !== void 0 ? props : this); }
|
|
7599
7613
|
setFieldValue(value) {
|
|
7600
7614
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7601
7615
|
let filterValue;
|
|
@@ -8768,6 +8782,7 @@ class Menu extends ComponentRender {
|
|
|
8768
8782
|
this.searchValue = '';
|
|
8769
8783
|
/** Store the current item focused */
|
|
8770
8784
|
this.currentItem = null;
|
|
8785
|
+
this.cache = false;
|
|
8771
8786
|
this.app = this.getInitValue('app', props.app, this.app);
|
|
8772
8787
|
this.absolute = this.getInitValue('absolute', props.absolute, this.absolute);
|
|
8773
8788
|
this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
|
|
@@ -8786,6 +8801,7 @@ class Menu extends ComponentRender {
|
|
|
8786
8801
|
this.closeToMini = this.getInitValue('closeToMini', props.closeToMini, this.closeToMini);
|
|
8787
8802
|
this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
|
|
8788
8803
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
8804
|
+
this.cache = this.getInitValue('cache', props.cache, this.cache);
|
|
8789
8805
|
this.mobileBreakpoint = this.getInitValue('mobileBreakpoint', props.mobileBreakpoint, this.mobileBreakpoint);
|
|
8790
8806
|
this.drawer = window.innerWidth > this.mobileBreakpoint;
|
|
8791
8807
|
this.openedInitialValue = this.getInitValue('opened', props.opened, this.opened);
|
|
@@ -8848,7 +8864,7 @@ class Menu extends ComponentRender {
|
|
|
8848
8864
|
*/
|
|
8849
8865
|
loadMetadata(url) {
|
|
8850
8866
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8851
|
-
this.items = (yield Metadata.get(url, Boolean(this.isLocal)));
|
|
8867
|
+
this.items = (yield Metadata.get(url, Boolean(this.isLocal), this.cache));
|
|
8852
8868
|
});
|
|
8853
8869
|
}
|
|
8854
8870
|
/**
|
|
@@ -10565,6 +10581,10 @@ class SelectTree extends TextInput {
|
|
|
10565
10581
|
* Defines if the node tree has child
|
|
10566
10582
|
*/
|
|
10567
10583
|
this.fieldHasChild = '';
|
|
10584
|
+
/**
|
|
10585
|
+
* Automatically select option if only one is filtered
|
|
10586
|
+
*/
|
|
10587
|
+
this.autoSelection = true;
|
|
10568
10588
|
this.savedNodes = undefined;
|
|
10569
10589
|
this.debounceSearch = debounce(this.searchChange, 500);
|
|
10570
10590
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
@@ -10588,6 +10608,7 @@ class SelectTree extends TextInput {
|
|
|
10588
10608
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
10589
10609
|
this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
|
|
10590
10610
|
this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
|
|
10611
|
+
this.autoSelection = this.getInitValue('autoSelection', props.autoSelection, this.autoSelection);
|
|
10591
10612
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
10592
10613
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
10593
10614
|
const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
@@ -10851,6 +10872,14 @@ class SelectTree extends TextInput {
|
|
|
10851
10872
|
});
|
|
10852
10873
|
});
|
|
10853
10874
|
}
|
|
10875
|
+
checkAutoSelection() {
|
|
10876
|
+
if (!this.getFilteredNodes)
|
|
10877
|
+
return;
|
|
10878
|
+
const filteredNode = this.getFilteredNodes();
|
|
10879
|
+
if (this.autoSelection && filteredNode) {
|
|
10880
|
+
this.setValue(filteredNode.id);
|
|
10881
|
+
}
|
|
10882
|
+
}
|
|
10854
10883
|
}
|
|
10855
10884
|
|
|
10856
10885
|
/**
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -7308,6 +7308,10 @@
|
|
|
7308
7308
|
* Field used to display values
|
|
7309
7309
|
*/
|
|
7310
7310
|
this.dataText = '';
|
|
7311
|
+
/**
|
|
7312
|
+
* Field used to display values when the select is closed
|
|
7313
|
+
*/
|
|
7314
|
+
this.dataTextDiscrete = '';
|
|
7311
7315
|
/**
|
|
7312
7316
|
* Value used to join display values
|
|
7313
7317
|
*/
|
|
@@ -7403,6 +7407,7 @@
|
|
|
7403
7407
|
this.debounceSearch = debounce__default["default"](this.doSearch, 500);
|
|
7404
7408
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, 'expand');
|
|
7405
7409
|
this.dataText = this.getInitValue('dataText', props.dataText, this.dataText);
|
|
7410
|
+
this.dataTextDiscrete = this.getInitValue('dataTextDiscrete', props.dataTextDiscrete, this.dataTextDiscrete);
|
|
7406
7411
|
this.dataTextSeparator = this.getInitValue('dataTextSeparator', props.dataTextSeparator, this.dataTextSeparator);
|
|
7407
7412
|
this.dataValue = this.getInitValue('dataValue', props.dataValue, this.dataValue);
|
|
7408
7413
|
this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
|
|
@@ -7421,6 +7426,12 @@
|
|
|
7421
7426
|
}
|
|
7422
7427
|
if (this.dataText && !Array.isArray(this.dataText))
|
|
7423
7428
|
this.dataText = [this.dataText];
|
|
7429
|
+
if (this.dataTextDiscrete && !Array.isArray(this.dataTextDiscrete))
|
|
7430
|
+
this.dataTextDiscrete = [this.dataTextDiscrete];
|
|
7431
|
+
this.discreteProps = {
|
|
7432
|
+
dataText: this.dataTextDiscrete,
|
|
7433
|
+
dataTextSeparator: this.dataTextSeparator,
|
|
7434
|
+
};
|
|
7424
7435
|
const defaultDatasource = this.getDefaultDatasource(props);
|
|
7425
7436
|
this.datasource = core.DatasourceFactory.factory(defaultDatasource);
|
|
7426
7437
|
this.overrideGet();
|
|
@@ -7471,7 +7482,10 @@
|
|
|
7471
7482
|
}
|
|
7472
7483
|
set search(value) {
|
|
7473
7484
|
this.searchValue = value || '';
|
|
7474
|
-
|
|
7485
|
+
const searchValue = this.dataTextDiscrete.length === 0
|
|
7486
|
+
? this.formatter(this.selectValue)
|
|
7487
|
+
: this.formatter(this.selectValue, this.discreteProps);
|
|
7488
|
+
if (this.searchValue === '' || this.searchValue !== searchValue) {
|
|
7475
7489
|
this.dirtySearchValue = this.searchValue;
|
|
7476
7490
|
if (this.isFocused)
|
|
7477
7491
|
this.debounceSearch(this.searchValue);
|
|
@@ -7602,7 +7616,7 @@
|
|
|
7602
7616
|
/**
|
|
7603
7617
|
* Returns the currentRow in the dataText key
|
|
7604
7618
|
*/
|
|
7605
|
-
formatter(value) { return this.formatterFn(value, this); }
|
|
7619
|
+
formatter(value, props) { return this.formatterFn(value, props !== null && props !== void 0 ? props : this); }
|
|
7606
7620
|
setFieldValue(value) {
|
|
7607
7621
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7608
7622
|
let filterValue;
|
|
@@ -8775,6 +8789,7 @@
|
|
|
8775
8789
|
this.searchValue = '';
|
|
8776
8790
|
/** Store the current item focused */
|
|
8777
8791
|
this.currentItem = null;
|
|
8792
|
+
this.cache = false;
|
|
8778
8793
|
this.app = this.getInitValue('app', props.app, this.app);
|
|
8779
8794
|
this.absolute = this.getInitValue('absolute', props.absolute, this.absolute);
|
|
8780
8795
|
this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
|
|
@@ -8793,6 +8808,7 @@
|
|
|
8793
8808
|
this.closeToMini = this.getInitValue('closeToMini', props.closeToMini, this.closeToMini);
|
|
8794
8809
|
this.showSearch = this.getInitValue('showSearch', props.showSearch, this.showSearch);
|
|
8795
8810
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
8811
|
+
this.cache = this.getInitValue('cache', props.cache, this.cache);
|
|
8796
8812
|
this.mobileBreakpoint = this.getInitValue('mobileBreakpoint', props.mobileBreakpoint, this.mobileBreakpoint);
|
|
8797
8813
|
this.drawer = window.innerWidth > this.mobileBreakpoint;
|
|
8798
8814
|
this.openedInitialValue = this.getInitValue('opened', props.opened, this.opened);
|
|
@@ -8855,7 +8871,7 @@
|
|
|
8855
8871
|
*/
|
|
8856
8872
|
loadMetadata(url) {
|
|
8857
8873
|
return __awaiter(this, void 0, void 0, function* () {
|
|
8858
|
-
this.items = (yield core.Metadata.get(url, Boolean(this.isLocal)));
|
|
8874
|
+
this.items = (yield core.Metadata.get(url, Boolean(this.isLocal), this.cache));
|
|
8859
8875
|
});
|
|
8860
8876
|
}
|
|
8861
8877
|
/**
|
|
@@ -10572,6 +10588,10 @@
|
|
|
10572
10588
|
* Defines if the node tree has child
|
|
10573
10589
|
*/
|
|
10574
10590
|
this.fieldHasChild = '';
|
|
10591
|
+
/**
|
|
10592
|
+
* Automatically select option if only one is filtered
|
|
10593
|
+
*/
|
|
10594
|
+
this.autoSelection = true;
|
|
10575
10595
|
this.savedNodes = undefined;
|
|
10576
10596
|
this.debounceSearch = debounce__default["default"](this.searchChange, 500);
|
|
10577
10597
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
@@ -10595,6 +10615,7 @@
|
|
|
10595
10615
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
10596
10616
|
this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
|
|
10597
10617
|
this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
|
|
10618
|
+
this.autoSelection = this.getInitValue('autoSelection', props.autoSelection, this.autoSelection);
|
|
10598
10619
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
10599
10620
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
10600
10621
|
const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
@@ -10858,6 +10879,14 @@
|
|
|
10858
10879
|
});
|
|
10859
10880
|
});
|
|
10860
10881
|
}
|
|
10882
|
+
checkAutoSelection() {
|
|
10883
|
+
if (!this.getFilteredNodes)
|
|
10884
|
+
return;
|
|
10885
|
+
const filteredNode = this.getFilteredNodes();
|
|
10886
|
+
if (this.autoSelection && filteredNode) {
|
|
10887
|
+
this.setValue(filteredNode.id);
|
|
10888
|
+
}
|
|
10889
|
+
}
|
|
10861
10890
|
}
|
|
10862
10891
|
|
|
10863
10892
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.87.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": "
|
|
46
|
+
"gitHead": "52e489cc86beba6f24fc8120e8ea641edc9d7cdf"
|
|
47
47
|
}
|
|
@@ -117,6 +117,7 @@ export declare class Menu extends ComponentRender implements IMenu {
|
|
|
117
117
|
private searchValue;
|
|
118
118
|
/** Store the current item focused */
|
|
119
119
|
currentItem: IMenuItem | null;
|
|
120
|
+
cache?: boolean;
|
|
120
121
|
/**
|
|
121
122
|
* Creates a new Menu.
|
|
122
123
|
* @param props Menu properties
|
|
@@ -14,6 +14,10 @@ export declare class Select extends TextInput implements ISelect {
|
|
|
14
14
|
* Field used to display values
|
|
15
15
|
*/
|
|
16
16
|
dataText: string | any[];
|
|
17
|
+
/**
|
|
18
|
+
* Field used to display values when the select is closed
|
|
19
|
+
*/
|
|
20
|
+
dataTextDiscrete: string | any[];
|
|
17
21
|
/**
|
|
18
22
|
* Value used to join display values
|
|
19
23
|
*/
|
|
@@ -105,6 +109,7 @@ export declare class Select extends TextInput implements ISelect {
|
|
|
105
109
|
protected cachedTotal: number;
|
|
106
110
|
protected formatterFn: Function;
|
|
107
111
|
private pushedValue;
|
|
112
|
+
private discreteProps?;
|
|
108
113
|
protected loadMoreQtty: number;
|
|
109
114
|
/**
|
|
110
115
|
* Create a new Select.
|
|
@@ -149,7 +154,10 @@ export declare class Select extends TextInput implements ISelect {
|
|
|
149
154
|
/**
|
|
150
155
|
* Returns the currentRow in the dataText key
|
|
151
156
|
*/
|
|
152
|
-
formatter(value?: string | IDictionary<any
|
|
157
|
+
formatter(value?: string | IDictionary<any>, props?: {
|
|
158
|
+
dataText: string | any[];
|
|
159
|
+
dataTextSeparator: string;
|
|
160
|
+
}): any;
|
|
153
161
|
protected setFieldValue(value: any): Promise<boolean>;
|
|
154
162
|
/**
|
|
155
163
|
* Set value accessors
|
|
@@ -32,6 +32,7 @@ export interface ISelectTree extends IComponentRender {
|
|
|
32
32
|
fetchOnDemand?: boolean;
|
|
33
33
|
fieldHasChild?: string;
|
|
34
34
|
menuMaxWidth?: number;
|
|
35
|
+
autoSelection?: boolean;
|
|
35
36
|
}
|
|
36
37
|
export interface ISelectTreeCloseEvent extends IEventParam<SelectTree> {
|
|
37
38
|
selectedNodes: ISelectTreeNode<IDictionary>[];
|
|
@@ -98,6 +98,11 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
98
98
|
* Defines if the node tree has child
|
|
99
99
|
*/
|
|
100
100
|
fieldHasChild: string;
|
|
101
|
+
/**
|
|
102
|
+
* Automatically select option if only one is filtered
|
|
103
|
+
*/
|
|
104
|
+
autoSelection: boolean;
|
|
105
|
+
getFilteredNodes?: () => boolean | Object;
|
|
101
106
|
/**
|
|
102
107
|
* Creates a new instance of SelectTree
|
|
103
108
|
* @param props
|
|
@@ -149,4 +154,5 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
149
154
|
set value(value: any);
|
|
150
155
|
setValue(value: any): void;
|
|
151
156
|
loadChildren(parentNode: ISelectTreeNode<IDictionary>): Promise<void>;
|
|
157
|
+
checkAutoSelection(): void;
|
|
152
158
|
}
|