@zeedhi/common 1.50.0 → 1.51.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 +58 -7
- package/dist/zd-common.umd.js +58 -7
- package/package.json +2 -2
- package/types/components/zd-frame/frame.d.ts +4 -1
- package/types/components/zd-frame-page/frame-page.d.ts +1 -1
- package/types/components/zd-grid/grid-editable.d.ts +1 -0
- package/types/components/zd-select-tree/select-tree.d.ts +3 -2
- package/types/components/zd-tabs/interfaces.d.ts +1 -0
- package/types/components/zd-tabs/tab.d.ts +1 -0
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +1 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -4456,8 +4456,8 @@ class Frame extends ComponentRender {
|
|
|
4456
4456
|
this.metadata = this.overrideNamedPropsFunc(this.metadata);
|
|
4457
4457
|
}
|
|
4458
4458
|
}
|
|
4459
|
-
catch (
|
|
4460
|
-
this.notFoundError();
|
|
4459
|
+
catch (e) {
|
|
4460
|
+
this.notFoundError(e);
|
|
4461
4461
|
}
|
|
4462
4462
|
finally {
|
|
4463
4463
|
this.loading = false;
|
|
@@ -4478,7 +4478,10 @@ class Frame extends ComponentRender {
|
|
|
4478
4478
|
this.getMetadata();
|
|
4479
4479
|
});
|
|
4480
4480
|
}
|
|
4481
|
-
notFoundError() {
|
|
4481
|
+
notFoundError(e) {
|
|
4482
|
+
if (this.rejectLoad)
|
|
4483
|
+
this.rejectLoad(e);
|
|
4484
|
+
}
|
|
4482
4485
|
requestPage() {
|
|
4483
4486
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4484
4487
|
if (!this.cache) {
|
|
@@ -4504,6 +4507,8 @@ class Frame extends ComponentRender {
|
|
|
4504
4507
|
* @param element
|
|
4505
4508
|
*/
|
|
4506
4509
|
afterLoad(event, element) {
|
|
4510
|
+
if (this.resolveLoad)
|
|
4511
|
+
this.resolveLoad(this.metadata);
|
|
4507
4512
|
this.callEvent('onAfterLoad', {
|
|
4508
4513
|
event, element, component: this,
|
|
4509
4514
|
});
|
|
@@ -4544,6 +4549,18 @@ class Frame extends ComponentRender {
|
|
|
4544
4549
|
return caches.delete(Frame.cacheName);
|
|
4545
4550
|
});
|
|
4546
4551
|
}
|
|
4552
|
+
waitLoading() {
|
|
4553
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4554
|
+
return new Promise((resolve, reject) => {
|
|
4555
|
+
if (!this.loading) {
|
|
4556
|
+
resolve(this.metadata);
|
|
4557
|
+
return;
|
|
4558
|
+
}
|
|
4559
|
+
this.resolveLoad = resolve;
|
|
4560
|
+
this.rejectLoad = reject;
|
|
4561
|
+
});
|
|
4562
|
+
});
|
|
4563
|
+
}
|
|
4547
4564
|
}
|
|
4548
4565
|
Frame.cacheName = 'zd-frame-cache';
|
|
4549
4566
|
|
|
@@ -4557,8 +4574,8 @@ class FramePage extends Frame {
|
|
|
4557
4574
|
this.notFoundRoute = this.getInitValue('notFoundRoute', props.notFoundRoute, this.notFoundRoute);
|
|
4558
4575
|
this.createAccessors();
|
|
4559
4576
|
}
|
|
4560
|
-
notFoundError() {
|
|
4561
|
-
super.notFoundError();
|
|
4577
|
+
notFoundError(e) {
|
|
4578
|
+
super.notFoundError(e);
|
|
4562
4579
|
Router.replace(this.notFoundRoute);
|
|
4563
4580
|
}
|
|
4564
4581
|
/**
|
|
@@ -5635,6 +5652,7 @@ class GridEditable extends Grid {
|
|
|
5635
5652
|
});
|
|
5636
5653
|
}
|
|
5637
5654
|
} });
|
|
5655
|
+
this.updateOriginalRow(key, row);
|
|
5638
5656
|
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false });
|
|
5639
5657
|
}
|
|
5640
5658
|
checkLookupData(column, row, componentProps) {
|
|
@@ -5682,6 +5700,10 @@ class GridEditable extends Grid {
|
|
|
5682
5700
|
this.editedRows = rows;
|
|
5683
5701
|
}
|
|
5684
5702
|
}
|
|
5703
|
+
updateOriginalRow(key, row) {
|
|
5704
|
+
if (this.editedRows[key] !== undefined)
|
|
5705
|
+
this.editedRows[key].originalRow = row;
|
|
5706
|
+
}
|
|
5685
5707
|
/**
|
|
5686
5708
|
* Checks if column is edited
|
|
5687
5709
|
* @param column Column
|
|
@@ -9258,6 +9280,7 @@ class SelectTree extends TextInput {
|
|
|
9258
9280
|
* Uses delayed loading to load tree branches
|
|
9259
9281
|
*/
|
|
9260
9282
|
this.fetchOnDemand = false;
|
|
9283
|
+
this.savedNodes = undefined;
|
|
9261
9284
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
9262
9285
|
this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
|
|
9263
9286
|
this.flattenSearchResults = this.getInitValue('flattenSearchResults', props.flattenSearchResults, this.flattenSearchResults);
|
|
@@ -9334,7 +9357,7 @@ class SelectTree extends TextInput {
|
|
|
9334
9357
|
}
|
|
9335
9358
|
createNodeFromRow(row) {
|
|
9336
9359
|
let children;
|
|
9337
|
-
if (this.fetchOnDemand) {
|
|
9360
|
+
if (this.fetchOnDemand && !this.datasource.search) {
|
|
9338
9361
|
children = null;
|
|
9339
9362
|
}
|
|
9340
9363
|
else {
|
|
@@ -9414,6 +9437,26 @@ class SelectTree extends TextInput {
|
|
|
9414
9437
|
* Triggered after the search query changes
|
|
9415
9438
|
*/
|
|
9416
9439
|
searchChange(searchQuery, element) {
|
|
9440
|
+
if (this.fetchOnDemand) {
|
|
9441
|
+
if (!searchQuery && this.savedNodes) {
|
|
9442
|
+
this.nodes = this.savedNodes;
|
|
9443
|
+
this.savedNodes = undefined;
|
|
9444
|
+
this.datasource.search = '';
|
|
9445
|
+
}
|
|
9446
|
+
else {
|
|
9447
|
+
if (!this.savedNodes) {
|
|
9448
|
+
this.savedNodes = [...this.nodes];
|
|
9449
|
+
}
|
|
9450
|
+
this.datasource.setSearch(searchQuery).then(() => {
|
|
9451
|
+
const treeData = this.treeDataStructure.treeData.map((item) => {
|
|
9452
|
+
delete item[this.parentField];
|
|
9453
|
+
item.tree__children = [];
|
|
9454
|
+
return item;
|
|
9455
|
+
});
|
|
9456
|
+
this.nodes = this.createChildrenNodes(treeData);
|
|
9457
|
+
});
|
|
9458
|
+
}
|
|
9459
|
+
}
|
|
9417
9460
|
this.callEvent('onSearchChange', { element, component: this, searchQuery });
|
|
9418
9461
|
}
|
|
9419
9462
|
isDisable(node) {
|
|
@@ -9443,7 +9486,7 @@ class SelectTree extends TextInput {
|
|
|
9443
9486
|
return !hasError;
|
|
9444
9487
|
}
|
|
9445
9488
|
/**
|
|
9446
|
-
* Triggered when the data is
|
|
9489
|
+
* Triggered when the data is inputed.
|
|
9447
9490
|
* @param value search value
|
|
9448
9491
|
* @param event DOM event
|
|
9449
9492
|
* @param element Element focused
|
|
@@ -9452,6 +9495,7 @@ class SelectTree extends TextInput {
|
|
|
9452
9495
|
if (value !== this.lastInputValue) {
|
|
9453
9496
|
this.lastInputValue = value;
|
|
9454
9497
|
this.callInputEvent({ element, component: this });
|
|
9498
|
+
this.searchChange(value, element);
|
|
9455
9499
|
}
|
|
9456
9500
|
}
|
|
9457
9501
|
get searchValue() {
|
|
@@ -9926,9 +9970,11 @@ class Tab extends Component {
|
|
|
9926
9970
|
super(props);
|
|
9927
9971
|
this.disabled = false;
|
|
9928
9972
|
this.tabTitle = '';
|
|
9973
|
+
this.lazyLoad = true;
|
|
9929
9974
|
this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
|
|
9930
9975
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
9931
9976
|
this.flex = this.getInitValue('flex', props.flex, this.flex);
|
|
9977
|
+
this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
|
|
9932
9978
|
this.createAccessors();
|
|
9933
9979
|
}
|
|
9934
9980
|
}
|
|
@@ -11192,8 +11238,13 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11192
11238
|
});
|
|
11193
11239
|
}
|
|
11194
11240
|
} });
|
|
11241
|
+
this.updateOriginalRow(key, row);
|
|
11195
11242
|
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false });
|
|
11196
11243
|
}
|
|
11244
|
+
updateOriginalRow(key, row) {
|
|
11245
|
+
if (this.editedRows[key] !== undefined)
|
|
11246
|
+
this.editedRows[key].originalRow = row;
|
|
11247
|
+
}
|
|
11197
11248
|
checkLookupData(column, row, componentProps) {
|
|
11198
11249
|
if (row[column.name] && column.lookupData && componentProps.datasource) {
|
|
11199
11250
|
componentProps.datasource.data = componentProps.datasource.data || [];
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -4463,8 +4463,8 @@
|
|
|
4463
4463
|
this.metadata = this.overrideNamedPropsFunc(this.metadata);
|
|
4464
4464
|
}
|
|
4465
4465
|
}
|
|
4466
|
-
catch (
|
|
4467
|
-
this.notFoundError();
|
|
4466
|
+
catch (e) {
|
|
4467
|
+
this.notFoundError(e);
|
|
4468
4468
|
}
|
|
4469
4469
|
finally {
|
|
4470
4470
|
this.loading = false;
|
|
@@ -4485,7 +4485,10 @@
|
|
|
4485
4485
|
this.getMetadata();
|
|
4486
4486
|
});
|
|
4487
4487
|
}
|
|
4488
|
-
notFoundError() {
|
|
4488
|
+
notFoundError(e) {
|
|
4489
|
+
if (this.rejectLoad)
|
|
4490
|
+
this.rejectLoad(e);
|
|
4491
|
+
}
|
|
4489
4492
|
requestPage() {
|
|
4490
4493
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4491
4494
|
if (!this.cache) {
|
|
@@ -4511,6 +4514,8 @@
|
|
|
4511
4514
|
* @param element
|
|
4512
4515
|
*/
|
|
4513
4516
|
afterLoad(event, element) {
|
|
4517
|
+
if (this.resolveLoad)
|
|
4518
|
+
this.resolveLoad(this.metadata);
|
|
4514
4519
|
this.callEvent('onAfterLoad', {
|
|
4515
4520
|
event, element, component: this,
|
|
4516
4521
|
});
|
|
@@ -4551,6 +4556,18 @@
|
|
|
4551
4556
|
return caches.delete(Frame.cacheName);
|
|
4552
4557
|
});
|
|
4553
4558
|
}
|
|
4559
|
+
waitLoading() {
|
|
4560
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4561
|
+
return new Promise((resolve, reject) => {
|
|
4562
|
+
if (!this.loading) {
|
|
4563
|
+
resolve(this.metadata);
|
|
4564
|
+
return;
|
|
4565
|
+
}
|
|
4566
|
+
this.resolveLoad = resolve;
|
|
4567
|
+
this.rejectLoad = reject;
|
|
4568
|
+
});
|
|
4569
|
+
});
|
|
4570
|
+
}
|
|
4554
4571
|
}
|
|
4555
4572
|
Frame.cacheName = 'zd-frame-cache';
|
|
4556
4573
|
|
|
@@ -4564,8 +4581,8 @@
|
|
|
4564
4581
|
this.notFoundRoute = this.getInitValue('notFoundRoute', props.notFoundRoute, this.notFoundRoute);
|
|
4565
4582
|
this.createAccessors();
|
|
4566
4583
|
}
|
|
4567
|
-
notFoundError() {
|
|
4568
|
-
super.notFoundError();
|
|
4584
|
+
notFoundError(e) {
|
|
4585
|
+
super.notFoundError(e);
|
|
4569
4586
|
core.Router.replace(this.notFoundRoute);
|
|
4570
4587
|
}
|
|
4571
4588
|
/**
|
|
@@ -5642,6 +5659,7 @@
|
|
|
5642
5659
|
});
|
|
5643
5660
|
}
|
|
5644
5661
|
} });
|
|
5662
|
+
this.updateOriginalRow(key, row);
|
|
5645
5663
|
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false });
|
|
5646
5664
|
}
|
|
5647
5665
|
checkLookupData(column, row, componentProps) {
|
|
@@ -5689,6 +5707,10 @@
|
|
|
5689
5707
|
this.editedRows = rows;
|
|
5690
5708
|
}
|
|
5691
5709
|
}
|
|
5710
|
+
updateOriginalRow(key, row) {
|
|
5711
|
+
if (this.editedRows[key] !== undefined)
|
|
5712
|
+
this.editedRows[key].originalRow = row;
|
|
5713
|
+
}
|
|
5692
5714
|
/**
|
|
5693
5715
|
* Checks if column is edited
|
|
5694
5716
|
* @param column Column
|
|
@@ -9265,6 +9287,7 @@
|
|
|
9265
9287
|
* Uses delayed loading to load tree branches
|
|
9266
9288
|
*/
|
|
9267
9289
|
this.fetchOnDemand = false;
|
|
9290
|
+
this.savedNodes = undefined;
|
|
9268
9291
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
9269
9292
|
this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
|
|
9270
9293
|
this.flattenSearchResults = this.getInitValue('flattenSearchResults', props.flattenSearchResults, this.flattenSearchResults);
|
|
@@ -9341,7 +9364,7 @@
|
|
|
9341
9364
|
}
|
|
9342
9365
|
createNodeFromRow(row) {
|
|
9343
9366
|
let children;
|
|
9344
|
-
if (this.fetchOnDemand) {
|
|
9367
|
+
if (this.fetchOnDemand && !this.datasource.search) {
|
|
9345
9368
|
children = null;
|
|
9346
9369
|
}
|
|
9347
9370
|
else {
|
|
@@ -9421,6 +9444,26 @@
|
|
|
9421
9444
|
* Triggered after the search query changes
|
|
9422
9445
|
*/
|
|
9423
9446
|
searchChange(searchQuery, element) {
|
|
9447
|
+
if (this.fetchOnDemand) {
|
|
9448
|
+
if (!searchQuery && this.savedNodes) {
|
|
9449
|
+
this.nodes = this.savedNodes;
|
|
9450
|
+
this.savedNodes = undefined;
|
|
9451
|
+
this.datasource.search = '';
|
|
9452
|
+
}
|
|
9453
|
+
else {
|
|
9454
|
+
if (!this.savedNodes) {
|
|
9455
|
+
this.savedNodes = [...this.nodes];
|
|
9456
|
+
}
|
|
9457
|
+
this.datasource.setSearch(searchQuery).then(() => {
|
|
9458
|
+
const treeData = this.treeDataStructure.treeData.map((item) => {
|
|
9459
|
+
delete item[this.parentField];
|
|
9460
|
+
item.tree__children = [];
|
|
9461
|
+
return item;
|
|
9462
|
+
});
|
|
9463
|
+
this.nodes = this.createChildrenNodes(treeData);
|
|
9464
|
+
});
|
|
9465
|
+
}
|
|
9466
|
+
}
|
|
9424
9467
|
this.callEvent('onSearchChange', { element, component: this, searchQuery });
|
|
9425
9468
|
}
|
|
9426
9469
|
isDisable(node) {
|
|
@@ -9450,7 +9493,7 @@
|
|
|
9450
9493
|
return !hasError;
|
|
9451
9494
|
}
|
|
9452
9495
|
/**
|
|
9453
|
-
* Triggered when the data is
|
|
9496
|
+
* Triggered when the data is inputed.
|
|
9454
9497
|
* @param value search value
|
|
9455
9498
|
* @param event DOM event
|
|
9456
9499
|
* @param element Element focused
|
|
@@ -9459,6 +9502,7 @@
|
|
|
9459
9502
|
if (value !== this.lastInputValue) {
|
|
9460
9503
|
this.lastInputValue = value;
|
|
9461
9504
|
this.callInputEvent({ element, component: this });
|
|
9505
|
+
this.searchChange(value, element);
|
|
9462
9506
|
}
|
|
9463
9507
|
}
|
|
9464
9508
|
get searchValue() {
|
|
@@ -9933,9 +9977,11 @@
|
|
|
9933
9977
|
super(props);
|
|
9934
9978
|
this.disabled = false;
|
|
9935
9979
|
this.tabTitle = '';
|
|
9980
|
+
this.lazyLoad = true;
|
|
9936
9981
|
this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
|
|
9937
9982
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
9938
9983
|
this.flex = this.getInitValue('flex', props.flex, this.flex);
|
|
9984
|
+
this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
|
|
9939
9985
|
this.createAccessors();
|
|
9940
9986
|
}
|
|
9941
9987
|
}
|
|
@@ -11199,8 +11245,13 @@
|
|
|
11199
11245
|
});
|
|
11200
11246
|
}
|
|
11201
11247
|
} });
|
|
11248
|
+
this.updateOriginalRow(key, row);
|
|
11202
11249
|
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false });
|
|
11203
11250
|
}
|
|
11251
|
+
updateOriginalRow(key, row) {
|
|
11252
|
+
if (this.editedRows[key] !== undefined)
|
|
11253
|
+
this.editedRows[key].originalRow = row;
|
|
11254
|
+
}
|
|
11204
11255
|
checkLookupData(column, row, componentProps) {
|
|
11205
11256
|
if (row[column.name] && column.lookupData && componentProps.datasource) {
|
|
11206
11257
|
componentProps.datasource.data = componentProps.datasource.data || [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.51.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": "
|
|
40
|
+
"gitHead": "be07d7f99d3351043e08a98b52a5736ab686dd30"
|
|
41
41
|
}
|
|
@@ -20,6 +20,8 @@ export declare class Frame extends ComponentRender implements IFrame {
|
|
|
20
20
|
type: string;
|
|
21
21
|
private readonly headerName;
|
|
22
22
|
private static readonly cacheName;
|
|
23
|
+
protected resolveLoad?: (value: Object) => void;
|
|
24
|
+
protected rejectLoad?: (reason?: any) => void;
|
|
23
25
|
/**
|
|
24
26
|
* Creates a new Frame.
|
|
25
27
|
* @param props Frame properties
|
|
@@ -28,7 +30,7 @@ export declare class Frame extends ComponentRender implements IFrame {
|
|
|
28
30
|
private getMetadata;
|
|
29
31
|
overrideNamedPropsFunc(metadata: object): any;
|
|
30
32
|
reload(): Promise<void>;
|
|
31
|
-
protected notFoundError(): void;
|
|
33
|
+
protected notFoundError(e: unknown): void;
|
|
32
34
|
private requestPage;
|
|
33
35
|
/**
|
|
34
36
|
* Triggered when frame is load.
|
|
@@ -52,4 +54,5 @@ export declare class Frame extends ComponentRender implements IFrame {
|
|
|
52
54
|
* Deletes all frame cached requests
|
|
53
55
|
*/
|
|
54
56
|
static deleteCache(): Promise<boolean>;
|
|
57
|
+
waitLoading(): Promise<Object>;
|
|
55
58
|
}
|
|
@@ -6,7 +6,7 @@ export declare class FramePage extends Frame implements IFramePage {
|
|
|
6
6
|
*/
|
|
7
7
|
notFoundRoute: string;
|
|
8
8
|
constructor(props: IFramePage);
|
|
9
|
-
protected notFoundError(): void;
|
|
9
|
+
protected notFoundError(e: unknown): void;
|
|
10
10
|
/**
|
|
11
11
|
* Triggered before the component is destroyed.
|
|
12
12
|
*/
|
|
@@ -103,6 +103,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
103
103
|
* change event of editable components
|
|
104
104
|
*/
|
|
105
105
|
private changeEditableComponent;
|
|
106
|
+
private updateOriginalRow;
|
|
106
107
|
/**
|
|
107
108
|
* Checks if column is edited
|
|
108
109
|
* @param column Column
|
|
@@ -117,16 +117,17 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
117
117
|
* Triggered after selecting an node
|
|
118
118
|
*/
|
|
119
119
|
select(node: ISelectTreeNode<IDictionary>, element?: any): void;
|
|
120
|
+
private savedNodes?;
|
|
120
121
|
/**
|
|
121
122
|
* Triggered after the search query changes
|
|
122
123
|
*/
|
|
123
|
-
searchChange(searchQuery:
|
|
124
|
+
searchChange(searchQuery: string, element?: any): void;
|
|
124
125
|
private isDisable;
|
|
125
126
|
private getDisabledNodes;
|
|
126
127
|
getNodes(): ISelectTreeNode<IDictionary>[];
|
|
127
128
|
validate(): boolean;
|
|
128
129
|
/**
|
|
129
|
-
* Triggered when the data is
|
|
130
|
+
* Triggered when the data is inputed.
|
|
130
131
|
* @param value search value
|
|
131
132
|
* @param event DOM event
|
|
132
133
|
* @param element Element focused
|