@katlux/toolkit 0.1.0-beta.72 → 0.1.0-beta.73

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.
Files changed (26) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
  3. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +1 -1
  4. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
  5. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +1 -1
  6. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +1 -1
  7. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +1 -1
  8. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +1 -1
  9. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +12 -3
  10. package/dist/runtime/components/KDropdown/KDropdown.global.vue +2 -1
  11. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +12 -3
  12. package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +24 -2
  13. package/dist/runtime/components/KDropdown/KDropdown.logic.js +91 -13
  14. package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
  15. package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
  16. package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
  17. package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
  18. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +2 -2
  19. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +2 -2
  20. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +3 -3
  21. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +3 -3
  22. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +0 -1
  23. package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +7 -1
  24. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +56 -13
  25. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +7 -1
  26. package/package.json +1 -1
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.72",
4
+ "version": "0.1.0-beta.73",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -22,7 +22,7 @@ export interface KButtonEmits {
22
22
  export declare function useKButtonLogic(props: KButtonProps, emit: KButtonEmits): {
23
23
  isLink: import("vue").ComputedRef<boolean>;
24
24
  isDisabled: import("vue").ComputedRef<boolean | undefined>;
25
- buttonClasses: import("vue").ComputedRef<("info" | "default" | "small" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | "large" | "medium" | {
25
+ buttonClasses: import("vue").ComputedRef<("info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | "small" | "large" | "medium" | {
26
26
  disabled: boolean | undefined;
27
27
  })[]>;
28
28
  onClick: () => void;
@@ -11,8 +11,8 @@ interface Props {
11
11
  page?: number;
12
12
  }
13
13
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
- bulkActions: IKDatatableAction[];
15
14
  search: string;
15
+ bulkActions: IKDatatableAction[];
16
16
  loading: boolean;
17
17
  visibleFields: Array<string> | null;
18
18
  rowActions: IKDatatableAction[];
@@ -11,8 +11,8 @@ interface Props {
11
11
  page?: number;
12
12
  }
13
13
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
14
- bulkActions: IKDatatableAction[];
15
14
  search: string;
15
+ bulkActions: IKDatatableAction[];
16
16
  loading: boolean;
17
17
  visibleFields: Array<string> | null;
18
18
  rowActions: IKDatatableAction[];
@@ -113,13 +113,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
113
113
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
114
114
  }>, {
115
115
  isOpen: boolean;
116
- day: string | Date;
117
116
  validation: "error" | "success" | "warning" | null | undefined;
118
117
  validationText: string;
119
118
  modelValue: string | Date;
120
119
  placeholder: string;
121
120
  teleportTo: string;
122
121
  showClear: boolean;
122
+ day: string | Date;
123
123
  align: "left" | "right" | undefined;
124
124
  format: string;
125
125
  calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
@@ -113,13 +113,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
113
113
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
114
114
  }>, {
115
115
  isOpen: boolean;
116
- day: string | Date;
117
116
  validation: "error" | "success" | "warning" | null | undefined;
118
117
  validationText: string;
119
118
  modelValue: string | Date;
120
119
  placeholder: string;
121
120
  teleportTo: string;
122
121
  showClear: boolean;
122
+ day: string | Date;
123
123
  align: "left" | "right" | undefined;
124
124
  format: string;
125
125
  calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
@@ -119,13 +119,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
119
119
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
120
120
  }>, {
121
121
  isOpen: boolean;
122
- day: string | Date;
123
122
  validation: "error" | "success" | "warning" | null | undefined;
124
123
  validationText: string;
125
124
  modelValue: string | Date;
126
125
  placeholder: string;
127
126
  teleportTo: string;
128
127
  showClear: boolean;
128
+ day: string | Date;
129
129
  format: string;
130
130
  calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
131
131
  calendarMarkedDays: import("../KCalendar/types.js").IMarkedDay[];
@@ -119,13 +119,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
119
119
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
120
120
  }>, {
121
121
  isOpen: boolean;
122
- day: string | Date;
123
122
  validation: "error" | "success" | "warning" | null | undefined;
124
123
  validationText: string;
125
124
  modelValue: string | Date;
126
125
  placeholder: string;
127
126
  teleportTo: string;
128
127
  showClear: boolean;
128
+ day: string | Date;
129
129
  format: string;
130
130
  calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
131
131
  calendarMarkedDays: import("../KCalendar/types.js").IMarkedDay[];
@@ -16,7 +16,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
16
16
  default: undefined;
17
17
  };
18
18
  align: {
19
- type: import("vue").PropType<"left" | "right">;
19
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
20
+ default: string;
21
+ };
22
+ direction: {
23
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
20
24
  default: string;
21
25
  };
22
26
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -39,7 +43,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
39
43
  default: undefined;
40
44
  };
41
45
  align: {
42
- type: import("vue").PropType<"left" | "right">;
46
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
47
+ default: string;
48
+ };
49
+ direction: {
50
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
43
51
  default: string;
44
52
  };
45
53
  }>> & Readonly<{
@@ -48,8 +56,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
48
56
  isOpen: boolean;
49
57
  teleportTo: string;
50
58
  fullWidth: boolean;
51
- align: "left" | "right";
59
+ align: import("./KDropdown.logic.js").KDropdownAlign;
52
60
  anchorEl: HTMLElement;
61
+ direction: import("./KDropdown.logic.js").KDropdownDirection;
53
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
54
63
  declare const _default: typeof __VLS_export;
55
64
  export default _default;
@@ -20,7 +20,8 @@ const templateProps = computed(() => ({
20
20
  clickoutside,
21
21
  teleportTarget: teleportTarget.value,
22
22
  isInModal: isInModal.value,
23
- align: props.align
23
+ align: props.align,
24
+ direction: props.direction
24
25
  }));
25
26
  </script>
26
27
 
@@ -16,7 +16,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
16
16
  default: undefined;
17
17
  };
