@zeedhi/common 1.48.1 → 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.
@@ -1794,16 +1794,17 @@ class Input extends ComponentRender {
1794
1794
  set displayValue(value) {
1795
1795
  if (this.internalDisplayValue !== value) {
1796
1796
  this.internalValue = this.parser(value);
1797
+ this.value = this.internalValue; // forces value accessor to be called if necessary
1797
1798
  let { mask } = this;
1798
1799
  if (mask) {
1799
1800
  if (typeof mask === 'function') {
1800
1801
  mask = mask(this.internalValue);
1801
1802
  }
1802
- this.internalDisplayValue = Mask.convertAll(mask, value);
1803
+ this.internalDisplayValue = Mask.convertAll(mask, this.internalValue);
1803
1804
  this.internalValue = this.parser(this.internalDisplayValue);
1804
1805
  }
1805
1806
  else {
1806
- this.internalDisplayValue = value;
1807
+ this.internalDisplayValue = this.internalValue;
1807
1808
  }
1808
1809
  }
1809
1810
  }
@@ -2812,6 +2813,16 @@ class ModalService {
2812
2813
  return this.create(modal);
2813
2814
  });
2814
2815
  }
2816
+ /**
2817
+ * Creates a new modal instance from JSON
2818
+ * @param modal modal structure
2819
+ */
2820
+ static createFromJsonPost(modalPath, params) {
2821
+ return __awaiter(this, void 0, void 0, function* () {
2822
+ const modal = yield Metadata.post(modalPath, params);
2823
+ return this.create(modal);
2824
+ });
2825
+ }
2815
2826
  /**
2816
2827
  * Deletes modal
2817
2828
  * @param modal modal instance
@@ -3102,7 +3113,7 @@ class Dashboard extends ComponentRender {
3102
3113
  ];
3103
3114
  this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
3104
3115
  this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
3105
- this.cards = props.cards || this.cards;
3116
+ this.cards = this.getInitValue('cards', props.cards, this.cards);
3106
3117
  this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
3107
3118
  this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
3108
3119
  this.height = this.getInitValue('height', props.height, this.height);
@@ -3130,13 +3141,7 @@ class Dashboard extends ComponentRender {
3130
3141
  addCard() {
3131
3142
  const addCardForm = Metadata.getInstance('addCardForm');
3132
3143
  if (addCardForm.validate()) {
3133
- const newCard = {
3134
- cardId: this.getCardId(),
3135
- path: addCardForm.value.inputPath,
3136
- local: addCardForm.value.inputLocal,
3137
- height: addCardForm.value.inputHeight,
3138
- width: addCardForm.value.inputWidth,
3139
- };
3144
+ 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);
3140
3145
  this.cards.push(newCard);
3141
3146
  this.modalCancelClick();
3142
3147
  }
@@ -3428,6 +3433,7 @@ class Date$1 extends TextInput {
3428
3433
  this.dateError = false;
3429
3434
  this.internalDisplayValue = newValue;
3430
3435
  this.internalValue = this.parser(newValue);
3436
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3431
3437
  }
3432
3438
  /**
3433
3439
  * Assign the updated mask to mask property
@@ -3467,6 +3473,7 @@ class Date$1 extends TextInput {
3467
3473
  }
3468
3474
  this.dateError = !!displayValue;
3469
3475
  }
3476
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3470
3477
  }
3471
3478
  isValidDate(value, format, strict = true) {
3472
3479
  return dayjs(value, format, strict).isValid();
@@ -3773,6 +3780,7 @@ class DateRange extends TextInput {
3773
3780
  this.internalValue = this.parser(newValue);
3774
3781
  else
3775
3782
  this.internalValue = [];
3783
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3776
3784
  }
3777
3785
  /**
3778
3786
  * Assign the updated mask to mask property
@@ -3813,6 +3821,7 @@ class DateRange extends TextInput {
3813
3821
  }
3814
3822
  this.dateError = !!displayValue;
3815
3823
  }
3824
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3816
3825
  }
3817
3826
  isValidDateArray(format, values) {
3818
3827
  if (!values || values.length === 0)
@@ -4412,14 +4421,17 @@ class Frame extends ComponentRender {
4412
4421
  this.local = false;
4413
4422
  this.metadata = {};
4414
4423
  this.override = {};
4424
+ this.params = {};
4415
4425
  this.overrideNamedProps = {};
4426
+ this.path = '';
4416
4427
  this.cache = false;
4417
4428
  this.cacheDuration = 2 * 60 * 60 * 1000;
4418
4429
  this.height = 'auto';
4419
4430
  this.maxHeight = 'none';
4420
4431
  this.minHeight = 'none';
4432
+ this.type = 'get';
4421
4433
  this.headerName = 'sw-fetched-on';
4422
- this.path = props.path;
4434
+ this.path = this.getInitValue('path', props.path, this.path);
4423
4435
  this.local = props.local === true;
4424
4436
  this.override = props.override || this.override;
4425
4437
  this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
@@ -4428,6 +4440,8 @@ class Frame extends ComponentRender {
4428
4440
  this.height = this.getInitValue('height', props.height, this.height);
4429
4441
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4430
4442
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4443
+ this.type = this.getInitValue('type', props.type, this.type);
4444
+ this.params = this.getInitValue('params', props.params, this.params);
4431
4445
  this.createAccessors();
4432
4446
  this.getMetadata();
4433
4447
  }
@@ -4442,8 +4456,8 @@ class Frame extends ComponentRender {
4442
4456
  this.metadata = this.overrideNamedPropsFunc(this.metadata);
4443
4457
  }
4444
4458
  }
4445
- catch (_a) {
4446
- this.notFoundError();
4459
+ catch (e) {
4460
+ this.notFoundError(e);
4447
4461
  }
4448
4462
  finally {
4449
4463
  this.loading = false;
@@ -4464,10 +4478,16 @@ class Frame extends ComponentRender {
4464
4478
  this.getMetadata();
4465
4479
  });
4466
4480
  }
4467
- notFoundError() { }
4481
+ notFoundError(e) {
4482
+ if (this.rejectLoad)
4483
+ this.rejectLoad(e);
4484
+ }
4468
4485
  requestPage() {
4469
4486
  return __awaiter(this, void 0, void 0, function* () {
4470
4487
  if (!this.cache) {
4488
+ if (this.type === 'post') {
4489
+ return Metadata.post(this.path, this.params);
4490
+ }
4471
4491
  return Metadata.get(this.path, this.local);
4472
4492
  }
4473
4493
  const url = Metadata.getMetadataUrl(this.path, this.local);
@@ -4487,6 +4507,8 @@ class Frame extends ComponentRender {
4487
4507
  * @param element
4488
4508
  */
