@zeedhi/common 1.78.2 → 1.79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- import { AccessorManager, Event, KeyMap, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, MethodNotAssignedError, Loader, Config, dayjs, DateHelper, Utils, Router, InstanceNotFoundError, Cookie, Http, URL as URL$1, VersionService } from '@zeedhi/core';
1
+ import { AccessorManager, Event, KeyMap, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, MethodNotAssignedError, Loader, Config, dayjs, Utils, DateHelper, Router, InstanceNotFoundError, Cookie, Http, URL as URL$1, VersionService } from '@zeedhi/core';
2
2
  import merge from 'lodash.merge';
3
+ import cloneDeep from 'lodash.clonedeep';
3
4
  import debounce from 'lodash.debounce';
4
5
  import isUndefined from 'lodash.isundefined';
5
6
  import set from 'lodash.set';
@@ -526,6 +527,7 @@ class ApexChart extends ComponentRender {
526
527
  },
527
528
  },
528
529
  };
530
+ this.drillHistory = [];
529
531
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
530
532
  this.options = merge(this.defaultOptions, this.getInitValue('options', this.translateOptions(props.options), this.options));
531
533
  this.series = this.getInitValue('series', this.translateSeries(props.series), this.series);
@@ -625,7 +627,11 @@ class ApexChart extends ComponentRender {
625
627
  */
626
628
  updateChart(options) {
627
629
  merge(this.options, options);
630
+ if (options.labels) {
631
+ this.options.labels = options.labels;
632
+ }
628
633
  if (options.series) {
634
+ this.options.series = options.series;
629
635
  this.series = this.options.series;
630
636
  }
631
637
  if (this.viewUpdate) {
@@ -879,6 +885,20 @@ class ApexChart extends ComponentRender {
879
885
  }
880
886
  return newOptions;
881
887
  }
888
+ drillDown(options) {
889
+ this.drillHistory.push(cloneDeep(this.options));
890
+ return new Promise((resolve) => {
891
+ setTimeout(() => {
892
+ resolve(this.updateChart(options));
893
+ }, 200);
894
+ });
895
+ }
896
+ drillUp() {
897
+ if (this.drillHistory.length === 0)
898
+ return Promise.resolve();
899
+ const options = this.drillHistory.pop();
900
+ return this.updateChart(options);
901
+ }
882
902
  }
883
903
 
884
904
  /**
@@ -3874,7 +3894,9 @@ class Date$1 extends TextInput {
3874
3894
  this.removeDateMask();
3875
3895
  this.setDateValue(this.formatter(this.value));
3876
3896
  super.blur(event, element);
3877
- this.showDatePicker = false;
3897
+ if (!Utils.isMobile()) {
3898
+ this.showDatePicker = false;
3899
+ }
3878
3900
  }
3879
3901
  focus(event, element) {
3880
3902
  this.addDateMask();
@@ -4257,6 +4279,8 @@ class DateRange extends TextInput {
4257
4279
  this.removeDateMask();
4258
4280
  this.setDateValue(this.formatter(this.value));
4259
4281
  super.blur(event, element);
4282
+ }
4283
+ if (!Utils.isMobile()) {
4260
4284
  this.showDatePicker = false;
4261
4285
  }
4262
4286
  }
@@ -4890,6 +4914,7 @@ class Frame extends ComponentRender {
4890
4914
  overrideNamedPropsFunc(metadata) {
4891
4915
  let strMetadata = JSON.stringify(metadata);
4892
4916
  Object.keys(this.overrideNamedProps).forEach((key) => {
4917
+ strMetadata = strMetadata.replace(RegExp(`"<<${key}>>"`, 'g'), JSON.stringify(this.overrideNamedProps[key]));
4893
4918
  strMetadata = strMetadata.replace(RegExp(`<<${key}>>`, 'g'), this.overrideNamedProps[key]);
4894
4919
  });
4895
4920
  return JSON.parse(strMetadata);
@@ -7114,6 +7139,10 @@ class Select extends TextInput {
7114
7139
  * Defines if data handling should be manual or automatic
7115
7140
  */
7116
7141
  this.manualMode = false;
7142
+ /**
7143
+ * Specifies which DOM element that this component should detach to.
7144
+ */
7145
+ this.attach = false;
7117
7146
  /**
7118
7147
  * Defines if data handling should be manual or automatic
7119
7148
  */
@@ -7158,6 +7187,7 @@ class Select extends TextInput {
7158
7187
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
7159
7188
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
7160
7189
  this.manualMode = this.getInitValue('manualMode', props.manualMode, this.manualMode);
7190
+ this.attach = this.getInitValue('attach', props.attach, this.attach);
7161
7191
  this.searchParam = this.getInitValue('searchParam', props.searchParam, this.searchParam);
7162
7192
  if (((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.type) === 'simple') {
7163
7193
  this.dataValue = 'value';
@@ -8313,8 +8343,32 @@ class MasterDetail extends ComponentRender {
8313
8343
  * Defines whether the relationship will be created on mounted
8314
8344
  */
8315
8345
  this.lazyRelate = false;
8346
+ /**
8347
+ * Defines the component height. Possible values for this property can be
8348
+ * <samp>'auto', '100%', '400px' or 400</samp>
8349
+ */
8350
+ this.height = 'auto';
8351
+ /**
8352
+ * Defines the component min height. Possible values for this property can be
8353
+ * <samp>'auto', '100%', '400px' or 400</samp>
8354
+ */
8355
+ this.minHeight = 'auto';
8356
+ /**
8357
+ * Defines the component max height. Possible values for this property can be
8358
+ * <samp>'auto', '100%', '400px' or 400</samp>
8359
+ */
8360
+ this.maxHeight = 'none';
8361
+ /**
8362
+ * Set component height to fill all space available
8363
+ */
8364
+ this.fillHeight = false;
8316
8365
  this.config = this.getInitValue('config', props.config, this.config);
8317
8366
  this.lazyRelate = this.getInitValue('lazyRelate', props.lazyRelate, this.lazyRelate);
8367
+ this.height = this.getInitValue('height', props.height, this.height);
8368
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
8369
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
8370
+ this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
8371
+ this.createAccessors();
8318
8372
  }
8319
8373
  createRelationship(master, details = []) {
8320
8374
  if (master.datasource && details.length) {
@@ -9776,11 +9830,13 @@ class TreeDataStructure {
9776
9830
  * Stores tree structure
9777
9831
  */
9778
9832
  this.treeStructure = {};
9833
+ this.fieldHasChild = '';
9779
9834
  this.searchValue = '';
9780
9835
  this.originalDatasource = tree.datasource;
9781
9836
  this.parentField = tree.parentField;
9782
9837
  this.fetchOnDemand = tree.fetchOnDemand;
9783
9838
  this.openLevelOnLoad = tree.openLevelOnLoad;
9839
+ this.fieldHasChild = tree.fieldHasChild;
9784
9840
  this.tree = tree;
9785
9841
  this.init();
9786
9842
  }
@@ -10142,6 +10198,33 @@ class TreeDataStructure {
10142
10198
  });
10143
10199
  return result;
10144
10200
  }
10201
+ /**
10202
+ * Checks if a row has async children that are yet to be loaded
10203
+ * @param row
10204
+ * @returns `false` if the row has no children to be loaded, `true` if it does or if fieldHasChild is not defined
10205
+ */
10206
+ hasChildOnDemand(row) {
10207
+ if (!this.fieldHasChild)
10208
+ return true;
10209
+ const rowHasChild = row[this.fieldHasChild];
10210
+ let isVisibleChevron = true;
10211
+ switch (rowHasChild) {
10212
+ case '0':
10213
+ case false:
10214
+ case 0:
10215
+ isVisibleChevron = false;
10216
+ break;
10217
+ case '1':
10218
+ case true:
10219
+ case 1:
10220
+ isVisibleChevron = true;
10221
+ break;
10222
+ default:
10223
+ isVisibleChevron = true;
10224
+ break;
10225
+ }
10226
+ return isVisibleChevron;
10227
+ }
10145
10228
  }
10146
10229
 
10147
10230
  /**
@@ -10234,6 +10317,10 @@ class SelectTree extends TextInput {
10234
10317
  * Uses delayed loading to load tree branches
10235
10318
  */
10236
10319
  this.fetchOnDemand = false;
10320
+ /**
10321
+ * Defines if the node tree has child
10322
+ */
10323
+ this.fieldHasChild = '';
10237
10324
  this.savedNodes = undefined;
10238
10325
  this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
10239
10326
  this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
@@ -10254,6 +10341,8 @@ class SelectTree extends TextInput {
10254
10341
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
10255
10342
  this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
10256
10343
  this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
10344
+ this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
10345
+ this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
10257
10346
  if (props.datasource && Object.keys(props.datasource).length) {
10258
10347
  this.lazyLoad = props.datasource.lazyLoad !== false;
10259
10348
  const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
@@ -10291,6 +10380,7 @@ class SelectTree extends TextInput {
10291
10380
  parentField: this.parentField,
10292
10381
  openLevelOnLoad: false,
10293
10382
  fetchOnDemand: this.fetchOnDemand,
10383
+ fieldHasChild: this.fieldHasChild,
10294
10384
  });
10295
10385
  if (!this.lazyLoad) {
10296
10386
  this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
@@ -10421,7 +10511,14 @@ class SelectTree extends TextInput {
10421
10511
  return this.disabledItems.indexOf(node.id) !== -1;
10422
10512
  }
10423
10513
  getDisabledNodes(nodes) {
10424
- return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : node.children })));
10514
+ return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: this.getNodeChildren(node) })));
10515
+ }
10516
+ getNodeChildren(node) {
10517
+ if (node.children)
10518
+ return this.getDisabledNodes(node.children);
10519
+ if (!this.fieldHasChild || !this.treeDataStructure)
10520
+ return node.children;
10521
+ return node.row && this.treeDataStructure.hasChildOnDemand(node.row) ? null : undefined;
10425
10522
  }
