From d312d30c605745af4cbed81b00bbe4b14878e5e5 Mon Sep 17 00:00:00 2001 From: Odalys Adam Date: Thu, 12 Oct 2023 10:42:26 +0200 Subject: [PATCH 01/35] don't show adjacent months --- src/components/feature-date-time-picker/DatePicker.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/feature-date-time-picker/DatePicker.vue b/src/components/feature-date-time-picker/DatePicker.vue index 184043d53c..293df99ea8 100644 --- a/src/components/feature-date-time-picker/DatePicker.vue +++ b/src/components/feature-date-time-picker/DatePicker.vue @@ -39,7 +39,6 @@ first-day-of-week="1" :min="minDate" :max="maxDate" - show-adjacent-months @input="onInput" /> From 589b589957b7960069f361d899e544e48674bd46 Mon Sep 17 00:00:00 2001 From: Odalys Adam Date: Fri, 13 Oct 2023 12:02:43 +0200 Subject: [PATCH 02/35] first draft time picker autocorrect --- .../feature-date-time-picker/TimePicker.vue | 82 ++++++++++++------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/src/components/feature-date-time-picker/TimePicker.vue b/src/components/feature-date-time-picker/TimePicker.vue index 3e5c94be77..749e8062f6 100644 --- a/src/components/feature-date-time-picker/TimePicker.vue +++ b/src/components/feature-date-time-picker/TimePicker.vue @@ -11,7 +11,7 @@ diff --git a/src/components/feature-date-time-picker/TimePicker.vue b/src/components/feature-date-time-picker/TimePicker.vue index 25fb03f61e..8871b2b795 100644 --- a/src/components/feature-date-time-picker/TimePicker.vue +++ b/src/components/feature-date-time-picker/TimePicker.vue @@ -20,6 +20,7 @@ append-icon="$mdiClockOutline" :rules="rules" data-testid="time-input" + v-timeInputMask :class="{ 'menu-open': showTimeDialog }" @keypress="isNumberOrColon" @keydown.prevent.space="showTimeDialog = true" @@ -54,6 +55,7 @@ import { computed, defineComponent, ref, watch, watchEffect } from "vue"; import { useTimePickerState } from "./TimePickerState.composable"; import { ValidationRule } from "@/types/date-time-picker/Validation"; import { useI18n } from "@/composables/i18n.composable"; +import { timeInputMask } from "@util-input-masks"; export default defineComponent({ name: "TimePicker", @@ -63,6 +65,9 @@ export default defineComponent({ ariaLabel: { type: String, default: "" }, required: { type: Boolean }, }, + directives: { + timeInputMask, + }, emits: ["update:time"], setup(props, { emit }) { const { t } = useI18n(); diff --git a/src/components/util-input-masks/InputMask.factory.ts b/src/components/util-input-masks/InputMask.factory.ts new file mode 100644 index 0000000000..0120301591 --- /dev/null +++ b/src/components/util-input-masks/InputMask.factory.ts @@ -0,0 +1,21 @@ +import { MaskInputOptions, vMaska } from "maska"; +import { DirectiveFunction } from "vue"; + +/** + * Creates a Maska-Directive from a given maska-configuration. + * + * **Usage** + * ```ts + * const myGermanIsoDateMask = createInputMask({mask: '##.##.####'}) + * ``` + * + * @see https://beholdr.github.io/maska/#/?id=maskinput-options + */ +export const createInputMask = (options: MaskInputOptions) => { + const bindMaska: DirectiveFunction = (el, binding, vNode, oldVnode) => { + const newBinding = { ...binding, arg: options as string }; + (vMaska as DirectiveFunction)(el, newBinding, vNode, oldVnode); + }; + + return bindMaska; +}; diff --git a/src/components/util-input-masks/InputsMasks.ts b/src/components/util-input-masks/InputsMasks.ts new file mode 100644 index 0000000000..63c858e562 --- /dev/null +++ b/src/components/util-input-masks/InputsMasks.ts @@ -0,0 +1,7 @@ +import { createInputMask } from "./InputMask.factory"; + +export const dateInputMask = createInputMask({ + mask: "##.##.####", +}); + +export const timeInputMask = createInputMask({ mask: "##:##" }); diff --git a/src/components/util-input-masks/index.ts b/src/components/util-input-masks/index.ts new file mode 100644 index 0000000000..87a195726f --- /dev/null +++ b/src/components/util-input-masks/index.ts @@ -0,0 +1,3 @@ +import { dateInputMask, timeInputMask } from "./InputsMasks"; + +export { dateInputMask, timeInputMask }; diff --git a/tsconfig.json b/tsconfig.json index 99d972f024..6623e788e9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,13 +38,13 @@ "@feature-date-time-picker": ["src/components/feature-date-time-picker"], "@feature-editor": ["src/components/feature-editor"], "@feature-render-html": ["src/components/feature-render-html"], - "@ui-alert": ["src/components/ui-alert"], "@ui-board": ["src/components/ui-board"], "@ui-confirmation-dialog": ["src/components/ui-confirmation-dialog"], "@ui-light-box": ["src/components/ui-light-box"], "@util-board": ["src/components/util-board"], "@util-validators": ["src/components/util-validators"], + "@util-input-masks": ["src/components/util-input-masks"], "@page-board": ["src/components/page-board"], "@/*": ["src/*"], "@@/*": ["*"] diff --git a/vue.config.js b/vue.config.js index fd93d2a3d8..0d81fcbc22 100644 --- a/vue.config.js +++ b/vue.config.js @@ -51,6 +51,7 @@ module.exports = defineConfig({ "@ui-light-box": getDir("src/components/ui-light-box"), "@util-board": getDir("src/components/util-board"), "@util-validators": getDir("src/components/util-validators"), + "@util-input-masks": getDir("src/components/util-input-masks"), "@page-board": getDir("src/components/page-board"), }, extensions: [".js", ".ts", ".vue", ".json"], From 1e4b27b1690ce9b22fa1b8d4e09d5a7e9a74d8e6 Mon Sep 17 00:00:00 2001 From: Odalys Adam Date: Wed, 25 Oct 2023 10:31:21 +0200 Subject: [PATCH 06/35] remove test component --- .../LinkContentElementEdit.vue | 1 - src/components/feature-board/board/Board.vue | 3 --- .../feature-board/board/TestComponent.vue | 26 ------------------- 3 files changed, 30 deletions(-) delete mode 100644 src/components/feature-board/board/TestComponent.vue diff --git a/src/components/feature-board-link-element/LinkContentElementEdit.vue b/src/components/feature-board-link-element/LinkContentElementEdit.vue index d8fa10ee31..aee3a0093f 100644 --- a/src/components/feature-board-link-element/LinkContentElementEdit.vue +++ b/src/components/feature-board-link-element/LinkContentElementEdit.vue @@ -3,7 +3,6 @@ {{ $t("pages.room.boardCard.label.courseBoard") }} -