4489
4509
  afterLoad(event, element) {
4510
+ if (this.resolveLoad)
4511
+ this.resolveLoad(this.metadata);
4490
4512
  this.callEvent('onAfterLoad', {
4491
4513
  event, element, component: this,
4492
4514
  });
@@ -4527,6 +4549,18 @@ class Frame extends ComponentRender {
4527
4549
  return caches.delete(Frame.cacheName);
4528
4550
  });
4529
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
+ }
4530
4564
  }
4531
4565
  Frame.cacheName = 'zd-frame-cache';
4532
4566
 
@@ -4540,8 +4574,8 @@ class FramePage extends Frame {
4540
4574
  this.notFoundRoute = this.getInitValue('notFoundRoute', props.notFoundRoute, this.notFoundRoute);
4541
4575
  this.createAccessors();
4542
4576
  }
4543
- notFoundError() {
4544
- super.notFoundError();
4577
+ notFoundError(e) {
4578
+ super.notFoundError(e);
4545
4579
  Router.replace(this.notFoundRoute);
4546
4580
  }
4547
4581
  /**
@@ -5618,6 +5652,7 @@ class GridEditable extends Grid {
5618
5652
  });
5619
5653
  }
5620
5654
  } });
5655
+ this.updateOriginalRow(key, row);
5621
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 });
5622
5657
  }
5623
5658
  checkLookupData(column, row, componentProps) {
@@ -5665,6 +5700,10 @@ class GridEditable extends Grid {
5665
5700
  this.editedRows = rows;
5666
5701
  }
5667
5702
  }
5703
+ updateOriginalRow(key, row) {
5704
+ if (this.editedRows[key] !== undefined)
5705
+ this.editedRows[key].originalRow = row;
5706
+ }
5668
5707
  /**
5669
5708
  * Checks if column is edited
5670
5709
  * @param column Column
@@ -9047,7 +9086,9 @@ class TreeDataStructure {
9047
9086
  originalData.splice(index + 1, 0, ...data);
9048
9087
  this.originalDatasource.data = originalData;
9049
9088
  this.originalDatasource.currentRow = this.clearRow(row);
9089
+ return data;
9050
9090
  }
9091
+ return undefined;
9051
9092
  });
9052
9093
  }
9053
9094
  /**
@@ -9235,6 +9276,11 @@ class SelectTree extends TextInput {
9235
9276
  */
9236
9277
  this.lazyLoad = true;
9237
9278
  this.selectValue = null;
9279
+ /**
9280
+ * Uses delayed loading to load tree branches
9281
+ */
9282
+ this.fetchOnDemand = false;
9283
+ this.savedNodes = undefined;
9238
9284
  this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
9239
9285
  this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
9240
9286
  this.flattenSearchResults = this.getInitValue('flattenSearchResults', props.flattenSearchResults, this.flattenSearchResults);
@@ -9253,6 +9299,7 @@ class SelectTree extends TextInput {
9253
9299
  this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
9254
9300
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
9255
9301
  this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
9302
+ this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
9256
9303
  if (props.datasource && Object.keys(props.datasource).length) {
9257
9304
  this.lazyLoad = props.datasource.lazyLoad !== false;
9258
9305
  const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
@@ -9289,7 +9336,7 @@ class SelectTree extends TextInput {
9289
9336
  datasource: this.datasource,
9290
9337
  parentField: this.parentField,
9291
9338
  openLevelOnLoad: false,
9292
- fetchOnDemand: false,
9339
+ fetchOnDemand: this.fetchOnDemand,
9293
9340
  });
9294
9341
  if (!this.lazyLoad) {
9295
9342
  this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
@@ -9309,7 +9356,16 @@ class SelectTree extends TextInput {
9309
9356
  }
9310
9357
  }
9311
9358
  createNodeFromRow(row) {
9312
- const children = this.createChildrenNodes(row.tree__children);
9359
+ let children;
9360
+ if (this.fetchOnDemand && !this.datasource.search) {
9361
+ children = null;
9362
+ }
9363
+ else {
9364
+ children = this.createChildrenNodes(row.tree__children);
9365
+ if (!children.length) {
9366
+ children = undefined;
9367
+ }
9368
+ }
9313
9369
  const dataTextArr = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
9314
9370
  const dataTextNames = [];
9315
9371
  const masks = [];
@@ -9344,15 +9400,18 @@ class SelectTree extends TextInput {
9344
9400
  return {
9345
9401
  id: row[this.dataValue],
9346
9402
  label: dataText,
9347
- children: children.length ? children : undefined,
9403
+ children,
9348
9404
  row,
9349
9405
  };
9350
9406
  }
9351
9407
  createChildrenNodes(rows) {
9352
9408
  const newNodes = [];
9353
9409
  rows.forEach((row) => {
9354
- const newNode = this.createNodeFromRow(row);
9355
- newNodes.push(newNode);
9410
+ if (Object.keys(row).length > 0) {
9411
+ const newNode = this.createNodeFromRow(row);
9412
+ row.tree__node = newNode;
9413
+ newNodes.push(newNode);
9414
+ }
9356
9415
  });
9357
9416
  return newNodes;
9358
9417
  }
@@ -9378,6 +9437,26 @@ class SelectTree extends TextInput {
9378
9437
  * Triggered after the search query changes
9379
9438
  */
9380
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
+ }
9381
9460
  this.callEvent('onSearchChange', { element, component: this, searchQuery });
9382
9461
  }
9383
9462
  isDisable(node) {
@@ -9388,7 +9467,7 @@ class SelectTree extends TextInput {
9388
9467
  return this.disabledItems.indexOf(node.id) !== -1;
9389
9468
  }
9390
9469
  getDisabledNodes(nodes) {
9391
- return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : undefined })));
9470
+ return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : node.children })));
9392
9471
  }
