@zeedhi/common 1.53.0 → 1.55.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 +442 -241
- package/dist/zd-common.umd.js +442 -240
- 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/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
|
-
/[0-2]/,
|
|
10368
|
-
value[0] === '2' ? /[0-3]/ : /[0-9]/,
|
|
10369
|
-
];
|
|
10370
|
-
const minutes = [/[0-5]/, /[0-9]/];
|
|
10371
|
-
const seconds = this.useSeconds ? [':', ...minutes] : [];
|
|
10372
|
-
return [...hours, ':', ...minutes, ...seconds];
|
|
10429
|
+
isValidTime(value, format, strict = true) {
|
|
10430
|
+
return core.dayjs(value, format, strict).isValid();
|
|
10373
10431
|
}
|
|
10374
|
-
|
|
10375
|
-
return this.
|
|
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);
|
|
10441
|
+
}
|
|
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
|
-
this.isDisplayValid = true;
|
|
10388
|
-
this.lastInvalid = value;
|
|
10389
|
-
return value;
|
|
10467
|
+
timeValidation() {
|
|
10468
|
+
if (this.isValidTime(this.displayValue, this.displayFormat) || !this.displayValue) {
|
|
10469
|
+
return true;
|
|
10390
10470
|
}
|
|
10391
|
-
return
|
|
10471
|
+
return core.I18n.translate('VALIDATION_INVALID_TIME');
|
|
10392
10472
|
}
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
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;
|
|
10484
|
+
}
|
|
10485
|
+
}
|
|
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);
|
|
10400
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);
|
|
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
|
-
return core.dayjs(uppecaseValue, displayFormat).format(valueFormat);
|
|
10592
|
+
if (core.dayjs(value, displayFormat, true).isValid()) {
|
|
10593
|
+
return core.dayjs(value, displayFormat).format(valueFormat);
|
|
10477
10594
|
}
|
|
10478
|
-
|
|
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
|
+
}
|
|
10607
|
+
}
|
|
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;
|
|
@@ -10849,15 +10980,19 @@
|
|
|
10849
10980
|
const nodePath = node.pathStr;
|
|
10850
10981
|
if (!nodePath)
|
|
10851
10982
|
return;
|
|
10852
|
-
const compName = component.name
|
|
10983
|
+
const compName = component.name.indexOf(`_${nodePath}`) > -1
|
|
10984
|
+
? component.name.substring(0, component.name.indexOf(`_${nodePath}`)) : component.name;
|
|
10853
10985
|
const instanceName = `${compName}_${nodePath}`;
|
|
10854
10986
|
const path = parentPath ? `${parentPath}.${compName}` : compName;
|
|
10855
|
-
const
|
|
10987
|
+
const newInstances = core.Metadata.getInstances(instanceName);
|
|
10988
|
+
const newInstance = newInstances[0];
|
|
10989
|
+
const appliedConditions = (_a = this.appliedConditions[nodePath]) === null || _a === void 0 ? void 0 : _a[path];
|
|
10990
|
+
const newComponent = merge__default["default"]({}, component, newInstance, appliedConditions);
|
|
10856
10991
|
const newChildren = this.getSlotComponent(newComponent.children || [], node, path);
|
|
10857
10992
|
newComponent.name = instanceName;
|
|
10858
10993
|
newComponent.children = newChildren;
|
|
10859
10994
|
try {
|
|
10860
|
-
core.Metadata.updateInstance(instanceName,
|
|
10995
|
+
core.Metadata.updateInstance(instanceName, appliedConditions);
|
|
10861
10996
|
}
|
|
10862
10997
|
catch (e) {
|
|
10863
10998
|
// do nothing
|
|
@@ -10923,6 +11058,10 @@
|
|
|
10923
11058
|
return this.searchPath(currentNode.children || [], path.slice(1));
|
|
10924
11059
|
return currentNode;
|
|
10925
11060
|
}
|
|
11061
|
+
callDisableCheckbox(node) {
|
|
11062
|
+
return !!this.disableCheckbox && typeof this.disableCheckbox === 'function'
|
|
11063
|
+
&& this.disableCheckbox({ node, component: this });
|
|
11064
|
+
}
|
|
10926
11065
|
}
|
|
10927
11066
|
|
|
10928
11067
|
/**
|
|
@@ -11069,6 +11208,8 @@
|
|
|
11069
11208
|
const rows = [row, ...this.treeDataStructure.getChildren(row)];
|
|
11070
11209
|
if (isSelected) {
|
|
11071
11210
|
this.selectedRows = Array.from(new Set(this.selectedRows.concat(rows))); // remove duplicates
|
|
11211
|
+
// check if all the children of the parent are selected.
|
|
11212
|
+
this.selectParents(rows, row);
|
|
11072
11213
|
}
|
|
11073
11214
|
else {
|
|
11074
11215
|
rows.forEach((item) => {
|
|
@@ -11076,6 +11217,31 @@
|
|
|
11076
11217
|
if (index > -1)
|
|
11077
11218
|
this.selectedRows.splice(index, 1);
|
|
11078
11219
|
});
|
|
11220
|
+
this.unselectParents(row);
|
|
11221
|
+
}
|
|
11222
|
+
}
|
|
11223
|
+
selectParents(rows, row) {
|
|
11224
|
+
if (row[this.parentField]) {
|
|
11225
|
+
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11226
|
+
const every = this.treeDataStructure.getChildren(parentRow).every((item) => {
|
|
11227
|
+
const index = this.treeDataStructure.findDataIndex(this.selectedRows, item[this.datasource.uniqueKey]);
|
|
11228
|
+
if (index > -1)
|
|
11229
|
+
return true;
|
|
11230
|
+
return false;
|
|
11231
|
+
});
|
|
11232
|
+
if (every)
|
|
11233
|
+
rows.push(parentRow);
|
|
11234
|
+
this.selectedRows = Array.from(new Set(this.selectedRows.concat(rows))); // remove duplicates
|
|
11235
|
+
this.selectParents(rows, parentRow);
|
|
11236
|
+
}
|
|
11237
|
+
}
|
|
11238
|
+
unselectParents(row) {
|
|
11239
|
+
if (row[this.parentField]) {
|
|
11240
|
+
const index = this.treeDataStructure.findDataIndex(this.selectedRows, row[this.parentField]);
|
|
11241
|
+
if (index > -1)
|
|
11242
|
+
this.selectedRows.splice(index, 1);
|
|
11243
|
+
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11244
|
+
this.unselectParents(parentRow);
|
|
11079
11245
|
}
|
|
11080
11246
|
}
|
|
11081
11247
|
}
|
|
@@ -11110,6 +11276,7 @@
|
|
|
11110
11276
|
},
|
|
11111
11277
|
};
|
|
11112
11278
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
11279
|
+
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
11113
11280
|
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
11114
11281
|
this.createAccessors();
|
|
11115
11282
|
}
|
|
@@ -11163,10 +11330,10 @@
|
|
|
11163
11330
|
* @param event DOM event
|
|
11164
11331
|
* @param element DOM Element
|
|
11165
11332
|
*/
|
|
11166
|
-
cellClick(row, column, event, element) {
|
|
11333
|
+
cellClick(row, column, event, element, canEdit = true) {
|
|
11167
11334
|
if (this.editing)
|
|
11168
11335
|
return;
|
|
11169
|
-
if (column.editable) {
|
|
11336
|
+
if (column.editable && canEdit) {
|
|
11170
11337
|
this.editing = true;
|
|
11171
11338
|
this.preventRowClick = true;
|
|
11172
11339
|
this.datasource.currentRow = row;
|
|
@@ -11483,6 +11650,9 @@
|
|
|
11483
11650
|
throw e;
|
|
11484
11651
|
}
|
|
11485
11652
|
}
|
|
11653
|
+
callCanEditRow(row) {
|
|
11654
|
+
return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
|
|
11655
|
+
}
|
|
11486
11656
|
}
|
|
11487
11657
|
|
|
11488
11658
|
class Icons {
|
|
@@ -11926,9 +12096,9 @@
|
|
|
11926
12096
|
};
|
|
11927
12097
|
this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
11928
12098
|
}
|
|
11929
|
-
|
|
12099
|
+
getColumnsWidth(columns) {
|
|
11930
12100
|
const widths = {};
|
|
11931
|
-
let totalWidth;
|
|
12101
|
+
let totalWidth = 0;
|
|
11932
12102
|
try {
|
|
11933
12103
|
totalWidth = columns.reduce((sum, col) => {
|
|
11934
12104
|
widths[col.name] = col.getWidth();
|
|
@@ -11940,6 +12110,10 @@
|
|
|
11940
12110
|
throw e;
|
|
11941
12111
|
}
|
|
11942
12112
|
}
|
|
12113
|
+
return { widths, totalWidth };
|
|
12114
|
+
}
|
|
12115
|
+
buildColumns(columns) {
|
|
12116
|
+
const { widths, totalWidth } = this.getColumnsWidth(columns);
|
|
11943
12117
|
return columns.reduce((result, col, index) => {
|
|
11944
12118
|
let size;
|
|
11945
12119
|
if (!totalWidth) {
|
|
@@ -11952,63 +12126,20 @@
|
|
|
11952
12126
|
align: col.align || 'left',
|
|
11953
12127
|
description: col.label,
|
|
11954
12128
|
sequence: index,
|
|
11955
|
-
format: this.getFormatOfColumn(col),
|
|
11956
12129
|
size: `${size}%`,
|
|
11957
12130
|
xlsType: col.xlsType,
|
|
11958
12131
|
};
|
|
11959
12132
|
return Object.assign(Object.assign({}, result), { [col.name]: row });
|
|
11960
12133
|
}, {});
|
|
11961
12134
|
}
|
|
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
|
-
}));
|
|
12135
|
+
buildFilter(filter, columns) {
|
|
12136
|
+
return Object.keys(filter).map((key) => {
|
|
12137
|
+
var _a;
|
|
12138
|
+
return ({
|
|
12139
|
+
label: ((_a = columns.find((col) => col.name === key)) === null || _a === void 0 ? void 0 : _a.label) || key,
|
|
12140
|
+
value: core.I18n.translate('IS_EQUAL', { value: filter[key] }),
|
|
12141
|
+
});
|
|
12142
|
+
});
|
|
12012
12143
|
}
|
|
12013
12144
|
formatLangCode(lang) {
|
|
12014
12145
|
if (!lang) {
|
|
@@ -12033,7 +12164,7 @@
|
|
|
12033
12164
|
}
|
|
12034
12165
|
buildMetadata(name, title, columns, filter) {
|
|
12035
12166
|
const builtCols = this.buildColumns(columns);
|
|
12036
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12167
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12037
12168
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12038
12169
|
const clientLogo = '';
|
|
12039
12170
|
const enterpriseLogo = '';
|
|
@@ -12071,10 +12202,76 @@
|
|
|
12071
12202
|
buildDataset(data) {
|
|
12072
12203
|
return JSON.stringify(data);
|
|
12073
12204
|
}
|
|
12205
|
+
buildColumns(columns) {
|
|
12206
|
+
const { widths, totalWidth } = this.getColumnsWidth(columns);
|
|
12207
|
+
return columns.reduce((result, col, index) => {
|
|
12208
|
+
let size;
|
|
12209
|
+
if (!totalWidth) {
|
|
12210
|
+
size = Math.floor(100 / columns.length);
|
|
12211
|
+
}
|
|
12212
|
+
else {
|
|
12213
|
+
size = Math.floor((widths[col.name] * 100) / totalWidth);
|
|
12214
|
+
}
|
|
12215
|
+
const row = {
|
|
12216
|
+
align: col.align || 'left',
|
|
12217
|
+
description: col.label,
|
|
12218
|
+
sequence: index,
|
|
12219
|
+
format: this.getFormatOfColumn(col),
|
|
12220
|
+
size: `${size}%`,
|
|
12221
|
+
xlsType: col.xlsType,
|
|
12222
|
+
};
|
|
12223
|
+
return Object.assign(Object.assign({}, result), { [col.name]: row });
|
|
12224
|
+
}, {});
|
|
12225
|
+
}
|
|
12226
|
+
getFormatOfColumn(column) {
|
|
12227
|
+
let format;
|
|
12228
|
+
let { mask } = column;
|
|
12229
|
+
if (mask) {
|
|
12230
|
+
format = {
|
|
12231
|
+
type: 'fix',
|
|
12232
|
+
params: {
|
|
12233
|
+
mask,
|
|
12234
|
+
},
|
|
12235
|
+
};
|
|
12236
|
+
}
|
|
12237
|
+
else if (column.componentProps && Object.keys(column.componentProps).length) {
|
|
12238
|
+
const { component } = column.componentProps;
|
|
12239
|
+
if (this.isNumberComponent(component)) {
|
|
12240
|
+
format = { type: 'float' };
|
|
12241
|
+
mask = this.checkAccessor(column.componentProps.mask);
|
|
12242
|
+
if (mask) {
|
|
12243
|
+
format.params = {};
|
|
12244
|
+
if (mask.currencySymbol) {
|
|
12245
|
+
format.type = 'currency';
|
|
12246
|
+
format.symbol = mask.currencySymbol;
|
|
12247
|
+
format.decimal = mask.decimalCharacter;
|
|
12248
|
+
format.thousands = mask.digitGroupSeparator;
|
|
12249
|
+
format.precision = mask.decimalPlaces;
|
|
12250
|
+
}
|
|
12251
|
+
else {
|
|
12252
|
+
format.params.decimal = mask.decimalCharacter;
|
|
12253
|
+
format.params.thousands = mask.digitGroupSeparator;
|
|
12254
|
+
format.params.precision = mask.decimalPlaces;
|
|
12255
|
+
}
|
|
12256
|
+
}
|
|
12257
|
+
}
|
|
12258
|
+
}
|
|
12259
|
+
return format;
|
|
12260
|
+
}
|
|
12261
|
+
isNumberComponent(component) {
|
|
12262
|
+
return ['ZdNumber', 'ZdCurrency', 'ZdIncrement'].indexOf(component) !== -1;
|
|
12263
|
+
}
|
|
12264
|
+
checkAccessor(value) {
|
|
12265
|
+
if (core.Accessor.isAccessorDefinition(value)) {
|
|
12266
|
+
const [controller, accessor] = core.Accessor.getAccessor(value);
|
|
12267
|
+
return core.Loader.getInstance(controller)[accessor];
|
|
12268
|
+
}
|
|
12269
|
+
return value;
|
|
12270
|
+
}
|
|
12074
12271
|
buildMetadata(name, title, columns, filter, portrait = true) {
|
|
12075
12272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12076
12273
|
const builtCols = this.buildColumns(columns);
|
|
12077
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12274
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12078
12275
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12079
12276
|
let clientLogo = '';
|
|
12080
12277
|
let enterpriseLogo = '';
|
|
@@ -12152,6 +12349,7 @@
|
|
|
12152
12349
|
}
|
|
12153
12350
|
}
|
|
12154
12351
|
|
|
12352
|
+
// XLS without groups (formatXLS = 'F3')
|
|
12155
12353
|
class XLSReport extends BaseReport {
|
|
12156
12354
|
constructor() {
|
|
12157
12355
|
super(...arguments);
|
|
@@ -12172,7 +12370,7 @@
|
|
|
12172
12370
|
}
|
|
12173
12371
|
buildMetadata(name, title, columns, filter) {
|
|
12174
12372
|
const builtCols = this.buildColumns(columns);
|
|
12175
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12373
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12176
12374
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12177
12375
|
const clientLogo = '';
|
|
12178
12376
|
const enterpriseLogo = '';
|
|
@@ -12198,13 +12396,14 @@
|
|
|
12198
12396
|
columns: builtCols,
|
|
12199
12397
|
filter: builtFilters,
|
|
12200
12398
|
reportXLS: true,
|
|
12399
|
+
formatXLS: 'F3',
|
|
12201
12400
|
xlsMergedCell: [],
|
|
12202
12401
|
};
|
|
12203
12402
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
12204
12403
|
}
|
|
12205
12404
|
}
|
|
12206
12405
|
|
|
12207
|
-
// XLS with groups
|
|
12406
|
+
// XLS with groups (formatXLS = 'F1')
|
|
12208
12407
|
class XLS2Report extends BaseReport {
|
|
12209
12408
|
constructor() {
|
|
12210
12409
|
super(...arguments);
|
|
@@ -12216,7 +12415,7 @@
|
|
|
12216
12415
|
}
|
|
12217
12416
|
buildMetadata(name, title, columns, filter) {
|
|
12218
12417
|
const builtCols = this.buildColumns(columns);
|
|
12219
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12418
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12220
12419
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12221
12420
|
const clientLogo = '';
|
|
12222
12421
|
const enterpriseLogo = '';
|
|
@@ -12242,6 +12441,7 @@
|
|
|
12242
12441
|
columns: builtCols,
|
|
12243
12442
|
filter: builtFilters,
|
|
12244
12443
|
reportXLS: true,
|
|
12444
|
+
formatXLS: 'F1',
|
|
12245
12445
|
xlsMergedCell: [],
|
|
12246
12446
|
};
|
|
12247
12447
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12400,7 +12600,7 @@
|
|
|
12400
12600
|
}
|
|
12401
12601
|
}
|
|
12402
12602
|
|
|
12403
|
-
// Grid mirror (with groups)
|
|
12603
|
+
// Grid mirror (with groups) (formatXLS = 'F2')
|
|
12404
12604
|
class XLS3Report extends BaseReport {
|
|
12405
12605
|
constructor() {
|
|
12406
12606
|
super(...arguments);
|
|
@@ -12412,7 +12612,7 @@
|
|
|
12412
12612
|
}
|
|
12413
12613
|
buildMetadata(name, title, columns, filter) {
|
|
12414
12614
|
const builtCols = this.buildColumns(columns);
|
|
12415
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12615
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12416
12616
|
const lang = this.formatLangCode(core.I18n.instance.language);
|
|
12417
12617
|
const clientLogo = '';
|
|
12418
12618
|
const enterpriseLogo = '';
|
|
@@ -12438,6 +12638,7 @@
|
|
|
12438
12638
|
columns: builtCols,
|
|
12439
12639
|
filter: builtFilters,
|
|
12440
12640
|
reportXLS: true,
|
|
12641
|
+
formatXLS: 'F2',
|
|
12441
12642
|
xlsMergedCell: [],
|
|
12442
12643
|
};
|
|
12443
12644
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12710,6 +12911,7 @@
|
|
|
12710
12911
|
exports.Col = Col;
|
|
12711
12912
|
exports.CollapseCard = CollapseCard;
|
|
12712
12913
|
exports.Column = Column;
|
|
12914
|
+
exports.ColumnNotFoundError = ColumnNotFoundError;
|
|
12713
12915
|
exports.Component = Component;
|
|
12714
12916
|
exports.ComponentRender = ComponentRender;
|
|
12715
12917
|
exports.Container = Container;
|