@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.esm.js
CHANGED
|
@@ -2908,8 +2908,6 @@ class Dashboard extends ComponentRender {
|
|
|
2908
2908
|
this.moveMode = false;
|
|
2909
2909
|
/* Cards */
|
|
2910
2910
|
this.cards = [];
|
|
2911
|
-
/* Card ID to be deleted */
|
|
2912
|
-
this.deleteCardId = '';
|
|
2913
2911
|
this.overrideNamedProps = {};
|
|
2914
2912
|
/* Remove the paddings of the dashboard */
|
|
2915
2913
|
this.removePadding = false;
|
|
@@ -3002,7 +3000,9 @@ class Dashboard extends ComponentRender {
|
|
|
3002
3000
|
persistent: true,
|
|
3003
3001
|
title: 'EDIT_CARD',
|
|
3004
3002
|
grid: {
|
|
3005
|
-
|
|
3003
|
+
cols: 10,
|
|
3004
|
+
sm: 8,
|
|
3005
|
+
lg: 6,
|
|
3006
3006
|
},
|
|
3007
3007
|
children: [
|
|
3008
3008
|
{
|
|
@@ -3024,7 +3024,12 @@ class Dashboard extends ComponentRender {
|
|
|
3024
3024
|
minValue: 1,
|
|
3025
3025
|
clearable: false,
|
|
3026
3026
|
hint: 'Min: 1, Max: 12',
|
|
3027
|
-
|
|
3027
|
+
grid: {
|
|
3028
|
+
cols: 6,
|
|
3029
|
+
sm: 6,
|
|
3030
|
+
md: 4,
|
|
3031
|
+
lg: 3,
|
|
3032
|
+
},
|
|
3028
3033
|
mask: {
|
|
3029
3034
|
decimalPlaces: 0,
|
|
3030
3035
|
},
|
|
@@ -3033,19 +3038,33 @@ class Dashboard extends ComponentRender {
|
|
|
3033
3038
|
name: 'inputHeight',
|
|
3034
3039
|
component: 'ZdTextInput',
|
|
3035
3040
|
label: 'HEIGHT',
|
|
3036
|
-
|
|
3041
|
+
grid: {
|
|
3042
|
+
cols: 6,
|
|
3043
|
+
sm: 6,
|
|
3044
|
+
md: 4,
|
|
3045
|
+
lg: 3,
|
|
3046
|
+
},
|
|
3037
3047
|
},
|
|
3038
3048
|
{
|
|
3039
3049
|
name: 'inputPath',
|
|
3040
3050
|
component: 'ZdTextInput',
|
|
3041
3051
|
label: 'PATH',
|
|
3042
|
-
|
|
3052
|
+
grid: {
|
|
3053
|
+
cols: 7,
|
|
3054
|
+
sm: 7,
|
|
3055
|
+
md: 9,
|
|
3056
|
+
},
|
|
3043
3057
|
},
|
|
3044
3058
|
{
|
|
3045
3059
|
name: 'inputLocal',
|
|
3046
3060
|
component: 'ZdSwitch',
|
|
3047
3061
|
label: 'PATH_LOCAL',
|
|
3048
3062
|
cssClass: 'zd-mt-4',
|
|
3063
|
+
grid: {
|
|
3064
|
+
cols: 5,
|
|
3065
|
+
sm: 5,
|
|
3066
|
+
md: 3,
|
|
3067
|
+
},
|
|
3049
3068
|
},
|
|
3050
3069
|
],
|
|
3051
3070
|
},
|
|
@@ -3080,40 +3099,30 @@ class Dashboard extends ComponentRender {
|
|
|
3080
3099
|
/* Edit header */
|
|
3081
3100
|
this.headerLeftSlot = [
|
|
3082
3101
|
{
|
|
3083
|
-
name: `
|
|
3084
|
-
component: '
|
|
3085
|
-
bottom: true,
|
|
3102
|
+
name: `addDashboard${this.name}`,
|
|
3103
|
+
component: 'ZdButton',
|
|
3086
3104
|
label: 'ADD',
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
click: this.openModalAddCard.bind(this),
|
|
3096
|
-
},
|
|
3097
|
-
},
|
|
3098
|
-
],
|
|
3105
|
+
iconName: 'plus',
|
|
3106
|
+
color: 'white',
|
|
3107
|
+
small: true,
|
|
3108
|
+
cssClass: 'zd-my-2',
|
|
3109
|
+
outline: true,
|
|
3110
|
+
events: {
|
|
3111
|
+
click: this.openModalAddCard.bind(this),
|
|
3112
|
+
},
|
|
3099
3113
|
},
|
|
3100
3114
|
{
|
|
3101
|
-
name: `
|
|
3102
|
-
component: '
|
|
3103
|
-
bottom: true,
|
|
3115
|
+
name: `saveDashboard${this.name}`,
|
|
3116
|
+
component: 'ZdButton',
|
|
3104
3117
|
label: 'SAVE',
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
click: this.onSave.bind(this),
|
|
3114
|
-
},
|
|
3115
|
-
},
|
|
3116
|
-
],
|
|
3118
|
+
iconName: 'complete',
|
|
3119
|
+
color: 'white',
|
|
3120
|
+
small: true,
|
|
3121
|
+
cssClass: 'zd-my-2',
|
|
3122
|
+
outline: true,
|
|
3123
|
+
events: {
|
|
3124
|
+
click: this.onSave.bind(this),
|
|
3125
|
+
},
|
|
3117
3126
|
},
|
|
3118
3127
|
];
|
|
3119
3128
|
this.editingMode = this.getInitValue('editingMode', props.editingMode, this.editingMode);
|
|
@@ -3123,6 +3132,7 @@ class Dashboard extends ComponentRender {
|
|
|
3123
3132
|
this.removePadding = this.getInitValue('removePadding', props.removePadding, this.removePadding);
|
|
3124
3133
|
this.height = this.getInitValue('height', props.height, this.height);
|
|
3125
3134
|
this.heightAdjust = this.getInitValue('heightAdjust', props.heightAdjust, this.heightAdjust);
|
|
3135
|
+
this.cardFooterSlot = this.getInitValue('cardFooterSlot', props.cardFooterSlot, this.cardFooterSlot);
|
|
3126
3136
|
this.createAccessors();
|
|
3127
3137
|
}
|
|
3128
3138
|
onMounted(element) {
|
|
@@ -3152,17 +3162,19 @@ class Dashboard extends ComponentRender {
|
|
|
3152
3162
|
}
|
|
3153
3163
|
}
|
|
3154
3164
|
/* Delete a card */
|
|
3155
|
-
deleteCard() {
|
|
3165
|
+
deleteCard(cardId) {
|
|
3156
3166
|
this.cards.forEach((card, index) => {
|
|
3157
|
-
if (
|
|
3167
|
+
if (cardId === card.cardId) {
|
|
3158
3168
|
this.cards.splice(index, 1);
|
|
3159
3169
|
}
|
|
3160
3170
|
});
|
|
3171
|
+
}
|
|
3172
|
+
deleteAndCloseDialog(cardId) {
|
|
3173
|
+
this.deleteCard(cardId);
|
|
3161
3174
|
DialogService.hide();
|
|
3162
3175
|
}
|
|
3163
3176
|
/* Show delete card dialog */
|
|
3164
3177
|
showDeleteCardDialog(cardId) {
|
|
3165
|
-
this.deleteCardId = cardId;
|
|
3166
3178
|
this.hideDialog();
|
|
3167
3179
|
DialogService.show({
|
|
3168
3180
|
name: `${this.name}-delete-dialog`,
|
|
@@ -3184,7 +3196,7 @@ class Dashboard extends ComponentRender {
|
|
|
3184
3196
|
component: 'ZdButton',
|
|
3185
3197
|
label: 'YES',
|
|
3186
3198
|
events: {
|
|
3187
|
-
click: this.
|
|
3199
|
+
click: this.deleteAndCloseDialog.bind(this, cardId),
|
|
3188
3200
|
},
|
|
3189
3201
|
},
|
|
3190
3202
|
],
|
|
@@ -3256,6 +3268,8 @@ class Dashboard extends ComponentRender {
|
|
|
3256
3268
|
}
|
|
3257
3269
|
/* Return footer rightSlot props for view layer */
|
|
3258
3270
|
getFooterRightSlot(cardId) {
|
|
3271
|
+
if (this.cardFooterSlot)
|
|
3272
|
+
return this.cardFooterSlot;
|
|
3259
3273
|
const rightSlot = [
|
|
3260
3274
|
{
|
|
3261
3275
|
name: `tooltipDelete${cardId}`,
|
|
@@ -3299,6 +3313,9 @@ class Dashboard extends ComponentRender {
|
|
|
3299
3313
|
getCardId() {
|
|
3300
3314
|
return Math.random().toString(36).substr(2, 9);
|
|
3301
3315
|
}
|
|
3316
|
+
selectCard(cardId) {
|
|
3317
|
+
this.currentCardId = cardId;
|
|
3318
|
+
}
|
|
3302
3319
|
}
|
|
3303
3320
|
|
|
3304
3321
|
/**
|
|
@@ -3395,9 +3412,6 @@ class Date$1 extends TextInput {
|
|
|
3395
3412
|
this.pickerType = this.getInitValue('pickerType', props.pickerType, this.pickerType);
|
|
3396
3413
|
this.helperOptions = this.getInitValue('helperOptions', props.helperOptions, this.helperOptions);
|
|
3397
3414
|
this.helperValue = this.getInitValue('helperValue', props.helperValue, this.helperValue);
|
|
3398
|
-
if (this.pickerType === 'month') {
|
|
3399
|
-
this.isoFormat = 'YYYY-MM';
|
|
3400
|
-
}
|
|
3401
3415
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
3402
3416
|
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
3403
3417
|
this.createAccessors();
|
|
@@ -5203,6 +5217,7 @@ class Grid extends Iterable {
|
|
|
5203
5217
|
* @public
|
|
5204
5218
|
*/
|
|
5205
5219
|
this.resizeColumns = false;
|
|
5220
|
+
this.showSelectAll = true;
|
|
5206
5221
|
this.navigationKeyMapping = {
|
|
5207
5222
|
up: {
|
|
5208
5223
|
event: this.navigateUp.bind(this),
|
|
@@ -5252,6 +5267,8 @@ class Grid extends Iterable {
|
|
|
5252
5267
|
this.noResultSlot = this.changeDefaultSlotNames(this.noResultSlot);
|
|
5253
5268
|
this.noDataText = this.getInitValue('noDataText', props.noDataText, this.noDataText);
|
|
5254
5269
|
this.noResultsText = this.getInitValue('noResultsText', props.noResultsText, this.noResultsText);
|
|
5270
|
+
this.disableSelection = this.getInitValue('disableSelection', props.disableSelection, this.disableSelection);
|
|
5271
|
+
this.showSelectAll = this.getInitValue('showSelectAll', props.showSelectAll, this.showSelectAll);
|
|
5255
5272
|
this.createAccessors();
|
|
5256
5273
|
}
|
|
5257
5274
|
onMounted(element) {
|
|
@@ -5441,6 +5458,10 @@ class Grid extends Iterable {
|
|
|
5441
5458
|
});
|
|
5442
5459
|
return slot;
|
|
5443
5460
|
}
|
|
5461
|
+
callDisableSelection(row) {
|
|
5462
|
+
return !!this.disableSelection && typeof this.disableSelection === 'function'
|
|
5463
|
+
&& this.disableSelection({ row, component: this });
|
|
5464
|
+
}
|
|
5444
5465
|
}
|
|
5445
5466
|
|
|
5446
5467
|
/**
|
|
@@ -5518,6 +5539,7 @@ class GridEditable extends Grid {
|
|
|
5518
5539
|
};
|
|
5519
5540
|
this.newRowIdentifier = '__added_row';
|
|
5520
5541
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
5542
|
+
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
5521
5543
|
this.createAccessors();
|
|
5522
5544
|
}
|
|
5523
5545
|
onMounted(element) {
|
|
@@ -5570,10 +5592,10 @@ class GridEditable extends Grid {
|
|
|
5570
5592
|
* @param event DOM event
|
|
5571
5593
|
* @param element DOM Element
|
|
5572
5594
|
*/
|
|
5573
|
-
cellClick(row, column, event, element) {
|
|
5595
|
+
cellClick(row, column, event, element, canEdit = true) {
|
|
5574
5596
|
if (this.editing)
|
|
5575
5597
|
return;
|
|
5576
|
-
if (column.editable) {
|
|
5598
|
+
if (column.editable && canEdit) {
|
|
5577
5599
|
this.editing = true;
|
|
5578
5600
|
this.preventRowClick = true;
|
|
5579
5601
|
this.datasource.currentRow = row;
|
|
@@ -5922,6 +5944,9 @@ class GridEditable extends Grid {
|
|
|
5922
5944
|
throw e;
|
|
5923
5945
|
}
|
|
5924
5946
|
}
|
|
5947
|
+
callCanEditRow(row) {
|
|
5948
|
+
return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
|
|
5949
|
+
}
|
|
5925
5950
|
}
|
|
5926
5951
|
|
|
5927
5952
|
/**
|
|
@@ -8158,6 +8183,7 @@ class Month extends Date$1 {
|
|
|
8158
8183
|
* Defines the month input format.
|
|
8159
8184
|
*/
|
|
8160
8185
|
this.inputFormat = Config.monthInputFormat;
|
|
8186
|
+
this.isoFormat = 'YYYY-MM';
|
|
8161
8187
|
/**
|
|
8162
8188
|
* Determines the type of the picker - month for month picker.
|
|
8163
8189
|
*/
|
|
@@ -8167,19 +8193,11 @@ class Month extends Date$1 {
|
|
|
8167
8193
|
this.dateFormat = this.getInitValue('dateFormat', props.dateFormat, this.dateFormat);
|
|
8168
8194
|
this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormat);
|
|
8169
8195
|
this.inputFormat = this.getInitValue('inputFormat', props.inputFormat, this.inputFormat);
|
|
8196
|
+
this.pickerType = this.getInitValue('pickerType', undefined, this.pickerType);
|
|
8170
8197
|
this.createAccessors();
|
|
8171
8198
|
}
|
|
8172
|
-
maskFormat(format) {
|
|
8173
|
-
const monthIndex = format.indexOf('MMM');
|
|
8174
|
-
const replaced = format.replace(/[A-Za-z]/gi, '#');
|
|
8175
|
-
if (monthIndex === -1)
|
|
8176
|
-
return replaced;
|
|
8177
|
-
const arrFormat = replaced.split('');
|
|
8178
|
-
arrFormat.splice(monthIndex, 3, ...'CCC');
|
|
8179
|
-
return arrFormat.join('');
|
|
8180
|
-
}
|
|
8181
8199
|
}
|
|
8182
|
-
FormatterParserProvider.registerFormatter('ZdMonth', (value, { dateFormat = Config.monthFormat, displayFormat = Config.monthDisplayFormat, inputFormat = Config.monthInputFormat, mask = '', initialMask, } = {}) => {
|
|
8200
|
+
FormatterParserProvider.registerFormatter('ZdMonth', (value, { dateFormat = Config.monthFormat, displayFormat = Config.monthDisplayFormat, inputFormat = Config.monthInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
|
|
8183
8201
|
if (!value) {
|
|
8184
8202
|
return '';
|
|
8185
8203
|
}
|
|
@@ -8191,14 +8209,17 @@ FormatterParserProvider.registerFormatter('ZdMonth', (value, { dateFormat = Conf
|
|
|
8191
8209
|
if (inputFormat) {
|
|
8192
8210
|
return dayjs(value, dateFormat).format(inputFormat);
|
|
8193
8211
|
}
|
|
8194
|
-
|
|
8212
|
+
let valueToUnmask = value;
|
|
8213
|
+
if (isSimpleDisplay) {
|
|
8214
|
+
valueToUnmask = dayjs(value, dateFormat).format(displayFormat);
|
|
8215
|
+
}
|
|
8195
8216
|
const unmasked = Mask.getValueWithoutMask(valueToUnmask);
|
|
8196
8217
|
const masked = Mask.getValueWithMask(unmasked, mask);
|
|
8197
8218
|
return masked;
|
|
8198
8219
|
}
|
|
8199
8220
|
return dayjs(value, dateFormat).format(displayFormat);
|
|
8200
8221
|
});
|
|
8201
|
-
FormatterParserProvider.registerParser('ZdMonth', (value, { dateFormat = Config.monthFormat, displayFormat = Config.monthDisplayFormat, inputFormat = Config.monthInputFormat, mask = '',
|
|
8222
|
+
FormatterParserProvider.registerParser('ZdMonth', (value, { dateFormat = Config.monthFormat, displayFormat = Config.monthDisplayFormat, inputFormat = Config.monthInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
|
|
8202
8223
|
if (!value) {
|
|
8203
8224
|
return null;
|
|
8204
8225
|
}
|
|
@@ -8214,12 +8235,14 @@ FormatterParserProvider.registerParser('ZdMonth', (value, { dateFormat = Config.
|
|
|
8214
8235
|
}
|
|
8215
8236
|
const unmasked = Mask.getValueWithoutMask(value);
|
|
8216
8237
|
let masked;
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8238
|
+
if (!initialMask || isSimpleDisplay) {
|
|
8239
|
+
const displayFmtMask = displayFormat.replace(/[A-Za-z]/gi, '#');
|
|
8240
|
+
masked = Mask.getValueWithMask(unmasked, displayFmtMask);
|
|
8241
|
+
if (dayjs(masked, displayFormat, true).format(displayFormat) === masked) {
|
|
8242
|
+
return dayjs(masked, displayFormat).format(dateFormat);
|
|
8243
|
+
}
|
|
8221
8244
|
}
|
|
8222
|
-
const dateFmtMask =
|
|
8245
|
+
const dateFmtMask = dateFormat.replace(/[A-Za-z]/gi, '#');
|
|
8223
8246
|
masked = Mask.getValueWithMask(unmasked, dateFmtMask);
|
|
8224
8247
|
if (dayjs(masked, dateFormat, true).format(dateFormat) === masked) {
|
|
8225
8248
|
return masked;
|
|
@@ -10229,7 +10252,7 @@ class Time extends TextInput {
|
|
|
10229
10252
|
/**
|
|
10230
10253
|
* Defines the format of a time displayed in picker. Available options are ampm and 24hr.
|
|
10231
10254
|
*/
|
|
10232
|
-
this.timeFormat = Config.timeFormat || 'ampm';
|
|
10255
|
+
this.timeFormat = Config.timeFormat || 'ampm'; // change props to pickerFormat
|
|
10233
10256
|
/**
|
|
10234
10257
|
* Forces 100% width.
|
|
10235
10258
|
*/
|
|
@@ -10260,29 +10283,18 @@ class Time extends TextInput {
|
|
|
10260
10283
|
this.width = 290;
|
|
10261
10284
|
this.formatterFn = FormatterParserProvider.getFormatter('ZdTime');
|
|
10262
10285
|
this.parserFn = FormatterParserProvider.getParser('ZdTime');
|
|
10286
|
+
this.isoFormatValue = 'HH:mm';
|
|
10287
|
+
this.valueFormatInternal = Config.valueTimeFormat;
|
|
10288
|
+
this.displayFormatInternal = Config.displayTimeFormat;
|
|
10263
10289
|
/**
|
|
10264
|
-
*
|
|
10265
|
-
*/
|
|
10266
|
-
this.maskFunctions = {
|
|
10267
|
-
ampm: () => this.ampmMask(),
|
|
10268
|
-
'24hr': (value) => this.fullTimeMask(value),
|
|
10269
|
-
};
|
|
10270
|
-
/**
|
|
10271
|
-
* Format used in time value
|
|
10290
|
+
* Defines the time input format.
|
|
10272
10291
|
*/
|
|
10273
|
-
this.
|
|
10274
|
-
/**
|
|
10275
|
-
* Format used to display the value
|
|
10276
|
-
*/
|
|
10277
|
-
this.displayFormat = Config.displayTimeFormat;
|
|
10292
|
+
this.inputFormat = Config.timeInputFormat;
|
|
10278
10293
|
/**
|
|
10279
10294
|
* True when displayValue is valid
|
|
10280
10295
|
*/
|
|
10281
10296
|
this.isDisplayValid = true;
|
|
10282
|
-
|
|
10283
|
-
* Last invalid value passed to formatter
|
|
10284
|
-
*/
|
|
10285
|
-
this.lastInvalid = '';
|
|
10297
|
+
this.timeError = false;
|
|
10286
10298
|
this.allowedHours = this.getInitValue('allowedHours', props.allowedHours, this.allowedHours);
|
|
10287
10299
|
this.allowedMinutes = this.getInitValue('allowedMinutes', props.allowedMinutes, this.allowedMinutes);
|
|
10288
10300
|
this.allowedSeconds = this.getInitValue('allowedSeconds', props.allowedSeconds, this.allowedSeconds);
|
|
@@ -10296,40 +10308,40 @@ class Time extends TextInput {
|
|
|
10296
10308
|
this.useSeconds = this.getInitValue('useSeconds', props.useSeconds, this.useSeconds);
|
|
10297
10309
|
this.width = this.getInitValue('width', props.width, this.width);
|
|
10298
10310
|
this.autofill = this.getInitValue('autofill', props.autofill, this.autofill);
|
|
10299
|
-
this.mask = this.getInitValue('mask', props.mask, this.getMask);
|
|
10300
10311
|
this.timeValidation = this.timeValidation.bind(this);
|
|
10312
|
+
this.valueFormat = this.getInitValue('valueFormat', props.valueFormat, this.valueFormatInternal);
|
|
10313
|
+
this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormatInternal);
|
|
10314
|
+
this.inputFormat = this.getInitValue('inputFormat', props.inputFormat, this.inputFormat);
|
|
10301
10315
|
this.timeAllowedValidation = this.timeAllowedValidation.bind(this);
|
|
10302
10316
|
this.rules.push(this.timeValidation, this.timeAllowedValidation);
|
|
10303
|
-
this.
|
|
10304
|
-
this.displayFormat = this.getInitValue('displayFormat', props.displayFormat, this.displayFormat);
|
|
10317
|
+
this.mask = this.getInitValue('mask', props.mask, undefined);
|
|
10305
10318
|
this.createAccessors();
|
|
10306
|
-
this.
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
delete this.valueFormat;
|
|
10314
|
-
this.valueFormat = valueFormat;
|
|
10315
|
-
},
|
|
10316
|
-
});
|
|
10319
|
+
this.initialMask = this.getInitialMask();
|
|
10320
|
+
this.isSimpleDisplay = this.isSimpleFormat(this.displayFormat);
|
|
10321
|
+
}
|
|
10322
|
+
get displayFormat() {
|
|
10323
|
+
const commonsDisplay = ['hh:mm A', 'hh:mm:ss A', 'HH:mm:ss', 'HH:mm'];
|
|
10324
|
+
if (commonsDisplay.includes(this.displayFormatInternal)) {
|
|
10325
|
+
this.displayFormatInternal = this.defaultFormats[this.timeFormat];
|
|
10317
10326
|
}
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10327
|
+
return this.displayFormatInternal;
|
|
10328
|
+
}
|
|
10329
|
+
set displayFormat(value) {
|
|
10330
|
+
this.displayFormatInternal = value;
|
|
10331
|
+
}
|
|
10332
|
+
get valueFormat() {
|
|
10333
|
+
const commonsDisplay = ['hh:mm A', 'hh:mm:ss A', 'HH:mm:ss', 'HH:mm'];
|
|
10334
|
+
if (commonsDisplay.includes(this.valueFormatInternal)) {
|
|
10335
|
+
this.valueFormatInternal = this.defaultFormats['24hr'];
|
|
10326
10336
|
}
|
|
10337
|
+
return this.valueFormatInternal;
|
|
10327
10338
|
}
|
|
10328
|
-
|
|
10329
|
-
|
|
10339
|
+
set valueFormat(value) {
|
|
10340
|
+
this.valueFormatInternal = value;
|
|
10330
10341
|
}
|
|
10331
|
-
get
|
|
10332
|
-
|
|
10342
|
+
get isoFormat() {
|
|
10343
|
+
this.isoFormatValue = this.useSeconds ? 'HH:mm:ss' : 'HH:mm';
|
|
10344
|
+
return this.isoFormatValue;
|
|
10333
10345
|
}
|
|
10334
10346
|
get defaultFormats() {
|
|
10335
10347
|
const seconds = this.useSeconds ? ':ss' : '';
|
|
@@ -10338,59 +10350,172 @@ class Time extends TextInput {
|
|
|
10338
10350
|
'24hr': `HH:mm${seconds}`,
|
|
10339
10351
|
};
|
|
10340
10352
|
}
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10353
|
+
getInitialMask() {
|
|
10354
|
+
if (isUndefined(this.mask)) {
|
|
10355
|
+
this.mask = this.inputFormat && this.maskFormat(this.inputFormat);
|
|
10356
|
+
}
|
|
10357
|
+
return this.mask;
|
|
10358
|
+
}
|
|
10359
|
+
formatter(value) { return this.formatterFn(value, this); }
|
|
10360
|
+
parser(value) { return this.parserFn(value, this); }
|
|
10361
|
+
/**
|
|
10362
|
+
* Triggered when date is clicked.
|
|
10363
|
+
* @param event
|
|
10364
|
+
* @param element
|
|
10365
|
+
*/
|
|
10366
|
+
selectTime(time, event, element) {
|
|
10367
|
+
if (this.events.onSelectTime && typeof this.events.onSelectTime === 'function') {
|
|
10368
|
+
this.events.onSelectTime({
|
|
10369
|
+
time, event, element, component: this,
|
|
10370
|
+
});
|
|
10371
|
+
}
|
|
10372
|
+
}
|
|
10373
|
+
get displayValue() {
|
|
10374
|
+
return this.internalDisplayValue;
|
|
10375
|
+
}
|
|
10376
|
+
set displayValue(newValue) {
|
|
10377
|
+
this.timeError = false;
|
|
10378
|
+
this.internalDisplayValue = newValue;
|
|
10379
|
+
this.internalValue = this.parser(newValue);
|
|
10380
|
+
this.value = this.internalValue; // forces value accessor to be called if necessary
|
|
10381
|
+
}
|
|
10382
|
+
/**
|
|
10383
|
+
* Assign the updated mask to mask property
|
|
10384
|
+
*/
|
|
10385
|
+
updateMask() {
|
|
10386
|
+
this.isSimpleDisplay = this.isSimpleFormat(this.displayFormat);
|
|
10387
|
+
this.mask = this.getUpdatedMask();
|
|
10388
|
+
return this.mask;
|
|
10389
|
+
}
|
|
10390
|
+
/**
|
|
10391
|
+
* Gets the updated masked, based on displayFormat if the initial mask is undefined
|
|
10392
|
+
*/
|
|
10393
|
+
getUpdatedMask() {
|
|
10394
|
+
if (isUndefined(this.initialMask)) {
|
|
10395
|
+
return this.maskFormat(this.displayFormat);
|
|
10346
10396
|
}
|
|
10347
|
-
|
|
10348
|
-
|
|
10397
|
+
return this.mask;
|
|
10398
|
+
}
|
|
10399
|
+
maskFormat(format) {
|
|
10400
|
+
return format.replace(/[A-Za-z]/gi, '#');
|
|
10401
|
+
}
|
|
10402
|
+
setTimeValue(displayValue) {
|
|
10403
|
+
const lastValue = this.displayValue;
|
|
10404
|
+
if (this.isValidTime(displayValue, this.displayFormat)) {
|
|
10405
|
+
this.internalDisplayValue = displayValue;
|
|
10406
|
+
this.internalValue = this.parser(displayValue);
|
|
10407
|
+
this.timeError = false;
|
|
10408
|
+
if (lastValue !== this.displayValue)
|
|
10409
|
+
this.change(this.value);
|
|
10349
10410
|
}
|
|
10350
10411
|
else {
|
|
10351
|
-
|
|
10412
|
+
if (!displayValue) {
|
|
10413
|
+
this.internalDisplayValue = displayValue;
|
|
10414
|
+
this.internalValue = null;
|
|
10415
|
+
if (lastValue !== this.displayValue)
|
|
10416
|
+
this.change(this.value);
|
|
10417
|
+
}
|
|
10418
|
+
this.timeError = !!displayValue;
|
|
10352
10419
|
}
|
|
10353
|
-
|
|
10354
|
-
const seconds = this.useSeconds ? [':', ...minutes] : [];
|
|
10355
|
-
const ampm = /(A|P)/;
|
|
10356
|
-
return [...hours, ':', ...minutes, ...seconds, ' ', ampm, 'M'];
|
|
10420
|
+
this.value = this.internalValue; // forces value accessor to be called if necessary
|
|
10357
10421
|
}
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
/[0-2]/,
|
|
10361
|
-
value[0] === '2' ? /[0-3]/ : /[0-9]/,
|
|
10362
|
-
];
|
|
10363
|
-
const minutes = [/[0-5]/, /[0-9]/];
|
|
10364
|
-
const seconds = this.useSeconds ? [':', ...minutes] : [];
|
|
10365
|
-
return [...hours, ':', ...minutes, ...seconds];
|
|
10422
|
+
isValidTime(value, format, strict = true) {
|
|
10423
|
+
return dayjs(value, format, strict).isValid();
|
|
10366
10424
|
}
|
|
10367
|
-
|
|
10368
|
-
return this.
|
|
10425
|
+
get isoValue() {
|
|
10426
|
+
return this.formatISOTimeValue(this.value);
|
|
10427
|
+
}
|
|
10428
|
+
set isoValue(newValue) {
|
|
10429
|
+
const lastValue = this.value;
|
|
10430
|
+
this.timeError = false;
|
|
10431
|
+
this.value = this.parseISOTimeValue(newValue);
|
|
10432
|
+
if (lastValue !== this.value)
|
|
10433
|
+
this.change(this.value);
|
|
10434
|
+
}
|
|
10435
|
+
formatISOTimeValue(value) {
|
|
10436
|
+
if (value && this.isValidTime(value, this.valueFormat)) {
|
|
10437
|
+
return dayjs(value, this.valueFormat).format(this.isoFormat);
|
|
10438
|
+
}
|
|
10439
|
+
return '';
|
|
10440
|
+
}
|
|
10441
|
+
parseISOTimeValue(value) {
|
|
10442
|
+
if (value && this.isValidTime(value, this.valueFormat)) {
|
|
10443
|
+
return dayjs(value, this.isoFormat).format(this.valueFormat);
|
|
10444
|
+
}
|
|
10445
|
+
return null;
|
|
10369
10446
|
}
|
|
10370
10447
|
/**
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10448
|
+
* Checks if a time format is simple.
|
|
10449
|
+
* Simple time formats are the ones that consists only of 'HH', 'mm', 'mm' or 'YYYY', and mask delimiters
|
|
10450
|
+
* @param format The format to be checked
|
|
10451
|
+
* @returns true if it is simple, false otherwise
|
|
10452
|
+
*/
|
|
10453
|
+
isSimpleFormat(format) {
|
|
10454
|
+
const simpleTokens = ['HH', 'mm', 'ss', 'hh', 'A', 'a', 'p', 'P'];
|
|
10455
|
+
// remove the simple tokens from the string
|
|
10456
|
+
const replaced = simpleTokens.reduce((result, token) => result.replace(token, ''), format);
|
|
10457
|
+
const chars = replaced.split('');
|
|
10458
|
+
return chars.length ? chars.every((char) => Mask.isMaskDelimiter(char)) : true;
|
|
10376
10459
|
}
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
this.isDisplayValid = true;
|
|
10381
|
-
this.lastInvalid = value;
|
|
10382
|
-
return value;
|
|
10460
|
+
timeValidation() {
|
|
10461
|
+
if (this.isValidTime(this.displayValue, this.displayFormat) || !this.displayValue) {
|
|
10462
|
+
return true;
|
|
10383
10463
|
}
|
|
10384
|
-
return
|
|
10464
|
+
return I18n.translate('VALIDATION_INVALID_TIME');
|
|
10385
10465
|
}
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10466
|
+
timeAllowedValidation() {
|
|
10467
|
+
return !this.displayValue
|
|
10468
|
+
|| (this.isValidTime(this.displayValue, this.displayFormat)
|
|
10469
|
+
&& this.isTimeAllowed())
|
|
10470
|
+
|| I18n.translate('VALIDATION_TIME_NOT_ALLOWED');
|
|
10471
|
+
}
|
|
10472
|
+
click(event, element) {
|
|
10473
|
+
const clickEvent = event || new MouseEvent('click');
|
|
10474
|
+
super.click(clickEvent, element);
|
|
10475
|
+
if (!clickEvent.defaultPrevented) {
|
|
10476
|
+
this.showTimePicker = !this.showTimePicker;
|
|
10477
|
+
}
|
|
10478
|
+
}
|
|
10479
|
+
blur(event, element) {
|
|
10480
|
+
this.removeTimeMask();
|
|
10481
|
+
this.setTimeValue(this.formatter(this.value));
|
|
10482
|
+
super.blur(event, element);
|
|
10483
|
+
this.showTimePicker = false;
|
|
10390
10484
|
}
|
|
10391
|
-
|
|
10392
|
-
|
|
10485
|
+
focus(event, element) {
|
|
10486
|
+
this.addTimeMask();
|
|
10487
|
+
super.focus(event, element);
|
|
10393
10488
|
}
|
|
10489
|
+
/**
|
|
10490
|
+
* Add date mask
|
|
10491
|
+
*/
|
|
10492
|
+
addTimeMask() {
|
|
10493
|
+
if (!this.value)
|
|
10494
|
+
return;
|
|
10495
|
+
this.mask = this.initialMask;
|
|
10496
|
+
this.internalDisplayValue = dayjs(this.value, this.valueFormat).format(this.inputFormat || this.displayFormat);
|
|
10497
|
+
}
|
|
10498
|
+
/**
|
|
10499
|
+
* Removes the component mask if value is valid
|
|
10500
|
+
*/
|
|
10501
|
+
removeTimeMask() {
|
|
10502
|
+
if (isUndefined(this.initialMask) || !this.value || this.timeError
|
|
10503
|
+
|| !this.isValidTime(this.value, this.valueFormat)) {
|
|
10504
|
+
return;
|
|
10505
|
+
}
|
|
10506
|
+
this.mask = '';
|
|
10507
|
+
}
|
|
10508
|
+
/**
|
|
10509
|
+
* Checks if value is valid according to valueFormat and if displayValue
|
|
10510
|
+
* is true
|
|
10511
|
+
*/
|
|
10512
|
+
isFullyValid(value = this.value) {
|
|
10513
|
+
return this.isValidTime(value, this.valueFormat, true) && this.isDisplayValid;
|
|
10514
|
+
}
|
|
10515
|
+
/**
|
|
10516
|
+
* Last invalid value passed to formatter
|
|
10517
|
+
*/
|
|
10518
|
+
// private lastInvalid: string = '';
|
|
10394
10519
|
isTimeAllowed(value = this.value) {
|
|
10395
10520
|
return this.isSameOrAfterMin(value) && this.isSameOrBeforeMax(value)
|
|
10396
10521
|
&& this.isHourAllowed(value) && this.isMinuteAllowed(value)
|
|
@@ -10426,49 +10551,54 @@ class Time extends TextInput {
|
|
|
10426
10551
|
const second = dayjs(value, this.valueFormat).second();
|
|
10427
10552
|
return this.allowedSeconds.includes(second);
|
|
10428
10553
|
}
|
|
10429
|
-
timeValidation() {
|
|
10430
|
-
return !this.displayValue
|
|
10431
|
-
|| this.isValidTime(this.displayValue, this.displayFormat)
|
|
10432
|
-
|| I18n.translate('VALIDATION_INVALID_TIME');
|
|
10433
|
-
}
|
|
10434
|
-
timeAllowedValidation() {
|
|
10435
|
-
return !this.displayValue
|
|
10436
|
-
|| (this.isValidTime(this.displayValue, this.displayFormat)
|
|
10437
|
-
&& this.isTimeAllowed())
|
|
10438
|
-
|| I18n.translate('VALIDATION_TIME_NOT_ALLOWED');
|
|
10439
|
-
}
|
|
10440
|
-
click(event) {
|
|
10441
|
-
this.callEvent('click', {
|
|
10442
|
-
event: (event || new MouseEvent('click')),
|
|
10443
|
-
component: this,
|
|
10444
|
-
});
|
|
10445
|
-
if (!(event === null || event === void 0 ? void 0 : event.defaultPrevented)) {
|
|
10446
|
-
this.showTimePicker = !this.showTimePicker;
|
|
10447
|
-
}
|
|
10448
|
-
}
|
|
10449
10554
|
clear() {
|
|
10450
10555
|
this.value = null;
|
|
10451
10556
|
this.change(this.value);
|
|
10452
10557
|
}
|
|
10453
10558
|
}
|
|
10454
|
-
FormatterParserProvider.registerFormatter('ZdTime', (value, { displayFormat = Config.
|
|
10559
|
+
FormatterParserProvider.registerFormatter('ZdTime', (value, { valueFormat = Config.valueTimeFormat, displayFormat = Config.displayTimeFormat, inputFormat = Config.timeInputFormat, mask = '', initialMask, isSimpleDisplay = false, } = {}) => {
|
|
10455
10560
|
if (!value) {
|
|
10456
10561
|
return '';
|
|
10457
10562
|
}
|
|
10458
|
-
|
|
10459
|
-
|
|
10563
|
+
const isTimeValid = dayjs(value, valueFormat, true).isValid();
|
|
10564
|
+
if (!isTimeValid) {
|
|
10565
|
+
return value;
|
|
10460
10566
|
}
|
|
10461
|
-
|
|
10567
|
+
if (mask && initialMask) {
|
|
10568
|
+
if (inputFormat) {
|
|
10569
|
+
return dayjs(value, valueFormat).format(inputFormat);
|
|
10570
|
+
}
|
|
10571
|
+
let valueToUnmask = value;
|
|
10572
|
+
if (isSimpleDisplay) {
|
|
10573
|
+
valueToUnmask = dayjs(value, valueFormat).format(displayFormat);
|
|
10574
|
+
}
|
|
10575
|
+
const unmasked = Mask.getValueWithoutMask(valueToUnmask);
|
|
10576
|
+
const masked = Mask.getValueWithMask(unmasked, mask);
|
|
10577
|
+
return masked;
|
|
10578
|
+
}
|
|
10579
|
+
return dayjs(value, valueFormat).format(displayFormat);
|
|
10462
10580
|
});
|
|
10463
|
-
FormatterParserProvider.registerParser('ZdTime', (value, { displayFormat = Config.
|
|
10581
|
+
FormatterParserProvider.registerParser('ZdTime', (value, { displayFormat = Config.displayTimeFormat, valueFormat = Config.valueTimeFormat, mask = '', initialMask, } = {}) => {
|
|
10464
10582
|
if (!value) {
|
|
10465
10583
|
return null;
|
|
10466
10584
|
}
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
return dayjs(uppecaseValue, displayFormat).format(valueFormat);
|
|
10585
|
+
if (dayjs(value, displayFormat, true).isValid()) {
|
|
10586
|
+
return dayjs(value, displayFormat).format(valueFormat);
|
|
10470
10587
|
}
|
|
10471
|
-
|
|
10588
|
+
if (mask && Mask.checkMask(value, mask)) {
|
|
10589
|
+
const unmasked = Mask.getValueWithoutMask(value);
|
|
10590
|
+
let masked;
|
|
10591
|
+
if (!initialMask) {
|
|
10592
|
+
const displayFmtMask = displayFormat.replace(/[A-Za-z]/gi, '#');
|
|
10593
|
+
masked = Mask.getValueWithMask(unmasked, displayFmtMask);
|
|
10594
|
+
}
|
|
10595
|
+
const timeFmtMask = valueFormat.replace(/[A-Za-z]/gi, '#');
|
|
10596
|
+
masked = Mask.getValueWithMask(unmasked, timeFmtMask);
|
|
10597
|
+
if (dayjs(masked, valueFormat, true).format(valueFormat) === masked) {
|
|
10598
|
+
return masked;
|
|
10599
|
+
}
|
|
10600
|
+
}
|
|
10601
|
+
return value;
|
|
10472
10602
|
});
|
|
10473
10603
|
|
|
10474
10604
|
/**
|
|
@@ -10610,6 +10740,7 @@ class Tree extends ComponentRender {
|
|
|
10610
10740
|
this.checkedField = this.getInitValue('checkedField', props.checkedField, this.checkedField);
|
|
10611
10741
|
this.openLevelOnLoad = this.getInitValue('openLevelOnLoad', props.openLevelOnLoad, this.openLevelOnLoad);
|
|
10612
10742
|
this.checkbox = this.getInitValue('checkbox', props.checkbox, this.checkbox);
|
|
10743
|
+
this.disableCheckbox = this.getInitValue('disableCheckbox', props.disableCheckbox, this.disableCheckbox);
|
|
10613
10744
|
this.afterTitleSlot = props.afterTitleSlot || this.afterTitleSlot;
|
|
10614
10745
|
this.toolbarSlot = props.toolbarSlot || this.toolbarSlot;
|
|
10615
10746
|
this.titleSlot = props.titleSlot || this.titleSlot;
|
|
@@ -10842,15 +10973,19 @@ class Tree extends ComponentRender {
|
|
|
10842
10973
|
const nodePath = node.pathStr;
|
|
10843
10974
|
if (!nodePath)
|
|
10844
10975
|
return;
|
|
10845
|
-
const compName = component.name
|
|
10976
|
+
const compName = component.name.indexOf(`_${nodePath}`) > -1
|
|
10977
|
+
? component.name.substring(0, component.name.indexOf(`_${nodePath}`)) : component.name;
|
|
10846
10978
|
const instanceName = `${compName}_${nodePath}`;
|
|
10847
10979
|
const path = parentPath ? `${parentPath}.${compName}` : compName;
|
|
10848
|
-
const
|
|
10980
|
+
const newInstances = Metadata.getInstances(instanceName);
|
|
10981
|
+
const newInstance = newInstances[0];
|
|
10982
|
+
const appliedConditions = (_a = this.appliedConditions[nodePath]) === null || _a === void 0 ? void 0 : _a[path];
|
|
10983
|
+
const newComponent = merge({}, component, newInstance, appliedConditions);
|
|
10849
10984
|
const newChildren = this.getSlotComponent(newComponent.children || [], node, path);
|
|
10850
10985
|
newComponent.name = instanceName;
|
|
10851
10986
|
newComponent.children = newChildren;
|
|
10852
10987
|
try {
|
|
10853
|
-
Metadata.updateInstance(instanceName,
|
|
10988
|
+
Metadata.updateInstance(instanceName, appliedConditions);
|
|
10854
10989
|
}
|
|
10855
10990
|
catch (e) {
|
|
10856
10991
|
// do nothing
|
|
@@ -10916,6 +11051,10 @@ class Tree extends ComponentRender {
|
|
|
10916
11051
|
return this.searchPath(currentNode.children || [], path.slice(1));
|
|
10917
11052
|
return currentNode;
|
|
10918
11053
|
}
|
|
11054
|
+
callDisableCheckbox(node) {
|
|
11055
|
+
return !!this.disableCheckbox && typeof this.disableCheckbox === 'function'
|
|
11056
|
+
&& this.disableCheckbox({ node, component: this });
|
|
11057
|
+
}
|
|
10919
11058
|
}
|
|
10920
11059
|
|
|
10921
11060
|
/**
|
|
@@ -11062,6 +11201,8 @@ class TreeGrid extends Grid {
|
|
|
11062
11201
|
const rows = [row, ...this.treeDataStructure.getChildren(row)];
|
|
11063
11202
|
if (isSelected) {
|
|
11064
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);
|
|
11065
11206
|
}
|
|
11066
11207
|
else {
|
|
11067
11208
|
rows.forEach((item) => {
|
|
@@ -11069,6 +11210,31 @@ class TreeGrid extends Grid {
|
|
|
11069
11210
|
if (index > -1)
|
|
11070
11211
|
this.selectedRows.splice(index, 1);
|
|
11071
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);
|
|
11072
11238
|
}
|
|
11073
11239
|
}
|
|
11074
11240
|
}
|
|
@@ -11103,6 +11269,7 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11103
11269
|
},
|
|
11104
11270
|
};
|
|
11105
11271
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
11272
|
+
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
11106
11273
|
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
11107
11274
|
this.createAccessors();
|
|
11108
11275
|
}
|
|
@@ -11156,10 +11323,10 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11156
11323
|
* @param event DOM event
|
|
11157
11324
|
* @param element DOM Element
|
|
11158
11325
|
*/
|
|
11159
|
-
cellClick(row, column, event, element) {
|
|
11326
|
+
cellClick(row, column, event, element, canEdit = true) {
|
|
11160
11327
|
if (this.editing)
|
|
11161
11328
|
return;
|
|
11162
|
-
if (column.editable) {
|
|
11329
|
+
if (column.editable && canEdit) {
|
|
11163
11330
|
this.editing = true;
|
|
11164
11331
|
this.preventRowClick = true;
|
|
11165
11332
|
this.datasource.currentRow = row;
|
|
@@ -11476,6 +11643,9 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11476
11643
|
throw e;
|
|
11477
11644
|
}
|
|
11478
11645
|
}
|
|
11646
|
+
callCanEditRow(row) {
|
|
11647
|
+
return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
|
|
11648
|
+
}
|
|
11479
11649
|
}
|
|
11480
11650
|
|
|
11481
11651
|
class Icons {
|
|
@@ -11919,9 +12089,9 @@ class BaseReport {
|
|
|
11919
12089
|
};
|
|
11920
12090
|
this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
11921
12091
|
}
|
|
11922
|
-
|
|
12092
|
+
getColumnsWidth(columns) {
|
|
11923
12093
|
const widths = {};
|
|
11924
|
-
let totalWidth;
|
|
12094
|
+
let totalWidth = 0;
|
|
11925
12095
|
try {
|
|
11926
12096
|
totalWidth = columns.reduce((sum, col) => {
|
|
11927
12097
|
widths[col.name] = col.getWidth();
|
|
@@ -11933,6 +12103,10 @@ class BaseReport {
|
|
|
11933
12103
|
throw e;
|
|
11934
12104
|
}
|
|
11935
12105
|
}
|
|
12106
|
+
return { widths, totalWidth };
|
|
12107
|
+
}
|
|
12108
|
+
buildColumns(columns) {
|
|
12109
|
+
const { widths, totalWidth } = this.getColumnsWidth(columns);
|
|
11936
12110
|
return columns.reduce((result, col, index) => {
|
|
11937
12111
|
let size;
|
|
11938
12112
|
if (!totalWidth) {
|
|
@@ -11945,63 +12119,20 @@ class BaseReport {
|
|
|
11945
12119
|
align: col.align || 'left',
|
|
11946
12120
|
description: col.label,
|
|
11947
12121
|
sequence: index,
|
|
11948
|
-
format: this.getFormatOfColumn(col),
|
|
11949
12122
|
size: `${size}%`,
|
|
11950
12123
|
xlsType: col.xlsType,
|
|
11951
12124
|
};
|
|
11952
12125
|
return Object.assign(Object.assign({}, result), { [col.name]: row });
|
|
11953
12126
|
}, {});
|
|
11954
12127
|
}
|
|
11955
|
-
|
|
11956
|
-
return
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
}
|
|
11963
|
-
return value;
|
|
11964
|
-
}
|
|
11965
|
-
getFormatOfColumn(column) {
|
|
11966
|
-
let format;
|
|
11967
|
-
let { mask } = column;
|
|
11968
|
-
if (mask) {
|
|
11969
|
-
format = {
|
|
11970
|
-
type: 'fix',
|
|
11971
|
-
params: {
|
|
11972
|
-
mask,
|
|
11973
|
-
},
|
|
11974
|
-
};
|
|
11975
|
-
}
|
|
11976
|
-
else if (column.componentProps && Object.keys(column.componentProps).length) {
|
|
11977
|
-
const { component } = column.componentProps;
|
|
11978
|
-
if (this.isNumberComponent(component)) {
|
|
11979
|
-
format = { type: 'float' };
|
|
11980
|
-
mask = this.checkAccessor(column.componentProps.mask);
|
|
11981
|
-
if (mask) {
|
|
11982
|
-
format.params = {};
|
|
11983
|
-
if (mask.currencySymbol) {
|
|
11984
|
-
format.type = 'currency';
|
|
11985
|
-
format.symbol = mask.currencySymbol;
|
|
11986
|
-
format.decimal = mask.decimalCharacter;
|
|
11987
|
-
format.thousands = mask.digitGroupSeparator;
|
|
11988
|
-
format.precision = mask.decimalPlaces;
|
|
11989
|
-
}
|
|
11990
|
-
else {
|
|
11991
|
-
format.params.decimal = mask.decimalCharacter;
|
|
11992
|
-
format.params.thousands = mask.digitGroupSeparator;
|
|
11993
|
-
format.params.precision = mask.decimalPlaces;
|
|
11994
|
-
}
|
|
11995
|
-
}
|
|
11996
|
-
}
|
|
11997
|
-
}
|
|
11998
|
-
return format;
|
|
11999
|
-
}
|
|
12000
|
-
buildFilter(filter) {
|
|
12001
|
-
return Object.keys(filter).map((key) => ({
|
|
12002
|
-
label: key,
|
|
12003
|
-
value: I18n.translate('IS_EQUAL', { value: filter[key] }),
|
|
12004
|
-
}));
|
|
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: I18n.translate('IS_EQUAL', { value: filter[key] }),
|
|
12134
|
+
});
|
|
12135
|
+
});
|
|
12005
12136
|
}
|
|
12006
12137
|
formatLangCode(lang) {
|
|
12007
12138
|
if (!lang) {
|
|
@@ -12026,7 +12157,7 @@ class CSVReport extends BaseReport {
|
|
|
12026
12157
|
}
|
|
12027
12158
|
buildMetadata(name, title, columns, filter) {
|
|
12028
12159
|
const builtCols = this.buildColumns(columns);
|
|
12029
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12160
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12030
12161
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12031
12162
|
const clientLogo = '';
|
|
12032
12163
|
const enterpriseLogo = '';
|
|
@@ -12064,10 +12195,76 @@ class PDFReport extends BaseReport {
|
|
|
12064
12195
|
buildDataset(data) {
|
|
12065
12196
|
return JSON.stringify(data);
|
|
12066
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 (Accessor.isAccessorDefinition(value)) {
|
|
12259
|
+
const [controller, accessor] = Accessor.getAccessor(value);
|
|
12260
|
+
return Loader.getInstance(controller)[accessor];
|
|
12261
|
+
}
|
|
12262
|
+
return value;
|
|
12263
|
+
}
|
|
12067
12264
|
buildMetadata(name, title, columns, filter, portrait = true) {
|
|
12068
12265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12069
12266
|
const builtCols = this.buildColumns(columns);
|
|
12070
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12267
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12071
12268
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12072
12269
|
let clientLogo = '';
|
|
12073
12270
|
let enterpriseLogo = '';
|
|
@@ -12145,6 +12342,7 @@ class PDFReport extends BaseReport {
|
|
|
12145
12342
|
}
|
|
12146
12343
|
}
|
|
12147
12344
|
|
|
12345
|
+
// XLS without groups (formatXLS = 'F3')
|
|
12148
12346
|
class XLSReport extends BaseReport {
|
|
12149
12347
|
constructor() {
|
|
12150
12348
|
super(...arguments);
|
|
@@ -12165,7 +12363,7 @@ class XLSReport extends BaseReport {
|
|
|
12165
12363
|
}
|
|
12166
12364
|
buildMetadata(name, title, columns, filter) {
|
|
12167
12365
|
const builtCols = this.buildColumns(columns);
|
|
12168
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12366
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12169
12367
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12170
12368
|
const clientLogo = '';
|
|
12171
12369
|
const enterpriseLogo = '';
|
|
@@ -12191,13 +12389,14 @@ class XLSReport extends BaseReport {
|
|
|
12191
12389
|
columns: builtCols,
|
|
12192
12390
|
filter: builtFilters,
|
|
12193
12391
|
reportXLS: true,
|
|
12392
|
+
formatXLS: 'F3',
|
|
12194
12393
|
xlsMergedCell: [],
|
|
12195
12394
|
};
|
|
12196
12395
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
12197
12396
|
}
|
|
12198
12397
|
}
|
|
12199
12398
|
|
|
12200
|
-
// XLS with groups
|
|
12399
|
+
// XLS with groups (formatXLS = 'F1')
|
|
12201
12400
|
class XLS2Report extends BaseReport {
|
|
12202
12401
|
constructor() {
|
|
12203
12402
|
super(...arguments);
|
|
@@ -12209,7 +12408,7 @@ class XLS2Report extends BaseReport {
|
|
|
12209
12408
|
}
|
|
12210
12409
|
buildMetadata(name, title, columns, filter) {
|
|
12211
12410
|
const builtCols = this.buildColumns(columns);
|
|
12212
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12411
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12213
12412
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12214
12413
|
const clientLogo = '';
|
|
12215
12414
|
const enterpriseLogo = '';
|
|
@@ -12235,6 +12434,7 @@ class XLS2Report extends BaseReport {
|
|
|
12235
12434
|
columns: builtCols,
|
|
12236
12435
|
filter: builtFilters,
|
|
12237
12436
|
reportXLS: true,
|
|
12437
|
+
formatXLS: 'F1',
|
|
12238
12438
|
xlsMergedCell: [],
|
|
12239
12439
|
};
|
|
12240
12440
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12393,7 +12593,7 @@ class XLS2Report extends BaseReport {
|
|
|
12393
12593
|
}
|
|
12394
12594
|
}
|
|
12395
12595
|
|
|
12396
|
-
// Grid mirror (with groups)
|
|
12596
|
+
// Grid mirror (with groups) (formatXLS = 'F2')
|
|
12397
12597
|
class XLS3Report extends BaseReport {
|
|
12398
12598
|
constructor() {
|
|
12399
12599
|
super(...arguments);
|
|
@@ -12405,7 +12605,7 @@ class XLS3Report extends BaseReport {
|
|
|
12405
12605
|
}
|
|
12406
12606
|
buildMetadata(name, title, columns, filter) {
|
|
12407
12607
|
const builtCols = this.buildColumns(columns);
|
|
12408
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12608
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12409
12609
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12410
12610
|
const clientLogo = '';
|
|
12411
12611
|
const enterpriseLogo = '';
|
|
@@ -12431,6 +12631,7 @@ class XLS3Report extends BaseReport {
|
|
|
12431
12631
|
columns: builtCols,
|
|
12432
12632
|
filter: builtFilters,
|
|
12433
12633
|
reportXLS: true,
|
|
12634
|
+
formatXLS: 'F2',
|
|
12434
12635
|
xlsMergedCell: [],
|
|
12435
12636
|
};
|
|
12436
12637
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12684,4 +12885,4 @@ class Report {
|
|
|
12684
12885
|
|
|
12685
12886
|
const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
12686
12887
|
|
|
12687
|
-
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|
|
12888
|
+
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|