9393
9472
  getNodes() {
9394
9473
  return this.getDisabledNodes(this.nodes);
@@ -9407,7 +9486,7 @@ class SelectTree extends TextInput {
9407
9486
  return !hasError;
9408
9487
  }
9409
9488
  /**
9410
- * Triggered when the data is inputted.
9489
+ * Triggered when the data is inputed.
9411
9490
  * @param value search value
9412
9491
  * @param event DOM event
9413
9492
  * @param element Element focused
@@ -9416,6 +9495,7 @@ class SelectTree extends TextInput {
9416
9495
  if (value !== this.lastInputValue) {
9417
9496
  this.lastInputValue = value;
9418
9497
  this.callInputEvent({ element, component: this });
9498
+ this.searchChange(value, element);
9419
9499
  }
9420
9500
  }
9421
9501
  get searchValue() {
@@ -9455,6 +9535,22 @@ class SelectTree extends TextInput {
9455
9535
  }
9456
9536
  this.selectValue = val;
9457
9537
  }
9538
+ loadChildren(parentNode) {
9539
+ return __awaiter(this, void 0, void 0, function* () {
9540
+ return this.treeDataStructure.toggleExpand(parentNode.row).then((data) => {
9541
+ const node = parentNode.row.tree__node;
9542
+ if (node) {
9543
+ if (!data || data.length === 0) {
9544
+ node.children = undefined;
9545
+ }
9546
+ else {
9547
+ const nodes = this.createChildrenNodes(data);
9548
+ node.children = nodes;
9549
+ }
9550
+ }
9551
+ });
9552
+ });
9553
+ }
9458
9554
  }
9459
9555
 
9460
9556
  /**
@@ -9874,9 +9970,11 @@ class Tab extends Component {
9874
9970
  super(props);
9875
9971
  this.disabled = false;
9876
9972
  this.tabTitle = '';
9973
+ this.lazyLoad = true;
9877
9974
  this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
9878
9975
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
9879
9976
  this.flex = this.getInitValue('flex', props.flex, this.flex);
9977
+ this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
9880
9978
  this.createAccessors();
9881
9979
  }
9882
9980
  }
@@ -10527,6 +10625,10 @@ class Tree extends ComponentRender {
10527
10625
  children: [],
10528
10626
  };
10529
10627
  newNode = merge(newNode, node, override);
10628
+ if (typeof node.isLeaf === 'undefined') {
10629
+ const hasChildren = newNode.children.length > 0;
10630
+ newNode.isLeaf = !hasChildren;
10631
+ }
10530
10632
  newNode.children = this.initNodes(node.children || [], override);
10531
10633
  return newNode;
10532
10634
  });
@@ -10601,6 +10703,7 @@ class Tree extends ComponentRender {
10601
10703
  insertNode(newNode) {
10602
10704
  const initNode = this.initNodes([newNode])[0];
10603
10705
  if (this.selectedNodes.length) {
10706
+ this.updateNodeData(this.selectedNodes[0], { isLeaf: false });
10604
10707
  const cursorPosition = {
10605
10708
  node: this.selectedNodes[0],
10606
10709
  placement: 'inside',
@@ -10611,31 +10714,44 @@ class Tree extends ComponentRender {
10611
10714
  this.nodes.push(initNode);
10612
10715
  }
10613
10716
  }
10717
+ /** Import multiples nodes by the current cursor position */
10614
10718
  importNodes(nodes) {
10615
10719
  if (this.selectedNodes.length) {
10616
- const cursorPosition = {
10617
- node: this.selectedNodes[0],
10618
- placement: 'inside',
10619
- };
10620
10720
  nodes.reverse().forEach((node) => {
10621
- this.tree.insert(cursorPosition, node);
10721
+ this.insertNode(node);
10622
10722
  });
10623
10723
  }
10624
10724
  else {
10625
10725
  nodes.forEach((node) => {
10626
- this.nodes.push(node);
10726
+ this.insertNode(node);
10627
10727
  });
10628
10728
  }
10629
10729
  }
10630
10730
  /** Remove selected node */
10631
10731
  removeSelected() {
10732
+ const parentNodesPath = [];
10632
10733
  if (this.selectedNodes.length) {
10633
- const selectedPaths = this.selectedNodes.map((item) => item.path);
10734
+ const selectedPaths = this.selectedNodes.map((item) => {
10735
+ const parent = this.getParentNode(item);
10736
+ if (parent) {
10737
+ parentNodesPath.push(parent.path);
10738
+ }
10739
+ return item.path;
10740
+ });
10634
10741
  this.tree.remove(selectedPaths);
10742
+ parentNodesPath.forEach((path) => {
10743
+ const parent = this.getNode(path);
10744
+ if (parent && parent.children && parent.children.length === 0) {
10745
+ this.tree.updateNode(path, { isLeaf: true });
10746
+ }
10747
+ });
10635
10748
  }
10636
10749
  }
10637
10750
  /** Update selected node */
10638
10751
  updateNodeData(node, value) {
10752
+ if (node.children && node.children.length === 0) {
10753
+ this.tree.updateNode(node.path, { isLeaf: true });
10754
+ }
10639
10755
  this.tree.updateNode(node.path, value);
10640
10756
  }
10641
10757
  setTree(tree) {
@@ -10768,8 +10884,11 @@ class Tree extends ComponentRender {
10768
10884
  return this.searchPath(this.nodes, path);
10769
10885
  }
10770
10886
  getParentNode(node) {
10771
- var _a;
10772
- return this.tree.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10887
+ const hasParent = Array.isArray(node.path) && node.path.length > 1;
10888
+ if (hasParent) {
10889
+ return this.tree.getNode(node.path.slice(0, -1));
10890
+ }
10891
+ return undefined;
10773
10892
  }
10774
10893
  searchPath(nodes, path) {
10775
10894
  const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
@@ -11119,8 +11238,13 @@ class TreeGridEditable extends TreeGrid {
11119
11238
  });
11120
11239
  }
11121
11240
  } });
