Skip to content

Commit baecd38

Browse files
Update dependency @vue/tsconfig to ^0.8.0 (#236)
* Update dependency @vue/tsconfig to ^0.8.0 * Fix typescript compile errors * Fix DateSelection reactive component * Auto build assets [skip ci] --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Frank Dekker <fdekker@gmail.com> Co-authored-by: frankdekker <2179983+frankdekker@users.noreply.github.com>
1 parent 9583bc4 commit baecd38

File tree

9 files changed

+546
-612
lines changed

9 files changed

+546
-612
lines changed

frontend/package-lock.json

Lines changed: 487 additions & 562 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@vue/eslint-config-prettier": "^10.0.0",
3030
"@vue/eslint-config-typescript": "^14.0.1",
3131
"@vue/test-utils": "^2.4.6",
32-
"@vue/tsconfig": "^0.7.0",
32+
"@vue/tsconfig": "^0.8.0",
3333
"eslint": "^9.12.0",
3434
"eslint-plugin-vue": "^10.0.0",
3535
"jsdom": "^26.0.0",

frontend/src/components/datepicker/DatePicker.vue

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ import DatePickerDropdown from '@/components/datepicker/DatePickerDropdown.vue';
33
import type DateSelection from '@/models/DateSelection';
44
import {formatSelection, parseSelection} from '@/services/DatePickerService';
55
import {formatRelativeDate, getRelativeDate} from '@/services/Dates';
6-
import {onMounted, reactive, ref, watch} from 'vue';
6+
import {onMounted, ref, watch} from 'vue';
77
88
const between = defineModel<string>();
99
const emit = defineEmits(['change']);
1010
1111
const active = ref(false);
1212
const dateExpanded = ref<'none' | 'startDate' | 'endDate'>('none');
13-
const startDate = reactive<DateSelection>({
13+
const startDate = ref<DateSelection>({
1414
date: getRelativeDate(15, 'i', true),
1515
mode: 'relative',
1616
value: '15i',
1717
formatted: formatRelativeDate(15, 'i')
1818
});
19-
const endDate = reactive<DateSelection>({date: new Date(), mode: 'now', value: null, formatted: 'now'});
19+
const endDate = ref<DateSelection>({date: new Date(), mode: 'now', value: null, formatted: 'now'});
2020
let currentValue: string | null = null;
2121
2222
onMounted(() => onBetweenChanged());
@@ -27,7 +27,7 @@ function onBetweenChanged(): void {
2727
return;
2828
}
2929
30-
const result = parseSelection(between.value ?? '', startDate, endDate);
30+
const result = parseSelection(between.value ?? '', startDate.value, endDate.value);
3131
currentValue = result === false ? null : between.value ?? null;
3232
active.value = result !== false;
3333
}
@@ -41,19 +41,19 @@ function onExpand(): void {
4141
4242
function onApply(): void {
4343
dateExpanded.value = 'none';
44-
setBetween(formatSelection(startDate, endDate));
44+
setBetween(formatSelection(startDate.value, endDate.value));
4545
}
4646
4747
function onClear(): void {
4848
dateExpanded.value = 'none';
49-
startDate.date = getRelativeDate(15, 'i', true);
50-
startDate.mode = 'relative';
51-
startDate.value = '15i';
52-
startDate.formatted = formatRelativeDate(15, 'i');
53-
endDate.date = new Date();
54-
endDate.mode = 'now';
55-
endDate.value = null;
56-
endDate.formatted = 'now';
49+
startDate.value.date = getRelativeDate(15, 'i', true);
50+
startDate.value.mode = 'relative';
51+
startDate.value.value = '15i';
52+
startDate.value.formatted = formatRelativeDate(15, 'i');
53+
endDate.value.date = new Date();
54+
endDate.value.mode = 'now';
55+
endDate.value.value = null;
56+
endDate.value.formatted = 'now';
5757
active.value = false;
5858
setBetween('');
5959
}

frontend/src/services/Assert.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export default class Assert {
2+
public static string(value: unknown): string {
3+
if (typeof value !== 'string' && value instanceof String === false) {
4+
throw new Error('Value is not a string: ' + typeof value)
5+
}
6+
return String(value);
7+
}
8+
}

frontend/src/services/DatePickerService.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type DateSelection from '@/models/DateSelection';
22
import {format, formatDateTime, formatRelativeDate, getRelativeDate} from '@/services/Dates';
33
import Numbers from '@/services/Numbers';
4+
import Assert from '@/services/Assert.ts'
45

56
export function parseSelection(value: string, startDate: DateSelection, endDate: DateSelection): boolean {
6-
const match = (value ?? '').trim().match(/^(.*)~(.*)$/);
7+
const match: string[]|null = (value ?? '').trim().match(/^(.*)~(.*)$/);
78
if (match === null || match.length !== 3) {
89
return false;
910
}
10-
return parseDate(match[1], startDate) && parseDate(match[2], endDate);
11+
return parseDate(Assert.string(match[1]), startDate) && parseDate(Assert.string(match[2]), endDate);
1112
}
1213

1314
export function formatSelection(startDate: DateSelection, endDate: DateSelection): string {
@@ -30,7 +31,7 @@ function parseDate(value: string, date: DateSelection): boolean {
3031
return true;
3132
}
3233
if (value.match(/^\d+[sihdwmy]$/)) {
33-
const unit = value[value.length - 1];
34+
const unit = Assert.string(value[value.length - 1]);
3435
const val = Numbers.parseInt(value.substring(0, value.length - 1));
3536
date.date = getRelativeDate(val, unit, false);
3637
date.mode = 'relative';
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"src/main.ts": {
3-
"file": "assets/main-Skb8xSdo.js",
3+
"file": "assets/main-BKNaHnn9.js",
44
"name": "main",
55
"src": "src/main.ts",
66
"isEntry": true
77
},
88
"style.css": {
9-
"file": "assets/style-BHUqSd06.css",
9+
"file": "assets/style-TDLn_C_M.css",
1010
"src": "style.css"
1111
}
1212
}

src/Resources/public/assets/main-BKNaHnn9.js

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Resources/public/assets/main-Skb8xSdo.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/Resources/public/assets/style-BHUqSd06.css renamed to src/Resources/public/assets/style-TDLn_C_M.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)