@component-hook/picker 1.0.1-alpha.0 → 1.0.2-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/README.md +5 -5
- package/dist/react/picker.es.d.ts +15 -15
- package/dist/react/picker.es.js +102 -96
- package/dist/react/picker.umd.js +12 -12
- package/dist/vue/picker.es.d.ts +55 -115
- package/dist/vue/picker.es.js +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -44,13 +44,13 @@ $ pnpm install @component-hook/picker
|
|
|
44
44
|
```vue
|
|
45
45
|
<script setup lang="ts">
|
|
46
46
|
import { ref } from 'vue';
|
|
47
|
-
import { Picker
|
|
47
|
+
import { Picker } from '@component-hook/picker/vue';
|
|
48
48
|
|
|
49
49
|
const isShowPicker = ref(false);
|
|
50
|
-
const pickerValues = ref<
|
|
50
|
+
const pickerValues = ref<number[]>([]);
|
|
51
51
|
const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value: index }));
|
|
52
52
|
|
|
53
|
-
function onConfirm(value:
|
|
53
|
+
function onConfirm(value: number[]) {
|
|
54
54
|
pickerValues.value = value;
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -84,9 +84,9 @@ const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value:
|
|
|
84
84
|
|
|
85
85
|
export function BasePicker() {
|
|
86
86
|
const [showPicker, setShowPicker] = useState(false);
|
|
87
|
-
const [pickerValues, setPickerValues] = useState<
|
|
87
|
+
const [pickerValues, setPickerValues] = useState<number[]>([]);
|
|
88
88
|
|
|
89
|
-
function onConfirm(values:
|
|
89
|
+
function onConfirm(values: number[]) {
|
|
90
90
|
setPickerValues(values);
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -7,9 +7,9 @@ export declare type DatePickerColumnType = 'year' | 'month' | 'day';
|
|
|
7
7
|
|
|
8
8
|
export declare type Direction = '' | 'vertical' | 'horizontal';
|
|
9
9
|
|
|
10
|
-
export declare function Picker({ show, values, title, columns, linkage, loading, loadingSlot, emptySlot, teleport, confirmButtonText, cancelButtonText, columnsFieldNames, onConfirm, onClose, onChange, onCancel, onOpen, onClosed, }: Props): JSX_2.Element;
|
|
10
|
+
export declare function Picker<T>({ show, values, title, columns, linkage, loading, loadingSlot, emptySlot, teleport, confirmButtonText, cancelButtonText, columnsFieldNames, onConfirm, onClose, onChange, onCancel, onOpen, onClosed, }: Props<T>): JSX_2.Element;
|
|
11
11
|
|
|
12
|
-
export declare type PickerColumn = Array<PickerOption | undefined>;
|
|
12
|
+
export declare type PickerColumn<T = string | number> = Array<PickerOption<T> | undefined>;
|
|
13
13
|
|
|
14
14
|
export declare type PickerColumnsType = 'single' | 'multiple' | 'cascade';
|
|
15
15
|
|
|
@@ -21,20 +21,20 @@ export declare interface PickerFields {
|
|
|
21
21
|
|
|
22
22
|
export declare type PickerFormatLabel = (label: string) => string;
|
|
23
23
|
|
|
24
|
-
export declare interface PickerOption {
|
|
24
|
+
export declare interface PickerOption<T> {
|
|
25
25
|
label?: string | number;
|
|
26
|
-
value?:
|
|
27
|
-
children?: PickerColumn
|
|
26
|
+
value?: T;
|
|
27
|
+
children?: PickerColumn<T>;
|
|
28
28
|
[key: PropertyKey]: any;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export declare type PickerSelectedValues = Array<PickerOption['value']>;
|
|
31
|
+
export declare type PickerSelectedValues<T = string | number> = Array<PickerOption<T>['value']>;
|
|
32
32
|
|
|
33
|
-
declare interface Props {
|
|
33
|
+
declare interface Props<T = string | number> {
|
|
34
34
|
show: boolean;
|
|
35
|
-
values?:
|
|
35
|
+
values?: T[];
|
|
36
36
|
title?: string;
|
|
37
|
-
columns: PickerColumn | PickerColumn[];
|
|
37
|
+
columns: PickerColumn<T> | PickerColumn<T>[];
|
|
38
38
|
linkage?: boolean;
|
|
39
39
|
loading?: boolean;
|
|
40
40
|
loadingSlot?: ReactNode;
|
|
@@ -43,9 +43,9 @@ declare interface Props {
|
|
|
43
43
|
confirmButtonText?: string;
|
|
44
44
|
cancelButtonText?: string;
|
|
45
45
|
columnsFieldNames?: PickerFields;
|
|
46
|
-
onConfirm?: (values:
|
|
46
|
+
onConfirm?: (values: T[]) => void;
|
|
47
47
|
onClose: () => void;
|
|
48
|
-
onChange?: (values:
|
|
48
|
+
onChange?: (values: T[]) => void;
|
|
49
49
|
onCancel?: () => void;
|
|
50
50
|
onOpen?: () => void;
|
|
51
51
|
onClosed?: () => void;
|
|
@@ -53,7 +53,7 @@ declare interface Props {
|
|
|
53
53
|
|
|
54
54
|
declare interface Props_2 {
|
|
55
55
|
show: boolean;
|
|
56
|
-
values?:
|
|
56
|
+
values?: number[];
|
|
57
57
|
title?: string;
|
|
58
58
|
columnsType?: DatePickerColumnType[];
|
|
59
59
|
minDate?: Date;
|
|
@@ -64,7 +64,7 @@ declare interface Props_2 {
|
|
|
64
64
|
formatYearLabel?: PickerFormatLabel;
|
|
65
65
|
formatMonthLabel?: PickerFormatLabel;
|
|
66
66
|
formatDayLabel?: PickerFormatLabel;
|
|
67
|
-
onConfirm?: (values:
|
|
67
|
+
onConfirm?: (values: number[]) => void;
|
|
68
68
|
onClose: () => void;
|
|
69
69
|
onCancel?: () => void;
|
|
70
70
|
onOpen?: () => void;
|
|
@@ -73,7 +73,7 @@ declare interface Props_2 {
|
|
|
73
73
|
|
|
74
74
|
declare interface Props_3 {
|
|
75
75
|
show: boolean;
|
|
76
|
-
values?:
|
|
76
|
+
values?: number[];
|
|
77
77
|
title?: string;
|
|
78
78
|
columnsType?: TimePickerColumnType[];
|
|
79
79
|
minTime?: string;
|
|
@@ -84,7 +84,7 @@ declare interface Props_3 {
|
|
|
84
84
|
formatHourLabel?: PickerFormatLabel;
|
|
85
85
|
formatMinuteLabel?: PickerFormatLabel;
|
|
86
86
|
formatSecondLabel?: PickerFormatLabel;
|
|
87
|
-
onConfirm?: (values:
|
|
87
|
+
onConfirm?: (values: number[]) => void;
|
|
88
88
|
onClose: () => void;
|
|
89
89
|
onCancel?: () => void;
|
|
90
90
|
onOpen?: () => void;
|