@central-design-system/components 2.30.0 → 3.0.0-alpha.0
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/cds.css +1 -111
- package/dist/cds.d.ts +31 -0
- package/dist/cds.es.js +2159 -0
- package/dist/cds.umd.js +1 -0
- package/dist/components/CdsBadge/CdsBadge.vue.d.ts +32 -0
- package/dist/components/CdsButton/CdsButton.vue.d.ts +140 -0
- package/dist/components/CdsDrawer/CdsDrawer.vue.d.ts +179 -0
- package/dist/components/CdsGrid/CdsCol.vue.d.ts +73 -0
- package/dist/components/CdsGrid/CdsGrid.vue.d.ts +55 -0
- package/dist/components/CdsGrid/CdsRow.vue.d.ts +37 -0
- package/dist/components/CdsGrid/composable/column.d.ts +84 -0
- package/dist/components/CdsGrid/composable/grid.d.ts +24 -0
- package/dist/components/CdsGrid/composable/index.d.ts +4 -0
- package/dist/components/CdsGrid/composable/subgrid.d.ts +20 -0
- package/dist/components/CdsGrid/composable/wide.d.ts +12 -0
- package/dist/components/CdsGrid/mode/CSSGrid.d.ts +5 -0
- package/dist/components/CdsGrid/mode/FlexGrid.d.ts +5 -0
- package/dist/components/CdsGrid/types.d.ts +27 -0
- package/dist/components/CdsIcon/CdsIcon.vue.d.ts +44 -0
- package/dist/components/CdsIcon/index.d.ts +1 -0
- package/dist/components/CdsLink/CdsLink.vue.d.ts +50 -0
- package/dist/components/CdsList/CdsList.vue.d.ts +170 -0
- package/dist/components/CdsList/CdsListGroup.vue.d.ts +125 -0
- package/dist/components/CdsList/CdsListItem.vue.d.ts +172 -0
- package/dist/components/CdsList/composable/depth.d.ts +3 -0
- package/dist/components/CdsList/composable/index.d.ts +2 -0
- package/dist/components/CdsList/composable/list.d.ts +19 -0
- package/dist/components/CdsList/index.d.ts +3 -0
- package/dist/components/CdsLoader/CdsLoader.vue.d.ts +62 -0
- package/dist/components/CdsLoader/index.d.ts +1 -0
- package/dist/components/CdsStatus/CdsStatus.vue.d.ts +46 -0
- package/dist/components/CdsTag/CdsTag.vue.d.ts +96 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/composable/appearance.d.ts +24 -0
- package/dist/composable/color.d.ts +21 -0
- package/dist/composable/dark.d.ts +19 -0
- package/dist/composable/disabled.d.ts +19 -0
- package/dist/composable/focus.d.ts +12 -0
- package/dist/composable/icon.d.ts +32 -0
- package/dist/composable/index.d.ts +17 -0
- package/dist/composable/items.d.ts +78 -0
- package/dist/composable/link.d.ts +36 -0
- package/dist/composable/loading.d.ts +19 -0
- package/dist/composable/nested/nested.d.ts +85 -0
- package/dist/composable/nested/openStrategies.d.ts +25 -0
- package/dist/composable/nested/selectStrategies.d.ts +21 -0
- package/dist/composable/proxyModel.d.ts +8 -0
- package/dist/composable/render.d.ts +2 -0
- package/dist/composable/size.d.ts +24 -0
- package/dist/composable/status.d.ts +21 -0
- package/dist/composable/tag.d.ts +16 -0
- package/dist/composable/text.d.ts +17 -0
- package/dist/composable/toggleScope.d.ts +2 -0
- package/dist/directives/index.d.ts +2 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/shims-vue.d.ts +24 -0
- package/dist/transitions/createTransition.d.ts +9 -0
- package/dist/transitions/expandTransition.d.ts +19 -0
- package/dist/transitions/index.d.ts +14 -0
- package/dist/types/CdsOptions.d.ts +3 -0
- package/dist/utils/changeCase/lowerCase.d.ts +8 -0
- package/dist/utils/changeCase/noCase.d.ts +10 -0
- package/dist/utils/changeCase/paramCase.d.ts +3 -0
- package/dist/utils/changeCase/pascalCase.d.ts +5 -0
- package/dist/utils/getCurrentInstance.d.ts +13 -0
- package/dist/utils/helpers.d.ts +49 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/propsFactory.d.ts +52 -0
- package/nuxt.js +13 -0
- package/package.json +37 -80
- package/src/scss/index.scss +10 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/_convert.scss +4 -2
- package/{dist/mixins/scss → src/scss/mixins}/layout/_layout.scss +0 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/_mini-unit.scss +0 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/_spacing.scss +0 -0
- package/src/scss/mixins/layout/exports/_mini-unit.module.scss +5 -0
- package/src/scss/mixins/layout/exports/_spacing-all.module.scss +3 -0
- package/src/scss/mixins/layout/exports/_spacing-fluid.module.scss +8 -0
- package/src/scss/mixins/layout/exports/_spacing-layout.module.scss +11 -0
- package/src/scss/mixins/layout/exports/_spacing.module.scss +16 -0
- package/{dist/mixins/scss → src/scss/mixins}/layout/index.scss +0 -2
- package/{dist/mixins/scss → src/scss/mixins}/motion.scss +0 -0
- package/{dist/mixins/scss → src/scss/mixins}/typo.scss +0 -67
- package/src/scss/modules/_reset.scss +113 -0
- package/src/scss/modules/_transition.scss +26 -0
- package/src/scss/modules/_typography.scss +36 -0
- package/src/scss/modules/_variables.scss +9 -0
- package/src/scss/modules/grid/_aspect-ratio.scss +62 -0
- package/src/scss/modules/grid/_breakpoint.scss +195 -0
- package/src/scss/modules/grid/_config.scss +88 -0
- package/src/scss/modules/grid/_css-grid.scss +445 -0
- package/src/scss/modules/grid/_flex-grid.scss +39 -0
- package/src/scss/modules/grid/_mixins.scss +307 -0
- package/src/scss/modules/grid/exports/_config.module.scss +9 -0
- package/src/scss/modules/grid/index.scss +5 -0
- package/src/scss/themes/b2b/tokens-map.scss +139 -0
- package/src/scss/themes/b2b/tokens.json +2190 -0
- package/{dist/tokens → src/scss/themes}/b2b/variables.css +0 -0
- package/src/scss/themes/cds/tokens-map.scss +138 -0
- package/src/scss/themes/cds/tokens.json +2184 -0
- package/{dist/tokens → src/scss/themes}/cds/variables.css +0 -1
- package/src/scss/themes/index.ts +43 -0
- package/src/scss/utility/display.scss +13 -0
- package/src/scss/utility/flexbox.scss +37 -0
- package/src/scss/utility/generatedFiles/generatedStyles.json +1 -0
- package/src/scss/utility/generatedFiles/generatedStyles.scss +300 -0
- package/src/scss/utility/index.scss +7 -0
- package/src/scss/utility/layout.scss +11 -0
- package/src/scss/utility/lists.scss +76 -0
- package/src/scss/utility/spacing.scss +89 -0
- package/src/scss/utility/typography.scss +16 -0
- package/src/scss/utility/variables.scss +116 -0
- package/README.md +0 -87
- package/build/utils/postInstall.js +0 -20
- package/build/utils/print.js +0 -38
- package/dist/CdsAccordion/index.js +0 -8
- package/dist/CdsAccordion/styles.css +0 -11
- package/dist/CdsBadge/index.js +0 -8
- package/dist/CdsBadge/styles.css +0 -9
- package/dist/CdsBreadcrumbs/index.js +0 -8
- package/dist/CdsBreadcrumbs/styles.css +0 -11
- package/dist/CdsButton/index.js +0 -8
- package/dist/CdsButton/styles.css +0 -11
- package/dist/CdsCheckbox/index.js +0 -8
- package/dist/CdsCheckbox/styles.css +0 -15
- package/dist/CdsCombobox/index.js +0 -8
- package/dist/CdsCombobox/styles.css +0 -15
- package/dist/CdsContainer/index.js +0 -8
- package/dist/CdsContainer/styles.css +0 -11
- package/dist/CdsContentSwitcher/index.js +0 -8
- package/dist/CdsContentSwitcher/styles.css +0 -15
- package/dist/CdsDataTable/index.js +0 -8
- package/dist/CdsDataTable/styles.css +0 -21
- package/dist/CdsDatePicker/index.js +0 -24
- package/dist/CdsDatePicker/styles.css +0 -15
- package/dist/CdsDrawer/index.js +0 -8
- package/dist/CdsDrawer/styles.css +0 -17
- package/dist/CdsDropdown/index.js +0 -8
- package/dist/CdsDropdown/styles.css +0 -15
- package/dist/CdsEmptyState/index.js +0 -8
- package/dist/CdsEmptyState/styles.css +0 -9
- package/dist/CdsFooter/index.js +0 -8
- package/dist/CdsFooter/styles.css +0 -17
- package/dist/CdsForm/index.js +0 -8
- package/dist/CdsForm/styles.css +0 -15
- package/dist/CdsGrid/index.js +0 -8
- package/dist/CdsGrid/styles.css +0 -9
- package/dist/CdsHeader/index.js +0 -8
- package/dist/CdsHeader/styles.css +0 -11
- package/dist/CdsIcon/index.js +0 -8
- package/dist/CdsIcon/styles.css +0 -9
- package/dist/CdsImage/index.js +0 -8
- package/dist/CdsImage/styles.css +0 -9
- package/dist/CdsInput/index.js +0 -8
- package/dist/CdsInput/styles.css +0 -13
- package/dist/CdsLink/index.js +0 -8
- package/dist/CdsLink/styles.css +0 -9
- package/dist/CdsList/index.js +0 -8
- package/dist/CdsList/styles.css +0 -9
- package/dist/CdsLoading/index.js +0 -8
- package/dist/CdsLoading/styles.css +0 -9
- package/dist/CdsModal/index.js +0 -8
- package/dist/CdsModal/styles.css +0 -15
- package/dist/CdsMultiselect/index.js +0 -8
- package/dist/CdsMultiselect/styles.css +0 -17
- package/dist/CdsNotification/index.js +0 -8
- package/dist/CdsNotification/styles.css +0 -21
- package/dist/CdsOverflowMenu/index.js +0 -8
- package/dist/CdsOverflowMenu/styles.css +0 -21
- package/dist/CdsPagination/index.js +0 -8
- package/dist/CdsPagination/styles.css +0 -13
- package/dist/CdsRadioButton/index.js +0 -8
- package/dist/CdsRadioButton/styles.css +0 -15
- package/dist/CdsSearch/index.js +0 -8
- package/dist/CdsSearch/styles.css +0 -19
- package/dist/CdsSelect/index.js +0 -8
- package/dist/CdsSelect/styles.css +0 -15
- package/dist/CdsSidebar/index.js +0 -8
- package/dist/CdsSidebar/styles.css +0 -15
- package/dist/CdsSkeleton/index.js +0 -8
- package/dist/CdsSkeleton/styles.css +0 -9
- package/dist/CdsStages/index.js +0 -8
- package/dist/CdsStages/styles.css +0 -9
- package/dist/CdsStatus/index.js +0 -8
- package/dist/CdsStatus/styles.css +0 -15
- package/dist/CdsSteps/index.js +0 -8
- package/dist/CdsSteps/styles.css +0 -19
- package/dist/CdsTable/index.js +0 -16
- package/dist/CdsTable/styles.css +0 -21
- package/dist/CdsTabs/index.js +0 -8
- package/dist/CdsTabs/styles.css +0 -9
- package/dist/CdsTag/index.js +0 -8
- package/dist/CdsTag/styles.css +0 -11
- package/dist/CdsTextArea/index.js +0 -8
- package/dist/CdsTextArea/styles.css +0 -17
- package/dist/CdsTextInput/index.js +0 -8
- package/dist/CdsTextInput/styles.css +0 -15
- package/dist/CdsToggle/index.js +0 -8
- package/dist/CdsToggle/styles.css +0 -9
- package/dist/CdsTooltip/index.js +0 -8
- package/dist/CdsTooltip/styles.css +0 -13
- package/dist/CdsUploader/index.js +0 -14
- package/dist/CdsUploader/styles.css +0 -25
- package/dist/cds.js +0 -38
- package/dist/cds.min.css +0 -7
- package/dist/cds.min.js +0 -38
- package/dist/index.html +0 -60
- package/dist/mixins/scss/layout/_breakpoint.scss +0 -237
- package/dist/mixins/scss/layout/_key-height.scss +0 -90
- package/dist/mixins/scss/layout/_spacing-export.scss +0 -34
- package/dist/mixins/scss/layout/_utilities.scss +0 -33
- package/dist/types/CdsAccordion.ts +0 -4
- package/dist/types/CdsAccordionItem.ts +0 -10
- package/dist/types/CdsBreadcrumbs.ts +0 -11
- package/dist/types/CdsBreadcrumbsItem.ts +0 -12
- package/dist/types/CdsButton.ts +0 -30
- package/dist/types/CdsCheckbox.ts +0 -20
- package/dist/types/CdsCheckboxGroup.ts +0 -14
- package/dist/types/CdsCol.ts +0 -38
- package/dist/types/CdsCombobox.ts +0 -42
- package/dist/types/CdsContainer.ts +0 -32
- package/dist/types/CdsContentSwitcher.ts +0 -4
- package/dist/types/CdsContentSwitcherButton.ts +0 -21
- package/dist/types/CdsDataTable.ts +0 -48
- package/dist/types/CdsDatePicker.ts +0 -40
- package/dist/types/CdsDrawer.ts +0 -25
- package/dist/types/CdsDrawerGroup.ts +0 -8
- package/dist/types/CdsDrawerItem.ts +0 -12
- package/dist/types/CdsDrawerLabel.ts +0 -4
- package/dist/types/CdsDropdown.ts +0 -14
- package/dist/types/CdsEmptyState.ts +0 -10
- package/dist/types/CdsFooter.ts +0 -17
- package/dist/types/CdsFooterService.ts +0 -16
- package/dist/types/CdsForm.ts +0 -4
- package/dist/types/CdsFormGroup.ts +0 -8
- package/dist/types/CdsFormItem.ts +0 -4
- package/dist/types/CdsGrid.ts +0 -16
- package/dist/types/CdsHeader.ts +0 -27
- package/dist/types/CdsHeaderService.ts +0 -4
- package/dist/types/CdsIcon.ts +0 -6
- package/dist/types/CdsLink.ts +0 -22
- package/dist/types/CdsList.ts +0 -6
- package/dist/types/CdsLoading.ts +0 -14
- package/dist/types/CdsModal.ts +0 -17
- package/dist/types/CdsMultiselect.ts +0 -33
- package/dist/types/CdsNotification.ts +0 -22
- package/dist/types/CdsOverflowMenu.ts +0 -16
- package/dist/types/CdsPagination.ts +0 -12
- package/dist/types/CdsRadioButton.ts +0 -29
- package/dist/types/CdsRow.ts +0 -18
- package/dist/types/CdsSearch.ts +0 -24
- package/dist/types/CdsSelect.ts +0 -37
- package/dist/types/CdsSkeleton.ts +0 -14
- package/dist/types/CdsStages.ts +0 -10
- package/dist/types/CdsStatus.ts +0 -22
- package/dist/types/CdsSteps.ts +0 -22
- package/dist/types/CdsStepsItem.ts +0 -12
- package/dist/types/CdsTable.ts +0 -46
- package/dist/types/CdsTabs.ts +0 -19
- package/dist/types/CdsTabsItem.ts +0 -18
- package/dist/types/CdsTag.ts +0 -20
- package/dist/types/CdsTextArea.ts +0 -26
- package/dist/types/CdsTextInput.ts +0 -32
- package/dist/types/CdsToggle.ts +0 -18
- package/dist/types/CdsTooltip.ts +0 -18
- package/dist/types/CdsTooltipDefinition.ts +0 -16
- package/dist/types/CdsTooltipInteractive.ts +0 -11
- package/dist/types/CdsUploader.ts +0 -44
- package/dist/types/Sidebar.ts +0 -17
- package/dist/types/types.ts +0 -2
- package/dist/utils/convertRemToPx.js +0 -9
- package/dist/utils/deepFind.js +0 -14
- package/dist/utils/expiringStorage.js +0 -28
- package/dist/utils/helpers.js +0 -33
- package/dist/utils/index.js +0 -1
- package/dist/utils/isCorrectTag.js +0 -5
- package/dist/utils/isRightProps.js +0 -5
- package/dist/utils/memoize.js +0 -8
- package/dist/utils/suffixPropName.js +0 -12
- package/dist/utils/test/deepFind.test.js +0 -18
- package/dist/utils/test/isCorrectTag.test.js +0 -9
- package/dist/utils/test/isCorrectTagDataSet.js +0 -51
- package/dist/utils/validationProps.js +0 -7
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { SelectItemKey } from '../utils';
|
|
2
|
+
import type { PropType, ComputedRef } from 'vue';
|
|
3
|
+
export interface IInternalItem<T = any> {
|
|
4
|
+
title: string;
|
|
5
|
+
value: any;
|
|
6
|
+
props: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
title: string;
|
|
9
|
+
value: any;
|
|
10
|
+
};
|
|
11
|
+
children?: IInternalItem<T>[];
|
|
12
|
+
raw: T;
|
|
13
|
+
}
|
|
14
|
+
export interface IItemsProps {
|
|
15
|
+
items: any[];
|
|
16
|
+
itemTitle: SelectItemKey;
|
|
17
|
+
itemValue: SelectItemKey;
|
|
18
|
+
itemChildren: SelectItemKey;
|
|
19
|
+
itemProps: SelectItemKey;
|
|
20
|
+
returnObject: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface IUseItems {
|
|
23
|
+
items: ComputedRef<IInternalItem[]>;
|
|
24
|
+
}
|
|
25
|
+
export declare const makeItemsProps: <Defaults extends {
|
|
26
|
+
items?: unknown;
|
|
27
|
+
itemTitle?: unknown;
|
|
28
|
+
itemValue?: unknown;
|
|
29
|
+
itemChildren?: unknown;
|
|
30
|
+
itemProps?: unknown;
|
|
31
|
+
returnObject?: unknown;
|
|
32
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
33
|
+
/**
|
|
34
|
+
* Массив списка элементов
|
|
35
|
+
*/
|
|
36
|
+
items: {
|
|
37
|
+
type: PropType<any[]>;
|
|
38
|
+
default: () => never[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Ключ для заголовка элемента
|
|
42
|
+
*/
|
|
43
|
+
itemTitle: {
|
|
44
|
+
type: PropType<SelectItemKey>;
|
|
45
|
+
default: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Ключ для значения элемента
|
|
49
|
+
*/
|
|
50
|
+
itemValue: {
|
|
51
|
+
type: PropType<SelectItemKey>;
|
|
52
|
+
default: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Ключ для дочерних элементов
|
|
56
|
+
*/
|
|
57
|
+
itemChildren: {
|
|
58
|
+
type: PropType<SelectItemKey>;
|
|
59
|
+
default: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Ключ для дополнительных свойств элемента
|
|
63
|
+
*/
|
|
64
|
+
itemProps: {
|
|
65
|
+
type: PropType<SelectItemKey>;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Возвращать объект вместо массива
|
|
70
|
+
*/
|
|
71
|
+
returnObject: {
|
|
72
|
+
type: PropType<boolean>;
|
|
73
|
+
default: boolean;
|
|
74
|
+
};
|
|
75
|
+
}, Defaults>;
|
|
76
|
+
export declare function useItems(props: IItemsProps): IUseItems;
|
|
77
|
+
export declare function transformItem(props: Omit<IItemsProps, 'items'>, item: any): IInternalItem;
|
|
78
|
+
export declare function transformItems(props: Omit<IItemsProps, 'items'>, items: IItemsProps['items']): IInternalItem[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SetupContext } from 'vue';
|
|
2
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
3
|
+
import type { RouteLocationRaw, useLink as TUseLink } from 'vue-router';
|
|
4
|
+
export interface ILinkProps {
|
|
5
|
+
href: string | undefined;
|
|
6
|
+
to: RouteLocationRaw | undefined;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IUseLink extends Omit<Partial<ReturnType<typeof TUseLink>>, 'href' | 'isActive'> {
|
|
10
|
+
isActive: ComputedRef<boolean> | undefined;
|
|
11
|
+
isLink: ComputedRef<boolean>;
|
|
12
|
+
href: ComputedRef<string | undefined>;
|
|
13
|
+
to: ComputedRef<RouteLocationRaw | undefined>;
|
|
14
|
+
tag: ComputedRef<string>;
|
|
15
|
+
handleClick: (event: MouseEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const makeLinkProps: <Defaults extends {
|
|
18
|
+
href?: unknown;
|
|
19
|
+
to?: unknown;
|
|
20
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
21
|
+
/**
|
|
22
|
+
* Обычная ссылка
|
|
23
|
+
*/
|
|
24
|
+
href: {
|
|
25
|
+
type: PropType<string>;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Ссылка или объект Vue Router
|
|
30
|
+
*/
|
|
31
|
+
to: {
|
|
32
|
+
type: PropType<RouteLocationRaw>;
|
|
33
|
+
default: undefined;
|
|
34
|
+
};
|
|
35
|
+
}, Defaults>;
|
|
36
|
+
export declare function useLink(props: ILinkProps, context: SetupContext<any>): IUseLink;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
2
|
+
export interface ILoadingProp {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface IUseLoading {
|
|
6
|
+
loadingClasses: ComputedRef<string | undefined>;
|
|
7
|
+
}
|
|
8
|
+
export declare const makeLoadingProps: <Defaults extends {
|
|
9
|
+
loading?: unknown;
|
|
10
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
11
|
+
/**
|
|
12
|
+
* Состояние загрузки
|
|
13
|
+
*/
|
|
14
|
+
loading: {
|
|
15
|
+
type: PropType<boolean>;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
}, Defaults>;
|
|
19
|
+
export declare function useLoading(props: ILoadingProp): IUseLoading;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Ref, InjectionKey, PropType, SetupContext } from 'vue';
|
|
2
|
+
import type { TSelectStrategyProp } from './selectStrategies';
|
|
3
|
+
import type { TOpenStrategyProp } from './openStrategies';
|
|
4
|
+
declare type TNestedProvide = {
|
|
5
|
+
id: Ref<unknown>;
|
|
6
|
+
isGroupActivator?: boolean;
|
|
7
|
+
root: {
|
|
8
|
+
children: Ref<Map<unknown, unknown[]>>;
|
|
9
|
+
parents: Ref<Map<unknown, unknown>>;
|
|
10
|
+
opened: Ref<Set<unknown>>;
|
|
11
|
+
selected: Ref<Map<unknown, 'on' | 'off' | 'indeterminate'>>;
|
|
12
|
+
selectedValues: Ref<unknown[]>;
|
|
13
|
+
register: (id: unknown, parentId: unknown, isGroup?: boolean) => void;
|
|
14
|
+
unregister: (id: unknown) => void;
|
|
15
|
+
open: (id: unknown, value: boolean, event?: Event) => void;
|
|
16
|
+
select: (id: unknown, value: boolean, event?: Event) => void;
|
|
17
|
+
openOnSelect: (id: unknown, value: boolean, event?: Event) => void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface INestedProps {
|
|
21
|
+
selectStrategy: TSelectStrategyProp | undefined;
|
|
22
|
+
openStrategy: TOpenStrategyProp | undefined;
|
|
23
|
+
selected: unknown[] | unknown;
|
|
24
|
+
opened: unknown[] | unknown;
|
|
25
|
+
required: boolean;
|
|
26
|
+
'onUpdate:selected'?: ((val: unknown[]) => void) | undefined;
|
|
27
|
+
'onUpdate:opened'?: ((val: unknown[]) => void) | undefined;
|
|
28
|
+
}
|
|
29
|
+
export declare const VNestedSymbol: InjectionKey<TNestedProvide>;
|
|
30
|
+
export declare const emptyNested: TNestedProvide;
|
|
31
|
+
export declare const makeNestedProps: <Defaults extends {
|
|
32
|
+
selectStrategy?: unknown;
|
|
33
|
+
openStrategy?: unknown;
|
|
34
|
+
opened?: unknown;
|
|
35
|
+
selected?: unknown;
|
|
36
|
+
required?: unknown;
|
|
37
|
+
} = {}>(defaults?: Defaults | undefined) => import('../../utils').AppendDefault<{
|
|
38
|
+
/**
|
|
39
|
+
* Стратегия выбора элементов
|
|
40
|
+
*/
|
|
41
|
+
selectStrategy: PropType<TSelectStrategyProp>;
|
|
42
|
+
/**
|
|
43
|
+
* Стратегия открытия элементов
|
|
44
|
+
*/
|
|
45
|
+
openStrategy: PropType<TOpenStrategyProp>;
|
|
46
|
+
/**
|
|
47
|
+
* Массив открытых элементов
|
|
48
|
+
*/
|
|
49
|
+
opened: PropType<unknown[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Массив выбранных элементов
|
|
52
|
+
*/
|
|
53
|
+
selected: PropType<unknown[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Обязательный выбор
|
|
56
|
+
*/
|
|
57
|
+
required: BooleanConstructor;
|
|
58
|
+
}, Defaults>;
|
|
59
|
+
export declare const useNested: (props: INestedProps, ctx: SetupContext<any>) => TNestedProvide['root'];
|
|
60
|
+
export declare const useNestedItem: (id: Ref<unknown>, isGroup: boolean) => {
|
|
61
|
+
id: import("vue").ComputedRef<{}>;
|
|
62
|
+
open: (open: boolean, event: Event) => void;
|
|
63
|
+
openOnSelect: (open: boolean, event?: Event) => void;
|
|
64
|
+
isOpen: import("vue").ComputedRef<boolean>;
|
|
65
|
+
parent: import("vue").ComputedRef<unknown>;
|
|
66
|
+
select: (selected: boolean, event?: Event) => void;
|
|
67
|
+
isSelected: import("vue").ComputedRef<boolean>;
|
|
68
|
+
isIndeterminate: import("vue").ComputedRef<boolean>;
|
|
69
|
+
isLeaf: import("vue").ComputedRef<boolean>;
|
|
70
|
+
isGroupActivator: boolean | undefined;
|
|
71
|
+
root: {
|
|
72
|
+
children: Ref<Map<unknown, unknown[]>>;
|
|
73
|
+
parents: Ref<Map<unknown, unknown>>;
|
|
74
|
+
opened: Ref<Set<unknown>>;
|
|
75
|
+
selected: Ref<Map<unknown, 'on' | 'off' | 'indeterminate'>>;
|
|
76
|
+
selectedValues: Ref<unknown[]>;
|
|
77
|
+
register: (id: unknown, parentId: unknown, isGroup?: boolean) => void;
|
|
78
|
+
unregister: (id: unknown) => void;
|
|
79
|
+
open: (id: unknown, value: boolean, event?: Event) => void;
|
|
80
|
+
select: (id: unknown, value: boolean, event?: Event) => void;
|
|
81
|
+
openOnSelect: (id: unknown, value: boolean, event?: Event) => void;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export declare const useNestedGroupActivator: () => void;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare type TOpenStrategyFn = (data: {
|
|
2
|
+
id: unknown;
|
|
3
|
+
value: boolean;
|
|
4
|
+
opened: Set<unknown>;
|
|
5
|
+
children: Map<unknown, unknown[]>;
|
|
6
|
+
parents: Map<unknown, unknown>;
|
|
7
|
+
event?: Event;
|
|
8
|
+
}) => Set<unknown>;
|
|
9
|
+
export declare type TOpenSelectStrategyFn = (data: {
|
|
10
|
+
id: unknown;
|
|
11
|
+
value: boolean;
|
|
12
|
+
opened: Set<unknown>;
|
|
13
|
+
selected: Map<unknown, 'on' | 'off' | 'indeterminate'>;
|
|
14
|
+
children: Map<unknown, unknown[]>;
|
|
15
|
+
parents: Map<unknown, unknown>;
|
|
16
|
+
event?: Event;
|
|
17
|
+
}) => Set<unknown> | null;
|
|
18
|
+
export declare type TOpenStrategy = {
|
|
19
|
+
open: TOpenStrategyFn;
|
|
20
|
+
select: TOpenSelectStrategyFn;
|
|
21
|
+
};
|
|
22
|
+
export declare type TOpenStrategyProp = 'single' | 'multiple' | 'list' | TOpenStrategy;
|
|
23
|
+
export declare const singleOpenStrategy: TOpenStrategy;
|
|
24
|
+
export declare const multipleOpenStrategy: TOpenStrategy;
|
|
25
|
+
export declare const listOpenStrategy: TOpenStrategy;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare type TSelectStrategyFn = (data: {
|
|
2
|
+
id: unknown;
|
|
3
|
+
value: boolean;
|
|
4
|
+
selected: Map<unknown, 'on' | 'off' | 'indeterminate'>;
|
|
5
|
+
children: Map<unknown, unknown[]>;
|
|
6
|
+
parents: Map<unknown, unknown>;
|
|
7
|
+
event?: Event;
|
|
8
|
+
}) => Map<unknown, 'on' | 'off' | 'indeterminate'>;
|
|
9
|
+
export declare type TSelectStrategyTransformInFn = (value: unknown[] | undefined, children: Map<unknown, unknown[]>, parents: Map<unknown, unknown>) => Map<unknown, 'on' | 'off' | 'indeterminate'>;
|
|
10
|
+
export declare type TSelectStrategyTransformOutFn = (value: Map<unknown, 'on' | 'off' | 'indeterminate'>, children: Map<unknown, unknown[]>, parents: Map<unknown, unknown>) => unknown[];
|
|
11
|
+
export declare type TSelectStrategy = {
|
|
12
|
+
select: TSelectStrategyFn;
|
|
13
|
+
in: TSelectStrategyTransformInFn;
|
|
14
|
+
out: TSelectStrategyTransformOutFn;
|
|
15
|
+
};
|
|
16
|
+
export declare type TSelectStrategyProp = 'single-leaf' | 'leaf' | 'independent' | 'single-independent' | 'classic' | TSelectStrategyFn;
|
|
17
|
+
export declare const independentSelectStrategy: (required?: boolean) => TSelectStrategy;
|
|
18
|
+
export declare const independentSingleSelectStrategy: (required?: boolean) => TSelectStrategy;
|
|
19
|
+
export declare const leafSelectStrategy: (required?: boolean) => TSelectStrategy;
|
|
20
|
+
export declare const leafSingleSelectStrategy: (required?: boolean) => TSelectStrategy;
|
|
21
|
+
export declare const classicSelectStrategy: (required?: boolean) => TSelectStrategy;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
declare type InnerVal<T> = T extends any[] ? Readonly<T> : T;
|
|
3
|
+
export declare function useProxyModel<Props extends object & {
|
|
4
|
+
[key in Prop as `onUpdate:${Prop}`]?: ((val: any) => void) | undefined;
|
|
5
|
+
}, Prop extends Extract<keyof Props, string>, Inner = Props[Prop]>(props: Props, prop: Prop, defaultValue?: Props[Prop], transformIn?: (value?: Props[Prop]) => Inner, transformOut?: (value: Inner) => Props[Prop]): Ref<InnerVal<Inner>> & {
|
|
6
|
+
readonly externalValue: Props[Prop];
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
2
|
+
import type { MaybeRef } from '../utils';
|
|
3
|
+
export declare type TSize = typeof allowedSize[number];
|
|
4
|
+
export interface ISizeProps {
|
|
5
|
+
size: TSize;
|
|
6
|
+
}
|
|
7
|
+
export interface IUseSize {
|
|
8
|
+
sizeClasses: ComputedRef<string>;
|
|
9
|
+
}
|
|
10
|
+
export declare const allowedSize: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
11
|
+
export declare const makeSizeProps: <Defaults extends {
|
|
12
|
+
size?: unknown;
|
|
13
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
14
|
+
/**
|
|
15
|
+
* Размер
|
|
16
|
+
*/
|
|
17
|
+
size: {
|
|
18
|
+
type: PropType<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
19
|
+
default: string;
|
|
20
|
+
available: readonly ["xs", "sm", "md", "lg", "xl"];
|
|
21
|
+
validator: (value: TSize) => boolean;
|
|
22
|
+
};
|
|
23
|
+
}, Defaults>;
|
|
24
|
+
export declare function useSize(props: MaybeRef<ISizeProps>, name: string): IUseSize;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
2
|
+
export declare type TStatus = typeof allowedStatus[number];
|
|
3
|
+
export interface IStatusProps {
|
|
4
|
+
status: TStatus;
|
|
5
|
+
}
|
|
6
|
+
export interface IUseStatus {
|
|
7
|
+
statusClasses: ComputedRef<string>;
|
|
8
|
+
}
|
|
9
|
+
export declare const allowedStatus: readonly ["info", "success", "warning", "error", "progress"];
|
|
10
|
+
export declare const makeStatusProps: <Defaults extends {
|
|
11
|
+
status?: unknown;
|
|
12
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
13
|
+
status: {
|
|
14
|
+
type: PropType<"error" | "info" | "success" | "warning" | "progress">;
|
|
15
|
+
default: string;
|
|
16
|
+
available: readonly ["info", "success", "warning", "error", "progress"];
|
|
17
|
+
description: string;
|
|
18
|
+
validator: (value: TStatus) => boolean;
|
|
19
|
+
};
|
|
20
|
+
}, Defaults>;
|
|
21
|
+
export declare function useStatus(props: IStatusProps, name: string): IUseStatus;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
export interface ITagProps {
|
|
3
|
+
tag: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const makeTagProps: <Defaults extends {
|
|
6
|
+
tag?: unknown;
|
|
7
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
8
|
+
/**
|
|
9
|
+
* Пользовательский элемент для отображения
|
|
10
|
+
*/
|
|
11
|
+
tag: {
|
|
12
|
+
type: PropType<string>;
|
|
13
|
+
default: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
}, Defaults>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
export interface ITextProps {
|
|
3
|
+
text: string | undefined;
|
|
4
|
+
}
|
|
5
|
+
export interface IUseText {
|
|
6
|
+
}
|
|
7
|
+
export declare const makeTextProps: <Defaults extends {
|
|
8
|
+
text?: unknown;
|
|
9
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
10
|
+
/**
|
|
11
|
+
* Текст
|
|
12
|
+
*/
|
|
13
|
+
text: {
|
|
14
|
+
type: PropType<string>;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
}, Defaults>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
declare module '*.vue' {
|
|
5
|
+
import type { DefineComponent } from 'vue';
|
|
6
|
+
const component: DefineComponent<{}, {}, any>;
|
|
7
|
+
export default component;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ComponentObjectPropsOptions<P = Data> = {
|
|
11
|
+
[K in keyof P]: Prop<P[K]> | null;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Data = Record<string, unknown>;
|
|
15
|
+
type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
|
|
16
|
+
type DefaultFactory<T> = (props: Data) => T | null | undefined;
|
|
17
|
+
|
|
18
|
+
interface PropOptions<T = any, D = T> {
|
|
19
|
+
type?: PropType<T> | true | null;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
default?: D | DefaultFactory<D> | null | undefined | object;
|
|
22
|
+
available?: readonly string[] | readonly number[];
|
|
23
|
+
validator?(value: unknown): boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Prop } from 'vue';
|
|
2
|
+
export declare function createCssTransition(): void;
|
|
3
|
+
export declare function createJSTransition(name: string, functions: Record<string, any>, mode?: string): import("vue").DefineComponent<{
|
|
4
|
+
mode: Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
5
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
8
|
+
mode: Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
9
|
+
}>>, {}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface HTMLExpandElement extends HTMLElement {
|
|
2
|
+
_parent?: (Node & ParentNode & HTMLElement) | null;
|
|
3
|
+
_initialStyle?: {
|
|
4
|
+
transition: string;
|
|
5
|
+
overflow: string;
|
|
6
|
+
height?: string | null;
|
|
7
|
+
width?: string | null;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export default function (expandedParentClass?: string, x?: boolean): {
|
|
11
|
+
onBeforeEnter(el: HTMLExpandElement): void;
|
|
12
|
+
onEnter(el: HTMLExpandElement): void;
|
|
13
|
+
onAfterEnter: (el: HTMLExpandElement) => void;
|
|
14
|
+
onEnterCancelled: (el: HTMLExpandElement) => void;
|
|
15
|
+
onLeave(el: HTMLExpandElement): void;
|
|
16
|
+
onAfterLeave: (el: HTMLExpandElement) => void;
|
|
17
|
+
onLeaveCancelled: (el: HTMLExpandElement) => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CdsTransitionExpand: import("vue").DefineComponent<{
|
|
2
|
+
mode: import("vue").Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
3
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
6
|
+
mode: import("vue").Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
7
|
+
}>>, {}>;
|
|
8
|
+
export declare const CdsTransitionExpandX: import("vue").DefineComponent<{
|
|
9
|
+
mode: import("vue").Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
10
|
+
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
mode: import("vue").Prop<"default" | "in-out" | "out-in", "default" | "in-out" | "out-in">;
|
|
14
|
+
}>>, {}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IChangeCaseOptions {
|
|
2
|
+
splitRegexp?: RegExp | RegExp[];
|
|
3
|
+
stripRegexp?: RegExp | RegExp[];
|
|
4
|
+
delimiter?: string;
|
|
5
|
+
transform?: (part: string, index: number, parts: string[]) => string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Normalize the string into something other libraries can manipulate easier.
|
|
9
|
+
*/
|
|
10
|
+
export declare function noCase(input: string, options?: IChangeCaseOptions): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IChangeCaseOptions } from './noCase';
|
|
2
|
+
export type { IChangeCaseOptions };
|
|
3
|
+
export declare function pascalCaseTransform(input: string, index: number): string;
|
|
4
|
+
export declare function pascalCaseTransformMerge(input: string): string;
|
|
5
|
+
export declare function pascalCase(input: string, options?: IChangeCaseOptions): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentInternalInstance } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* This is a wrapper around Vue's getCurrentInstance
|
|
4
|
+
* WARNING! It's not a public API and can be removed in the future
|
|
5
|
+
* @param name
|
|
6
|
+
* @param message
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCurrentInstance(name: string, message?: string): ComponentInternalInstance;
|
|
9
|
+
export declare function getCurrentInstanceName(name?: string): string;
|
|
10
|
+
export declare function getUid(): number;
|
|
11
|
+
export declare namespace getUid {
|
|
12
|
+
var reset: () => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
export declare const keyCodes: Readonly<{
|
|
3
|
+
enter: 13;
|
|
4
|
+
tab: 9;
|
|
5
|
+
delete: 46;
|
|
6
|
+
esc: 27;
|
|
7
|
+
space: 32;
|
|
8
|
+
up: 38;
|
|
9
|
+
down: 40;
|
|
10
|
+
left: 37;
|
|
11
|
+
right: 39;
|
|
12
|
+
end: 35;
|
|
13
|
+
home: 36;
|
|
14
|
+
del: 46;
|
|
15
|
+
backspace: 8;
|
|
16
|
+
insert: 45;
|
|
17
|
+
pageup: 33;
|
|
18
|
+
pagedown: 34;
|
|
19
|
+
shift: 16;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const classesStates: Readonly<{
|
|
22
|
+
hover: "cds-state-hover";
|
|
23
|
+
focus: "cds-state-focus";
|
|
24
|
+
active: "cds-state-active";
|
|
25
|
+
visited: "cds-state-visited";
|
|
26
|
+
disabled: "cds-state-disabled";
|
|
27
|
+
checked: "cds-state-checked";
|
|
28
|
+
indeterminate: "cds-state-indeterminate";
|
|
29
|
+
invalid: "cds-state-invalid";
|
|
30
|
+
empty: "cds-state-empty";
|
|
31
|
+
loading: "cds-state-loading";
|
|
32
|
+
}>;
|
|
33
|
+
export declare function isObject(obj: any): obj is object;
|
|
34
|
+
export declare function mergeDeep(source?: Record<string, any>, target?: Record<string, any>, arrayFn?: (a: unknown[], b: unknown[]) => unknown[]): Record<string, any>;
|
|
35
|
+
export declare function getNestedValue(obj: any, path: (string | number)[], fallback?: any): any;
|
|
36
|
+
export declare function getObjectValueByPath(obj: any, path: string, fallback?: any): any;
|
|
37
|
+
export declare function getPropertyFromItem(item: any, property: SelectItemKey, fallback?: any): any;
|
|
38
|
+
/**
|
|
39
|
+
* @description This function is used to return a copy of the object that is composed of the picked object properties.
|
|
40
|
+
* @param obj
|
|
41
|
+
* @param paths
|
|
42
|
+
*/
|
|
43
|
+
export declare function pick<T extends object, U extends Extract<keyof T, string>>(obj: T, paths: U[]): [yes: MaybePick<T, U>, no: Omit<T, U>];
|
|
44
|
+
/**
|
|
45
|
+
* Types
|
|
46
|
+
*/
|
|
47
|
+
export declare type MaybeRef<T> = T | Ref<T>;
|
|
48
|
+
export declare type SelectItemKey = boolean | string | (string | number)[] | ((item: Record<string, any>, fallback?: any) => any);
|
|
49
|
+
export declare type MaybePick<T extends object, U extends Extract<keyof T, string>> = Record<string, unknown> extends T ? Partial<Pick<T, U>> : Pick<T, U>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
import type { Prop, ComponentObjectPropsOptions } from '../shims-vue';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a factory function for props definitions.
|
|
5
|
+
* This is used to define props in a composable then override
|
|
6
|
+
* default values in an implementing component.
|
|
7
|
+
*
|
|
8
|
+
* @example Simplified signature
|
|
9
|
+
* (props: Props) => (defaults?: Record<keyof props, any>) => Props
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* const makeProps = propsFactory({
|
|
13
|
+
* foo: String,
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* defineComponent({
|
|
17
|
+
* props: {
|
|
18
|
+
* ...makeProps({
|
|
19
|
+
* foo: 'a',
|
|
20
|
+
* }),
|
|
21
|
+
* },
|
|
22
|
+
* setup (props) {
|
|
23
|
+
* // would be "string | undefined", now "string" because a default has been provided
|
|
24
|
+
* props.foo
|
|
25
|
+
* },
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
export declare function propsFactory<PropsOptions extends ComponentObjectPropsOptions = ComponentObjectPropsOptions>(props: PropsOptions, source: string): <Defaults extends PartialKeys<PropsOptions> = {}>(defaults?: Defaults | undefined) => AppendDefault<PropsOptions, Defaults>;
|
|
29
|
+
export declare type AppendDefault<T extends ComponentObjectPropsOptions, D extends PartialKeys<T>> = {
|
|
30
|
+
[P in keyof T]-?: unknown extends D[P] ? T[P] : T[P] extends Record<string, unknown> ? Omit<T[P], 'type' | 'default'> & {
|
|
31
|
+
type: PropType<MergeDefaults<T[P], D[P]>>;
|
|
32
|
+
default: MergeDefaults<T[P], D[P]>;
|
|
33
|
+
} : {
|
|
34
|
+
type: PropType<MergeDefaults<T[P], D[P]>>;
|
|
35
|
+
default: MergeDefaults<T[P], D[P]>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare type MergeDefaults<T, D> = unknown extends D ? InferPropType<T> : NonNullable<InferPropType<T>> | D;
|
|
39
|
+
/**
|
|
40
|
+
* Like `Partial<T>` but doesn't care what the value is
|
|
41
|
+
*/
|
|
42
|
+
declare type PartialKeys<T> = {
|
|
43
|
+
[P in keyof T]?: unknown;
|
|
44
|
+
};
|
|
45
|
+
declare type InferPropType<T> = T extends null ? any : T extends {
|
|
46
|
+
type: null | true;
|
|
47
|
+
} ? any : T extends ObjectConstructor | {
|
|
48
|
+
type: ObjectConstructor;
|
|
49
|
+
} ? Record<string, any> : T extends BooleanConstructor | {
|
|
50
|
+
type: BooleanConstructor;
|
|
51
|
+
} ? boolean : T extends Prop<infer V, infer D> ? unknown extends V ? D : V : T;
|
|
52
|
+
export {};
|
package/nuxt.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineNuxtModule } from '@nuxt/kit';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
|
|
4
|
+
export default defineNuxtModule({
|
|
5
|
+
hooks: {
|
|
6
|
+
'components:dirs'(dirs) {
|
|
7
|
+
dirs.push({
|
|
8
|
+
path: fileURLToPath(new URL('./src/components', import.meta.url)),
|
|
9
|
+
extensions: ['vue']
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|