@teammodlr/ui-kit 2.1.43 → 2.1.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/lib/components/avatar/Avatar.vue.d.ts +1 -1
- package/lib/components/avatargroup/AvatarGroup.vue.d.ts +1 -1
- package/lib/components/badge/Badge.vue.d.ts +1 -1
- package/lib/components/breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/lib/components/breadcrumb/BreadcrumbItem.vue.d.ts +1 -1
- package/lib/components/button/Button.vue.d.ts +1 -1
- package/lib/components/buttongroup/ButtonGroup.vue.d.ts +1 -1
- package/lib/components/checkbox/Checkbox.vue.d.ts +3 -3
- package/lib/components/colorpicker/ColorPicker.vue.d.ts +1 -1
- package/lib/components/configprovider/ConfigProvider.vue.d.ts +35 -0
- package/lib/components/configprovider/types.d.ts +3 -0
- package/lib/components/confirm/Confirm.vue.d.ts +1 -1
- package/lib/components/confirm/ConfirmProvider.vue.d.ts +1 -1
- package/lib/components/dialog/Dialog.vue.d.ts +1 -1
- package/lib/components/dropdown/Dropdown.vue.d.ts +1 -1
- package/lib/components/dropdown/DropdownHeading.vue.d.ts +1 -1
- package/lib/components/dropdown/DropdownItem.vue.d.ts +1 -1
- package/lib/components/dropdown/DropdownList.vue.d.ts +1 -1
- package/lib/components/dropdown/DropdownSeperator.vue.d.ts +1 -1
- package/lib/components/dropdown/DropdownWrapper.vue.d.ts +1 -1
- package/lib/components/form/Form.vue.d.ts +1 -1
- package/lib/components/image/Image.vue.d.ts +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/input/Input.vue.d.ts +2 -2
- package/lib/components/link/Link.vue.d.ts +1 -1
- package/lib/components/messageprovider/Message.vue.d.ts +1 -1
- package/lib/components/messageprovider/MessageProvider.vue.d.ts +1 -1
- package/lib/components/modal/Modal.vue.d.ts +1 -1
- package/lib/components/pagination/Pagination.vue.d.ts +1 -1
- package/lib/components/radio/Radio.vue.d.ts +3 -3
- package/lib/components/radiobutton/RadioButton.vue.d.ts +1 -1
- package/lib/components/radiobuttongroup/RadioButtonGroup.vue.d.ts +1 -1
- package/lib/components/renderer/examlpes/basic.vue.d.ts +1 -1
- package/lib/components/renderer/renderer.d.ts +1 -1
- package/lib/components/select/Select.vue.d.ts +2 -2
- package/lib/components/skeleton/Skeleton.vue.d.ts +1 -1
- package/lib/components/slider/Slider.vue.d.ts +1 -1
- package/lib/components/switch/Switch.vue.d.ts +3 -3
- package/lib/components/tab/Tab.vue.d.ts +1 -1
- package/lib/components/tab/TabGroup.vue.d.ts +1 -1
- package/lib/components/table/Table.vue.d.ts +1 -1
- package/lib/components/table/TableBody.vue.d.ts +1 -1
- package/lib/components/table/TableCell.vue.d.ts +1 -1
- package/lib/components/table/TableHead.vue.d.ts +1 -1
- package/lib/components/table/TableHeadRow.vue.d.ts +1 -1
- package/lib/components/table/TableRow.vue.d.ts +1 -1
- package/lib/components/tag/Tag.vue.d.ts +1 -1
- package/lib/components/textarea/Textarea.vue.d.ts +2 -2
- package/lib/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/lib/components/transfer/Transfer.vue.d.ts +1 -1
- package/lib/components/tree/Tree.vue.d.ts +1 -1
- package/lib/components/tree/TreeNode.vue.d.ts +1 -1
- package/lib/components/tree/TreeNodeToggle.vue.d.ts +1 -1
- package/lib/components/virtualscroll/VirtualScroll.vue.d.ts +1 -1
- package/lib/composables/useCachedUid.d.ts +1 -13
- package/lib/composables/useInput.d.ts +3 -3
- package/lib/index.cjs.js +10 -10
- package/lib/index.es.js +2069 -2070
- package/lib/styles/theme.css.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/configprovider/ConfigProvider.vue +26 -0
- package/src/components/configprovider/types.ts +3 -0
- package/src/components/confirm/ConfirmProvider.vue +3 -3
- package/src/components/index.ts +1 -0
- package/src/components/messageprovider/MessageProvider.vue +1 -1
- package/src/composables/useCachedUid.ts +16 -48
- package/src/composables/useInput.ts +3 -3
|
@@ -33,7 +33,7 @@ export declare const fontSizeScale: {
|
|
|
33
33
|
xlarge: string;
|
|
34
34
|
xxlarge: string;
|
|
35
35
|
};
|
|
36
|
-
export declare const fontSizeVariants: Record<"
|
|
36
|
+
export declare const fontSizeVariants: Record<"small" | "base" | "large" | "xsmall" | "xlarge" | "xxlarge", string>;
|
|
37
37
|
export declare const shadows: {
|
|
38
38
|
sm: string;
|
|
39
39
|
md: string;
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export interface ConfigProviderProps {
|
|
3
|
+
useId?: () => string
|
|
4
|
+
}
|
|
5
|
+
export default {
|
|
6
|
+
name: 'ConfigProvider',
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import {provide} from "vue";
|
|
12
|
+
import type {ConfigProviderInjection} from "./types";
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<ConfigProviderProps>(), {
|
|
15
|
+
useId: undefined
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const api: ConfigProviderInjection = {
|
|
19
|
+
useId: props['useId'],
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
provide('m-config', api);
|
|
23
|
+
</script>
|
|
24
|
+
<template>
|
|
25
|
+
<slot />
|
|
26
|
+
</template>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
<script lang="ts">
|
|
22
22
|
import { defineComponent, provide, ref } from 'vue';
|
|
23
|
-
import {
|
|
23
|
+
import { useId } from '../../composables/useCachedUid';
|
|
24
24
|
import { providerProps } from './providerProps';
|
|
25
25
|
import type { Confirm, ConfirmApiInjection, ConfirmOptions } from './types';
|
|
26
26
|
import MConfirm from './Confirm.vue';
|
|
@@ -45,8 +45,8 @@ export default defineComponent({
|
|
|
45
45
|
const dialogRefs: Record<string, PrivateConfirmRef> = {};
|
|
46
46
|
|
|
47
47
|
function create(options: ConfirmOptions): Confirm {
|
|
48
|
-
const
|
|
49
|
-
const key = id
|
|
48
|
+
const id = useId(null, 'm-confirm');
|
|
49
|
+
const key = id;
|
|
50
50
|
const dialog: PrivateConfirm = {
|
|
51
51
|
...options,
|
|
52
52
|
key,
|
package/src/components/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as MRenderer } from './renderer/renderer';
|
|
2
|
+
export { default as MConfigProvider } from './configprovider/ConfigProvider.vue';
|
|
2
3
|
export { default as MAvatar } from './avatar/Avatar.vue';
|
|
3
4
|
export { default as MAvatarGroup } from './avatargroup/AvatarGroup.vue';
|
|
4
5
|
export { default as MBadge } from './badge/Badge.vue';
|
|
@@ -43,7 +43,7 @@ import type {
|
|
|
43
43
|
} from './types';
|
|
44
44
|
import type { PropType } from 'vue';
|
|
45
45
|
import MMessage from './Message.vue';
|
|
46
|
-
import {
|
|
46
|
+
import { useId } from '../../composables/useCachedUid';
|
|
47
47
|
import * as style from './style';
|
|
48
48
|
import { modalScale } from '../../styles/transitions.css';
|
|
49
49
|
import { useIsServer } from '../../composables/useIsServer';
|
|
@@ -1,49 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export interface IUseCacheUid {
|
|
18
|
-
id: Readonly<Ref<string>>;
|
|
19
|
-
cacheAttrs: {
|
|
20
|
-
ref: Ref<CacheElement>;
|
|
21
|
-
[UID_CACHE_ATTR]?: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function useCachedUid(prefix?: string): IUseCacheUid {
|
|
26
|
-
const id = ref(uid(prefix));
|
|
27
|
-
const cacheElement = ref<CacheElement>(null);
|
|
28
|
-
|
|
29
|
-
onMounted(() => {
|
|
30
|
-
if (cacheElement.value) {
|
|
31
|
-
const element = getElement(cacheElement);
|
|
32
|
-
const serverId = element?.getAttribute(UID_CACHE_ATTR);
|
|
33
|
-
|
|
34
|
-
if (serverId) {
|
|
35
|
-
id.value = serverId;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
element?.removeAttribute(UID_CACHE_ATTR);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
id: readonly(id),
|
|
44
|
-
cacheAttrs: {
|
|
45
|
-
ref: cacheElement,
|
|
46
|
-
[UID_CACHE_ATTR]: typeof window === undefined ? id.value : undefined
|
|
47
|
-
}
|
|
48
|
-
};
|
|
1
|
+
import {inject} from 'vue';
|
|
2
|
+
|
|
3
|
+
let count = 0
|
|
4
|
+
|
|
5
|
+
export function useId(deterministicId?: string | null | undefined, prefix = 'ui') {
|
|
6
|
+
if (deterministicId) {
|
|
7
|
+
return deterministicId;
|
|
8
|
+
}
|
|
9
|
+
console.log(count);
|
|
10
|
+
const {useId} = inject('m-config', {useId: undefined});
|
|
11
|
+
if (useId && typeof useId === 'function') {
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
return `${prefix}-${useId()}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return `${prefix}-${count++}`;
|
|
49
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// inspired by indielayer ui
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
3
|
import { ref, watch, inject, computed, onMounted, onUnmounted } from 'vue';
|
|
4
|
-
import {
|
|
4
|
+
import { useId } from './useCachedUid';
|
|
5
5
|
import { FORM_STATE } from '../components/form/symbol';
|
|
6
6
|
|
|
7
7
|
export interface FormInput {
|
|
@@ -25,8 +25,8 @@ export const useInput = (
|
|
|
25
25
|
const isFirstValidation = ref(true);
|
|
26
26
|
const formError = ref(props.error);
|
|
27
27
|
|
|
28
|
-
const
|
|
29
|
-
const name = props.name ? props.name : id
|
|
28
|
+
const id = useId(null, 'input');
|
|
29
|
+
const name = props.name ? props.name : id;
|
|
30
30
|
const _name = ref(name);
|
|
31
31
|
|
|
32
32
|
watch(
|