10426
10523
  getNodes() {
10427
10524
  return this.getDisabledNodes(this.nodes);
@@ -10439,6 +10536,9 @@ class SelectTree extends TextInput {
10439
10536
  });
10440
10537
  return !hasError;
10441
10538
  }
10539
+ resetValidation() {
10540
+ this.validationError = '';
10541
+ }
10442
10542
  /**
10443
10543
  * Triggered when the data is inputed.
10444
10544
  * @param value search value
@@ -11552,7 +11652,6 @@ class Time extends TextInput {
11552
11652
  this.removeTimeMask();
11553
11653
  this.setTimeValue(this.formatter(this.value));
11554
11654
  super.blur(event, element);
11555
- this.showTimePicker = false;
11556
11655
  }
11557
11656
  focus(event, element) {
11558
11657
  this.addTimeMask();
@@ -12901,6 +13000,8 @@ class Icons {
12901
13000
  }
12902
13001
  Icons.mdiIcons = {
12903
13002
  alertOctagon: 'mdi-alert-octagon',
13003
+ arrowLeft: 'mdi-arrow-left',
13004
+ arrowRight: 'mdi-arrow-right',
12904
13005
  cancel: 'mdi-close-circle',
12905
13006
  calendar: 'mdi-calendar',
12906
13007
  checkboxIndeterminate: 'mdi-minus-box',
@@ -12958,6 +13059,8 @@ Icons.mdiIcons = {
12958
13059
  };
12959
13060
  Icons.faIcons = {
12960
13061
  alertOctagon: 'fa fa-exclamation-circle',
13062
+ arrowLeft: 'fa fa-arrow-left',
13063
+ arrowRight: 'fa fa-arrow-right',
12961
13064
  cancel: 'fa fa-times-circle',
12962
13065
  calendar: 'fa fa-calendar-o',
12963
13066
  checkboxIndeterminate: 'fa fa-minus-square',
@@ -1,12 +1,13 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.merge'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.set'), require('lodash.get')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.merge', 'lodash.debounce', 'lodash.isundefined', 'lodash.set', 'lodash.get'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.merge, global.debounce, global.isUndefined, global.set, global.get));
5
- })(this, (function (exports, core, merge, debounce, isUndefined, set, get) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@zeedhi/core'), require('lodash.merge'), require('lodash.clonedeep'), require('lodash.debounce'), require('lodash.isundefined'), require('lodash.set'), require('lodash.get')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@zeedhi/core', 'lodash.merge', 'lodash.clonedeep', 'lodash.debounce', 'lodash.isundefined', 'lodash.set', 'lodash.get'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@zeedhi/common"] = {}, global.core, global.merge, global.cloneDeep, global.debounce, global.isUndefined, global.set, global.get));
5
+ })(this, (function (exports, core, merge, cloneDeep, debounce, isUndefined, set, get) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
10
+ var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
10
11
  var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
11
12
  var isUndefined__default = /*#__PURE__*/_interopDefaultLegacy(isUndefined);