11241
+ this.updateOriginalRow(key, row);
11122
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 });
11123
11243
  }
11244
+ updateOriginalRow(key, row) {
11245
+ if (this.editedRows[key] !== undefined)
11246
+ this.editedRows[key].originalRow = row;
11247
+ }
11124
11248
  checkLookupData(column, row, componentProps) {
11125
11249
  if (row[column.name] && column.lookupData && componentProps.datasource) {
11126
11250
  componentProps.datasource.data = componentProps.datasource.data || [];
@@ -1801,16 +1801,17 @@
1801
1801
  set displayValue(value) {
1802
1802
  if (this.internalDisplayValue !== value) {
1803
1803
  this.internalValue = this.parser(value);
1804
+ this.value = this.internalValue; // forces value accessor to be called if necessary
1804
1805
  let { mask } = this;
1805
1806
  if (mask) {
1806
1807
  if (typeof mask === 'function') {
1807
1808
  mask = mask(this.internalValue);
1808
1809
  }
1809
- this.internalDisplayValue = core.Mask.convertAll(mask, value);
1810
+ this.internalDisplayValue = core.Mask.convertAll(mask, this.internalValue);
1810
1811
  this.internalValue = this.parser(this.internalDisplayValue);
1811
1812
  }
1812
1813
  else {
1813
- this.internalDisplayValue = value;
1814
+ this.internalDisplayValue = this.internalValue;
1814
1815
  }
1815
1816
  }
1816
1817
  }
@@ -2819,6 +2820,16 @@
2819
2820
  return this.create(modal);
2820
2821
  });
2821
2822
  }
