@zeedhi/common 1.95.1 → 1.96.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 +300 -102
- package/dist/zd-common.umd.js +300 -100
- package/package.json +2 -2
- package/types/components/index.d.ts +1 -0
- package/types/components/zd-file-input/file-input.d.ts +3 -0
- package/types/components/zd-grid/grid-editable.d.ts +6 -1
- 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 +6 -6
- package/types/components/zd-modal/interfaces.d.ts +9 -1
- package/types/components/zd-modal/modal.d.ts +5 -1
- package/types/components/zd-select/interfaces.d.ts +1 -1
- package/types/components/zd-select/select.d.ts +10 -1
- package/types/components/zd-select-multiple/interfaces.d.ts +2 -0
- package/types/components/zd-select-multiple/select-multiple.d.ts +8 -0
- 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 +2 -1
- 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
|
@@ -1982,7 +1982,9 @@
|
|
|
1982
1982
|
*/
|
|
1983
1983
|
addValidation(name, config) {
|
|
1984
1984
|
const validation = core.Validation.get(name)(config);
|
|
1985
|
-
|
|
1985
|
+
if (config) {
|
|
1986
|
+
this.validations[name] = config;
|
|
1987
|
+
}
|
|
1986
1988
|
this.parsedValidations[name] = validation;
|
|
1987
1989
|
this.updateRules();
|
|
1988
1990
|
}
|
|
@@ -2008,7 +2010,10 @@
|
|
|
2008
2010
|
*/
|
|
2009
2011
|
updateRules() {
|
|
2010
2012
|
this.rules = Object.values(this.parsedValidations)
|
|
2011
|
-
.map((validation) => () =>
|
|
2013
|
+
.map((validation) => (value) => {
|
|
2014
|
+
const testValue = value !== undefined ? value : this.value;
|
|
2015
|
+
return validation(testValue);
|
|
2016
|
+
});
|
|
2012
2017
|
}
|
|
2013
2018
|
/**
|
|
2014
2019
|
* Input value.
|
|
@@ -2061,8 +2066,11 @@
|
|
|
2061
2066
|
* Checks the input value are valid to all applied rules.
|
|
2062
2067
|
* @returns Input is valid
|
|
2063
2068
|
*/
|
|
2064
|
-
isValid() {
|
|
2065
|
-
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
|
+
});
|
|
2066
2074
|
}
|
|
2067
2075
|
/**
|
|
2068
2076
|
* Triggered when the input value changes.
|
|
@@ -2147,6 +2155,19 @@
|
|
|
2147
2155
|
}
|
|
2148
2156
|
}
|
|
2149
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
|
+
|
|
2150
2171
|
/**
|
|
2151
2172
|
* Base class for Checkbox component.
|
|
2152
2173
|
*/
|
|
@@ -2161,7 +2182,8 @@
|
|
|
2161
2182
|
this.showHelper = false;
|
|
2162
2183
|
this.createAccessors();
|
|
2163
2184
|
}
|
|
2164
|
-
}
|
|
2185
|
+
}
|
|
2186
|
+
InputFactory.register('ZdCheckbox', Checkbox);
|
|
2165
2187
|
|
|
2166
2188
|
/**
|
|
2167
2189
|
* Base class for Checkbox multiple component.
|
|
@@ -2214,7 +2236,8 @@
|
|
|
2214
2236
|
super.onBeforeDestroy();
|
|
2215
2237
|
this.datasource.destroy();
|
|
2216
2238
|
}
|
|
2217
|
-
}
|
|
2239
|
+
}
|
|
2240
|
+
InputFactory.register('ZdCheckboxMultiple', CheckboxMultiple);
|
|
2218
2241
|
|
|
2219
2242
|
/**
|
|
2220
2243
|
* Base class for Chip component.
|
|
@@ -2701,10 +2724,15 @@
|
|
|
2701
2724
|
* Defines text input value should concat the suffix text.
|
|
2702
2725
|
*/
|
|
2703
2726
|
this.valueWithSuffix = textInputDefaults.valueWithSuffix;
|
|
2727
|
+
/**
|
|
2728
|
+
* Defines clicks on outer icon should focus the component.
|
|
2729
|
+
*/
|
|
2730
|
+
this.focusOnOuterIconClick = true;
|
|
2704
2731
|
this.formatterFn = core.FormatterParserProvider.getFormatter('ZdTextInput');
|
|
2705
2732
|
this.parserFn = core.FormatterParserProvider.getParser('ZdTextInput');
|
|
2706
2733
|
this.appendIcon = this.getInitValue('appendIcon', props.appendIcon, this.appendIcon);
|
|
2707
2734
|
this.appendOuterIcon = this.getInitValue('appendOuterIcon', props.appendOuterIcon, this.appendOuterIcon);
|
|
2735
|
+
this.focusOnOuterIconClick = this.getInitValue('focusOnOuterIconClick', props.focusOnOuterIconClick, this.focusOnOuterIconClick);
|
|
2708
2736
|
this.prefix = this.getInitValue('prefix', props.prefix, this.prefix);
|
|
2709
2737
|
this.prependIcon = this.getInitValue('prependIcon', props.prependIcon, this.prependIcon);
|
|
2710
2738
|
this.prependOuterIcon = this.getInitValue('prependOuterIcon', props.prependOuterIcon, this.prependOuterIcon);
|
|
@@ -2810,7 +2838,8 @@
|
|
|
2810
2838
|
formatted = prefixValue + formatted + suffixValue;
|
|
2811
2839
|
}
|
|
2812
2840
|
return formatted;
|
|
2813
|
-
});
|
|
2841
|
+
});
|
|
2842
|
+
InputFactory.register('ZdTextInput', TextInput);
|
|
2814
2843
|
|
|
2815
2844
|
/**
|
|
2816
2845
|
* Base class for Number component
|
|
@@ -2920,7 +2949,8 @@
|
|
|
2920
2949
|
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2921
2950
|
maskValue = Object.assign(Object.assign({}, core.Config.masks.numberMask), maskValue);
|
|
2922
2951
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2923
|
-
});
|
|
2952
|
+
});
|
|
2953
|
+
InputFactory.register('ZdNumber', Number$1);
|
|
2924
2954
|
|
|
2925
2955
|
/**
|
|
2926
2956
|
* Base class for Currency component
|
|
@@ -2956,7 +2986,8 @@
|
|
|
2956
2986
|
let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
|
|
2957
2987
|
maskValue = Object.assign(Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), maskValue);
|
|
2958
2988
|
return value === '' ? null : AutoNumeric.unformat(value, maskValue);
|
|
2959
|
-
});
|
|
2989
|
+
});
|
|
2990
|
+
InputFactory.register('ZdCurrency', Currency);
|
|
2960
2991
|
|
|
2961
2992
|
class AlertQueue {
|
|
2962
2993
|
constructor() {
|
|
@@ -4214,7 +4245,8 @@
|
|
|
4214
4245
|
return core.dayjs(value, displayFormat).format(dateTimeFormat);
|
|
4215
4246
|
}
|
|
4216
4247
|
return value;
|
|
4217
|
-
});
|
|
4248
|
+
});
|
|
4249
|
+
InputFactory.register('ZdDate', Date$1);
|
|
4218
4250
|
|
|
4219
4251
|
class DateRange extends TextInput {
|
|
4220
4252
|
/* istanbul ignore next */
|
|
@@ -4678,7 +4710,8 @@
|
|
|
4678
4710
|
}
|
|
4679
4711
|
});
|
|
4680
4712
|
return formattedValue;
|
|
4681
|
-
});
|
|
4713
|
+
});
|
|
4714
|
+
InputFactory.register('ZdDateRange', DateRange);
|
|
4682
4715
|
|
|
4683
4716
|
/**
|
|
4684
4717
|
* Base class for Divider component.
|
|
@@ -4940,7 +4973,41 @@
|
|
|
4940
4973
|
}
|
|
4941
4974
|
}
|
|
4942
4975
|
}
|
|
4943
|
-
|
|
4976
|
+
setViewGetFileSizes(getFileSizes) {
|
|
4977
|
+
this.viewGetFileSizes = getFileSizes;
|
|
4978
|
+
}
|
|
4979
|
+
updateRules() {
|
|
4980
|
+
this.rules = Object.keys(this.parsedValidations)
|
|
4981
|
+
.map((key) => {
|
|
4982
|
+
const validation = this.parsedValidations[key];
|
|
4983
|
+
if (key !== 'maxFileSize')
|
|
4984
|
+
return (value) => {
|
|
4985
|
+
const testValue = value !== undefined ? value : this.value;
|
|
4986
|
+
return validation(testValue);
|
|
4987
|
+
};
|
|
4988
|
+
return () => {
|
|
4989
|
+
if (this.viewGetFileSizes) {
|
|
4990
|
+
const fileSizes = this.viewGetFileSizes();
|
|
4991
|
+
return validation(fileSizes);
|
|
4992
|
+
}
|
|
4993
|
+
return true;
|
|
4994
|
+
};
|
|
4995
|
+
});
|
|
4996
|
+
}
|
|
4997
|
+
}
|
|
4998
|
+
core.Validation.register('maxFileSize', (config) => (fileSizes) => {
|
|
4999
|
+
let fileError = '';
|
|
5000
|
+
Object.keys(fileSizes).some((fileName) => {
|
|
5001
|
+
if (fileSizes[fileName] > config.limit) {
|
|
5002
|
+
fileError = fileName;
|
|
5003
|
+
return true;
|
|
5004
|
+
}
|
|
5005
|
+
return false;
|
|
5006
|
+
});
|
|
5007
|
+
const message = core.I18n.translate((config.message || 'VALIDATION_FILE_SIZE'), { fileError });
|
|
5008
|
+
return (fileError === '') || message;
|
|
5009
|
+
});
|
|
5010
|
+
InputFactory.register('ZdFileInput', FileInput);
|
|
4944
5011
|
|
|
4945
5012
|
/**
|
|
4946
5013
|
* Base class for Footer component.
|
|
@@ -5983,7 +6050,7 @@
|
|
|
5983
6050
|
},
|
|
5984
6051
|
tab: {
|
|
5985
6052
|
event: this.navigateRight.bind(this),
|
|
5986
|
-
prevent:
|
|
6053
|
+
prevent: false,
|
|
5987
6054
|
active: true,
|
|
5988
6055
|
index: 99,
|
|
5989
6056
|
input: true,
|
|
@@ -5991,7 +6058,7 @@
|
|
|
5991
6058
|
},
|
|
5992
6059
|
'shift+tab': {
|
|
5993
6060
|
event: this.navigateLeft.bind(this),
|
|
5994
|
-
prevent:
|
|
6061
|
+
prevent: false,
|
|
5995
6062
|
active: true,
|
|
5996
6063
|
index: 99,
|
|
5997
6064
|
input: true,
|
|
@@ -6242,51 +6309,58 @@
|
|
|
6242
6309
|
arrSelection.splice(index, 1);
|
|
6243
6310
|
}
|
|
6244
6311
|
}
|
|
6245
|
-
navigateLeft() {
|
|
6312
|
+
navigateLeft({ event }) {
|
|
6246
6313
|
if (!this.viewNavigate)
|
|
6247
6314
|
return;
|
|
6248
|
-
this.viewNavigate('left');
|
|
6315
|
+
this.viewNavigate('left', event);
|
|
6249
6316
|
}
|
|
6250
|
-
navigateRight() {
|
|
6317
|
+
navigateRight({ event }) {
|
|
6251
6318
|
if (!this.viewNavigate)
|
|
6252
6319
|
return;
|
|
6253
|
-
this.viewNavigate('right');
|
|
6320
|
+
this.viewNavigate('right', event);
|
|
6254
6321
|
}
|
|
6255
6322
|
navigateUp() {
|
|
6256
|
-
if (this.
|
|
6257
|
-
this.viewNavigate('up');
|
|
6258
|
-
return;
|
|
6259
|
-
}
|
|
6260
|
-
const { uniqueKey, currentRow } = this.datasource;
|
|
6261
|
-
const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
|
|
6262
|
-
if (rowIndex === -1) {
|
|
6263
|
-
this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
|
|
6264
|
-
[this.currentColumn] = this.columns;
|
|
6265
|
-
return;
|
|
6266
|
-
}
|
|
6267
|
-
if (rowIndex === 0) {
|
|
6268
|
-
this.navigatePageDown();
|
|
6323
|
+
if (!this.viewNavigate)
|
|
6269
6324
|
return;
|
|
6270
|
-
|
|
6271
|
-
this.datasource.currentRow = this.datasource.data[rowIndex - 1];
|
|
6325
|
+
this.viewNavigate('up');
|
|
6272
6326
|
}
|
|
6273
6327
|
navigateDown() {
|
|
6274
|
-
if (this.
|
|
6275
|
-
this.viewNavigate('down');
|
|
6328
|
+
if (!this.viewNavigate)
|
|
6276
6329
|
return;
|
|
6277
|
-
|
|
6330
|
+
this.viewNavigate('down');
|
|
6331
|
+
}
|
|
6332
|
+
navigateDatasource(up) {
|
|
6278
6333
|
const { uniqueKey, currentRow } = this.datasource;
|
|
6279
6334
|
const rowIndex = this.datasource.data.findIndex((row) => row[uniqueKey] === currentRow[uniqueKey]);
|
|
6280
6335
|
if (rowIndex === -1) {
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6336
|
+
return this.navigateInitial(up);
|
|
6337
|
+
}
|
|
6338
|
+
if (up && rowIndex === 0) {
|
|
6339
|
+
return this.navigatePageDown();
|
|
6284
6340
|
}
|
|
6285
|
-
if (rowIndex === this.datasource.data.length - 1) {
|
|
6286
|
-
this.navigatePageUp();
|
|
6341
|
+
if (!up && rowIndex === this.datasource.data.length - 1) {
|
|
6342
|
+
return this.navigatePageUp();
|
|
6343
|
+
}
|
|
6344
|
+
return this.navigateCurrentRow(up, rowIndex);
|
|
6345
|
+
}
|
|
6346
|
+
navigateCurrentRow(up, rowIndex) {
|
|
6347
|
+
const addIndex = up ? -1 : 1;
|
|
6348
|
+
this.datasource.currentRow = this.datasource.data[rowIndex + addIndex];
|
|
6349
|
+
}
|
|
6350
|
+
navigateInitial(up) {
|
|
6351
|
+
if (up) {
|
|
6352
|
+
this.navigateLast();
|
|
6287
6353
|
return;
|
|
6288
6354
|
}
|
|
6289
|
-
this.
|
|
6355
|
+
this.navigateFirst();
|
|
6356
|
+
}
|
|
6357
|
+
navigateFirst() {
|
|
6358
|
+
[this.datasource.currentRow] = this.datasource.data;
|
|
6359
|
+
[this.currentColumn] = this.columns;
|
|
6360
|
+
}
|
|
6361
|
+
navigateLast() {
|
|
6362
|
+
this.datasource.currentRow = this.datasource.data[this.datasource.data.length - 1];
|
|
6363
|
+
[this.currentColumn] = this.columns;
|
|
6290
6364
|
}
|
|
6291
6365
|
navigatePageUp() {
|
|
6292
6366
|
if (this.datasource.page < Math.ceil(this.datasource.total / this.datasource.limit)) {
|
|
@@ -6821,6 +6895,9 @@
|
|
|
6821
6895
|
if (!revalidate) {
|
|
6822
6896
|
return Object.keys(this.invalidComponents).length === 0;
|
|
6823
6897
|
}
|
|
6898
|
+
if (!this.editing) {
|
|
6899
|
+
return this.isViewGridValid();
|
|
6900
|
+
}
|
|
6824
6901
|
let allValid = true;
|
|
6825
6902
|
this.datasource.data.forEach((row) => this.columns.forEach((column) => {
|
|
6826
6903
|
if (!column.isVisible || !column.editable)
|
|
@@ -6830,6 +6907,38 @@
|
|
|
6830
6907
|
}));
|
|
6831
6908
|
return allValid;
|
|
6832
6909
|
}
|
|
6910
|
+
/**
|
|
6911
|
+
* Checks whether the grid is valid while not in editing mode
|
|
6912
|
+
*/
|
|
6913
|
+
isViewGridValid(forceEditing = true) {
|
|
6914
|
+
const invalidCompNames = [];
|
|
6915
|
+
const componentInstances = {};
|
|
6916
|
+
const editableColumns = this.columns.filter((column) => column.editable && column.isVisible);
|
|
6917
|
+
editableColumns.forEach((column) => {
|
|
6918
|
+
const compName = this.getCompName('temp', column.name);
|
|
6919
|
+
const componentProps = Object.assign(Object.assign({}, column.componentProps), { name: compName });
|
|
6920
|
+
componentInstances[column.name] = InputFactory.factory(componentProps);
|
|
6921
|
+
});
|
|
6922
|
+
this.datasource.data.forEach((row) => {
|
|
6923
|
+
const key = row[this.datasource.uniqueKey];
|
|
6924
|
+
editableColumns.forEach((column) => {
|
|
6925
|
+
const instance = componentInstances[column.name];
|
|
6926
|
+
if (!instance.isValid(row[column.name])) {
|
|
6927
|
+
invalidCompNames.push(this.getCompName(key, column.name));
|
|
6928
|
+
}
|
|
6929
|
+
});
|
|
6930
|
+
});
|
|
6931
|
+
if (invalidCompNames.length > 0 && forceEditing) {
|
|
6932
|
+
this.editing = true;
|
|
6933
|
+
core.ViewService.nextTick(() => {
|
|
6934
|
+
invalidCompNames.forEach((compName) => {
|
|
6935
|
+
const invalidComponent = core.Metadata.getInstance(compName);
|
|
6936
|
+
invalidComponent.validate();
|
|
6937
|
+
});
|
|
6938
|
+
});
|
|
6939
|
+
}
|
|
6940
|
+
return invalidCompNames.length === 0;
|
|
6941
|
+
}
|
|
6833
6942
|
/**
|
|
6834
6943
|
* Adds new row to the datasource data and pushes it to the editedRows
|
|
6835
6944
|
* @param row Row
|
|
@@ -7315,7 +7424,8 @@
|
|
|
7315
7424
|
this.value -= this.step;
|
|
7316
7425
|
}
|
|
7317
7426
|
}
|
|
7318
|
-
}
|
|
7427
|
+
}
|
|
7428
|
+
InputFactory.register('ZdIncrement', Increment);
|
|
7319
7429
|
|
|
7320
7430
|
class IterableColumnsButtonController {
|
|
7321
7431
|
constructor(iterableComponent) {
|
|
@@ -7506,6 +7616,12 @@
|
|
|
7506
7616
|
[searchIn]: value,
|
|
7507
7617
|
},
|
|
7508
7618
|
}),
|
|
7619
|
+
DYNAMIC_FILTER: (value, search_in) => {
|
|
7620
|
+
const arrayValue = Array.isArray(value) ? value : Array.of(value);
|
|
7621
|
+
const filter = arrayValue.map((item) => ({ operation: 'EQUALS', relation: 'OR', value: item }));
|
|
7622
|
+
const dynamicFilter = { [search_in]: filter };
|
|
7623
|
+
return { dynamicFilter };
|
|
7624
|
+
},
|
|
7509
7625
|
};
|
|
7510
7626
|
/**
|
|
7511
7627
|
* Input search value
|
|
@@ -7648,13 +7764,16 @@
|
|
|
7648
7764
|
*/
|
|
7649
7765
|
getItemsBySearchValue(value, searchIn) {
|
|
7650
7766
|
return __awaiter(this, void 0, void 0, function* () {
|
|
7651
|
-
const config = Object.assign(Object.assign(Object.assign({}, this.datasource.clone()), this.dsSearch[this.searchParam](value, searchIn)), { lazyLoad: true });
|
|
7767
|
+
const config = Object.assign(Object.assign(Object.assign({}, this.datasource.clone()), this.dsSearch[this.searchParam](value, searchIn)), { lazyLoad: true, loadAll: Array.isArray(value) });
|
|
7652
7768
|
this.datasource.loading = true;
|
|
7653
7769
|
const datasource = core.DatasourceFactory.factory(config);
|
|
7654
7770
|
const items = yield datasource.get();
|
|
7655
7771
|
this.datasource.loading = false;
|
|
7656
7772
|
datasource.destroy();
|
|
7657
|
-
|
|
7773
|
+
if (Array.isArray(value)) {
|
|
7774
|
+
return items.filter((item) => value.includes(item[this.dataValue]));
|
|
7775
|
+
}
|
|
7776
|
+
return items.filter(this.getCondition(value));
|
|
7658
7777
|
});
|
|
7659
7778
|
}
|
|
7660
7779
|
getCondition(filterValue) {
|
|
@@ -7759,7 +7878,7 @@
|
|
|
7759
7878
|
const foundInData = this.datasource.data.find(this.getCondition(filterValue));
|
|
7760
7879
|
let searchValue = foundInData;
|
|
7761
7880
|
if (!foundInData && !this.manualMode) {
|
|
7762
|
-
searchValue = yield this.getItemsBySearchValue(filterValue, searchIn);
|
|
7881
|
+
[searchValue] = yield this.getItemsBySearchValue(filterValue, searchIn);
|
|
7763
7882
|
}
|
|
7764
7883
|
if (!searchValue) {
|
|
7765
7884
|
this.setFieldRowValue(null);
|
|
@@ -7991,7 +8110,8 @@
|
|
|
7991
8110
|
}
|
|
7992
8111
|
return result;
|
|
7993
8112
|
}, '');
|
|
7994
|
-
});
|
|
8113
|
+
});
|
|
8114
|
+
InputFactory.register('ZdSelect', Select);
|
|
7995
8115
|
|
|
7996
8116
|
/**
|
|
7997
8117
|
* Base class for Iterable Page Size component
|
|
@@ -8158,7 +8278,8 @@
|
|
|
8158
8278
|
yield this.iterableComponent.setSearch(search);
|
|
8159
8279
|
});
|
|
8160
8280
|
}
|
|
8161
|
-
}
|
|
8281
|
+
}
|
|
8282
|
+
InputFactory.register('ZdSearch', Search);
|
|
8162
8283
|
|
|
8163
8284
|
/**
|
|
8164
8285
|
* Base class for IterableComponentRender component.
|
|
@@ -9416,12 +9537,14 @@
|
|
|
9416
9537
|
*/
|
|
9417
9538
|
show() {
|
|
9418
9539
|
this.isVisible = true;
|
|
9540
|
+
core.ViewService.nextTick(() => this.callEvent('onShow', { component: this }));
|
|
9419
9541
|
}
|
|
9420
9542
|
/**
|
|
9421
9543
|
* Closes modal
|
|
9422
9544
|
*/
|
|
9423
9545
|
hide() {
|
|
9424
9546
|
this.isVisible = false;
|
|
9547
|
+
core.ViewService.nextTick(() => this.callEvent('onHide', { component: this }));
|
|
9425
9548
|
}
|
|
9426
9549
|
}
|
|
9427
9550
|
|
|
@@ -9592,7 +9715,8 @@
|
|
|
9592
9715
|
}
|
|
9593
9716
|
}
|
|
9594
9717
|
}
|
|
9595
|
-
core.FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
|
|
9718
|
+
core.FormatterParserProvider.registerFormatter('ZdPassword', (value) => (value || '').replace(/./g, '*'));
|
|
9719
|
+
InputFactory.register('ZdPassword', Password);
|
|
9596
9720
|
|
|
9597
9721
|
/**
|
|
9598
9722
|
* Base class for Progress component
|
|
@@ -9687,7 +9811,8 @@
|
|
|
9687
9811
|
super.onBeforeDestroy();
|
|
9688
9812
|
this.datasource.destroy();
|
|
9689
9813
|
}
|
|
9690
|
-
}
|
|
9814
|
+
}
|
|
9815
|
+
InputFactory.register('ZdRadio', Radio);
|
|
9691
9816
|
|
|
9692
9817
|
/**
|
|
9693
9818
|
* Base class for Range Slider component
|
|
@@ -9784,7 +9909,8 @@
|
|
|
9784
9909
|
set value(value) {
|
|
9785
9910
|
this.rangeSliderValue = value;
|
|
9786
9911
|
}
|
|
9787
|
-
}
|
|
9912
|
+
}
|
|
9913
|
+
InputFactory.register('ZdRangeSlider', RangeSlider);
|
|
9788
9914
|
|
|
9789
9915
|
/**
|
|
9790
9916
|
* Base class for Row component.
|
|
@@ -9859,12 +9985,16 @@
|
|
|
9859
9985
|
*/
|
|
9860
9986
|
this.limit = null;
|
|
9861
9987
|
this.showSelectAll = false;
|
|
9988
|
+
this.showCheckboxAll = false;
|
|
9989
|
+
this.checkboxAllValue = false;
|
|
9862
9990
|
if (!this.selectedValue) {
|
|
9863
9991
|
this.selectedValue = [];
|
|
9864
9992
|
}
|
|
9865
9993
|
this.showSelectAll = this.getInitValue('showSelectAll', props.showSelectAll, this.showSelectAll);
|
|
9866
9994
|
this.maxRows = this.getInitValue('maxRows', props.maxRows, this.maxRows);
|
|
9867
9995
|
this.limit = this.getInitValue('limit', props.limit, this.limit);
|
|
9996
|
+
this.showCheckboxAll = this.getInitValue('showCheckboxAll', props.showCheckboxAll, this.showCheckboxAll);
|
|
9997
|
+
this.checkboxAll = this.getInitValue('checkboxAll', props.checkboxAll, this.checkboxAll);
|
|
9868
9998
|
if (!Array.isArray(this.dataText))
|
|
9869
9999
|
this.dataText = [this.dataText];
|
|
9870
10000
|
this.internalDisplayValue = this.getDisplayValue();
|
|
@@ -9894,6 +10024,13 @@
|
|
|
9894
10024
|
this.selectedValue = rows;
|
|
9895
10025
|
this.setFieldValue(this.getValues(rows));
|
|
9896
10026
|
}
|
|
10027
|
+
get checkboxAll() {
|
|
10028
|
+
return this.checkboxAllValue;
|
|
10029
|
+
}
|
|
10030
|
+
set checkboxAll(value) {
|
|
10031
|
+
this.disabled = value;
|
|
10032
|
+
this.checkboxAllValue = value;
|
|
10033
|
+
}
|
|
9897
10034
|
/**
|
|
9898
10035
|
* Removes item from array a and add it to array b if condition is satisfied
|
|
9899
10036
|
*/
|
|
@@ -9905,8 +10042,8 @@
|
|
|
9905
10042
|
}
|
|
9906
10043
|
setFieldValue(value) {
|
|
9907
10044
|
return __awaiter(this, void 0, void 0, function* () {
|
|
9908
|
-
const
|
|
9909
|
-
const
|
|
10045
|
+
const foundValues = [];
|
|
10046
|
+
const searchedValues = [];
|
|
9910
10047
|
let pushed = false;
|
|
9911
10048
|
value.forEach((row) => {
|
|
9912
10049
|
let filterValue;
|
|
@@ -9916,27 +10053,37 @@
|
|
|
9916
10053
|
else {
|
|
9917
10054
|
filterValue = row;
|
|
9918
10055
|
}
|
|
9919
|
-
const searchIn = this.dataValue;
|
|
9920
10056
|
const foundInData = this.datasource.data.find(this.getCondition(filterValue));
|
|
9921
10057
|
if (foundInData) {
|
|
9922
|
-
|
|
10058
|
+
foundValues.push(foundInData);
|
|
9923
10059
|
}
|
|
9924
10060
|
else if (!this.manualMode) {
|
|
9925
|
-
|
|
9926
|
-
if (item) {
|
|
9927
|
-
searchValues.push(item);
|
|
9928
|
-
this.datasource.data.unshift(item);
|
|
9929
|
-
this.insertedValues.push(item);
|
|
9930
|
-
pushed = true;
|
|
9931
|
-
}
|
|
9932
|
-
}));
|
|
10061
|
+
searchedValues.push(filterValue);
|
|
9933
10062
|
}
|
|
9934
10063
|
});
|
|
9935
|
-
|
|
10064
|
+
const insertItem = (item) => __awaiter(this, void 0, void 0, function* () {
|
|
10065
|
+
if (!item)
|
|
10066
|
+
return;
|
|
10067
|
+
foundValues.push(item);
|
|
10068
|
+
this.datasource.data.unshift(item);
|
|
10069
|
+
this.insertedValues.push(item);
|
|
10070
|
+
pushed = true;
|
|
10071
|
+
});
|
|
10072
|
+
// using filter/find/dynamicFilter should make only 1 request
|
|
10073
|
+
// using normal search should make one request per search value
|
|
10074
|
+
if (this.searchParam !== 'SEARCH') {
|
|
10075
|
+
const items = yield this.getItemsBySearchValue(searchedValues, this.dataValue);
|
|
10076
|
+
items.forEach(insertItem);
|
|
10077
|
+
}
|
|
10078
|
+
else {
|
|
10079
|
+
const promises = searchedValues.map((searchedValue) => __awaiter(this, void 0, void 0, function* () {
|
|
10080
|
+
const [item] = yield this.getItemsBySearchValue(searchedValue, this.dataValue);
|
|
10081
|
+
insertItem(item);
|
|
10082
|
+
}));
|
|
9936
10083
|
yield Promise.all(promises);
|
|
9937
10084
|
}
|
|
9938
|
-
if (
|
|
9939
|
-
this.setFieldRowValue(
|
|
10085
|
+
if (foundValues.length > 0) {
|
|
10086
|
+
this.setFieldRowValue(foundValues);
|
|
9940
10087
|
}
|
|
9941
10088
|
else {
|
|
9942
10089
|
this.setFieldRowValue([]);
|
|
@@ -10185,6 +10332,19 @@
|
|
|
10185
10332
|
}
|
|
10186
10333
|
this.cachedTotal = this.datasource.total;
|
|
10187
10334
|
}
|
|
10335
|
+
/**
|
|
10336
|
+
* Updates input rules.
|
|
10337
|
+
*/
|
|
10338
|
+
updateRules() {
|
|
10339
|
+
this.rules = Object.keys(this.parsedValidations)
|
|
10340
|
+
.map((key) => (value) => {
|
|
10341
|
+
const testValue = value !== undefined ? value : this.value;
|
|
10342
|
+
const validation = this.parsedValidations[key];
|
|
10343
|
+
if (key !== 'required')
|
|
10344
|
+
return validation(testValue);
|
|
10345
|
+
return validation((this.checkboxAll && 'all') || testValue);
|
|
10346
|
+
});
|
|
10347
|
+
}
|
|
10188
10348
|
}
|
|
10189
10349
|
|
|
10190
10350
|
class TreeDataStructure {
|
|
@@ -11012,7 +11172,8 @@
|
|
|
11012
11172
|
this.setValue(filteredNode.id);
|
|
11013
11173
|
}
|
|
11014
11174
|
}
|
|
11015
|
-
}
|
|
11175
|
+
}
|
|
11176
|
+
InputFactory.register('ZdSelectTree', SelectTree);
|
|
11016
11177
|
|
|
11017
11178
|
/**
|
|
11018
11179
|
* Base class for Select Tree Multiple component.
|
|
@@ -11462,7 +11623,8 @@
|
|
|
11462
11623
|
this.inset = this.getInitValue('inset', props.inset, this.inset);
|
|
11463
11624
|
this.createAccessors();
|
|
11464
11625
|
}
|
|
11465
|
-
}
|
|
11626
|
+
}
|
|
11627
|
+
InputFactory.register('ZdSwitch', Switch);
|
|
11466
11628
|
|
|
11467
11629
|
/**
|
|
11468
11630
|
* Base class for Table component.
|
|
@@ -11800,7 +11962,8 @@
|
|
|
11800
11962
|
this.addValidation('maxLength', { limit: parseInt(this.counter.toString(), 10) });
|
|
11801
11963
|
}
|
|
11802
11964
|
}
|
|
11803
|
-
}
|
|
11965
|
+
}
|
|
11966
|
+
InputFactory.register('ZdTextarea', Textarea);
|
|
11804
11967
|
|
|
11805
11968
|
/**
|
|
11806
11969
|
* Selects the time format by the rule:
|
|
@@ -12188,7 +12351,8 @@
|
|
|
12188
12351
|
}
|
|
12189
12352
|
}
|
|
12190
12353
|
return value;
|
|
12191
|
-
});
|
|
12354
|
+
});
|
|
12355
|
+
InputFactory.register('ZdTime', Time);
|
|
12192
12356
|
|
|
12193
12357
|
/**
|
|
12194
12358
|
* Base class for Tooltip component.
|
|
@@ -12833,45 +12997,28 @@
|
|
|
12833
12997
|
navigateToggle(collapse) {
|
|
12834
12998
|
this.treeDataStructure.navigateToggle(collapse);
|
|
12835
12999
|
}
|
|
12836
|
-
|
|
12837
|
-
* Navigate upwards
|
|
12838
|
-
*/
|
|
12839
|
-
navigateUp() {
|
|
12840
|
-
if (this.cellSelection && this.viewNavigate) {
|
|
12841
|
-
this.viewNavigate('up');
|
|
12842
|
-
return;
|
|
12843
|
-
}
|
|
13000
|
+
navigateDatasource(up) {
|
|
12844
13001
|
const { uniqueKey, currentRow } = this.datasource;
|
|
12845
13002
|
const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
|
|
12846
|
-
if (
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
13003
|
+
if (up) {
|
|
13004
|
+
if (rowIndex === -1) {
|
|
13005
|
+
const lastOpenedRowIdx = this.treeDataStructure.previousOpenedRow(this.datasource.data.length);
|
|
13006
|
+
this.datasource.currentRow = this.datasource.data[lastOpenedRowIdx];
|
|
13007
|
+
return;
|
|
13008
|
+
}
|
|
12851
13009
|
const previousRowIdx = this.treeDataStructure.previousOpenedRow(rowIndex);
|
|
12852
13010
|
if (previousRowIdx > -1) {
|
|
12853
13011
|
this.datasource.currentRow = this.datasource.data[previousRowIdx];
|
|
12854
13012
|
}
|
|
12855
|
-
}
|
|
12856
|
-
}
|
|
12857
|
-
/**
|
|
12858
|
-
* Navigate downwards
|
|
12859
|
-
*/
|
|
12860
|
-
navigateDown() {
|
|
12861
|
-
if (this.cellSelection && this.viewNavigate) {
|
|
12862
|
-
this.viewNavigate('down');
|
|
12863
13013
|
return;
|
|
12864
13014
|
}
|
|
12865
|
-
const { uniqueKey, currentRow } = this.datasource;
|
|
12866
|
-
const rowIndex = this.treeDataStructure.findDataIndex(this.datasource.data, currentRow[uniqueKey]);
|
|
12867
13015
|
if (rowIndex === -1) {
|
|
12868
13016
|
[this.datasource.currentRow] = this.datasource.data;
|
|
13017
|
+
return;
|
|
12869
13018
|
}
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
this.datasource.currentRow = this.datasource.data[nextRowIdx];
|
|
12874
|
-
}
|
|
13019
|
+
const nextRowIdx = this.treeDataStructure.nextOpenedRow(rowIndex);
|
|
13020
|
+
if (nextRowIdx > -1) {
|
|
13021
|
+
this.datasource.currentRow = this.datasource.data[nextRowIdx];
|
|
12875
13022
|
}
|
|
12876
13023
|
}
|
|
12877
13024
|
removeDuplicates(arr, key) {
|
|
@@ -14598,6 +14745,52 @@
|
|
|
14598
14745
|
}
|
|
14599
14746
|
}
|
|
14600
14747
|
|
|
14748
|
+
/**
|
|
14749
|
+
* Class used to format grouped data into the ZhReports format
|
|
14750
|
+
*/
|
|
14751
|
+
class GroupedPDFFormatter {
|
|
14752
|
+
format(data) {
|
|
14753
|
+
return data.map((item) => {
|
|
14754
|
+
if (this.isGroupHeader(item)) {
|
|
14755
|
+
return {
|
|
14756
|
+
__group: item.group,
|
|
14757
|
+
__groupHeader: item.groupHeader,
|
|
14758
|
+
__groupFooter: false,
|
|
14759
|
+
__groupIndex: item.groupIndex,
|
|
14760
|
+
__groupLabel: item.groupLabel,
|
|
14761
|
+
__groupValue: item.groupValue,
|
|
14762
|
+
__groupOpened: item.groupOpened,
|
|
14763
|
+
};
|
|
14764
|
+
}
|
|
14765
|
+
if (this.isGroupFooter(item)) {
|
|
14766
|
+
const groupKeys = ['groupFooter', 'groupIndex', 'groupHeaders', 'groupLabel', 'groupValue', 'groupSummary'];
|
|
14767
|
+
const totalColumnNames = Object.keys(item).filter((key) => !groupKeys.includes(key));
|
|
14768
|
+
const result = {
|
|
14769
|
+
__group: true,
|
|
14770
|
+
__groupFooter: item.groupFooter,
|
|
14771
|
+
__groupIndex: item.groupIndex,
|
|
14772
|
+
__groupLabel: item.groupLabel,
|
|
14773
|
+
__groupValue: item.groupValue,
|
|
14774
|
+
__groupSummary: !!item.groupSummary,
|
|
14775
|
+
};
|
|
14776
|
+
totalColumnNames.forEach((name) => {
|
|
14777
|
+
result[name] = item[name];
|
|
14778
|
+
});
|
|
14779
|
+
return result;
|
|
14780
|
+
}
|
|
14781
|
+
const dataItem = Object.assign({}, item);
|
|
14782
|
+
delete dataItem.groupHeaders;
|
|
14783
|
+
return dataItem;
|
|
14784
|
+
});
|
|
14785
|
+
}
|
|
14786
|
+
isGroupHeader(entry) {
|
|
14787
|
+
return entry.groupHeader === true;
|
|
14788
|
+
}
|
|
14789
|
+
isGroupFooter(entry) {
|
|
14790
|
+
return entry.groupFooter === true;
|
|
14791
|
+
}
|
|
14792
|
+
}
|
|
14793
|
+
|
|
14601
14794
|
class Report {
|
|
14602
14795
|
constructor(iterable, title) {
|
|
14603
14796
|
this.endPoint = core.Config.reportsEndPoint;
|
|
@@ -14654,7 +14847,7 @@
|
|
|
14654
14847
|
const { route } = reportType;
|
|
14655
14848
|
const { name, columns, datasource } = this.iterable;
|
|
14656
14849
|
const { groupedData } = Object.assign({}, this.iterable);
|
|
14657
|
-
const formattedColumns = this.
|
|
14850
|
+
const formattedColumns = this.filterColumns(columns);
|
|
14658
14851
|
const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
|
|
14659
14852
|
let dataset;
|
|
14660
14853
|
if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
|
|
@@ -14662,6 +14855,11 @@
|
|
|
14662
14855
|
const metadataObjClone = merge__default["default"](rowMetadata, JSON.parse(metadataObj));
|
|
14663
14856
|
dataset = reportType.buildDataset(groupedData, metadataObjClone);
|
|
14664
14857
|
}
|
|
14858
|
+
else if (reportType instanceof PDFReport && groupedData && groupedData.length > 0) {
|
|
14859
|
+
const formatter = new GroupedPDFFormatter();
|
|
14860
|
+
const pdfGroupedData = formatter.format(groupedData);
|
|
14861
|
+
dataset = reportType.buildDataset(pdfGroupedData);
|
|
14862
|
+
}
|
|
14665
14863
|
else {
|
|
14666
14864
|
dataset = reportType.buildDataset(data, formattedColumns);
|
|
14667
14865
|
}
|
|
@@ -14692,7 +14890,7 @@
|
|
|
14692
14890
|
return new URL(reportFile, this.fileEndPoint).href;
|
|
14693
14891
|
});
|
|
14694
14892
|
}
|
|
14695
|
-
|
|
14893
|
+
filterColumns(columns) {
|
|
14696
14894
|
return columns.filter((item) => (item.type !== 'action' && item.isVisible));
|
|
14697
14895
|
}
|
|
14698
14896
|
}
|
|
@@ -14741,12 +14939,14 @@
|
|
|
14741
14939
|
exports.GridColumn = GridColumn;
|
|
14742
14940
|
exports.GridColumnEditable = GridColumnEditable;
|
|
14743
14941
|
exports.GridEditable = GridEditable;
|
|
14942
|
+
exports.GroupedPDFFormatter = GroupedPDFFormatter;
|
|
14744
14943
|
exports.Header = Header;
|
|
14745
14944
|
exports.Icon = Icon;
|
|
14746
14945
|
exports.Icons = Icons;
|
|
14747
14946
|
exports.Image = Image;
|
|
14748
14947
|
exports.Increment = Increment;
|
|
14749
14948
|
exports.Input = Input;
|
|
14949
|
+
exports.InputFactory = InputFactory;
|
|
14750
14950
|
exports.Iterable = Iterable;
|
|
14751
14951
|
exports.IterableColumnsButton = IterableColumnsButton;
|
|
14752
14952
|
exports.IterableColumnsButtonController = IterableColumnsButtonController;
|