12
13
  var set__default = /*#__PURE__*/_interopDefaultLegacy(set);
@@ -533,6 +534,7 @@
533
534
  },
534
535
  },
535
536
  };
537
+ this.drillHistory = [];
536
538
  this.chartType = this.getInitValue('chartType', props.chartType, this.chartType);
537
539
  this.options = merge__default["default"](this.defaultOptions, this.getInitValue('options', this.translateOptions(props.options), this.options));
538
540
  this.series = this.getInitValue('series', this.translateSeries(props.series), this.series);
@@ -632,7 +634,11 @@
632
634
  */
633
635
  updateChart(options) {
634
636
  merge__default["default"](this.options, options);
637
+ if (options.labels) {
638
+ this.options.labels = options.labels;
639
+ }
635
640
  if (options.series) {
641
+ this.options.series = options.series;
636
642
  this.series = this.options.series;
637
643
  }
638
644
  if (this.viewUpdate) {
@@ -886,6 +892,20 @@
886
892
  }
887
893
  return newOptions;
888
894
  }
895
+ drillDown(options) {
896
+ this.drillHistory.push(cloneDeep__default["default"](this.options));
897
+ return new Promise((resolve) => {
898
+ setTimeout(() => {
899
+ resolve(this.updateChart(options));
900
+ }, 200);
901
+ });
902
+ }
903
+ drillUp() {
904
+ if (this.drillHistory.length === 0)
905
+ return Promise.resolve();
906
+ const options = this.drillHistory.pop();
907
+ return this.updateChart(options);
908
+ }
889
909
  }