2823
+ /**
2824
+ * Creates a new modal instance from JSON
2825
+ * @param modal modal structure
2826
+ */
2827
+ static createFromJsonPost(modalPath, params) {
2828
+ return __awaiter(this, void 0, void 0, function* () {
2829
+ const modal = yield core.Metadata.post(modalPath, params);
2830
+ return this.create(modal);
2831
+ });
2832
+ }
2822
2833
  /**
2823
2834
  * Deletes modal
2824
2835
  * @param modal modal instance
@@ -3109,7 +3120,7 @@
3109
3120
  ];
3110
3121
  this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
3111
3122
  this.moveMode = this.getInitValue('moveMode', props.moveMode, this.moveMode);
3112
- this.cards = props.cards || this.cards;
3123
+ this.cards = this.getInitValue('cards', props.cards, this.cards);
3113
3124
  this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
3114
3125
  this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
3115
3126
  this.height = this.getInitValue('height', props.height, this.height);
@@ -3137,13 +3148,7 @@
3137
3148
  addCard() {
3138
3149
  const addCardForm = core.Metadata.getInstance('addCardForm');
3139
3150
  if (addCardForm.validate()) {
3140
- const newCard = {
3141
- cardId: this.getCardId(),
3142
- path: addCardForm.value.inputPath,
3143
- local: addCardForm.value.inputLocal,
3144
- height: addCardForm.value.inputHeight,
3145
- width: addCardForm.value.inputWidth,
3146
- };
3151
+ 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);
3147
3152
  this.cards.push(newCard);
3148
3153
  this.modalCancelClick();
3149
3154
  }
@@ -3435,6 +3440,7 @@
3435
3440
  this.dateError = false;
3436
3441
  this.internalDisplayValue = newValue;
3437
3442
  this.internalValue = this.parser(newValue);
3443
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3438
3444
  }
3439
3445
  /**
3440
3446
  * Assign the updated mask to mask property
@@ -3474,6 +3480,7 @@
3474
3480
  }
3475
3481
  this.dateError = !!displayValue;
3476
3482
  }
3483
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3477
3484
  }
3478
3485
  isValidDate(value, format, strict = true) {
3479
3486
  return core.dayjs(value, format, strict).isValid();
@@ -3780,6 +3787,7 @@
3780
3787
  this.internalValue = this.parser(newValue);
3781
3788
  else
3782
3789
  this.internalValue = [];
3790
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3783
3791
  }
3784
3792
  /**
3785
3793
  * Assign the updated mask to mask property
@@ -3820,6 +3828,7 @@
3820
3828
  }
3821
3829
  this.dateError = !!displayValue;
3822
3830
  }
3831
+ this.value = this.internalValue; // forces value accessor to be called if necessary
3823
3832
  }
3824
3833
  isValidDateArray(format, values) {
3825
3834
  if (!values || values.length === 0)
@@ -4419,14 +4428,17 @@
4419
4428
  this.local = false;
4420
4429
  this.metadata = {};
4421
4430
  this.override = {};
4431
+ this.params = {};
4422
4432
  this.overrideNamedProps = {};
4433
+ this.path = '';
4423
4434
  this.cache = false;
4424
4435
  this.cacheDuration = 2 * 60 * 60 * 1000;
4425
4436
  this.height = 'auto';
4426
4437
  this.maxHeight = 'none';
4427
4438
  this.minHeight = 'none';
4439
+ this.type = 'get';
4428
4440
  this.headerName = 'sw-fetched-on';
4429
- this.path = props.path;
4441
+ this.path = this.getInitValue('path', props.path, this.path);
4430
4442
  this.local = props.local === true;
4431
4443
  this.override = props.override || this.override;
4432
4444
  this.overrideNamedProps = props.overrideNamedProps || this.overrideNamedProps;
@@ -4435,6 +4447,8 @@
4435
4447
  this.height = this.getInitValue('height', props.height, this.height);
4436
4448
  this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
4437
4449
  this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
4450
+ this.type = this.getInitValue('type', props.type, this.type);
4451
+ this.params = this.getInitValue('params', props.params, this.params);
4438
4452
  this.createAccessors();
4439
4453
  this.getMetadata();
4440
4454
  }
@@ -4449,8 +4463,8 @@
4449
4463
  this.metadata = this.overrideNamedPropsFunc(this.metadata);
4450
4464
  }
4451
4465
  }
4452
- catch (_a) {
4453
- this.notFoundError();
4466
+ catch (e) {
4467
+ this.notFoundError(e);
4454
4468
  }
4455
4469
  finally {
4456
4470
  this.loading = false;
@@ -4471,10 +4485,16 @@
4471
4485
  this.getMetadata();
4472
4486
  });
4473
4487
  }
4474
- notFoundError() { }
4488
+ notFoundError(e) {
4489
+ if (this.rejectLoad)
4490
+ this.rejectLoad(e);
4491
+ }
4475
4492
  requestPage() {
4476
4493
  return __awaiter(this, void 0, void 0, function* () {
4477
4494
  if (!this.cache) {
4495
+ if (this.type === 'post') {
4496
+ return core.Metadata.post(this.path, this.params);
4497
+ }
4478
4498
  return core.Metadata.get(this.path, this.local);
4479
4499
  }
4480
4500
  const url = core.Metadata.getMetadataUrl(this.path, this.local);
@@ -4494,6 +4514,8 @@
4494
4514
  * @param element
4495
4515
  */
4496
4516
  afterLoad(event, element) {
4517
+ if (this.resolveLoad)
4518
+ this.resolveLoad(this.metadata);
4497
4519
  this.callEvent('onAfterLoad', {
4498
4520
  event, element, component: this,
4499
4521
  });
@@ -4534,6 +4556,18 @@
4534
4556
  return caches.delete(Frame.cacheName);
4535
4557
  });
