@zeedhi/common 1.49.0 → 1.52.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 +163 -35
- package/dist/zd-common.umd.js +163 -35
- package/package.json +2 -2
- package/types/components/zd-container/container.d.ts +4 -0
- package/types/components/zd-container/interfaces.d.ts +1 -0
- package/types/components/zd-dashboard/interfaces.d.ts +3 -5
- 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-iterable/iterable-controller.d.ts +8 -0
- package/types/components/zd-iterable/iterable.d.ts +1 -1
- package/types/components/zd-select-tree/interfaces.d.ts +3 -1
- package/types/components/zd-select-tree/select-tree.d.ts +8 -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/tree.d.ts +2 -1
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +1 -0
- package/types/services/zd-modal/modal-service.d.ts +5 -0
- package/types/utils/tree-data-structure/tree-data-structure.d.ts +1 -1
package/dist/zd-common.esm.js
CHANGED
|
@@ -2317,7 +2317,12 @@ class Container extends ComponentRender {
|
|
|
2317
2317
|
* Removes viewport maximum-width size breakpoints.
|
|
2318
2318
|
*/
|
|
2319
2319
|
this.fluid = true;
|
|
2320
|
+
/**
|
|
2321
|
+
* Define if the container is a scroll view
|
|
2322
|
+
*/
|
|
2323
|
+
this.scrollView = false;
|
|
2320
2324
|
this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
|
|
2325
|
+
this.scrollView = this.getInitValue('scrollView', props.scrollView, this.scrollView);
|
|
2321
2326
|
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
2322
2327
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
2323
2328
|
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
@@ -2813,6 +2818,16 @@ class ModalService {
|
|
|
2813
2818
|
return this.create(modal);
|
|
2814
2819
|
});
|
|
2815
2820
|
}
|
|
2821
|
+
/**
|
|
2822
|
+
* Creates a new modal instance from JSON
|
|
2823
|
+
* @param modal modal structure
|
|
2824
|
+
*/
|
|
2825
|
+
static createFromJsonPost(modalPath, params) {
|
|
2826
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2827
|
+
const modal = yield Metadata.post(modalPath, params);
|
|
2828
|
+
return this.create(modal);
|
|
2829
|
+
});
|
|
2830
|
+
}
|
|
2816
2831
|
/**
|
|
2817
2832
|
* Deletes modal
|
|
2818
2833
|
* @param modal modal instance
|
|
@@ -3103,7 +3118,7 @@ class Dashboard extends ComponentRender {
|
|
|
3103
3118
|
];
|
|
3104
3119
|
this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
|
|
3105
3120
|
this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
|
|
3106
|
-
this.cards = props.cards
|
|
3121
|
+
this.cards = this.getInitValue('cards', props.cards, this.cards);
|
|
3107
3122
|
this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
|
|
3108
3123
|
this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
|
|
3109
3124
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
@@ -3131,13 +3146,7 @@ class Dashboard extends ComponentRender {
|
|
|
3131
3146
|
addCard() {
|
|
3132
3147
|
const addCardForm = Metadata.getInstance('addCardForm');
|
|
3133
3148
|
if (addCardForm.validate()) {
|
|
3134
|
-
const newCard = {
|
|
3135
|
-
cardId: this.getCardId(),
|
|
3136
|
-
path: addCardForm.value.inputPath,
|
|
3137
|
-
local: addCardForm.value.inputLocal,
|
|
3138
|
-
height: addCardForm.value.inputHeight,
|
|
3139
|
-
width: addCardForm.value.inputWidth,
|
|
3140
|
-
};
|
|
3149
|
+
const newCard = Object.assign({ cardId: this.getCardId(), path: addCardForm.value.inputPath, local: addCardForm.value.inputLocal, height: addCardForm.value.inputHeight, width: addCardForm.value.inputWidth }, addCardForm.value);
|
|
3141
3150
|
this.cards.push(newCard);
|
|
3142
3151
|
this.modalCancelClick();
|
|
3143
3152
|
}
|
|
@@ -4452,8 +4461,8 @@ class Frame extends ComponentRender {
|
|
|
4452
4461
|
this.metadata = this.overrideNamedPropsFunc(this.metadata);
|
|
4453
4462
|
}
|
|
4454
4463
|
}
|
|
4455
|
-
catch (
|
|
4456
|
-
this.notFoundError();
|
|
4464
|
+
catch (e) {
|
|
4465
|
+
this.notFoundError(e);
|
|
4457
4466
|
}
|
|
4458
4467
|
finally {
|
|
4459
4468
|
this.loading = false;
|
|
@@ -4474,7 +4483,10 @@ class Frame extends ComponentRender {
|
|
|
4474
4483
|
this.getMetadata();
|
|
4475
4484
|
});
|
|
4476
4485
|
}
|
|
4477
|
-
notFoundError() {
|
|
4486
|
+
notFoundError(e) {
|
|
4487
|
+
if (this.rejectLoad)
|
|
4488
|
+
this.rejectLoad(e);
|
|
4489
|
+
}
|
|
4478
4490
|
requestPage() {
|
|
4479
4491
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4480
4492
|
if (!this.cache) {
|
|
@@ -4500,6 +4512,8 @@ class Frame extends ComponentRender {
|
|
|
4500
4512
|
* @param element
|
|
4501
4513
|
*/
|
|
4502
4514
|
afterLoad(event, element) {
|
|
4515
|
+
if (this.resolveLoad)
|
|
4516
|
+
this.resolveLoad(this.metadata);
|
|
4503
4517
|
this.callEvent('onAfterLoad', {
|
|
4504
4518
|
event, element, component: this,
|
|
4505
4519
|
});
|
|
@@ -4540,6 +4554,18 @@ class Frame extends ComponentRender {
|
|
|
4540
4554
|
return caches.delete(Frame.cacheName);
|
|
4541
4555
|
});
|
|
4542
4556
|
}
|
|
4557
|
+
waitLoading() {
|
|
4558
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4559
|
+
return new Promise((resolve, reject) => {
|
|
4560
|
+
if (!this.loading) {
|
|
4561
|
+
resolve(this.metadata);
|
|
4562
|
+
return;
|
|
4563
|
+
}
|
|
4564
|
+
this.resolveLoad = resolve;
|
|
4565
|
+
this.rejectLoad = reject;
|
|
4566
|
+
});
|
|
4567
|
+
});
|
|
4568
|
+
}
|
|
4543
4569
|
}
|
|
4544
4570
|
Frame.cacheName = 'zd-frame-cache';
|
|
4545
4571
|
|
|
@@ -4553,8 +4579,8 @@ class FramePage extends Frame {
|
|
|
4553
4579
|
this.notFoundRoute = this.getInitValue('notFoundRoute', props.notFoundRoute, this.notFoundRoute);
|
|
4554
4580
|
this.createAccessors();
|
|
4555
4581
|
}
|
|
4556
|
-
notFoundError() {
|
|
4557
|
-
super.notFoundError();
|
|
4582
|
+
notFoundError(e) {
|
|
4583
|
+
super.notFoundError(e);
|
|
4558
4584
|
Router.replace(this.notFoundRoute);
|
|
4559
4585
|
}
|
|
4560
4586
|
/**
|
|
@@ -4776,6 +4802,23 @@ class ColumnNotFoundError extends Error {
|
|
|
4776
4802
|
}
|
|
4777
4803
|
}
|
|
4778
4804
|
|
|
4805
|
+
class IterableController {
|
|
4806
|
+
constructor(iterable) {
|
|
4807
|
+
this.searchInValue = undefined;
|
|
4808
|
+
this.columns = iterable.columns;
|
|
4809
|
+
}
|
|
4810
|
+
get searchIn() {
|
|
4811
|
+
return this.searchInValue || this.columns.reduce((result, column) => {
|
|
4812
|
+
if (column.type !== 'action' && column.isVisible)
|
|
4813
|
+
result.push(column.name);
|
|
4814
|
+
return result;
|
|
4815
|
+
}, []);
|
|
4816
|
+
}
|
|
4817
|
+
set searchIn(value) {
|
|
4818
|
+
this.searchInValue = value;
|
|
4819
|
+
}
|
|
4820
|
+
}
|
|
4821
|
+
|
|
4779
4822
|
/**
|
|
4780
4823
|
* Base class for Iterable components.
|
|
4781
4824
|
*/
|
|
@@ -4811,16 +4854,14 @@ class Iterable extends ComponentRender {
|
|
|
4811
4854
|
*/
|
|
4812
4855
|
this.actionsApplied = {};
|
|
4813
4856
|
this.columns = this.getColumns(props.columns || this.columns);
|
|
4814
|
-
this.
|
|
4857
|
+
this.createController();
|
|
4858
|
+
this.datasource = DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}` }));
|
|
4815
4859
|
this.pageSizes = this.getInitValue('pageSizes', props.pageSizes, this.pageSizes);
|
|
4816
4860
|
this.virtualScroll = this.getInitValue('virtualScroll', props.virtualScroll, this.virtualScroll);
|
|
4817
4861
|
}
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
result.push(column.name);
|
|
4822
|
-
return result;
|
|
4823
|
-
}, []);
|
|
4862
|
+
createController() {
|
|
4863
|
+
const controller = new IterableController(this);
|
|
4864
|
+
Loader.addController(`IterableController_${this.name}`, controller);
|
|
4824
4865
|
}
|
|
4825
4866
|
/**
|
|
4826
4867
|
* Retrieves columns instances
|
|
@@ -5631,6 +5672,7 @@ class GridEditable extends Grid {
|
|
|
5631
5672
|
});
|
|
5632
5673
|
}
|
|
5633
5674
|
} });
|
|
5675
|
+
this.updateOriginalRow(key, row);
|
|
5634
5676
|
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 });
|
|
5635
5677
|
}
|
|
5636
5678
|
checkLookupData(column, row, componentProps) {
|
|
@@ -5678,6 +5720,10 @@ class GridEditable extends Grid {
|
|
|
5678
5720
|
this.editedRows = rows;
|
|
5679
5721
|
}
|
|
5680
5722
|
}
|
|
5723
|
+
updateOriginalRow(key, row) {
|
|
5724
|
+
if (this.editedRows[key] !== undefined)
|
|
5725
|
+
this.editedRows[key].originalRow = row;
|
|
5726
|
+
}
|
|
5681
5727
|
/**
|
|
5682
5728
|
* Checks if column is edited
|
|
5683
5729
|
* @param column Column
|
|
@@ -9060,7 +9106,9 @@ class TreeDataStructure {
|
|
|
9060
9106
|
originalData.splice(index + 1, 0, ...data);
|
|
9061
9107
|
this.originalDatasource.data = originalData;
|
|
9062
9108
|
this.originalDatasource.currentRow = this.clearRow(row);
|
|
9109
|
+
return data;
|
|
9063
9110
|
}
|
|
9111
|
+
return undefined;
|
|
9064
9112
|
});
|
|
9065
9113
|
}
|
|
9066
9114
|
/**
|
|
@@ -9248,6 +9296,11 @@ class SelectTree extends TextInput {
|
|
|
9248
9296
|
*/
|
|
9249
9297
|
this.lazyLoad = true;
|
|
9250
9298
|
this.selectValue = null;
|
|
9299
|
+
/**
|
|
9300
|
+
* Uses delayed loading to load tree branches
|
|
9301
|
+
*/
|
|
9302
|
+
this.fetchOnDemand = false;
|
|
9303
|
+
this.savedNodes = undefined;
|
|
9251
9304
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
9252
9305
|
this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
|
|
9253
9306
|
this.flattenSearchResults = this.getInitValue('flattenSearchResults', props.flattenSearchResults, this.flattenSearchResults);
|
|
@@ -9266,6 +9319,7 @@ class SelectTree extends TextInput {
|
|
|
9266
9319
|
this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
|
|
9267
9320
|
this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
|
|
9268
9321
|
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
9322
|
+
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
9269
9323
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
9270
9324
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
9271
9325
|
const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
@@ -9302,7 +9356,7 @@ class SelectTree extends TextInput {
|
|
|
9302
9356
|
datasource: this.datasource,
|
|
9303
9357
|
parentField: this.parentField,
|
|
9304
9358
|
openLevelOnLoad: false,
|
|
9305
|
-
fetchOnDemand:
|
|
9359
|
+
fetchOnDemand: this.fetchOnDemand,
|
|
9306
9360
|
});
|
|
9307
9361
|
if (!this.lazyLoad) {
|
|
9308
9362
|
this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
|
|
@@ -9322,7 +9376,16 @@ class SelectTree extends TextInput {
|
|
|
9322
9376
|
}
|
|
9323
9377
|
}
|
|
9324
9378
|
createNodeFromRow(row) {
|
|
9325
|
-
|
|
9379
|
+
let children;
|
|
9380
|
+
if (this.fetchOnDemand && !this.datasource.search) {
|
|
9381
|
+
children = null;
|
|
9382
|
+
}
|
|
9383
|
+
else {
|
|
9384
|
+
children = this.createChildrenNodes(row.tree__children);
|
|
9385
|
+
if (!children.length) {
|
|
9386
|
+
children = undefined;
|
|
9387
|
+
}
|
|
9388
|
+
}
|
|
9326
9389
|
const dataTextArr = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
9327
9390
|
const dataTextNames = [];
|
|
9328
9391
|
const masks = [];
|
|
@@ -9357,15 +9420,18 @@ class SelectTree extends TextInput {
|
|
|
9357
9420
|
return {
|
|
9358
9421
|
id: row[this.dataValue],
|
|
9359
9422
|
label: dataText,
|
|
9360
|
-
children
|
|
9423
|
+
children,
|
|
9361
9424
|
row,
|
|
9362
9425
|
};
|
|
9363
9426
|
}
|
|
9364
9427
|
createChildrenNodes(rows) {
|
|
9365
9428
|
const newNodes = [];
|
|
9366
9429
|
rows.forEach((row) => {
|
|
9367
|
-
|
|
9368
|
-
|
|
9430
|
+
if (Object.keys(row).length > 0) {
|
|
9431
|
+
const newNode = this.createNodeFromRow(row);
|
|
9432
|
+
row.tree__node = newNode;
|
|
9433
|
+
newNodes.push(newNode);
|
|
9434
|
+
}
|
|
9369
9435
|
});
|
|
9370
9436
|
return newNodes;
|
|
9371
9437
|
}
|
|
@@ -9391,6 +9457,26 @@ class SelectTree extends TextInput {
|
|
|
9391
9457
|
* Triggered after the search query changes
|
|
9392
9458
|
*/
|
|
9393
9459
|
searchChange(searchQuery, element) {
|
|
9460
|
+
if (this.fetchOnDemand) {
|
|
9461
|
+
if (!searchQuery && this.savedNodes) {
|
|
9462
|
+
this.nodes = this.savedNodes;
|
|
9463
|
+
this.savedNodes = undefined;
|
|
9464
|
+
this.datasource.search = '';
|
|
9465
|
+
}
|
|
9466
|
+
else {
|
|
9467
|
+
if (!this.savedNodes) {
|
|
9468
|
+
this.savedNodes = [...this.nodes];
|
|
9469
|
+
}
|
|
9470
|
+
this.datasource.setSearch(searchQuery).then(() => {
|
|
9471
|
+
const treeData = this.treeDataStructure.treeData.map((item) => {
|
|
9472
|
+
delete item[this.parentField];
|
|
9473
|
+
item.tree__children = [];
|
|
9474
|
+
return item;
|
|
9475
|
+
});
|
|
9476
|
+
this.nodes = this.createChildrenNodes(treeData);
|
|
9477
|
+
});
|
|
9478
|
+
}
|
|
9479
|
+
}
|
|
9394
9480
|
this.callEvent('onSearchChange', { element, component: this, searchQuery });
|
|
9395
9481
|
}
|
|
9396
9482
|
isDisable(node) {
|
|
@@ -9401,7 +9487,7 @@ class SelectTree extends TextInput {
|
|
|
9401
9487
|
return this.disabledItems.indexOf(node.id) !== -1;
|
|
9402
9488
|
}
|
|
9403
9489
|
getDisabledNodes(nodes) {
|
|
9404
|
-
return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) :
|
|
9490
|
+
return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : node.children })));
|
|
9405
9491
|
}
|
|
9406
9492
|
getNodes() {
|
|
9407
9493
|
return this.getDisabledNodes(this.nodes);
|
|
@@ -9420,7 +9506,7 @@ class SelectTree extends TextInput {
|
|
|
9420
9506
|
return !hasError;
|
|
9421
9507
|
}
|
|
9422
9508
|
/**
|
|
9423
|
-
* Triggered when the data is
|
|
9509
|
+
* Triggered when the data is inputed.
|
|
9424
9510
|
* @param value search value
|
|
9425
9511
|
* @param event DOM event
|
|
9426
9512
|
* @param element Element focused
|
|
@@ -9429,6 +9515,7 @@ class SelectTree extends TextInput {
|
|
|
9429
9515
|
if (value !== this.lastInputValue) {
|
|
9430
9516
|
this.lastInputValue = value;
|
|
9431
9517
|
this.callInputEvent({ element, component: this });
|
|
9518
|
+
this.searchChange(value, element);
|
|
9432
9519
|
}
|
|
9433
9520
|
}
|
|
9434
9521
|
get searchValue() {
|
|
@@ -9468,6 +9555,22 @@ class SelectTree extends TextInput {
|
|
|
9468
9555
|
}
|
|
9469
9556
|
this.selectValue = val;
|
|
9470
9557
|
}
|
|
9558
|
+
loadChildren(parentNode) {
|
|
9559
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9560
|
+
return this.treeDataStructure.toggleExpand(parentNode.row).then((data) => {
|
|
9561
|
+
const node = parentNode.row.tree__node;
|
|
9562
|
+
if (node) {
|
|
9563
|
+
if (!data || data.length === 0) {
|
|
9564
|
+
node.children = undefined;
|
|
9565
|
+
}
|
|
9566
|
+
else {
|
|
9567
|
+
const nodes = this.createChildrenNodes(data);
|
|
9568
|
+
node.children = nodes;
|
|
9569
|
+
}
|
|
9570
|
+
}
|
|
9571
|
+
});
|
|
9572
|
+
});
|
|
9573
|
+
}
|
|
9471
9574
|
}
|
|
9472
9575
|
|
|
9473
9576
|
/**
|
|
@@ -9887,9 +9990,11 @@ class Tab extends Component {
|
|
|
9887
9990
|
super(props);
|
|
9888
9991
|
this.disabled = false;
|
|
9889
9992
|
this.tabTitle = '';
|
|
9993
|
+
this.lazyLoad = true;
|
|
9890
9994
|
this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
|
|
9891
9995
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
9892
9996
|
this.flex = this.getInitValue('flex', props.flex, this.flex);
|
|
9997
|
+
this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
|
|
9893
9998
|
this.createAccessors();
|
|
9894
9999
|
}
|
|
9895
10000
|
}
|
|
@@ -10540,6 +10645,10 @@ class Tree extends ComponentRender {
|
|
|
10540
10645
|
children: [],
|
|
10541
10646
|
};
|
|
10542
10647
|
newNode = merge(newNode, node, override);
|
|
10648
|
+
if (typeof node.isLeaf === 'undefined') {
|
|
10649
|
+
const hasChildren = newNode.children.length > 0;
|
|
10650
|
+
newNode.isLeaf = !hasChildren;
|
|
10651
|
+
}
|
|
10543
10652
|
newNode.children = this.initNodes(node.children || [], override);
|
|
10544
10653
|
return newNode;
|
|
10545
10654
|
});
|
|
@@ -10614,6 +10723,7 @@ class Tree extends ComponentRender {
|
|
|
10614
10723
|
insertNode(newNode) {
|
|
10615
10724
|
const initNode = this.initNodes([newNode])[0];
|
|
10616
10725
|
if (this.selectedNodes.length) {
|
|
10726
|
+
this.updateNodeData(this.selectedNodes[0], { isLeaf: false });
|
|
10617
10727
|
const cursorPosition = {
|
|
10618
10728
|
node: this.selectedNodes[0],
|
|
10619
10729
|
placement: 'inside',
|
|
@@ -10624,31 +10734,44 @@ class Tree extends ComponentRender {
|
|
|
10624
10734
|
this.nodes.push(initNode);
|
|
10625
10735
|
}
|
|
10626
10736
|
}
|
|
10737
|
+
/** Import multiples nodes by the current cursor position */
|
|
10627
10738
|
importNodes(nodes) {
|
|
10628
10739
|
if (this.selectedNodes.length) {
|
|
10629
|
-
const cursorPosition = {
|
|
10630
|
-
node: this.selectedNodes[0],
|
|
10631
|
-
placement: 'inside',
|
|
10632
|
-
};
|
|
10633
10740
|
nodes.reverse().forEach((node) => {
|
|
10634
|
-
this.
|
|
10741
|
+
this.insertNode(node);
|
|
10635
10742
|
});
|
|
10636
10743
|
}
|
|
10637
10744
|
else {
|
|
10638
10745
|
nodes.forEach((node) => {
|
|
10639
|
-
this.
|
|
10746
|
+
this.insertNode(node);
|
|
10640
10747
|
});
|
|
10641
10748
|
}
|
|
10642
10749
|
}
|
|
10643
10750
|
/** Remove selected node */
|
|
10644
10751
|
removeSelected() {
|
|
10752
|
+
const parentNodesPath = [];
|
|
10645
10753
|
if (this.selectedNodes.length) {
|
|
10646
|
-
const selectedPaths = this.selectedNodes.map((item) =>
|
|
10754
|
+
const selectedPaths = this.selectedNodes.map((item) => {
|
|
10755
|
+
const parent = this.getParentNode(item);
|
|
10756
|
+
if (parent) {
|
|
10757
|
+
parentNodesPath.push(parent.path);
|
|
10758
|
+
}
|
|
10759
|
+
return item.path;
|
|
10760
|
+
});
|
|
10647
10761
|
this.tree.remove(selectedPaths);
|
|
10762
|
+
parentNodesPath.forEach((path) => {
|
|
10763
|
+
const parent = this.getNode(path);
|
|
10764
|
+
if (parent && parent.children && parent.children.length === 0) {
|
|
10765
|
+
this.tree.updateNode(path, { isLeaf: true });
|
|
10766
|
+
}
|
|
10767
|
+
});
|
|
10648
10768
|
}
|
|
10649
10769
|
}
|
|
10650
10770
|
/** Update selected node */
|
|
10651
10771
|
updateNodeData(node, value) {
|
|
10772
|
+
if (node.children && node.children.length === 0) {
|
|
10773
|
+
this.tree.updateNode(node.path, { isLeaf: true });
|
|
10774
|
+
}
|
|
10652
10775
|
this.tree.updateNode(node.path, value);
|
|
10653
10776
|
}
|
|
10654
10777
|
setTree(tree) {
|
|
@@ -10782,7 +10905,7 @@ class Tree extends ComponentRender {
|
|
|
10782
10905
|
}
|
|
10783
10906
|
getParentNode(node) {
|
|
10784
10907
|
const hasParent = Array.isArray(node.path) && node.path.length > 1;
|
|
10785
|
-
if (
|
|
10908
|
+
if (hasParent) {
|
|
10786
10909
|
return this.tree.getNode(node.path.slice(0, -1));
|
|
10787
10910
|
}
|
|
10788
10911
|
return undefined;
|
|
@@ -11135,8 +11258,13 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11135
11258
|
});
|
|
11136
11259
|
}
|
|
11137
11260
|
} });
|
|
11261
|
+
this.updateOriginalRow(key, row);
|
|
11138
11262
|
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 });
|
|
11139
11263
|
}
|
|
11264
|
+
updateOriginalRow(key, row) {
|
|
11265
|
+
if (this.editedRows[key] !== undefined)
|
|
11266
|
+
this.editedRows[key].originalRow = row;
|
|
11267
|
+
}
|
|
11140
11268
|
checkLookupData(column, row, componentProps) {
|
|
11141
11269
|
if (row[column.name] && column.lookupData && componentProps.datasource) {
|
|
11142
11270
|
componentProps.datasource.data = componentProps.datasource.data || [];
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -2324,7 +2324,12 @@
|
|
|
2324
2324
|
* Removes viewport maximum-width size breakpoints.
|
|
2325
2325
|
*/
|
|
2326
2326
|
this.fluid = true;
|
|
2327
|
+
/**
|
|
2328
|
+
* Define if the container is a scroll view
|
|
2329
|
+
*/
|
|
2330
|
+
this.scrollView = false;
|
|
2327
2331
|
this.fluid = this.getInitValue('fluid', props.fluid, this.fluid);
|
|
2332
|
+
this.scrollView = this.getInitValue('scrollView', props.scrollView, this.scrollView);
|
|
2328
2333
|
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
2329
2334
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
2330
2335
|
this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
|
|
@@ -2820,6 +2825,16 @@
|
|
|
2820
2825
|
return this.create(modal);
|
|
2821
2826
|
});
|
|
2822
2827
|
}
|
|
2828
|
+
/**
|
|
2829
|
+
* Creates a new modal instance from JSON
|
|
2830
|
+
* @param modal modal structure
|
|
2831
|
+
*/
|
|
2832
|
+
static createFromJsonPost(modalPath, params) {
|
|
2833
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2834
|
+
const modal = yield core.Metadata.post(modalPath, params);
|
|
2835
|
+
return this.create(modal);
|
|
2836
|
+
});
|
|
2837
|
+
}
|
|
2823
2838
|
/**
|
|
2824
2839
|
* Deletes modal
|
|
2825
2840
|
* @param modal modal instance
|
|
@@ -3110,7 +3125,7 @@
|
|
|
3110
3125
|
];
|
|
3111
3126
|
this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
|
|
3112
3127
|
this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
|
|
3113
|
-
this.cards = props.cards
|
|
3128
|
+
this.cards = this.getInitValue('cards', props.cards, this.cards);
|
|
3114
3129
|
this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
|
|
3115
3130
|
this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
|
|
3116
3131
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
@@ -3138,13 +3153,7 @@
|
|
|
3138
3153
|
addCard() {
|
|
3139
3154
|
const addCardForm = core.Metadata.getInstance('addCardForm');
|
|
3140
3155
|
if (addCardForm.validate()) {
|
|
3141
|
-
const newCard = {
|
|
3142
|
-
cardId: this.getCardId(),
|
|
3143
|
-
path: addCardForm.value.inputPath,
|
|
3144
|
-
local: addCardForm.value.inputLocal,
|
|
3145
|
-
height: addCardForm.value.inputHeight,
|
|
3146
|
-
width: addCardForm.value.inputWidth,
|
|
3147
|
-
};
|
|
3156
|
+
const newCard = Object.assign({ cardId: this.getCardId(), path: addCardForm.value.inputPath, local: addCardForm.value.inputLocal, height: addCardForm.value.inputHeight, width: addCardForm.value.inputWidth }, addCardForm.value);
|
|
3148
3157
|
this.cards.push(newCard);
|
|
3149
3158
|
this.modalCancelClick();
|
|
3150
3159
|
}
|
|
@@ -4459,8 +4468,8 @@
|
|
|
4459
4468
|
this.metadata = this.overrideNamedPropsFunc(this.metadata);
|
|
4460
4469
|
}
|
|
4461
4470
|
}
|
|
4462
|
-
catch (
|
|
4463
|
-
this.notFoundError();
|
|
4471
|
+
catch (e) {
|
|
4472
|
+
this.notFoundError(e);
|
|
4464
4473
|
}
|
|
4465
4474
|
finally {
|
|
4466
4475
|
this.loading = false;
|
|
@@ -4481,7 +4490,10 @@
|
|
|
4481
4490
|
this.getMetadata();
|
|
4482
4491
|
});
|
|
4483
4492
|
}
|
|
4484
|
-
notFoundError() {
|
|
4493
|
+
notFoundError(e) {
|
|
4494
|
+
if (this.rejectLoad)
|
|
4495
|
+
this.rejectLoad(e);
|
|
4496
|
+
}
|
|
4485
4497
|
requestPage() {
|
|
4486
4498
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4487
4499
|
if (!this.cache) {
|
|
@@ -4507,6 +4519,8 @@
|
|
|
4507
4519
|
* @param element
|
|
4508
4520
|
*/
|
|
4509
4521
|
afterLoad(event, element) {
|
|
4522
|
+
if (this.resolveLoad)
|
|
4523
|
+
this.resolveLoad(this.metadata);
|
|
4510
4524
|
this.callEvent('onAfterLoad', {
|
|
4511
4525
|
event, element, component: this,
|
|
4512
4526
|
});
|
|
@@ -4547,6 +4561,18 @@
|
|
|
4547
4561
|
return caches.delete(Frame.cacheName);
|
|
4548
4562
|
});
|
|
4549
4563
|
}
|
|
4564
|
+
waitLoading() {
|
|
4565
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4566
|
+
return new Promise((resolve, reject) => {
|
|
4567
|
+
if (!this.loading) {
|
|
4568
|
+
resolve(this.metadata);
|
|
4569
|
+
return;
|
|
4570
|
+
}
|
|
4571
|
+
this.resolveLoad = resolve;
|
|
4572
|
+
this.rejectLoad = reject;
|
|
4573
|
+
});
|
|
4574
|
+
});
|
|
4575
|
+
}
|
|
4550
4576
|
}
|
|
4551
4577
|
Frame.cacheName = 'zd-frame-cache';
|
|
4552
4578
|
|
|
@@ -4560,8 +4586,8 @@
|
|
|
4560
4586
|
this.notFoundRoute = this.getInitValue('notFoundRoute', props.notFoundRoute, this.notFoundRoute);
|
|
4561
4587
|
this.createAccessors();
|
|
4562
4588
|
}
|
|
4563
|
-
notFoundError() {
|
|
4564
|
-
super.notFoundError();
|
|
4589
|
+
notFoundError(e) {
|
|
4590
|
+
super.notFoundError(e);
|
|
4565
4591
|
core.Router.replace(this.notFoundRoute);
|
|
4566
4592
|
}
|
|
4567
4593
|
/**
|
|
@@ -4783,6 +4809,23 @@
|
|
|
4783
4809
|
}
|
|
4784
4810
|
}
|
|
4785
4811
|
|
|
4812
|
+
class IterableController {
|
|
4813
|
+
constructor(iterable) {
|
|
4814
|
+
this.searchInValue = undefined;
|
|
4815
|
+
this.columns = iterable.columns;
|
|
4816
|
+
}
|
|
4817
|
+
get searchIn() {
|
|
4818
|
+
return this.searchInValue || this.columns.reduce((result, column) => {
|
|
4819
|
+
if (column.type !== 'action' && column.isVisible)
|
|
4820
|
+
result.push(column.name);
|
|
4821
|
+
return result;
|
|
4822
|
+
}, []);
|
|
4823
|
+
}
|
|
4824
|
+
set searchIn(value) {
|
|
4825
|
+
this.searchInValue = value;
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4828
|
+
|
|
4786
4829
|
/**
|
|
4787
4830
|
* Base class for Iterable components.
|
|
4788
4831
|
*/
|
|
@@ -4818,16 +4861,14 @@
|
|
|
4818
4861
|
*/
|
|
4819
4862
|
this.actionsApplied = {};
|
|
4820
4863
|
this.columns = this.getColumns(props.columns || this.columns);
|
|
4821
|
-
this.
|
|
4864
|
+
this.createController();
|
|
4865
|
+
this.datasource = core.DatasourceFactory.factory(Object.assign(Object.assign({}, props.datasource), { searchIn: ((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.searchIn) || `{{IterableController_${this.name}.searchIn}}` }));
|
|
4822
4866
|
this.pageSizes = this.getInitValue('pageSizes', props.pageSizes, this.pageSizes);
|
|
4823
4867
|
this.virtualScroll = this.getInitValue('virtualScroll', props.virtualScroll, this.virtualScroll);
|
|
4824
4868
|
}
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
result.push(column.name);
|
|
4829
|
-
return result;
|
|
4830
|
-
}, []);
|
|
4869
|
+
createController() {
|
|
4870
|
+
const controller = new IterableController(this);
|
|
4871
|
+
core.Loader.addController(`IterableController_${this.name}`, controller);
|
|
4831
4872
|
}
|
|
4832
4873
|
/**
|
|
4833
4874
|
* Retrieves columns instances
|
|
@@ -5638,6 +5679,7 @@
|
|
|
5638
5679
|
});
|
|
5639
5680
|
}
|
|
5640
5681
|
} });
|
|
5682
|
+
this.updateOriginalRow(key, row);
|
|
5641
5683
|
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 });
|
|
5642
5684
|
}
|
|
5643
5685
|
checkLookupData(column, row, componentProps) {
|
|
@@ -5685,6 +5727,10 @@
|
|
|
5685
5727
|
this.editedRows = rows;
|
|
5686
5728
|
}
|
|
5687
5729
|
}
|
|
5730
|
+
updateOriginalRow(key, row) {
|
|
5731
|
+
if (this.editedRows[key] !== undefined)
|
|
5732
|
+
this.editedRows[key].originalRow = row;
|
|
5733
|
+
}
|
|
5688
5734
|
/**
|
|
5689
5735
|
* Checks if column is edited
|
|
5690
5736
|
* @param column Column
|
|
@@ -9067,7 +9113,9 @@
|
|
|
9067
9113
|
originalData.splice(index + 1, 0, ...data);
|
|
9068
9114
|
this.originalDatasource.data = originalData;
|
|
9069
9115
|
this.originalDatasource.currentRow = this.clearRow(row);
|
|
9116
|
+
return data;
|
|
9070
9117
|
}
|
|
9118
|
+
return undefined;
|
|
9071
9119
|
});
|
|
9072
9120
|
}
|
|
9073
9121
|
/**
|
|
@@ -9255,6 +9303,11 @@
|
|
|
9255
9303
|
*/
|
|
9256
9304
|
this.lazyLoad = true;
|
|
9257
9305
|
this.selectValue = null;
|
|
9306
|
+
/**
|
|
9307
|
+
* Uses delayed loading to load tree branches
|
|
9308
|
+
*/
|
|
9309
|
+
this.fetchOnDemand = false;
|
|
9310
|
+
this.savedNodes = undefined;
|
|
9258
9311
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
9259
9312
|
this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
|
|
9260
9313
|
this.flattenSearchResults = this.getInitValue('flattenSearchResults', props.flattenSearchResults, this.flattenSearchResults);
|
|
@@ -9273,6 +9326,7 @@
|
|
|
9273
9326
|
this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
|
|
9274
9327
|
this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
|
|
9275
9328
|
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
9329
|
+
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
9276
9330
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
9277
9331
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
9278
9332
|
const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
@@ -9309,7 +9363,7 @@
|
|
|
9309
9363
|
datasource: this.datasource,
|
|
9310
9364
|
parentField: this.parentField,
|
|
9311
9365
|
openLevelOnLoad: false,
|
|
9312
|
-
fetchOnDemand:
|
|
9366
|
+
fetchOnDemand: this.fetchOnDemand,
|
|
9313
9367
|
});
|
|
9314
9368
|
if (!this.lazyLoad) {
|
|
9315
9369
|
this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
|
|
@@ -9329,7 +9383,16 @@
|
|
|
9329
9383
|
}
|
|
9330
9384
|
}
|
|
9331
9385
|
createNodeFromRow(row) {
|
|
9332
|
-
|
|
9386
|
+
let children;
|
|
9387
|
+
if (this.fetchOnDemand && !this.datasource.search) {
|
|
9388
|
+
children = null;
|
|
9389
|
+
}
|
|
9390
|
+
else {
|
|
9391
|
+
children = this.createChildrenNodes(row.tree__children);
|
|
9392
|
+
if (!children.length) {
|
|
9393
|
+
children = undefined;
|
|
9394
|
+
}
|
|
9395
|
+
}
|
|
9333
9396
|
const dataTextArr = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
|
|
9334
9397
|
const dataTextNames = [];
|
|
9335
9398
|
const masks = [];
|
|
@@ -9364,15 +9427,18 @@
|
|
|
9364
9427
|
return {
|
|
9365
9428
|
id: row[this.dataValue],
|
|
9366
9429
|
label: dataText,
|
|
9367
|
-
children
|
|
9430
|
+
children,
|
|
9368
9431
|
row,
|
|
9369
9432
|
};
|
|
9370
9433
|
}
|
|
9371
9434
|
createChildrenNodes(rows) {
|
|
9372
9435
|
const newNodes = [];
|
|
9373
9436
|
rows.forEach((row) => {
|
|
9374
|
-
|
|
9375
|
-
|
|
9437
|
+
if (Object.keys(row).length > 0) {
|
|
9438
|
+
const newNode = this.createNodeFromRow(row);
|
|
9439
|
+
row.tree__node = newNode;
|
|
9440
|
+
newNodes.push(newNode);
|
|
9441
|
+
}
|
|
9376
9442
|
});
|
|
9377
9443
|
return newNodes;
|
|
9378
9444
|
}
|
|
@@ -9398,6 +9464,26 @@
|
|
|
9398
9464
|
* Triggered after the search query changes
|
|
9399
9465
|
*/
|
|
9400
9466
|
searchChange(searchQuery, element) {
|
|
9467
|
+
if (this.fetchOnDemand) {
|
|
9468
|
+
if (!searchQuery && this.savedNodes) {
|
|
9469
|
+
this.nodes = this.savedNodes;
|
|
9470
|
+
this.savedNodes = undefined;
|
|
9471
|
+
this.datasource.search = '';
|
|
9472
|
+
}
|
|
9473
|
+
else {
|
|
9474
|
+
if (!this.savedNodes) {
|
|
9475
|
+
this.savedNodes = [...this.nodes];
|
|
9476
|
+
}
|
|
9477
|
+
this.datasource.setSearch(searchQuery).then(() => {
|
|
9478
|
+
const treeData = this.treeDataStructure.treeData.map((item) => {
|
|
9479
|
+
delete item[this.parentField];
|
|
9480
|
+
item.tree__children = [];
|
|
9481
|
+
return item;
|
|
9482
|
+
});
|
|
9483
|
+
this.nodes = this.createChildrenNodes(treeData);
|
|
9484
|
+
});
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9401
9487
|
this.callEvent('onSearchChange', { element, component: this, searchQuery });
|
|
9402
9488
|
}
|
|
9403
9489
|
isDisable(node) {
|
|
@@ -9408,7 +9494,7 @@
|
|
|
9408
9494
|
return this.disabledItems.indexOf(node.id) !== -1;
|
|
9409
9495
|
}
|
|
9410
9496
|
getDisabledNodes(nodes) {
|
|
9411
|
-
return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) :
|
|
9497
|
+
return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : node.children })));
|
|
9412
9498
|
}
|
|
9413
9499
|
getNodes() {
|
|
9414
9500
|
return this.getDisabledNodes(this.nodes);
|
|
@@ -9427,7 +9513,7 @@
|
|
|
9427
9513
|
return !hasError;
|
|
9428
9514
|
}
|
|
9429
9515
|
/**
|
|
9430
|
-
* Triggered when the data is
|
|
9516
|
+
* Triggered when the data is inputed.
|
|
9431
9517
|
* @param value search value
|
|
9432
9518
|
* @param event DOM event
|
|
9433
9519
|
* @param element Element focused
|
|
@@ -9436,6 +9522,7 @@
|
|
|
9436
9522
|
if (value !== this.lastInputValue) {
|
|
9437
9523
|
this.lastInputValue = value;
|
|
9438
9524
|
this.callInputEvent({ element, component: this });
|
|
9525
|
+
this.searchChange(value, element);
|
|
9439
9526
|
}
|
|
9440
9527
|
}
|
|
9441
9528
|
get searchValue() {
|
|
@@ -9475,6 +9562,22 @@
|
|
|
9475
9562
|
}
|
|
9476
9563
|
this.selectValue = val;
|
|
9477
9564
|
}
|
|
9565
|
+
loadChildren(parentNode) {
|
|
9566
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
9567
|
+
return this.treeDataStructure.toggleExpand(parentNode.row).then((data) => {
|
|
9568
|
+
const node = parentNode.row.tree__node;
|
|
9569
|
+
if (node) {
|
|
9570
|
+
if (!data || data.length === 0) {
|
|
9571
|
+
node.children = undefined;
|
|
9572
|
+
}
|
|
9573
|
+
else {
|
|
9574
|
+
const nodes = this.createChildrenNodes(data);
|
|
9575
|
+
node.children = nodes;
|
|
9576
|
+
}
|
|
9577
|
+
}
|
|
9578
|
+
});
|
|
9579
|
+
});
|
|
9580
|
+
}
|
|
9478
9581
|
}
|
|
9479
9582
|
|
|
9480
9583
|
/**
|
|
@@ -9894,9 +9997,11 @@
|
|
|
9894
9997
|
super(props);
|
|
9895
9998
|
this.disabled = false;
|
|
9896
9999
|
this.tabTitle = '';
|
|
10000
|
+
this.lazyLoad = true;
|
|
9897
10001
|
this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
|
|
9898
10002
|
this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
|
|
9899
10003
|
this.flex = this.getInitValue('flex', props.flex, this.flex);
|
|
10004
|
+
this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
|
|
9900
10005
|
this.createAccessors();
|
|
9901
10006
|
}
|
|
9902
10007
|
}
|
|
@@ -10547,6 +10652,10 @@
|
|
|
10547
10652
|
children: [],
|
|
10548
10653
|
};
|
|
10549
10654
|
newNode = merge__default["default"](newNode, node, override);
|
|
10655
|
+
if (typeof node.isLeaf === 'undefined') {
|
|
10656
|
+
const hasChildren = newNode.children.length > 0;
|
|
10657
|
+
newNode.isLeaf = !hasChildren;
|
|
10658
|
+
}
|
|
10550
10659
|
newNode.children = this.initNodes(node.children || [], override);
|
|
10551
10660
|
return newNode;
|
|
10552
10661
|
});
|
|
@@ -10621,6 +10730,7 @@
|
|
|
10621
10730
|
insertNode(newNode) {
|
|
10622
10731
|
const initNode = this.initNodes([newNode])[0];
|
|
10623
10732
|
if (this.selectedNodes.length) {
|
|
10733
|
+
this.updateNodeData(this.selectedNodes[0], { isLeaf: false });
|
|
10624
10734
|
const cursorPosition = {
|
|
10625
10735
|
node: this.selectedNodes[0],
|
|
10626
10736
|
placement: 'inside',
|
|
@@ -10631,31 +10741,44 @@
|
|
|
10631
10741
|
this.nodes.push(initNode);
|
|
10632
10742
|
}
|
|
10633
10743
|
}
|
|
10744
|
+
/** Import multiples nodes by the current cursor position */
|
|
10634
10745
|
importNodes(nodes) {
|
|
10635
10746
|
if (this.selectedNodes.length) {
|
|
10636
|
-
const cursorPosition = {
|
|
10637
|
-
node: this.selectedNodes[0],
|
|
10638
|
-
placement: 'inside',
|
|
10639
|
-
};
|
|
10640
10747
|
nodes.reverse().forEach((node) => {
|
|
10641
|
-
this.
|
|
10748
|
+
this.insertNode(node);
|
|
10642
10749
|
});
|
|
10643
10750
|
}
|
|
10644
10751
|
else {
|
|
10645
10752
|
nodes.forEach((node) => {
|
|
10646
|
-
this.
|
|
10753
|
+
this.insertNode(node);
|
|
10647
10754
|
});
|
|
10648
10755
|
}
|
|
10649
10756
|
}
|
|
10650
10757
|
/** Remove selected node */
|
|
10651
10758
|
removeSelected() {
|
|
10759
|
+
const parentNodesPath = [];
|
|
10652
10760
|
if (this.selectedNodes.length) {
|
|
10653
|
-
const selectedPaths = this.selectedNodes.map((item) =>
|
|
10761
|
+
const selectedPaths = this.selectedNodes.map((item) => {
|
|
10762
|
+
const parent = this.getParentNode(item);
|
|
10763
|
+
if (parent) {
|
|
10764
|
+
parentNodesPath.push(parent.path);
|
|
10765
|
+
}
|
|
10766
|
+
return item.path;
|
|
10767
|
+
});
|
|
10654
10768
|
this.tree.remove(selectedPaths);
|
|
10769
|
+
parentNodesPath.forEach((path) => {
|
|
10770
|
+
const parent = this.getNode(path);
|
|
10771
|
+
if (parent && parent.children && parent.children.length === 0) {
|
|
10772
|
+
this.tree.updateNode(path, { isLeaf: true });
|
|
10773
|
+
}
|
|
10774
|
+
});
|
|
10655
10775
|
}
|
|
10656
10776
|
}
|
|
10657
10777
|
/** Update selected node */
|
|
10658
10778
|
updateNodeData(node, value) {
|
|
10779
|
+
if (node.children && node.children.length === 0) {
|
|
10780
|
+
this.tree.updateNode(node.path, { isLeaf: true });
|
|
10781
|
+
}
|
|
10659
10782
|
this.tree.updateNode(node.path, value);
|
|
10660
10783
|
}
|
|
10661
10784
|
setTree(tree) {
|
|
@@ -10789,7 +10912,7 @@
|
|
|
10789
10912
|
}
|
|
10790
10913
|
getParentNode(node) {
|
|
10791
10914
|
const hasParent = Array.isArray(node.path) && node.path.length > 1;
|
|
10792
|
-
if (
|
|
10915
|
+
if (hasParent) {
|
|
10793
10916
|
return this.tree.getNode(node.path.slice(0, -1));
|
|
10794
10917
|
}
|
|
10795
10918
|
return undefined;
|
|
@@ -11142,8 +11265,13 @@
|
|
|
11142
11265
|
});
|
|
11143
11266
|
}
|
|
11144
11267
|
} });
|
|
11268
|
+
this.updateOriginalRow(key, row);
|
|
11145
11269
|
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 });
|
|
11146
11270
|
}
|
|
11271
|
+
updateOriginalRow(key, row) {
|
|
11272
|
+
if (this.editedRows[key] !== undefined)
|
|
11273
|
+
this.editedRows[key].originalRow = row;
|
|
11274
|
+
}
|
|
11147
11275
|
checkLookupData(column, row, componentProps) {
|
|
11148
11276
|
if (row[column.name] && column.lookupData && componentProps.datasource) {
|
|
11149
11277
|
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.52.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": "7831436c706ebc6f781d756f5f80f393bf053b9b"
|
|
41
41
|
}
|
|
@@ -24,6 +24,10 @@ export declare class Container extends ComponentRender implements IContainer {
|
|
|
24
24
|
* Removes viewport maximum-width size breakpoints.
|
|
25
25
|
*/
|
|
26
26
|
fluid: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Define if the container is a scroll view
|
|
29
|
+
*/
|
|
30
|
+
scrollView: boolean;
|
|
27
31
|
/**
|
|
28
32
|
* Creates a new Container.
|
|
29
33
|
* @param props Container properties
|
|
@@ -2,7 +2,7 @@ import { IEventParam } from '@zeedhi/core';
|
|
|
2
2
|
import { Dashboard } from './dashboard';
|
|
3
3
|
import { IComponentRender, IComponentEvents } from '../zd-component/interfaces';
|
|
4
4
|
import { IButton } from '../zd-button/interfaces';
|
|
5
|
-
import {
|
|
5
|
+
import { ICard } from '../zd-card/interfaces';
|
|
6
6
|
export declare type IDashboardEventParam = IEventParam<Dashboard>;
|
|
7
7
|
export declare type IDashboardLoadEvent<T> = (event: T) => Promise<any>;
|
|
8
8
|
export interface IDashboardEvents<T = IEventParam<any>> extends IComponentEvents<T> {
|
|
@@ -19,13 +19,11 @@ export interface IDashboard extends IComponentRender {
|
|
|
19
19
|
height?: string | number;
|
|
20
20
|
heightAdjust?: string | number;
|
|
21
21
|
}
|
|
22
|
-
export interface IDashboardCard {
|
|
22
|
+
export interface IDashboardCard extends Omit<ICard, 'name' | 'component'> {
|
|
23
23
|
cardId: string;
|
|
24
24
|
path: string;
|
|
25
25
|
local: boolean;
|
|
26
26
|
height: number | string;
|
|
27
|
-
width: number;
|
|
28
|
-
flat?: boolean;
|
|
29
|
-
events?: ICardEvents;
|
|
27
|
+
width: number | string;
|
|
30
28
|
overrideNamedProps?: any;
|
|
31
29
|
}
|
|
@@ -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
|
|
@@ -41,7 +41,7 @@ export declare class Iterable extends ComponentRender implements IIterable {
|
|
|
41
41
|
* @param props Iterable properties
|
|
42
42
|
*/
|
|
43
43
|
constructor(props: IIterable);
|
|
44
|
-
protected
|
|
44
|
+
protected createController(): void;
|
|
45
45
|
/**
|
|
46
46
|
* Retrieves columns instances
|
|
47
47
|
* @param columns Columns property
|
|
@@ -6,7 +6,8 @@ export interface ISelectTreeNode<T> {
|
|
|
6
6
|
label: string;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
8
|
isDefaultExpanded?: boolean;
|
|
9
|
-
children?: ISelectTreeNode<T>[];
|
|
9
|
+
children?: ISelectTreeNode<T>[] | null;
|
|
10
|
+
row?: IDictionary<any>;
|
|
10
11
|
}
|
|
11
12
|
export interface ISelectTree extends IComponentRender {
|
|
12
13
|
nodes?: ISelectTreeNode<IDictionary>[];
|
|
@@ -28,6 +29,7 @@ export interface ISelectTree extends IComponentRender {
|
|
|
28
29
|
dataText?: string | any[];
|
|
29
30
|
dataDisabled?: string;
|
|
30
31
|
disabledItems?: any[];
|
|
32
|
+
fetchOnDemand?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export interface ISelectTreeCloseEvent extends IEventParam<SelectTree> {
|
|
33
35
|
selectedNodes: ISelectTreeNode<IDictionary>[];
|
|
@@ -89,6 +89,10 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
89
89
|
*/
|
|
90
90
|
private lazyLoad;
|
|
91
91
|
selectValue: any;
|
|
92
|
+
/**
|
|
93
|
+
* Uses delayed loading to load tree branches
|
|
94
|
+
*/
|
|
95
|
+
fetchOnDemand: boolean;
|
|
92
96
|
/**
|
|
93
97
|
* Creates a new instance of SelectTree
|
|
94
98
|
* @param props
|
|
@@ -113,16 +117,17 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
113
117
|
* Triggered after selecting an node
|
|
114
118
|
*/
|
|
115
119
|
select(node: ISelectTreeNode<IDictionary>, element?: any): void;
|
|
120
|
+
private savedNodes?;
|
|
116
121
|
/**
|
|
117
122
|
* Triggered after the search query changes
|
|
118
123
|
*/
|
|
119
|
-
searchChange(searchQuery:
|
|
124
|
+
searchChange(searchQuery: string, element?: any): void;
|
|
120
125
|
private isDisable;
|
|
121
126
|
private getDisabledNodes;
|
|
122
127
|
getNodes(): ISelectTreeNode<IDictionary>[];
|
|
123
128
|
validate(): boolean;
|
|
124
129
|
/**
|
|
125
|
-
* Triggered when the data is
|
|
130
|
+
* Triggered when the data is inputed.
|
|
126
131
|
* @param value search value
|
|
127
132
|
* @param event DOM event
|
|
128
133
|
* @param element Element focused
|
|
@@ -135,4 +140,5 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
135
140
|
get value(): any;
|
|
136
141
|
set value(value: any);
|
|
137
142
|
setValue(value: any): void;
|
|
143
|
+
loadChildren(parentNode: ISelectTreeNode<IDictionary>): Promise<void>;
|
|
138
144
|
}
|
|
@@ -68,7 +68,7 @@ export declare class Tree extends ComponentRender implements ITree {
|
|
|
68
68
|
/**
|
|
69
69
|
* Initialize all the properties of the declared nodes (reactivity)
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
initNodes(nodes: ITreeNodeModel<IDictionary>[], override?: IDictionary): ITreeNodeModel<IDictionary>[];
|
|
72
72
|
/** Nodes */
|
|
73
73
|
get nodes(): ITreeNodeModel<IDictionary>[];
|
|
74
74
|
set nodes(value: ITreeNodeModel<IDictionary>[]);
|
|
@@ -82,6 +82,7 @@ export declare class Tree extends ComponentRender implements ITree {
|
|
|
82
82
|
private createChildrenNodes;
|
|
83
83
|
/** Insert nodes by the current cursor position */
|
|
84
84
|
insertNode(newNode: ITreeNodeModel<IDictionary>): void;
|
|
85
|
+
/** Import multiples nodes by the current cursor position */
|
|
85
86
|
importNodes(nodes: ITreeNodeModel<IDictionary>[]): void;
|
|
86
87
|
/** Remove selected node */
|
|
87
88
|
removeSelected(): void;
|
|
@@ -17,6 +17,11 @@ export declare class ModalService {
|
|
|
17
17
|
* @param modal modal structure
|
|
18
18
|
*/
|
|
19
19
|
static createFromJson(modalPath: string, local?: boolean): Promise<Modal>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new modal instance from JSON
|
|
22
|
+
* @param modal modal structure
|
|
23
|
+
*/
|
|
24
|
+
static createFromJsonPost(modalPath: string, params?: object): Promise<Modal>;
|
|
20
25
|
/**
|
|
21
26
|
* Deletes modal
|
|
22
27
|
* @param modal modal instance
|
|
@@ -105,7 +105,7 @@ export declare class TreeDataStructure {
|
|
|
105
105
|
* @param row Row object
|
|
106
106
|
* @param rowIndex Row index
|
|
107
107
|
*/
|
|
108
|
-
toggleExpand(row: IDictionary<any>, rowIndex?: number): Promise<
|
|
108
|
+
toggleExpand(row: IDictionary<any>, rowIndex?: number): Promise<IDictionary<any>[] | undefined>;
|
|
109
109
|
/**
|
|
110
110
|
* Return row with tree data
|
|
111
111
|
* @param row datasource row
|