890
910
 
891
911
  /**
@@ -3881,7 +3901,9 @@
3881
3901
  this.removeDateMask();
3882
3902
  this.setDateValue(this.formatter(this.value));
3883
3903
  super.blur(event, element);
3884
- this.showDatePicker = false;
3904
+ if (!core.Utils.isMobile()) {
3905
+ this.showDatePicker = false;
3906
+ }
3885
3907
  }
3886
3908
  focus(event, element) {
3887
3909
  this.addDateMask();
@@ -4264,6 +4286,8 @@
4264
4286
  this.removeDateMask();
4265
4287
  this.setDateValue(this.formatter(this.value));
4266
4288
  super.blur(event, element);
4289
+ }
4290
+ if (!core.Utils.isMobile()) {
4267
4291
  this.showDatePicker = false;
4268
4292
  }
4269
4293
  }
@@ -4897,6 +4921,7 @@
4897
4921
  overrideNamedPropsFunc(metadata) {
4898
4922
  let strMetadata = JSON.stringify(metadata);
4899
4923
  Object.keys(this.overrideNamedProps).forEach((key) => {
4924
+ strMetadata = strMetadata.replace(RegExp(`"<<${key}>>"`, 'g'), JSON.stringify(this.overrideNamedProps[key]));
4900
4925
  strMetadata = strMetadata.replace(RegExp(`<<${key}>>`, 'g'), this.overrideNamedProps[key]);
4901
4926
  });
4902
4927
  return JSON.parse(strMetadata);
@@ -7121,6 +7146,10 @@
7121
7146
  * Defines if data handling should be manual or automatic
7122
7147
  */
7123
7148
  this.manualMode = false;
7149
+ /**
7150
+ * Specifies which DOM element that this component should detach to.
7151
+ */
7152
+ this.attach = false;
7124
7153
  /**
7125
7154
  * Defines if data handling should be manual or automatic
7126
7155
  */
@@ -7165,6 +7194,7 @@
7165
7194
  this.autocomplete = this.getInitValue('autocomplete', props.autocomplete, this.autocomplete);
7166
7195
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
7167
7196
  this.manualMode = this.getInitValue('manualMode', props.manualMode, this.manualMode);
7197
+ this.attach = this.getInitValue('attach', props.attach, this.attach);
7168
7198
  this.searchParam = this.getInitValue('searchParam', props.searchParam, this.searchParam);
