@zeedhi/common 1.52.0 → 1.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/zd-common.esm.js +442 -248
- package/dist/zd-common.umd.js +442 -247
- package/package.json +2 -2
- package/types/components/index.d.ts +1 -0
- package/types/components/zd-dashboard/dashboard.d.ts +7 -3
- package/types/components/zd-dashboard/interfaces.d.ts +1 -0
- package/types/components/zd-date/date.d.ts +1 -1
- package/types/components/zd-date/interfaces.d.ts +0 -1
- package/types/components/zd-grid/grid-editable.d.ts +9 -1
- package/types/components/zd-grid/grid.d.ts +10 -0
- package/types/components/zd-grid/interfaces.d.ts +11 -0
- package/types/components/zd-month/month.d.ts +2 -2
- package/types/components/zd-time/interfaces.d.ts +1 -0
- package/types/components/zd-time/time.d.ts +59 -23
- package/types/components/zd-tree/interfaces.d.ts +4 -0
- package/types/components/zd-tree/tree.d.ts +8 -0
- package/types/components/zd-tree-grid/interfaces.d.ts +11 -2
- package/types/components/zd-tree-grid/tree-grid-editable.d.ts +9 -1
- package/types/components/zd-tree-grid/tree-grid.d.ts +2 -0
- package/types/utils/report/report-type/base-report.d.ts +5 -4
- package/types/utils/report/report-type/interfaces.d.ts +1 -0
- package/types/utils/report/report-type/pdf-report.d.ts +5 -0
- package/types/utils/report/report.d.ts +1 -1
package/dist/zd-common.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
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10422
|
+
isValidTime(value, format, strict = true) {
|
|
10423
|
+
return dayjs(value, format, strict).isValid();
|
|
10424
|
+
}
|
|
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);
|
|
10366
10434
|
}
|
|
10367
|
-
|
|
10368
|
-
|
|
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
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10460
|
+
timeValidation() {
|
|
10461
|
+
if (this.isValidTime(this.displayValue, this.displayFormat) || !this.displayValue) {
|
|
10462
|
+
return true;
|
|
10463
|
+
}
|
|
10464
|
+
return I18n.translate('VALIDATION_INVALID_TIME');
|
|
10465
|
+
}
|
|
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;
|
|
10383
10477
|
}
|
|
10384
|
-
return this.formatterFn(value, this);
|
|
10385
10478
|
}
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
this.
|
|
10389
|
-
|
|
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);
|
|
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);
|
|
10393
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
|
-
|
|
10585
|
+
if (dayjs(value, displayFormat, true).isValid()) {
|
|
10586
|
+
return dayjs(value, displayFormat).format(valueFormat);
|
|
10587
|
+
}
|
|
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
|
+
}
|
|
10470
10600
|
}
|
|
10471
|
-
return
|
|
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;
|
|
@@ -10845,16 +10976,13 @@ class Tree extends ComponentRender {
|
|
|
10845
10976
|
const compName = component.name;
|
|
10846
10977
|
const instanceName = `${compName}_${nodePath}`;
|
|
10847
10978
|
const path = parentPath ? `${parentPath}.${compName}` : compName;
|
|
10848
|
-
const
|
|
10979
|
+
const newInstances = Metadata.getInstances(instanceName);
|
|
10980
|
+
const newInstance = newInstances[0];
|
|
10981
|
+
const appliedConditions = (_a = this.appliedConditions[nodePath]) === null || _a === void 0 ? void 0 : _a[path];
|
|
10982
|
+
const newComponent = merge({}, component, newInstance, appliedConditions);
|
|
10849
10983
|
const newChildren = this.getSlotComponent(newComponent.children || [], node, path);
|
|
10850
10984
|
newComponent.name = instanceName;
|
|
10851
10985
|
newComponent.children = newChildren;
|
|
10852
|
-
try {
|
|
10853
|
-
Metadata.updateInstance(instanceName, newComponent);
|
|
10854
|
-
}
|
|
10855
|
-
catch (e) {
|
|
10856
|
-
// do nothing
|
|
10857
|
-
}
|
|
10858
10986
|
newComponents.push(newComponent);
|
|
10859
10987
|
});
|
|
10860
10988
|
return newComponents;
|
|
@@ -10916,6 +11044,10 @@ class Tree extends ComponentRender {
|
|
|
10916
11044
|
return this.searchPath(currentNode.children || [], path.slice(1));
|
|
10917
11045
|
return currentNode;
|
|
10918
11046
|
}
|
|
11047
|
+
callDisableCheckbox(node) {
|
|
11048
|
+
return !!this.disableCheckbox && typeof this.disableCheckbox === 'function'
|
|
11049
|
+
&& this.disableCheckbox({ node, component: this });
|
|
11050
|
+
}
|
|
10919
11051
|
}
|
|
10920
11052
|
|
|
10921
11053
|
/**
|
|
@@ -11062,6 +11194,8 @@ class TreeGrid extends Grid {
|
|
|
11062
11194
|
const rows = [row, ...this.treeDataStructure.getChildren(row)];
|
|
11063
11195
|
if (isSelected) {
|
|
11064
11196
|
this.selectedRows = Array.from(new Set(this.selectedRows.concat(rows))); // remove duplicates
|
|
11197
|
+
// check if all the children of the parent are selected.
|
|
11198
|
+
this.selectParents(rows, row);
|
|
11065
11199
|
}
|
|
11066
11200
|
else {
|
|
11067
11201
|
rows.forEach((item) => {
|
|
@@ -11069,6 +11203,31 @@ class TreeGrid extends Grid {
|
|
|
11069
11203
|
if (index > -1)
|
|
11070
11204
|
this.selectedRows.splice(index, 1);
|
|
11071
11205
|
});
|
|
11206
|
+
this.unselectParents(row);
|
|
11207
|
+
}
|
|
11208
|
+
}
|
|
11209
|
+
selectParents(rows, row) {
|
|
11210
|
+
if (row[this.parentField]) {
|
|
11211
|
+
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11212
|
+
const every = this.treeDataStructure.getChildren(parentRow).every((item) => {
|
|
11213
|
+
const index = this.treeDataStructure.findDataIndex(this.selectedRows, item[this.datasource.uniqueKey]);
|
|
11214
|
+
if (index > -1)
|
|
11215
|
+
return true;
|
|
11216
|
+
return false;
|
|
11217
|
+
});
|
|
11218
|
+
if (every)
|
|
11219
|
+
rows.push(parentRow);
|
|
11220
|
+
this.selectedRows = Array.from(new Set(this.selectedRows.concat(rows))); // remove duplicates
|
|
11221
|
+
this.selectParents(rows, parentRow);
|
|
11222
|
+
}
|
|
11223
|
+
}
|
|
11224
|
+
unselectParents(row) {
|
|
11225
|
+
if (row[this.parentField]) {
|
|
11226
|
+
const index = this.treeDataStructure.findDataIndex(this.selectedRows, row[this.parentField]);
|
|
11227
|
+
if (index > -1)
|
|
11228
|
+
this.selectedRows.splice(index, 1);
|
|
11229
|
+
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11230
|
+
this.unselectParents(parentRow);
|
|
11072
11231
|
}
|
|
11073
11232
|
}
|
|
11074
11233
|
}
|
|
@@ -11103,6 +11262,7 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11103
11262
|
},
|
|
11104
11263
|
};
|
|
11105
11264
|
this.doubleClickEdit = this.getInitValue('doubleClickEdit', props.doubleClickEdit, this.doubleClickEdit);
|
|
11265
|
+
this.canEditRow = this.getInitValue('canEditRow', props.canEditRow, this.canEditRow);
|
|
11106
11266
|
this.noDataSlot = this.changeDefaultSlotNames(this.noDataSlot);
|
|
11107
11267
|
this.createAccessors();
|
|
11108
11268
|
}
|
|
@@ -11156,10 +11316,10 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11156
11316
|
* @param event DOM event
|
|
11157
11317
|
* @param element DOM Element
|
|
11158
11318
|
*/
|
|
11159
|
-
cellClick(row, column, event, element) {
|
|
11319
|
+
cellClick(row, column, event, element, canEdit = true) {
|
|
11160
11320
|
if (this.editing)
|
|
11161
11321
|
return;
|
|
11162
|
-
if (column.editable) {
|
|
11322
|
+
if (column.editable && canEdit) {
|
|
11163
11323
|
this.editing = true;
|
|
11164
11324
|
this.preventRowClick = true;
|
|
11165
11325
|
this.datasource.currentRow = row;
|
|
@@ -11476,6 +11636,9 @@ class TreeGridEditable extends TreeGrid {
|
|
|
11476
11636
|
throw e;
|
|
11477
11637
|
}
|
|
11478
11638
|
}
|
|
11639
|
+
callCanEditRow(row) {
|
|
11640
|
+
return !this.canEditRow || typeof this.canEditRow !== 'function' || this.canEditRow({ row, component: this });
|
|
11641
|
+
}
|
|
11479
11642
|
}
|
|
11480
11643
|
|
|
11481
11644
|
class Icons {
|
|
@@ -11919,9 +12082,9 @@ class BaseReport {
|
|
|
11919
12082
|
};
|
|
11920
12083
|
this.colunmXLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
11921
12084
|
}
|
|
11922
|
-
|
|
12085
|
+
getColumnsWidth(columns) {
|
|
11923
12086
|
const widths = {};
|
|
11924
|
-
let totalWidth;
|
|
12087
|
+
let totalWidth = 0;
|
|
11925
12088
|
try {
|
|
11926
12089
|
totalWidth = columns.reduce((sum, col) => {
|
|
11927
12090
|
widths[col.name] = col.getWidth();
|
|
@@ -11933,6 +12096,10 @@ class BaseReport {
|
|
|
11933
12096
|
throw e;
|
|
11934
12097
|
}
|
|
11935
12098
|
}
|
|
12099
|
+
return { widths, totalWidth };
|
|
12100
|
+
}
|
|
12101
|
+
buildColumns(columns) {
|
|
12102
|
+
const { widths, totalWidth } = this.getColumnsWidth(columns);
|
|
11936
12103
|
return columns.reduce((result, col, index) => {
|
|
11937
12104
|
let size;
|
|
11938
12105
|
if (!totalWidth) {
|
|
@@ -11945,63 +12112,20 @@ class BaseReport {
|
|
|
11945
12112
|
align: col.align || 'left',
|
|
11946
12113
|
description: col.label,
|
|
11947
12114
|
sequence: index,
|
|
11948
|
-
format: this.getFormatOfColumn(col),
|
|
11949
12115
|
size: `${size}%`,
|
|
11950
12116
|
xlsType: col.xlsType,
|
|
11951
12117
|
};
|
|
11952
12118
|
return Object.assign(Object.assign({}, result), { [col.name]: row });
|
|
11953
12119
|
}, {});
|
|
11954
12120
|
}
|
|
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
|
-
}));
|
|
12121
|
+
buildFilter(filter, columns) {
|
|
12122
|
+
return Object.keys(filter).map((key) => {
|
|
12123
|
+
var _a;
|
|
12124
|
+
return ({
|
|
12125
|
+
label: ((_a = columns.find((col) => col.name === key)) === null || _a === void 0 ? void 0 : _a.label) || key,
|
|
12126
|
+
value: I18n.translate('IS_EQUAL', { value: filter[key] }),
|
|
12127
|
+
});
|
|
12128
|
+
});
|
|
12005
12129
|
}
|
|
12006
12130
|
formatLangCode(lang) {
|
|
12007
12131
|
if (!lang) {
|
|
@@ -12026,7 +12150,7 @@ class CSVReport extends BaseReport {
|
|
|
12026
12150
|
}
|
|
12027
12151
|
buildMetadata(name, title, columns, filter) {
|
|
12028
12152
|
const builtCols = this.buildColumns(columns);
|
|
12029
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12153
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12030
12154
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12031
12155
|
const clientLogo = '';
|
|
12032
12156
|
const enterpriseLogo = '';
|
|
@@ -12064,10 +12188,76 @@ class PDFReport extends BaseReport {
|
|
|
12064
12188
|
buildDataset(data) {
|
|
12065
12189
|
return JSON.stringify(data);
|
|
12066
12190
|
}
|
|
12191
|
+
buildColumns(columns) {
|
|
12192
|
+
const { widths, totalWidth } = this.getColumnsWidth(columns);
|
|
12193
|
+
return columns.reduce((result, col, index) => {
|
|
12194
|
+
let size;
|
|
12195
|
+
if (!totalWidth) {
|
|
12196
|
+
size = Math.floor(100 / columns.length);
|
|
12197
|
+
}
|
|
12198
|
+
else {
|
|
12199
|
+
size = Math.floor((widths[col.name] * 100) / totalWidth);
|
|
12200
|
+
}
|
|
12201
|
+
const row = {
|
|
12202
|
+
align: col.align || 'left',
|
|
12203
|
+
description: col.label,
|
|
12204
|
+
sequence: index,
|
|
12205
|
+
format: this.getFormatOfColumn(col),
|
|
12206
|
+
size: `${size}%`,
|
|
12207
|
+
xlsType: col.xlsType,
|
|
12208
|
+
};
|
|
12209
|
+
return Object.assign(Object.assign({}, result), { [col.name]: row });
|
|
12210
|
+
}, {});
|
|
12211
|
+
}
|
|
12212
|
+
getFormatOfColumn(column) {
|
|
12213
|
+
let format;
|
|
12214
|
+
let { mask } = column;
|
|
12215
|
+
if (mask) {
|
|
12216
|
+
format = {
|
|
12217
|
+
type: 'fix',
|
|
12218
|
+
params: {
|
|
12219
|
+
mask,
|
|
12220
|
+
},
|
|
12221
|
+
};
|
|
12222
|
+
}
|
|
12223
|
+
else if (column.componentProps && Object.keys(column.componentProps).length) {
|
|
12224
|
+
const { component } = column.componentProps;
|
|
12225
|
+
if (this.isNumberComponent(component)) {
|
|
12226
|
+
format = { type: 'float' };
|
|
12227
|
+
mask = this.checkAccessor(column.componentProps.mask);
|
|
12228
|
+
if (mask) {
|
|
12229
|
+
format.params = {};
|
|
12230
|
+
if (mask.currencySymbol) {
|
|
12231
|
+
format.type = 'currency';
|
|
12232
|
+
format.symbol = mask.currencySymbol;
|
|
12233
|
+
format.decimal = mask.decimalCharacter;
|
|
12234
|
+
format.thousands = mask.digitGroupSeparator;
|
|
12235
|
+
format.precision = mask.decimalPlaces;
|
|
12236
|
+
}
|
|
12237
|
+
else {
|
|
12238
|
+
format.params.decimal = mask.decimalCharacter;
|
|
12239
|
+
format.params.thousands = mask.digitGroupSeparator;
|
|
12240
|
+
format.params.precision = mask.decimalPlaces;
|
|
12241
|
+
}
|
|
12242
|
+
}
|
|
12243
|
+
}
|
|
12244
|
+
}
|
|
12245
|
+
return format;
|
|
12246
|
+
}
|
|
12247
|
+
isNumberComponent(component) {
|
|
12248
|
+
return ['ZdNumber', 'ZdCurrency', 'ZdIncrement'].indexOf(component) !== -1;
|
|
12249
|
+
}
|
|
12250
|
+
checkAccessor(value) {
|
|
12251
|
+
if (Accessor.isAccessorDefinition(value)) {
|
|
12252
|
+
const [controller, accessor] = Accessor.getAccessor(value);
|
|
12253
|
+
return Loader.getInstance(controller)[accessor];
|
|
12254
|
+
}
|
|
12255
|
+
return value;
|
|
12256
|
+
}
|
|
12067
12257
|
buildMetadata(name, title, columns, filter, portrait = true) {
|
|
12068
12258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
12069
12259
|
const builtCols = this.buildColumns(columns);
|
|
12070
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12260
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12071
12261
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12072
12262
|
let clientLogo = '';
|
|
12073
12263
|
let enterpriseLogo = '';
|
|
@@ -12145,6 +12335,7 @@ class PDFReport extends BaseReport {
|
|
|
12145
12335
|
}
|
|
12146
12336
|
}
|
|
12147
12337
|
|
|
12338
|
+
// XLS without groups (formatXLS = 'F3')
|
|
12148
12339
|
class XLSReport extends BaseReport {
|
|
12149
12340
|
constructor() {
|
|
12150
12341
|
super(...arguments);
|
|
@@ -12165,7 +12356,7 @@ class XLSReport extends BaseReport {
|
|
|
12165
12356
|
}
|
|
12166
12357
|
buildMetadata(name, title, columns, filter) {
|
|
12167
12358
|
const builtCols = this.buildColumns(columns);
|
|
12168
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12359
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12169
12360
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12170
12361
|
const clientLogo = '';
|
|
12171
12362
|
const enterpriseLogo = '';
|
|
@@ -12191,13 +12382,14 @@ class XLSReport extends BaseReport {
|
|
|
12191
12382
|
columns: builtCols,
|
|
12192
12383
|
filter: builtFilters,
|
|
12193
12384
|
reportXLS: true,
|
|
12385
|
+
formatXLS: 'F3',
|
|
12194
12386
|
xlsMergedCell: [],
|
|
12195
12387
|
};
|
|
12196
12388
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
12197
12389
|
}
|
|
12198
12390
|
}
|
|
12199
12391
|
|
|
12200
|
-
// XLS with groups
|
|
12392
|
+
// XLS with groups (formatXLS = 'F1')
|
|
12201
12393
|
class XLS2Report extends BaseReport {
|
|
12202
12394
|
constructor() {
|
|
12203
12395
|
super(...arguments);
|
|
@@ -12209,7 +12401,7 @@ class XLS2Report extends BaseReport {
|
|
|
12209
12401
|
}
|
|
12210
12402
|
buildMetadata(name, title, columns, filter) {
|
|
12211
12403
|
const builtCols = this.buildColumns(columns);
|
|
12212
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12404
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12213
12405
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12214
12406
|
const clientLogo = '';
|
|
12215
12407
|
const enterpriseLogo = '';
|
|
@@ -12235,6 +12427,7 @@ class XLS2Report extends BaseReport {
|
|
|
12235
12427
|
columns: builtCols,
|
|
12236
12428
|
filter: builtFilters,
|
|
12237
12429
|
reportXLS: true,
|
|
12430
|
+
formatXLS: 'F1',
|
|
12238
12431
|
xlsMergedCell: [],
|
|
12239
12432
|
};
|
|
12240
12433
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12393,7 +12586,7 @@ class XLS2Report extends BaseReport {
|
|
|
12393
12586
|
}
|
|
12394
12587
|
}
|
|
12395
12588
|
|
|
12396
|
-
// Grid mirror (with groups)
|
|
12589
|
+
// Grid mirror (with groups) (formatXLS = 'F2')
|
|
12397
12590
|
class XLS3Report extends BaseReport {
|
|
12398
12591
|
constructor() {
|
|
12399
12592
|
super(...arguments);
|
|
@@ -12405,7 +12598,7 @@ class XLS3Report extends BaseReport {
|
|
|
12405
12598
|
}
|
|
12406
12599
|
buildMetadata(name, title, columns, filter) {
|
|
12407
12600
|
const builtCols = this.buildColumns(columns);
|
|
12408
|
-
const builtFilters = this.buildFilter(filter || {});
|
|
12601
|
+
const builtFilters = this.buildFilter(filter || {}, columns);
|
|
12409
12602
|
const lang = this.formatLangCode(I18n.instance.language);
|
|
12410
12603
|
const clientLogo = '';
|
|
12411
12604
|
const enterpriseLogo = '';
|
|
@@ -12431,6 +12624,7 @@ class XLS3Report extends BaseReport {
|
|
|
12431
12624
|
columns: builtCols,
|
|
12432
12625
|
filter: builtFilters,
|
|
12433
12626
|
reportXLS: true,
|
|
12627
|
+
formatXLS: 'F2',
|
|
12434
12628
|
xlsMergedCell: [],
|
|
12435
12629
|
};
|
|
12436
12630
|
return Promise.resolve(JSON.stringify(metadataObj));
|
|
@@ -12635,7 +12829,7 @@ class Report {
|
|
|
12635
12829
|
const { route } = reportType;
|
|
12636
12830
|
const { name, columns, datasource } = this.iterable;
|
|
12637
12831
|
const { groupedData } = Object.assign({}, this.iterable);
|
|
12638
|
-
const formattedColumns = this.
|
|
12832
|
+
const formattedColumns = this.removeColumns(columns);
|
|
12639
12833
|
const metadataObj = yield reportType.buildMetadata(name, this.title, formattedColumns, datasource.filter, portrait);
|
|
12640
12834
|
let dataset;
|
|
12641
12835
|
if ((reportType instanceof XLS2Report || reportType instanceof XLS3Report) && groupedData) {
|
|
@@ -12677,11 +12871,11 @@ class Report {
|
|
|
12677
12871
|
return new URL(reportFile, this.fileEndPoint).href;
|
|
12678
12872
|
});
|
|
12679
12873
|
}
|
|
12680
|
-
|
|
12681
|
-
return columns.filter((item) => item.type !== 'action');
|
|
12874
|
+
removeColumns(columns) {
|
|
12875
|
+
return columns.filter((item) => (item.type !== 'action' && item.isVisible));
|
|
12682
12876
|
}
|
|
12683
12877
|
}
|
|
12684
12878
|
|
|
12685
12879
|
const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
12686
12880
|
|
|
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 };
|
|
12881
|
+
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 };
|