@zeedhi/common 1.100.0 → 1.100.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 +92 -44
- package/dist/zd-common.umd.js +92 -44
- package/package.json +2 -2
- package/types/components/zd-grid/grid-editable.d.ts +14 -0
- package/types/components/zd-grid/grid.d.ts +2 -0
- package/types/components/zd-input/input.d.ts +4 -0
- package/types/components/zd-input/interfaces.d.ts +1 -0
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +5 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -1889,6 +1889,10 @@ class Input extends ComponentRender {
|
|
|
1889
1889
|
* Input validations.
|
|
1890
1890
|
*/
|
|
1891
1891
|
this.validations = {};
|
|
1892
|
+
/**
|
|
1893
|
+
* Defines if the input should be automatically registered in the closest parent Form
|
|
1894
|
+
*/
|
|
1895
|
+
this.autoRegister = true;
|
|
1892
1896
|
/**
|
|
1893
1897
|
* Parsed field rules.
|
|
1894
1898
|
*/
|
|
@@ -1924,8 +1928,9 @@ class Input extends ComponentRender {
|
|
|
1924
1928
|
this.storePath = this.getInitValue('storePath', props.storePath, this.storePath);
|
|
1925
1929
|
this.value = this.getInitValue('value', props.value, this.value);
|
|
1926
1930
|
this.validations = this.getInitValue('validations', props.validations, this.validations);
|
|
1931
|
+
this.autoRegister = this.getInitValue('autoRegister', props.autoRegister, this.autoRegister);
|
|
1927
1932
|
this.parseValidations(props.validations || {});
|
|
1928
|
-
if (this.formParent) {
|
|
1933
|
+
if (this.autoRegister && this.formParent) {
|
|
1929
1934
|
this.formParent.registerInput(this);
|
|
1930
1935
|
}
|
|
1931
1936
|
this.createAccessors();
|
|
@@ -5816,7 +5821,7 @@ class GridColumn extends Column {
|
|
|
5816
5821
|
FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, row, componentProps, }) => {
|
|
5817
5822
|
if (value === null || value === undefined)
|
|
5818
5823
|
return '';
|
|
5819
|
-
const { dataText, formatterDataText, dataTextSeparator, dataValue, } = componentProps;
|
|
5824
|
+
const { dataText, formatterDataText, dataTextSeparator, dataValue, dataTextDiscrete, } = componentProps;
|
|
5820
5825
|
let currentRow = row;
|
|
5821
5826
|
if (dataValue) {
|
|
5822
5827
|
const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
|
|
@@ -5837,7 +5842,7 @@ FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, r
|
|
|
5837
5842
|
}
|
|
5838
5843
|
if (!Object.keys(currentRow).length)
|
|
5839
5844
|
return typeof value === 'object' ? '' : value;
|
|
5840
|
-
const textColumn = formatterDataText || dataText;
|
|
5845
|
+
const textColumn = formatterDataText || dataTextDiscrete || dataText;
|
|
5841
5846
|
if (!textColumn)
|
|
5842
5847
|
return value;
|
|
5843
5848
|
if (typeof textColumn === 'string') {
|
|
@@ -6433,6 +6438,7 @@ class Grid extends Iterable {
|
|
|
6433
6438
|
props.children = newChildren;
|
|
6434
6439
|
props.name = instanceName;
|
|
6435
6440
|
props.allowDuplicate = true;
|
|
6441
|
+
props.autoRegister = false;
|
|
6436
6442
|
let instance = null;
|
|
6437
6443
|
try {
|
|
6438
6444
|
instance = this.updateActionInstance(instanceName, props);
|
|
@@ -6455,8 +6461,15 @@ class Grid extends Iterable {
|
|
|
6455
6461
|
}
|
|
6456
6462
|
return { props, instance };
|
|
6457
6463
|
}
|
|
6464
|
+
filterObject(obj, callback) {
|
|
6465
|
+
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => callback(key, value)));
|
|
6466
|
+
}
|
|
6467
|
+
deleteAccessorProps(newComponent) {
|
|
6468
|
+
const filteredProps = this.filterObject(newComponent, (_key, value) => !Accessor.isAccessorDefinition(value));
|
|
6469
|
+
return filteredProps;
|
|
6470
|
+
}
|
|
6458
6471
|
updateActionInstance(instanceName, newComponent) {
|
|
6459
|
-
const updatedComponent =
|
|
6472
|
+
const updatedComponent = this.deleteAccessorProps(newComponent);
|
|
6460
6473
|
delete updatedComponent.datasource;
|
|
6461
6474
|
delete updatedComponent.events;
|
|
6462
6475
|
const instance = Metadata.updateInstance(instanceName, updatedComponent);
|
|
@@ -6647,6 +6660,22 @@ class GridEditable extends Grid {
|
|
|
6647
6660
|
}
|
|
6648
6661
|
this.cellClickEvent(row, column, event, element);
|
|
6649
6662
|
}
|
|
6663
|
+
/**
|
|
6664
|
+
* Dispatches cellDoubleClick event
|
|
6665
|
+
* @param row Grid row
|
|
6666
|
+
* @param column Grid column
|
|
6667
|
+
* @param event DOM event
|
|
6668
|
+
* @param element DOM Element
|
|
6669
|
+
*/
|
|
6670
|
+
cellDoubleClick(row, column, event, element, canEdit = true) {
|
|
6671
|
+
if (column.editable && canEdit) {
|
|
6672
|
+
this.preventRowDoubleClick = true;
|
|
6673
|
+
this.datasource.currentRow = row;
|
|
6674
|
+
this.inlineEdit(row, column, event, element);
|
|
6675
|
+
return;
|
|
6676
|
+
}
|
|
6677
|
+
this.cellDoubleClickEvent(row, column, event, element);
|
|
6678
|
+
}
|
|
6650
6679
|
/**
|
|
6651
6680
|
* Enables editing mode
|
|
6652
6681
|
* @param row Grid row
|
|
@@ -6667,6 +6696,11 @@ class GridEditable extends Grid {
|
|
|
6667
6696
|
event, element, row, column, component: this,
|
|
6668
6697
|
});
|
|
6669
6698
|
}
|
|
6699
|
+
cellDoubleClickEvent(row, column, event, element) {
|
|
6700
|
+
this.preventRowDoubleClick = this.callEvent('cellDoubleClick', {
|
|
6701
|
+
event, element, row, column, component: this,
|
|
6702
|
+
});
|
|
6703
|
+
}
|
|
6670
6704
|
/**
|
|
6671
6705
|
* Dispatches select/unselect event
|
|
6672
6706
|
* @param row Grid row
|
|
@@ -6752,32 +6786,39 @@ class GridEditable extends Grid {
|
|
|
6752
6786
|
}
|
|
6753
6787
|
} });
|
|
6754
6788
|
this.updateOriginalRow(key, row);
|
|
6755
|
-
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true });
|
|
6789
|
+
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true, autoRegister: false });
|
|
6756
6790
|
}
|
|
6791
|
+
/**
|
|
6792
|
+
* Pushes lookup values into the column's datasource
|
|
6793
|
+
* If the row[column.name] has a selected value, pushes it
|
|
6794
|
+
*/
|
|
6757
6795
|
checkLookupData(column, row, componentProps) {
|
|
6758
|
-
if (row[column.name]
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
return;
|
|
6769
|
-
}
|
|
6770
|
-
if (colValue && typeof colValue === 'object'
|
|
6771
|
-
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
6772
|
-
const value = colValue[componentProps.dataValue];
|
|
6796
|
+
if (!row[column.name] || !column.lookupData || !componentProps.datasource)
|
|
6797
|
+
return;
|
|
6798
|
+
componentProps.datasource.data = componentProps.datasource.data || [];
|
|
6799
|
+
// prevent pushing lookup values when using accessor in data
|
|
6800
|
+
if (!Array.isArray(componentProps.datasource.data))
|
|
6801
|
+
return;
|
|
6802
|
+
const colValue = row[column.name];
|
|
6803
|
+
if (Array.isArray(colValue)) {
|
|
6804
|
+
colValue.forEach((item) => {
|
|
6805
|
+
const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
|
|
6773
6806
|
if (column.lookupData[value]) {
|
|
6774
6807
|
componentProps.datasource.data.push(column.lookupData[value]);
|
|
6775
6808
|
}
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6809
|
+
});
|
|
6810
|
+
return;
|
|
6811
|
+
}
|
|
6812
|
+
if (colValue && typeof colValue === 'object'
|
|
6813
|
+
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
6814
|
+
const value = colValue[componentProps.dataValue];
|
|
6815
|
+
if (column.lookupData[value]) {
|
|
6816
|
+
componentProps.datasource.data.push(column.lookupData[value]);
|
|
6780
6817
|
}
|
|
6818
|
+
return;
|
|
6819
|
+
}
|
|
6820
|
+
if (column.lookupData[colValue]) {
|
|
6821
|
+
componentProps.datasource.data.push(column.lookupData[colValue]);
|
|
6781
6822
|
}
|
|
6782
6823
|
}
|
|
6783
6824
|
checkCompValidity(component) {
|
|
@@ -14775,36 +14816,43 @@ class TreeGridEditable extends TreeGrid {
|
|
|
14775
14816
|
}
|
|
14776
14817
|
} });
|
|
14777
14818
|
this.updateOriginalRow(key, row);
|
|
14778
|
-
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true });
|
|
14819
|
+
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true, autoRegister: false });
|
|
14779
14820
|
}
|
|
14780
14821
|
updateOriginalRow(key, row) {
|
|
14781
14822
|
if (this.editedRows[key] !== undefined)
|
|
14782
14823
|
this.editedRows[key].originalRow = omit(row, 'originalRow');
|
|
14783
14824
|
}
|
|
14825
|
+
/**
|
|
14826
|
+
* Pushes lookup values into the column's datasource
|
|
14827
|
+
* If the row[column.name] has a selected value, pushes it
|
|
14828
|
+
*/
|
|
14784
14829
|
checkLookupData(column, row, componentProps) {
|
|
14785
|
-
if (row[column.name]
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14794
|
-
|
|
14795
|
-
return;
|
|
14796
|
-
}
|
|
14797
|
-
if (colValue && typeof colValue === 'object'
|
|
14798
|
-
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
14799
|
-
const value = colValue[componentProps.dataValue];
|
|
14830
|
+
if (!row[column.name] || !column.lookupData || !componentProps.datasource)
|
|
14831
|
+
return;
|
|
14832
|
+
componentProps.datasource.data = componentProps.datasource.data || [];
|
|
14833
|
+
// prevent pushing lookup values when using accessor in data
|
|
14834
|
+
if (!Array.isArray(componentProps.datasource.data))
|
|
14835
|
+
return;
|
|
14836
|
+
const colValue = row[column.name];
|
|
14837
|
+
if (Array.isArray(colValue)) {
|
|
14838
|
+
colValue.forEach((item) => {
|
|
14839
|
+
const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
|
|
14800
14840
|
if (column.lookupData[value]) {
|
|
14801
14841
|
componentProps.datasource.data.push(column.lookupData[value]);
|
|
14802
14842
|
}
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14843
|
+
});
|
|
14844
|
+
return;
|
|
14845
|
+
}
|
|
14846
|
+
if (colValue && typeof colValue === 'object'
|
|
14847
|
+
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
14848
|
+
const value = colValue[componentProps.dataValue];
|
|
14849
|
+
if (column.lookupData[value]) {
|
|
14850
|
+
componentProps.datasource.data.push(column.lookupData[value]);
|
|
14807
14851
|
}
|
|
14852
|
+
return;
|
|
14853
|
+
}
|
|
14854
|
+
if (column.lookupData[colValue]) {
|
|
14855
|
+
componentProps.datasource.data.push(column.lookupData[colValue]);
|
|
14808
14856
|
}
|
|
14809
14857
|
}
|
|
14810
14858
|
checkCompValidity(component) {
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -1896,6 +1896,10 @@
|
|
|
1896
1896
|
* Input validations.
|
|
1897
1897
|
*/
|
|
1898
1898
|
this.validations = {};
|
|
1899
|
+
/**
|
|
1900
|
+
* Defines if the input should be automatically registered in the closest parent Form
|
|
1901
|
+
*/
|
|
1902
|
+
this.autoRegister = true;
|
|
1899
1903
|
/**
|
|
1900
1904
|
* Parsed field rules.
|
|
1901
1905
|
*/
|
|
@@ -1931,8 +1935,9 @@
|
|
|
1931
1935
|
this.storePath = this.getInitValue('storePath', props.storePath, this.storePath);
|
|
1932
1936
|
this.value = this.getInitValue('value', props.value, this.value);
|
|
1933
1937
|
this.validations = this.getInitValue('validations', props.validations, this.validations);
|
|
1938
|
+
this.autoRegister = this.getInitValue('autoRegister', props.autoRegister, this.autoRegister);
|
|
1934
1939
|
this.parseValidations(props.validations || {});
|
|
1935
|
-
if (this.formParent) {
|
|
1940
|
+
if (this.autoRegister && this.formParent) {
|
|
1936
1941
|
this.formParent.registerInput(this);
|
|
1937
1942
|
}
|
|
1938
1943
|
this.createAccessors();
|
|
@@ -5823,7 +5828,7 @@
|
|
|
5823
5828
|
core.FormatterParserProvider.registerFormatter('column_ZdSelect', ({ column, value, row, componentProps, }) => {
|
|
5824
5829
|
if (value === null || value === undefined)
|
|
5825
5830
|
return '';
|
|
5826
|
-
const { dataText, formatterDataText, dataTextSeparator, dataValue, } = componentProps;
|
|
5831
|
+
const { dataText, formatterDataText, dataTextSeparator, dataValue, dataTextDiscrete, } = componentProps;
|
|
5827
5832
|
let currentRow = row;
|
|
5828
5833
|
if (dataValue) {
|
|
5829
5834
|
const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
|
|
@@ -5844,7 +5849,7 @@
|
|
|
5844
5849
|
}
|
|
5845
5850
|
if (!Object.keys(currentRow).length)
|
|
5846
5851
|
return typeof value === 'object' ? '' : value;
|
|
5847
|
-
const textColumn = formatterDataText || dataText;
|
|
5852
|
+
const textColumn = formatterDataText || dataTextDiscrete || dataText;
|
|
5848
5853
|
if (!textColumn)
|
|
5849
5854
|
return value;
|
|
5850
5855
|
if (typeof textColumn === 'string') {
|
|
@@ -6440,6 +6445,7 @@
|
|
|
6440
6445
|
props.children = newChildren;
|
|
6441
6446
|
props.name = instanceName;
|
|
6442
6447
|
props.allowDuplicate = true;
|
|
6448
|
+
props.autoRegister = false;
|
|
6443
6449
|
let instance = null;
|
|
6444
6450
|
try {
|
|
6445
6451
|
instance = this.updateActionInstance(instanceName, props);
|
|
@@ -6462,8 +6468,15 @@
|
|
|
6462
6468
|
}
|
|
6463
6469
|
return { props, instance };
|
|
6464
6470
|
}
|
|
6471
|
+
filterObject(obj, callback) {
|
|
6472
|
+
return Object.fromEntries(Object.entries(obj).filter(([key, value]) => callback(key, value)));
|
|
6473
|
+
}
|
|
6474
|
+
deleteAccessorProps(newComponent) {
|
|
6475
|
+
const filteredProps = this.filterObject(newComponent, (_key, value) => !core.Accessor.isAccessorDefinition(value));
|
|
6476
|
+
return filteredProps;
|
|
6477
|
+
}
|
|
6465
6478
|
updateActionInstance(instanceName, newComponent) {
|
|
6466
|
-
const updatedComponent =
|
|
6479
|
+
const updatedComponent = this.deleteAccessorProps(newComponent);
|
|
6467
6480
|
delete updatedComponent.datasource;
|
|
6468
6481
|
delete updatedComponent.events;
|
|
6469
6482
|
const instance = core.Metadata.updateInstance(instanceName, updatedComponent);
|
|
@@ -6654,6 +6667,22 @@
|
|
|
6654
6667
|
}
|
|
6655
6668
|
this.cellClickEvent(row, column, event, element);
|
|
6656
6669
|
}
|
|
6670
|
+
/**
|
|
6671
|
+
* Dispatches cellDoubleClick event
|
|
6672
|
+
* @param row Grid row
|
|
6673
|
+
* @param column Grid column
|
|
6674
|
+
* @param event DOM event
|
|
6675
|
+
* @param element DOM Element
|
|
6676
|
+
*/
|
|
6677
|
+
cellDoubleClick(row, column, event, element, canEdit = true) {
|
|
6678
|
+
if (column.editable && canEdit) {
|
|
6679
|
+
this.preventRowDoubleClick = true;
|
|
6680
|
+
this.datasource.currentRow = row;
|
|
6681
|
+
this.inlineEdit(row, column, event, element);
|
|
6682
|
+
return;
|
|
6683
|
+
}
|
|
6684
|
+
this.cellDoubleClickEvent(row, column, event, element);
|
|
6685
|
+
}
|
|
6657
6686
|
/**
|
|
6658
6687
|
* Enables editing mode
|
|
6659
6688
|
* @param row Grid row
|
|
@@ -6674,6 +6703,11 @@
|
|
|
6674
6703
|
event, element, row, column, component: this,
|
|
6675
6704
|
});
|
|
6676
6705
|
}
|
|
6706
|
+
cellDoubleClickEvent(row, column, event, element) {
|
|
6707
|
+
this.preventRowDoubleClick = this.callEvent('cellDoubleClick', {
|
|
6708
|
+
event, element, row, column, component: this,
|
|
6709
|
+
});
|
|
6710
|
+
}
|
|
6677
6711
|
/**
|
|
6678
6712
|
* Dispatches select/unselect event
|
|
6679
6713
|
* @param row Grid row
|
|
@@ -6759,32 +6793,39 @@
|
|
|
6759
6793
|
}
|
|
6760
6794
|
} });
|
|
6761
6795
|
this.updateOriginalRow(key, row);
|
|
6762
|
-
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true });
|
|
6796
|
+
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true, autoRegister: false });
|
|
6763
6797
|
}
|
|
6798
|
+
/**
|
|
6799
|
+
* Pushes lookup values into the column's datasource
|
|
6800
|
+
* If the row[column.name] has a selected value, pushes it
|
|
6801
|
+
*/
|
|
6764
6802
|
checkLookupData(column, row, componentProps) {
|
|
6765
|
-
if (row[column.name]
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
return;
|
|
6776
|
-
}
|
|
6777
|
-
if (colValue && typeof colValue === 'object'
|
|
6778
|
-
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
6779
|
-
const value = colValue[componentProps.dataValue];
|
|
6803
|
+
if (!row[column.name] || !column.lookupData || !componentProps.datasource)
|
|
6804
|
+
return;
|
|
6805
|
+
componentProps.datasource.data = componentProps.datasource.data || [];
|
|
6806
|
+
// prevent pushing lookup values when using accessor in data
|
|
6807
|
+
if (!Array.isArray(componentProps.datasource.data))
|
|
6808
|
+
return;
|
|
6809
|
+
const colValue = row[column.name];
|
|
6810
|
+
if (Array.isArray(colValue)) {
|
|
6811
|
+
colValue.forEach((item) => {
|
|
6812
|
+
const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
|
|
6780
6813
|
if (column.lookupData[value]) {
|
|
6781
6814
|
componentProps.datasource.data.push(column.lookupData[value]);
|
|
6782
6815
|
}
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6816
|
+
});
|
|
6817
|
+
return;
|
|
6818
|
+
}
|
|
6819
|
+
if (colValue && typeof colValue === 'object'
|
|
6820
|
+
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
6821
|
+
const value = colValue[componentProps.dataValue];
|
|
6822
|
+
if (column.lookupData[value]) {
|
|
6823
|
+
componentProps.datasource.data.push(column.lookupData[value]);
|
|
6787
6824
|
}
|
|
6825
|
+
return;
|
|
6826
|
+
}
|
|
6827
|
+
if (column.lookupData[colValue]) {
|
|
6828
|
+
componentProps.datasource.data.push(column.lookupData[colValue]);
|
|
6788
6829
|
}
|
|
6789
6830
|
}
|
|
6790
6831
|
checkCompValidity(component) {
|
|
@@ -14782,36 +14823,43 @@
|
|
|
14782
14823
|
}
|
|
14783
14824
|
} });
|
|
14784
14825
|
this.updateOriginalRow(key, row);
|
|
14785
|
-
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true });
|
|
14826
|
+
return Object.assign(Object.assign({}, componentProps), { name: compName, parent: this, align: column.align, showLabel: false, showHelper: false, dense: true, value: colValue, events: newEvents, autofill: false, allowDuplicate: true, autoRegister: false });
|
|
14786
14827
|
}
|
|
14787
14828
|
updateOriginalRow(key, row) {
|
|
14788
14829
|
if (this.editedRows[key] !== undefined)
|
|
14789
14830
|
this.editedRows[key].originalRow = omit__default["default"](row, 'originalRow');
|
|
14790
14831
|
}
|
|
14832
|
+
/**
|
|
14833
|
+
* Pushes lookup values into the column's datasource
|
|
14834
|
+
* If the row[column.name] has a selected value, pushes it
|
|
14835
|
+
*/
|
|
14791
14836
|
checkLookupData(column, row, componentProps) {
|
|
14792
|
-
if (row[column.name]
|
|
14793
|
-
|
|
14794
|
-
|
|
14795
|
-
|
|
14796
|
-
|
|
14797
|
-
|
|
14798
|
-
|
|
14799
|
-
|
|
14800
|
-
|
|
14801
|
-
|
|
14802
|
-
return;
|
|
14803
|
-
}
|
|
14804
|
-
if (colValue && typeof colValue === 'object'
|
|
14805
|
-
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
14806
|
-
const value = colValue[componentProps.dataValue];
|
|
14837
|
+
if (!row[column.name] || !column.lookupData || !componentProps.datasource)
|
|
14838
|
+
return;
|
|
14839
|
+
componentProps.datasource.data = componentProps.datasource.data || [];
|
|
14840
|
+
// prevent pushing lookup values when using accessor in data
|
|
14841
|
+
if (!Array.isArray(componentProps.datasource.data))
|
|
14842
|
+
return;
|
|
14843
|
+
const colValue = row[column.name];
|
|
14844
|
+
if (Array.isArray(colValue)) {
|
|
14845
|
+
colValue.forEach((item) => {
|
|
14846
|
+
const value = typeof item === 'object' ? item[componentProps.dataValue] : item;
|
|
14807
14847
|
if (column.lookupData[value]) {
|
|
14808
14848
|
componentProps.datasource.data.push(column.lookupData[value]);
|
|
14809
14849
|
}
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14850
|
+
});
|
|
14851
|
+
return;
|
|
14852
|
+
}
|
|
14853
|
+
if (colValue && typeof colValue === 'object'
|
|
14854
|
+
&& Object.prototype.hasOwnProperty.call(colValue, componentProps.dataValue)) {
|
|
14855
|
+
const value = colValue[componentProps.dataValue];
|
|
14856
|
+
if (column.lookupData[value]) {
|
|
14857
|
+
componentProps.datasource.data.push(column.lookupData[value]);
|
|
14814
14858
|
}
|
|
14859
|
+
return;
|
|
14860
|
+
}
|
|
14861
|
+
if (column.lookupData[colValue]) {
|
|
14862
|
+
componentProps.datasource.data.push(column.lookupData[colValue]);
|
|
14815
14863
|
}
|
|
14816
14864
|
}
|
|
14817
14865
|
checkCompValidity(component) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.100.
|
|
3
|
+
"version": "1.100.1",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"lodash.times": "4.3.*",
|
|
44
44
|
"mockdate": "3.0.*"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "1209ae3b06d2feb2b969f42ec7100f68ac8c55e0"
|
|
47
47
|
}
|
|
@@ -76,6 +76,14 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
76
76
|
* @param element DOM Element
|
|
77
77
|
*/
|
|
78
78
|
cellClick(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any, canEdit?: boolean): void;
|
|
79
|
+
/**
|
|
80
|
+
* Dispatches cellDoubleClick event
|
|
81
|
+
* @param row Grid row
|
|
82
|
+
* @param column Grid column
|
|
83
|
+
* @param event DOM event
|
|
84
|
+
* @param element DOM Element
|
|
85
|
+
*/
|
|
86
|
+
cellDoubleClick(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any, canEdit?: boolean): void;
|
|
79
87
|
/**
|
|
80
88
|
* Enables editing mode
|
|
81
89
|
* @param row Grid row
|
|
@@ -85,6 +93,7 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
85
93
|
*/
|
|
86
94
|
inlineEdit(row: IDictionary, column: GridColumnEditable, event: Event, element: any): void;
|
|
87
95
|
cellClickEvent(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any): void;
|
|
96
|
+
cellDoubleClickEvent(row: IDictionary<any>, column: GridColumnEditable, event: Event, element: any): void;
|
|
88
97
|
/**
|
|
89
98
|
* Dispatches select/unselect event
|
|
90
99
|
* @param row Grid row
|
|
@@ -119,7 +128,12 @@ export declare class GridEditable extends Grid implements IGridEditable {
|
|
|
119
128
|
events: any;
|
|
120
129
|
autofill: boolean;
|
|
121
130
|
allowDuplicate: boolean;
|
|
131
|
+
autoRegister: boolean;
|
|
122
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Pushes lookup values into the column's datasource
|
|
135
|
+
* If the row[column.name] has a selected value, pushes it
|
|
136
|
+
*/
|
|
123
137
|
private checkLookupData;
|
|
124
138
|
private checkCompValidity;
|
|
125
139
|
/**
|
|
@@ -225,6 +225,8 @@ export declare class Grid extends Iterable implements IGrid {
|
|
|
225
225
|
props: IComponent;
|
|
226
226
|
instance: Component | null;
|
|
227
227
|
};
|
|
228
|
+
private filterObject;
|
|
229
|
+
private deleteAccessorProps;
|
|
228
230
|
protected updateActionInstance(instanceName: string, newComponent: IComponent): Component;
|
|
229
231
|
getActionComponent(actionComponent: IComponent, column: GridColumn, row: IDictionary, parentPath?: string): IComponent;
|
|
230
232
|
protected changeDefaultSlotNames(slot: IComponentRender[]): any;
|
|
@@ -99,6 +99,10 @@ export declare class Input extends ComponentRender implements IInput {
|
|
|
99
99
|
* Input validations.
|
|
100
100
|
*/
|
|
101
101
|
validations: IDictionary<IDictionary<string | number>>;
|
|
102
|
+
/**
|
|
103
|
+
* Defines if the input should be automatically registered in the closest parent Form
|
|
104
|
+
*/
|
|
105
|
+
autoRegister: boolean;
|
|
102
106
|
/**
|
|
103
107
|
* Optional validation method assigned by view layer.
|
|
104
108
|
*/
|
|
@@ -110,8 +110,13 @@ export declare class TreeGridEditable extends TreeGrid implements ITreeGridEdita
|
|
|
110
110
|
events: any;
|
|
111
111
|
autofill: boolean;
|
|
112
112
|
allowDuplicate: boolean;
|
|
113
|
+
autoRegister: boolean;
|
|
113
114
|
};
|
|
114
115
|
private updateOriginalRow;
|
|
116
|
+
/**
|
|
117
|
+
* Pushes lookup values into the column's datasource
|
|
118
|
+
* If the row[column.name] has a selected value, pushes it
|
|
119
|
+
*/
|
|
115
120
|
private checkLookupData;
|
|
116
121
|
private checkCompValidity;
|
|
117
122
|
/**
|