@katlux/toolkit 0.1.0-beta.43 → 0.1.0-beta.44

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
3
  "configKey": "katluxToolkit",
4
- "version": "0.1.0-beta.43",
4
+ "version": "0.1.0-beta.44",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -86,13 +86,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
86
86
  "onUpdate:modelValue"?: ((value: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null) => any) | undefined;
87
87
  }>, {
88
88
  disabled: boolean;
89
- modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
90
- visibleFields: String[];
91
89
  searchbox: boolean;
92
90
  placeholder: string;
93
91
  closeOnSelect: boolean;
94
92
  multiSelect: boolean;
95
93
  maxSelectedDisplay: string | number | boolean;
94
+ visibleFields: String[];
95
+ modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
96
96
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
97
97
  declare const _default: typeof __VLS_export;
98
98
  export default _default;
@@ -86,13 +86,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
86
86
  "onUpdate:modelValue"?: ((value: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null) => any) | undefined;
87
87
  }>, {
88
88
  disabled: boolean;
89
- modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
90
- visibleFields: String[];
91
89
  searchbox: boolean;
92
90
  placeholder: string;
93
91
  closeOnSelect: boolean;
94
92
  multiSelect: boolean;
95
93
  maxSelectedDisplay: string | number | boolean;
94
+ visibleFields: String[];
95
+ modelValue: import("@katlux/providers").TDataRow | import("@katlux/providers").TDataRow[] | null;
96
96
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
97
97
  declare const _default: typeof __VLS_export;
98
98
  export default _default;
@@ -7,6 +7,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
7
7
  type: (DateConstructor | StringConstructor)[];
8
8
  default: undefined;
9
9
  };
10
+ modelValue: {
11
+ type: (DateConstructor | StringConstructor)[];
12
+ default: undefined;
13
+ };
14
+ isOpen: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
10
18
  calendarDefinedDays: {
11
19
  type: import("vue").PropType<IDefinedDay[]>;
12
20
  default: () => never[];
@@ -15,7 +23,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
15
23
  type: import("vue").PropType<IMarkedDay[]>;
16
24
  default: () => never[];
17
25
  };
18
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
27
+ "update:modelValue": (value: string | Date) => any;
28
+ "update:maskedModel": (value: string) => any;
29
+ "update:calendarShow": (value: boolean) => any;
30
+ "update:day": (value: string | Date) => any;
31
+ "update:isOpen": (value: boolean) => any;
32
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
33
  format: {
20
34
  type: StringConstructor;
21
35
  default: string;
@@ -24,6 +38,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
24
38
  type: (DateConstructor | StringConstructor)[];
25
39
  default: undefined;
26
40
  };
41
+ modelValue: {
42
+ type: (DateConstructor | StringConstructor)[];
43
+ default: undefined;
44
+ };
45
+ isOpen: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
27
49
  calendarDefinedDays: {
28
50
  type: import("vue").PropType<IDefinedDay[]>;
29
51
  default: () => never[];
@@ -32,8 +54,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
32
54
  type: import("vue").PropType<IMarkedDay[]>;
33
55
  default: () => never[];
34
56
  };
