@katlux/toolkit 0.1.0-beta.84 → 0.1.1-alpha.100
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/README.md +9 -4
- package/bin/add-ai-reference.mjs +84 -0
- package/dist/compiled/composables/locales.mjs +554 -0
- package/dist/compiled/composables/useKatluxI18n.mjs +56 -0
- package/dist/compiled/composables/useKatluxI18n.spec.mjs +10 -0
- package/dist/compiled/composables/usePresetComponent.mjs +22 -13
- package/dist/module.cjs +70 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +71 -2
- package/dist/runtime/app.config.d.ts +2 -1
- package/dist/runtime/components/KAccordion/KAccordion.logic.d.ts +5 -1
- package/dist/runtime/components/KAccordion/KAccordion.logic.js +11 -4
- package/dist/runtime/components/KAlert/KAlert.global.d.vue.ts +10 -1
- package/dist/runtime/components/KAlert/KAlert.global.vue +9 -1
- package/dist/runtime/components/KAlert/KAlert.global.vue.d.ts +10 -1
- package/dist/runtime/components/KAlert/KAlert.logic.d.ts +10 -2
- package/dist/runtime/components/KAlert/KAlert.logic.js +18 -3
- package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
- package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCalendar/KCalendar.global.vue +5 -0
- package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +3 -1
- package/dist/runtime/components/KCalendar/KCalendar.logic.js +37 -10
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +3 -3
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +3 -3
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +1 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +7 -7
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +7 -7
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
- package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +1 -1
- package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +6 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +6 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +6 -6
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +6 -6
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +2 -2
- package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +9 -9
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +9 -9
- package/dist/runtime/components/KGantt/KGantt.logic.d.ts +4 -4
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +6 -6
- package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +6 -6
- package/dist/runtime/components/KIcon/KIcon.logic.d.ts +3 -3
- package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +1 -1
- package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KModal/KModal.logic.js +4 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +1 -1
- package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTabs/KTabs.logic.js +12 -5
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KToast/KToast.global.d.vue.ts +1 -1
- package/dist/runtime/components/KToast/KToast.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +3 -3
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +3 -3
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +3 -3
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +3 -3
- package/dist/runtime/composables/locales.d.ts +28 -0
- package/dist/runtime/composables/locales.js +554 -0
- package/dist/runtime/composables/useKatluxI18n.d.ts +15 -0
- package/dist/runtime/composables/useKatluxI18n.js +56 -0
- package/dist/runtime/composables/usePresetComponent.d.ts +3 -8
- package/dist/runtime/composables/usePresetComponent.js +22 -13
- package/dist/runtime/plugins/PresetPlugin.d.ts +2 -3
- package/dist/runtime/plugins/PresetPlugin.js +11 -15
- package/dist/runtime/presets/default/components/KAccordion/KAccordionItem.vue +18 -1
- package/dist/runtime/presets/default/components/KAlert/KAlert.d.vue.ts +6 -1
- package/dist/runtime/presets/default/components/KAlert/KAlert.vue +112 -3
- package/dist/runtime/presets/default/components/KAlert/KAlert.vue.d.ts +6 -1
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +6 -3
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +17 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.d.vue.ts +8 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +302 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue.d.ts +8 -1
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +15 -3
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +12 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +7 -0
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +7 -4
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +7 -2
- package/dist/runtime/presets/default/components/KModal/KModal.vue +4 -1
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue +16 -6
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +15 -3
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +9 -3
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +4 -1
- package/dist/runtime/presets/default/components/KTree/KTree.vue +13 -1
- package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue +5 -1
- package/package.json +7 -2
- package/dist/runtime/components/KSearchTree/KSearchTree.global.d.vue.ts +0 -3
- package/dist/runtime/components/KSearchTree/KSearchTree.global.vue +0 -9
- package/dist/runtime/components/KSearchTree/KSearchTree.global.vue.d.ts +0 -3
- package/dist/runtime/components/KSearchTree/KSearchTree.logic.d.ts +0 -10
- package/dist/runtime/components/KSearchTree/KSearchTree.logic.js +0 -9
- package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.d.vue.ts +0 -3
- package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.vue +0 -9
- package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.vue.d.ts +0 -3
- package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.d.ts +0 -10
- package/dist/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.js +0 -9
- package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.d.vue.ts +0 -6
- package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue +0 -13
- package/dist/runtime/presets/default/components/KSearchTree/KSearchTree.vue.d.ts +0 -6
- package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.d.vue.ts +0 -6
- package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue +0 -13
- package/dist/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue.d.ts +0 -6
|
@@ -1,5 +1,305 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KCalendarWeek
|
|
3
|
-
//
|
|
3
|
+
// Left fixed time column
|
|
4
|
+
.time-column-wrapper
|
|
5
|
+
.time-header-space
|
|
6
|
+
.time-slots-container(ref="timeContainerRef")
|
|
7
|
+
.time-slot(v-for="hour in 24" :key="hour")
|
|
8
|
+
span {{ formatHour(hour - 1) }}
|
|
9
|
+
|
|
10
|
+
// Right days schedule column
|
|
11
|
+
.days-scroll-body(@scroll="handleScroll")
|
|
12
|
+
.week-headers
|
|
13
|
+
.day-header(v-for="(dayName, i) in weekDays" :key="i")
|
|
14
|
+
.day-name {{ dayName }}
|
|
15
|
+
.day-date(
|
|
16
|
+
:class="{ today: isToday(weekDates[i]), selected: isSelected(weekDates[i]) }"
|
|
17
|
+
@click="dayClicked(weekDates[i])"
|
|
18
|
+
) {{ weekDates[i].getDate() }}
|
|
19
|
+
|
|
20
|
+
.days-grid
|
|
21
|
+
.day-column(v-for="(date, dayIdx) in weekDates" :key="dayIdx")
|
|
22
|
+
.hour-cell(
|
|
23
|
+
v-for="hour in 24"
|
|
24
|
+
:key="hour"
|
|
25
|
+
@click="cellClicked(date, hour - 1)"
|
|
26
|
+
)
|
|
27
|
+
// Render events for this day & hour
|
|
28
|
+
.event-tag(
|
|
29
|
+
v-for="(evt, evtIdx) in getEventsForSlot(date, hour - 1)"
|
|
30
|
+
:key="evtIdx"
|
|
31
|
+
:class="evt.type || 'info'"
|
|
32
|
+
:title="evt.description || evt.label"
|
|
33
|
+
) {{ evt.label }}
|
|
4
34
|
</template>
|
|
5
|
-
|
|
35
|
+
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import { computed, ref } from 'vue'
|
|
38
|
+
import type { IMarkedDay } from '../../../../components/KCalendar/types'
|
|
39
|
+
|
|
40
|
+
const timeContainerRef = ref<HTMLElement | null>(null)
|
|
41
|
+
|
|
42
|
+
function handleScroll(e: Event) {
|
|
43
|
+
const target = e.target as HTMLElement
|
|
44
|
+
if (timeContainerRef.value && target) {
|
|
45
|
+
timeContainerRef.value.scrollTop = target.scrollTop
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const props = defineProps<{
|
|
50
|
+
currentDate?: Date | string
|
|
51
|
+
selectedDay?: Date | string
|
|
52
|
+
markedDays?: IMarkedDay[]
|
|
53
|
+
dayClicked: (date: Date) => void
|
|
54
|
+
}>()
|
|
55
|
+
|
|
56
|
+
const weekDays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
57
|
+
|
|
58
|
+
const baseDate = computed(() => {
|
|
59
|
+
if (!props.currentDate) return new Date()
|
|
60
|
+
return typeof props.currentDate === 'string' ? new Date(props.currentDate) : props.currentDate
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const weekDates = computed(() => {
|
|
64
|
+
const curr = new Date(baseDate.value)
|
|
65
|
+
const dayOfWeek = curr.getDay()
|
|
66
|
+
const distanceToMon = (dayOfWeek + 6) % 7
|
|
67
|
+
const monday = new Date(curr)
|
|
68
|
+
monday.setDate(curr.getDate() - distanceToMon)
|
|
69
|
+
|
|
70
|
+
const dates: Date[] = []
|
|
71
|
+
for (let i = 0; i < 7; i++) {
|
|
72
|
+
const d = new Date(monday)
|
|
73
|
+
d.setDate(monday.getDate() + i)
|
|
74
|
+
dates.push(d)
|
|
75
|
+
}
|
|
76
|
+
return dates
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
function formatHour(h: number) {
|
|
80
|
+
return `${h.toString().padStart(2, '0')}:00`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function isToday(date: Date) {
|
|
84
|
+
const today = new Date()
|
|
85
|
+
return (
|
|
86
|
+
date.getDate() === today.getDate() &&
|
|
87
|
+
date.getMonth() === today.getMonth() &&
|
|
88
|
+
date.getFullYear() === today.getFullYear()
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function isSelected(date: Date) {
|
|
93
|
+
if (!props.selectedDay) return false
|
|
94
|
+
const sel = typeof props.selectedDay === 'string' ? new Date(props.selectedDay) : props.selectedDay
|
|
95
|
+
return (
|
|
96
|
+
date.getDate() === sel.getDate() &&
|
|
97
|
+
date.getMonth() === sel.getMonth() &&
|
|
98
|
+
date.getFullYear() === sel.getFullYear()
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function cellClicked(date: Date, hour: number) {
|
|
103
|
+
const slotDate = new Date(date)
|
|
104
|
+
slotDate.setHours(hour, 0, 0, 0)
|
|
105
|
+
props.dayClicked(slotDate)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function getEventsForSlot(date: Date, hour: number): IMarkedDay[] {
|
|
109
|
+
if (!props.markedDays) return []
|
|
110
|
+
return props.markedDays.filter(evt => {
|
|
111
|
+
if (!evt.date) return false
|
|
112
|
+
let evtDate: Date | null = null
|
|
113
|
+
|
|
114
|
+
// 1. Direct JS Date or Date string / ISO
|
|
115
|
+
if (evt.date instanceof Date) {
|
|
116
|
+
evtDate = evt.date
|
|
117
|
+
} else if (typeof evt.date === 'string') {
|
|
118
|
+
evtDate = new Date(evt.date)
|
|
119
|
+
} else if ((evt.date as any).startDate) {
|
|
120
|
+
evtDate = new Date((evt.date as any).startDate)
|
|
121
|
+
} else if ((evt.date as any).recurringRules) {
|
|
122
|
+
// Recurring rule support: check if recurring rule lands on this date
|
|
123
|
+
const rules = (evt.date as any).recurringRules
|
|
124
|
+
for (const r of rules) {
|
|
125
|
+
if (r.daysOfYear) {
|
|
126
|
+
for (const doy of r.daysOfYear) {
|
|
127
|
+
if (doy.month === (date.getMonth() + 1) && doy.day === date.getDate()) {
|
|
128
|
+
evtDate = date
|
|
129
|
+
break
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
} else if (r.daysOfWeek) {
|
|
133
|
+
const dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
|
134
|
+
if (r.daysOfWeek.includes(dayNames[date.getDay()])) {
|
|
135
|
+
evtDate = date
|
|
136
|
+
break
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!evtDate || isNaN(evtDate.getTime())) return false
|
|
143
|
+
|
|
144
|
+
const sameDay =
|
|
145
|
+
evtDate.getDate() === date.getDate() &&
|
|
146
|
+
evtDate.getMonth() === date.getMonth() &&
|
|
147
|
+
evtDate.getFullYear() === date.getFullYear()
|
|
148
|
+
|
|
149
|
+
if (!sameDay) return false
|
|
150
|
+
|
|
151
|
+
// Default to 9 AM slot if no specific hour was assigned to the event
|
|
152
|
+
const evtHour = (evt as any).hour ?? (evtDate.getHours() !== 0 ? evtDate.getHours() : 9)
|
|
153
|
+
return evtHour === hour
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<style lang="scss" scoped>
|
|
159
|
+
.KCalendarWeek {
|
|
160
|
+
width: 540px;
|
|
161
|
+
border: 1px solid var(--border-color-light, #e5e7eb);
|
|
162
|
+
border-radius: var(--border-radius-md, 8px);
|
|
163
|
+
background: var(--panel-bg-default, #ffffff);
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
box-sizing: border-box;
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: row;
|
|
168
|
+
|
|
169
|
+
.time-column-wrapper {
|
|
170
|
+
width: 50px;
|
|
171
|
+
flex-shrink: 0;
|
|
172
|
+
border-right: 1px solid var(--border-color-light, #e5e7eb);
|
|
173
|
+
background: var(--neutral-50, #f9fafb);
|
|
174
|
+
|
|
175
|
+
.time-header-space {
|
|
176
|
+
height: 52px;
|
|
177
|
+
border-bottom: 1px solid var(--border-color-light, #e5e7eb);
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.time-slots-container {
|
|
182
|
+
height: 340px;
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
|
|
185
|
+
.time-slot {
|
|
186
|
+
height: 36px;
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: flex-start;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
padding-top: 2px;
|
|
191
|
+
font-size: 10px;
|
|
192
|
+
color: var(--font-color-secondary, #6b7280);
|
|
193
|
+
border-bottom: 1px solid var(--border-color-light, #e5e7eb);
|
|
194
|
+
box-sizing: border-box;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.days-scroll-body {
|
|
200
|
+
flex: 1;
|
|
201
|
+
height: 392px;
|
|
202
|
+
overflow-y: scroll;
|
|
203
|
+
min-width: 0;
|
|
204
|
+
|
|
205
|
+
&::-webkit-scrollbar {
|
|
206
|
+
width: 6px;
|
|
207
|
+
}
|
|
208
|
+
&::-webkit-scrollbar-track {
|
|
209
|
+
background: var(--neutral-50, #f9fafb);
|
|
210
|
+
}
|
|
211
|
+
&::-webkit-scrollbar-thumb {
|
|
212
|
+
background: var(--neutral-300, #d1d5db);
|
|
213
|
+
border-radius: 3px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.week-headers {
|
|
217
|
+
position: sticky;
|
|
218
|
+
top: 0;
|
|
219
|
+
z-index: 10;
|
|
220
|
+
display: grid;
|
|
221
|
+
grid-template-columns: repeat(7, 1fr);
|
|
222
|
+
border-bottom: 1px solid var(--border-color-light, #e5e7eb);
|
|
223
|
+
background: var(--neutral-50, #f9fafb);
|
|
224
|
+
height: 52px;
|
|
225
|
+
box-sizing: border-box;
|
|
226
|
+
|
|
227
|
+
.day-header {
|
|
228
|
+
text-align: center;
|
|
229
|
+
padding: 6px 2px;
|
|
230
|
+
border-right: 1px solid var(--border-color-light, #e5e7eb);
|
|
231
|
+
box-sizing: border-box;
|
|
232
|
+
&:last-child { border-right: none; }
|
|
233
|
+
|
|
234
|
+
.day-name {
|
|
235
|
+
font-size: 11px;
|
|
236
|
+
color: var(--font-color-secondary, #6b7280);
|
|
237
|
+
font-weight: 500;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.day-date {
|
|
241
|
+
width: 24px;
|
|
242
|
+
height: 24px;
|
|
243
|
+
margin: 2px auto 0 auto;
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
justify-content: center;
|
|
247
|
+
border-radius: 50%;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
font-size: 12px;
|
|
250
|
+
font-weight: 600;
|
|
251
|
+
|
|
252
|
+
&.today { border: 2px solid var(--primary-500, #3b82f6); }
|
|
253
|
+
&.selected { background: var(--primary-500, #3b82f6); color: #fff; }
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.days-grid {
|
|
259
|
+
display: grid;
|
|
260
|
+
grid-template-columns: repeat(7, 1fr);
|
|
261
|
+
|
|
262
|
+
.day-column {
|
|
263
|
+
border-right: 1px solid var(--border-color-light, #e5e7eb);
|
|
264
|
+
box-sizing: border-box;
|
|
265
|
+
&:last-child { border-right: none; }
|
|
266
|
+
|
|
267
|
+
.hour-cell {
|
|
268
|
+
height: 36px;
|
|
269
|
+
border-bottom: 1px solid var(--border-color-light, #f3f4f6);
|
|
270
|
+
box-sizing: border-box;
|
|
271
|
+
padding: 1px;
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
position: relative;
|
|
274
|
+
transition: background 0.15s ease;
|
|
275
|
+
|
|
276
|
+
&:hover {
|
|
277
|
+
background: var(--neutral-100, #f3f4f6);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.event-tag {
|
|
281
|
+
font-size: 9px;
|
|
282
|
+
line-height: 1.1;
|
|
283
|
+
padding: 2px 3px;
|
|
284
|
+
border-radius: 3px;
|
|
285
|
+
white-space: nowrap;
|
|
286
|
+
overflow: hidden;
|
|
287
|
+
text-overflow: ellipsis;
|
|
288
|
+
color: #fff;
|
|
289
|
+
background: var(--primary-500, #3b82f6);
|
|
290
|
+
position: absolute;
|
|
291
|
+
inset: 1px;
|
|
292
|
+
z-index: 2;
|
|
293
|
+
display: flex;
|
|
294
|
+
align-items: center;
|
|
295
|
+
|
|
296
|
+
&.warning { background: var(--warning-color, #eab308); color: #000; }
|
|
297
|
+
&.error { background: var(--error-color, #ef4444); }
|
|
298
|
+
&.success { background: var(--success-color, #22c55e); }
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
</style>
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IMarkedDay } from '../../../../components/KCalendar/types.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
currentDate?: Date | string;
|
|
4
|
+
selectedDay?: Date | string;
|
|
5
|
+
markedDays?: IMarkedDay[];
|
|
6
|
+
dayClicked: (date: Date) => void;
|
|
7
|
+
};
|
|
8
|
+
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>;
|
|
2
9
|
declare const _default: typeof __VLS_export;
|
|
3
10
|
export default _default;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KCheckbox-wrapper
|
|
3
|
-
label.KCheckbox
|
|
4
|
-
|
|
3
|
+
label.KCheckbox(
|
|
4
|
+
role="checkbox"
|
|
5
|
+
:aria-checked="!!internalModel"
|
|
6
|
+
:aria-disabled="isDisabled"
|
|
7
|
+
tabindex="0"
|
|
8
|
+
@keydown.space.prevent="internalModel = !internalModel"
|
|
9
|
+
)
|
|
10
|
+
input(type="checkbox" v-model="internalModel" :value="checkboxValue" :disabled="isDisabled" tabindex="-1")
|
|
5
11
|
.icon-container(:class="validation ? `is-${validation}` : ''")
|
|
6
12
|
KIcon.icon(iconname="check")
|
|
7
13
|
span
|
|
@@ -41,7 +47,13 @@ const internalModel = computed({
|
|
|
41
47
|
cursor: pointer;
|
|
42
48
|
|
|
43
49
|
input {
|
|
44
|
-
|
|
50
|
+
position: absolute;
|
|
51
|
+
opacity: 0;
|
|
52
|
+
width: 1px;
|
|
53
|
+
height: 1px;
|
|
54
|
+
margin: -1px;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
clip: rect(0, 0, 0, 0);
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
.icon-container {
|
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
.KCombobox-wrapper
|
|
3
3
|
label.k-input-label(v-if="label") {{ label }}
|
|
4
4
|
.KCombobox(ref="activatorRef" :class="{ disabled: disabled, open: isOptionsOpen, ... (validation ? { [`is-${validation}`]: true } : {}) }")
|
|
5
|
-
KGrid(
|
|
5
|
+
KGrid(
|
|
6
|
+
@click.stop="toggleDropdown"
|
|
7
|
+
@keydown.enter.prevent="toggleDropdown"
|
|
8
|
+
@keydown.space.prevent="toggleDropdown"
|
|
9
|
+
@keydown.escape.prevent="closeDropdown"
|
|
10
|
+
role="combobox"
|
|
11
|
+
:aria-expanded="isOptionsOpen"
|
|
12
|
+
aria-haspopup="listbox"
|
|
13
|
+
tabindex="0"
|
|
14
|
+
align="center"
|
|
15
|
+
justify="space-between"
|
|
16
|
+
).KCombobox__selected-content-container
|
|
6
17
|
KGrid(align="center" wrap="no-wrap").KCombobox__selected-content
|
|
7
18
|
.KCombobox__selected-content-item(
|
|
8
19
|
v-if="getSelectedContent().length>0"
|
|
@@ -43,9 +43,16 @@ const searchtextModel = computed({
|
|
|
43
43
|
.KCombobox__options {
|
|
44
44
|
&-content {
|
|
45
45
|
margin: -var(--grid-gap);
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
min-height: 0;
|
|
49
|
+
flex: 1;
|
|
50
|
+
overflow: hidden;
|
|
46
51
|
}
|
|
47
52
|
&-list {
|
|
48
53
|
overflow-y: auto;
|
|
54
|
+
flex: 1;
|
|
55
|
+
min-height: 0;
|
|
49
56
|
&-item {
|
|
50
57
|
cursor: pointer;
|
|
51
58
|
height: 40px;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.k-datatable(:style="{ '--page-size': props.dataProvider?.pageSize?.value || 10 }")
|
|
2
|
+
.k-datatable(:style="{ '--page-size': props.dataProvider?.pageSize?.value || 10 }" role="region" :aria-label="t('Data Table')")
|
|
3
3
|
KGrid(:flex-child="true" align="stretch" direction="column")
|
|
4
4
|
.datatable-container
|
|
5
5
|
KLoader(:loading="isLoading" overlay)
|
|
6
|
-
table
|
|
6
|
+
table(role="grid" :aria-busy="isLoading")
|
|
7
7
|
thead
|
|
8
8
|
tr
|
|
9
9
|
th.check(v-if="props.bulkActions && props.bulkActions.length>0")
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
tbody
|
|
22
22
|
tr.empty-row(v-if="!isLoading && (!props.dataProvider.pageData.value || props.dataProvider.pageData.value.length === 0)")
|
|
23
23
|
td.empty-state(:colspan="(visibleFields || props.dataProvider.fields || []).length + (props.bulkActions && props.bulkActions.length > 0 ? 1 : 0) + (props.rowActions && props.rowActions.length > 0 ? 1 : 0)")
|
|
24
|
-
span(v-if="props.dataProvider.filter.value?.active") {{ props.emptyFilterStateText || '
|
|
25
|
-
span(v-else) {{ props.emptyStateText || '
|
|
24
|
+
span(v-if="props.dataProvider.filter.value?.active") {{ props.emptyFilterStateText || t('No result found for filter') }}
|
|
25
|
+
span(v-else) {{ props.emptyStateText || t('No result') }}
|
|
26
26
|
tr(v-for="(row, index) in props.dataProvider.pageData.value" :key="index")
|
|
27
27
|
td.check(v-if="props.bulkActions && props.bulkActions.length>0")
|
|
28
28
|
KCheckbox(:value="row" v-model="selectedRows")
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
import { computed } from 'vue'
|
|
60
60
|
import { ADataProvider } from '@katlux/providers'
|
|
61
61
|
import type { IKDatatableAction } from '@katlux/providers'
|
|
62
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
63
|
+
|
|
64
|
+
const { t } = useKatluxI18n()
|
|
62
65
|
|
|
63
66
|
const props = defineProps<{
|
|
64
67
|
dataProvider: ADataProvider
|
|
@@ -86,7 +86,9 @@ const dialogStyle = computed(() => {
|
|
|
86
86
|
// Applied to the KPanel content so the dropdown list can scroll inside
|
|
87
87
|
const contentStyle = computed(() => ({
|
|
88
88
|
maxHeight: `${props.dropdownRect.maxHeight}px`,
|
|
89
|
-
|
|
89
|
+
overflow: 'hidden',
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'column',
|
|
90
92
|
}))
|
|
91
93
|
</script>
|
|
92
94
|
|
|
@@ -102,9 +104,12 @@ const contentStyle = computed(() => ({
|
|
|
102
104
|
:deep {
|
|
103
105
|
.KPanel--content {
|
|
104
106
|
padding: var(--component-gap);
|
|
105
|
-
overflow-y: auto;
|
|
106
107
|
background-color: var(--panel-bg-default);
|
|
107
108
|
color: var(--font-color-primary);
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
min-height: 0;
|
|
112
|
+
flex: 1;
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
dialog.k-modal(ref="dialogRef" @close="closeModal" @click="handleBackdropClick" @mousedown="handleMouseDown")
|
|
2
|
+
dialog.k-modal(ref="dialogRef" @close="closeModal" @click="handleBackdropClick" @mousedown="handleMouseDown" role="dialog" aria-modal="true" :aria-label="t('Dialog Window')")
|
|
3
3
|
.modal-portal(:id="modalId" style="position: absolute; top: 0; left: 0; z-index: 9999; pointer-events: none;")
|
|
4
4
|
KPanel(no-gap flex-content scrollable).modal-container
|
|
5
5
|
template(#header)
|
|
@@ -11,6 +11,9 @@ dialog.k-modal(ref="dialogRef" @close="closeModal" @click="handleBackdropClick"
|
|
|
11
11
|
|
|
12
12
|
<script lang="ts" setup>
|
|
13
13
|
import { ref, watch, onMounted } from 'vue'
|
|
14
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
15
|
+
|
|
16
|
+
const { t } = useKatluxI18n()
|
|
14
17
|
|
|
15
18
|
const props = defineProps<{
|
|
16
19
|
modalId: string
|
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.k-pagination(v-if="totalPages > 1")
|
|
2
|
+
nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
|
|
3
3
|
ul
|
|
4
4
|
li(v-if="showPrevButton")
|
|
5
|
-
KButton(@click="goToPrev" :href="getPageHref(dp.currentPage.value - 1)" size="small" variant="outline") ‹
|
|
5
|
+
KButton(@click="goToPrev" :href="getPageHref(dp.currentPage.value - 1)" size="small" variant="outline" :aria-label="t('Previous Page')") ‹
|
|
6
6
|
|
|
7
7
|
li(v-if="showFirstEllipsis")
|
|
8
|
-
KButton(@click="goToFirst" :href="getPageHref(1)" size="small" variant="outline") 1
|
|
8
|
+
KButton(@click="goToFirst" :href="getPageHref(1)" size="small" variant="outline" :aria-label="t('Go to Page 1')") 1
|
|
9
9
|
|
|
10
10
|
li(v-if="showFirstEllipsis")
|
|
11
11
|
span.ellipsis ...
|
|
12
12
|
|
|
13
13
|
li(v-for="item in visiblePages" :key="item")
|
|
14
|
-
KButton(
|
|
14
|
+
KButton(
|
|
15
|
+
@click="pageClicked(item)"
|
|
16
|
+
:href="getPageHref(item)"
|
|
17
|
+
:class="{'light': item==dp.currentPage.value}"
|
|
18
|
+
size="small"
|
|
19
|
+
:aria-current="item === dp.currentPage.value ? 'page' : undefined"
|
|
20
|
+
:aria-label="t('Page') + ' ' + item"
|
|
21
|
+
) {{item}}
|
|
15
22
|
|
|
16
23
|
li(v-if="showLastEllipsis")
|
|
17
24
|
span.ellipsis ...
|
|
18
25
|
|
|
19
26
|
li(v-if="showLastEllipsis")
|
|
20
|
-
KButton(@click="goToLast" :href="getPageHref(totalPages)" size="small" variant="outline") {{totalPages}}
|
|
27
|
+
KButton(@click="goToLast" :href="getPageHref(totalPages)" size="small" variant="outline" :aria-label="t('Go to Page') + ' ' + totalPages") {{totalPages}}
|
|
21
28
|
|
|
22
29
|
li(v-if="showNextButton")
|
|
23
|
-
KButton(@click="goToNext" :href="getPageHref(dp.currentPage.value + 1)" size="small" variant="outline") ›
|
|
30
|
+
KButton(@click="goToNext" :href="getPageHref(dp.currentPage.value + 1)" size="small" variant="outline" :aria-label="t('Next Page')") ›
|
|
24
31
|
</template>
|
|
25
32
|
|
|
26
33
|
<script setup lang="ts">
|
|
27
34
|
import { computed } from 'vue'
|
|
35
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
36
|
+
|
|
37
|
+
const { t } = useKatluxI18n()
|
|
28
38
|
|
|
29
39
|
const props = defineProps<{
|
|
30
40
|
dp: any
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KRadiobox-wrapper
|
|
3
|
-
label.KRadiobox
|
|
4
|
-
|
|
3
|
+
label.KRadiobox(
|
|
4
|
+
role="radio"
|
|
5
|
+
:aria-checked="model === value"
|
|
6
|
+
:aria-disabled="disabled"
|
|
7
|
+
tabindex="0"
|
|
8
|
+
@keydown.space.prevent="model = value"
|
|
9
|
+
)
|
|
10
|
+
input(type="radio" v-model="model" :disabled="disabled" :value="value" tabindex="-1")
|
|
5
11
|
.icon-container(:class="validation ? `is-${validation}` : ''")
|
|
6
12
|
KIcon.icon(iconname="check")
|
|
7
13
|
span(v-if="$slots.label || $slots.default || label")
|
|
@@ -30,7 +36,13 @@ const model = defineModel()
|
|
|
30
36
|
gap: 5px;
|
|
31
37
|
cursor: pointer;
|
|
32
38
|
input {
|
|
33
|
-
|
|
39
|
+
position: absolute;
|
|
40
|
+
opacity: 0;
|
|
41
|
+
width: 1px;
|
|
42
|
+
height: 1px;
|
|
43
|
+
margin: -1px;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
clip: rect(0, 0, 0, 0);
|
|
34
46
|
}
|
|
35
47
|
.icon-container {
|
|
36
48
|
border: var(--input-border);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
.KTab
|
|
3
3
|
KPanel
|
|
4
4
|
template(#header)
|
|
5
|
-
.k-tabs-nav
|
|
6
|
-
KButton.k-tabs-nav-btn(v-if="hasOverflow" @click="scroll(-1)" size="small") <
|
|
5
|
+
.k-tabs-nav(role="tablist" :aria-label="t('Tab Navigation')")
|
|
6
|
+
KButton.k-tabs-nav-btn(v-if="hasOverflow" @click="scroll(-1)" size="small" :aria-label="t('Scroll left')") <
|
|
7
7
|
.k-tabs-scroll-area(ref="scrollArea")
|
|
8
8
|
KGrid(direction="row" wrap="nowrap")
|
|
9
9
|
KButton.k-tab-btn(
|
|
@@ -12,13 +12,19 @@
|
|
|
12
12
|
@click="toggleItem(index)"
|
|
13
13
|
size="small"
|
|
14
14
|
:disabled="isOpen(index)"
|
|
15
|
+
role="tab"
|
|
16
|
+
:aria-selected="isOpen(index)"
|
|
17
|
+
:tabindex="isOpen(index) ? 0 : -1"
|
|
15
18
|
) {{item.title}}
|
|
16
|
-
KButton.k-tabs-nav-btn(v-if="hasOverflow" @click="scroll(1)" size="small") >
|
|
19
|
+
KButton.k-tabs-nav-btn(v-if="hasOverflow" @click="scroll(1)" size="small" :aria-label="t('Scroll right')") >
|
|
17
20
|
slot
|
|
18
21
|
</template>
|
|
19
22
|
|
|
20
23
|
<script lang="ts" setup>
|
|
21
24
|
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
|
25
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
26
|
+
|
|
27
|
+
const { t } = useKatluxI18n()
|
|
22
28
|
|
|
23
29
|
const props = defineProps<{
|
|
24
30
|
items: any[]
|
|
@@ -3,12 +3,15 @@
|
|
|
3
3
|
label.k-input-label(v-if="label") {{ label }}
|
|
4
4
|
.KTextbox(:class="validation ? `is-${validation}` : ''")
|
|
5
5
|
input(v-bind="inputAttrs" :type="props.type" v-model="text" :placeholder="placeholder")
|
|
6
|
-
KIcon(v-if="showClear" @click.stop="clear" @mousedown.stop iconname="close" width="10" height="10").closeIcon
|
|
6
|
+
KIcon(v-if="showClear" @click.stop="clear" @mousedown.stop iconname="close" width="10" height="10" role="button" :aria-label="t('Clear input')").closeIcon
|
|
7
7
|
span.validation-text(v-if="validation && ['success', 'warning', 'error'].includes(validation) && validationText" :class="`is-${validation}`") {{ validationText }}
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
import { computed, useAttrs } from 'vue'
|
|
12
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
13
|
+
|
|
14
|
+
const { t } = useKatluxI18n()
|
|
12
15
|
|
|
13
16
|
defineOptions({
|
|
14
17
|
inheritAttrs: false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KTree
|
|
2
|
+
.KTree(role="tree" :aria-label="t('Hierarchical Tree')")
|
|
3
3
|
KLoader(:loading="isLoading" overlay)
|
|
4
4
|
.tree-list
|
|
5
5
|
.tree-node(
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
:key="row[idKey] || row.id"
|
|
8
8
|
:class="{ 'has-children': row.__treeNode?.hasChildren }"
|
|
9
9
|
:style="{ paddingLeft: ((row.__treeNode?.depth || 0) * 20) + 'px' }"
|
|
10
|
+
role="treeitem"
|
|
11
|
+
:aria-expanded="row.__treeNode?.hasChildren ? row.__treeNode?.isExpanded : undefined"
|
|
12
|
+
:aria-level="(row.__treeNode?.depth || 0) + 1"
|
|
13
|
+
tabindex="0"
|
|
14
|
+
@keydown.enter.prevent="onNodeClick(row)"
|
|
15
|
+
@keydown.space.prevent="row.__treeNode?.hasChildren ? toggleNode(row.__treeNode?.id) : onNodeClick(row)"
|
|
10
16
|
)
|
|
11
17
|
.node-content
|
|
12
18
|
// Toggle
|
|
@@ -14,6 +20,9 @@
|
|
|
14
20
|
v-if="row.__treeNode?.hasChildren"
|
|
15
21
|
@click="toggleNode(row.__treeNode?.id)"
|
|
16
22
|
:class="{ expanded: row.__treeNode?.isExpanded }"
|
|
23
|
+
role="button"
|
|
24
|
+
:aria-label="t('Toggle node')"
|
|
25
|
+
tabindex="-1"
|
|
17
26
|
)
|
|
18
27
|
KIcon(iconname="chevron" :width="12" :height="12" :rotate="row.__treeNode?.isExpanded ? '90' : '0'")
|
|
19
28
|
|
|
@@ -41,6 +50,9 @@
|
|
|
41
50
|
|
|
42
51
|
<script lang="ts" setup>
|
|
43
52
|
import { computed, type Ref } from 'vue'
|
|
53
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
54
|
+
|
|
55
|
+
const { t } = useKatluxI18n()
|
|
44
56
|
|
|
45
57
|
const props = defineProps<{
|
|
46
58
|
visibleRows: any[] // Rows with __treeNode attached
|
|
@@ -106,7 +106,11 @@ function onTreeSelect(node: any) {
|
|
|
106
106
|
<style lang="scss" scoped>
|
|
107
107
|
.KTreePicker__tree-container {
|
|
108
108
|
padding: 10px;
|
|
109
|
-
|
|
109
|
+
margin: -var(--grid-gap);
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
flex: 1;
|
|
113
|
+
min-height: 0;
|
|
110
114
|
overflow-y: auto;
|
|
111
115
|
min-width: 250px;
|
|
112
116
|
background-color: var(--panel-bg-default);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katlux/toolkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-alpha.100",
|
|
4
4
|
"description": "Core UI toolkit and utilities for the Katlux ecosystem",
|
|
5
5
|
"author": "Katlux",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"main": "./dist/module.mjs",
|
|
11
|
+
"bin": {
|
|
12
|
+
"katlux-add-ref": "./bin/add-ai-reference.mjs"
|
|
13
|
+
},
|
|
11
14
|
"scripts": {
|
|
12
15
|
"build": "nuxt-module-build build && unbuild && mkdir -p dist/runtime && cp -r src/runtime/presets dist/runtime/",
|
|
13
16
|
"dev": "nuxt-module-build build --stub",
|
|
@@ -37,10 +40,12 @@
|
|
|
37
40
|
"dependencies": {
|
|
38
41
|
"@katlux/providers": "*",
|
|
39
42
|
"@nuxt/kit": "^3.12.0",
|
|
43
|
+
"@nuxtjs/i18n": "^10.4.0",
|
|
40
44
|
"pug": "^3.0.0",
|
|
41
45
|
"sass": "^1.80.0"
|
|
42
46
|
},
|
|
43
47
|
"files": [
|
|
44
|
-
"dist"
|
|
48
|
+
"dist",
|
|
49
|
+
"bin"
|
|
45
50
|
]
|
|
46
51
|
}
|