@katlux/toolkit 0.1.1-alpha.92 → 0.1.1-alpha.95
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/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 +6 -12
- package/dist/module.cjs +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -1
- 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/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +1 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +8 -8
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +8 -8
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.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/KSlider/KSlider.global.d.vue.ts +1 -1
- package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
- 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 +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +1 -1
- 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 -9
- package/dist/runtime/composables/usePresetComponent.js +6 -12
- package/dist/runtime/plugins/PresetPlugin.js +11 -12
- package/dist/runtime/presets/default/components/KAlert/KAlert.vue +2 -3
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +2 -2
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +2 -2
- package/dist/runtime/presets/default/components/KModal/KModal.vue +2 -2
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue +2 -2
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +2 -2
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +2 -2
- package/dist/runtime/presets/default/components/KTree/KTree.vue +2 -2
- package/package.json +2 -1
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { computed, defineAsyncComponent } from "vue";
|
|
2
|
-
import { useAppConfig
|
|
3
|
-
|
|
4
|
-
return useState("katlux-preset-loaders-registry", () => ({}));
|
|
5
|
-
}
|
|
1
|
+
import { computed, defineAsyncComponent, shallowReactive } from "vue";
|
|
2
|
+
import { useAppConfig } from "#app";
|
|
3
|
+
const _loadersRegistry = shallowReactive({});
|
|
6
4
|
export function registerPresetComponents(presetName, loaders) {
|
|
7
|
-
|
|
8
|
-
registry.value[presetName] = loaders;
|
|
5
|
+
_loadersRegistry[presetName] = loaders;
|
|
9
6
|
}
|
|
10
7
|
export function usePresetComponent(componentBaseName, defaultComponent) {
|
|
11
8
|
const appConfig = useAppConfig();
|
|
12
|
-
const registry = usePresetLoadersRegistry();
|
|
13
9
|
const presetStack = computed(() => {
|
|
14
10
|
const raw = appConfig.katluxToolkit?.activePreset;
|
|
15
11
|
const list = Array.isArray(raw) ? raw : raw ? [raw] : [];
|
|
@@ -19,7 +15,7 @@ export function usePresetComponent(componentBaseName, defaultComponent) {
|
|
|
19
15
|
let loader;
|
|
20
16
|
for (const presetName of presetStack.value) {
|
|
21
17
|
if (presetName === "default") break;
|
|
22
|
-
const externalLoaders =
|
|
18
|
+
const externalLoaders = _loadersRegistry[presetName];
|
|
23
19
|
if (externalLoaders) {
|
|
24
20
|
const key = `./components/${componentBaseName}/${componentBaseName}.vue`;
|
|
25
21
|
loader = externalLoaders[key];
|
|
@@ -47,9 +43,7 @@ export function usePresetComponent(componentBaseName, defaultComponent) {
|
|
|
47
43
|
if (loader) break;
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
|
-
if (loader)
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
46
|
+
if (loader) break;
|
|
53
47
|
}
|
|
54
48
|
if (!loader) {
|
|
55
49
|
return defaultComponent;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { defineNuxtPlugin, useHead, useState } from "#app";
|
|
2
|
-
import { watch } from "vue";
|
|
1
|
+
import { defineNuxtPlugin, useHead, useAppConfig, useState } from "#app";
|
|
2
|
+
import { ref, watch } from "vue";
|
|
3
3
|
import { PresetResolver } from "../utils/PresetResolver.js";
|
|
4
4
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
5
5
|
const resolver = new PresetResolver();
|
|
6
|
+
const appConfig = useAppConfig();
|
|
6
7
|
const activePresetState = useState("katlux-active-preset-state", () => resolver.getActivePreset());
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
updateRootAttribute(activePreset);
|
|
8
|
+
const resolvePresetString = (val) => Array.isArray(val) ? val[0] ?? "default" : val;
|
|
9
|
+
const currentPreset = ref(resolvePresetString(activePresetState.value));
|
|
10
|
+
useHead({
|
|
11
|
+
htmlAttrs: {
|
|
12
|
+
"data-template": currentPreset
|
|
13
|
+
}
|
|
14
|
+
});
|
|
16
15
|
if (appConfig.katluxToolkit) {
|
|
17
16
|
watch(() => appConfig.katluxToolkit?.activePreset, (newPreset) => {
|
|
18
17
|
if (newPreset) {
|
|
19
|
-
|
|
18
|
+
currentPreset.value = resolvePresetString(newPreset);
|
|
20
19
|
resolver.setActivePreset(newPreset);
|
|
21
20
|
}
|
|
22
21
|
});
|
|
@@ -12,14 +12,13 @@ Transition(name="k-alert-fade")
|
|
|
12
12
|
|
|
13
13
|
<script lang="ts" setup>
|
|
14
14
|
import type { KAlertProps } from '../../../../components/KAlert/KAlert.logic'
|
|
15
|
-
import {
|
|
15
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
16
16
|
|
|
17
17
|
const props = defineProps<KAlertProps>()
|
|
18
18
|
const emit = defineEmits<{ dismiss: [] }>()
|
|
19
19
|
const { visible, dismiss, icon } = useKAlertLogic(props, () => emit('dismiss'))
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
21
|
+
const { t } = useKatluxI18n()
|
|
23
22
|
</script>
|
|
24
23
|
|
|
25
24
|
<style lang="scss" scoped>
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
import { computed } from 'vue'
|
|
26
26
|
import { CFlatClientDataProvider } from '@katlux/providers'
|
|
27
27
|
import type { IKDatatableAction } from '@katlux/providers'
|
|
28
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
30
|
+
const { t } = useKatluxI18n()
|
|
31
31
|
|
|
32
32
|
const props = defineProps<{
|
|
33
33
|
bulkActions: IKDatatableAction[]
|
|
@@ -59,9 +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'
|
|
62
63
|
|
|
63
|
-
const
|
|
64
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
64
|
+
const { t } = useKatluxI18n()
|
|
65
65
|
|
|
66
66
|
const props = defineProps<{
|
|
67
67
|
dataProvider: ADataProvider
|
|
@@ -11,9 +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'
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
16
|
+
const { t } = useKatluxI18n()
|
|
17
17
|
|
|
18
18
|
const props = defineProps<{
|
|
19
19
|
modalId: string
|
|
@@ -32,9 +32,9 @@ nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
|
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
34
34
|
import { computed } from 'vue'
|
|
35
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
35
36
|
|
|
36
|
-
const
|
|
37
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
37
|
+
const { t } = useKatluxI18n()
|
|
38
38
|
|
|
39
39
|
const props = defineProps<{
|
|
40
40
|
dp: any
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
|
|
23
23
|
<script lang="ts" setup>
|
|
24
24
|
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
|
25
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
27
|
+
const { t } = useKatluxI18n()
|
|
28
28
|
|
|
29
29
|
const props = defineProps<{
|
|
30
30
|
items: any[]
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
import { computed, useAttrs } from 'vue'
|
|
12
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
14
|
+
const { t } = useKatluxI18n()
|
|
15
15
|
|
|
16
16
|
defineOptions({
|
|
17
17
|
inheritAttrs: false
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
|
|
51
51
|
<script lang="ts" setup>
|
|
52
52
|
import { computed, type Ref } from 'vue'
|
|
53
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
53
54
|
|
|
54
|
-
const
|
|
55
|
-
const t = (key: string) => nuxtApp?.$t ? nuxtApp.$t(key) : key
|
|
55
|
+
const { t } = useKatluxI18n()
|
|
56
56
|
|
|
57
57
|
const props = defineProps<{
|
|
58
58
|
visibleRows: any[] // Rows with __treeNode attached
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katlux/toolkit",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.95",
|
|
4
4
|
"description": "Core UI toolkit and utilities for the Katlux ecosystem",
|
|
5
5
|
"author": "Katlux",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@katlux/providers": "*",
|
|
42
42
|
"@nuxt/kit": "^3.12.0",
|
|
43
|
+
"@nuxtjs/i18n": "^10.4.0",
|
|
43
44
|
"pug": "^3.0.0",
|
|
44
45
|
"sass": "^1.80.0"
|
|
45
46
|
},
|