35
- }>> & Readonly<{}>, {
57
+ }>> & Readonly<{
58
+ "onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
59
+ "onUpdate:maskedModel"?: ((value: string) => any) | undefined;
60
+ "onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
61
+ "onUpdate:day"?: ((value: string | Date) => any) | undefined;
62
+ "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
63
+ }>, {
64
+ isOpen: boolean;
36
65
  day: string | Date;
66
+ modelValue: string | Date;
37
67
  format: string;
38
68
  calendarDefinedDays: IDefinedDay[];
39
69
  calendarMarkedDays: IMarkedDay[];
@@ -1,9 +1,10 @@
1
1
  <script setup>
2
2
  import { useKDatePickerLogic, KDatePickerDefaultProps } from "./KDatePicker.logic";
3
3
  import { usePresetComponent } from "../../composables/usePresetComponent";
4
- import { computed } from "vue";
4
+ import { computed, watch } from "vue";
5
5
  import KDatePickerDefault from "../../presets/default/components/KDatePicker/KDatePicker.vue";
6
6
  const props = defineProps(KDatePickerDefaultProps);
7
+ const emit = defineEmits(["update:maskedModel", "update:calendarShow", "update:day", "update:modelValue", "update:isOpen"]);
7
8
  const {
8
9
  _date,
9
10
  maskedModel,
@@ -33,6 +34,13 @@ const updateCalendarShow = (val) => {
33
34
  const handleDateSelected = (date) => {
34
35
  dateSelected(date);
35
36
  };
37
+ watch(_date, (newDate) => {
38
+ emit("update:day", newDate);
39
+ emit("update:modelValue", newDate);
40
+ });
41
+ watch(calendarShow, (newVal) => {
42
+ emit("update:isOpen", newVal);
43
+ });
36
44
  </script>
37
45
 
38
46
  <template lang="pug">
@@ -7,6 +7,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
7
7
  type: (DateConstructor | StringConstructor)[];
8
8
  default: undefined;
9
9
  };
10
+ modelValue: {
11
+ type: (DateConstructor | StringConstructor)[];
12
+ default: undefined;
13
+ };
14
+ isOpen: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
10
18
  calendarDefinedDays: {
11
19
  type: import("vue").PropType<IDefinedDay[]>;
12
20
  default: () => never[];
@@ -15,7 +23,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
15
23
  type: import("vue").PropType<IMarkedDay[]>;
16
24
  default: () => never[];
17
25
  };
18
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
27
+ "update:modelValue": (value: string | Date) => any;
28
+ "update:maskedModel": (value: string) => any;
29
+ "update:calendarShow": (value: boolean) => any;
30
+ "update:day": (value: string | Date) => any;
31
+ "update:isOpen": (value: boolean) => any;
32
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
33
  format: {
20
34
  type: StringConstructor;
21
35
  default: string;
@@ -24,6 +38,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
24
38
  type: (DateConstructor | StringConstructor)[];
25
39
  default: undefined;
26
40
  };
41
+ modelValue: {
42
+ type: (DateConstructor | StringConstructor)[];
43
+ default: undefined;
44
+ };
45
+ isOpen: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
27
49
  calendarDefinedDays: {
28
50
  type: import("vue").PropType<IDefinedDay[]>;
29
51
  default: () => never[];
@@ -32,8 +54,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
32
54
  type: import("vue").PropType<IMarkedDay[]>;
33
55
  default: () => never[];
34
56
  };
35
- }>> & Readonly<{}>, {
57
+ }>> & Readonly<{
58
+ "onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
59
+ "onUpdate:maskedModel"?: ((value: string) => any) | undefined;
60
+ "onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
61
+ "onUpdate:day"?: ((value: string | Date) => any) | undefined;
62
+ "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
63
+ }>, {
64
+ isOpen: boolean;
36
65
  day: string | Date;
66
+ modelValue: string | Date;
37
67
  format: string;
38
68
  calendarDefinedDays: IDefinedDay[];
39
69
  calendarMarkedDays: IMarkedDay[];
@@ -3,6 +3,8 @@ import type { IMarkedDay, IDefinedDay } from '@katlux/toolkit/components/KCalend
3
3
  export interface KDatePickerProps {
4
4
  format: string;
5
5
  day?: Date | string;
6
+ modelValue?: Date | string;
7
+ isOpen?: boolean;
6
8
  calendarDefinedDays: IDefinedDay[];
7
9
  calendarMarkedDays: IMarkedDay[];
8
10
  }
@@ -15,6 +17,14 @@ export declare const KDatePickerDefaultProps: {
15
17
  type: (DateConstructor | StringConstructor)[];
16
18
  default: undefined;
17
19
  };
20
+ modelValue: {
21
+ type: (DateConstructor | StringConstructor)[];
22
+ default: undefined;
23
+ };
24
+ isOpen: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
18
28
  calendarDefinedDays: {
19
29
  type: PropType<IDefinedDay[]>;
20
30
  default: () => never[];
@@ -1,4 +1,4 @@
1
- import { ref, onMounted, computed } from "vue";
1
+ import { ref, watch, onMounted, computed } from "vue";
2
2
  export const KDatePickerDefaultProps = {
3
3
  format: {
4
4
  type: String,
@@ -8,6 +8,14 @@ export const KDatePickerDefaultProps = {
8
8
  type: [Date, String],
9
9
  default: void 0
10
10
  },
11
+ modelValue: {
12
+ type: [Date, String],
13
+ default: void 0
14
+ },
15
+ isOpen: {
16
+ type: Boolean,
17
+ default: false
18
+ },
11
19
  calendarDefinedDays: {
12
20
  type: Array,
13
21
  default: () => []
@@ -44,11 +52,46 @@ export function useKDatePickerLogic(props) {
44
52
  return formattedDate;
45
53
  };
46
54
  onMounted(() => {
47
- maskedModel.value = _date.value.toString();
55
+ if (props.modelValue) {
56
+ _date.value = props.modelValue;
57
+ } else if (props.day) {
58
+ _date.value = props.day;
59
+ }
60
+ if (props.isOpen) {
61
+ calendarShow.value = props.isOpen;
62
+ }
63
+ if (_date.value) {
64
+ const initialDate = _date.value instanceof Date ? _date.value : new Date(_date.value);
65
+ if (!isNaN(initialDate.getTime())) {
66
+ maskedModel.value = formatDate(initialDate);
67
+ }
68
+ }
48
69
  });
70
+ watch(() => props.day, (newDay) => {
71
+ if (newDay) {
72
+ _date.value = newDay;
73
+ syncMaskedModel(newDay);
74
+ }
75
+ });
76
+ watch(() => props.modelValue, (newVal) => {
77
+ if (newVal) {
78
+ _date.value = newVal;
79
+ syncMaskedModel(newVal);
80
+ }
81
+ });
82
+ watch(() => props.isOpen, (newVal) => {
83
+ calendarShow.value = !!newVal;
84
+ });
85
+ const syncMaskedModel = (val) => {
86
+ const d = val instanceof Date ? val : new Date(val);
87
+ if (!isNaN(d.getTime())) {
88
+ maskedModel.value = formatDate(d);
89
+ }
90
+ };
49
91
  const calendarDay = computed(() => {
50
- if (props.day) {
51
- return props.day;
92
+ const val = props.modelValue || props.day;
93
+ if (val) {
94
+ return val;
52
95
  }
53
96
  return /* @__PURE__ */ new Date();
54
97
  });
@@ -62,9 +62,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
62
62
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
63
63
  }>, {
64
64
  disabled: boolean;
65
+ placeholder: string;
65
66
  modelValue: string;
66
67
  format: string;
67
- placeholder: string;
68
68
  step: number;
69
69
  startHour: string;
70
70
  endHour: string;
@@ -62,9 +62,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
62
62
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
63
63
  }>, {
64
64
  disabled: boolean;
65
+ placeholder: string;
65
66
  modelValue: string;
66
67
  format: string;
67
- placeholder: string;
68
68
  step: number;
69
69
  startHour: string;
70
70
  endHour: string;
@@ -37,8 +37,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
37
37
  }>> & Readonly<{
38
38
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
39
39
  }>, {
40
- modelValue: string;
41
40
  placeholder: string;
41
+ modelValue: string;
42
42
  showClear: boolean;
43
43
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
@@ -37,8 +37,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
37
37
  }>> & Readonly<{
38
38
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
39
39
  }>, {
40
- modelValue: string;
41
40
  placeholder: string;
41
+ modelValue: string;
42
42
  showClear: boolean;
43
43
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
@@ -107,12 +107,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
107
107
  idKey: string;
108
108
  disabled: boolean;
109
109
  loading: boolean;
110
- modelValue: any;
111
- dataProvider: any;
112
110
  searchbox: boolean;
113
111
  placeholder: string;
112
+ dataProvider: any;
114
113
  closeOnSelect: boolean;
115
114
  multiSelect: boolean;
115
+ modelValue: any;
116
116
  iconField: string;
117
117
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
118
118
  declare const _default: typeof __VLS_export;
@@ -107,12 +107,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
107
107
  idKey: string;
108
108
  disabled: boolean;
109
109
  loading: boolean;
110
- modelValue: any;
111
- dataProvider: any;
112
110
  searchbox: boolean;
113
111
  placeholder: string;
112
+ dataProvider: any;
114
113
  closeOnSelect: boolean;
115
114
  multiSelect: boolean;
115
+ modelValue: any;
116
116
  iconField: string;
117
117
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
118
118
  declare const _default: typeof __VLS_export;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
- "version": "0.1.0-beta.43",
3
+ "version": "0.1.0-beta.44",
4
4
  "description": "Core UI toolkit and utilities for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "MIT",