@zeedhi/common 1.79.0 → 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.
- package/dist/zd-common.esm.js +82 -4
- package/dist/zd-common.umd.js +85 -7
- package/package.json +4 -2
- package/types/components/zd-apex-chart/apex-chart.d.ts +3 -0
- package/types/components/zd-frame/frame.d.ts +1 -1
- package/types/components/zd-select/interfaces.d.ts +1 -0
- package/types/components/zd-select/select.d.ts +4 -0
- package/types/components/zd-select-tree/interfaces.d.ts +1 -0
- package/types/components/zd-select-tree/select-tree.d.ts +6 -0
- package/types/utils/tree-data-structure/interfaces.d.ts +1 -0
- package/types/utils/tree-data-structure/tree-data-structure.d.ts +7 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AccessorManager, Event, KeyMap, Metadata, Accessor, I18n, FormatterParserProvider, Validation, Mask, DatasourceFactory, MethodNotAssignedError, Loader, Config, dayjs,
|
|
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
|
-
|
|
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';
|
|
@@ -9800,11 +9830,13 @@ class TreeDataStructure {
|
|
|
9800
9830
|
* Stores tree structure
|
|
9801
9831
|
*/
|
|
9802
9832
|
this.treeStructure = {};
|
|
9833
|
+
this.fieldHasChild = '';
|
|
9803
9834
|
this.searchValue = '';
|
|
9804
9835
|
this.originalDatasource = tree.datasource;
|
|
9805
9836
|
this.parentField = tree.parentField;
|
|
9806
9837
|
this.fetchOnDemand = tree.fetchOnDemand;
|
|
9807
9838
|
this.openLevelOnLoad = tree.openLevelOnLoad;
|
|
9839
|
+
this.fieldHasChild = tree.fieldHasChild;
|
|
9808
9840
|
this.tree = tree;
|
|
9809
9841
|
this.init();
|
|
9810
9842
|
}
|
|
@@ -10166,6 +10198,33 @@ class TreeDataStructure {
|
|
|
10166
10198
|
});
|
|
10167
10199
|
return result;
|
|
10168
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
|
+
}
|
|
10169
10228
|
}
|
|
10170
10229
|
|
|
10171
10230
|
/**
|
|
@@ -10258,6 +10317,10 @@ class SelectTree extends TextInput {
|
|
|
10258
10317
|
* Uses delayed loading to load tree branches
|
|
10259
10318
|
*/
|
|
10260
10319
|
this.fetchOnDemand = false;
|
|
10320
|
+
/**
|
|
10321
|
+
* Defines if the node tree has child
|
|
10322
|
+
*/
|
|
10323
|
+
this.fieldHasChild = '';
|
|
10261
10324
|
this.savedNodes = undefined;
|
|
10262
10325
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
10263
10326
|
this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
|
|
@@ -10278,6 +10341,7 @@ class SelectTree extends TextInput {
|
|
|
10278
10341
|
this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
|
|
10279
10342
|
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
10280
10343
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
10344
|
+
this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
|
|
10281
10345
|
this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
|
|
10282
10346
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
10283
10347
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
@@ -10316,6 +10380,7 @@ class SelectTree extends TextInput {
|
|
|
10316
10380
|
parentField: this.parentField,
|
|
10317
10381
|
openLevelOnLoad: false,
|
|
10318
10382
|
fetchOnDemand: this.fetchOnDemand,
|
|
10383
|
+
fieldHasChild: this.fieldHasChild,
|
|
10319
10384
|
});
|
|
10320
10385
|
if (!this.lazyLoad) {
|
|
10321
10386
|
this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
|
|
@@ -10446,7 +10511,14 @@ class SelectTree extends TextInput {
|
|
|
10446
10511
|
return this.disabledItems.indexOf(node.id) !== -1;
|
|
10447
10512
|
}
|
|
10448
10513
|
getDisabledNodes(nodes) {
|
|
10449
|
-
return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(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;
|
|
10450
10522
|
}
|
|
10451
10523
|
getNodes() {
|
|
10452
10524
|
return this.getDisabledNodes(this.nodes);
|
|
@@ -10464,6 +10536,9 @@ class SelectTree extends TextInput {
|
|
|
10464
10536
|
});
|
|
10465
10537
|
return !hasError;
|
|
10466
10538
|
}
|
|
10539
|
+
resetValidation() {
|
|
10540
|
+
this.validationError = '';
|
|
10541
|
+
}
|
|
10467
10542
|
/**
|
|
10468
10543
|
* Triggered when the data is inputed.
|
|
10469
10544
|
* @param value search value
|
|
@@ -11577,7 +11652,6 @@ class Time extends TextInput {
|
|
|
11577
11652
|
this.removeTimeMask();
|
|
11578
11653
|
this.setTimeValue(this.formatter(this.value));
|
|
11579
11654
|
super.blur(event, element);
|
|
11580
|
-
this.showTimePicker = false;
|
|
11581
11655
|
}
|
|
11582
11656
|
focus(event, element) {
|
|
11583
11657
|
this.addTimeMask();
|
|
@@ -12926,6 +13000,8 @@ class Icons {
|
|
|
12926
13000
|
}
|
|
12927
13001
|
Icons.mdiIcons = {
|
|
12928
13002
|
alertOctagon: 'mdi-alert-octagon',
|
|
13003
|
+
arrowLeft: 'mdi-arrow-left',
|
|
13004
|
+
arrowRight: 'mdi-arrow-right',
|
|
12929
13005
|
cancel: 'mdi-close-circle',
|
|
12930
13006
|
calendar: 'mdi-calendar',
|
|
12931
13007
|
checkboxIndeterminate: 'mdi-minus-box',
|
|
@@ -12983,6 +13059,8 @@ Icons.mdiIcons = {
|
|
|
12983
13059
|
};
|
|
12984
13060
|
Icons.faIcons = {
|
|
12985
13061
|
alertOctagon: 'fa fa-exclamation-circle',
|
|
13062
|
+
arrowLeft: 'fa fa-arrow-left',
|
|
13063
|
+
arrowRight: 'fa fa-arrow-right',
|
|
12986
13064
|
cancel: 'fa fa-times-circle',
|
|
12987
13065
|
calendar: 'fa fa-calendar-o',
|
|
12988
13066
|
checkboxIndeterminate: 'fa fa-minus-square',
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -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
|
-
|
|
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';
|
|
@@ -9807,11 +9837,13 @@
|
|
|
9807
9837
|
* Stores tree structure
|
|
9808
9838
|
*/
|
|
9809
9839
|
this.treeStructure = {};
|
|
9840
|
+
this.fieldHasChild = '';
|
|
9810
9841
|
this.searchValue = '';
|
|
9811
9842
|
this.originalDatasource = tree.datasource;
|
|
9812
9843
|
this.parentField = tree.parentField;
|
|
9813
9844
|
this.fetchOnDemand = tree.fetchOnDemand;
|
|
9814
9845
|
this.openLevelOnLoad = tree.openLevelOnLoad;
|
|
9846
|
+
this.fieldHasChild = tree.fieldHasChild;
|
|
9815
9847
|
this.tree = tree;
|
|
9816
9848
|
this.init();
|
|
9817
9849
|
}
|
|
@@ -10173,6 +10205,33 @@
|
|
|
10173
10205
|
});
|
|
10174
10206
|
return result;
|
|
10175
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
|
+
}
|
|
10176
10235
|
}
|
|
10177
10236
|
|
|
10178
10237
|
/**
|
|
@@ -10265,6 +10324,10 @@
|
|
|
10265
10324
|
* Uses delayed loading to load tree branches
|
|
10266
10325
|
*/
|
|
10267
10326
|
this.fetchOnDemand = false;
|
|
10327
|
+
/**
|
|
10328
|
+
* Defines if the node tree has child
|
|
10329
|
+
*/
|
|
10330
|
+
this.fieldHasChild = '';
|
|
10268
10331
|
this.savedNodes = undefined;
|
|
10269
10332
|
this.nodes = this.getInitValue('nodes', props.nodes, this.nodes);
|
|
10270
10333
|
this.alwaysOpen = this.getInitValue('alwaysOpen', props.alwaysOpen, this.alwaysOpen);
|
|
@@ -10285,6 +10348,7 @@
|
|
|
10285
10348
|
this.disabledItems = this.getInitValue('disabledItems', props.disabledItems, this.disabledItems);
|
|
10286
10349
|
this.preventLoadOnFocus = this.getInitValue('preventLoadOnFocus', props.preventLoadOnFocus, this.preventLoadOnFocus);
|
|
10287
10350
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
10351
|
+
this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
|
|
10288
10352
|
this.menuMaxWidth = this.getInitValue('menuMaxWidth', props.menuMaxWidth, this.menuMaxWidth);
|
|
10289
10353
|
if (props.datasource && Object.keys(props.datasource).length) {
|
|
10290
10354
|
this.lazyLoad = props.datasource.lazyLoad !== false;
|
|
@@ -10323,6 +10387,7 @@
|
|
|
10323
10387
|
parentField: this.parentField,
|
|
10324
10388
|
openLevelOnLoad: false,
|
|
10325
10389
|
fetchOnDemand: this.fetchOnDemand,
|
|
10390
|
+
fieldHasChild: this.fieldHasChild,
|
|
10326
10391
|
});
|
|
10327
10392
|
if (!this.lazyLoad) {
|
|
10328
10393
|
this.datasource.get().then(() => { this.createNodesFromDatasource(false); });
|
|
@@ -10453,7 +10518,14 @@
|
|
|
10453
10518
|
return this.disabledItems.indexOf(node.id) !== -1;
|
|
10454
10519
|
}
|
|
10455
10520
|
getDisabledNodes(nodes) {
|
|
10456
|
-
return nodes.map((node) => (Object.assign(Object.assign({}, node), { isDisabled: this.isDisable(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;
|
|
10457
10529
|
}
|
|
10458
10530
|
getNodes() {
|
|
10459
10531
|
return this.getDisabledNodes(this.nodes);
|
|
@@ -10471,6 +10543,9 @@
|
|
|
10471
10543
|
});
|
|
10472
10544
|
return !hasError;
|
|
10473
10545
|
}
|
|
10546
|
+
resetValidation() {
|
|
10547
|
+
this.validationError = '';
|
|
10548
|
+
}
|
|
10474
10549
|
/**
|
|
10475
10550
|
* Triggered when the data is inputed.
|
|
10476
10551
|
* @param value search value
|
|
@@ -11584,7 +11659,6 @@
|
|
|
11584
11659
|
this.removeTimeMask();
|
|
11585
11660
|
this.setTimeValue(this.formatter(this.value));
|
|
11586
11661
|
super.blur(event, element);
|
|
11587
|
-
this.showTimePicker = false;
|
|
11588
11662
|
}
|
|
11589
11663
|
focus(event, element) {
|
|
11590
11664
|
this.addTimeMask();
|
|
@@ -12933,6 +13007,8 @@
|
|
|
12933
13007
|
}
|
|
12934
13008
|
Icons.mdiIcons = {
|
|
12935
13009
|
alertOctagon: 'mdi-alert-octagon',
|
|
13010
|
+
arrowLeft: 'mdi-arrow-left',
|
|
13011
|
+
arrowRight: 'mdi-arrow-right',
|
|
12936
13012
|
cancel: 'mdi-close-circle',
|
|
12937
13013
|
calendar: 'mdi-calendar',
|
|
12938
13014
|
checkboxIndeterminate: 'mdi-minus-box',
|
|
@@ -12990,6 +13066,8 @@
|
|
|
12990
13066
|
};
|
|
12991
13067
|
Icons.faIcons = {
|
|
12992
13068
|
alertOctagon: 'fa fa-exclamation-circle',
|
|
13069
|
+
arrowLeft: 'fa fa-arrow-left',
|
|
13070
|
+
arrowRight: 'fa fa-arrow-right',
|
|
12993
13071
|
cancel: 'fa fa-times-circle',
|
|
12994
13072
|
calendar: 'fa fa-calendar-o',
|
|
12995
13073
|
checkboxIndeterminate: 'fa fa-minus-square',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.79.
|
|
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": "
|
|
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
|
}
|
|
@@ -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,7 @@ export interface ISelectTree extends IComponentRender {
|
|
|
30
30
|
dataDisabled?: string;
|
|
31
31
|
disabledItems?: any[];
|
|
32
32
|
fetchOnDemand?: boolean;
|
|
33
|
+
fieldHasChild?: string;
|
|
33
34
|
menuMaxWidth?: number;
|
|
34
35
|
}
|
|
35
36
|
export interface ISelectTreeCloseEvent extends IEventParam<SelectTree> {
|
|
@@ -94,6 +94,10 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
94
94
|
*/
|
|
95
95
|
fetchOnDemand: boolean;
|
|
96
96
|
menuMaxWidth?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Defines if the node tree has child
|
|
99
|
+
*/
|
|
100
|
+
fieldHasChild: string;
|
|
97
101
|
/**
|
|
98
102
|
* Creates a new instance of SelectTree
|
|
99
103
|
* @param props
|
|
@@ -125,8 +129,10 @@ export declare class SelectTree extends TextInput implements ISelectTree {
|
|
|
125
129
|
searchChange(searchQuery: string, element?: any): void;
|
|
126
130
|
private isDisable;
|
|
127
131
|
private getDisabledNodes;
|
|
132
|
+
private getNodeChildren;
|
|
128
133
|
getNodes(): ISelectTreeNode<IDictionary>[];
|
|
129
134
|
validate(): boolean;
|
|
135
|
+
resetValidation(): void;
|
|
130
136
|
/**
|
|
131
137
|
* Triggered when the data is inputed.
|
|
132
138
|
* @param value search value
|
|
@@ -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
|
}
|