inviton-powerduck 0.0.154 → 0.0.155
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/app/powerduck-initializer.ts +3 -3
- package/common/api-http.ts +20 -14
- package/common/css/ladda-themeless-zoomin.min.css +89 -89
- package/common/enum-translation/day-translator.ts +3 -2
- package/common/excel/excel-reader.ts +2 -9
- package/common/extensions/array-extensions.ts +116 -0
- package/common/extensions/string-extensions.ts +92 -0
- package/common/extensions/temporal-extensions.ts +115 -0
- package/common/scroll-utils.ts +2 -1
- package/common/temporal-helpers.ts +551 -0
- package/common/timezone-helper.ts +39 -29
- package/common/utils/cookie.ts +11 -8
- package/common/utils/date-localization-utils.ts +25 -19
- package/common/utils/date-utils.ts +37 -47
- package/common/utils/form-utils.ts +3 -1
- package/common/utils/language-utils.ts +21 -27
- package/common/utils/temporal-utils.ts +43 -0
- package/common/utils/upload-image-helper.ts +1 -1
- package/common/utils/utils.ts +14 -14
- package/common/validation.ts +17 -5
- package/components/chart-js/line-chart-flot.tsx +9 -9
- package/components/chart-js/thirdparty/flot/jquery.flot.categories.min.js +93 -93
- package/components/chart-js/thirdparty/flot/jquery.flot.crosshair.min.js +83 -83
- package/components/chart-js/thirdparty/flot/jquery.flot.navigate.min.js +270 -270
- package/components/chart-js/thirdparty/flot/jquery.flot.pie.min.js +507 -507
- package/components/chart-js/thirdparty/flot/jquery.flot.resize.js +7 -9
- package/components/chart-js/thirdparty/flot/jquery.flot.resize.min.js +9 -11
- package/components/chart-js/thirdparty/flot/jquery.flot.stack.min.js +104 -104
- package/components/chart-js/ts/line-chart-contracts.ts +2 -2
- package/components/container-with-breakpoints/ts/breakpoint-handler.ts +2 -2
- package/components/counter/testall.tsx +89 -75
- package/components/datatable/datatable.tsx +2379 -2375
- package/components/datatable/export-excel-modal.tsx +12 -14
- package/components/datatable/ts/reorder.ts +4 -2
- package/components/dropdown/index.tsx +48 -22
- package/components/dropdown/mobile/legacy_fdd.ts +10 -11
- package/components/dropzone/gallery-dropzone.tsx +394 -382
- package/components/fullcalendar/fullcalendar-draggable-event.tsx +8 -7
- package/components/fullcalendar/timegrid-calendar.tsx +60 -67
- package/components/image-crop/image-cropping-modal.tsx +9 -8
- package/components/image-crop/upload-and-crop.tsx +162 -162
- package/components/image-crop/vendor/jquery.Jcrop.min.css +344 -344
- package/components/import/import-mapper.tsx +2 -2
- package/components/input/daterange-picker.tsx +502 -521
- package/components/input/datetime-picker.tsx +45 -50
- package/components/input/plugins/daterangepicker/daterangepicker.min.css +400 -400
- package/components/input/plugins/daterangepicker/jquery.daterangepicker.min.js +346 -339
- package/components/input/plugins/daterangepicker/jquery.daterangepicker.ts +580 -402
- package/components/input/radio-button-group.tsx +2 -2
- package/components/input/ts/dateInputHelper.ts +1 -0
- package/components/input/wysiwig.tsx +12 -7
- package/components/svg/skilift-svg.tsx +6 -6
- package/package.json +2 -1
- package/common/date-wrapper.ts +0 -422
- package/common/utils/array-extend.ts +0 -215
- package/common/utils/array-remove.ts +0 -10
- package/common/utils/array-sort.ts +0 -56
- package/common/utils/capitalize-string.ts +0 -11
- package/common/utils/format-string.ts +0 -14
- package/common/utils/latinize-string.ts +0 -7
|
@@ -1,26 +1,29 @@
|
|
|
1
|
+
import type { Temporal } from '@js-temporal/polyfill';
|
|
2
|
+
|
|
1
3
|
import type { DropdownButtonItemArgs } from '../dropdown-button/dropdown-button-item';
|
|
2
4
|
import type { FormItemWrapperArgs, MarginType } from '../form/form-item-wrapper';
|
|
3
5
|
import { Prop, toNative } from 'vue-facing-decorator';
|
|
4
6
|
import PowerduckState from '../../app/powerduck-state';
|
|
5
7
|
import TsxComponent, { Component } from '../../app/vuetsx';
|
|
6
8
|
|
|
7
|
-
import {
|
|
8
|
-
import { capitalize } from '../../common/utils/capitalize-string';
|
|
9
|
+
import { toJsDate, toWire } from '../../common/extensions/temporal-extensions';
|
|
9
10
|
import { isNullOrEmpty } from '../../common/utils/is-null-or-empty';
|
|
11
|
+
import TemporalUtils from '../../common/utils/temporal-utils';
|
|
10
12
|
import { PortalUtils } from '../../common/utils/utils';
|
|
11
13
|
import FormItemWrapper from '../form/form-item-wrapper';
|
|
12
14
|
import DateInputHelper, { DateInputUsage } from './ts/dateInputHelper';
|
|
13
15
|
import 'bootstrap-datetime-picker';
|
|
14
16
|
import 'bootstrap-datetime-picker/css/bootstrap-datetimepicker.min.css';
|
|
17
|
+
import { capitalize } from '../../common/extensions/string-extensions';
|
|
15
18
|
|
|
16
19
|
interface DatetimePickerArgs extends FormItemWrapperArgs {
|
|
17
|
-
value:
|
|
20
|
+
value: Temporal.PlainDateTime;
|
|
18
21
|
disabled?: boolean;
|
|
19
22
|
placeholder?: string;
|
|
20
23
|
showTime?: boolean;
|
|
21
|
-
startDate?:
|
|
22
|
-
endDate?:
|
|
23
|
-
changed: (newValue:
|
|
24
|
+
startDate?: Temporal.PlainDateTime;
|
|
25
|
+
endDate?: Temporal.PlainDateTime;
|
|
26
|
+
changed: (newValue: Temporal.PlainDateTime) => void;
|
|
24
27
|
inline?: boolean;
|
|
25
28
|
}
|
|
26
29
|
|
|
@@ -29,7 +32,7 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
29
32
|
@Prop() label!: string;
|
|
30
33
|
@Prop() labelButtons!: DropdownButtonItemArgs[];
|
|
31
34
|
@Prop() subtitle!: string;
|
|
32
|
-
@Prop() value!:
|
|
35
|
+
@Prop() value!: Temporal.PlainDateTime;
|
|
33
36
|
@Prop() disabled!: boolean;
|
|
34
37
|
@Prop() placeholder!: string;
|
|
35
38
|
@Prop() mandatory!: boolean;
|
|
@@ -41,14 +44,14 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
41
44
|
@Prop() prependClicked: () => void;
|
|
42
45
|
@Prop() maxWidth?: number;
|
|
43
46
|
@Prop() marginType?: MarginType;
|
|
44
|
-
@Prop() changed: (newValue:
|
|
47
|
+
@Prop() changed: (newValue: Temporal.PlainDateTime) => void;
|
|
45
48
|
@Prop() showTime!: boolean;
|
|
46
49
|
@Prop() showClearValueButton!: boolean;
|
|
47
|
-
@Prop() startDate?:
|
|
48
|
-
@Prop() endDate?:
|
|
50
|
+
@Prop() startDate?: Temporal.PlainDateTime;
|
|
51
|
+
@Prop() endDate?: Temporal.PlainDateTime;
|
|
49
52
|
@Prop() inline!: boolean;
|
|
50
53
|
|
|
51
|
-
raiseChangeEvent(newValue:
|
|
54
|
+
raiseChangeEvent(newValue: Temporal.PlainDateTime) {
|
|
52
55
|
this.populateValidationDeclaration();
|
|
53
56
|
|
|
54
57
|
if (this.changed != null) {
|
|
@@ -78,7 +81,7 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
if (this.useNativeElement()) {
|
|
81
|
-
return this.value
|
|
84
|
+
return this.value?.[toWire](this.showTime);
|
|
82
85
|
} else {
|
|
83
86
|
return null;
|
|
84
87
|
}
|
|
@@ -107,24 +110,26 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
107
110
|
};
|
|
108
111
|
|
|
109
112
|
for (let i = 0; i < 12; i++) {
|
|
113
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
110
114
|
const monthDate = new Date(Date.UTC(
|
|
111
115
|
1990,
|
|
112
116
|
i,
|
|
113
117
|
1,
|
|
114
118
|
));
|
|
115
|
-
resPack.months.push(
|
|
116
|
-
resPack.monthsShort.push(
|
|
119
|
+
resPack.months.push(monthDate.toLocaleDateString(locale, { month: 'long', timeZone: 'UTC' })[capitalize]());
|
|
120
|
+
resPack.monthsShort.push(monthDate.toLocaleDateString(locale, { month: 'short', timeZone: 'UTC' })[capitalize]());
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
for (let i = 7; i < 15; i++) {
|
|
124
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
120
125
|
const dayDate = new Date(Date.UTC(
|
|
121
126
|
2015,
|
|
122
127
|
5,
|
|
123
128
|
i,
|
|
124
129
|
));
|
|
125
|
-
resPack.days.push(
|
|
130
|
+
resPack.days.push(dayDate.toLocaleDateString(locale, { weekday: 'long', timeZone: 'UTC' })[capitalize]());
|
|
126
131
|
|
|
127
|
-
let shortDay =
|
|
132
|
+
let shortDay = dayDate.toLocaleDateString(locale, { weekday: 'short', timeZone: 'UTC' })[capitalize]();
|
|
128
133
|
resPack.daysShort.push(shortDay);
|
|
129
134
|
|
|
130
135
|
if (shortDay.length > 2) {
|
|
@@ -140,12 +145,15 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
140
145
|
|
|
141
146
|
getTimeZoneAbbreviation(): string {
|
|
142
147
|
let abbreviation, formattedStr, matchedStrings, ref, str;
|
|
148
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
143
149
|
const date = new Date().toString();
|
|
150
|
+
// eslint-disable-next-line no-cond-assign
|
|
144
151
|
formattedStr = ((ref = date.split('(')[1]) != null ? ref.slice(0, -1) : 0) || date.split(' ');
|
|
145
152
|
if (Array.isArray(formattedStr)) {
|
|
146
153
|
matchedStrings = [];
|
|
147
154
|
for (let i = 0, len = formattedStr.length; i < len; i++) {
|
|
148
155
|
str = formattedStr[i];
|
|
156
|
+
// eslint-disable-next-line no-cond-assign
|
|
149
157
|
if ((abbreviation = (ref = str.match(/\b[A-Z]+\b/)) !== null) ? ref[0] : 0) {
|
|
150
158
|
matchedStrings.push(abbreviation);
|
|
151
159
|
}
|
|
@@ -158,7 +166,7 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
158
166
|
|
|
159
167
|
handleInputValueChange(e) {
|
|
160
168
|
if (this.useNativeElement()) {
|
|
161
|
-
this.raiseChangeEvent(
|
|
169
|
+
this.raiseChangeEvent(TemporalUtils.fromString(e.target.value));
|
|
162
170
|
} else {
|
|
163
171
|
(this.getDtpJq() as any).datetimepicker('update');
|
|
164
172
|
|
|
@@ -174,14 +182,8 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
174
182
|
'standard',
|
|
175
183
|
'UTC',
|
|
176
184
|
);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
parsedDate.getUTCMonth(),
|
|
180
|
-
parsedDate.getUTCDate(),
|
|
181
|
-
parsedDate.getUTCHours(),
|
|
182
|
-
parsedDate.getUTCMinutes(),
|
|
183
|
-
));
|
|
184
|
-
this.onDtpValueChanged(utcDateWrapper as any);
|
|
185
|
+
|
|
186
|
+
this.onDtpValueChanged(TemporalUtils.fromDate(parsedDate));
|
|
185
187
|
}
|
|
186
188
|
}
|
|
187
189
|
}
|
|
@@ -209,8 +211,8 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
209
211
|
onFocus={e => this.handleInputOnFocus(e)}
|
|
210
212
|
class={`${PowerduckState.getFormControlCssClass()} dtp-input${placeholderClass}`}
|
|
211
213
|
placeholder={this.placeholder}
|
|
212
|
-
min={this.startDate == null ? null : this.startDate
|
|
213
|
-
max={this.endDate == null ? null : this.endDate
|
|
214
|
+
min={this.startDate == null ? null : this.startDate[toWire](this.showTime)}
|
|
215
|
+
max={this.endDate == null ? null : this.endDate[toWire](this.showTime)}
|
|
214
216
|
/>
|
|
215
217
|
);
|
|
216
218
|
} else {
|
|
@@ -239,8 +241,8 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
239
241
|
);
|
|
240
242
|
}
|
|
241
243
|
|
|
242
|
-
onDtpValueChanged(e:
|
|
243
|
-
this.raiseChangeEvent(e
|
|
244
|
+
onDtpValueChanged(e: Temporal.PlainDateTime): void {
|
|
245
|
+
this.raiseChangeEvent(e);
|
|
244
246
|
}
|
|
245
247
|
|
|
246
248
|
getDtpJq(): JQuery {
|
|
@@ -252,15 +254,7 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
252
254
|
return null;
|
|
253
255
|
}
|
|
254
256
|
|
|
255
|
-
|
|
256
|
-
return new Date(
|
|
257
|
-
d.getFullYear(),
|
|
258
|
-
d.getMonth(),
|
|
259
|
-
d.getDate(),
|
|
260
|
-
d.getHours(),
|
|
261
|
-
d.getMinutes(),
|
|
262
|
-
d.getSeconds(),
|
|
263
|
-
);
|
|
257
|
+
return this.value[toJsDate]();
|
|
264
258
|
}
|
|
265
259
|
|
|
266
260
|
refreshJqInputDate() {
|
|
@@ -274,7 +268,7 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
274
268
|
const DPGlobal = ($ as any).fn.datetimepicker.DPGlobal;
|
|
275
269
|
const format = DPGlobal.parseFormat(this.getDtpDateFormat(), 'standard');
|
|
276
270
|
const separators = $.extend([], format.separators);
|
|
277
|
-
const getVal =
|
|
271
|
+
const getVal = (num: number): string => {
|
|
278
272
|
if (num < 10) {
|
|
279
273
|
return `0${num.toString()}`;
|
|
280
274
|
} else {
|
|
@@ -283,15 +277,16 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
283
277
|
};
|
|
284
278
|
|
|
285
279
|
if (date != null) {
|
|
280
|
+
const d = date.toZonedDateTime('UTC');
|
|
286
281
|
const funcMapping = {
|
|
287
|
-
t:
|
|
288
|
-
yy:
|
|
289
|
-
yyyy:
|
|
290
|
-
mm: getVal(
|
|
291
|
-
dd: getVal(
|
|
292
|
-
hh: getVal(
|
|
293
|
-
ii: getVal(
|
|
294
|
-
ss: getVal(
|
|
282
|
+
t: d.epochMilliseconds,
|
|
283
|
+
yy: d.year.toString().substring(2),
|
|
284
|
+
yyyy: d.year,
|
|
285
|
+
mm: getVal(d.month),
|
|
286
|
+
dd: getVal(d.day),
|
|
287
|
+
hh: getVal(d.hour),
|
|
288
|
+
ii: getVal(d.minute),
|
|
289
|
+
ss: getVal(d.second),
|
|
295
290
|
z: this.getTimeZoneAbbreviation(),
|
|
296
291
|
};
|
|
297
292
|
|
|
@@ -323,8 +318,8 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
323
318
|
format: this.getDtpDateFormat(),
|
|
324
319
|
minView: this.showTime ? 0 : 2,
|
|
325
320
|
initialDate: this.getDateForJqDtp(),
|
|
326
|
-
startDate: this.startDate != null ? this.startDate
|
|
327
|
-
endDate: this.endDate != null ? this.endDate
|
|
321
|
+
startDate: this.startDate != null ? this.startDate[toWire](true) : null,
|
|
322
|
+
endDate: this.endDate != null ? this.endDate[toWire](true) : null,
|
|
328
323
|
language: PowerduckState.getCurrentLanguage(),
|
|
329
324
|
timezone: this.getTimeZoneAbbreviation(),
|
|
330
325
|
weekStart: DateInputHelper.getStartOfWeek(),
|
|
@@ -332,7 +327,7 @@ class DatetimePickerComponent extends TsxComponent<DatetimePickerArgs> implement
|
|
|
332
327
|
|
|
333
328
|
this.getDtpJq()
|
|
334
329
|
.on('changeDate', (e: any) => {
|
|
335
|
-
this.onDtpValueChanged(e.date);
|
|
330
|
+
this.onDtpValueChanged(TemporalUtils.fromDate(e.date));
|
|
336
331
|
})
|
|
337
332
|
.on('keydown', (e) => {
|
|
338
333
|
if (e.keyCode == 13) {
|