4536
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
+ }
4537
4571
  }
4538
4572
  Frame.cacheName = 'zd-frame-cache';
4539
4573
 
@@ -4547,8 +4581,8 @@
4547
4581
  this.notFoundRoute = this.getInitValue('notFoundRoute', props.notFoundRoute, this.notFoundRoute);
4548
4582
  this.createAccessors();
4549
4583
  }
4550
- notFoundError() {
4551
- super.notFoundError();
4584
+ notFoundError(e) {
4585
+ super.notFoundError(e);
4552
4586
  core.Router.replace(this.notFoundRoute);
4553
4587
  }
4554
4588
  /**
@@ -5625,6 +5659,7 @@
5625
5659
  });
5626
5660
  }
5627
5661
  } });
5662
+ this.updateOriginalRow(key, row);
5628
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 });
5629
5664
  }
5630
5665
  checkLookupData(column, row, componentProps) {
@@ -5672,6 +5707,10 @@
5672
5707
  this.editedRows = rows;
5673
5708
  }
5674
5709
  }
5710
+ updateOriginalRow(key, row) {
5711
+ if (this.editedRows[key] !== undefined)
5712
+ this.editedRows[key].originalRow = row;
5713
+ }
5675
5714
  /**
5676
5715
  * Checks if column is edited
5677
5716
  * @param column Column
@@ -9054,7 +9093,9 @@
9054
9093
  originalData.splice(index + 1, 0, ...data);
9055
9094
  this.originalDatasource.data = originalData;
9056
9095
  this.originalDatasource.currentRow = this.clearRow(row);
9096
+ return data;
9057
9097
  }
9098
+ return undefined;
9058
9099
  });
9059
9100
  }
9060
9101
  /**
@@ -9242,6 +9283,11 @@
9242
9283
  */
9243
9284
  this.lazyLoad = true;
9244
9285
  this.selectValue = null;
9286
+ /**
9287
+ * Uses delayed loading to load tree branches
9288
+ */
9289
+ this.fetchOnDemand = false;
9290
+ this.savedNodes = undefined;
9245
9291
  this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
9246
9292
  this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
9247
9293
  this.flattenSearchResults = this.getInitValue('flattenSearchResults', props.flattenSearchResults, this.flattenSearchResults);
@@ -9260,6 +9306,7 @@
9260
9306
  this.dataDisabled = this.getInitValue('dataDisabled', props.dataDisabled, this.dataDisabled);
9261
9307
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
9262
9308
  this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
9309
+ this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
9263
9310
  if (props.datasource && Object.keys(props.datasource).length) {
9264
9311
  this.lazyLoad = props.datasource.lazyLoad !== false;
9265
9312
  const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
@@ -9296,7 +9343,7 @@
9296
9343
  datasource: this.datasource,
9297
9344
  parentField: this.parentField,
9298
9345
  openLevelOnLoad: false,
9299
- fetchOnDemand: false,
9346
+ fetchOnDemand: this.fetchOnDemand,
9300
9347
  });
9301
9348
  if (!this.lazyLoad) {
9302
9349
  this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
@@ -9316,7 +9363,16 @@
9316
9363
  }
9317
9364
  }
9318
9365
  createNodeFromRow(row) {
9319
- const children = this.createChildrenNodes(row.tree__children);
9366
+ let children;
9367
+ if (this.fetchOnDemand && !this.datasource.search) {
9368
+ children = null;
9369
+ }
9370
+ else {
9371
+ children = this.createChildrenNodes(row.tree__children);
9372
+ if (!children.length) {
9373
+ children = undefined;
9374
+ }
9375
+ }
9320
9376
  const dataTextArr = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
9321
9377
  const dataTextNames = [];
9322
9378
  const masks = [];
@@ -9351,15 +9407,18 @@
9351
9407
  return {
9352
9408
  id: row[this.dataValue],
9353
9409
  label: dataText,
9354
- children: children.length ? children : undefined,
9410
+ children,
9355
9411
  row,
9356
9412
  };
9357
9413
  }
9358
9414
  createChildrenNodes(rows) {
9359
9415
  const newNodes = [];
9360
9416
  rows.forEach((row) => {
9361
- const newNode = this.createNodeFromRow(row);
9362
- newNodes.push(newNode);
9417
+ if (Object.keys(row).length > 0) {
9418
+ const newNode = this.createNodeFromRow(row);
9419
+ row.tree__node = newNode;
9420
+ newNodes.push(newNode);
9421
+ }
9363
9422
  });
9364
9423
  return newNodes;
9365
9424
  }
@@ -9385,6 +9444,26 @@
9385
9444
  * Triggered after the search query changes
9386
9445
  */
9387
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
+ }
9388
9467
  this.callEvent('onSearchChange', { element, component: this, searchQuery });
9389
9468
  }
9390
9469
  isDisable(node) {
@@ -9395,7 +9474,7 @@
9395
9474
  return this.disabledItems.indexOf(node.id) !== -1;
9396
9475
  }
9397
9476
  getDisabledNodes(nodes) {
9398
- return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : undefined })));
9477
+ return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : node.children })));
9399
9478
  }