18
18
  align: {
19
- type: import("vue").PropType<"left" | "right">;
19
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
20
+ default: string;
21
+ };
22
+ direction: {
23
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
20
24
  default: string;
21
25
  };
22
26
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -39,7 +43,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
39
43
  default: undefined;
40
44
  };
41
45
  align: {
42
- type: import("vue").PropType<"left" | "right">;
46
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
47
+ default: string;
48
+ };
49
+ direction: {
50
+ type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
43
51
  default: string;
44
52
  };
45
53
  }>> & Readonly<{
@@ -48,8 +56,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
48
56
  isOpen: boolean;
49
57
  teleportTo: string;
50
58
  fullWidth: boolean;
51
- align: "left" | "right";
59
+ align: import("./KDropdown.logic.js").KDropdownAlign;
52
60
  anchorEl: HTMLElement;
61
+ direction: import("./KDropdown.logic.js").KDropdownDirection;
53
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
54
63
  declare const _default: typeof __VLS_export;
55
64
  export default _default;
@@ -1,10 +1,13 @@
1
1
  import { type PropType, type Ref } from 'vue';
2
+ export type KDropdownDirection = 'auto' | 'bottom' | 'top' | 'left' | 'right';
3
+ export type KDropdownAlign = 'left' | 'right' | 'top' | 'bottom';
2
4
  export interface KDropdownProps {
3
5
  isOpen: boolean;
4
6
  fullWidth: boolean;
5
7
  anchorEl?: HTMLElement;
6
8
  teleportTo?: string;
7
- align?: 'left' | 'right';
9
+ align?: KDropdownAlign;
10
+ direction?: KDropdownDirection;
8
11
  }
9
12
  export interface KDropdownEmits {
10
13
  (e: 'update:isOpen', value: boolean): void;
@@ -27,7 +30,11 @@ export declare const KDropdownDefaultProps: {
27
30
  default: undefined;
28
31
  };
29
32
  align: {
30
- type: PropType<"left" | "right">;
33
+ type: PropType<KDropdownAlign>;
34
+ default: string;
35
+ };
36
+ direction: {
37
+ type: PropType<KDropdownDirection>;
31
38
  default: string;
32
39
  };
33
40
  };
@@ -37,17 +44,32 @@ export declare function useKDropdownLogic(props: KDropdownProps, emit: KDropdown
37
44
  top: number;
38
45
  left: number;
39
46
  right: number;
47
+ bottom: number;
40
48
  width: number;
49
+ height: number;
50
+ maxHeight: number;
51
+ resolvedDirection: "top" | "bottom" | "left" | "right";
52
+ resolvedAlign: "left" | "right" | "top" | "bottom";
41
53
  }, {
42
54
  top: number;
43
55
  left: number;
44
56
  right: number;
57
+ bottom: number;
45
58
  width: number;
59
+ height: number;
60
+ maxHeight: number;
61
+ resolvedDirection: "top" | "bottom" | "left" | "right";
62
+ resolvedAlign: "left" | "right" | "top" | "bottom";
46
63
  } | {
47
64
  top: number;
48
65
  left: number;
49
66
  right: number;
67
+ bottom: number;
50
68
  width: number;
69
+ height: number;
70
+ maxHeight: number;
71
+ resolvedDirection: "top" | "bottom" | "left" | "right";
72
+ resolvedAlign: "left" | "right" | "top" | "bottom";
51
73
  }>;
52
74
  clickoutside: () => void;
53
75
  teleportTarget: import("vue").ComputedRef<string>;
@@ -20,6 +20,10 @@ export const KDropdownDefaultProps = {
20
20
  align: {
21
21
  type: String,
22
22
  default: "left"
23
+ },
24
+ direction: {
25
+ type: String,
26
+ default: "auto"
23
27
  }
24
28
  };
25
29
  export function useKDropdownLogic(props, emit) {
@@ -38,33 +42,109 @@ export function useKDropdownLogic(props, emit) {
38
42
  return "body";
39
43
  });
40
44
  const open = ref(false);
41
- const dropdownRect = ref({ top: 0, left: 0, right: 0, width: 0 });
45
+ const dropdownRect = ref({
46
+ top: 0,
47
+ left: 0,
48
+ right: 0,
49
+ bottom: 0,
50
+ width: 0,
51
+ height: 0,
52
+ maxHeight: 300,
53
+ resolvedDirection: "bottom",
54
+ resolvedAlign: "left"
55
+ });
42
56
  const clickoutside = () => {
43
57
  open.value = false;
44
58
  emit("update:isOpen", open.value);
45
59
  };
60
+ function resolveDirection(rect, viewportWidth, viewportHeight, requested) {
61
+ const spaceBelow = viewportHeight - rect.bottom;
62
+ const spaceAbove = rect.top;
63
+ const spaceRight = viewportWidth - rect.right;
64
+ const spaceLeft = rect.left;
65
+ if (requested === "auto") {
66
+ return spaceBelow >= spaceAbove ? "bottom" : "top";
67
+ }
68
+ if (requested === "bottom") return spaceBelow >= spaceAbove ? "bottom" : "top";
69
+ if (requested === "top") return spaceAbove >= spaceBelow ? "top" : "bottom";
70
+ if (requested === "right") return spaceRight >= spaceLeft ? "right" : "left";
71
+ if (requested === "left") return spaceLeft >= spaceRight ? "left" : "right";
72
+ return "bottom";
73
+ }
74
+ function resolveAlign(rect, viewportWidth, viewportHeight, direction, requested) {
75
+ const isVertical = direction === "top" || direction === "bottom";
76
+ if (isVertical) {
77
+ const preferLeft = requested !== "right";
78
+ const spaceRight = viewportWidth - rect.left;
79
+ const spaceLeft = rect.right;
80
+ if (preferLeft) {
81
+ return spaceRight > 80 ? "left" : "right";
82
+ } else {
83
+ return spaceLeft > 80 ? "right" : "left";
84
+ }
85
+ } else {
86
+ const preferTop = requested !== "bottom";
87
+ const spaceBelow = viewportHeight - rect.top;
88
+ const spaceAbove = rect.bottom;
89
+ if (preferTop) {
90
+ return spaceBelow > 80 ? "top" : "bottom";
91
+ } else {
92
+ return spaceAbove > 80 ? "bottom" : "top";
93
+ }
94
+ }
95
+ }
46
96
  const updatePosition = () => {
47
97
  try {
48
98
  if (props.anchorEl) {
49
99
  const el = props.anchorEl.$el || props.anchorEl;
50
100
  if (el && typeof el.getBoundingClientRect === "function") {
51
101
  const rect = el.getBoundingClientRect();
102
+ const viewportWidth = document.documentElement.clientWidth;
103
+ const viewportHeight = document.documentElement.clientHeight;
104
+ const resolvedDir = resolveDirection(
105
+ rect,
106
+ viewportWidth,
107
+ viewportHeight,
108
+ props.direction ?? "auto"
109
+ );
110
+ const resolvedAl = resolveAlign(
111
+ rect,
112
+ viewportWidth,
113
+ viewportHeight,
114
+ resolvedDir,
115
+ props.align ?? "left"
116
+ );
117
+ const spaceBelow = viewportHeight - rect.bottom;
118
+ const spaceAbove = rect.top;
119
+ const rawSpace = resolvedDir === "top" ? spaceAbove : spaceBelow;
120
+ const maxHeight = Math.min(300, rawSpace - 8);
52
121
  if (teleportTarget.value === "body" || teleportTarget.value === void 0) {
53
122
  dropdownRect.value = {
54
- top: rect.bottom + window.scrollY,
55
- left: rect.left + window.scrollX,
56
- right: document.documentElement.clientWidth - rect.right + window.scrollX,
57
- width: rect.width
123
+ top: rect.bottom,
124
+ left: rect.left,
125
+ right: document.documentElement.clientWidth - rect.right,
126
+ bottom: document.documentElement.clientHeight - rect.top,
127
+ width: rect.width,
128
+ height: rect.height,
129
+ maxHeight,
130
+ resolvedDirection: resolvedDir,
131
+ resolvedAlign: resolvedAl
58
132
  };
59
133
  } else {
60
134
  const portalEl = document.querySelector(teleportTarget.value);
61
- const portalRect = portalEl ? portalEl.getBoundingClientRect() : { top: 0, left: 0 };
62
- const portalWidth = portalEl ? portalEl.clientWidth : document.documentElement.clientWidth;
135
+ const portalRect = portalEl ? portalEl.getBoundingClientRect() : { top: 0, left: 0, bottom: 0, right: 0 };
136
+ const portalWidth = portalEl ? portalEl.clientWidth : viewportWidth;
137
+ const portalHeight = portalEl ? portalEl.clientHeight : viewportHeight;
63
138
  dropdownRect.value = {
64
139
  top: rect.bottom - portalRect.top,
65
140
  left: rect.left - portalRect.left,
66
141
  right: portalWidth - (rect.right - portalRect.left),
67
- width: rect.width
142
+ bottom: portalHeight - (rect.top - portalRect.top),
143
+ width: rect.width,
144
+ height: rect.height,
145
+ maxHeight,
146
+ resolvedDirection: resolvedDir,
147
+ resolvedAlign: resolvedAl
68
148
  };
69
149
  }
70
150
  }
@@ -73,7 +153,7 @@ export function useKDropdownLogic(props, emit) {
73
153
  console.error("[KDropdown] Failed to update position", e);
74
154
  }
75
155
  };
76
- const onScrollResize = () => {
156
+ const repositionOnScroll = () => {
77
157
  if (open.value) {
78
158
  updatePosition();
79
159
  }
@@ -101,12 +181,10 @@ export function useKDropdownLogic(props, emit) {
101
181
  }
102
182
  );
103
183
  onMounted(() => {
104
- window.addEventListener("scroll", onScrollResize, true);
105
- window.addEventListener("resize", onScrollResize);
184
+ window.addEventListener("scroll", repositionOnScroll, true);
106
185
  });
107
186
  onUnmounted(() => {
108
- window.removeEventListener("scroll", onScrollResize, true);
109
- window.removeEventListener("resize", onScrollResize);
187
+ window.removeEventListener("scroll", repositionOnScroll, true);
110
188
  });
111
189
  return {
112
190
  open,
@@ -1,8 +1,8 @@
1
1
  import { type KGridProps } from './KGrid.logic.js';
2
2
  declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
3
3
  align: "start" | "center" | "end" | "stretch" | "baseline";
4
- wrap: "wrap" | "nowrap";
5
4
  direction: "row" | "column";
5
+ wrap: "wrap" | "nowrap";
6
6
  flexChild: boolean;
7
7
  justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
8
8
  noGap: boolean;
@@ -1,8 +1,8 @@
1
1
  import { type KGridProps } from './KGrid.logic.js';
2
2
  declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
3
3
  align: "start" | "center" | "end" | "stretch" | "baseline";
4
- wrap: "wrap" | "nowrap";
5
4
  direction: "row" | "column";
5
+ wrap: "wrap" | "nowrap";
6
6
  flexChild: boolean;
7
7
  justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
8
8
  noGap: boolean;
@@ -34,8 +34,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
34
34
  };
35
35
  }>> & Readonly<{}>, {
36
36
  width: string | number;
37
- rotate: string | number;
38
37
  height: string | number;
38
+ rotate: string | number;
39
39
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
40
40
  declare const _default: typeof __VLS_export;
41
41
  export default _default;
@@ -34,8 +34,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
34
34
  };
35
35
  }>> & Readonly<{}>, {
36
36
  width: string | number;
37
- rotate: string | number;
38
37
  height: string | number;
38
+ rotate: string | number;
39
39
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
40
40
  declare const _default: typeof __VLS_export;
41
41
  export default _default;
@@ -156,6 +156,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
156
156
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
157
157
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
158
158
  }>, {
159
+ parentKey: string;
160
+ idKey: string;
159
161
  disabled: boolean;
160
162
  loading: boolean;
161
163
  validation: "error" | "success" | "warning" | null | undefined;
@@ -170,8 +172,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
170
172
  multiSelect: boolean;
171
173
  valueField: string;
172
174
  iconField: string;
173
- idKey: string;
174
- parentKey: string;
175
175
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
176
176
  declare const _default: typeof __VLS_export;
177
177
  export default _default;
@@ -156,6 +156,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
156
156
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
157
157
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
158
158
  }>, {
159
+ parentKey: string;
160
+ idKey: string;
159
161
  disabled: boolean;
160
162
  loading: boolean;
161
163
  validation: "error" | "success" | "warning" | null | undefined;
@@ -170,8 +172,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
170
172
  multiSelect: boolean;
171
173
  valueField: string;
172
174
  iconField: string;
173
- idKey: string;
174
- parentKey: string;
175
175
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
176
176
  declare const _default: typeof __VLS_export;
177
177
  export default _default;
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  default: () => {};
82
82
  };
83
83
  }>> & Readonly<{}>, {
84
+ parentKey: string;
85
+ idKey: string;
86
+ expandedByDefault: boolean;
84
87
  bulkActions: import("@katlux/providers").IKDatatableAction[];
85
88
  rowActions: import("./KTreeView.logic.js").IRowAction[];
86
89
  cellSlots: Record<string, any>;
87
90
  headerSlots: Record<string, any>;
88
91
  treeColumnIndex: number;
89
- idKey: string;
90
- parentKey: string;
91
- expandedByDefault: boolean;
92
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
93
93
  declare const _default: typeof __VLS_export;
94
94
  export default _default;
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
81
81
  default: () => {};
82
82
  };
83
83
  }>> & Readonly<{}>, {
84
+ parentKey: string;
85
+ idKey: string;
86
+ expandedByDefault: boolean;
84
87
  bulkActions: import("@katlux/providers").IKDatatableAction[];
85
88
  rowActions: import("./KTreeView.logic.js").IRowAction[];
86
89
  cellSlots: Record<string, any>;
87
90
  headerSlots: Record<string, any>;
88
91
  treeColumnIndex: number;
89
- idKey: string;
90
- parentKey: string;
91
- expandedByDefault: boolean;
92
92
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
93
93
  declare const _default: typeof __VLS_export;
94
94
  export default _default;
@@ -45,7 +45,6 @@ const searchtextModel = computed({
45
45
  margin: -var(--grid-gap);
46
46
  }
47
47
  &-list {
48
- max-height: 500px;
49
48
  overflow-y: auto;
50
49
  &-item {
51
50
  cursor: pointer;
@@ -6,12 +6,18 @@ type __VLS_Props = {
6
6
  top: number;
7
7
  left: number;
8
8
  right: number;
9
+ bottom: number;
9
10
  width: number;
11
+ height: number;
12
+ maxHeight: number;
13
+ resolvedDirection: 'top' | 'bottom' | 'left' | 'right';
14
+ resolvedAlign: 'left' | 'right' | 'top' | 'bottom';
10
15
  };
11
16
  clickoutside: () => void;
12
17
  teleportTarget: string | null;
13
18
  isInModal: boolean;
14
- align?: 'left' | 'right';
19
+ align?: string;
20
+ direction?: string;
15
21
  };
16
22
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
23
  declare const _default: typeof __VLS_export;
@@ -3,7 +3,7 @@
3
3
  Teleport(v-if="isMounted && open && teleportTarget" :to="teleportTarget")
4
4
  .KDropdown-teleported
5
5
  .KDropdown(v-click-outside="{ handler: clickoutside, extraInside: anchorEl }" :style="dialogStyle" v-bind="$attrs")
6
- KPanel.KDropdown-container(:class="{'fullWidth': fullWidth}")
6
+ KPanel.KDropdown-container(:class="{'fullWidth': fullWidth}" :style="contentStyle")
7
7
  slot
8
8
  </template>
9
9
 
@@ -18,11 +18,22 @@ const props = defineProps<{
18
18
  open: boolean
19
19
  fullWidth: boolean
20
20
  anchorEl?: HTMLElement
21
- dropdownRect: { top: number, left: number, right: number, width: number }
21
+ dropdownRect: {
22
+ top: number
23
+ left: number
24
+ right: number
25
+ bottom: number
26
+ width: number
27
+ height: number
28
+ maxHeight: number
29
+ resolvedDirection: 'top' | 'bottom' | 'left' | 'right'
30
+ resolvedAlign: 'left' | 'right' | 'top' | 'bottom'
31
+ }
22
32
  clickoutside: () => void
23
33
  teleportTarget: string | null
24
34
  isInModal: boolean
25
- align?: 'left' | 'right'
35
+ align?: string
36
+ direction?: string
26
37
  }>()
27
38
 
28
39
  const isMounted = ref(false)
@@ -31,22 +42,52 @@ onMounted(() => {
31
42
  })
32
43
 
33
44
  const dialogStyle = computed(() => {
34
- const style: any = {
35
- position: 'absolute',
36
- top: `${props.dropdownRect.top}px`,
37
- width: props.fullWidth ? 'fit-content' : 'fit-content',
38
- minWidth: props.fullWidth ? `${props.dropdownRect.width}px` : 'auto',
39
- zIndex: 2000
45
+ const { top, left, right, bottom, width, resolvedDirection, resolvedAlign } = props.dropdownRect
46
+ const style: Record<string, string> = {
47
+ position: 'fixed',
48
+ zIndex: '2000',
49
+ width: 'fit-content',
50
+ minWidth: props.fullWidth ? `${width}px` : 'auto',
40
51
  }
41
52
 
42
- if (props.align === 'right') {
43
- style.right = `${props.dropdownRect.right}px`
44
- } else {
45
- style.left = `${props.dropdownRect.left}px`
53
+ if (resolvedDirection === 'bottom') {
54
+ style.top = `${top}px`
55
+ if (resolvedAlign === 'right') {
56
+ style.right = `${right}px`
57
+ } else {
58
+ style.left = `${left}px`
59
+ }
60
+ } else if (resolvedDirection === 'top') {
61
+ style.bottom = `${bottom}px`
62
+ if (resolvedAlign === 'right') {
63
+ style.right = `${right}px`
64
+ } else {
65
+ style.left = `${left}px`
66
+ }
67
+ } else if (resolvedDirection === 'right') {
68
+ style.left = `${left + width}px`
69
+ if (resolvedAlign === 'bottom') {
70
+ style.bottom = `${bottom}px`
71
+ } else {
72
+ style.top = `${top - props.dropdownRect.height}px`
73
+ }
74
+ } else if (resolvedDirection === 'left') {
75
+ style.right = `${right + width}px`
76
+ if (resolvedAlign === 'bottom') {
77
+ style.bottom = `${bottom}px`
78
+ } else {
79
+ style.top = `${top - props.dropdownRect.height}px`
80
+ }
46
81
  }
47
82
 
48
83
  return style
49
84
  })
85
+
86
+ // Applied to the KPanel content so the dropdown list can scroll inside
87
+ const contentStyle = computed(() => ({
88
+ maxHeight: `${props.dropdownRect.maxHeight}px`,
89
+ overflowY: 'auto',
90
+ }))
50
91
  </script>
51
92
 
52
93
  <style lang="scss" scoped>
@@ -55,9 +96,11 @@ const dialogStyle = computed(() => {
55
96
  width: auto !important;
56
97
  max-width: 100vw;
57
98
  box-shadow: var(--shadow-xl);
99
+ overflow: hidden;
58
100
  :deep {
59
101
  .KPanel--content {
60
102
  padding: var(--component-gap);
103
+ overflow-y: auto;
61
104
  }
62
105
  }
63
106
  }
@@ -6,12 +6,18 @@ type __VLS_Props = {
6
6
  top: number;
7
7
  left: number;
8
8
  right: number;
9
+ bottom: number;
9
10
  width: number;
11
+ height: number;
12
+ maxHeight: number;
13
+ resolvedDirection: 'top' | 'bottom' | 'left' | 'right';
14
+ resolvedAlign: 'left' | 'right' | 'top' | 'bottom';
10
15
  };
11
16
  clickoutside: () => void;
12
17
  teleportTarget: string | null;
13
18
  isInModal: boolean;
14
- align?: 'left' | 'right';
19
+ align?: string;
20
+ direction?: string;
15
21
  };
16
22
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
23
  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.72",
3
+ "version": "0.1.0-beta.73",
4
4
  "description": "Core UI toolkit and utilities for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "MIT",