7169
7199
  if (((_a = props.datasource) === null || _a === void 0 ? void 0 : _a.type) === 'simple') {
7170
7200
  this.dataValue = 'value';
@@ -8320,8 +8350,32 @@
8320
8350
  * Defines whether the relationship will be created on mounted
8321
8351
  */
8322
8352
  this.lazyRelate = false;
8353
+ /**
8354
+ * Defines the component height. Possible values for this property can be
8355
+ * <samp>'auto', '100%', '400px' or 400</samp>
8356
+ */
8357
+ this.height = 'auto';
8358
+ /**
8359
+ * Defines the component min height. Possible values for this property can be
8360
+ * <samp>'auto', '100%', '400px' or 400</samp>
8361
+ */
8362
+ this.minHeight = 'auto';
8363
+ /**
8364
+ * Defines the component max height. Possible values for this property can be
8365
+ * <samp>'auto', '100%', '400px' or 400</samp>
8366
+ */
8367
+ this.maxHeight = 'none';
8368
+ /**
8369
+ * Set component height to fill all space available
8370
+ */
8371
+ this.fillHeight = false;
8323
8372
  this.config = this.getInitValue('config', props.config, this.config);
8324
8373
  this.lazyRelate = this.getInitValue('lazyRelate', props.lazyRelate, this.lazyRelate);
8374
+ this.height = this.getInitValue('height', props.height, this.height);
8375
+ this.minHeight = this.getInitValue('minHeight', props.minHeight, this.minHeight);
8376
+ this.maxHeight = this.getInitValue('maxHeight', props.maxHeight, this.maxHeight);
8377
+ this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
8378
+ this.createAccessors();
8325
8379
  }
8326
8380
  createRelationship(master, details = []) {
8327
8381
  if (master.datasource && details.length) {
@@ -9783,11 +9837,13 @@
9783
9837
  * Stores tree structure
9784
9838
  */
9785
9839
  this.treeStructure = {};
9840
+ this.fieldHasChild = '';
9786
9841
  this.searchValue = '';
9787
9842
  this.originalDatasource = tree.datasource;
9788
9843
  this.parentField = tree.parentField;
9789
9844
  this.fetchOnDemand = tree.fetchOnDemand;
9790
9845
  this.openLevelOnLoad = tree.openLevelOnLoad;
9846
+ this.fieldHasChild = tree.fieldHasChild;
9791
9847
  this.tree = tree;
9792
9848
  this.init();
9793
9849
  }
@@ -10149,6 +10205,33 @@
10149
10205
  });
10150
10206
  return result;
10151
10207
  }
10208
+ /**
10209
+ * Checks if a row has async children that are yet to be loaded
10210
+ * @param row
10211
+ * @returns `false` if the row has no children to be loaded, `true` if it does or if fieldHasChild is not defined
10212
+ */
10213
+ hasChildOnDemand(row) {
10214
+ if (!this.fieldHasChild)
10215
+ return true;
10216
+ const rowHasChild = row[this.fieldHasChild];
10217
+ let isVisibleChevron = true;
10218
+ switch (rowHasChild) {
10219
+ case '0':
10220
+ case false:
10221
+ case 0:
10222
+ isVisibleChevron = false;
10223
+ break;
10224
+ case '1':
10225
+ case true:
10226
+ case 1:
10227
+ isVisibleChevron = true;
10228
+ break;
10229
+ default:
10230
+ isVisibleChevron = true;
10231
+ break;
10232
+ }
10233
+ return isVisibleChevron;
10234
+ }
10152
10235
  }
10153
10236
 
10154
10237
  /**
@@ -10241,6 +10324,10 @@
10241
10324
  * Uses delayed loading to load tree branches
10242
10325
  */
10243
10326
  this.fetchOnDemand = false;
10327
+ /**
10328
+ * Defines if the node tree has child
10329
+ */
10330
+ this.fieldHasChild = '';
10244
10331
  this.savedNodes = undefined;
10245
10332
  this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
10246
10333
  this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
@@ -10261,6 +10348,8 @@
10261
10348
  this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
10262
10349
  this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
10263
10350
  this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
10351
+ this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
10352
+ this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
10264
10353
  if (props.datasource && Object.keys(props.datasource).length) {
10265
10354
  this.lazyLoad = props.datasource.lazyLoad !== false;
10266
10355
  const searchFields = Array.isArray(this.dataText) ? this.dataText : [this.dataText];
@@ -10298,6 +10387,7 @@
10298
10387
  parentField: this.parentField,
10299
10388
  openLevelOnLoad: false,
10300
10389
  fetchOnDemand: this.fetchOnDemand,
10390
+ fieldHasChild: this.fieldHasChild,
10301
10391
  });
10302
10392
  if (!this.lazyLoad) {
10303
10393
  this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
@@ -10428,7 +10518,14 @@
10428
10518
  return this.disabledItems.indexOf(node.id) !== -1;
10429
10519
  }