9400
9479
  getNodes() {
9401
9480
  return this.getDisabledNodes(this.nodes);
@@ -9414,7 +9493,7 @@
9414
9493
  return !hasError;
9415
9494
  }
9416
9495
  /**
9417
- * Triggered when the data is inputted.
9496
+ * Triggered when the data is inputed.
9418
9497
  * @param value search value
9419
9498
  * @param event DOM event
9420
9499
  * @param element Element focused
@@ -9423,6 +9502,7 @@
9423
9502
  if (value !== this.lastInputValue) {
9424
9503
  this.lastInputValue = value;
9425
9504
  this.callInputEvent({ element, component: this });
9505
+ this.searchChange(value, element);
9426
9506
  }
9427
9507
  }
9428
9508
  get searchValue() {
@@ -9462,6 +9542,22 @@
9462
9542
  }
9463
9543
  this.selectValue = val;
9464
9544
  }
9545
+ loadChildren(parentNode) {
9546
+ return __awaiter(this, void 0, void 0, function* () {
9547
+ return this.treeDataStructure.toggleExpand(parentNode.row).then((data) => {
9548
+ const node = parentNode.row.tree__node;
9549
+ if (node) {
9550
+ if (!data || data.length === 0) {
9551
+ node.children = undefined;
9552
+ }
9553
+ else {
9554
+ const nodes = this.createChildrenNodes(data);
9555
+ node.children = nodes;
9556
+ }
9557
+ }
9558
+ });
9559
+ });
9560
+ }
9465
9561
  }
9466
9562
 
9467
9563
  /**
@@ -9881,9 +9977,11 @@
9881
9977
  super(props);
9882
9978
  this.disabled = false;
9883
9979
  this.tabTitle = '';
9980
+ this.lazyLoad = true;
9884
9981
  this.tabTitle = this.getInitValue('tabTitle', props.tabTitle, this.tabTitle);
9885
9982
  this.disabled = this.getInitValue('disabled', props.disabled, this.disabled);
9886
9983
  this.flex = this.getInitValue('flex', props.flex, this.flex);
9984
+ this.lazyLoad = this.getInitValue('lazyLoad', props.lazyLoad, this.lazyLoad);
9887
9985
  this.createAccessors();
9888
9986
  }
9889
9987
  }
@@ -10534,6 +10632,10 @@
10534
10632
  children: [],
10535
10633
  };
10536
10634
  newNode = merge__default["default"](newNode, node, override);
10635
+ if (typeof node.isLeaf === 'undefined') {
10636
+ const hasChildren = newNode.children.length > 0;
10637
+ newNode.isLeaf = !hasChildren;
10638
+ }
10537
10639
  newNode.children = this.initNodes(node.children || [], override);
10538
10640
  return newNode;
10539
10641
  });
@@ -10608,6 +10710,7 @@
10608
10710
  insertNode(newNode) {
10609
10711
  const initNode = this.initNodes([newNode])[0];
10610
10712
  if (this.selectedNodes.length) {
10713
+ this.updateNodeData(this.selectedNodes[0], { isLeaf: false });
10611
10714
  const cursorPosition = {
10612
10715
  node: this.selectedNodes[0],
10613
10716
  placement: 'inside',
@@ -10618,31 +10721,44 @@
10618
10721
  this.nodes.push(initNode);
10619
10722
  }
10620
10723
  }
10724
+ /** Import multiples nodes by the current cursor position */
10621
10725
  importNodes(nodes) {
10622
10726
  if (this.selectedNodes.length) {
10623
- const cursorPosition = {
10624
- node: this.selectedNodes[0],
10625
- placement: 'inside',
10626
- };
10627
10727
  nodes.reverse().forEach((node) => {
10628
- this.tree.insert(cursorPosition, node);
10728
+ this.insertNode(node);
10629
10729
  });
10630
10730
  }
10631
10731
  else {
10632
10732
  nodes.forEach((node) => {
10633
- this.nodes.push(node);
10733
+ this.insertNode(node);
10634
10734
  });
10635
10735
  }
10636
10736
  }
10637
10737
  /** Remove selected node */
10638
10738
  removeSelected() {
10739
+ const parentNodesPath = [];
10639
10740
  if (this.selectedNodes.length) {
10640
- const selectedPaths = this.selectedNodes.map((item) => item.path);
10741
+ const selectedPaths = this.selectedNodes.map((item) => {
10742
+ const parent = this.getParentNode(item);
10743
+ if (parent) {
10744
+ parentNodesPath.push(parent.path);
10745
+ }
10746
+ return item.path;
10747
+ });
10641
10748
  this.tree.remove(selectedPaths);
10749
+ parentNodesPath.forEach((path) => {
10750
+ const parent = this.getNode(path);
10751
+ if (parent && parent.children && parent.children.length === 0) {
10752
+ this.tree.updateNode(path, { isLeaf: true });
10753
+ }
10754
+ });
10642
10755
  }
10643
10756
  }
10644
10757
  /** Update selected node */
