@zeedhi/common 1.52.0 → 1.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zd-common.esm.js +442 -248
- package/dist/zd-common.umd.js +442 -247
- package/package.json +2 -2
- package/types/components/index.d.ts +1 -0
- package/types/components/zd-dashboard/dashboard.d.ts +7 -3
- package/types/components/zd-dashboard/interfaces.d.ts +1 -0
- package/types/components/zd-date/date.d.ts +1 -1
- package/types/components/zd-date/interfaces.d.ts +0 -1
- package/types/components/zd-grid/grid-editable.d.ts +9 -1
- package/types/components/zd-grid/grid.d.ts +10 -0
- package/types/components/zd-grid/interfaces.d.ts +11 -0
- package/types/components/zd-month/month.d.ts +2 -2
- package/types/components/zd-time/interfaces.d.ts +1 -0
- package/types/components/zd-time/time.d.ts +59 -23
- package/types/components/zd-tree/interfaces.d.ts +4 -0
- package/types/components/zd-tree/tree.d.ts +8 -0
- package/types/components/zd-tree-grid/interfaces.d.ts +11 -2
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +9 -1
- package/types/components/zd-tree-grid/tree-grid.d.ts +2 -0
- package/types/utils/report/report-type/base-report.d.ts +5 -4
- package/types/utils/report/report-type/interfaces.d.ts +1 -0
- package/types/utils/report/report-type/pdf-report.d.ts +5 -0
- package/types/utils/report/report.d.ts +1 -1
package/dist/zd-common.umd.js
CHANGED
|
@@ -2915,8 +2915,6 @@
|
|
|
2915
2915
|
this.moveMode = false;
|
|
2916
2916
|
/* Cards */
|
|
2917
2917
|
this.cards = [];
|
|
2918
|
-
/* Card ID to be deleted */
|
|
2919
|
-
this.deleteCardId = '';
|
|
2920
2918
|
this.overrideNamedProps = {};
|
|
2921
2919
|
/* Remove the paddings of the dashboard */
|
|
2922
2920
|
this.removePadding = false;
|
|
@@ -3009,7 +3007,9 @@
|
|
|
3009
3007
|
persistent: true,
|
|
3010
3008
|
title: 'EDIT_CARD',
|
|
3011
3009
|
grid: {
|
|
3012
|
-
|
|
3010
|
+
cols: 10,
|
|
3011
|
+
sm: 8,
|
|
3012
|
+
lg: 6,
|
|
3013
3013
|
},
|
|
3014
3014
|
children: [
|
|
3015
3015
|
{
|
|
@@ -3031,7 +3031,12 @@
|
|
|
3031
3031
|
minValue: 1,
|
|
3032
3032
|
clearable: false,
|
|
3033
3033
|
hint: 'Min: 1, Max: 12',
|
|
3034
|
-
|
|
3034
|
+
grid: {
|
|
3035
|
+
cols: 6,
|
|
3036
|
+
sm: 6,
|
|
3037
|
+
md: 4,
|
|
3038
|
+
lg: 3,
|
|
3039
|
+
},
|
|
3035
3040
|
mask: {
|
|
3036
3041
|
decimalPlaces: 0,
|
|
3037
3042
|
},
|
|
@@ -3040,19 +3045,33 @@
|
|
|
3040
3045
|
name: 'inputHeight',
|
|
3041
3046
|
component: 'ZdTextInput',
|
|
3042
3047
|
label: 'HEIGHT',
|
|
3043
|
-
|
|
3048
|
+
grid: {
|
|
3049
|
+
cols: 6,
|
|
3050
|
+
sm: 6,
|
|
3051
|
+
md: 4,
|
|
3052
|
+
lg: 3,
|
|
3053
|
+
},
|
|
3044
3054
|
},
|
|
3045
3055
|
{
|
|
3046
3056
|
name: 'inputPath',
|
|
3047
3057
|
component: 'ZdTextInput',
|
|
3048
3058
|
label: 'PATH',
|
|
3049
|
-
|
|
3059
|
+
grid: {
|
|
3060
|
+
cols: 7,
|
|
3061
|
+
sm: 7,
|
|
3062
|
+
md: 9,
|
|
3063
|
+
},
|
|
3050
3064
|
},
|
|
3051
3065
|
{
|
|
3052
3066
|
name: 'inputLocal',
|
|
3053
3067
|
component: 'ZdSwitch',
|
|
3054
3068
|
label: 'PATH_LOCAL',
|
|
3055
3069
|
cssClass: 'zd-mt-4',
|
|
3070
|
+
grid: {
|
|
3071
|
+
cols: 5,
|
|
3072
|
+
sm: 5,
|
|
3073
|
+
md: 3,
|
|
3074
|
+
},
|
|
3056
3075
|
},
|
|
3057
3076
|
],
|
|
3058
3077
|
},
|
|
@@ -3087,40 +3106,30 @@
|
|
|
3087
3106
|
/* Edit header */
|
|
3088
3107
|
this.headerLeftSlot = [
|
|
3089
3108
|
{
|
|
3090
|
-
name: `
|
|
3091
|
-
component: '
|
|
3092
|
-
bottom: true,
|
|
3109
|
+
name: `addDashboard${this.name}`,
|
|
3110
|
+
component: 'ZdButton',
|
|
3093
3111
|
label: 'ADD',
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
click: this.openModalAddCard.bind(this),
|
|
3103
|
-
},
|
|
3104
|
-
},
|
|
3105
|
-
],
|
|
3112
|
+
iconName: 'plus',
|
|
3113
|
+
color: 'white',
|
|
3114
|
+
small: true,
|
|
3115
|
+
cssClass: 'zd-my-2',
|
|
3116
|
+
outline: true,
|
|
3117
|
+
events: {
|
|
3118
|
+
click: this.openModalAddCard.bind(this),
|
|
3119
|
+
},
|
|
3106
3120
|
},
|
|
3107
3121
|
{
|
|
3108
|
-
name: `
|
|
3109
|
-
component: '
|
|
3110
|
-
bottom: true,
|
|
3122
|
+
name: `saveDashboard${this.name}`,
|
|
3123
|
+
component: 'ZdButton',
|
|
3111
3124
|
label: 'SAVE',
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
click: this.onSave.bind(this),
|
|
3121
|
-
},
|
|
3122
|
-
},
|
|
3123
|
-
],
|
|
3125
|
+
iconName: 'complete',
|
|
3126
|
+
color: 'white',
|
|
3127
|
+
small: true,
|
|
3128
|
+
cssClass: 'zd-my-2',
|
|
3129
|
+
outline: true,
|
|
3130
|
+
events: {
|
|
3131
|
+
click: this.onSave.bind(this),
|
|
3132
|
+
},
|
|
3124
3133
|
},
|
|
3125
3134
|
];
|
|
3126
3135
|
this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
|
|
@@ -3130,6 +3139,7 @@
|
|
|
3130
3139
|
this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
|
|
3131
3140
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
3132
3141
|
this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
|
|
3142
|
+
this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
|
|
3133
3143
|
this.createAccessors();
|
|
3134
3144
|
}
|
|
3135
3145
|
onMounted(element) {
|
|
@@ -3159,17 +3169,19 @@
|
|
|
3159
3169
|
}
|
|
3160
3170
|
}
|
|
3161
3171
|
/* Delete a card */
|
|
3162
|
-
deleteCard() {
|
|
3172
|
+
deleteCard(cardId) {
|
|
3163
3173
|
this.cards.forEach((card, index) => {
|
|
3164
|
-
if (
|
|
3174
|
+
if (cardId === card.cardId) {
|
|
3165
3175
|
this.cards.splice(index, 1);
|
|
3166
3176
|
}
|
|
3167
3177
|
});
|
|
3178
|
+
}
|
|
3179
|
+
deleteAndCloseDialog(cardId) {
|
|
3180
|
+
this.deleteCard(cardId);
|
|
3168
3181
|
DialogService.hide();
|
|
3169
3182
|
}
|
|
3170
3183
|
/* Show delete card dialog */
|
|
3171
3184
|
showDeleteCardDialog(cardId) {
|
|
3172
|
-
this.deleteCardId = cardId;
|
|
3173
3185
|
this.hideDialog();
|
|
3174
3186
|
DialogService.show({
|
|
3175
3187
|
name: `${this.name}-delete-dialog`,
|
|
@@ -3191,7 +3203,7 @@
|
|
|
3191
3203
|
component: 'ZdButton',
|
|
3192
3204
|
label: 'YES',
|
|
3193
3205
|
events: {
|
|
3194
|
-
click: this.
|
|
3206
|
+
click: this.deleteAndCloseDialog.bind(this, cardId),
|
|
3195
3207
|
},
|
|
3196
3208
|
},
|
|
3197
3209
|
],
|
|
@@ -3263,6 +3275,8 @@
|
|
|
3263
3275
|
}
|
|
3264
3276
|
/* Return footer rightSlot props for view layer */
|
|
3265
3277
|
getFooterRightSlot(cardId) {
|
|
3278
|
+
if (this.cardFooterSlot)
|
|
3279
|
+
return this.cardFooterSlot;
|
|
3266
3280
|
const rightSlot = [
|
|
3267
3281
|
{
|
|
3268
3282
|
name: `tooltipDelete${cardId}`,
|
|
@@ -3306,6 +3320,9 @@
|
|
|
3306
3320
|
getCardId() {
|
|
3307
3321
|
return Math.random().toString(36).substr(2, 9);
|
|
3308
3322
|
}
|
|
3323
|
+
selectCard(cardId) {
|
|
3324
|
+
this.currentCardId = cardId;
|
|
3325
|
+
}
|
|
3309
3326
|
}
|
|
3310
3327
|
|
|
3311
3328
|
/**
|
|
@@ -3402,9 +3419,6 @@
|
|
|
3402
3419
|
this.pickerType = this.getInitValue('pickerType', props.pickerType, this.pickerType);
|
|
3403
3420
|
this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
|
|
3404
3421
|
this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
|
|
3405
|
-
if (this.pickerType === 'month') {
|
|
3406
|
-
this.isoFormat = 'YYYY-MM';
|
|
3407
|
-
}
|
|
3408
3422
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
3409
3423
|
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
3410
3424
|
this.createAccessors();
|
|
@@ -5210,6 +5224,7 @@
|
|
|
5210
5224
|
* @public
|
|
5211
5225
|
*/
|
|
5212
5226
|
this.resizeColumns = false;
|
|
5227
|
+
this.showSelectAll = true;
|
|
5213
5228
|
this.navigationKeyMapping = {
|
|
5214
5229
|
up: {
|
|
5215
5230
|
event: this.navigateUp.bind(this),
|
|
@@ -5259,6 +5274,8 @@
|
|
|
5259
5274
|
this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
|
|
5260
5275
|
this.noDataText = this.getInitValue('noDataText', props.noDataText, this.noDataText);
|
|
5261
5276
|
this.noResultsText = this.getInitValue('noResultsText', props.noResultsText, this.noResultsText);
|
|
5277
|
+
this.disableSelection = this.getInitValue('disableSelection', props.disableSelection, this.disableSelection);
|
|
5278
|
+
this.showSelectAll = this.getInitValue('showSelectAll', props.showSelectAll, this.showSelectAll);
|
|
5262
5279
|
this.createAccessors();
|
|
5263
5280
|
}
|
|
5264
5281
|
onMounted(element) {
|
|
@@ -5448,6 +5465,10 @@
|
|
|
5448
5465
|
});
|
|
5449
5466
|
return slot;
|
|
5450
5467
|
}
|
|
5468
|
+
callDisableSelection(row) {
|
|
5469
|
+
return !!this.disableSelection && typeof this.disableSelection === 'function'
|
|
5470
|
+
&& this.disableSelection({ row, component: this });
|
|
5471
|
+
}
|
|
5451
5472
|
}
|
|
5452
5473
|
|
|
5453
5474
|
/**
|
|
@@ -5525,6 +5546,7 @@
|
|
|
5525
5546
|
};
|
|
5526
5547
|
this.newRowIdentifier = '__added_row';
|
|
5527
5548
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
5549
|
+
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
5528
5550
|
this.createAccessors();
|
|
5529
5551
|
}
|
|
5530
5552
|
onMounted(element) {
|
|
@@ -5577,10 +5599,10 @@
|
|
|
5577
5599
|
* @param event DOM event
|
|
5578
5600
|
* @param element DOM Element
|
|
5579
5601
|
*/
|
|
5580
|
-
cellClick(row, column, event, element) {
|
|
5602
|
+
cellClick(row, column, event, element, canEdit = true) {
|
|
5581
5603
|
if (this.editing)
|
|
5582
5604
|
return;
|
|
5583
|
-
if (column.editable) {
|
|
5605
|
+
if (column.editable && canEdit) {
|
|
5584
5606
|
this.editing = true;
|
|
5585
5607
|
this.preventRowClick = true;
|
|
5586
5608
|
this.datasource.currentRow = row;
|
|
@@ -5929,6 +5951,9 @@
|
|
|
5929
5951
|
throw e;
|
|
5930
5952
|
}
|
|
5931
5953
|
}
|
|
5954
|
+
callCanEditRow(row) {
|
|
5955
|
+
return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
|
|
5956
|
+
}
|
|
5932
5957
|
}
|
|
5933
5958
|
|
|
5934
5959
|
/**
|
|
@@ -8165,6 +8190,7 @@
|
|
|
8165
8190
|
* Defines the month input format.
|
|
8166
8191
|
*/
|
|
8167
8192
|
this.inputFormat = core.Config.monthInputFormat;
|
|
8193
|
+
this.isoFormat = 'YYYY-MM';
|
|
8168
8194
|
/**
|
|
8169
8195
|
* Determines the type of the picker - month for month picker.
|
|
8170
8196
|
*/
|
|
@@ -8174,19 +8200,11 @@
|
|
|
8174
8200
|
this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
|
|
8175
8201
|
this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormat);
|
|
8176
8202
|
this.inputFormat = this.getInitValue('inputFormat', props.inputFormat, this.inputFormat);
|
|
8203
|
+
this.pickerType = this.getInitValue('pickerType', undefined, this.pickerType);
|
|
8177
8204
|
this.createAccessors();
|
|
8178
8205
|
}
|
|
8179
|
-
maskFormat(format) {
|
|
8180
|
-
const monthIndex = format.indexOf('MMM');
|
|
8181
|
-
const replaced = format.replace(/[A-Za-z]/gi, '#');
|
|
8182
|
-
if (monthIndex === -1)
|
|
8183
|
-
return replaced;
|
|
8184
|
-
const arrFormat = replaced.split('');
|
|
8185
|
-
arrFormat.splice(monthIndex, 3, ...'CCC');
|
|
8186
|
-
return arrFormat.join('');
|
|
8187
|
-
}
|
|
8188
8206
|
}
|
|
8189
|
-
core.FormatterParserProvider.registerFormatter('ZdMonth', (value, { dateFormat = core.Config.monthFormat, displayFormat = core.Config.monthDisplayFormat, inputFormat = core.Config.monthInputFormat, mask = '', initialMask, } = {}) => {
|
|
8207
|
+
core.FormatterParserProvider.registerFormatter('ZdMonth', (value, { dateFormat = core.Config.monthFormat, displayFormat = core.Config.monthDisplayFormat, inputFormat = core.Config.monthInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
|
|
8190
8208
|
if (!value) {
|
|
8191
8209
|
return '';
|
|
8192
8210
|
}
|
|
@@ -8198,14 +8216,17 @@
|
|
|
8198
8216
|
if (inputFormat) {
|
|
8199
8217
|
return core.dayjs(value, dateFormat).format(inputFormat);
|
|
8200
8218
|
}
|
|
8201
|
-
|
|
8219
|
+
let valueToUnmask = value;
|
|
8220
|
+
if (isSimpleDisplay) {
|
|
8221
|
+
valueToUnmask = core.dayjs(value, dateFormat).format(displayFormat);
|
|
8222
|
+
}
|
|
8202
8223
|
const unmasked = core.Mask.getValueWithoutMask(valueToUnmask);
|
|
8203
8224
|
const masked = core.Mask.getValueWithMask(unmasked, mask);
|
|
8204
8225
|
return masked;
|
|
8205
8226
|
}
|
|
8206
8227
|
return core.dayjs(value, dateFormat).format(displayFormat);
|
|
8207
8228
|
});
|
|
8208
|
-
core.FormatterParserProvider.registerParser('ZdMonth', (value, { dateFormat = core.Config.monthFormat, displayFormat = core.Config.monthDisplayFormat, inputFormat = core.Config.monthInputFormat, mask = '',
|
|
8229
|
+
core.FormatterParserProvider.registerParser('ZdMonth', (value, { dateFormat = core.Config.monthFormat, displayFormat = core.Config.monthDisplayFormat, inputFormat = core.Config.monthInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
|
|
8209
8230
|
if (!value) {
|
|
8210
8231
|
return null;
|
|
8211
8232
|
}
|
|
@@ -8221,12 +8242,14 @@
|
|
|
8221
8242
|
}
|
|
8222
8243
|
const unmasked = core.Mask.getValueWithoutMask(value);
|
|
8223
8244
|
let masked;
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8245
|
+
if (!initialMask || isSimpleDisplay) {
|
|
8246
|
+
const displayFmtMask = displayFormat.replace(/[A-Za-z]/gi, '#');
|
|
8247
|
+
masked = core.Mask.getValueWithMask(unmasked, displayFmtMask);
|
|
8248
|
+
if (core.dayjs(masked, displayFormat, true).format(displayFormat) === masked) {
|
|
8249
|
+
return core.dayjs(masked, displayFormat).format(dateFormat);
|
|
8250
|
+
}
|
|
8228
8251
|
}
|
|
8229
|
-
const dateFmtMask =
|
|
8252
|
+
const dateFmtMask = dateFormat.replace(/[A-Za-z]/gi, '#');
|
|
8230
8253
|
masked = core.Mask.getValueWithMask(unmasked, dateFmtMask);
|
|
8231
8254
|
if (core.dayjs(masked, dateFormat, true).format(dateFormat) === masked) {
|
|
8232
8255
|
return masked;
|
|
@@ -10236,7 +10259,7 @@
|
|
|
10236
10259
|
/**
|
|
10237
10260
|
* Defines the format of a time displayed in picker. Available options are ampm and 24hr.
|
|
10238
10261
|
*/
|
|
10239
|
-
this.timeFormat = core.Config.timeFormat || 'ampm';
|
|
10262
|
+
this.timeFormat = core.Config.timeFormat || 'ampm'; // change props to pickerFormat
|
|
10240
10263
|
/**
|
|
10241
10264
|
* Forces 100% width.
|
|
10242
10265
|
*/
|
|
@@ -10267,29 +10290,18 @@
|
|
|
10267
10290
|
this.width = 290;
|
|
10268
10291
|
this.formatterFn = core.FormatterParserProvider.getFormatter('ZdTime');
|
|
10269
10292
|
this.parserFn = core.FormatterParserProvider.getParser('ZdTime');
|
|
10293
|
+
this.isoFormatValue = 'HH:mm';
|
|
10294
|
+
this.valueFormatInternal = core.Config.valueTimeFormat;
|
|
10295
|
+
this.displayFormatInternal = core.Config.displayTimeFormat;
|
|
10270
10296
|
/**
|
|
10271
|
-
*
|
|
10272
|
-
*/
|
|
10273
|
-
this.maskFunctions = {
|
|
10274
|
-
ampm: () => this.ampmMask(),
|
|
10275
|
-
'24hr': (value) => this.fullTimeMask(value),
|
|
10276
|
-
};
|
|
10277
|
-
/**
|
|
10278
|
-
* Format used in time value
|
|
10297
|
+
* Defines the time input format.
|
|
10279
10298
|
*/
|
|
10280
|
-
this.
|
|
10281
|
-
/**
|
|
10282
|
-
* Format used to display the value
|
|
10283
|
-
*/
|
|
10284
|
-
this.displayFormat = core.Config.displayTimeFormat;
|
|
10299
|
+
this.inputFormat = core.Config.timeInputFormat;
|
|
10285
10300
|
/**
|
|
10286
10301
|
* True when displayValue is valid
|
|
10287
10302
|
*/
|
|
10288
10303
|
this.isDisplayValid = true;
|
|
10289
|
-
|
|
10290
|
-
* Last invalid value passed to formatter
|
|
10291
|
-
*/
|
|
10292
|
-
this.lastInvalid = '';
|
|
10304
|
+
this.timeError = false;
|
|
10293
10305
|
this.allowedHours = this.getInitValue('allowedHours', props.allowedHours, this.allowedHours);
|
|
10294
10306
|
this.allowedMinutes = this.getInitValue('allowedMinutes', props.allowedMinutes, this.allowedMinutes);
|
|
10295
10307
|
this.allowedSeconds = this.getInitValue('allowedSeconds', props.allowedSeconds, this.allowedSeconds);
|
|
@@ -10303,40 +10315,40 @@
|
|
|
10303
10315
|
this.useSeconds = this.getInitValue('useSeconds', props.useSeconds, this.useSeconds);
|
|
10304
10316
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
10305
10317
|
this.autofill = this.getInitValue('autofill', props.autofill, this.autofill);
|
|
10306
|
-
this.mask = this.getInitValue('mask', props.mask, this.getMask);
|
|
10307
10318
|
this.timeValidation = this.timeValidation.bind(this);
|
|
10319
|
+
this.valueFormat = this.getInitValue('valueFormat', props.valueFormat, this.valueFormatInternal);
|
|
10320
|
+
this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormatInternal);
|
|
10321
|
+
this.inputFormat = this.getInitValue('inputFormat', props.inputFormat, this.inputFormat);
|
|
10308
10322
|
this.timeAllowedValidation = this.timeAllowedValidation.bind(this);
|
|
10309
10323
|
this.rules.push(this.timeValidation, this.timeAllowedValidation);
|
|
10310
|
-
this.
|
|
10311
|
-
this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormat);
|
|
10324
|
+
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
10312
10325
|
this.createAccessors();
|
|
10313
|
-
this.
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
delete this.valueFormat;
|
|
10321
|
-
this.valueFormat = valueFormat;
|
|
10322
|
-
},
|
|
10323
|
-
});
|
|
10326
|
+
this.initialMask = this.getInitialMask();
|
|
10327
|
+
this.isSimpleDisplay = this.isSimpleFormat(this.displayFormat);
|
|
10328
|
+
}
|
|
10329
|
+
get displayFormat() {
|
|
10330
|
+
const commonsDisplay = ['hh:mm A', 'hh:mm:ss A', 'HH:mm:ss', 'HH:mm'];
|
|
10331
|
+
if (commonsDisplay.includes(this.displayFormatInternal)) {
|
|
10332
|
+
this.displayFormatInternal = this.defaultFormats[this.timeFormat];
|
|
10324
10333
|
}
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10334
|
+
return this.displayFormatInternal;
|
|
10335
|
+
}
|
|
10336
|
+
set displayFormat(value) {
|
|
10337
|
+
this.displayFormatInternal = value;
|
|
10338
|
+
}
|
|
10339
|
+
get valueFormat() {
|
|
10340
|
+
const commonsDisplay = ['hh:mm A', 'hh:mm:ss A', 'HH:mm:ss', 'HH:mm'];
|
|
10341
|
+
if (commonsDisplay.includes(this.valueFormatInternal)) {
|
|
10342
|
+
this.valueFormatInternal = this.defaultFormats['24hr'];
|
|
10333
10343
|
}
|
|
10344
|
+
return this.valueFormatInternal;
|
|
10334
10345
|
}
|
|
10335
|
-
|
|
10336
|
-
|
|
10346
|
+
set valueFormat(value) {
|
|
10347
|
+
this.valueFormatInternal = value;
|
|
10337
10348
|
}
|
|
10338
|
-
get
|
|
10339
|
-
|
|
10349
|
+
get isoFormat() {
|
|
10350
|
+
this.isoFormatValue = this.useSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
10351
|
+
return this.isoFormatValue;
|
|
10340
10352
|
}
|
|
10341
10353
|
get defaultFormats() {
|
|
10342
10354
|
const seconds = this.useSeconds ? ':ss' : '';
|
|
@@ -10345,59 +10357,172 @@
|
|
|
10345
10357
|
'24hr': `HH:mm${seconds}`,
|
|
10346
10358
|
};
|
|
10347
10359
|
}
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10360
|
+
getInitialMask() {
|
|
10361
|
+
if (isUndefined__default["default"](this.mask)) {
|
|
10362
|
+
this.mask = this.inputFormat && this.maskFormat(this.inputFormat);
|
|
10363
|
+
}
|
|
10364
|
+
return this.mask;
|
|
10365
|
+
}
|
|
10366
|
+
formatter(value) { return this.formatterFn(value, this); }
|
|
10367
|
+
parser(value) { return this.parserFn(value, this); }
|
|
10368
|
+
/**
|
|
10369
|
+
* Triggered when date is clicked.
|
|
10370
|
+
* @param event
|
|
10371
|
+
* @param element
|
|
10372
|
+
*/
|
|
10373
|
+
selectTime(time, event, element) {
|
|
10374
|
+
if (this.events.onSelectTime && typeof this.events.onSelectTime === 'function') {
|
|
10375
|
+
this.events.onSelectTime({
|
|
10376
|
+
time, event, element, component: this,
|
|
10377
|
+
});
|
|
10378
|
+
}
|
|
10379
|
+
}
|
|
10380
|
+
get displayValue() {
|
|
10381
|
+
return this.internalDisplayValue;
|
|
10382
|
+
}
|
|
10383
|
+
set displayValue(newValue) {
|
|
10384
|
+
this.timeError = false;
|
|
10385
|
+
this.internalDisplayValue = newValue;
|
|
10386
|
+
this.internalValue = this.parser(newValue);
|
|
10387
|
+
this.value = this.internalValue; // forces value accessor to be called if necessary
|
|
10388
|
+
}
|
|
10389
|
+
/**
|
|
10390
|
+
* Assign the updated mask to mask property
|
|
10391
|
+
*/
|
|
10392
|
+
updateMask() {
|
|
10393
|
+
this.isSimpleDisplay = this.isSimpleFormat(this.displayFormat);
|
|
10394
|
+
this.mask = this.getUpdatedMask();
|
|
10395
|
+
return this.mask;
|
|
10396
|
+
}
|
|
10397
|
+
/**
|
|
10398
|
+
* Gets the updated masked, based on displayFormat if the initial mask is undefined
|
|
10399
|
+
*/
|
|
10400
|
+
getUpdatedMask() {
|
|
10401
|
+
if (isUndefined__default["default"](this.initialMask)) {
|
|
10402
|
+
return this.maskFormat(this.displayFormat);
|
|
10353
10403
|
}
|
|
10354
|
-
|
|
10355
|
-
|
|
10404
|
+
return this.mask;
|
|
10405
|
+
}
|
|
10406
|
+
maskFormat(format) {
|
|
10407
|
+
return format.replace(/[A-Za-z]/gi, '#');
|
|
10408
|
+
}
|
|
10409
|
+
setTimeValue(displayValue) {
|
|
10410
|
+
const lastValue = this.displayValue;
|
|
10411
|
+
if (this.isValidTime(displayValue, this.displayFormat)) {
|
|
10412
|
+
this.internalDisplayValue = displayValue;
|
|
10413
|
+
this.internalValue = this.parser(displayValue);
|
|
10414
|
+
this.timeError = false;
|
|
10415
|
+
if (lastValue !== this.displayValue)
|
|
10416
|
+
this.change(this.value);
|
|
10356
10417
|
}
|
|
10357
10418
|
else {
|
|
10358
|
-
|
|
10419
|
+
if (!displayValue) {
|
|
10420
|
+
this.internalDisplayValue = displayValue;
|
|
10421
|
+
this.internalValue = null;
|
|
10422
|
+
if (lastValue !== this.displayValue)
|
|
10423
|
+
this.change(this.value);
|
|
10424
|
+
}
|
|
10425
|
+
this.timeError = !!displayValue;
|
|
10359
10426
|
}
|
|
10360
|
-
|
|
10361
|
-
const seconds = this.useSeconds ? [':', ...minutes] : [];
|
|
10362
|
-
const ampm = /(A|P)/;
|
|
10363
|
-
return [...hours, ':', ...minutes, ...seconds, ' ', ampm, 'M'];
|
|
10427
|
+
this.value = this.internalValue; // forces value accessor to be called if necessary
|
|
10364
10428
|
}
|
|
10365
|
-
|
|
10366
|
-
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10429
|
+
isValidTime(value, format, strict = true) {
|
|
10430
|
+
return core.dayjs(value, format, strict).isValid();
|
|
10431
|
+
}
|
|
10432
|
+
get isoValue() {
|
|
10433
|
+
return this.formatISOTimeValue(this.value);
|
|
10434
|
+
}
|
|
10435
|
+
set isoValue(newValue) {
|
|
10436
|
+
const lastValue = this.value;
|
|
10437
|
+
this.timeError = false;
|
|
10438
|
+
this.value = this.parseISOTimeValue(newValue);
|
|
10439
|
+
if (lastValue !== this.value)
|
|
10440
|
+
this.change(this.value);
|
|
10373
10441
|
}
|
|
10374
|
-
|
|
10375
|
-
|
|
10442
|
+
formatISOTimeValue(value) {
|
|
10443
|
+
if (value && this.isValidTime(value, this.valueFormat)) {
|
|
10444
|
+
return core.dayjs(value, this.valueFormat).format(this.isoFormat);
|
|
10445
|
+
}
|
|
10446
|
+
return '';
|
|
10447
|
+
}
|
|
10448
|
+
parseISOTimeValue(value) {
|
|
10449
|
+
if (value && this.isValidTime(value, this.valueFormat)) {
|
|
10450
|
+
return core.dayjs(value, this.isoFormat).format(this.valueFormat);
|
|
10451
|
+
}
|
|
10452
|
+
return null;
|
|
10376
10453
|
}
|
|
10377
10454
|
/**
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10455
|
+
* Checks if a time format is simple.
|
|
10456
|
+
* Simple time formats are the ones that consists only of 'HH', 'mm', 'mm' or 'YYYY', and mask delimiters
|
|
10457
|
+
* @param format The format to be checked
|
|
10458
|
+
* @returns true if it is simple, false otherwise
|
|
10459
|
+
*/
|
|
10460
|
+
isSimpleFormat(format) {
|
|
10461
|
+
const simpleTokens = ['HH', 'mm', 'ss', 'hh', 'A', 'a', 'p', 'P'];
|
|
10462
|
+
// remove the simple tokens from the string
|
|
10463
|
+
const replaced = simpleTokens.reduce((result, token) => result.replace(token, ''), format);
|
|
10464
|
+
const chars = replaced.split('');
|
|
10465
|
+
return chars.length ? chars.every((char) => core.Mask.isMaskDelimiter(char)) : true;
|
|
10383
10466
|
}
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10467
|
+
timeValidation() {
|
|
10468
|
+
if (this.isValidTime(this.displayValue, this.displayFormat) || !this.displayValue) {
|
|
10469
|
+
return true;
|
|
10470
|
+
}
|
|
10471
|
+
return core.I18n.translate('VALIDATION_INVALID_TIME');
|
|
10472
|
+
}
|
|
10473
|
+
timeAllowedValidation() {
|
|
10474
|
+
return !this.displayValue
|
|
10475
|
+
|| (this.isValidTime(this.displayValue, this.displayFormat)
|
|
10476
|
+
&& this.isTimeAllowed())
|
|
10477
|
+
|| core.I18n.translate('VALIDATION_TIME_NOT_ALLOWED');
|
|
10478
|
+
}
|
|
10479
|
+
click(event, element) {
|
|
10480
|
+
const clickEvent = event || new MouseEvent('click');
|
|
10481
|
+
super.click(clickEvent, element);
|
|
10482
|
+
if (!clickEvent.defaultPrevented) {
|
|
10483
|
+
this.showTimePicker = !this.showTimePicker;
|
|
10390
10484
|
}
|
|
10391
|
-
return this.formatterFn(value, this);
|
|
10392
10485
|
}
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
this.
|
|
10396
|
-
|
|
10486
|
+
blur(event, element) {
|
|
10487
|
+
this.removeTimeMask();
|
|
10488
|
+
this.setTimeValue(this.formatter(this.value));
|
|
10489
|
+
super.blur(event, element);
|
|
10490
|
+
this.showTimePicker = false;
|
|
10397
10491
|
}
|
|
10398
|
-
|
|
10399
|
-
|
|
10492
|
+
focus(event, element) {
|
|
10493
|
+
this.addTimeMask();
|
|
10494
|
+
super.focus(event, element);
|
|
10495
|
+
}
|
|
10496
|
+
/**
|
|
10497
|
+
* Add date mask
|
|
10498
|
+
*/
|
|
10499
|
+
addTimeMask() {
|
|
10500
|
+
if (!this.value)
|
|
10501
|
+
return;
|
|
10502
|
+
this.mask = this.initialMask;
|
|
10503
|
+
this.internalDisplayValue = core.dayjs(this.value, this.valueFormat).format(this.inputFormat || this.displayFormat);
|
|
10400
10504
|
}
|
|
10505
|
+
/**
|
|
10506
|
+
* Removes the component mask if value is valid
|
|
10507
|
+
*/
|
|
10508
|
+
removeTimeMask() {
|
|
10509
|
+
if (isUndefined__default["default"](this.initialMask) || !this.value || this.timeError
|
|
10510
|
+
|| !this.isValidTime(this.value, this.valueFormat)) {
|
|
10511
|
+
return;
|
|
10512
|
+
}
|
|
10513
|
+
this.mask = '';
|
|
10514
|
+
}
|
|
10515
|
+
/**
|
|
10516
|
+
* Checks if value is valid according to valueFormat and if displayValue
|
|
10517
|
+
* is true
|
|
10518
|
+
*/
|
|
10519
|
+
isFullyValid(value = this.value) {
|
|
10520
|
+
return this.isValidTime(value, this.valueFormat, true) && this.isDisplayValid;
|
|
10521
|
+
}
|
|
10522
|
+
/**
|
|
10523
|
+
* Last invalid value passed to formatter
|
|
10524
|
+
*/
|
|
10525
|
+
// private lastInvalid: string = '';
|
|
10401
10526
|
isTimeAllowed(value = this.value) {
|
|
10402
10527
|
return this.isSameOrAfterMin(value) && this.isSameOrBeforeMax(value)
|
|
10403
10528
|
&& this.isHourAllowed(value) && this.isMinuteAllowed(value)
|
|
@@ -10433,49 +10558,54 @@
|
|
|
10433
10558
|
const second = core.dayjs(value, this.valueFormat).second();
|
|
10434
10559
|
return this.allowedSeconds.includes(second);
|
|
10435
10560
|
}
|
|
10436
|
-
timeValidation() {
|
|
10437
|
-
return !this.displayValue
|
|
10438
|
-
|| this.isValidTime(this.displayValue, this.displayFormat)
|
|
10439
|
-
|| core.I18n.translate('VALIDATION_INVALID_TIME');
|
|
10440
|
-
}
|
|
10441
|
-
timeAllowedValidation() {
|
|
10442
|
-
return !this.displayValue
|
|
10443
|
-
|| (this.isValidTime(this.displayValue, this.displayFormat)
|
|
10444
|
-
&& this.isTimeAllowed())
|
|
10445
|
-
|| core.I18n.translate('VALIDATION_TIME_NOT_ALLOWED');
|
|
10446
|
-
}
|
|
10447
|
-
click(event) {
|
|
10448
|
-
this.callEvent('click', {
|
|
10449
|
-
event: (event || new MouseEvent('click')),
|
|
10450
|
-
component: this,
|
|
10451
|
-
});
|
|
10452
|
-
if (!(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {
|
|
10453
|
-
this.showTimePicker = !this.showTimePicker;
|
|
10454
|
-
}
|
|
10455
|
-
}
|
|
10456
10561
|
clear() {
|
|
10457
10562
|
this.value = null;
|
|
10458
10563
|
this.change(this.value);
|
|
10459
10564
|
}
|
|
10460
10565
|
}
|
|
10461
|
-
core.FormatterParserProvider.registerFormatter('ZdTime', (value, { displayFormat = core.Config.
|
|
10566
|
+
core.FormatterParserProvider.registerFormatter('ZdTime', (value, { valueFormat = core.Config.valueTimeFormat, displayFormat = core.Config.displayTimeFormat, inputFormat = core.Config.timeInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
|
|
10462
10567
|
if (!value) {
|
|
10463
10568
|
return '';
|
|
10464
10569
|
}
|
|
10465
|
-
|
|
10466
|
-
|
|
10570
|
+
const isTimeValid = core.dayjs(value, valueFormat, true).isValid();
|
|
10571
|
+
if (!isTimeValid) {
|
|
10572
|
+
return value;
|
|
10467
10573
|
}
|
|
10468
|
-
|
|
10574
|
+
if (mask && initialMask) {
|
|
10575
|
+
if (inputFormat) {
|
|
10576
|
+
return core.dayjs(value, valueFormat).format(inputFormat);
|
|
10577
|
+
}
|
|
10578
|
+
let valueToUnmask = value;
|
|
10579
|
+
if (isSimpleDisplay) {
|
|
10580
|
+
valueToUnmask = core.dayjs(value, valueFormat).format(displayFormat);
|
|
10581
|
+
}
|
|
10582
|
+
const unmasked = core.Mask.getValueWithoutMask(valueToUnmask);
|
|
10583
|
+
const masked = core.Mask.getValueWithMask(unmasked, mask);
|
|
10584
|
+
return masked;
|
|
10585
|
+
}
|
|
10586
|
+
return core.dayjs(value, valueFormat).format(displayFormat);
|
|
10469
10587
|
});
|
|
10470
|
-
core.FormatterParserProvider.registerParser('ZdTime', (value, { displayFormat = core.Config.
|
|
10588
|
+
core.FormatterParserProvider.registerParser('ZdTime', (value, { displayFormat = core.Config.displayTimeFormat, valueFormat = core.Config.valueTimeFormat, mask = '', initialMask, } = {}) => {
|
|
10471
10589
|
if (!value) {
|
|
10472
10590
|
return null;
|
|
10473
10591
|
}
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10592
|
+
if (core.dayjs(value, displayFormat, true).isValid()) {
|
|
10593
|
+
return core.dayjs(value, displayFormat).format(valueFormat);
|
|
10594
|
+
}
|
|
10595
|
+
if (mask && core.Mask.checkMask(value, mask)) {
|
|
10596
|
+
const unmasked = core.Mask.getValueWithoutMask(value);
|
|
10597
|
+
let masked;
|
|
10598
|
+
if (!initialMask) {
|
|
10599
|
+
const displayFmtMask = displayFormat.replace(/[A-Za-z]/gi, '#');
|
|
10600
|
+
masked = core.Mask.getValueWithMask(unmasked, displayFmtMask);
|
|
10601
|
+
}
|
|
10602
|
+
const timeFmtMask = valueFormat.replace(/[A-Za-z]/gi, '#');
|
|
10603
|
+
masked = core.Mask.getValueWithMask(unmasked, timeFmtMask);
|
|
10604
|
+
if (core.dayjs(masked, valueFormat, true).format(valueFormat) === masked) {
|
|
10605
|
+
return masked;
|
|
10606
|
+
}
|
|
10477
10607
|
}
|
|
10478
|
-
return
|
|
10608
|
+
return value;
|
|
10479
10609
|
});
|
|
10480
10610
|
|
|
10481
10611
|
/**
|
|
@@ -10617,6 +10747,7 @@
|
|
|
10617
10747
|
this.checkedField = this.getInitValue('checkedField', props.checkedField, this.checkedField);
|
|
10618
10748
|
this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
|
|
10619
10749
|
this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
|
|
10750
|
+
this.disableCheckbox = this.getInitValue('disableCheckbox', props.disableCheckbox, this.disableCheckbox);
|
|
10620
10751
|
this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
|
|
10621
10752
|
this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
|
|
10622
10753
|
this.titleSlot = props.titleSlot || this.titleSlot;
|
|
@@ -10852,16 +10983,13 @@
|
|
|
10852
10983
|
const compName = component.name;
|
|
10853
10984
|
const instanceName = `${compName}_${nodePath}`;
|
|
10854
10985
|
const path = parentPath ? `${parentPath}.${compName}` : compName;
|
|
10855
|
-
const
|
|
10986
|
+
const newInstances = core.Metadata.getInstances(instanceName);
|
|
10987
|
+
const newInstance = newInstances[0];
|
|
10988
|
+
const appliedConditions = (_a = this.appliedConditions[nodePath]) === null || _a === void 0 ? void 0 : _a[path];
|
|
10989
|
+
const newComponent = merge__default["default"]({}, component, newInstance, appliedConditions);
|
|
10856
10990
|
const newChildren = this.getSlotComponent(newComponent.children || [], node, path);
|
|
10857
10991
|
newComponent.name = instanceName;
|
|
10858
10992
|
newComponent.children = newChildren;
|
|
10859
|
-
try {
|
|
10860
|
-
core.Metadata.updateInstance(instanceName, newComponent);
|
|
10861
|
-
}
|
|
10862
|
-
catch (e) {
|
|
10863
|
-
// do nothing
|
|
10864
|
-
}
|
|
10865
10993
|
newComponents.push(newComponent);
|
|
10866
10994
|
});
|
|
10867
10995
|
return newComponents;
|
|
@@ -10923,6 +11051,10 @@
|
|
|
10923
11051
|
return this.searchPath(currentNode.children || [], path.slice(1));
|
|
10924
11052
|
return currentNode;
|
|
10925
11053
|
}
|
|
11054
|
+
callDisableCheckbox(node) {
|
|
11055
|
+
return !!this.disableCheckbox && typeof this.disableCheckbox === 'function'
|
|
11056
|
+
&& this.disableCheckbox({ node, component: this });
|
|
11057
|
+
}
|
|
10926
11058
|
}
|
|
10927
11059
|
|
|
10928
11060
|
/**
|
|
@@ -11069,6 +11201,8 @@
|
|
|
11069
11201
|
const rows = [row, ...this.treeDataStructure.getChildren(row)];
|
|
11070
11202
|
if (isSelected) {
|
|
11071
11203
|
this.selectedRows = Array.from(new Set(this.selectedRows.concat(rows))); // remove duplicates
|
|
11204
|
+
// check if all the children of the parent are selected.
|
|
11205
|
+
this.selectParents(rows, row);
|
|
11072
11206
|
}
|
|
11073
11207
|
else {
|
|
11074
11208
|
rows.forEach((item) => {
|
|
@@ -11076,6 +11210,31 @@
|
|
|
11076
11210
|
if (index > -1)
|
|
11077
11211
|
this.selectedRows.splice(index, 1);
|
|
11078
11212
|
});
|
|
11213
|
+
this.unselectParents(row);
|
|
11214
|
+
}
|
|
11215
|
+
}
|
|
11216
|
+
selectParents(rows, row) {
|
|
11217
|
+
if (row[this.parentField]) {
|
|
11218
|
+
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11219
|
+
const every = this.treeDataStructure.getChildren(parentRow).every((item) => {
|
|
11220
|
+
const index = this.treeDataStructure.findDataIndex(this.selectedRows, item[this.datasource.uniqueKey]);
|
|
11221
|
+
if (index > -1)
|
|
11222
|
+
return true;
|
|
11223
|
+
return false;
|
|
11224
|
+
});
|
|
11225
|
+
if (every)
|
|
11226
|
+
rows.push(parentRow);
|
|
11227
|
+
this.selectedRows = Array.from(new Set(this.selectedRows.concat(rows))); // remove duplicates
|
|
11228
|
+
this.selectParents(rows, parentRow);
|
|
11229
|
+
}
|
|
11230
|
+
}
|
|
11231
|
+
unselectParents(row) {
|
|
11232
|
+
if (row[this.parentField]) {
|
|
11233
|
+
const index = this.treeDataStructure.findDataIndex(this.selectedRows, row[this.parentField]);
|
|
11234
|
+
if (index > -1)
|
|
11235
|
+
this.selectedRows.splice(index, 1);
|
|
11236
|
+
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11237
|
+
this.unselectParents(parentRow);
|
|
11079
11238
|
}
|
|
11080
11239
|
}
|
|
11081
11240
|
}
|
|
@@ -11110,6 +11269,7 @@
|
|
|
11110
11269
|
},
|
|
11111
11270
|
};
|
|
11112
11271
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
11272
|
+
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
11113
11273
|
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
11114
11274
|
this.createAccessors();
|
|
11115
11275
|
}
|
|
@@ -11163,10 +11323,10 @@
|
|
|
11163
11323
|
* @param event DOM event
|
|
11164
11324
|
* @param element DOM Element
|
|
11165
11325
|
*/
|
|
11166
|
-
cellClick(row, column, event, element) {
|
|
11326
|
+
cellClick(row, column, event, element, canEdit = true) {
|
|
11167
11327
|
if (this.editing)
|
|
11168
11328
|
return;
|
|
11169
|
-
if (column.editable) {
|
|
11329
|
+
if (column.editable && canEdit) {
|
|
11170
11330
|
this.editing = true;
|
|
11171
11331
|
this.preventRowClick = true;
|
|
11172
11332
|
this.datasource.currentRow = row;
|
|
@@ -11483,6 +11643,9 @@
|
|
|
11483
11643
|
throw e;
|
|
11484
11644
|
}
|
|
11485
11645
|
}
|
|
11646
|
+
callCanEditRow(row) {
|
|
11647
|
+
return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
|
|
11648
|
+
}
|
|
11486
11649
|
}
|
|
11487
11650
|
|
|
11488
11651
|
class Icons {
|
|
@@ -11926,9 +12089,9 @@
|
|
|
11926
12089
|
};
|
|
11927
12090
|
this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
11928
12091
|
}
|
|
11929
|
-
|
|
12092
|
+
getColumnsWidth(columns) {
|
|
11930
12093
|
const widths = {};
|
|
11931
|
-
let totalWidth;
|
|
12094
|
+
let totalWidth = 0;
|
|
11932
12095
|
try {
|
|
11933
12096
|
totalWidth = columns.reduce((sum, col) => {
|
|
11934
12097
|
widths[col.name] = col.getWidth();
|
|
@@ -11940,6 +12103,10 @@
|
|
|
11940
12103
|
throw e;
|
|
11941
12104
|
}
|
|
11942
12105
|
}
|
|
12106
|
+
return { widths, totalWidth };
|
|
12107
|
+
}
|
|
12108
|
+
buildColumns(columns) {
|
|
12109
|
+
const { widths, totalWidth } = this.getColumnsWidth(columns);
|
|
11943
12110
|
return columns.reduce((result, col, index) => {
|
|
11944
12111
|
let size;
|
|
11945
12112
|
if (!totalWidth) {
|
|
@@ -11952,63 +12119,20 @@
|
|
|
11952
12119
|
align: col.align || 'left',
|
|
11953
12120
|
description: col.label,
|
|
11954
12121
|
sequence: index,
|
|
11955
|
-
format: this.getFormatOfColumn(col),
|
|
11956
12122
|
size: `${size}%`,
|
|
11957
12123
|
xlsType: col.xlsType,
|
|
11958
12124
|
};
|
|
11959
12125
|
return Object.assign(Object.assign({}, result), { [col.name]: row });
|
|
11960
12126
|
}, {});
|
|
11961
12127
|
}
|
|
11962
|
-
|
|
11963
|
-
return
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
}
|
|
11970
|
-
return value;
|
|
11971
|
-
}
|
|
11972
|
-
getFormatOfColumn(column) {
|
|
11973
|
-
let format;
|
|
11974
|
-
let { mask } = column;
|
|
11975
|
-
if (mask) {
|
|
11976
|
-
format = {
|
|
11977
|
-
type: 'fix',
|
|
11978
|
-
params: {
|
|
11979
|
-
mask,
|
|
11980
|
-
},
|
|
11981
|
-
};
|
|
11982
|
-
}
|
|
11983
|
-
else if (column.componentProps && Object.keys(column.componentProps).length) {
|
|
11984
|
-
const { component } = column.componentProps;
|
|
11985
|
-
if (this.isNumberComponent(component)) {
|
|
11986
|
-
format = { type: 'float' };
|
|
11987
|
-
mask = this.checkAccessor(column.componentProps.mask);
|
|
11988
|
-
if (mask) {
|
|
11989
|
-
format.params = {};
|
|
11990
|
-
if (mask.currencySymbol) {
|
|
11991
|
-
format.type = 'currency';
|
|
11992
|
-
format.symbol = mask.currencySymbol;
|
|
11993
|
-
format.decimal = mask.decimalCharacter;
|
|
11994
|
-
format.thousands = mask.digitGroupSeparator;
|
|
11995
|
-
format.precision = mask.decimalPlaces;
|
|
11996
|
-
}
|
|
11997
|
-
else {
|
|
11998
|
-
format.params.decimal = mask.decimalCharacter;
|
|
11999
|
-
format.params.thousands = mask.digitGroupSeparator;
|
|
12000
|
-
format.params.precision = mask.decimalPlaces;
|
|
12001
|
-
}
|
|
12002
|
-
}
|
|
12003
|
-
}
|
|
12004
|
-
}
|
|
12005
|
-
return format;
|
|
12006
|
-
}
|
|
12007
|
-
buildFilter(filter) {
|
|
12008
|
-
return Object.keys(filter).map((key) => ({
|
|
12009
|
-
label: key,
|
|
12010
|
-
value: core.I18n.translate('IS_EQUAL', { value: filter[key] }),
|
|
12011
|
-
}));
|
|
12128
|
+
buildFilter(filter, columns) {
|
|
12129
|
+
return Object.keys(filter).map((key) => {
|
|
12130
|
+
var _a;
|
|
12131
|
+
return ({
|
|
12132
|
+
label: ((_a = columns.find((col) => col.name === key)) === null || _a === void 0 ? void 0 : _a.label) || key,
|
|
12133
|
+
value: core.I18n.translate('IS_EQUAL', { value: filter[key] }),
|
|
12134
|
+
});
|
|
12135
|
+
});
|
|
12012
12136
|
}
|
|
12013
12137
|
formatLangCode(lang) {
|
|
12014
12138
|
if (!lang) {
|
|
@@ -12033,7 +12157,7 @@
|
|
|
12033
12157
|
}
|
|
12034
12158
|
buildMetadata(name, title, columns, filter) {
|
|
12035
12159
|
const builtCols = this.buildColumns(columns);
|
|
12036
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12160
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12037
12161
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12038
12162
|
const clientLogo = '';
|
|
12039
12163
|
const enterpriseLogo = '';
|
|
@@ -12071,10 +12195,76 @@
|
|
|
12071
12195
|
buildDataset(data) {
|
|
12072
12196
|
return JSON.stringify(data);
|
|
12073
12197
|
}
|
|
12198
|
+
buildColumns(columns) {
|
|
12199
|
+
const { widths, totalWidth } = this.getColumnsWidth(columns);
|
|
12200
|
+
return columns.reduce((result, col, index) => {
|
|
12201
|
+
let size;
|
|
12202
|
+
if (!totalWidth) {
|
|
12203
|
+
size = Math.floor(100 / columns.length);
|
|
12204
|
+
}
|
|
12205
|
+
else {
|
|
12206
|
+
size = Math.floor((widths[col.name] * 100) / totalWidth);
|
|
12207
|
+
}
|
|
12208
|
+
const row = {
|
|
12209
|
+
align: col.align || 'left',
|
|
12210
|
+
description: col.label,
|
|
12211
|
+
sequence: index,
|
|
12212
|
+
format: this.getFormatOfColumn(col),
|
|
12213
|
+
size: `${size}%`,
|
|
12214
|
+
xlsType: col.xlsType,
|
|
12215
|
+
};
|
|
12216
|
+
return Object.assign(Object.assign({}, result), { [col.name]: row });
|
|
12217
|
+
}, {});
|
|
12218
|
+
}
|
|
12219
|
+
getFormatOfColumn(column) {
|
|
12220
|
+
let format;
|
|
12221
|
+
let { mask } = column;
|
|
12222
|
+
if (mask) {
|
|
12223
|
+
format = {
|
|
12224
|
+
type: 'fix',
|
|
12225
|
+
params: {
|
|
12226
|
+
mask,
|
|
12227
|
+
},
|
|
12228
|
+
};
|
|
12229
|
+
}
|
|
12230
|
+
else if (column.componentProps && Object.keys(column.componentProps).length) {
|
|
12231
|
+
const { component } = column.componentProps;
|
|
12232
|
+
if (this.isNumberComponent(component)) {
|
|
12233
|
+
format = { type: 'float' };
|
|
12234
|
+
mask = this.checkAccessor(column.componentProps.mask);
|
|
12235
|
+
if (mask) {
|
|
12236
|
+
format.params = {};
|
|
12237
|
+
if (mask.currencySymbol) {
|
|
12238
|
+
format.type = 'currency';
|
|
12239
|
+
format.symbol = mask.currencySymbol;
|
|
12240
|
+
format.decimal = mask.decimalCharacter;
|
|
12241
|
+
format.thousands = mask.digitGroupSeparator;
|
|
12242
|
+
format.precision = mask.decimalPlaces;
|
|
12243
|
+
}
|
|
12244
|
+
else {
|
|
12245
|
+
format.params.decimal = mask.decimalCharacter;
|
|
12246
|
+
format.params.thousands = mask.digitGroupSeparator;
|
|
12247
|
+
format.params.precision = mask.decimalPlaces;
|
|
12248
|
+
}
|
|
12249
|
+
}
|
|
12250
|
+
}
|
|
12251
|
+
}
|
|
12252
|
+
return format;
|
|
12253
|
+
}
|
|
12254
|
+
isNumberComponent(component) {
|
|
12255
|
+
return ['ZdNumber', 'ZdCurrency', 'ZdIncrement'].indexOf(component) !== -1;
|
|
12256
|
+
}
|
|
12257
|
+
checkAccessor(value) {
|
|
12258
|
+
if (core.Accessor.isAccessorDefinition(value)) {
|
|
12259
|
+
const [controller, accessor] = core.Accessor.getAccessor(value);
|
|
12260
|
+
return core.Loader.getInstance(controller)[accessor];
|
|
12261
|
+
}
|
|
12262
|
+
return value;
|
|
12263
|
+
}
|
|
12074
12264
|
buildMetadata(name, title, columns, filter, portrait = true) {
|
|
12075
12265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12076
12266
|
const builtCols = this.buildColumns(columns);
|
|
12077
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12267
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12078
12268
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12079
12269
|
let clientLogo = '';
|
|
12080
12270
|
let enterpriseLogo = '';
|
|
@@ -12152,6 +12342,7 @@
|
|
|
12152
12342
|
}
|
|
12153
12343
|
}
|
|
12154
12344
|
|
|
12345
|
+
// XLS without groups (formatXLS = 'F3')
|
|
12155
12346
|
class XLSReport extends BaseReport {
|
|
12156
12347
|
constructor() {
|
|
12157
12348
|
super(...arguments);
|
|
@@ -12172,7 +12363,7 @@
|
|
|
12172
12363
|
}
|
|
12173
12364
|
buildMetadata(name, title, columns, filter) {
|
|
12174
12365
|
const builtCols = this.buildColumns(columns);
|
|
12175
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12366
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12176
12367
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12177
12368
|
const clientLogo = '';
|
|
12178
12369
|
const enterpriseLogo = '';
|
|
@@ -12198,13 +12389,14 @@
|
|
|
12198
12389
|
columns: builtCols,
|
|
12199
12390
|
filter: builtFilters,
|
|
12200
12391
|
reportXLS: true,
|
|
12392
|
+
formatXLS: 'F3',
|
|
12201
12393
|
xlsMergedCell: [],
|
|
12202
12394
|
};
|
|
12203
12395
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
12204
12396
|
}
|
|
12205
12397
|
}
|
|
12206
12398
|
|
|
12207
|
-
// XLS with groups
|
|
12399
|
+
// XLS with groups (formatXLS = 'F1')
|
|
12208
12400
|
class XLS2Report extends BaseReport {
|
|
12209
12401
|
constructor() {
|
|
12210
12402
|
super(...arguments);
|
|
@@ -12216,7 +12408,7 @@
|
|
|
12216
12408
|
}
|
|
12217
12409
|
buildMetadata(name, title, columns, filter) {
|
|
12218
12410
|
const builtCols = this.buildColumns(columns);
|
|
12219
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12411
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12220
12412
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12221
12413
|
const clientLogo = '';
|
|
12222
12414
|
const enterpriseLogo = '';
|
|
@@ -12242,6 +12434,7 @@
|
|
|
12242
12434
|
columns: builtCols,
|
|
12243
12435
|
filter: builtFilters,
|
|
12244
12436
|
reportXLS: true,
|
|
12437
|
+
formatXLS: 'F1',
|
|
12245
12438
|
xlsMergedCell: [],
|
|
12246
12439
|
};
|
|
12247
12440
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12400,7 +12593,7 @@
|
|
|
12400
12593
|
}
|
|
12401
12594
|
}
|
|
12402
12595
|
|
|
12403
|
-
// Grid mirror (with groups)
|
|
12596
|
+
// Grid mirror (with groups) (formatXLS = 'F2')
|
|
12404
12597
|
class XLS3Report extends BaseReport {
|
|
12405
12598
|
constructor() {
|
|
12406
12599
|
super(...arguments);
|
|
@@ -12412,7 +12605,7 @@
|
|
|
12412
12605
|
}
|
|
12413
12606
|
buildMetadata(name, title, columns, filter) {
|
|
12414
12607
|
const builtCols = this.buildColumns(columns);
|
|
12415
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12608
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12416
12609
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12417
12610
|
const clientLogo = '';
|
|
12418
12611
|
const enterpriseLogo = '';
|
|
@@ -12438,6 +12631,7 @@
|
|
|
12438
12631
|
columns: builtCols,
|
|
12439
12632
|
filter: builtFilters,
|
|
12440
12633
|
reportXLS: true,
|
|
12634
|
+
formatXLS: 'F2',
|
|
12441
12635
|
xlsMergedCell: [],
|
|
12442
12636
|
};
|
|
12443
12637
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12642,7 +12836,7 @@
|
|
|
12642
12836
|
const { route } = reportType;
|
|
12643
12837
|
const { name, columns, datasource } = this.iterable;
|
|
12644
12838
|
const { groupedData } = Object.assign({}, this.iterable);
|
|
12645
|
-
const formattedColumns = this.
|
|
12839
|
+
const formattedColumns = this.removeColumns(columns);
|
|
12646
12840
|
const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
|
|
12647
12841
|
let dataset;
|
|
12648
12842
|
if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
|
|
@@ -12684,8 +12878,8 @@
|
|
|
12684
12878
|
return new URL(reportFile, this.fileEndPoint).href;
|
|
12685
12879
|
});
|
|
12686
12880
|
}
|
|
12687
|
-
|
|
12688
|
-
return columns.filter((item) => item.type !== 'action');
|
|
12881
|
+
removeColumns(columns) {
|
|
12882
|
+
return columns.filter((item) => (item.type !== 'action' && item.isVisible));
|
|
12689
12883
|
}
|
|
12690
12884
|
}
|
|
12691
12885
|
|
|
@@ -12710,6 +12904,7 @@
|
|
|
12710
12904
|
exports.Col = Col;
|
|
12711
12905
|
exports.CollapseCard = CollapseCard;
|
|
12712
12906
|
exports.Column = Column;
|
|
12907
|
+
exports.ColumnNotFoundError = ColumnNotFoundError;
|
|
12713
12908
|
exports.Component = Component;
|
|
12714
12909
|
exports.ComponentRender = ComponentRender;
|
|
12715
12910
|
exports.Container = Container;
|