@zeedhi/common 1.67.0 → 1.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zd-common.esm.js +69 -32
- package/dist/zd-common.umd.js +69 -32
- package/package.json +2 -2
- package/types/components/zd-component/component.d.ts +4 -0
- package/types/components/zd-component/interfaces.d.ts +1 -0
- package/types/components/zd-dashboard/dashboard.d.ts +1 -0
- package/types/components/zd-dashboard/interfaces.d.ts +1 -0
- package/types/components/zd-date/date-range.d.ts +1 -1
- package/types/components/zd-form/form.d.ts +5 -1
- package/types/components/zd-grid/grid-column.d.ts +2 -4
- package/types/components/zd-input/input.d.ts +0 -4
- package/types/components/zd-input/interfaces.d.ts +0 -1
- package/types/components/zd-menu/interfaces.d.ts +1 -0
- package/types/components/zd-menu/menu.d.ts +4 -0
- package/types/components/zd-textarea/interfaces.d.ts +2 -0
- package/types/components/zd-textarea/textarea.d.ts +8 -0
- package/types/components/zd-tooltip/interfaces.d.ts +1 -0
- package/types/components/zd-tooltip/tooltip.d.ts +6 -2
- package/types/components/zd-tree-grid/interfaces.d.ts +1 -0
- package/types/components/zd-tree-grid/tree-grid.d.ts +4 -0
- package/types/utils/tree-data-structure/interfaces.d.ts +1 -0
- package/types/utils/tree-data-structure/tree-data-structure.d.ts +6 -3
package/dist/zd-common.esm.js
CHANGED
|
@@ -23,6 +23,10 @@ class Component {
|
|
|
23
23
|
* @param props Components properties
|
|
24
24
|
*/
|
|
25
25
|
constructor(props) {
|
|
26
|
+
/**
|
|
27
|
+
* Automatically add focus to input when it's created.
|
|
28
|
+
*/
|
|
29
|
+
this.autofocus = false;
|
|
26
30
|
/**
|
|
27
31
|
* Children component structure if the component has children.
|
|
28
32
|
*/
|
|
@@ -77,6 +81,7 @@ class Component {
|
|
|
77
81
|
this.parent = props.parent;
|
|
78
82
|
this.name = props.name;
|
|
79
83
|
this.events = Event.factory(props.events || this.events);
|
|
84
|
+
this.autofocus = this.getInitValue('autofocus', props.autofocus, this.autofocus);
|
|
80
85
|
this.cssClass = this.getInitValue('cssClass', props.cssClass, this.cssClass);
|
|
81
86
|
this.cssStyle = this.getInitValue('cssStyle', props.cssStyle, this.cssStyle);
|
|
82
87
|
this.directives = this.getInitValue('directives', props.directives, this.directives);
|
|
@@ -1612,10 +1617,6 @@ class Input extends ComponentRender {
|
|
|
1612
1617
|
* Input auto complete.
|
|
1613
1618
|
*/
|
|
1614
1619
|
this.autofill = true;
|
|
1615
|
-
/**
|
|
1616
|
-
* Automatically add focus to input when it's created.
|
|
1617
|
-
*/
|
|
1618
|
-
this.autofocus = false;
|
|
1619
1620
|
/**
|
|
1620
1621
|
* Add input clear functionality if the input isn't readonly or disabled.
|
|
1621
1622
|
*/
|
|
@@ -1704,7 +1705,6 @@ class Input extends ComponentRender {
|
|
|
1704
1705
|
this.align = this.getInitValue('align', props.align, this.align);
|
|
1705
1706
|
this.alwaysShowError = this.getInitValue('alwaysShowError', props.alwaysShowError, this.alwaysShowError);
|
|
1706
1707
|
this.autofill = this.getInitValue('autofill', props.autofill, this.autofill);
|
|
1707
|
-
this.autofocus = this.getInitValue('autofocus', props.autofocus, this.autofocus);
|
|
1708
1708
|
this.clearable = this.getInitValue('clearable', props.clearable, this.clearable);
|
|
1709
1709
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
1710
1710
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
@@ -2992,6 +2992,8 @@ class Dashboard extends ComponentRender {
|
|
|
2992
2992
|
super(props);
|
|
2993
2993
|
/* Enable edit mode */
|
|
2994
2994
|
this.editingMode = false;
|
|
2995
|
+
/* show edit header */
|
|
2996
|
+
this.showEditHeader = true;
|
|
2995
2997
|
/* Enable only move mode */
|
|
2996
2998
|
this.moveMode = false;
|
|
2997
2999
|
/* Cards */
|
|
@@ -3226,6 +3228,7 @@ class Dashboard extends ComponentRender {
|
|
|
3226
3228
|
this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
|
|
3227
3229
|
this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
|
|
3228
3230
|
this.editHeader = this.getInitValue('editHeader', props.editHeader, this.editHeader);
|
|
3231
|
+
this.showEditHeader = this.getInitValue('showEditHeader', props.showEditHeader, this.showEditHeader);
|
|
3229
3232
|
this.createAccessors();
|
|
3230
3233
|
}
|
|
3231
3234
|
onMounted(element) {
|
|
@@ -4073,19 +4076,25 @@ class DateRange extends TextInput {
|
|
|
4073
4076
|
const chars = replaced.split('');
|
|
4074
4077
|
return chars.length ? chars.every((char) => Mask.isMaskDelimiter(char)) : true;
|
|
4075
4078
|
}
|
|
4076
|
-
updateHelperHint() {
|
|
4077
|
-
|
|
4079
|
+
updateHelperHint(helperValue) {
|
|
4080
|
+
const previousHelperHint = this.helperValue ? DateHelper.getLabel(this.helperValue) : '';
|
|
4081
|
+
if (!this.hint || previousHelperHint !== this.hint) {
|
|
4078
4082
|
this.previousHint = this.hint;
|
|
4079
4083
|
this.previousPersistentHint = this.persistentHint;
|
|
4080
|
-
this.hint = DateHelper.getLabel(this.helperValue);
|
|
4081
|
-
this.persistentHint = true;
|
|
4082
4084
|
}
|
|
4085
|
+
this.helperValue = helperValue;
|
|
4086
|
+
const label = DateHelper.getLabel(helperValue);
|
|
4087
|
+
if (!helperValue || !label) {
|
|
4088
|
+
this.hint = this.previousHint;
|
|
4089
|
+
this.persistentHint = this.previousPersistentHint;
|
|
4090
|
+
return;
|
|
4091
|
+
}
|
|
4092
|
+
this.hint = label;
|
|
4093
|
+
this.persistentHint = true;
|
|
4083
4094
|
}
|
|
4084
4095
|
change(event, element) {
|
|
4085
4096
|
super.change(event, element);
|
|
4086
|
-
this.
|
|
4087
|
-
this.hint = this.previousHint;
|
|
4088
|
-
this.persistentHint = this.previousPersistentHint;
|
|
4097
|
+
this.updateHelperHint('');
|
|
4089
4098
|
}
|
|
4090
4099
|
getMaskValue() {
|
|
4091
4100
|
let mask = '';
|
|
@@ -4774,9 +4783,11 @@ class Column extends Component {
|
|
|
4774
4783
|
this.loading = true;
|
|
4775
4784
|
const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
|
|
4776
4785
|
this.lookupDatasource.addFilter(lookupColumn, dataToLookup).then((data) => {
|
|
4786
|
+
const lookupData = {};
|
|
4777
4787
|
data.forEach((row) => {
|
|
4778
|
-
|
|
4788
|
+
lookupData[row[lookupColumn]] = row;
|
|
4779
4789
|
});
|
|
4790
|
+
this.lookupData = lookupData;
|
|
4780
4791
|
this.lookupDataCount += 1;
|
|
4781
4792
|
this.loading = false;
|
|
4782
4793
|
});
|
|
@@ -7914,6 +7925,10 @@ class Menu extends ComponentRender {
|
|
|
7914
7925
|
* Defines if the menu is an application menu
|
|
7915
7926
|
*/
|
|
7916
7927
|
this.app = false;
|
|
7928
|
+
/**
|
|
7929
|
+
* Defines if the menu must be rendered inside an absolute div
|
|
7930
|
+
*/
|
|
7931
|
+
this.absolute = false;
|
|
7917
7932
|
/**
|
|
7918
7933
|
* Defines if the menu should rests under the application toolbar
|
|
7919
7934
|
*/
|
|
@@ -8007,6 +8022,7 @@ class Menu extends ComponentRender {
|
|
|
8007
8022
|
/** Store the current item focused */
|
|
8008
8023
|
this.currentItem = null;
|
|
8009
8024
|
this.app = this.getInitValue('app', props.app, this.app);
|
|
8025
|
+
this.absolute = this.getInitValue('absolute', props.absolute, this.absolute);
|
|
8010
8026
|
this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
|
|
8011
8027
|
this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
|
|
8012
8028
|
this.floating = this.getInitValue('floating', props.floating, this.floating);
|
|
@@ -9273,6 +9289,7 @@ class TreeDataStructure {
|
|
|
9273
9289
|
this.parentField = tree.parentField;
|
|
9274
9290
|
this.fetchOnDemand = tree.fetchOnDemand;
|
|
9275
9291
|
this.openLevelOnLoad = tree.openLevelOnLoad;
|
|
9292
|
+
this.tree = tree;
|
|
9276
9293
|
this.init();
|
|
9277
9294
|
}
|
|
9278
9295
|
/**
|
|
@@ -9292,20 +9309,20 @@ class TreeDataStructure {
|
|
|
9292
9309
|
this.searchValue = this.originalDatasource.search;
|
|
9293
9310
|
this.searchHasNoData = false;
|
|
9294
9311
|
if (this.fetchOnDemand) {
|
|
9295
|
-
if (this.originalDatasource.search) {
|
|
9312
|
+
if (this.tree.detach || this.originalDatasource.search) {
|
|
9296
9313
|
delete this.originalDatasource.filter[this.parentField];
|
|
9297
9314
|
}
|
|
9298
9315
|
else if (!this.originalDatasource.filter[this.parentField]) {
|
|
9299
9316
|
this.originalDatasource.filter[this.parentField] = 'NULL';
|
|
9300
9317
|
}
|
|
9301
9318
|
}
|
|
9302
|
-
if (!this.fetchOnDemand && this.searchValue) {
|
|
9319
|
+
if (!this.tree.detach && !this.fetchOnDemand && this.searchValue) {
|
|
9303
9320
|
this.searchAllData();
|
|
9304
9321
|
return Promise.resolve(this.originalDatasource.data);
|
|
9305
9322
|
}
|
|
9306
9323
|
return originalGet.call(this.originalDatasource).then((data) => {
|
|
9307
9324
|
if (this.searchValue) {
|
|
9308
|
-
this.
|
|
9325
|
+
this.buildDetached();
|
|
9309
9326
|
}
|
|
9310
9327
|
else {
|
|
9311
9328
|
this.buildTree();
|
|
@@ -9318,7 +9335,10 @@ class TreeDataStructure {
|
|
|
9318
9335
|
* search data
|
|
9319
9336
|
*/
|
|
9320
9337
|
buildTree() {
|
|
9321
|
-
if (this.
|
|
9338
|
+
if (this.tree.detach) {
|
|
9339
|
+
this.buildDetached();
|
|
9340
|
+
}
|
|
9341
|
+
else if (this.fetchOnDemand) {
|
|
9322
9342
|
this.buildOnDemand();
|
|
9323
9343
|
}
|
|
9324
9344
|
else {
|
|
@@ -9571,13 +9591,12 @@ class TreeDataStructure {
|
|
|
9571
9591
|
});
|
|
9572
9592
|
}
|
|
9573
9593
|
/**
|
|
9574
|
-
*
|
|
9575
|
-
* @param data datasource data
|
|
9594
|
+
* Arrange treeData in a uniform structure
|
|
9576
9595
|
*/
|
|
9577
|
-
|
|
9596
|
+
buildDetached() {
|
|
9578
9597
|
this.treeData = [];
|
|
9579
9598
|
this.treeStructure = {};
|
|
9580
|
-
const childData = this.originalDatasource.data.map((row) => (Object.assign(Object.assign({}, row), { tree__children: [], tree__opened: false, tree__searched:
|
|
9599
|
+
const childData = this.originalDatasource.data.map((row) => (Object.assign(Object.assign({}, row), { tree__children: [], tree__opened: false, tree__searched: !!this.searchValue, tree__level: 1, tree__parent: undefined })));
|
|
9581
9600
|
this.treeData = childData;
|
|
9582
9601
|
this.treeStructure['no-parent'] = childData;
|
|
9583
9602
|
}
|
|
@@ -10613,6 +10632,14 @@ class Textarea extends TextInput {
|
|
|
10613
10632
|
* Default row count.
|
|
10614
10633
|
*/
|
|
10615
10634
|
this.rows = 5;
|
|
10635
|
+
/**
|
|
10636
|
+
* Input height
|
|
10637
|
+
*/
|
|
10638
|
+
this.height = 'auto';
|
|
10639
|
+
/**
|
|
10640
|
+
* Should input fill the remaining height
|
|
10641
|
+
*/
|
|
10642
|
+
this.fillHeight = false;
|
|
10616
10643
|
this.autoGrow = this.getInitValue('autoGrow', props.autoGrow, this.autoGrow);
|
|
10617
10644
|
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
10618
10645
|
this.clearIcon = this.getInitValue('clearIcon', props.clearIcon, this.clearIcon);
|
|
@@ -10624,6 +10651,8 @@ class Textarea extends TextInput {
|
|
|
10624
10651
|
this.rounded = this.getInitValue('rounded', props.rounded, this.reverse);
|
|
10625
10652
|
this.rowHeight = this.getInitValue('rowHeight', props.rowHeight, this.rowHeight);
|
|
10626
10653
|
this.rows = this.getInitValue('rows', props.rows, this.rows);
|
|
10654
|
+
this.height = this.getInitValue('height', props.height, this.height);
|
|
10655
|
+
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
10627
10656
|
this.createAccessors();
|
|
10628
10657
|
if (this.counter && !Number.isNaN(parseInt(this.counter.toString(), 10))) {
|
|
10629
10658
|
this.addValidation('maxLength', { limit: parseInt(this.counter.toString(), 10) });
|
|
@@ -11042,11 +11071,15 @@ class Tooltip extends ComponentRender {
|
|
|
11042
11071
|
*/
|
|
11043
11072
|
this.nudge = 0;
|
|
11044
11073
|
/**
|
|
11045
|
-
*
|
|
11074
|
+
* Open the tooltip on activator click
|
|
11046
11075
|
*/
|
|
11047
11076
|
this.openOnClick = false;
|
|
11048
11077
|
/**
|
|
11049
|
-
*
|
|
11078
|
+
* Open the tooltip on activator focus
|
|
11079
|
+
*/
|
|
11080
|
+
this.openOnFocus = true;
|
|
11081
|
+
/**
|
|
11082
|
+
* Open the tooltip on activator hover
|
|
11050
11083
|
*/
|
|
11051
11084
|
this.openOnHover = true;
|
|
11052
11085
|
/**
|
|
@@ -11066,6 +11099,7 @@ class Tooltip extends ComponentRender {
|
|
|
11066
11099
|
this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
|
|
11067
11100
|
this.nudge = this.getInitValue('nudge', props.nudge, this.nudge);
|
|
11068
11101
|
this.openOnClick = this.getInitValue('openOnClick', props.openOnClick, this.openOnClick);
|
|
11102
|
+
this.openOnFocus = this.getInitValue('openOnFocus', props.openOnFocus, this.openOnFocus);
|
|
11069
11103
|
this.openOnHover = this.getInitValue('openOnHover', props.openOnHover, this.openOnHover);
|
|
11070
11104
|
this.right = this.getInitValue('right', props.right, this.right);
|
|
11071
11105
|
this.top = this.getInitValue('top', props.top, this.top);
|
|
@@ -11495,6 +11529,10 @@ class TreeGrid extends Grid {
|
|
|
11495
11529
|
* Even though all children are selected, the parent node is not
|
|
11496
11530
|
*/
|
|
11497
11531
|
this.flat = false;
|
|
11532
|
+
/**
|
|
11533
|
+
* Display the rows detached from their parents
|
|
11534
|
+
*/
|
|
11535
|
+
this.detach = false;
|
|
11498
11536
|
this.navigationTreeKeyMapping = {
|
|
11499
11537
|
right: {
|
|
11500
11538
|
event: this.navigateToggle.bind(this, false),
|
|
@@ -11512,6 +11550,7 @@ class TreeGrid extends Grid {
|
|
|
11512
11550
|
this.parentField = this.getInitValue('parentField', props.parentField, this.parentField);
|
|
11513
11551
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
11514
11552
|
this.flat = this.getInitValue('flat', props.flat, this.flat);
|
|
11553
|
+
this.detach = this.getInitValue('detach', props.detach, this.detach);
|
|
11515
11554
|
this.treeDataStructure = new TreeDataStructure(this);
|
|
11516
11555
|
this.createAccessors();
|
|
11517
11556
|
}
|
|
@@ -11526,17 +11565,15 @@ class TreeGrid extends Grid {
|
|
|
11526
11565
|
* Build tree data
|
|
11527
11566
|
*/
|
|
11528
11567
|
buildTree(doGet = true) {
|
|
11529
|
-
if (doGet) {
|
|
11530
|
-
if (this.fetchOnDemand) {
|
|
11531
|
-
this.datasource.addFilter(this.parentField, 'NULL');
|
|
11532
|
-
}
|
|
11533
|
-
else {
|
|
11534
|
-
this.datasource.get();
|
|
11535
|
-
}
|
|
11536
|
-
}
|
|
11537
|
-
else {
|
|
11568
|
+
if (!doGet) {
|
|
11538
11569
|
this.treeDataStructure.buildTree();
|
|
11570
|
+
return;
|
|
11571
|
+
}
|
|
11572
|
+
if (!this.fetchOnDemand) {
|
|
11573
|
+
this.datasource.get();
|
|
11574
|
+
return;
|
|
11539
11575
|
}
|
|
11576
|
+
this.datasource.addFilter(this.parentField, 'NULL');
|
|
11540
11577
|
}
|
|
11541
11578
|
/**
|
|
11542
11579
|
* This function takes an array of objects and updates the data in the tree.
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
* @param props Components properties
|
|
31
31
|
*/
|
|
32
32
|
constructor(props) {
|
|
33
|
+
/**
|
|
34
|
+
* Automatically add focus to input when it's created.
|
|
35
|
+
*/
|
|
36
|
+
this.autofocus = false;
|
|
33
37
|
/**
|
|
34
38
|
* Children component structure if the component has children.
|
|
35
39
|
*/
|
|
@@ -84,6 +88,7 @@
|
|
|
84
88
|
this.parent = props.parent;
|
|
85
89
|
this.name = props.name;
|
|
86
90
|
this.events = core.Event.factory(props.events || this.events);
|
|
91
|
+
this.autofocus = this.getInitValue('autofocus', props.autofocus, this.autofocus);
|
|
87
92
|
this.cssClass = this.getInitValue('cssClass', props.cssClass, this.cssClass);
|
|
88
93
|
this.cssStyle = this.getInitValue('cssStyle', props.cssStyle, this.cssStyle);
|
|
89
94
|
this.directives = this.getInitValue('directives', props.directives, this.directives);
|
|
@@ -1619,10 +1624,6 @@
|
|
|
1619
1624
|
* Input auto complete.
|
|
1620
1625
|
*/
|
|
1621
1626
|
this.autofill = true;
|
|
1622
|
-
/**
|
|
1623
|
-
* Automatically add focus to input when it's created.
|
|
1624
|
-
*/
|
|
1625
|
-
this.autofocus = false;
|
|
1626
1627
|
/**
|
|
1627
1628
|
* Add input clear functionality if the input isn't readonly or disabled.
|
|
1628
1629
|
*/
|
|
@@ -1711,7 +1712,6 @@
|
|
|
1711
1712
|
this.align = this.getInitValue('align', props.align, this.align);
|
|
1712
1713
|
this.alwaysShowError = this.getInitValue('alwaysShowError', props.alwaysShowError, this.alwaysShowError);
|
|
1713
1714
|
this.autofill = this.getInitValue('autofill', props.autofill, this.autofill);
|
|
1714
|
-
this.autofocus = this.getInitValue('autofocus', props.autofocus, this.autofocus);
|
|
1715
1715
|
this.clearable = this.getInitValue('clearable', props.clearable, this.clearable);
|
|
1716
1716
|
this.color = this.getInitValue('color', props.color, this.color);
|
|
1717
1717
|
this.dense = this.getInitValue('dense', props.dense, this.dense);
|
|
@@ -2999,6 +2999,8 @@
|
|
|
2999
2999
|
super(props);
|
|
3000
3000
|
/* Enable edit mode */
|
|
3001
3001
|
this.editingMode = false;
|
|
3002
|
+
/* show edit header */
|
|
3003
|
+
this.showEditHeader = true;
|
|
3002
3004
|
/* Enable only move mode */
|
|
3003
3005
|
this.moveMode = false;
|
|
3004
3006
|
/* Cards */
|
|
@@ -3233,6 +3235,7 @@
|
|
|
3233
3235
|
this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
|
|
3234
3236
|
this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
|
|
3235
3237
|
this.editHeader = this.getInitValue('editHeader', props.editHeader, this.editHeader);
|
|
3238
|
+
this.showEditHeader = this.getInitValue('showEditHeader', props.showEditHeader, this.showEditHeader);
|
|
3236
3239
|
this.createAccessors();
|
|
3237
3240
|
}
|
|
3238
3241
|
onMounted(element) {
|
|
@@ -4080,19 +4083,25 @@
|
|
|
4080
4083
|
const chars = replaced.split('');
|
|
4081
4084
|
return chars.length ? chars.every((char) => core.Mask.isMaskDelimiter(char)) : true;
|
|
4082
4085
|
}
|
|
4083
|
-
updateHelperHint() {
|
|
4084
|
-
|
|
4086
|
+
updateHelperHint(helperValue) {
|
|
4087
|
+
const previousHelperHint = this.helperValue ? core.DateHelper.getLabel(this.helperValue) : '';
|
|
4088
|
+
if (!this.hint || previousHelperHint !== this.hint) {
|
|
4085
4089
|
this.previousHint = this.hint;
|
|
4086
4090
|
this.previousPersistentHint = this.persistentHint;
|
|
4087
|
-
this.hint = core.DateHelper.getLabel(this.helperValue);
|
|
4088
|
-
this.persistentHint = true;
|
|
4089
4091
|
}
|
|
4092
|
+
this.helperValue = helperValue;
|
|
4093
|
+
const label = core.DateHelper.getLabel(helperValue);
|
|
4094
|
+
if (!helperValue || !label) {
|
|
4095
|
+
this.hint = this.previousHint;
|
|
4096
|
+
this.persistentHint = this.previousPersistentHint;
|
|
4097
|
+
return;
|
|
4098
|
+
}
|
|
4099
|
+
this.hint = label;
|
|
4100
|
+
this.persistentHint = true;
|
|
4090
4101
|
}
|
|
4091
4102
|
change(event, element) {
|
|
4092
4103
|
super.change(event, element);
|
|
4093
|
-
this.
|
|
4094
|
-
this.hint = this.previousHint;
|
|
4095
|
-
this.persistentHint = this.previousPersistentHint;
|
|
4104
|
+
this.updateHelperHint('');
|
|
4096
4105
|
}
|
|
4097
4106
|
getMaskValue() {
|
|
4098
4107
|
let mask = '';
|
|
@@ -4781,9 +4790,11 @@
|
|
|
4781
4790
|
this.loading = true;
|
|
4782
4791
|
const dataToLookup = Array.from(new Set(this.dataToLookup)); // remove duplicates
|
|
4783
4792
|
this.lookupDatasource.addFilter(lookupColumn, dataToLookup).then((data) => {
|
|
4793
|
+
const lookupData = {};
|
|
4784
4794
|
data.forEach((row) => {
|
|
4785
|
-
|
|
4795
|
+
lookupData[row[lookupColumn]] = row;
|
|
4786
4796
|
});
|
|
4797
|
+
this.lookupData = lookupData;
|
|
4787
4798
|
this.lookupDataCount += 1;
|
|
4788
4799
|
this.loading = false;
|
|
4789
4800
|
});
|
|
@@ -7921,6 +7932,10 @@
|
|
|
7921
7932
|
* Defines if the menu is an application menu
|
|
7922
7933
|
*/
|
|
7923
7934
|
this.app = false;
|
|
7935
|
+
/**
|
|
7936
|
+
* Defines if the menu must be rendered inside an absolute div
|
|
7937
|
+
*/
|
|
7938
|
+
this.absolute = false;
|
|
7924
7939
|
/**
|
|
7925
7940
|
* Defines if the menu should rests under the application toolbar
|
|
7926
7941
|
*/
|
|
@@ -8014,6 +8029,7 @@
|
|
|
8014
8029
|
/** Store the current item focused */
|
|
8015
8030
|
this.currentItem = null;
|
|
8016
8031
|
this.app = this.getInitValue('app', props.app, this.app);
|
|
8032
|
+
this.absolute = this.getInitValue('absolute', props.absolute, this.absolute);
|
|
8017
8033
|
this.clipped = this.getInitValue('clipped', props.clipped, this.clipped);
|
|
8018
8034
|
this.fixed = this.getInitValue('fixed', props.fixed, this.fixed);
|
|
8019
8035
|
this.floating = this.getInitValue('floating', props.floating, this.floating);
|
|
@@ -9280,6 +9296,7 @@
|
|
|
9280
9296
|
this.parentField = tree.parentField;
|
|
9281
9297
|
this.fetchOnDemand = tree.fetchOnDemand;
|
|
9282
9298
|
this.openLevelOnLoad = tree.openLevelOnLoad;
|
|
9299
|
+
this.tree = tree;
|
|
9283
9300
|
this.init();
|
|
9284
9301
|
}
|
|
9285
9302
|
/**
|
|
@@ -9299,20 +9316,20 @@
|
|
|
9299
9316
|
this.searchValue = this.originalDatasource.search;
|
|
9300
9317
|
this.searchHasNoData = false;
|
|
9301
9318
|
if (this.fetchOnDemand) {
|
|
9302
|
-
if (this.originalDatasource.search) {
|
|
9319
|
+
if (this.tree.detach || this.originalDatasource.search) {
|
|
9303
9320
|
delete this.originalDatasource.filter[this.parentField];
|
|
9304
9321
|
}
|
|
9305
9322
|
else if (!this.originalDatasource.filter[this.parentField]) {
|
|
9306
9323
|
this.originalDatasource.filter[this.parentField] = 'NULL';
|
|
9307
9324
|
}
|
|
9308
9325
|
}
|
|
9309
|
-
if (!this.fetchOnDemand && this.searchValue) {
|
|
9326
|
+
if (!this.tree.detach && !this.fetchOnDemand && this.searchValue) {
|
|
9310
9327
|
this.searchAllData();
|
|
9311
9328
|
return Promise.resolve(this.originalDatasource.data);
|
|
9312
9329
|
}
|
|
9313
9330
|
return originalGet.call(this.originalDatasource).then((data) => {
|
|
9314
9331
|
if (this.searchValue) {
|
|
9315
|
-
this.
|
|
9332
|
+
this.buildDetached();
|
|
9316
9333
|
}
|
|
9317
9334
|
else {
|
|
9318
9335
|
this.buildTree();
|
|
@@ -9325,7 +9342,10 @@
|
|
|
9325
9342
|
* search data
|
|
9326
9343
|
*/
|
|
9327
9344
|
buildTree() {
|
|
9328
|
-
if (this.
|
|
9345
|
+
if (this.tree.detach) {
|
|
9346
|
+
this.buildDetached();
|
|
9347
|
+
}
|
|
9348
|
+
else if (this.fetchOnDemand) {
|
|
9329
9349
|
this.buildOnDemand();
|
|
9330
9350
|
}
|
|
9331
9351
|
else {
|
|
@@ -9578,13 +9598,12 @@
|
|
|
9578
9598
|
});
|
|
9579
9599
|
}
|
|
9580
9600
|
/**
|
|
9581
|
-
*
|
|
9582
|
-
* @param data datasource data
|
|
9601
|
+
* Arrange treeData in a uniform structure
|
|
9583
9602
|
*/
|
|
9584
|
-
|
|
9603
|
+
buildDetached() {
|
|
9585
9604
|
this.treeData = [];
|
|
9586
9605
|
this.treeStructure = {};
|
|
9587
|
-
const childData = this.originalDatasource.data.map((row) => (Object.assign(Object.assign({}, row), { tree__children: [], tree__opened: false, tree__searched:
|
|
9606
|
+
const childData = this.originalDatasource.data.map((row) => (Object.assign(Object.assign({}, row), { tree__children: [], tree__opened: false, tree__searched: !!this.searchValue, tree__level: 1, tree__parent: undefined })));
|
|
9588
9607
|
this.treeData = childData;
|
|
9589
9608
|
this.treeStructure['no-parent'] = childData;
|
|
9590
9609
|
}
|
|
@@ -10620,6 +10639,14 @@
|
|
|
10620
10639
|
* Default row count.
|
|
10621
10640
|
*/
|
|
10622
10641
|
this.rows = 5;
|
|
10642
|
+
/**
|
|
10643
|
+
* Input height
|
|
10644
|
+
*/
|
|
10645
|
+
this.height = 'auto';
|
|
10646
|
+
/**
|
|
10647
|
+
* Should input fill the remaining height
|
|
10648
|
+
*/
|
|
10649
|
+
this.fillHeight = false;
|
|
10623
10650
|
this.autoGrow = this.getInitValue('autoGrow', props.autoGrow, this.autoGrow);
|
|
10624
10651
|
this.backgroundColor = this.getInitValue('backgroundColor', props.backgroundColor, this.backgroundColor);
|
|
10625
10652
|
this.clearIcon = this.getInitValue('clearIcon', props.clearIcon, this.clearIcon);
|
|
@@ -10631,6 +10658,8 @@
|
|
|
10631
10658
|
this.rounded = this.getInitValue('rounded', props.rounded, this.reverse);
|
|
10632
10659
|
this.rowHeight = this.getInitValue('rowHeight', props.rowHeight, this.rowHeight);
|
|
10633
10660
|
this.rows = this.getInitValue('rows', props.rows, this.rows);
|
|
10661
|
+
this.height = this.getInitValue('height', props.height, this.height);
|
|
10662
|
+
this.fillHeight = this.getInitValue('fillHeight', props.fillHeight, this.fillHeight);
|
|
10634
10663
|
this.createAccessors();
|
|
10635
10664
|
if (this.counter && !Number.isNaN(parseInt(this.counter.toString(), 10))) {
|
|
10636
10665
|
this.addValidation('maxLength', { limit: parseInt(this.counter.toString(), 10) });
|
|
@@ -11049,11 +11078,15 @@
|
|
|
11049
11078
|
*/
|
|
11050
11079
|
this.nudge = 0;
|
|
11051
11080
|
/**
|
|
11052
|
-
*
|
|
11081
|
+
* Open the tooltip on activator click
|
|
11053
11082
|
*/
|
|
11054
11083
|
this.openOnClick = false;
|
|
11055
11084
|
/**
|
|
11056
|
-
*
|
|
11085
|
+
* Open the tooltip on activator focus
|
|
11086
|
+
*/
|
|
11087
|
+
this.openOnFocus = true;
|
|
11088
|
+
/**
|
|
11089
|
+
* Open the tooltip on activator hover
|
|
11057
11090
|
*/
|
|
11058
11091
|
this.openOnHover = true;
|
|
11059
11092
|
/**
|
|
@@ -11073,6 +11106,7 @@
|
|
|
11073
11106
|
this.minWidth = this.getInitValue('minWidth', props.minWidth, this.minWidth);
|
|
11074
11107
|
this.nudge = this.getInitValue('nudge', props.nudge, this.nudge);
|
|
11075
11108
|
this.openOnClick = this.getInitValue('openOnClick', props.openOnClick, this.openOnClick);
|
|
11109
|
+
this.openOnFocus = this.getInitValue('openOnFocus', props.openOnFocus, this.openOnFocus);
|
|
11076
11110
|
this.openOnHover = this.getInitValue('openOnHover', props.openOnHover, this.openOnHover);
|
|
11077
11111
|
this.right = this.getInitValue('right', props.right, this.right);
|
|
11078
11112
|
this.top = this.getInitValue('top', props.top, this.top);
|
|
@@ -11502,6 +11536,10 @@
|
|
|
11502
11536
|
* Even though all children are selected, the parent node is not
|
|
11503
11537
|
*/
|
|
11504
11538
|
this.flat = false;
|
|
11539
|
+
/**
|
|
11540
|
+
* Display the rows detached from their parents
|
|
11541
|
+
*/
|
|
11542
|
+
this.detach = false;
|
|
11505
11543
|
this.navigationTreeKeyMapping = {
|
|
11506
11544
|
right: {
|
|
11507
11545
|
event: this.navigateToggle.bind(this, false),
|
|
@@ -11519,6 +11557,7 @@
|
|
|
11519
11557
|
this.parentField = this.getInitValue('parentField', props.parentField, this.parentField);
|
|
11520
11558
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
11521
11559
|
this.flat = this.getInitValue('flat', props.flat, this.flat);
|
|
11560
|
+
this.detach = this.getInitValue('detach', props.detach, this.detach);
|
|
11522
11561
|
this.treeDataStructure = new TreeDataStructure(this);
|
|
11523
11562
|
this.createAccessors();
|
|
11524
11563
|
}
|
|
@@ -11533,17 +11572,15 @@
|
|
|
11533
11572
|
* Build tree data
|
|
11534
11573
|
*/
|
|
11535
11574
|
buildTree(doGet = true) {
|
|
11536
|
-
if (doGet) {
|
|
11537
|
-
if (this.fetchOnDemand) {
|
|
11538
|
-
this.datasource.addFilter(this.parentField, 'NULL');
|
|
11539
|
-
}
|
|
11540
|
-
else {
|
|
11541
|
-
this.datasource.get();
|
|
11542
|
-
}
|
|
11543
|
-
}
|
|
11544
|
-
else {
|
|
11575
|
+
if (!doGet) {
|
|
11545
11576
|
this.treeDataStructure.buildTree();
|
|
11577
|
+
return;
|
|
11578
|
+
}
|
|
11579
|
+
if (!this.fetchOnDemand) {
|
|
11580
|
+
this.datasource.get();
|
|
11581
|
+
return;
|
|
11546
11582
|
}
|
|
11583
|
+
this.datasource.addFilter(this.parentField, 'NULL');
|
|
11547
11584
|
}
|
|
11548
11585
|
/**
|
|
11549
11586
|
* This function takes an array of objects and updates the data in the tree.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.69.0",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"lodash.times": "^4.3.2",
|
|
40
40
|
"mockdate": "^3.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "68d387623e59f31de6b04926cb0d476f2e1715a0"
|
|
43
43
|
}
|
|
@@ -4,6 +4,10 @@ import { IComponent, IComponentDirectives, IComponentEvents } from './interfaces
|
|
|
4
4
|
* Base class for all Zeedhi components.
|
|
5
5
|
*/
|
|
6
6
|
export declare class Component implements IComponent {
|
|
7
|
+
/**
|
|
8
|
+
* Automatically add focus to input when it's created.
|
|
9
|
+
*/
|
|
10
|
+
autofocus: boolean;
|
|
7
11
|
/**
|
|
8
12
|
* Children component structure if the component has children.
|
|
9
13
|
*/
|
|
@@ -10,6 +10,7 @@ import { IHeader } from '../zd-header/interfaces';
|
|
|
10
10
|
export declare class Dashboard extends ComponentRender implements IDashboard {
|
|
11
11
|
events: IDashboardEvents;
|
|
12
12
|
editingMode: boolean;
|
|
13
|
+
showEditHeader: boolean;
|
|
13
14
|
moveMode: boolean;
|
|
14
15
|
cards: IDashboardCard[];
|
|
15
16
|
addModal?: Modal;
|
|
@@ -18,6 +18,7 @@ export interface IDashboard extends IComponentRender {
|
|
|
18
18
|
removePadding?: boolean;
|
|
19
19
|
height?: string | number;
|
|
20
20
|
heightAdjust?: string | number;
|
|
21
|
+
showEditHeader?: string | boolean;
|
|
21
22
|
cardFooterSlot?: IComponentRender[];
|
|
22
23
|
}
|
|
23
24
|
export interface IDashboardCard extends Omit<ICard, 'name' | 'component'> {
|
|
@@ -127,7 +127,7 @@ export declare class DateRange extends TextInput implements IDateRange {
|
|
|
127
127
|
protected isSimpleFormat(format: string): boolean;
|
|
128
128
|
private previousHint;
|
|
129
129
|
private previousPersistentHint;
|
|
130
|
-
updateHelperHint(): void;
|
|
130
|
+
updateHelperHint(helperValue: string): void;
|
|
131
131
|
change(event?: Event, element?: any): void;
|
|
132
132
|
getMaskValue(): any;
|
|
133
133
|
}
|
|
@@ -71,12 +71,16 @@ export declare class Form extends ComponentRender implements IForm {
|
|
|
71
71
|
[key: string]: any;
|
|
72
72
|
children?: import("..").IComponentRender[] | undefined;
|
|
73
73
|
component: string;
|
|
74
|
+
autofocus?: boolean | undefined;
|
|
74
75
|
componentId?: number | undefined;
|
|
75
76
|
cssClass?: string | undefined;
|
|
76
77
|
cssStyle?: string | object | undefined;
|
|
77
78
|
events?: import("..").IComponentEvents<import("@zeedhi/core").IEventParam<any>> | undefined;
|
|
78
79
|
directives?: import("..").IComponentDirectives | undefined;
|
|
79
|
-
isVisible?: string | boolean | undefined;
|
|
80
|
+
isVisible?: string | boolean | undefined; /**
|
|
81
|
+
* Applies the align-items css property.
|
|
82
|
+
* Available options are start, center, end, space-between, space-around and stretch.
|
|
83
|
+
*/
|
|
80
84
|
dark?: boolean | undefined;
|
|
81
85
|
light?: boolean | undefined;
|
|
82
86
|
keyMap?: import("@zeedhi/core").IKeyMap<import("@zeedhi/core").IEventParam<any>> | undefined;
|
|
@@ -18,6 +18,7 @@ export declare class GridColumn extends Column implements IGridColumn {
|
|
|
18
18
|
[key: string]: any;
|
|
19
19
|
children?: import("..").IComponentRender[] | undefined;
|
|
20
20
|
component: string;
|
|
21
|
+
autofocus?: boolean | undefined;
|
|
21
22
|
componentId?: number | undefined;
|
|
22
23
|
cssClass?: string | undefined;
|
|
23
24
|
cssStyle?: string | object | undefined;
|
|
@@ -27,10 +28,7 @@ export declare class GridColumn extends Column implements IGridColumn {
|
|
|
27
28
|
dark?: boolean | undefined;
|
|
28
29
|
light?: boolean | undefined;
|
|
29
30
|
keyMap?: import("@zeedhi/core").IKeyMap<import("@zeedhi/core").IEventParam<any>> | undefined;
|
|
30
|
-
name: string;
|
|
31
|
-
* Creates a new Grid Column.
|
|
32
|
-
* @param props Grid column properties
|
|
33
|
-
*/
|
|
31
|
+
name: string;
|
|
34
32
|
parent?: import("..").Component | undefined;
|
|
35
33
|
tabStop?: boolean | undefined;
|
|
36
34
|
}[];
|
|
@@ -17,10 +17,6 @@ export declare class Input extends ComponentRender implements IInput {
|
|
|
17
17
|
* Input auto complete.
|
|
18
18
|
*/
|
|
19
19
|
autofill: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Automatically add focus to input when it's created.
|
|
22
|
-
*/
|
|
23
|
-
autofocus: boolean;
|
|
24
20
|
/**
|
|
25
21
|
* Add input clear functionality if the input isn't readonly or disabled.
|
|
26
22
|
*/
|
|
@@ -9,6 +9,7 @@ export declare type IMenuLinkEvents = IComponentEvents<IMenuLinkEvent>;
|
|
|
9
9
|
*/
|
|
10
10
|
export interface IMenu extends IComponentRender {
|
|
11
11
|
app?: boolean | string;
|
|
12
|
+
absolute?: boolean | string;
|
|
12
13
|
clipped?: boolean | string;
|
|
13
14
|
dense?: boolean | string;
|
|
14
15
|
fixed?: boolean | string;
|
|
@@ -9,6 +9,10 @@ export declare class Menu extends ComponentRender implements IMenu {
|
|
|
9
9
|
* Defines if the menu is an application menu
|
|
10
10
|
*/
|
|
11
11
|
app: boolean | string;
|
|
12
|
+
/**
|
|
13
|
+
* Defines if the menu must be rendered inside an absolute div
|
|
14
|
+
*/
|
|
15
|
+
absolute: boolean | string;
|
|
12
16
|
/**
|
|
13
17
|
* Defines if the menu should rests under the application toolbar
|
|
14
18
|
*/
|
|
@@ -48,6 +48,14 @@ export declare class Textarea extends TextInput implements ITextarea {
|
|
|
48
48
|
* Default row count.
|
|
49
49
|
*/
|
|
50
50
|
rows: number | string;
|
|
51
|
+
/**
|
|
52
|
+
* Input height
|
|
53
|
+
*/
|
|
54
|
+
height: number | string;
|
|
55
|
+
/**
|
|
56
|
+
* Should input fill the remaining height
|
|
57
|
+
*/
|
|
58
|
+
fillHeight: number | string | boolean;
|
|
51
59
|
/**
|
|
52
60
|
* Create a new Textarea.
|
|
53
61
|
* @param props Textarea properties
|
|
@@ -34,11 +34,15 @@ export declare class Tooltip extends ComponentRender implements ITooltip {
|
|
|
34
34
|
*/
|
|
35
35
|
nudge: number | string;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Open the tooltip on activator click
|
|
38
38
|
*/
|
|
39
39
|
openOnClick: boolean;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Open the tooltip on activator focus
|
|
42
|
+
*/
|
|
43
|
+
openOnFocus: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Open the tooltip on activator hover
|
|
42
46
|
*/
|
|
43
47
|
openOnHover: boolean;
|
|
44
48
|
/**
|
|
@@ -35,6 +35,10 @@ export declare class TreeGrid extends Grid implements ITreeGrid {
|
|
|
35
35
|
* Even though all children are selected, the parent node is not
|
|
36
36
|
*/
|
|
37
37
|
flat: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Display the rows detached from their parents
|
|
40
|
+
*/
|
|
41
|
+
detach: boolean;
|
|
38
42
|
viewUpdateScrollData?: () => void;
|
|
39
43
|
/**
|
|
40
44
|
* Creates a new Tree Grid.
|
|
@@ -29,6 +29,10 @@ export declare class TreeDataStructure {
|
|
|
29
29
|
* Stores tree structure
|
|
30
30
|
*/
|
|
31
31
|
private treeStructure;
|
|
32
|
+
/**
|
|
33
|
+
* Tree component
|
|
34
|
+
*/
|
|
35
|
+
private tree;
|
|
32
36
|
constructor(tree: ITreeDataStructure);
|
|
33
37
|
/**
|
|
34
38
|
* Creates properties and methods
|
|
@@ -122,10 +126,9 @@ export declare class TreeDataStructure {
|
|
|
122
126
|
*/
|
|
123
127
|
private reloadAndUpdateSelectedRows;
|
|
124
128
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @param data datasource data
|
|
129
|
+
* Arrange treeData in a uniform structure
|
|
127
130
|
*/
|
|
128
|
-
|
|
131
|
+
buildDetached(): void;
|
|
129
132
|
/**
|
|
130
133
|
* Search value against a memory datasource
|
|
131
134
|
*/
|