@zeedhi/common 1.96.0 → 1.96.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 +242 -91
- package/dist/zd-common.umd.js +242 -89
- package/package.json +2 -2
- package/types/components/index.d.ts +1 -0
- package/types/components/zd-grid/grid-editable.d.ts +11 -0
- package/types/components/zd-grid/grid.d.ts +10 -5
- package/types/components/zd-input/input-factory.d.ts +6 -0
- package/types/components/zd-input/input.d.ts +3 -3
- package/types/components/zd-modal/interfaces.d.ts +9 -1
- package/types/components/zd-modal/modal.d.ts +5 -1
- package/types/components/zd-text-input/interfaces.d.ts +1 -0
- package/types/components/zd-text-input/text-input.d.ts +4 -0
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +7 -0
- package/types/components/zd-tree-grid/tree-grid.d.ts +1 -8
- package/types/utils/report/dataset-formatters/grouped-pdf-formatter.d.ts +47 -0
- package/types/utils/report/dataset-formatters/index.d.ts +1 -0
- package/types/utils/report/index.d.ts +1 -0
- package/types/utils/report/report.d.ts +1 -1
package/dist/zd-common.umd.js
CHANGED
|
@@ -2010,7 +2010,10 @@
|
|
|
2010
2010
|
*/
|
|
2011
2011
|
updateRules() {
|
|
2012
2012
|
this.rules = Object.values(this.parsedValidations)
|
|
2013
|
-
.map((validation) => () =>
|
|
2013
|
+
.map((validation) => (value) => {
|
|
2014
|
+
const testValue = value !== undefined ? value : this.value;
|
|
2015
|
+
return validation(testValue);
|
|
2016
|
+
});
|
|
2014
2017
|
}
|
|
2015
2018
|
/**
|
|
2016
2019
|
* Input value.
|
|
@@ -2063,8 +2066,11 @@
|
|
|
2063
2066
|
* Checks the input value are valid to all applied rules.
|
|
2064
2067
|
* @returns Input is valid
|
|
2065
2068
|
*/
|
|
2066
|
-
isValid() {
|
|
2067
|
-
return this.rules.every((rule) =>
|
|
2069
|
+
isValid(value) {
|
|
2070
|
+
return this.rules.every((rule) => {
|
|
2071
|
+
const testValue = value !== undefined ? value : this.value;
|
|
2072
|
+
return typeof rule(testValue) !== 'string';
|
|
2073
|
+
});
|
|
2068
2074
|
}
|
|
2069
2075
|
/**
|
|
2070
2076
|
* Triggered when the input value changes.
|
|
@@ -2149,6 +2155,19 @@
|
|
|
2149
2155
|
}
|
|
2150
2156
|
}
|
|
2151
2157
|
|
|
2158
|
+
class InputFactory {
|
|
2159
|
+
static register(className, inputClass) {
|
|
2160
|
+
if (!this.inputClasses[className])
|
|
2161
|
+
this.inputClasses[className] = inputClass;
|
|
2162
|
+
}
|
|
2163
|
+
static factory(props) {
|
|
2164
|
+
if (!this.inputClasses[props.component])
|
|
2165
|
+
return undefined;
|
|
2166
|
+
return new this.inputClasses[props.component](props);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
InputFactory.inputClasses = {};
|
|
2170
|
+
|
|
2152
2171
|
/**
|
|
2153
2172
|
* Base class for Checkbox component.
|
|
2154
2173
|
*/
|
|
@@ -2163,7 +2182,8 @@
|
|
|
2163
2182
|
this.showHelper = false;
|
|
2164
2183
|
this.createAccessors();
|
|
2165
2184
|
}
|
|
2166
|
-
}
|
|
2185
|
+
}
|
|
2186
|
+
InputFactory.register('ZdCheckbox', Checkbox);
|
|
2167
2187
|
|
|
2168
2188
|
/**
|
|
2169
2189
|
* Base class for Checkbox multiple component.
|
|
@@ -2216,7 +2236,8 @@
|
|
|
2216
2236
|
super.onBeforeDestroy();
|
|
2217
2237
|
this.datasource.destroy();
|
|
2218
2238
|
}
|
|
2219
|
-
}
|
|
2239
|
+
}
|
|
2240
|
+
InputFactory.register('ZdCheckboxMultiple', CheckboxMultiple);
|
|
2220
2241
|
|
|
2221
2242
|
/**
|
|
2222
2243
|
* Base class for Chip component.
|
|
@@ -2703,10 +2724,15 @@
|
|
|
2703
2724
|
* Defines text input value should concat the suffix text.
|
|
2704
2725
|
*/
|
|
2705
2726
|
this.valueWithSuffix = textInputDefaults.valueWithSuffix;
|
|
2727
|
+
/**
|
|
2728
|
+
* Defines clicks on outer icon should focus the component.
|
|
2729
|
+
*/
|
|
2730
|
+
this.focusOnOuterIconClick = true;
|
|
2706
2731
|
this.formatterFn = core.FormatterParserProvider.getFormatter('ZdTextInput');
|
|
2707
2732
|
this.parserFn = core.FormatterParserProvider.getParser('ZdTextInput');
|
|
2708
2733
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, this.appendIcon);
|
|
2709
2734
|
this.appendOuterIcon = this.getInitValue('appendOuterIcon', props.appendOuterIcon, this.appendOuterIcon);
|
|
2735
|
+
this.focusOnOuterIconClick = this.getInitValue('focusOnOuterIconClick', props.focusOnOuterIconClick, this.focusOnOuterIconClick);
|
|
2710
2736
|
this.prefix = this.getInitValue('prefix', props.prefix, this.prefix);
|
|
2711
2737
|
this.prependIcon = this.getInitValue('prependIcon', props.prependIcon, this.prependIcon);
|
|
2712
2738
|
this.prependOuterIcon = this.getInitValue('prependOuterIcon', props.prependOuterIcon, this.prependOuterIcon);
|
|
@@ -2812,7 +2838,8 @@
|
|
|
2812
2838
|
formatted = prefixValue + formatted + suffixValue;
|
|
2813
2839
|
}
|
|
2814
2840
|
return formatted;
|
|
2815
|
-
});
|
|
2841
|
+
});
|
|
2842
|
+
InputFactory.register('ZdTextInput', TextInput);
|
|
2816
2843
|
|
|
2817
2844
|
/**
|
|
2818
2845
|
* Base class for Number component
|
|
@@ -2922,7 +2949,8 @@
|
|
|
2922
2949
|
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2923
2950
|
maskValue = Object.assign(Object.assign({}, core.Config.masks.numberMask), maskValue);
|
|
2924
2951
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2925
|
-
});
|
|
2952
|
+
});
|
|
2953
|
+
InputFactory.register('ZdNumber', Number$1);
|
|
2926
2954
|
|
|
2927
2955
|
/**
|
|
2928
2956
|
* Base class for Currency component
|
|
@@ -2958,7 +2986,8 @@
|
|
|
2958
2986
|
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2959
2987
|
maskValue = Object.assign(Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), maskValue);
|
|
2960
2988
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2961
|
-
});
|
|
2989
|
+
});
|
|
2990
|
+
InputFactory.register('ZdCurrency', Currency);
|
|
2962
2991
|
|
|
2963
2992
|
class AlertQueue {
|
|
2964
2993
|
constructor() {
|
|
@@ -4216,7 +4245,8 @@
|
|
|
4216
4245
|
return core.dayjs(value, displayFormat).format(dateTimeFormat);
|
|
4217
4246
|
}
|
|
4218
4247
|
return value;
|
|
4219
|
-
});
|
|
4248
|
+
});
|
|
4249
|
+
InputFactory.register('ZdDate', Date$1);
|
|
4220
4250
|
|
|
4221
4251
|
class DateRange extends TextInput {
|
|
4222
4252
|
/* istanbul ignore next */
|
|
@@ -4680,7 +4710,8 @@
|
|
|
4680
4710
|
}
|
|
4681
4711
|
});
|
|
4682
4712
|
return formattedValue;
|
|
4683
|
-
});
|
|
4713
|
+
});
|
|
4714
|
+
InputFactory.register('ZdDateRange', DateRange);
|
|
4684
4715
|
|
|
4685
4716
|
/**
|
|
4686
4717
|
* Base class for Divider component.
|
|
@@ -4949,8 +4980,12 @@
|
|
|
4949
4980
|
this.rules = Object.keys(this.parsedValidations)
|
|
4950
4981
|
.map((key) => {
|
|
4951
4982
|
const validation = this.parsedValidations[key];
|
|
4952
|
-
if (key !== 'maxFileSize')
|
|
4953
|
-
return () =>
|
|
4983
|
+
if (key !== 'maxFileSize') {
|
|
4984
|
+
return (value) => {
|
|
4985
|
+
const testValue = value !== undefined ? value : this.value;
|
|
4986
|
+
return validation(testValue);
|
|
4987
|
+
};
|
|
4988
|
+
}
|
|
4954
4989
|
return () => {
|
|
4955
4990
|
if (this.viewGetFileSizes) {
|
|
4956
4991
|
const fileSizes = this.viewGetFileSizes();
|
|
@@ -4972,7 +5007,8 @@
|
|
|
4972
5007
|
});
|
|
4973
5008
|
const message = core.I18n.translate((config.message || 'VALIDATION_FILE_SIZE'), { fileError });
|
|
4974
5009
|
return (fileError === '') || message;
|
|
4975
|
-
});
|
|
5010
|
+
});
|
|
5011
|
+
InputFactory.register('ZdFileInput', FileInput);
|
|
4976
5012
|
|
|
4977
5013
|
/**
|
|
4978
5014
|
* Base class for Footer component.
|
|
@@ -5752,12 +5788,12 @@
|
|
|
5752
5788
|
const { dataText, formatterDataText, dataTextSeparator, dataValue, } = componentProps;
|
|
5753
5789
|
let currentRow = row;
|
|
5754
5790
|
if (dataValue) {
|
|
5791
|
+
const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
|
|
5792
|
+
const columns = Array.isArray(formatterDataText) ? formatterDataText : [formatterDataText];
|
|
5755
5793
|
if (!formatterDataText) {
|
|
5756
5794
|
currentRow = column.getLookupData(dataValue, value[dataValue] || value);
|
|
5757
5795
|
}
|
|
5758
|
-
else {
|
|
5759
|
-
const columns = Array.isArray(formatterDataText) ? formatterDataText : [formatterDataText];
|
|
5760
|
-
const dataTextColumns = Array.isArray(dataText) ? dataText : [dataText];
|
|
5796
|
+
else if (columns.length === dataTextColumns.length) {
|
|
5761
5797
|
const loopkupRow = {};
|
|
5762
5798
|
columns.forEach((item, index) => {
|
|
5763
5799
|
const dataTextValue = dataTextColumns[index];
|
|
@@ -6015,7 +6051,7 @@
|
|
|
6015
6051
|
},
|
|
6016
6052
|
tab: {
|
|
6017
6053
|
event: this.navigateRight.bind(this),
|
|
6018
|
-
prevent:
|
|
6054
|
+
prevent: false,
|
|
6019
6055
|
active: true,
|
|
6020
6056
|
index: 99,
|
|
6021
6057
|
input: true,
|
|
@@ -6023,7 +6059,7 @@
|
|
|
6023
6059
|
},
|
|
6024
6060
|
'shift+tab': {
|
|
6025
6061
|
event: this.navigateLeft.bind(this),
|
|
6026
|
-
prevent:
|
|
6062
|
+
prevent: false,
|
|
6027
6063
|
active: true,
|
|
6028
6064
|
index: 99,
|
|
6029
6065
|
input: true,
|
|
@@ -6274,51 +6310,58 @@
|
|
|
6274
6310
|
arrSelection.splice(index, 1);
|
|
6275
6311
|
}
|
|
6276
6312
|
}
|
|
6277
|
-
navigateLeft() {
|
|
6313
|
+
navigateLeft({ event }) {
|
|
6278
6314
|
if (!this.viewNavigate)
|
|
6279
6315
|
return;
|
|
6280
|
-
this.viewNavigate('left');
|
|
6316
|
+
this.viewNavigate('left', event);
|
|
6281
6317
|
}
|
|
6282
|
-
navigateRight() {
|
|
6318
|
+
navigateRight({ event }) {
|
|
6283
6319
|
if (!this.viewNavigate)
|
|
6284
6320
|
return;
|
|
6285
|
-
this.viewNavigate('right');
|
|
6321
|
+
this.viewNavigate('right', event);
|
|
6286
6322
|
}
|
|
6287
6323
|
navigateUp() {
|
|
6288
|
-
if (this.
|
|
6289
|
-
this.viewNavigate('up');
|
|
6290
|
-
return;
|
|
6291
|
-
}
|
|
6292
|
-
const { uniqueKey, currentRow } = this.datasource;
|
|
6293
|
-
const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
|
|
6294
|
-
if (rowIndex === -1) {
|
|
6295
|
-
this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
|
|
6296
|
-
[this.currentColumn] = this.columns;
|
|
6297
|
-
return;
|
|
6298
|
-
}
|
|
6299
|
-
if (rowIndex === 0) {
|
|
6300
|
-
this.navigatePageDown();
|
|
6324
|
+
if (!this.viewNavigate)
|
|
6301
6325
|
return;
|
|
6302
|
-
|
|
6303
|
-
this.datasource.currentRow = this.datasource.data[rowIndex - 1];
|
|
6326
|
+
this.viewNavigate('up');
|
|
6304
6327
|
}
|
|
6305
6328
|
navigateDown() {
|
|
6306
|
-
if (this.
|
|
6307
|
-
this.viewNavigate('down');
|
|
6329
|
+
if (!this.viewNavigate)
|
|
6308
6330
|
return;
|
|
6309
|
-
|
|
6331
|
+
this.viewNavigate('down');
|
|
6332
|
+
}
|
|
6333
|
+
navigateDatasource(up) {
|
|
6310
6334
|
const { uniqueKey, currentRow } = this.datasource;
|
|
6311
6335
|
const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
|
|
6312
6336
|
if (rowIndex === -1) {
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6337
|
+
return this.navigateInitial(up);
|
|
6338
|
+
}
|
|
6339
|
+
if (up && rowIndex === 0) {
|
|
6340
|
+
return this.navigatePageDown();
|
|
6316
6341
|
}
|
|
6317
|
-
if (rowIndex === this.datasource.data.length - 1) {
|
|
6318
|
-
this.navigatePageUp();
|
|
6342
|
+
if (!up && rowIndex === this.datasource.data.length - 1) {
|
|
6343
|
+
return this.navigatePageUp();
|
|
6344
|
+
}
|
|
6345
|
+
return this.navigateCurrentRow(up, rowIndex);
|
|
6346
|
+
}
|
|
6347
|
+
navigateCurrentRow(up, rowIndex) {
|
|
6348
|
+
const addIndex = up ? -1 : 1;
|
|
6349
|
+
this.datasource.currentRow = this.datasource.data[rowIndex + addIndex];
|
|
6350
|
+
}
|
|
6351
|
+
navigateInitial(up) {
|
|
6352
|
+
if (up) {
|
|
6353
|
+
this.navigateLast();
|
|
6319
6354
|
return;
|
|
6320
6355
|
}
|
|
6321
|
-
this.
|
|
6356
|
+
this.navigateFirst();
|
|
6357
|
+
}
|
|
6358
|
+
navigateFirst() {
|
|
6359
|
+
[this.datasource.currentRow] = this.datasource.data;
|
|
6360
|
+
[this.currentColumn] = this.columns;
|
|
6361
|
+
}
|
|
6362
|
+
navigateLast() {
|
|
6363
|
+
this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
|
|
6364
|
+
[this.currentColumn] = this.columns;
|
|
6322
6365
|
}
|
|
6323
6366
|
navigatePageUp() {
|
|
6324
6367
|
if (this.datasource.page < Math.ceil(this.datasource.total / this.datasource.limit)) {
|
|
@@ -6496,6 +6539,7 @@
|
|
|
6496
6539
|
active: true,
|
|
6497
6540
|
},
|
|
6498
6541
|
};
|
|
6542
|
+
this.viewEnterEdit = null;
|
|
6499
6543
|
this.newRowIdentifier = '__added_row';
|
|
6500
6544
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
6501
6545
|
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
@@ -6503,6 +6547,9 @@
|
|
|
6503
6547
|
this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
|
|
6504
6548
|
this.createAccessors();
|
|
6505
6549
|
}
|
|
6550
|
+
setViewEnterEdit(viewEnterEdit) {
|
|
6551
|
+
this.viewEnterEdit = viewEnterEdit;
|
|
6552
|
+
}
|
|
6506
6553
|
onMounted(element) {
|
|
6507
6554
|
super.onMounted(element);
|
|
6508
6555
|
core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
|
|
@@ -6853,6 +6900,9 @@
|
|
|
6853
6900
|
if (!revalidate) {
|
|
6854
6901
|
return Object.keys(this.invalidComponents).length === 0;
|
|
6855
6902
|
}
|
|
6903
|
+
if (!this.editing) {
|
|
6904
|
+
return this.isViewGridValid();
|
|
6905
|
+
}
|
|
6856
6906
|
let allValid = true;
|
|
6857
6907
|
this.datasource.data.forEach((row) => this.columns.forEach((column) => {
|
|
6858
6908
|
if (!column.isVisible || !column.editable)
|
|
@@ -6862,6 +6912,38 @@
|
|
|
6862
6912
|
}));
|
|
6863
6913
|
return allValid;
|
|
6864
6914
|
}
|
|
6915
|
+
/**
|
|
6916
|
+
* Checks whether the grid is valid while not in editing mode
|
|
6917
|
+
*/
|
|
6918
|
+
isViewGridValid(forceEditing = true) {
|
|
6919
|
+
const invalidCompNames = [];
|
|
6920
|
+
const componentInstances = {};
|
|
6921
|
+
const editableColumns = this.columns.filter((column) => column.editable && column.isVisible);
|
|
6922
|
+
editableColumns.forEach((column) => {
|
|
6923
|
+
const compName = this.getCompName('temp', column.name);
|
|
6924
|
+
const componentProps = Object.assign(Object.assign({}, column.componentProps), { name: compName });
|
|
6925
|
+
componentInstances[column.name] = InputFactory.factory(componentProps);
|
|
6926
|
+
});
|
|
6927
|
+
this.datasource.data.forEach((row) => {
|
|
6928
|
+
const key = row[this.datasource.uniqueKey];
|
|
6929
|
+
editableColumns.forEach((column) => {
|
|
6930
|
+
const instance = componentInstances[column.name];
|
|
6931
|
+
if (!instance.isValid(row[column.name])) {
|
|
6932
|
+
invalidCompNames.push(this.getCompName(key, column.name));
|
|
6933
|
+
}
|
|
6934
|
+
});
|
|
6935
|
+
});
|
|
6936
|
+
if (invalidCompNames.length > 0 && forceEditing) {
|
|
6937
|
+
this.editing = true;
|
|
6938
|
+
core.ViewService.nextTick(() => {
|
|
6939
|
+
invalidCompNames.forEach((compName) => {
|
|
6940
|
+
const invalidComponent = core.Metadata.getInstance(compName);
|
|
6941
|
+
invalidComponent.validate();
|
|
6942
|
+
});
|
|
6943
|
+
});
|
|
6944
|
+
}
|
|
6945
|
+
return invalidCompNames.length === 0;
|
|
6946
|
+
}
|
|
6865
6947
|
/**
|
|
6866
6948
|
* Adds new row to the datasource data and pushes it to the editedRows
|
|
6867
6949
|
* @param row Row
|
|
@@ -6992,6 +7074,15 @@
|
|
|
6992
7074
|
delete rows[foundRow[uniqueKey]];
|
|
6993
7075
|
this.editedRows = rows;
|
|
6994
7076
|
}
|
|
7077
|
+
/**
|
|
7078
|
+
* Makes the cell enter edit mode
|
|
7079
|
+
*/
|
|
7080
|
+
enterEdit(rowKey, columnName) {
|
|
7081
|
+
if (!this.viewEnterEdit) {
|
|
7082
|
+
throw new Error('viewEnterEdit method not assigned');
|
|
7083
|
+
}
|
|
7084
|
+
this.viewEnterEdit(rowKey, columnName);
|
|
7085
|
+
}
|
|
6995
7086
|
}
|
|
6996
7087
|
|
|
6997
7088
|
/**
|
|
@@ -7347,7 +7438,8 @@
|
|
|
7347
7438
|
this.value -= this.step;
|
|
7348
7439
|
}
|
|
7349
7440
|
}
|
|
7350
|
-
}
|
|
7441
|
+
}
|
|
7442
|
+
InputFactory.register('ZdIncrement', Increment);
|
|
7351
7443
|
|
|
7352
7444
|
class IterableColumnsButtonController {
|
|
7353
7445
|
constructor(iterableComponent) {
|
|
@@ -8032,7 +8124,8 @@
|
|
|
8032
8124
|
}
|
|
8033
8125
|
return result;
|
|
8034
8126
|
}, '');
|
|
8035
|
-
});
|
|
8127
|
+
});
|
|
8128
|
+
InputFactory.register('ZdSelect', Select);
|
|
8036
8129
|
|
|
8037
8130
|
/**
|
|
8038
8131
|
* Base class for Iterable Page Size component
|
|
@@ -8199,7 +8292,8 @@
|
|
|
8199
8292
|
yield this.iterableComponent.setSearch(search);
|
|
8200
8293
|
});
|
|
8201
8294
|
}
|
|
8202
|
-
}
|
|
8295
|
+
}
|
|
8296
|
+
InputFactory.register('ZdSearch', Search);
|
|
8203
8297
|
|
|
8204
8298
|
/**
|
|
8205
8299
|
* Base class for IterableComponentRender component.
|
|
@@ -9457,12 +9551,14 @@
|
|
|
9457
9551
|
*/
|
|
9458
9552
|
show() {
|
|
9459
9553
|
this.isVisible = true;
|
|
9554
|
+
core.ViewService.nextTick(() => this.callEvent('onShow', { component: this }));
|
|
9460
9555
|
}
|
|
9461
9556
|
/**
|
|
9462
9557
|
* Closes modal
|
|
9463
9558
|
*/
|
|
9464
9559
|
hide() {
|
|
9465
9560
|
this.isVisible = false;
|
|
9561
|
+
core.ViewService.nextTick(() => this.callEvent('onHide', { component: this }));
|
|
9466
9562
|
}
|
|
9467
9563
|
}
|
|
9468
9564
|
|
|
@@ -9633,7 +9729,8 @@
|
|
|
9633
9729
|
}
|
|
9634
9730
|
}
|
|
9635
9731
|
}
|
|
9636
|
-
core.FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
|
|
9732
|
+
core.FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
|
|
9733
|
+
InputFactory.register('ZdPassword', Password);
|
|
9637
9734
|
|
|
9638
9735
|
/**
|
|
9639
9736
|
* Base class for Progress component
|
|
@@ -9728,7 +9825,8 @@
|
|
|
9728
9825
|
super.onBeforeDestroy();
|
|
9729
9826
|
this.datasource.destroy();
|
|
9730
9827
|
}
|
|
9731
|
-
}
|
|
9828
|
+
}
|
|
9829
|
+
InputFactory.register('ZdRadio', Radio);
|
|
9732
9830
|
|
|
9733
9831
|
/**
|
|
9734
9832
|
* Base class for Range Slider component
|
|
@@ -9825,7 +9923,8 @@
|
|
|
9825
9923
|
set value(value) {
|
|
9826
9924
|
this.rangeSliderValue = value;
|
|
9827
9925
|
}
|
|
9828
|
-
}
|
|
9926
|
+
}
|
|
9927
|
+
InputFactory.register('ZdRangeSlider', RangeSlider);
|
|
9829
9928
|
|
|
9830
9929
|
/**
|
|
9831
9930
|
* Base class for Row component.
|
|
@@ -10252,11 +10351,12 @@
|
|
|
10252
10351
|
*/
|
|
10253
10352
|
updateRules() {
|
|
10254
10353
|
this.rules = Object.keys(this.parsedValidations)
|
|
10255
|
-
.map((key) => () => {
|
|
10354
|
+
.map((key) => (value) => {
|
|
10355
|
+
const testValue = value !== undefined ? value : this.value;
|
|
10256
10356
|
const validation = this.parsedValidations[key];
|
|
10257
10357
|
if (key !== 'required')
|
|
10258
|
-
return validation(
|
|
10259
|
-
return validation((this.checkboxAll && 'all') ||
|
|
10358
|
+
return validation(testValue);
|
|
10359
|
+
return validation((this.checkboxAll && 'all') || testValue);
|
|
10260
10360
|
});
|
|
10261
10361
|
}
|
|
10262
10362
|
}
|
|
@@ -11086,7 +11186,8 @@
|
|
|
11086
11186
|
this.setValue(filteredNode.id);
|
|
11087
11187
|
}
|
|
11088
11188
|
}
|
|
11089
|
-
}
|
|
11189
|
+
}
|
|
11190
|
+
InputFactory.register('ZdSelectTree', SelectTree);
|
|
11090
11191
|
|
|
11091
11192
|
/**
|
|
11092
11193
|
* Base class for Select Tree Multiple component.
|
|
@@ -11536,7 +11637,8 @@
|
|
|
11536
11637
|
this.inset = this.getInitValue('inset', props.inset, this.inset);
|
|
11537
11638
|
this.createAccessors();
|
|
11538
11639
|
}
|
|
11539
|
-
}
|
|
11640
|
+
}
|
|
11641
|
+
InputFactory.register('ZdSwitch', Switch);
|
|
11540
11642
|
|
|
11541
11643
|
/**
|
|
11542
11644
|
* Base class for Table component.
|
|
@@ -11874,7 +11976,8 @@
|
|
|
11874
11976
|
this.addValidation('maxLength', { limit: parseInt(this.counter.toString(), 10) });
|
|
11875
11977
|
}
|
|
11876
11978
|
}
|
|
11877
|
-
}
|
|
11979
|
+
}
|
|
11980
|
+
InputFactory.register('ZdTextarea', Textarea);
|
|
11878
11981
|
|
|
11879
11982
|
/**
|
|
11880
11983
|
* Selects the time format by the rule:
|
|
@@ -12262,7 +12365,8 @@
|
|
|
12262
12365
|
}
|
|
12263
12366
|
}
|
|
12264
12367
|
return value;
|
|
12265
|
-
});
|
|
12368
|
+
});
|
|
12369
|
+
InputFactory.register('ZdTime', Time);
|
|
12266
12370
|
|
|
12267
12371
|
/**
|
|
12268
12372
|
* Base class for Tooltip component.
|
|
@@ -12907,45 +13011,28 @@
|
|
|
12907
13011
|
navigateToggle(collapse) {
|
|
12908
13012
|
this.treeDataStructure.navigateToggle(collapse);
|
|
12909
13013
|
}
|
|
12910
|
-
|
|
12911
|
-
* Navigate upwards
|
|
12912
|
-
*/
|
|
12913
|
-
navigateUp() {
|
|
12914
|
-
if (this.cellSelection && this.viewNavigate) {
|
|
12915
|
-
this.viewNavigate('up');
|
|
12916
|
-
return;
|
|
12917
|
-
}
|
|
13014
|
+
navigateDatasource(up) {
|
|
12918
13015
|
const { uniqueKey, currentRow } = this.datasource;
|
|
12919
13016
|
const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
|
|
12920
|
-
if (
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
13017
|
+
if (up) {
|
|
13018
|
+
if (rowIndex === -1) {
|
|
13019
|
+
const lastOpenedRowIdx = this.treeDataStructure.previousOpenedRow(this.datasource.data.length);
|
|
13020
|
+
this.datasource.currentRow = this.datasource.data[lastOpenedRowIdx];
|
|
13021
|
+
return;
|
|
13022
|
+
}
|
|
12925
13023
|
const previousRowIdx = this.treeDataStructure.previousOpenedRow(rowIndex);
|
|
12926
13024
|
if (previousRowIdx > -1) {
|
|
12927
13025
|
this.datasource.currentRow = this.datasource.data[previousRowIdx];
|
|
12928
13026
|
}
|
|
12929
|
-
}
|
|
12930
|
-
}
|
|
12931
|
-
/**
|
|
12932
|
-
* Navigate downwards
|
|
12933
|
-
*/
|
|
12934
|
-
navigateDown() {
|
|
12935
|
-
if (this.cellSelection && this.viewNavigate) {
|
|
12936
|
-
this.viewNavigate('down');
|
|
12937
13027
|
return;
|
|
12938
13028
|
}
|
|
12939
|
-
const { uniqueKey, currentRow } = this.datasource;
|
|
12940
|
-
const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
|
|
12941
13029
|
if (rowIndex === -1) {
|
|
12942
13030
|
[this.datasource.currentRow] = this.datasource.data;
|
|
13031
|
+
return;
|
|
12943
13032
|
}
|
|
12944
|
-
|
|
12945
|
-
|
|
12946
|
-
|
|
12947
|
-
this.datasource.currentRow = this.datasource.data[nextRowIdx];
|
|
12948
|
-
}
|
|
13033
|
+
const nextRowIdx = this.treeDataStructure.nextOpenedRow(rowIndex);
|
|
13034
|
+
if (nextRowIdx > -1) {
|
|
13035
|
+
this.datasource.currentRow = this.datasource.data[nextRowIdx];
|
|
12949
13036
|
}
|
|
12950
13037
|
}
|
|
12951
13038
|
removeDuplicates(arr, key) {
|
|
@@ -13085,12 +13172,16 @@
|
|
|
13085
13172
|
active: true,
|
|
13086
13173
|
},
|
|
13087
13174
|
};
|
|
13175
|
+
this.viewEnterEdit = null;
|
|
13088
13176
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
13089
13177
|
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
13090
13178
|
this.singleEdit = this.getInitValue('singleEdit', props.singleEdit, this.singleEdit);
|
|
13091
13179
|
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
13092
13180
|
this.createAccessors();
|
|
13093
13181
|
}
|
|
13182
|
+
setViewEnterEdit(viewEnterEdit) {
|
|
13183
|
+
this.viewEnterEdit = viewEnterEdit;
|
|
13184
|
+
}
|
|
13094
13185
|
onMounted(element) {
|
|
13095
13186
|
super.onMounted(element);
|
|
13096
13187
|
core.KeyMap.bind(this.cancelEditedRowsKeyMapping, this, element);
|
|
@@ -13534,6 +13625,15 @@
|
|
|
13534
13625
|
delete rows[foundRow[uniqueKey]];
|
|
13535
13626
|
this.editedRows = rows;
|
|
13536
13627
|
}
|
|
13628
|
+
/**
|
|
13629
|
+
* Makes the cell enter edit mode
|
|
13630
|
+
*/
|
|
13631
|
+
enterEdit(rowKey, columnName) {
|
|
13632
|
+
if (!this.viewEnterEdit) {
|
|
13633
|
+
throw new Error('viewEnterEdit method not assigned');
|
|
13634
|
+
}
|
|
13635
|
+
this.viewEnterEdit(rowKey, columnName);
|
|
13636
|
+
}
|
|
13537
13637
|
}
|
|
13538
13638
|
|
|
13539
13639
|
class Icons {
|
|
@@ -14672,6 +14772,52 @@
|
|
|
14672
14772
|
}
|
|
14673
14773
|
}
|
|
14674
14774
|
|
|
14775
|
+
/**
|
|
14776
|
+
* Class used to format grouped data into the ZhReports format
|
|
14777
|
+
*/
|
|
14778
|
+
class GroupedPDFFormatter {
|
|
14779
|
+
format(data) {
|
|
14780
|
+
return data.map((item) => {
|
|
14781
|
+
if (this.isGroupHeader(item)) {
|
|
14782
|
+
return {
|
|
14783
|
+
__group: item.group,
|
|
14784
|
+
__groupHeader: item.groupHeader,
|
|
14785
|
+
__groupFooter: false,
|
|
14786
|
+
__groupIndex: item.groupIndex,
|
|
14787
|
+
__groupLabel: item.groupLabel,
|
|
14788
|
+
__groupValue: item.groupValue,
|
|
14789
|
+
__groupOpened: item.groupOpened,
|
|
14790
|
+
};
|
|
14791
|
+
}
|
|
14792
|
+
if (this.isGroupFooter(item)) {
|
|
14793
|
+
const groupKeys = ['groupFooter', 'groupIndex', 'groupHeaders', 'groupLabel', 'groupValue', 'groupSummary'];
|
|
14794
|
+
const totalColumnNames = Object.keys(item).filter((key) => !groupKeys.includes(key));
|
|
14795
|
+
const result = {
|
|
14796
|
+
__group: true,
|
|
14797
|
+
__groupFooter: item.groupFooter,
|
|
14798
|
+
__groupIndex: item.groupIndex,
|
|
14799
|
+
__groupLabel: item.groupLabel,
|
|
14800
|
+
__groupValue: item.groupValue,
|
|
14801
|
+
__groupSummary: !!item.groupSummary,
|
|
14802
|
+
};
|
|
14803
|
+
totalColumnNames.forEach((name) => {
|
|
14804
|
+
result[name] = item[name];
|
|
14805
|
+
});
|
|
14806
|
+
return result;
|
|
14807
|
+
}
|
|
14808
|
+
const dataItem = Object.assign({}, item);
|
|
14809
|
+
delete dataItem.groupHeaders;
|
|
14810
|
+
return dataItem;
|
|
14811
|
+
});
|
|
14812
|
+
}
|
|
14813
|
+
isGroupHeader(entry) {
|
|
14814
|
+
return entry.groupHeader === true;
|
|
14815
|
+
}
|
|
14816
|
+
isGroupFooter(entry) {
|
|
14817
|
+
return entry.groupFooter === true;
|
|
14818
|
+
}
|
|
14819
|
+
}
|
|
14820
|
+
|
|
14675
14821
|
class Report {
|
|
14676
14822
|
constructor(iterable, title) {
|
|
14677
14823
|
this.endPoint = core.Config.reportsEndPoint;
|
|
@@ -14728,7 +14874,7 @@
|
|
|
14728
14874
|
const { route } = reportType;
|
|
14729
14875
|
const { name, columns, datasource } = this.iterable;
|
|
14730
14876
|
const { groupedData } = Object.assign({}, this.iterable);
|
|
14731
|
-
const formattedColumns = this.
|
|
14877
|
+
const formattedColumns = this.filterColumns(columns);
|
|
14732
14878
|
const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
|
|
14733
14879
|
let dataset;
|
|
14734
14880
|
if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
|
|
@@ -14736,6 +14882,11 @@
|
|
|
14736
14882
|
const metadataObjClone = merge__default["default"](rowMetadata, JSON.parse(metadataObj));
|
|
14737
14883
|
dataset = reportType.buildDataset(groupedData, metadataObjClone);
|
|
14738
14884
|
}
|
|
14885
|
+
else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
|
|
14886
|
+
const formatter = new GroupedPDFFormatter();
|
|
14887
|
+
const pdfGroupedData = formatter.format(groupedData);
|
|
14888
|
+
dataset = reportType.buildDataset(pdfGroupedData);
|
|
14889
|
+
}
|
|
14739
14890
|
else {
|
|
14740
14891
|
dataset = reportType.buildDataset(data, formattedColumns);
|
|
14741
14892
|
}
|
|
@@ -14766,7 +14917,7 @@
|
|
|
14766
14917
|
return new URL(reportFile, this.fileEndPoint).href;
|
|
14767
14918
|
});
|
|
14768
14919
|
}
|
|
14769
|
-
|
|
14920
|
+
filterColumns(columns) {
|
|
14770
14921
|
return columns.filter((item) => (item.type !== 'action' && item.isVisible));
|
|
14771
14922
|
}
|
|
14772
14923
|
}
|
|
@@ -14815,12 +14966,14 @@
|
|
|
14815
14966
|
exports.GridColumn = GridColumn;
|
|
14816
14967
|
exports.GridColumnEditable = GridColumnEditable;
|
|
14817
14968
|
exports.GridEditable = GridEditable;
|
|
14969
|
+
exports.GroupedPDFFormatter = GroupedPDFFormatter;
|
|
14818
14970
|
exports.Header = Header;
|
|
14819
14971
|
exports.Icon = Icon;
|
|
14820
14972
|
exports.Icons = Icons;
|
|
14821
14973
|
exports.Image = Image;
|
|
14822
14974
|
exports.Increment = Increment;
|
|
14823
14975
|
exports.Input = Input;
|
|
14976
|
+
exports.InputFactory = InputFactory;
|
|
14824
14977
|
exports.Iterable = Iterable;
|
|
14825
14978
|
exports.IterableColumnsButton = IterableColumnsButton;
|
|
14826
14979
|
exports.IterableColumnsButtonController = IterableColumnsButtonController;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.96.
|
|
3
|
+
"version": "1.96.2",
|
|
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": "02a1782aa3a4e4c0bdbf29c41297467071e6e132"
|
|
47
47
|
}
|
|
@@ -70,6 +70,7 @@ export * from './zd-increment/increment';
|
|
|
70
70
|
export * from './zd-increment/interfaces';
|
|
71
71
|
export * from './zd-input/input';
|
|
72
72
|
export * from './zd-input/interfaces';
|
|
73
|
+
export * from './zd-input/input-factory';
|
|
73
74
|
export * from './zd-iterable/column';
|
|
74
75
|
export * from './zd-iterable/iterable';
|
|
75
76
|
export * from './zd-iterable/column-not-found';
|