@central-design-system/components 3.0.0-alpha.0 → 3.0.0-alpha.2
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 -1
- package/dist/cds.d.ts +26 -3
- package/dist/cds.es.js +7821 -1449
- package/dist/cds.umd.js +1 -1
- package/dist/components/CdsBreadcrumbs/CdsBreadcrumbs.vue.d.ts +64 -0
- package/dist/components/CdsBreadcrumbs/CdsBreadcrumbsItem.vue.d.ts +54 -0
- package/dist/components/CdsBreadcrumbs/index.d.ts +2 -0
- package/dist/components/CdsButton/CdsButton.vue.d.ts +13 -13
- package/dist/components/CdsButton/index.d.ts +1 -0
- package/dist/components/CdsCheckbox/CdsCheckbox.vue.d.ts +238 -0
- package/dist/components/CdsCheckbox/CdsCheckboxGroup.vue.d.ts +227 -0
- package/dist/components/CdsCheckbox/index.d.ts +2 -0
- package/dist/components/CdsCombobox/CdsCombobox.vue.d.ts +2454 -0
- package/dist/components/CdsCombobox/composable/highlight.d.ts +12 -0
- package/dist/components/CdsDatePicker/CdsDatePicker.vue.d.ts +246 -0
- package/dist/components/CdsDatePicker/composable/calendar.d.ts +315 -0
- package/dist/components/CdsDatePicker/composable/index.d.ts +1 -0
- package/dist/components/CdsDrawer/CdsDrawer.vue.d.ts +4 -4
- package/dist/components/CdsDropdown/CdsDropdown.vue.d.ts +2317 -0
- package/dist/components/CdsEmptyState/CdsEmptyState.vue.d.ts +54 -0
- package/dist/components/CdsForm/CdsForm.vue.d.ts +99 -0
- package/dist/components/CdsGrid/CdsCol.vue.d.ts +1 -1
- package/dist/components/CdsIcon/CdsIcon.vue.d.ts +4 -4
- package/dist/components/CdsInput/CdsInput.vue.d.ts +219 -0
- package/dist/components/CdsInput/CdsInputCounter.vue.d.ts +39 -0
- package/dist/components/CdsInput/CdsInputDescription.vue.d.ts +26 -0
- package/dist/components/CdsInput/CdsInputLabel.vue.d.ts +32 -0
- package/dist/components/CdsInput/CdsInputMessages.vue.d.ts +221 -0
- package/dist/components/CdsInput/index.d.ts +5 -0
- package/dist/components/CdsLink/CdsLink.vue.d.ts +1 -1
- package/dist/components/CdsLink/index.d.ts +1 -0
- package/dist/components/CdsList/CdsList.vue.d.ts +20 -24
- package/dist/components/CdsList/CdsListGroup.vue.d.ts +7 -7
- package/dist/components/CdsList/CdsListItem.vue.d.ts +27 -24
- package/dist/components/CdsList/composable/focus.d.ts +12 -0
- package/dist/components/CdsList/composable/index.d.ts +1 -0
- package/dist/components/CdsList/composable/list.d.ts +1 -1
- package/dist/components/CdsLoader/CdsLoader.vue.d.ts +1 -1
- package/dist/components/CdsMenu/CdsMenu.vue.d.ts +681 -0
- package/dist/components/CdsMenu/index.d.ts +1 -0
- package/dist/components/CdsMenu/shared.d.ts +10 -0
- package/dist/components/CdsOverlay/CdsOverlay.vue.d.ts +337 -0
- package/dist/components/CdsOverlay/composable/activator.d.ts +81 -0
- package/dist/components/CdsOverlay/composable/index.d.ts +6 -0
- package/dist/components/CdsOverlay/composable/locationStrategies.d.ts +75 -0
- package/dist/components/CdsOverlay/composable/scrim.d.ts +8 -0
- package/dist/components/CdsOverlay/composable/scrollStrategies.d.ts +33 -0
- package/dist/components/CdsOverlay/composable/stack.d.ts +9 -0
- package/dist/components/CdsOverlay/composable/teleport.d.ts +6 -0
- package/dist/components/CdsOverlay/index.d.ts +1 -0
- package/dist/components/CdsOverlay/utils/index.d.ts +2 -0
- package/dist/components/CdsOverlay/utils/point.d.ts +20 -0
- package/dist/components/CdsOverlay/utils/requestNewFrame.d.ts +5 -0
- package/dist/components/CdsRadioButton/CdsRadio.vue.d.ts +223 -0
- package/dist/components/CdsRadioButton/CdsRadioButton.vue.d.ts +222 -0
- package/dist/components/CdsSelect/CdsSelect.vue.d.ts +722 -0
- package/dist/components/CdsSidebar/CdsSidebar.vue.d.ts +56 -0
- package/dist/components/CdsStages/CdsStages.vue.d.ts +102 -0
- package/dist/components/CdsTag/CdsTag.vue.d.ts +2 -4
- package/dist/components/CdsTag/index.d.ts +1 -0
- package/dist/components/CdsTextArea/CdsTextArea.vue.d.ts +723 -0
- package/dist/components/CdsTextInput/CdsTextInput.vue.d.ts +660 -0
- package/dist/components/CdsTextInput/index.d.ts +1 -0
- package/dist/components/index.d.ts +24 -1
- package/dist/composable/color.d.ts +4 -2
- package/dist/composable/datetime.d.ts +76 -0
- package/dist/composable/delay.d.ts +29 -0
- package/dist/composable/dimensions.d.ts +47 -0
- package/dist/composable/direction.d.ts +24 -0
- package/dist/composable/field.d.ts +139 -0
- package/dist/composable/filter.d.ts +52 -0
- package/dist/composable/focus.d.ts +19 -9
- package/dist/composable/form.d.ts +128 -0
- package/dist/composable/hidration.d.ts +2 -0
- package/dist/composable/icon.d.ts +29 -4
- package/dist/composable/index.d.ts +18 -0
- package/dist/composable/input.d.ts +99 -0
- package/dist/composable/items.d.ts +12 -9
- package/dist/composable/lazy.d.ts +21 -0
- package/dist/composable/link.d.ts +1 -2
- package/dist/composable/loading.d.ts +1 -0
- package/dist/composable/menu.d.ts +37 -0
- package/dist/composable/nested/nested.d.ts +2 -2
- package/dist/composable/overlay.d.ts +98 -0
- package/dist/composable/router.d.ts +3 -0
- package/dist/composable/scopeId.d.ts +5 -0
- package/dist/composable/select.d.ts +86 -0
- package/dist/composable/title.d.ts +21 -0
- package/dist/composable/transition.d.ts +22 -0
- package/dist/composable/validation.d.ts +128 -0
- package/dist/directives/click-outside/index.d.ts +14 -0
- package/dist/directives/index.d.ts +1 -2
- package/dist/globals.d.ts +16 -0
- package/dist/locale/index.d.ts +12 -0
- package/dist/locale/ru.d.ts +3 -0
- package/dist/transitions/createTransition.d.ts +31 -2
- package/dist/transitions/index.d.ts +240 -0
- package/dist/utils/anchor.d.ts +23 -0
- package/dist/utils/animation.d.ts +6 -0
- package/dist/utils/box.d.ts +26 -0
- package/dist/utils/cache.d.ts +4 -0
- package/dist/utils/date.d.ts +181 -0
- package/dist/utils/dom.d.ts +6 -0
- package/dist/utils/getScrollParent.d.ts +3 -0
- package/dist/utils/globals.d.ts +4 -0
- package/dist/utils/helpers.d.ts +93 -20
- package/dist/utils/index.d.ts +8 -0
- package/package.json +5 -4
- package/src/scss/mixins/layout/_shadow.scss +4 -0
- package/src/scss/mixins/layout/index.scss +1 -0
- package/src/scss/modules/_transition.scss +133 -3
- package/src/scss/themes/index.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CdsTextInput } from './CdsTextInput.vue';
|
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Automatically generated by CDS CLI
|
|
3
|
-
* Generated on
|
|
3
|
+
* Generated on 5/10/2023, 7:16:03 PM
|
|
4
4
|
**/
|
|
5
5
|
export { default as CdsBadge } from './CdsBadge/CdsBadge.vue';
|
|
6
|
+
export { default as CdsBreadcrumbs } from './CdsBreadcrumbs/CdsBreadcrumbs.vue';
|
|
7
|
+
export { default as CdsBreadcrumbsItem } from './CdsBreadcrumbs/CdsBreadcrumbsItem.vue';
|
|
6
8
|
export { default as CdsButton } from './CdsButton/CdsButton.vue';
|
|
9
|
+
export { default as CdsCheckbox } from './CdsCheckbox/CdsCheckbox.vue';
|
|
10
|
+
export { default as CdsCheckboxGroup } from './CdsCheckbox/CdsCheckboxGroup.vue';
|
|
11
|
+
export { default as CdsCombobox } from './CdsCombobox/CdsCombobox.vue';
|
|
12
|
+
export { default as CdsDatePicker } from './CdsDatePicker/CdsDatePicker.vue';
|
|
7
13
|
export { default as CdsDrawer } from './CdsDrawer/CdsDrawer.vue';
|
|
14
|
+
export { default as CdsDropdown } from './CdsDropdown/CdsDropdown.vue';
|
|
15
|
+
export { default as CdsEmptyState } from './CdsEmptyState/CdsEmptyState.vue';
|
|
16
|
+
export { default as CdsForm } from './CdsForm/CdsForm.vue';
|
|
8
17
|
export { default as CdsCol } from './CdsGrid/CdsCol.vue';
|
|
9
18
|
export { default as CdsGrid } from './CdsGrid/CdsGrid.vue';
|
|
10
19
|
export { default as CdsRow } from './CdsGrid/CdsRow.vue';
|
|
11
20
|
export { default as CdsIcon } from './CdsIcon/CdsIcon.vue';
|
|
21
|
+
export { default as CdsInput } from './CdsInput/CdsInput.vue';
|
|
22
|
+
export { default as CdsInputCounter } from './CdsInput/CdsInputCounter.vue';
|
|
23
|
+
export { default as CdsInputDescription } from './CdsInput/CdsInputDescription.vue';
|
|
24
|
+
export { default as CdsInputLabel } from './CdsInput/CdsInputLabel.vue';
|
|
25
|
+
export { default as CdsInputMessages } from './CdsInput/CdsInputMessages.vue';
|
|
12
26
|
export { default as CdsLink } from './CdsLink/CdsLink.vue';
|
|
13
27
|
export { default as CdsList } from './CdsList/CdsList.vue';
|
|
14
28
|
export { default as CdsListGroup } from './CdsList/CdsListGroup.vue';
|
|
15
29
|
export { default as CdsListItem } from './CdsList/CdsListItem.vue';
|
|
16
30
|
export { default as CdsLoader } from './CdsLoader/CdsLoader.vue';
|
|
31
|
+
export { default as CdsMenu } from './CdsMenu/CdsMenu.vue';
|
|
32
|
+
export { default as CdsOverlay } from './CdsOverlay/CdsOverlay.vue';
|
|
33
|
+
export { default as CdsRadio } from './CdsRadioButton/CdsRadio.vue';
|
|
34
|
+
export { default as CdsRadioButton } from './CdsRadioButton/CdsRadioButton.vue';
|
|
35
|
+
export { default as CdsSelect } from './CdsSelect/CdsSelect.vue';
|
|
36
|
+
export { default as CdsSidebar } from './CdsSidebar/CdsSidebar.vue';
|
|
37
|
+
export { default as CdsStages } from './CdsStages/CdsStages.vue';
|
|
17
38
|
export { default as CdsStatus } from './CdsStatus/CdsStatus.vue';
|
|
18
39
|
export { default as CdsTag } from './CdsTag/CdsTag.vue';
|
|
40
|
+
export { default as CdsTextArea } from './CdsTextArea/CdsTextArea.vue';
|
|
41
|
+
export { default as CdsTextInput } from './CdsTextInput/CdsTextInput.vue';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComputedRef, PropType } from 'vue';
|
|
1
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
2
2
|
export declare type TColor = typeof allowedColor[number];
|
|
3
3
|
export declare type IColorProps = {
|
|
4
4
|
color: TColor | undefined;
|
|
@@ -10,11 +10,13 @@ export declare const allowedColor: readonly ["yellow", "light-blue", "blue", "de
|
|
|
10
10
|
export declare const makeColorProps: <Defaults extends {
|
|
11
11
|
color?: unknown;
|
|
12
12
|
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
13
|
+
/**
|
|
14
|
+
* Цвет
|
|
15
|
+
*/
|
|
13
16
|
color: {
|
|
14
17
|
type: PropType<"yellow" | "light-blue" | "blue" | "deep-purple" | "purple" | "pink">;
|
|
15
18
|
available: readonly ["yellow", "light-blue", "blue", "deep-purple", "purple", "pink"];
|
|
16
19
|
default: undefined;
|
|
17
|
-
description: string;
|
|
18
20
|
validator: (value: TColor) => boolean;
|
|
19
21
|
};
|
|
20
22
|
}, Defaults>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { IRawDate, TDateLocale } from '../utils';
|
|
2
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
3
|
+
export interface IDatetimeProps {
|
|
4
|
+
modelValue: string | TDatetimeValueRange | Array<string | TDatetimeValueRange>;
|
|
5
|
+
mask: string;
|
|
6
|
+
locale: TDateLocale;
|
|
7
|
+
readonly: boolean;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IUseDatetime {
|
|
11
|
+
editable: ComputedRef<boolean>;
|
|
12
|
+
tabindex: ComputedRef<number>;
|
|
13
|
+
getCurrentDate: (dateOnly?: boolean) => IRawDate;
|
|
14
|
+
getShortDate: (date: IRawDate) => Partial<IRawDate>;
|
|
15
|
+
getLocale: () => TDateLocale;
|
|
16
|
+
getMask: () => string;
|
|
17
|
+
decodeString: (date: string) => IRawDate;
|
|
18
|
+
}
|
|
19
|
+
export declare type TDatetimeValueRange = {
|
|
20
|
+
from: string | IRawDate;
|
|
21
|
+
to: string | IRawDate;
|
|
22
|
+
target?: string | IRawDate;
|
|
23
|
+
};
|
|
24
|
+
export declare const makeDatetimeProps: <Defaults extends {
|
|
25
|
+
modelValue?: unknown;
|
|
26
|
+
mask?: unknown;
|
|
27
|
+
locale?: unknown;
|
|
28
|
+
readonly?: unknown;
|
|
29
|
+
disabled?: unknown;
|
|
30
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
31
|
+
/**
|
|
32
|
+
* Значение модели
|
|
33
|
+
*/
|
|
34
|
+
modelValue: {
|
|
35
|
+
type: PropType<string | TDatetimeValueRange | (string | TDatetimeValueRange)[]>;
|
|
36
|
+
default: null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Формат даты/времени
|
|
40
|
+
*/
|
|
41
|
+
mask: {
|
|
42
|
+
type: PropType<string>;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Локализация компонента
|
|
47
|
+
*/
|
|
48
|
+
locale: {
|
|
49
|
+
type: PropType<{
|
|
50
|
+
days: string[];
|
|
51
|
+
daysShort: string[];
|
|
52
|
+
months: string[];
|
|
53
|
+
monthsLong: string[];
|
|
54
|
+
monthsShort: string[];
|
|
55
|
+
firstDayOfWeek: number;
|
|
56
|
+
format24h: boolean;
|
|
57
|
+
pluralDay: (day?: number | undefined) => string;
|
|
58
|
+
}>;
|
|
59
|
+
default: null;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Только для чтения
|
|
63
|
+
*/
|
|
64
|
+
readonly: {
|
|
65
|
+
type: PropType<boolean>;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Заблокированный
|
|
70
|
+
*/
|
|
71
|
+
disabled: {
|
|
72
|
+
type: PropType<boolean>;
|
|
73
|
+
default: boolean;
|
|
74
|
+
};
|
|
75
|
+
}, Defaults>;
|
|
76
|
+
export declare function useDatetime(props: IDatetimeProps): IUseDatetime;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
export interface IDelayProps {
|
|
3
|
+
closeDelay: number | string;
|
|
4
|
+
openDelay: number | string;
|
|
5
|
+
}
|
|
6
|
+
export interface IUseDelay {
|
|
7
|
+
runCloseDelay: () => void;
|
|
8
|
+
runOpenDelay: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const makeDelayProps: <Defaults extends {
|
|
11
|
+
closeDelay?: unknown;
|
|
12
|
+
openDelay?: unknown;
|
|
13
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
14
|
+
/**
|
|
15
|
+
* Задержка в миллисекундах перед закрытием оверлея. Только для события hover и focus.
|
|
16
|
+
*/
|
|
17
|
+
closeDelay: {
|
|
18
|
+
type: PropType<string | number>;
|
|
19
|
+
default: null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Задержка в миллисекундах перед открытием оверлея. Только для события hover и focus.
|
|
23
|
+
*/
|
|
24
|
+
openDelay: {
|
|
25
|
+
type: PropType<string | number>;
|
|
26
|
+
default: null;
|
|
27
|
+
};
|
|
28
|
+
}, Defaults>;
|
|
29
|
+
export declare function useDelay(props: IDelayProps, cb?: (value: boolean) => void): IUseDelay;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
export interface IDimensionsProps {
|
|
4
|
+
height: number | string;
|
|
5
|
+
maxHeight: number | string;
|
|
6
|
+
maxWidth: number | string;
|
|
7
|
+
minHeight: number | string;
|
|
8
|
+
minWidth: number | string;
|
|
9
|
+
width: number | string;
|
|
10
|
+
}
|
|
11
|
+
export interface IUseDimensions {
|
|
12
|
+
dimensionsStyles: ComputedRef<Record<string, any>>;
|
|
13
|
+
}
|
|
14
|
+
export declare const makeDimensionProps: <Defaults extends {
|
|
15
|
+
height?: unknown;
|
|
16
|
+
maxHeight?: unknown;
|
|
17
|
+
maxWidth?: unknown;
|
|
18
|
+
minHeight?: unknown;
|
|
19
|
+
minWidth?: unknown;
|
|
20
|
+
width?: unknown;
|
|
21
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
22
|
+
height: {
|
|
23
|
+
type: PropType<string | number>;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
maxHeight: {
|
|
27
|
+
type: PropType<string | number>;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
maxWidth: {
|
|
31
|
+
type: PropType<string | number>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
minHeight: {
|
|
35
|
+
type: PropType<string | number>;
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
minWidth: {
|
|
39
|
+
type: PropType<string | number>;
|
|
40
|
+
default: string;
|
|
41
|
+
};
|
|
42
|
+
width: {
|
|
43
|
+
type: PropType<string | number>;
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
46
|
+
}, Defaults>;
|
|
47
|
+
export declare function useDimensions(props: IDimensionsProps): IUseDimensions;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
2
|
+
import type { MaybeRef } from '../utils';
|
|
3
|
+
export declare type TDirection = typeof allowedDirection[number];
|
|
4
|
+
export interface IDirectionProps {
|
|
5
|
+
direction: TDirection;
|
|
6
|
+
}
|
|
7
|
+
export interface IUseDirection {
|
|
8
|
+
directionClasses: ComputedRef<string>;
|
|
9
|
+
}
|
|
10
|
+
export declare const allowedDirection: readonly ["horizontal", "vertical"];
|
|
11
|
+
export declare const makeDirectionProps: <Defaults extends {
|
|
12
|
+
direction?: unknown;
|
|
13
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
14
|
+
/**
|
|
15
|
+
* Расположение горизонтальное или вертикальное
|
|
16
|
+
*/
|
|
17
|
+
direction: {
|
|
18
|
+
type: PropType<"horizontal" | "vertical">;
|
|
19
|
+
default: string;
|
|
20
|
+
available: readonly ["horizontal", "vertical"];
|
|
21
|
+
validator: (value: TDirection) => boolean;
|
|
22
|
+
};
|
|
23
|
+
}, Defaults>;
|
|
24
|
+
export declare function useDirection(props: MaybeRef<IDirectionProps>, name: string): IUseDirection;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { ComputedRef, PropType } from 'vue';
|
|
2
|
+
import type { EventProp } from '../utils';
|
|
3
|
+
import type { TCdsIconsName } from '@central-design-system/icons';
|
|
4
|
+
export declare type TFieldTypes = typeof allowedFieldType[number];
|
|
5
|
+
export interface IFieldProps {
|
|
6
|
+
active: boolean;
|
|
7
|
+
autofocus: boolean;
|
|
8
|
+
prefix: string | undefined;
|
|
9
|
+
suffix: string | undefined;
|
|
10
|
+
prependInnerIcon: TCdsIconsName | undefined;
|
|
11
|
+
appendInnerIcon: TCdsIconsName | undefined;
|
|
12
|
+
type: TFieldTypes | undefined;
|
|
13
|
+
placeholder: string | undefined;
|
|
14
|
+
counter: boolean;
|
|
15
|
+
limit: number | undefined;
|
|
16
|
+
clearable: boolean;
|
|
17
|
+
'onClick:appendInner': EventProp | undefined;
|
|
18
|
+
'onClick:prependInner': EventProp | undefined;
|
|
19
|
+
}
|
|
20
|
+
export interface IUseField {
|
|
21
|
+
hasPrependInnerIcon: ComputedRef<boolean>;
|
|
22
|
+
hasAppendInnerIcon: ComputedRef<boolean>;
|
|
23
|
+
fieldClasses: ComputedRef<Record<string, boolean>>;
|
|
24
|
+
fieldProps: string[];
|
|
25
|
+
handleClickPrependInner: (event: MouseEvent) => void;
|
|
26
|
+
handleClickAppendInner: (event: MouseEvent) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare const allowedFieldType: readonly ["text", "password", "email", "number", "tel", "url"];
|
|
29
|
+
export declare const makeFieldProps: <Defaults extends {
|
|
30
|
+
active?: unknown;
|
|
31
|
+
autofocus?: unknown;
|
|
32
|
+
prefix?: unknown;
|
|
33
|
+
suffix?: unknown;
|
|
34
|
+
prependInnerIcon?: unknown;
|
|
35
|
+
appendInnerIcon?: unknown;
|
|
36
|
+
type?: unknown;
|
|
37
|
+
placeholder?: unknown;
|
|
38
|
+
counter?: unknown;
|
|
39
|
+
limit?: unknown;
|
|
40
|
+
clearable?: unknown;
|
|
41
|
+
'onClick:prependInner'?: unknown;
|
|
42
|
+
'onClick:appendInner'?: unknown;
|
|
43
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
44
|
+
/**
|
|
45
|
+
* Активный элемент
|
|
46
|
+
*/
|
|
47
|
+
active: {
|
|
48
|
+
type: PropType<boolean>;
|
|
49
|
+
default: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Автофокус
|
|
53
|
+
*/
|
|
54
|
+
autofocus: {
|
|
55
|
+
type: PropType<boolean>;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Добавить строку внутрь поля перед значением
|
|
60
|
+
*/
|
|
61
|
+
prefix: {
|
|
62
|
+
type: PropType<string>;
|
|
63
|
+
default: undefined;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Добавить строку внутрь поля после значения
|
|
67
|
+
*/
|
|
68
|
+
suffix: {
|
|
69
|
+
type: PropType<string>;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Иконка внутри элемента перед значением поля
|
|
74
|
+
*/
|
|
75
|
+
prependInnerIcon: {
|
|
76
|
+
type: PropType<"link" | "filters" | "search" | "add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "save" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
|
|
77
|
+
default: undefined;
|
|
78
|
+
validator: (value: TCdsIconsName) => boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Иконка внутри элемента после значения поля
|
|
82
|
+
*/
|
|
83
|
+
appendInnerIcon: {
|
|
84
|
+
type: PropType<"link" | "filters" | "search" | "add" | "alert-fill" | "alert" | "analog" | "arrow-down" | "arrow-left-bottom" | "arrow-left-top" | "arrow-left" | "arrow-right-bottom" | "arrow-right-top" | "arrow-right" | "arrow-up" | "arrows-vertical" | "calendar" | "card-bank" | "category" | "check-fill" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "chevron-up" | "chocolate-menu" | "clock" | "comment" | "company" | "compare" | "copy" | "data-cards" | "delete" | "directory" | "doc-download" | "doc" | "download" | "draggable" | "edit" | "enter" | "error-fill" | "error" | "external" | "facebook-fill" | "facebook" | "flag" | "globe" | "infinity" | "info-fill" | "info" | "list-search" | "list" | "loader" | "location" | "locked" | "login" | "logout" | "menu" | "minus" | "notification" | "overflow-menu-horizontal" | "overflow-menu-vertical" | "password" | "pin" | "plus" | "printer" | "question-fill" | "question" | "refresh" | "remove" | "sandglass" | "save" | "settings" | "shopping-cart" | "sort-date" | "star-fill" | "star" | "telegram" | "timer" | "tool" | "truck" | "unlocked" | "upload" | "user-avatar" | "user-group" | "visibility-off" | "visibility-on" | "vk" | "winner" | "workspace" | "youtube">;
|
|
85
|
+
default: undefined;
|
|
86
|
+
validator: (value: TCdsIconsName) => boolean;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Тип поля
|
|
90
|
+
*/
|
|
91
|
+
type: {
|
|
92
|
+
type: PropType<"number" | "text" | "password" | "email" | "tel" | "url">;
|
|
93
|
+
default: string;
|
|
94
|
+
validator: (value: TFieldTypes) => boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Плейсхолдер поля
|
|
98
|
+
*/
|
|
99
|
+
placeholder: {
|
|
100
|
+
type: PropType<string>;
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Счетчик введенных символов
|
|
105
|
+
*/
|
|
106
|
+
counter: {
|
|
107
|
+
type: PropType<boolean>;
|
|
108
|
+
default: boolean;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Ограничение ввода по количеству символов
|
|
112
|
+
*/
|
|
113
|
+
limit: {
|
|
114
|
+
type: PropType<number>;
|
|
115
|
+
default: undefined;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Очищаемое поле
|
|
119
|
+
*/
|
|
120
|
+
clearable: {
|
|
121
|
+
type: PropType<boolean>;
|
|
122
|
+
default: boolean;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Событие клика по иконке внутри элемента перед значением поля
|
|
126
|
+
*/
|
|
127
|
+
'onClick:prependInner': {
|
|
128
|
+
type: PropType<(...args: any[]) => any>;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Событие клика по иконке внутри элемента после значения поля
|
|
133
|
+
*/
|
|
134
|
+
'onClick:appendInner': {
|
|
135
|
+
type: PropType<(...args: any[]) => any>;
|
|
136
|
+
default: undefined;
|
|
137
|
+
};
|
|
138
|
+
}, Defaults>;
|
|
139
|
+
export declare function useField(props: IFieldProps, slots: Record<string, unknown>, name: string): IUseField;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IInternalItem } from './items';
|
|
2
|
+
import type { MaybeRef } from '../utils';
|
|
3
|
+
import type { PropType, Ref } from 'vue';
|
|
4
|
+
export declare type TFilterMath = boolean | number | [number, number] | [number, number][];
|
|
5
|
+
export interface IFilterProps {
|
|
6
|
+
customFilter?: TFilterFunction;
|
|
7
|
+
customKeyFilter?: TFilterKeyFunctions;
|
|
8
|
+
filterKeys?: TFilterKeys;
|
|
9
|
+
filterMode?: TFilterMode;
|
|
10
|
+
noFilter?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface IUseFilter<T> {
|
|
13
|
+
getMatches: (item: T) => Record<string, TFilterMath> | undefined;
|
|
14
|
+
filteredItems: Ref<T[]>;
|
|
15
|
+
filteredMatches: Ref<Map<unknown, Record<string, TFilterMath>>>;
|
|
16
|
+
}
|
|
17
|
+
export declare const makeFilterProps: <Defaults extends {
|
|
18
|
+
customFilter?: unknown;
|
|
19
|
+
customKeyFilter?: unknown;
|
|
20
|
+
filterKeys?: unknown;
|
|
21
|
+
filterMode?: unknown;
|
|
22
|
+
noFilter?: unknown;
|
|
23
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
24
|
+
customFilter: {
|
|
25
|
+
type: PropType<TFilterFunction>;
|
|
26
|
+
default: null;
|
|
27
|
+
};
|
|
28
|
+
customKeyFilter: {
|
|
29
|
+
type: PropType<TFilterKeyFunctions>;
|
|
30
|
+
default: null;
|
|
31
|
+
};
|
|
32
|
+
filterKeys: {
|
|
33
|
+
type: PropType<TFilterKeys>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
filterMode: {
|
|
37
|
+
type: PropType<TFilterMode>;
|
|
38
|
+
default: string;
|
|
39
|
+
};
|
|
40
|
+
noFilter: {
|
|
41
|
+
type: PropType<boolean>;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
}, Defaults>;
|
|
45
|
+
export declare function useFilter<T extends IInternalItem>(props: IFilterProps, items: MaybeRef<T[]>, query: Ref<string | number | undefined>, options?: {
|
|
46
|
+
filterKeys?: MaybeRef<TFilterKeys>;
|
|
47
|
+
}): IUseFilter<T>;
|
|
48
|
+
declare type TFilterFunction = (value: string, query: string, item?: any) => TFilterMath;
|
|
49
|
+
declare type TFilterKeyFunctions = Record<string, TFilterFunction>;
|
|
50
|
+
declare type TFilterKeys = string | string[];
|
|
51
|
+
declare type TFilterMode = 'some' | 'every' | 'union' | 'intersection';
|
|
52
|
+
export {};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import type { Ref } from 'vue';
|
|
2
|
-
export
|
|
1
|
+
import type { ComputedRef, PropType, Ref } from 'vue';
|
|
2
|
+
export interface IFocusProps {
|
|
3
|
+
focused: boolean;
|
|
4
|
+
}
|
|
3
5
|
export interface IUseFocus {
|
|
4
|
-
contentRef: Ref<HTMLElement | null>;
|
|
5
6
|
isFocused: Ref<boolean>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
onKeydown: (event: KeyboardEvent) => void;
|
|
10
|
-
focus: (location?: TFocusLocation) => void;
|
|
7
|
+
focusClasses: ComputedRef<Record<string, boolean>>;
|
|
8
|
+
focus: () => void;
|
|
9
|
+
blur: () => void;
|
|
11
10
|
}
|
|
12
|
-
export declare
|
|
11
|
+
export declare const makeFocusProps: <Defaults extends {
|
|
12
|
+
focused?: unknown;
|
|
13
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
14
|
+
/**
|
|
15
|
+
* Элемент в фокусе
|
|
16
|
+
*/
|
|
17
|
+
focused: {
|
|
18
|
+
type: PropType<boolean>;
|
|
19
|
+
default: boolean;
|
|
20
|
+
};
|
|
21
|
+
}, Defaults>;
|
|
22
|
+
export declare function useFocus(props: IFocusProps, name: string): IUseFocus;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import type { Ref, ComputedRef, PropType } from 'vue';
|
|
3
|
+
import type { IValidationProps } from './validation';
|
|
4
|
+
export interface IFormProvide {
|
|
5
|
+
register: (item: {
|
|
6
|
+
id: number | string;
|
|
7
|
+
validate: () => Promise<string[]>;
|
|
8
|
+
reset: () => void;
|
|
9
|
+
resetValidation: () => void;
|
|
10
|
+
}) => void;
|
|
11
|
+
unregister: (id: number | string) => void;
|
|
12
|
+
update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void;
|
|
13
|
+
items: Ref<IFormField[]>;
|
|
14
|
+
isDisabled: ComputedRef<boolean>;
|
|
15
|
+
isReadonly: ComputedRef<boolean>;
|
|
16
|
+
isValidating: Ref<boolean>;
|
|
17
|
+
validateOn: Ref<IFormProps['validateOn']>;
|
|
18
|
+
}
|
|
19
|
+
export interface IFormProps {
|
|
20
|
+
label: string;
|
|
21
|
+
description: string;
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
readonly: boolean;
|
|
24
|
+
firstFail: boolean;
|
|
25
|
+
modelValue: boolean | null;
|
|
26
|
+
validateOn?: IValidationProps['validateOn'];
|
|
27
|
+
}
|
|
28
|
+
interface IFormField {
|
|
29
|
+
id: number | string;
|
|
30
|
+
validate: () => Promise<string[]>;
|
|
31
|
+
reset: () => void;
|
|
32
|
+
resetValidation: () => void;
|
|
33
|
+
isValid: boolean | null;
|
|
34
|
+
errorMessages: string[];
|
|
35
|
+
}
|
|
36
|
+
interface IFieldValidationResult {
|
|
37
|
+
id: number | string;
|
|
38
|
+
errorMessages: string[];
|
|
39
|
+
}
|
|
40
|
+
interface IFormValidationResult {
|
|
41
|
+
valid: boolean;
|
|
42
|
+
errors: IFieldValidationResult[];
|
|
43
|
+
}
|
|
44
|
+
export interface SubmitEventPromise extends SubmitEvent, Promise<IFormValidationResult> {
|
|
45
|
+
}
|
|
46
|
+
export declare const makeFormProps: <Defaults extends {
|
|
47
|
+
label?: unknown;
|
|
48
|
+
description?: unknown;
|
|
49
|
+
disabled?: unknown;
|
|
50
|
+
readonly?: unknown;
|
|
51
|
+
firstFail?: unknown;
|
|
52
|
+
modelValue?: unknown;
|
|
53
|
+
validateOn?: unknown;
|
|
54
|
+
} = {}>(defaults?: Defaults | undefined) => import('../utils').AppendDefault<{
|
|
55
|
+
/**
|
|
56
|
+
* Заголовок формы
|
|
57
|
+
*/
|
|
58
|
+
label: {
|
|
59
|
+
type: PropType<string>;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Описание формы
|
|
64
|
+
*/
|
|
65
|
+
description: {
|
|
66
|
+
type: PropType<string>;
|
|
67
|
+
default: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Заблокировать форму
|
|
71
|
+
*/
|
|
72
|
+
disabled: {
|
|
73
|
+
type: PropType<boolean>;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Сделать форму только для чтения
|
|
78
|
+
*/
|
|
79
|
+
readonly: {
|
|
80
|
+
type: PropType<boolean>;
|
|
81
|
+
default: boolean;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Остановить валидацию при первой ошибке
|
|
85
|
+
*/
|
|
86
|
+
firstFail: {
|
|
87
|
+
type: PropType<boolean>;
|
|
88
|
+
default: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Значение модели
|
|
92
|
+
*/
|
|
93
|
+
modelValue: {
|
|
94
|
+
type: PropType<boolean | null>;
|
|
95
|
+
default: null;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Событие для валидации
|
|
99
|
+
*/
|
|
100
|
+
validateOn: {
|
|
101
|
+
type: PropType<"input" | "blur" | "submit" | undefined>;
|
|
102
|
+
default: string;
|
|
103
|
+
};
|
|
104
|
+
}, Defaults>;
|
|
105
|
+
export declare const FormKey: InjectionKey<IFormProvide>;
|
|
106
|
+
export declare function createForm(props: IFormProps): {
|
|
107
|
+
errors: Ref<{
|
|
108
|
+
id: string | number;
|
|
109
|
+
errorMessages: string[];
|
|
110
|
+
}[]>;
|
|
111
|
+
isDisabled: ComputedRef<boolean>;
|
|
112
|
+
isReadonly: ComputedRef<boolean>;
|
|
113
|
+
isValidating: Ref<boolean>;
|
|
114
|
+
model: Ref<boolean | null> & {
|
|
115
|
+
readonly externalValue: boolean | null;
|
|
116
|
+
};
|
|
117
|
+
validate: () => Promise<{
|
|
118
|
+
valid: boolean;
|
|
119
|
+
errors: {
|
|
120
|
+
id: string | number;
|
|
121
|
+
errorMessages: string[];
|
|
122
|
+
}[];
|
|
123
|
+
}>;
|
|
124
|
+
reset: () => void;
|
|
125
|
+
resetValidation: () => void;
|
|
126
|
+
};
|
|
127
|
+
export declare function useForm(): IFormProvide | null;
|
|
128
|
+
export {};
|