@solar-taro/ui-vant 3.5.2 → 4.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solar-taro/ui-vant",
3
- "version": "3.5.2",
3
+ "version": "4.0.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -25,8 +25,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
25
25
  onConfirm?: ((options: any) => any) | undefined;
26
26
  "onUpdate:show"?: ((args_0: boolean) => any) | undefined;
27
27
  }>, {
28
+ searchable: boolean;
28
29
  labelKey: string;
29
30
  valueKey: string;
30
- searchable: boolean;
31
31
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
32
  export default _default;
@@ -1,19 +1,42 @@
1
1
  .sun-selector {
2
- .van-field__control {
3
- min-width: 0;
4
- overflow: auto;
2
+ flex: auto;
3
+ display: flex;
4
+ align-items: center;
5
+ min-height: 24px;
6
+ line-height: 1.5;
7
+
8
+ &-disabled {
9
+ opacity: 0.5;
10
+ }
11
+
12
+ &-inner {
13
+ flex: auto;
14
+ overflow: hidden;
5
15
  white-space: nowrap;
16
+ text-overflow: ellipsis;
17
+ }
18
+
19
+ &-placeholder {
20
+ flex: auto;
21
+ color: var(--color-light-shade);
6
22
  }
7
23
 
8
- &-input {
24
+ &-icon {
25
+ flex-shrink: 0;
26
+ color: var(--color-medium-tint);
27
+ }
28
+
29
+ &-tags {
9
30
  display: flex;
31
+ flex-wrap: wrap;
10
32
  gap: 2px;
11
33
  }
12
34
 
13
35
  &-clear {
14
36
  &-icon {
15
- display: inline;
37
+ flex-shrink: 0;
16
38
  padding: 4px;
39
+ color: var(--color-medium-tint);
17
40
  }
18
41
 
19
42
  &-btn {
@@ -35,5 +58,10 @@
35
58
  color: var(--color-primary);
36
59
  font-size: 16px;
37
60
  }
61
+
62
+ &-divider {
63
+ position: sticky;
64
+ top: 0;
65
+ }
38
66
  }
39
67
  }
@@ -1,24 +1,21 @@
1
- declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
1
+ import { SelectorOption, SelectorOptionGroup } from './typings';
2
+ declare const _default: <TValue, TOption extends SelectorOption<TValue>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
2
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
3
- readonly "onUpdate:modelValue"?: ((args_0: unknown) => any) | undefined;
4
+ readonly "onUpdate:modelValue"?: ((value: TValue | TValue[] | null) => any) | undefined;
4
5
  readonly onClose?: (() => any) | undefined;
5
- readonly onSelect?: ((args_0: T) => any) | undefined;
6
+ readonly onSelect?: ((args_0: TOption) => any) | undefined;
6
7
  readonly onClear?: ((args_0: unknown) => any) | undefined;
7
- readonly onConfirm?: ((args_0: T[]) => any) | undefined;
8
+ readonly onConfirm?: ((args_0: TOption[]) => any) | undefined;
8
9
  readonly onRefresh?: (() => any) | undefined;
9
10
  readonly "onUpdate:keyword"?: ((value: string) => any) | undefined;
10
- readonly onUnselect?: ((args_0: T) => any) | undefined;
11
+ readonly onUnselect?: ((args_0: TOption) => any) | undefined;
11
12
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue" | "onSelect" | "onRefresh" | "onClose" | "onClear" | "onConfirm" | "onUpdate:keyword" | "onUnselect"> & ({
13
+ modelValue?: TValue | TValue[] | null;
12
14
  keyword?: string;
13
15
  } & {
14
- type?: "field" | "search";
15
16
  mode?: "single" | "multiple";
16
- label?: string;
17
17
  placeholder?: string;
18
- modelValue: unknown;
19
- options: T[];
20
- labelKey?: keyof T;
21
- valueKey?: keyof T;
18
+ options: SelectorOptionGroup<TOption>[] | TOption[];
22
19
  loading?: boolean;
23
20
  height?: string;
24
21
  required?: boolean;
@@ -27,13 +24,12 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
27
24
  delimiter?: string;
28
25
  searchable?: boolean;
29
26
  clearable?: boolean;
30
- searcher?: (option: T, keyword: string) => boolean;
31
- virtual?: boolean | {
32
- itemSize?: number;
33
- };
27
+ filter?: (option: NoInfer<TOption>, keyword: string) => boolean;
28
+ virtual?: boolean;
29
+ optionSize?: number | ((option: NoInfer<TOption>) => number);
34
30
  refresher?: boolean;
35
31
  refreshing?: boolean;
36
- compareWith?: (a: any, b: any) => boolean;
32
+ compareWith?: (a?: NoInfer<TValue>, b?: NoInfer<TValue>) => boolean;
37
33
  }) & Partial<{}>> & import('vue').PublicProps;
38
34
  expose(exposed: import('vue').ShallowUnwrapRef<{
39
35
  present: () => void;
@@ -45,40 +41,38 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
45
41
  default?(_: {
46
42
  present: () => void;
47
43
  label: string;
48
- selectedOptions: T[];
44
+ selectedOptions: TOption[];
49
45
  }): any;
50
- end?(_: {}): any;
51
- end?(_: {}): any;
52
46
  filter?(_: {
53
47
  rendered: boolean;
54
48
  }): any;
55
49
  'option-start'?(_: {
56
- option: T;
50
+ option: TOption | SelectorOptionGroup<TOption>;
57
51
  index: number;
58
52
  active: boolean;
59
53
  }): any;
60
54
  'option-start'?(_: {
61
- option: T;
55
+ option: TOption;
62
56
  index: number;
63
57
  active: boolean;
64
58
  }): any;
65
59
  option?(_: {
66
- option: T;
60
+ option: TOption | SelectorOptionGroup<TOption>;
67
61
  index: number;
68
62
  active: boolean;
69
63
  }): any;
70
64
  option?(_: {
71
- option: T;
65
+ option: TOption;
72
66
  index: number;
73
67
  active: boolean;
74
68
  }): any;
75
69
  'option-end'?(_: {
76
- option: T;
70
+ option: TOption | SelectorOptionGroup<TOption>;
77
71
  index: number;
78
72
  active: boolean;
79
73
  }): any;
80
74
  'option-end'?(_: {
81
- option: T;
75
+ option: TOption;
82
76
  index: number;
83
77
  active: boolean;
84
78
  }): any;
@@ -90,7 +84,7 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
90
84
  confirm: () => void;
91
85
  }): any;
92
86
  };
93
- emit: (((evt: "update:modelValue", args_0: unknown) => void) & ((evt: "close") => void) & ((evt: "select", args_0: T) => void) & ((evt: "clear", args_0: unknown) => void) & ((evt: "confirm", args_0: T[]) => void) & ((evt: "refresh") => void) & ((evt: "unselect", args_0: T) => void)) & ((evt: "update:keyword", value: string) => void);
87
+ emit: (((evt: "close") => void) & ((evt: "select", args_0: TOption) => void) & ((evt: "clear", args_0: unknown) => void) & ((evt: "confirm", args_0: TOption[]) => void) & ((evt: "refresh") => void) & ((evt: "unselect", args_0: TOption) => void)) & (((evt: "update:modelValue", value: TValue | TValue[] | null) => void) & ((evt: "update:keyword", value: string) => void));
94
88
  }>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
95
89
  [key: string]: any;
96
90
  }> & {
@@ -0,0 +1,9 @@
1
+ export interface SelectorOptionGroup<TOption extends SelectorOption<unknown>> {
2
+ label: string;
3
+ options: TOption[];
4
+ }
5
+ export interface SelectorOption<T> {
6
+ label: string;
7
+ value: T;
8
+ parent?: SelectorOptionGroup<this>;
9
+ }