10430
10520
  getDisabledNodes(nodes) {
10431
- return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: node.children ? this.getDisabledNodes(node.children) : node.children })));
10521
+ return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(node), children: this.getNodeChildren(node) })));
10522
+ }
10523
+ getNodeChildren(node) {
10524
+ if (node.children)
10525
+ return this.getDisabledNodes(node.children);
10526
+ if (!this.fieldHasChild || !this.treeDataStructure)
10527
+ return node.children;
10528
+ return node.row && this.treeDataStructure.hasChildOnDemand(node.row) ? null : undefined;
10432
10529
  }
10433
10530
  getNodes() {
10434
10531
  return this.getDisabledNodes(this.nodes);
@@ -10446,6 +10543,9 @@
10446
10543
  });
10447
10544
  return !hasError;
10448
10545
  }
10546
+ resetValidation() {
10547
+ this.validationError = '';
10548
+ }
10449
10549
  /**
10450
10550
  * Triggered when the data is inputed.
10451
10551
  * @param value search value
@@ -11559,7 +11659,6 @@
11559
11659
  this.removeTimeMask();
11560
11660
  this.setTimeValue(this.formatter(this.value));
11561
11661
  super.blur(event, element);
11562
- this.showTimePicker = false;
11563
11662
  }
11564
11663
  focus(event, element) {
11565
11664
  this.addTimeMask();
@@ -12908,6 +13007,8 @@
12908
13007
  }
12909
13008
  Icons.mdiIcons = {
12910
13009
  alertOctagon: 'mdi-alert-octagon',
13010
+ arrowLeft: 'mdi-arrow-left',
13011
+ arrowRight: 'mdi-arrow-right',
12911
13012
  cancel: 'mdi-close-circle',
12912
13013
  calendar: 'mdi-calendar',
12913
13014
  checkboxIndeterminate: 'mdi-minus-box',
@@ -12965,6 +13066,8 @@
12965
13066
  };
12966
13067
  Icons.faIcons = {
12967
13068
  alertOctagon: 'fa fa-exclamation-circle',
13069
+ arrowLeft: 'fa fa-arrow-left',
13070
+ arrowRight: 'fa fa-arrow-right',
12968
13071
  cancel: 'fa fa-times-circle',
12969
13072
  calendar: 'fa fa-calendar-o',
12970
13073
  checkboxIndeterminate: 'fa fa-minus-square',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.78.2",
3
+ "version": "1.79.1",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -19,7 +19,9 @@
19
19
  "watch": "npm run build -- -w"
20
20
  },
21
21
  "dependencies": {
22
+ "@types/lodash.clonedeep": "^4.5.7",
22
23
  "@zeedhi/autonumeric": "*",
24
+ "lodash.clonedeep": "^4.5.0",
23
25
  "lodash.debounce": "4.0.*",
24
26
  "lodash.get": "4.4.*",
25
27
  "lodash.isundefined": "3.0.*",
@@ -39,5 +41,5 @@
39
41
  "lodash.times": "4.3.*",
40
42
  "mockdate": "3.0.*"
41
43
  },
42
- "gitHead": "f90d2ee43230496d7eac7740266dabc973c9438a"
44
+ "gitHead": "b4bf265016337a00b453394e11176f0ce770b63f"
43
45
  }
@@ -251,4 +251,7 @@ export declare class ApexChart extends ComponentRender implements IApexChart {
251
251
  */
252
252
  brushScrolledEvent(chartContext?: any, config?: any): void;
253
253
  updateToolbarIcons(): any;
254
+ drillHistory: any[];
255
+ drillDown(options: any): Promise<unknown>;
256
+ drillUp(): Promise<any>;
254
257
  }
@@ -1,5 +1,5 @@
1
- import { IFrame, IFrameEvents } from './interfaces';
2
1
  import { ComponentRender } from '../zd-component/component-render';
2
+ import { IFrame, IFrameEvents } from './interfaces';
3
3
  /**
4
4
  * Base class for Frame component.
5
5
  */
@@ -3,4 +3,8 @@ import { IComponentRender } from '../zd-component/interfaces';
3
3
  export interface IMasterDetail extends IComponentRender {
4
4
  config?: IDictionary<any>;
5
5
  lazyRelate?: boolean;
6
+ height?: number | string;
7
+ maxHeight?: number | string;
8
+ minHeight?: number | string;
9
+ fillHeight?: boolean;
6
10
  }
