@zeedhi/common 1.83.0 → 1.83.2
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
CHANGED
|
@@ -2881,22 +2881,24 @@ class Number$1 extends TextInput {
|
|
|
2881
2881
|
*/
|
|
2882
2882
|
parser(value) { return this.parserFn(value, this); }
|
|
2883
2883
|
}
|
|
2884
|
-
FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask =
|
|
2884
|
+
FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask = {}, } = {}) => {
|
|
2885
2885
|
let maskDef = mask;
|
|
2886
2886
|
if (Accessor.isAccessorDefinition(maskDef)) {
|
|
2887
2887
|
const [controller, accessor] = Accessor.getAccessor(maskDef);
|
|
2888
2888
|
maskDef = Loader.getInstance(controller)[accessor];
|
|
2889
2889
|
}
|
|
2890
|
-
|
|
2890
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
|
|
2891
|
+
maskValue = Object.assign(Object.assign({}, Config.masks.numberMask), maskValue);
|
|
2891
2892
|
return value === null ? '' : AutoNumeric.format(value, maskValue);
|
|
2892
2893
|
});
|
|
2893
|
-
FormatterParserProvider.registerParser('ZdNumber', (value, { mask =
|
|
2894
|
+
FormatterParserProvider.registerParser('ZdNumber', (value, { mask = {}, } = {}) => {
|
|
2894
2895
|
let maskDef = mask;
|
|
2895
2896
|
if (Accessor.isAccessorDefinition(maskDef)) {
|
|
2896
2897
|
const [controller, accessor] = Accessor.getAccessor(maskDef);
|
|
2897
2898
|
maskDef = Loader.getInstance(controller)[accessor];
|
|
2898
2899
|
}
|
|
2899
|
-
|
|
2900
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2901
|
+
maskValue = Object.assign(Object.assign({}, Config.masks.numberMask), maskValue);
|
|
2900
2902
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2901
2903
|
});
|
|
2902
2904
|
|
|
@@ -2915,22 +2917,24 @@ class Currency extends Number$1 {
|
|
|
2915
2917
|
this.validateMask();
|
|
2916
2918
|
}
|
|
2917
2919
|
}
|
|
2918
|
-
FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask =
|
|
2920
|
+
FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = {}, } = {}) => {
|
|
2919
2921
|
let maskDef = mask;
|
|
2920
2922
|
if (Accessor.isAccessorDefinition(maskDef)) {
|
|
2921
2923
|
const [controller, accessor] = Accessor.getAccessor(maskDef);
|
|
2922
2924
|
maskDef = Loader.getInstance(controller)[accessor];
|
|
2923
2925
|
}
|
|
2924
|
-
|
|
2926
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
|
|
2927
|
+
maskValue = Object.assign(Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), maskValue);
|
|
2925
2928
|
return value === null ? '' : AutoNumeric.format(value, maskValue);
|
|
2926
2929
|
});
|
|
2927
|
-
FormatterParserProvider.registerParser('ZdCurrency', (value, { mask =
|
|
2930
|
+
FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = {}, } = {}) => {
|
|
2928
2931
|
let maskDef = mask;
|
|
2929
2932
|
if (Accessor.isAccessorDefinition(maskDef)) {
|
|
2930
2933
|
const [controller, accessor] = Accessor.getAccessor(maskDef);
|
|
2931
2934
|
maskDef = Loader.getInstance(controller)[accessor];
|
|
2932
2935
|
}
|
|
2933
|
-
|
|
2936
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2937
|
+
maskValue = Object.assign(Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), maskValue);
|
|
2934
2938
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2935
2939
|
});
|
|
2936
2940
|
|
|
@@ -7414,10 +7418,21 @@ class Select extends TextInput {
|
|
|
7414
7418
|
const oldGet = this.datasource.get;
|
|
7415
7419
|
this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
|
|
7416
7420
|
const response = yield oldGet.call(this.datasource);
|
|
7421
|
+
if (!this.datasource.search && !this.manualMode) {
|
|
7422
|
+
this.cachedData = [...this.datasource.data];
|
|
7423
|
+
this.cachedTotal = this.datasource.total;
|
|
7424
|
+
}
|
|
7417
7425
|
if (this.indexOf(this.value) === -1 && !this.datasource.search && !this.isFocused) {
|
|
7418
7426
|
yield this.setValue(this.value, false);
|
|
7419
7427
|
this.removePushedValue();
|
|
7420
7428
|
}
|
|
7429
|
+
if (this.pushedValue && this.indexOf(this.pushedValue) === -1) {
|
|
7430
|
+
const filterValue = this.pushedValue[this.dataValue];
|
|
7431
|
+
const foundInData = this.datasource.data.find(this.getCondition(filterValue));
|
|
7432
|
+
if (!foundInData) {
|
|
7433
|
+
this.datasource.data.unshift(this.pushedValue);
|
|
7434
|
+
}
|
|
7435
|
+
}
|
|
7421
7436
|
return response;
|
|
7422
7437
|
});
|
|
7423
7438
|
}
|
|
@@ -7684,10 +7699,13 @@ class Select extends TextInput {
|
|
|
7684
7699
|
yield this.updateSearch(value);
|
|
7685
7700
|
}
|
|
7686
7701
|
else {
|
|
7687
|
-
this.removePushedValue();
|
|
7688
|
-
this.datasource.search = this.searchValue;
|
|
7689
7702
|
this.datasource.data = [...this.cachedData];
|
|
7690
7703
|
this.datasource.total = this.cachedTotal;
|
|
7704
|
+
this.datasource.search = value;
|
|
7705
|
+
this.removePushedValue();
|
|
7706
|
+
if (this.preventLoadOnFocus) {
|
|
7707
|
+
yield this.datasource.get();
|
|
7708
|
+
}
|
|
7691
7709
|
}
|
|
7692
7710
|
});
|
|
7693
7711
|
}
|
|
@@ -7771,7 +7789,7 @@ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTe
|
|
|
7771
7789
|
const dataTextArr = Array.isArray(dataText) ? dataText : [dataText];
|
|
7772
7790
|
const dataTextNames = [];
|
|
7773
7791
|
const masks = [];
|
|
7774
|
-
dataTextArr.
|
|
7792
|
+
dataTextArr.map((text) => {
|
|
7775
7793
|
if (typeof text === 'string') {
|
|
7776
7794
|
dataTextNames.push(text);
|
|
7777
7795
|
masks.push('');
|
|
@@ -7786,6 +7804,7 @@ FormatterParserProvider.registerFormatter('ZdSelect', (value, { dataText, dataTe
|
|
|
7786
7804
|
masks.push(text.mask);
|
|
7787
7805
|
}
|
|
7788
7806
|
}
|
|
7807
|
+
return null;
|
|
7789
7808
|
});
|
|
7790
7809
|
return dataTextNames.reduce((result, column, index) => {
|
|
7791
7810
|
if (value[column] !== null && value[column] !== undefined) {
|
|
@@ -9673,10 +9692,6 @@ class SelectMultiple extends Select {
|
|
|
9673
9692
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9674
9693
|
if (!this.preventLoadOnFocus) {
|
|
9675
9694
|
yield this.datasource.get();
|
|
9676
|
-
const values = this.datasource.data.map((row) => row[this.dataValue]);
|
|
9677
|
-
// remove inserted items that are already in datasource
|
|
9678
|
-
this.insertedValues = this.insertedValues.filter((inserted) => !values.includes(inserted[this.dataValue]));
|
|
9679
|
-
this.preventLoadOnFocus = true;
|
|
9680
9695
|
}
|
|
9681
9696
|
this.setCache();
|
|
9682
9697
|
this.updateSearch(this.dirtySearchValue);
|
|
@@ -9696,6 +9711,13 @@ class SelectMultiple extends Select {
|
|
|
9696
9711
|
}
|
|
9697
9712
|
this.cachedTotal = this.datasource.total;
|
|
9698
9713
|
}
|
|
9714
|
+
overrideGet() {
|
|
9715
|
+
const oldGet = this.datasource.get;
|
|
9716
|
+
this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
|
|
9717
|
+
yield oldGet.call(this.datasource);
|
|
9718
|
+
this.setItemsOnSelect();
|
|
9719
|
+
});
|
|
9720
|
+
}
|
|
9699
9721
|
/**
|
|
9700
9722
|
* Field selected rows
|
|
9701
9723
|
*/
|
|
@@ -9724,9 +9746,7 @@ class SelectMultiple extends Select {
|
|
|
9724
9746
|
*/
|
|
9725
9747
|
cutFromAToB(a, b, condition) {
|
|
9726
9748
|
const indices = a.reduce((result, value, index) => (condition(value) ? [...result, index] : result), []);
|
|
9727
|
-
indices.
|
|
9728
|
-
b.push(a.splice(index, 1)[0]);
|
|
9729
|
-
});
|
|
9749
|
+
indices.map((index) => b.push(a.splice(index, 1)[0]));
|
|
9730
9750
|
}
|
|
9731
9751
|
setFieldValue(value) {
|
|
9732
9752
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9829,12 +9849,14 @@ class SelectMultiple extends Select {
|
|
|
9829
9849
|
const parsedValue = this.parserFn(value, this);
|
|
9830
9850
|
if (parsedValue !== this.datasource.search) {
|
|
9831
9851
|
yield this.datasource.setSearch(parsedValue);
|
|
9832
|
-
this.insertSelected();
|
|
9833
9852
|
}
|
|
9834
9853
|
});
|
|
9835
9854
|
}
|
|
9836
9855
|
/**
|
|
9837
|
-
* Inserts selected items in datasource
|
|
9856
|
+
* Inserts selected items in datasource.
|
|
9857
|
+
* This method will validate, for every selected value, if it is present in datasource:
|
|
9858
|
+
* if it is, removes from insertedValues
|
|
9859
|
+
* if not, add to insertedValues
|
|
9838
9860
|
*/
|
|
9839
9861
|
insertSelected() {
|
|
9840
9862
|
if (this.manualMode)
|
|
@@ -9858,10 +9880,9 @@ class SelectMultiple extends Select {
|
|
|
9858
9880
|
yield this.updateSearch(value);
|
|
9859
9881
|
}
|
|
9860
9882
|
else {
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
}
|
|
9883
|
+
this.datasource.data = [...this.cachedData];
|
|
9884
|
+
this.datasource.total = this.cachedTotal;
|
|
9885
|
+
this.datasource.search = value;
|
|
9865
9886
|
this.removeInserts();
|
|
9866
9887
|
this.insertSelected();
|
|
9867
9888
|
}
|
|
@@ -9887,7 +9908,7 @@ class SelectMultiple extends Select {
|
|
|
9887
9908
|
}
|
|
9888
9909
|
const dataTextNames = [];
|
|
9889
9910
|
const masks = [];
|
|
9890
|
-
this.dataText.
|
|
9911
|
+
this.dataText.map((text) => {
|
|
9891
9912
|
if (typeof text === 'string') {
|
|
9892
9913
|
dataTextNames.push(text);
|
|
9893
9914
|
masks.push('');
|
|
@@ -9896,6 +9917,7 @@ class SelectMultiple extends Select {
|
|
|
9896
9917
|
dataTextNames.push(text.name);
|
|
9897
9918
|
masks.push(text.mask);
|
|
9898
9919
|
}
|
|
9920
|
+
return text;
|
|
9899
9921
|
});
|
|
9900
9922
|
const formattedValue = value.map((row) => {
|
|
9901
9923
|
const isDisabled = this.dataDisabled && row[this.dataDisabled];
|
|
@@ -9937,10 +9959,6 @@ class SelectMultiple extends Select {
|
|
|
9937
9959
|
const foundInData = this.datasource.data.find(this.getCondition(value));
|
|
9938
9960
|
return !foundInData;
|
|
9939
9961
|
});
|
|
9940
|
-
this.insertSelected();
|
|
9941
|
-
if (!this.datasource.search) {
|
|
9942
|
-
this.setCache();
|
|
9943
|
-
}
|
|
9944
9962
|
this.removePushedValue();
|
|
9945
9963
|
});
|
|
9946
9964
|
}
|
|
@@ -10001,6 +10019,16 @@ class SelectMultiple extends Select {
|
|
|
10001
10019
|
}
|
|
10002
10020
|
});
|
|
10003
10021
|
}
|
|
10022
|
+
setItemsOnSelect() {
|
|
10023
|
+
const values = this.datasource.data.map((row) => row[this.dataValue]);
|
|
10024
|
+
// remove inserted items that are already in datasource
|
|
10025
|
+
this.insertedValues = this.insertedValues.filter((inserted) => !values.includes(inserted[this.dataValue]));
|
|
10026
|
+
this.preventLoadOnFocus = true;
|
|
10027
|
+
this.insertSelected();
|
|
10028
|
+
if (!this.datasource.search) {
|
|
10029
|
+
this.setCache();
|
|
10030
|
+
}
|
|
10031
|
+
}
|
|
10004
10032
|
checkValueOnBlur() { }
|
|
10005
10033
|
}
|
|
10006
10034
|
|
|
@@ -10294,6 +10322,7 @@ class TreeDataStructure {
|
|
|
10294
10322
|
originalData.splice(index + 1, 0, ...data);
|
|
10295
10323
|
this.originalDatasource.data = originalData;
|
|
10296
10324
|
this.originalDatasource.currentRow = this.clearRow(row);
|
|
10325
|
+
delete this.originalDatasource.filter[this.parentField];
|
|
10297
10326
|
return data;
|
|
10298
10327
|
}
|
|
10299
10328
|
return undefined;
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -2888,22 +2888,24 @@
|
|
|
2888
2888
|
*/
|
|
2889
2889
|
parser(value) { return this.parserFn(value, this); }
|
|
2890
2890
|
}
|
|
2891
|
-
core.FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask =
|
|
2891
|
+
core.FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask = {}, } = {}) => {
|
|
2892
2892
|
let maskDef = mask;
|
|
2893
2893
|
if (core.Accessor.isAccessorDefinition(maskDef)) {
|
|
2894
2894
|
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2895
2895
|
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2896
2896
|
}
|
|
2897
|
-
|
|
2897
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
|
|
2898
|
+
maskValue = Object.assign(Object.assign({}, core.Config.masks.numberMask), maskValue);
|
|
2898
2899
|
return value === null ? '' : AutoNumeric.format(value, maskValue);
|
|
2899
2900
|
});
|
|
2900
|
-
core.FormatterParserProvider.registerParser('ZdNumber', (value, { mask =
|
|
2901
|
+
core.FormatterParserProvider.registerParser('ZdNumber', (value, { mask = {}, } = {}) => {
|
|
2901
2902
|
let maskDef = mask;
|
|
2902
2903
|
if (core.Accessor.isAccessorDefinition(maskDef)) {
|
|
2903
2904
|
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2904
2905
|
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2905
2906
|
}
|
|
2906
|
-
|
|
2907
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2908
|
+
maskValue = Object.assign(Object.assign({}, core.Config.masks.numberMask), maskValue);
|
|
2907
2909
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2908
2910
|
});
|
|
2909
2911
|
|
|
@@ -2922,22 +2924,24 @@
|
|
|
2922
2924
|
this.validateMask();
|
|
2923
2925
|
}
|
|
2924
2926
|
}
|
|
2925
|
-
core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask =
|
|
2927
|
+
core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = {}, } = {}) => {
|
|
2926
2928
|
let maskDef = mask;
|
|
2927
2929
|
if (core.Accessor.isAccessorDefinition(maskDef)) {
|
|
2928
2930
|
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2929
2931
|
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2930
2932
|
}
|
|
2931
|
-
|
|
2933
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
|
|
2934
|
+
maskValue = Object.assign(Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), maskValue);
|
|
2932
2935
|
return value === null ? '' : AutoNumeric.format(value, maskValue);
|
|
2933
2936
|
});
|
|
2934
|
-
core.FormatterParserProvider.registerParser('ZdCurrency', (value, { mask =
|
|
2937
|
+
core.FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = {}, } = {}) => {
|
|
2935
2938
|
let maskDef = mask;
|
|
2936
2939
|
if (core.Accessor.isAccessorDefinition(maskDef)) {
|
|
2937
2940
|
const [controller, accessor] = core.Accessor.getAccessor(maskDef);
|
|
2938
2941
|
maskDef = core.Loader.getInstance(controller)[accessor];
|
|
2939
2942
|
}
|
|
2940
|
-
|
|
2943
|
+
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2944
|
+
maskValue = Object.assign(Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), maskValue);
|
|
2941
2945
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2942
2946
|
});
|
|
2943
2947
|
|
|
@@ -7421,10 +7425,21 @@
|
|
|
7421
7425
|
const oldGet = this.datasource.get;
|
|
7422
7426
|
this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
|
|
7423
7427
|
const response = yield oldGet.call(this.datasource);
|
|
7428
|
+
if (!this.datasource.search && !this.manualMode) {
|
|
7429
|
+
this.cachedData = [...this.datasource.data];
|
|
7430
|
+
this.cachedTotal = this.datasource.total;
|
|
7431
|
+
}
|
|
7424
7432
|
if (this.indexOf(this.value) === -1 && !this.datasource.search && !this.isFocused) {
|
|
7425
7433
|
yield this.setValue(this.value, false);
|
|
7426
7434
|
this.removePushedValue();
|
|
7427
7435
|
}
|
|
7436
|
+
if (this.pushedValue && this.indexOf(this.pushedValue) === -1) {
|
|
7437
|
+
const filterValue = this.pushedValue[this.dataValue];
|
|
7438
|
+
const foundInData = this.datasource.data.find(this.getCondition(filterValue));
|
|
7439
|
+
if (!foundInData) {
|
|
7440
|
+
this.datasource.data.unshift(this.pushedValue);
|
|
7441
|
+
}
|
|
7442
|
+
}
|
|
7428
7443
|
return response;
|
|
7429
7444
|
});
|
|
7430
7445
|
}
|
|
@@ -7691,10 +7706,13 @@
|
|
|
7691
7706
|
yield this.updateSearch(value);
|
|
7692
7707
|
}
|
|
7693
7708
|
else {
|
|
7694
|
-
this.removePushedValue();
|
|
7695
|
-
this.datasource.search = this.searchValue;
|
|
7696
7709
|
this.datasource.data = [...this.cachedData];
|
|
7697
7710
|
this.datasource.total = this.cachedTotal;
|
|
7711
|
+
this.datasource.search = value;
|
|
7712
|
+
this.removePushedValue();
|
|
7713
|
+
if (this.preventLoadOnFocus) {
|
|
7714
|
+
yield this.datasource.get();
|
|
7715
|
+
}
|
|
7698
7716
|
}
|
|
7699
7717
|
});
|
|
7700
7718
|
}
|
|
@@ -7778,7 +7796,7 @@
|
|
|
7778
7796
|
const dataTextArr = Array.isArray(dataText) ? dataText : [dataText];
|
|
7779
7797
|
const dataTextNames = [];
|
|
7780
7798
|
const masks = [];
|
|
7781
|
-
dataTextArr.
|
|
7799
|
+
dataTextArr.map((text) => {
|
|
7782
7800
|
if (typeof text === 'string') {
|
|
7783
7801
|
dataTextNames.push(text);
|
|
7784
7802
|
masks.push('');
|
|
@@ -7793,6 +7811,7 @@
|
|
|
7793
7811
|
masks.push(text.mask);
|
|
7794
7812
|
}
|
|
7795
7813
|
}
|
|
7814
|
+
return null;
|
|
7796
7815
|
});
|
|
7797
7816
|
return dataTextNames.reduce((result, column, index) => {
|
|
7798
7817
|
if (value[column] !== null && value[column] !== undefined) {
|
|
@@ -9680,10 +9699,6 @@
|
|
|
9680
9699
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9681
9700
|
if (!this.preventLoadOnFocus) {
|
|
9682
9701
|
yield this.datasource.get();
|
|
9683
|
-
const values = this.datasource.data.map((row) => row[this.dataValue]);
|
|
9684
|
-
// remove inserted items that are already in datasource
|
|
9685
|
-
this.insertedValues = this.insertedValues.filter((inserted) => !values.includes(inserted[this.dataValue]));
|
|
9686
|
-
this.preventLoadOnFocus = true;
|
|
9687
9702
|
}
|
|
9688
9703
|
this.setCache();
|
|
9689
9704
|
this.updateSearch(this.dirtySearchValue);
|
|
@@ -9703,6 +9718,13 @@
|
|
|
9703
9718
|
}
|
|
9704
9719
|
this.cachedTotal = this.datasource.total;
|
|
9705
9720
|
}
|
|
9721
|
+
overrideGet() {
|
|
9722
|
+
const oldGet = this.datasource.get;
|
|
9723
|
+
this.datasource.get = () => __awaiter(this, void 0, void 0, function* () {
|
|
9724
|
+
yield oldGet.call(this.datasource);
|
|
9725
|
+
this.setItemsOnSelect();
|
|
9726
|
+
});
|
|
9727
|
+
}
|
|
9706
9728
|
/**
|
|
9707
9729
|
* Field selected rows
|
|
9708
9730
|
*/
|
|
@@ -9731,9 +9753,7 @@
|
|
|
9731
9753
|
*/
|
|
9732
9754
|
cutFromAToB(a, b, condition) {
|
|
9733
9755
|
const indices = a.reduce((result, value, index) => (condition(value) ? [...result, index] : result), []);
|
|
9734
|
-
indices.
|
|
9735
|
-
b.push(a.splice(index, 1)[0]);
|
|
9736
|
-
});
|
|
9756
|
+
indices.map((index) => b.push(a.splice(index, 1)[0]));
|
|
9737
9757
|
}
|
|
9738
9758
|
setFieldValue(value) {
|
|
9739
9759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9836,12 +9856,14 @@
|
|
|
9836
9856
|
const parsedValue = this.parserFn(value, this);
|
|
9837
9857
|
if (parsedValue !== this.datasource.search) {
|
|
9838
9858
|
yield this.datasource.setSearch(parsedValue);
|
|
9839
|
-
this.insertSelected();
|
|
9840
9859
|
}
|
|
9841
9860
|
});
|
|
9842
9861
|
}
|
|
9843
9862
|
/**
|
|
9844
|
-
* Inserts selected items in datasource
|
|
9863
|
+
* Inserts selected items in datasource.
|
|
9864
|
+
* This method will validate, for every selected value, if it is present in datasource:
|
|
9865
|
+
* if it is, removes from insertedValues
|
|
9866
|
+
* if not, add to insertedValues
|
|
9845
9867
|
*/
|
|
9846
9868
|
insertSelected() {
|
|
9847
9869
|
if (this.manualMode)
|
|
@@ -9865,10 +9887,9 @@
|
|
|
9865
9887
|
yield this.updateSearch(value);
|
|
9866
9888
|
}
|
|
9867
9889
|
else {
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
}
|
|
9890
|
+
this.datasource.data = [...this.cachedData];
|
|
9891
|
+
this.datasource.total = this.cachedTotal;
|
|
9892
|
+
this.datasource.search = value;
|
|
9872
9893
|
this.removeInserts();
|
|
9873
9894
|
this.insertSelected();
|
|
9874
9895
|
}
|
|
@@ -9894,7 +9915,7 @@
|
|
|
9894
9915
|
}
|
|
9895
9916
|
const dataTextNames = [];
|
|
9896
9917
|
const masks = [];
|
|
9897
|
-
this.dataText.
|
|
9918
|
+
this.dataText.map((text) => {
|
|
9898
9919
|
if (typeof text === 'string') {
|
|
9899
9920
|
dataTextNames.push(text);
|
|
9900
9921
|
masks.push('');
|
|
@@ -9903,6 +9924,7 @@
|
|
|
9903
9924
|
dataTextNames.push(text.name);
|
|
9904
9925
|
masks.push(text.mask);
|
|
9905
9926
|
}
|
|
9927
|
+
return text;
|
|
9906
9928
|
});
|
|
9907
9929
|
const formattedValue = value.map((row) => {
|
|
9908
9930
|
const isDisabled = this.dataDisabled && row[this.dataDisabled];
|
|
@@ -9944,10 +9966,6 @@
|
|
|
9944
9966
|
const foundInData = this.datasource.data.find(this.getCondition(value));
|
|
9945
9967
|
return !foundInData;
|
|
9946
9968
|
});
|
|
9947
|
-
this.insertSelected();
|
|
9948
|
-
if (!this.datasource.search) {
|
|
9949
|
-
this.setCache();
|
|
9950
|
-
}
|
|
9951
9969
|
this.removePushedValue();
|
|
9952
9970
|
});
|
|
9953
9971
|
}
|
|
@@ -10008,6 +10026,16 @@
|
|
|
10008
10026
|
}
|
|
10009
10027
|
});
|
|
10010
10028
|
}
|
|
10029
|
+
setItemsOnSelect() {
|
|
10030
|
+
const values = this.datasource.data.map((row) => row[this.dataValue]);
|
|
10031
|
+
// remove inserted items that are already in datasource
|
|
10032
|
+
this.insertedValues = this.insertedValues.filter((inserted) => !values.includes(inserted[this.dataValue]));
|
|
10033
|
+
this.preventLoadOnFocus = true;
|
|
10034
|
+
this.insertSelected();
|
|
10035
|
+
if (!this.datasource.search) {
|
|
10036
|
+
this.setCache();
|
|
10037
|
+
}
|
|
10038
|
+
}
|
|
10011
10039
|
checkValueOnBlur() { }
|
|
10012
10040
|
}
|
|
10013
10041
|
|
|
@@ -10301,6 +10329,7 @@
|
|
|
10301
10329
|
originalData.splice(index + 1, 0, ...data);
|
|
10302
10330
|
this.originalDatasource.data = originalData;
|
|
10303
10331
|
this.originalDatasource.currentRow = this.clearRow(row);
|
|
10332
|
+
delete this.originalDatasource.filter[this.parentField];
|
|
10304
10333
|
return data;
|
|
10305
10334
|
}
|
|
10306
10335
|
return undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.83.
|
|
3
|
+
"version": "1.83.2",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -42,6 +42,5 @@
|
|
|
42
42
|
"@types/lodash.times": "4.3.*",
|
|
43
43
|
"lodash.times": "4.3.*",
|
|
44
44
|
"mockdate": "3.0.*"
|
|
45
|
-
}
|
|
46
|
-
"gitHead": "40cb1a2c5fe9d6ebb8d5ceb0add7e08f26cf5659"
|
|
45
|
+
}
|
|
47
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Datasource, IDictionary } from '@zeedhi/core';
|
|
2
2
|
import { IComponentRender } from '../zd-component/interfaces';
|
|
3
|
-
import { ISelect, SearchParam } from './interfaces';
|
|
4
3
|
import { TextInput } from '../zd-text-input/text-input';
|
|
4
|
+
import { ISelect, SearchParam } from './interfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Base class for Select component.
|
|
7
7
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDictionary } from '@zeedhi/core';
|
|
2
|
-
import { ISelectMultiple } from './interfaces';
|
|
3
2
|
import { Select } from '../zd-select/select';
|
|
3
|
+
import { ISelectMultiple } from './interfaces';
|
|
4
4
|
export declare class SelectMultiple extends Select implements ISelectMultiple {
|
|
5
5
|
private selectedValue;
|
|
6
6
|
/**
|
|
@@ -31,6 +31,7 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
|
|
|
31
31
|
* @param props Select properties
|
|
32
32
|
*/
|
|
33
33
|
constructor(props: ISelectMultiple);
|
|
34
|
+
overrideGet(): void;
|
|
34
35
|
/**
|
|
35
36
|
* Field selected rows
|
|
36
37
|
*/
|
|
@@ -66,7 +67,10 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
|
|
|
66
67
|
*/
|
|
67
68
|
updateSearch(value: string): Promise<void>;
|
|
68
69
|
/**
|
|
69
|
-
* Inserts selected items in datasource
|
|
70
|
+
* Inserts selected items in datasource.
|
|
71
|
+
* This method will validate, for every selected value, if it is present in datasource:
|
|
72
|
+
* if it is, removes from insertedValues
|
|
73
|
+
* if not, add to insertedValues
|
|
70
74
|
*/
|
|
71
75
|
private insertSelected;
|
|
72
76
|
protected removePushedValue(): void;
|
|
@@ -103,5 +107,6 @@ export declare class SelectMultiple extends Select implements ISelectMultiple {
|
|
|
103
107
|
onSelectAll(isSelected: boolean, event: Event, element: any): void;
|
|
104
108
|
selectAllItems(): Promise<void>;
|
|
105
109
|
unSelectAllItems(): Promise<void>;
|
|
110
|
+
private setItemsOnSelect;
|
|
106
111
|
protected checkValueOnBlur(): void;
|
|
107
112
|
}
|
package/LICENSE
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Zeedhi
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
|
23
|
-
This repository includes one file originally copied from https://github.com/vuetifyjs/vuetify/
|
|
24
|
-
under /blob/v1.5.16/packages/vuetify/src/util/, mask.ts.
|