@component-hook/picker 0.2.5 → 1.0.0-alpha.1

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.
@@ -1,78 +1,211 @@
1
1
  import { ComponentOptionsMixin } from 'vue';
2
2
  import { ComponentProvideOptions } from 'vue';
3
+ import { CreateComponentPublicInstanceWithMixins } from 'vue';
3
4
  import { DefineComponent } from 'vue';
5
+ import { GlobalComponents } from 'vue';
6
+ import { GlobalDirectives } from 'vue';
7
+ import { Props as Props_2 } from './PickerColumn.vue';
4
8
  import { PublicProps } from 'vue';
5
9
 
6
- declare type __VLS_Props = PickerComponentProps;
7
-
8
- declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
9
- "update:isShowPicker": (...args: any[]) => void;
10
- "update:anchor": (...args: any[]) => void;
11
- cancel: (...args: any[]) => void;
12
- confirm: (...args: any[]) => void;
13
- }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
14
- "onUpdate:isShowPicker"?: ((...args: any[]) => any) | undefined;
15
- "onUpdate:anchor"?: ((...args: any[]) => any) | undefined;
16
- onCancel?: ((...args: any[]) => any) | undefined;
17
- onConfirm?: ((...args: any[]) => any) | undefined;
10
+ declare const __VLS_component: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
11
+ "update:modelValue": (args_0: PickerSelectedValues) => any;
12
+ open: () => any;
13
+ closed: () => any;
14
+ "update:show": (args_0: boolean) => any;
15
+ confirm: (args_0: PickerSelectedValues) => any;
16
+ cancel: () => any;
17
+ }, string, PublicProps, Readonly<Props> & Readonly<{
18
+ "onUpdate:modelValue"?: ((args_0: PickerSelectedValues) => any) | undefined;
19
+ onOpen?: (() => any) | undefined;
20
+ onClosed?: (() => any) | undefined;
21
+ "onUpdate:show"?: ((args_0: boolean) => any) | undefined;
22
+ onConfirm?: ((args_0: PickerSelectedValues) => any) | undefined;
23
+ onCancel?: (() => any) | undefined;
18
24
  }>, {
19
- swipeTime: number;
20
- options: Partial<PickerOptions>;
21
- type: PickerBuiltIn;
22
- data: PickerData;
23
- showKey: string | Array<string>;
24
- }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
25
- export default _default;
25
+ confirmButtonText: string;
26
+ cancelButtonText: string;
27
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {
28
+ columnsRef: (CreateComponentPublicInstanceWithMixins<Readonly<Props_2> & Readonly<{
29
+ onChange?: ((args_0: number) => any) | undefined;
30
+ }>, {
31
+ scrollToSelected: (index?: number, behavior?: ScrollBehavior) => void;
32
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
33
+ change: (args_0: number) => any;
34
+ }, PublicProps, {
35
+ selectedIndex: number;
36
+ }, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
37
+ P: {};
38
+ B: {};
39
+ D: {};
40
+ C: {};
41
+ M: {};
42
+ Defaults: {};
43
+ }, Readonly<Props_2> & Readonly<{
44
+ onChange?: ((args_0: number) => any) | undefined;
45
+ }>, {
46
+ scrollToSelected: (index?: number, behavior?: ScrollBehavior) => void;
47
+ }, {}, {}, {}, {
48
+ selectedIndex: number;
49
+ }> | null)[];
50
+ }, any>;
51
+
52
+ declare function __VLS_template(): {
53
+ attrs: Partial<{}>;
54
+ slots: {
55
+ empty?(_: {}): any;
56
+ loading?(_: {}): any;
57
+ };
58
+ refs: {
59
+ columnsRef: (CreateComponentPublicInstanceWithMixins<Readonly<Props_2> & Readonly<{
60
+ onChange?: ((args_0: number) => any) | undefined;
61
+ }>, {
62
+ scrollToSelected: (index?: number, behavior?: ScrollBehavior) => void;
63
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
64
+ change: (args_0: number) => any;
65
+ }, PublicProps, {
66
+ selectedIndex: number;
67
+ }, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, HTMLDivElement, ComponentProvideOptions, {
68
+ P: {};
69
+ B: {};
70
+ D: {};
71
+ C: {};
72
+ M: {};
73
+ Defaults: {};
74
+ }, Readonly<Props_2> & Readonly<{
75
+ onChange?: ((args_0: number) => any) | undefined;
76
+ }>, {
77
+ scrollToSelected: (index?: number, behavior?: ScrollBehavior) => void;
78
+ }, {}, {}, {}, {
79
+ selectedIndex: number;
80
+ }> | null)[];
81
+ };
82
+ rootEl: any;
83
+ };
84
+
85
+ declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
86
+
87
+ declare type __VLS_WithTemplateSlots<T, S> = T & {
88
+ new (): {
89
+ $slots: S;
90
+ };
91
+ };
92
+
93
+ export declare const DatePicker: DefineComponent<Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
94
+ "update:modelValue": (args_0: PickerSelectedValues) => any;
95
+ open: () => any;
96
+ closed: () => any;
97
+ "update:show": (args_0: boolean) => any;
98
+ confirm: (args_0: PickerSelectedValues) => any;
99
+ cancel: () => any;
100
+ }, string, PublicProps, Readonly<Props_3> & Readonly<{
101
+ "onUpdate:modelValue"?: ((args_0: PickerSelectedValues) => any) | undefined;
102
+ onOpen?: (() => any) | undefined;
103
+ onClosed?: (() => any) | undefined;
104
+ "onUpdate:show"?: ((args_0: boolean) => any) | undefined;
105
+ onConfirm?: ((args_0: PickerSelectedValues) => any) | undefined;
106
+ onCancel?: (() => any) | undefined;
107
+ }>, {
108
+ title: string;
109
+ columnsType: DatePickerColumnType[];
110
+ minDate: Date;
111
+ maxDate: Date;
112
+ formatYearLabel: PickerFormatLabel;
113
+ formatMonthLabel: PickerFormatLabel;
114
+ formatDayLabel: PickerFormatLabel;
115
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
26
116
 
27
- declare type EmitKey = 'update:isShowPicker' | 'update:anchor' | 'cancel' | 'confirm';
117
+ export declare type DatePickerColumnType = 'year' | 'month' | 'day';
28
118
 
29
- export declare type NormalData = Record<PropertyKey, unknown> | string | number;
119
+ export declare type Direction = '' | 'vertical' | 'horizontal';
30
120
 
31
- export declare type OriginData = Array<NormalData>;
121
+ export declare const Picker: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
32
122
 
33
- export declare type PickerAnchor = number | Array<number>;
123
+ export declare type PickerColumn = PickerOption[];
34
124
 
35
- export declare type PickerBuiltIn = 'date' | 'time' | '';
125
+ export declare type PickerColumnsType = 'single' | 'multiple' | 'cascade';
36
126
 
37
- export declare interface PickerComponentProps<T = PickerAnchor> {
38
- data?: PickerData;
39
- isShowPicker: boolean;
40
- options?: Partial<PickerOptions>;
41
- anchor: T;
42
- showKey?: string | Array<string>;
43
- swipeTime?: number;
44
- type?: PickerBuiltIn;
127
+ export declare interface PickerFields {
128
+ label?: string;
129
+ value?: string;
130
+ children?: string;
45
131
  }
46
132
 
47
- export declare type PickerData = OriginData | Array<OriginData>;
133
+ export declare type PickerFormatLabel = (label: string) => string;
134
+
135
+ export declare interface PickerOption {
136
+ label?: string | number;
137
+ value?: string | number;
138
+ children?: PickerColumn;
139
+ [key: PropertyKey]: any;
140
+ }
48
141
 
49
- export declare type PickerEmit = (event: EmitKey, ...args: unknown[]) => void;
142
+ export declare type PickerSelectedValues = Array<PickerOption['value']>;
50
143
 
51
- export declare interface PickerOptions {
52
- cancelClass: string;
53
- confirmClass: string;
54
- titleClass: string;
55
- cancelColor: string;
56
- confirmColor: string;
57
- titleColor: string;
58
- cancelText: string;
59
- confirmText: string;
60
- titleText: string;
144
+ declare interface Props {
145
+ show: boolean;
146
+ modelValue?: PickerSelectedValues;
147
+ title?: string;
148
+ columns: PickerColumn | PickerColumn[];
149
+ linkage?: boolean;
150
+ loading?: boolean;
151
+ teleport?: string | Element;
152
+ confirmButtonText?: string;
153
+ cancelButtonText?: string;
154
+ columnsFieldNames?: PickerFields;
61
155
  }
62
156
 
63
- export declare interface PickerProps<T = PickerAnchor> {
64
- data: PickerData;
65
- isShowPicker: boolean;
66
- anchor: T;
67
- options?: Partial<PickerOptions>;
68
- showKey?: string | Array<string>;
69
- swipeTime?: number;
70
- type: PickerBuiltIn;
157
+ declare interface Props_3 {
158
+ show: boolean;
159
+ modelValue?: PickerSelectedValues;
160
+ title?: string;
161
+ columnsType?: DatePickerColumnType[];
162
+ minDate?: Date;
163
+ maxDate?: Date;
164
+ teleport?: string | Element;
165
+ confirmButtonText?: string;
166
+ cancelButtonText?: string;
167
+ formatYearLabel?: PickerFormatLabel;
168
+ formatMonthLabel?: PickerFormatLabel;
169
+ formatDayLabel?: PickerFormatLabel;
71
170
  }
72
171
 
73
- export declare interface PickerSelectItems<T = NormalData> {
74
- item: Array<T>;
75
- anchor: Array<number>;
172
+ declare interface Props_4 {
173
+ show: boolean;
174
+ modelValue?: PickerSelectedValues;
175
+ title?: string;
176
+ columnsType?: TimePickerColumnType[];
177
+ minTime?: string;
178
+ maxTime?: string;
179
+ teleport?: string | Element;
180
+ confirmButtonText?: string;
181
+ cancelButtonText?: string;
182
+ formatHourLabel?: PickerFormatLabel;
183
+ formatMinuteLabel?: PickerFormatLabel;
184
+ formatSecondLabel?: PickerFormatLabel;
76
185
  }
77
186
 
187
+ export declare const TimePicker: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
188
+ "update:modelValue": (args_0: PickerSelectedValues) => any;
189
+ open: () => any;
190
+ closed: () => any;
191
+ "update:show": (args_0: boolean) => any;
192
+ confirm: (args_0: PickerSelectedValues) => any;
193
+ cancel: () => any;
194
+ }, string, PublicProps, Readonly<Props_4> & Readonly<{
195
+ "onUpdate:modelValue"?: ((args_0: PickerSelectedValues) => any) | undefined;
196
+ onOpen?: (() => any) | undefined;
197
+ onClosed?: (() => any) | undefined;
198
+ "onUpdate:show"?: ((args_0: boolean) => any) | undefined;
199
+ onConfirm?: ((args_0: PickerSelectedValues) => any) | undefined;
200
+ onCancel?: (() => any) | undefined;
201
+ }>, {
202
+ title: string;
203
+ columnsType: TimePickerColumnType[];
204
+ formatHourLabel: PickerFormatLabel;
205
+ formatMinuteLabel: PickerFormatLabel;
206
+ formatSecondLabel: PickerFormatLabel;
207
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
208
+
209
+ export declare type TimePickerColumnType = 'hour' | 'minute' | 'second';
210
+
78
211
  export { }