10645
10758
  updateNodeData(node, value) {
10759
+ if (node.children && node.children.length === 0) {
10760
+ this.tree.updateNode(node.path, { isLeaf: true });
10761
+ }
10646
10762
  this.tree.updateNode(node.path, value);
10647
10763
  }
10648
10764
  setTree(tree) {
@@ -10775,8 +10891,11 @@
10775
10891
  return this.searchPath(this.nodes, path);
10776
10892
  }
10777
10893
  getParentNode(node) {
10778
- var _a;
10779
- return this.tree.getNode(((_a = node.path) === null || _a === void 0 ? void 0 : _a.slice(0, -1)) || []);
10894
+ const hasParent = Array.isArray(node.path) && node.path.length > 1;
10895
+ if (hasParent) {
10896
+ return this.tree.getNode(node.path.slice(0, -1));
10897
+ }
10898
+ return undefined;
10780
10899
  }
10781
10900
  searchPath(nodes, path) {
10782
10901
  const currentNode = (path[0] > -1 && path[0] < nodes.length) ? nodes[path[0]] : undefined;
@@ -11126,8 +11245,13 @@
11126
11245
  });
11127
11246
  }
11128
11247
  } });
11248
+ this.updateOriginalRow(key, row);
11129
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 });
11130
11250
  }
11251
+ updateOriginalRow(key, row) {
11252
+ if (this.editedRows[key] !== undefined)
11253
+ this.editedRows[key].originalRow = row;
11254
+ }
11131
11255
  checkLookupData(column, row, componentProps) {
11132
11256
  if (row[column.name] && column.lookupData && componentProps.datasource) {
11133
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.48.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": "8ac65de099ea963d8d4142294dfed80025f5755d"
40
+ "gitHead": "be07d7f99d3351043e08a98b52a5736ab686dd30"
41
41
  }
@@ -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 { ICardEvents } from '../zd-card/interfaces';
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
  }
@@ -8,6 +8,7 @@ export declare class Frame extends ComponentRender implements IFrame {
8
8
  local: boolean;
9
9
  metadata: Object;
10
10
  override: Object;
11
+ params: any;
11
12
  overrideNamedProps: any;
12
13
  path: string;
13
14
  cache: boolean;
@@ -16,8 +17,11 @@ export declare class Frame extends ComponentRender implements IFrame {
16
17
  height: number | string;
17
18
  maxHeight: number | string;
18
19
  minHeight: number | string;
20
+ type: string;
19
21
  private readonly headerName;
20
22
  private static readonly cacheName;
23
+ protected resolveLoad?: (value: Object) => void;
24
+ protected rejectLoad?: (reason?: any) => void;
21
25
  /**
22
26
  * Creates a new Frame.
23
27
  * @param props Frame properties
@@ -26,7 +30,7 @@ export declare class Frame extends ComponentRender implements IFrame {
26
30
  private getMetadata;
27
31
  overrideNamedPropsFunc(metadata: object): any;
28
32
  reload(): Promise<void>;
29
- protected notFoundError(): void;
33
+ protected notFoundError(e: unknown): void;
30
34
  private requestPage;
31
35
  /**
32
36
  * Triggered when frame is load.
@@ -50,4 +54,5 @@ export declare class Frame extends ComponentRender implements IFrame {
50
54
  * Deletes all frame cached requests
51
55
  */
52
56
  static deleteCache(): Promise<boolean>;
57
+ waitLoading(): Promise<Object>;
53
58
  }
@@ -6,13 +6,15 @@ export interface IFrameEvents<T = IFrameEvent> extends IComponentEvents<T> {
6
6
  onAfterLoad?: IEvent<T> | string;
7
7
  }
8
8
  export interface IFrame extends IComponentRender {
9
- path: string;
9
+ path?: string;
10
10
  local?: boolean;
11
11
  override?: Object;
12
+ params?: any;
12
13
  overrideNamedProps?: any;
13
14
  cache?: boolean;
14
15
  cacheDuration?: number;
15
16
  height?: number | string;
16
17
  maxHeight?: number | string;
17
18
  minHeight?: number | string;
19
+ type?: string;
18
20
  }
@@ -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
@@ -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: String, element?: any): void;
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 inputted.
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
  }
@@ -14,6 +14,7 @@ export interface ITab extends IComponent {
14
14
  tabTitle: string;
15
15
  disabled?: boolean;
16
16
  flex?: boolean;
17
+ lazyLoad?: boolean;
17
18
  }
18
19
  export interface ITabs extends IComponentRender {
19
20
  activeTab?: number;
@@ -10,6 +10,7 @@ export declare class Tab extends Component implements ITab {
10
10
  * Defines if is flex mode.
11
11
  */
12
12
  flex?: boolean;
13
+ lazyLoad: boolean;
13
14
  /**
14
15
  * Create a new Tab.
15
16
  * @param props Tab properties
@@ -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
- protected initNodes(nodes: ITreeNodeModel<IDictionary>[], override?: IDictionary): ITreeNodeModel<IDictionary>[];
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;
@@ -90,6 +90,7 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
90
90
  events: any;
91
91
  autofill: boolean;
92
92
  };
93
+ private updateOriginalRow;
93
94
  private checkLookupData;
94
95
  private checkCompValidity;
95
96
  /**
@@ -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<void>;
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