@@ -13,6 +13,25 @@ export declare class MasterDetail extends ComponentRender implements IMasterDeta
13
13
  * Defines whether the relationship will be created on mounted
14
14
  */
15
15
  lazyRelate: boolean;
16
+ /**
17
+ * Defines the component height. Possible values for this property can be
18
+ * <samp>'auto', '100%', '400px' or 400</samp>
19
+ */
20
+ height: string | number;
21
+ /**
22
+ * Defines the component min height. Possible values for this property can be
23
+ * <samp>'auto', '100%', '400px' or 400</samp>
24
+ */
25
+ minHeight: string | number;
26
+ /**
27
+ * Defines the component max height. Possible values for this property can be
28
+ * <samp>'auto', '100%', '400px' or 400</samp>
29
+ */
30
+ maxHeight: string | number;
31
+ /**
32
+ * Set component height to fill all space available
33
+ */
34
+ fillHeight: boolean;
16
35
  /**
17
36
  * Creates a new Master Detail.
18
37
  * @param props Master detail properties
@@ -16,5 +16,6 @@ export interface ISelect extends ITextInput {
16
16
  itemAfterSlot?: IComponentRender[];
17
17
  disabledItems?: any[];
18
18
  manualMode?: boolean;
19
+ attach?: boolean;
19
20
  searchParam?: string;
20
21
  }
@@ -66,6 +66,10 @@ export declare class Select extends TextInput implements ISelect {
66
66
  * Defines if data handling should be manual or automatic
67
67
  */
68
68
  manualMode: boolean;
69
+ /**
70
+ * Specifies which DOM element that this component should detach to.
71
+ */
72
+ attach: boolean;
69
73
  /**
70
74
  * Defines if data handling should be manual or automatic
71
75
  */
@@ -30,6 +30,8 @@ export interface ISelectTree extends IComponentRender {
30
30
  dataDisabled?: string;
31
31
  disabledItems?: any[];
32
32
  fetchOnDemand?: boolean;
33
+ fieldHasChild?: string;
34
+ menuMaxWidth?: number;
33
35
  }
34
36
  export interface ISelectTreeCloseEvent extends IEventParam<SelectTree> {
35
37
  selectedNodes: ISelectTreeNode<IDictionary>[];
@@ -93,6 +93,11 @@ export declare class SelectTree extends TextInput implements ISelectTree {
93
93
  * Uses delayed loading to load tree branches
94
94
  */
95
95
  fetchOnDemand: boolean;
96
+ menuMaxWidth?: number;
97
+ /**
98
+ * Defines if the node tree has child
99
+ */
100
+ fieldHasChild: string;
96
101
  /**
97
102
  * Creates a new instance of SelectTree
98
103
  * @param props
@@ -124,8 +129,10 @@ export declare class SelectTree extends TextInput implements ISelectTree {
124
129
  searchChange(searchQuery: string, element?: any): void;
125
130
  private isDisable;
126
131
  private getDisabledNodes;
132
+ private getNodeChildren;
127
133
  getNodes(): ISelectTreeNode<IDictionary>[];
128
134
  validate(): boolean;
135
+ resetValidation(): void;
129
136
  /**
130
137
  * Triggered when the data is inputed.
131
138
  * @param value search value
@@ -5,4 +5,5 @@ export interface ITreeDataStructure {
5
5
  openLevelOnLoad: number | boolean;
6
6
  fetchOnDemand: boolean;
7
7
  detach?: boolean;
8
+ fieldHasChild?: string;
8
9
  }
@@ -29,6 +29,7 @@ export declare class TreeDataStructure {
29
29
  * Stores tree structure
30
30
  */
31
31
  private treeStructure;
32
+ fieldHasChild?: string;
32
33
  /**
33
34
  * Tree component
34
35
  */
@@ -144,4 +145,10 @@ export declare class TreeDataStructure {
144
145
  * @param row datasource row
145
146
  */
146
147
  getChildren(row: IDictionary<any>): IDictionary<any>[];
148
+ /**
149
+ * Checks if a row has async children that are yet to be loaded
150
+ * @param row
151
+ * @returns `false` if the row has no children to be loaded, `true` if it does or if fieldHasChild is not defined
152
+ */
153
+ hasChildOnDemand(row: IDictionary<any>): boolean;
147
154
  }