@xn-lib/component 0.1.6 → 0.1.8

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.
@@ -0,0 +1,206 @@
1
+ import type { TransferOption, TransferExpose, TransferFields, TransferValue } from '../types/transfer';
2
+ declare function handleRemoveItem(value: string | number): void;
3
+ declare function clearTarget(): void;
4
+ declare var __VLS_12: {
5
+ clear: typeof clearTarget;
6
+ }, __VLS_40: {
7
+ items: TransferOption[];
8
+ remove: typeof handleRemoveItem;
9
+ valueKey: string;
10
+ labelKey: string;
11
+ };
12
+ type __VLS_Slots = {} & {
13
+ 'target-header'?: (props: typeof __VLS_12) => any;
14
+ } & {
15
+ target?: (props: typeof __VLS_40) => any;
16
+ };
17
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
18
+ readonly value: {
19
+ readonly type: import("vue").PropType<TransferValue>;
20
+ readonly default: () => never[];
21
+ };
22
+ readonly options: {
23
+ readonly type: import("vue").PropType<TransferOption[]>;
24
+ readonly default: () => never[];
25
+ };
26
+ readonly selectedOptions: {
27
+ readonly type: import("vue").PropType<TransferOption[]>;
28
+ readonly default: () => never[];
29
+ };
30
+ readonly disabled: {
31
+ readonly type: BooleanConstructor;
32
+ readonly default: false;
33
+ };
34
+ readonly filterable: {
35
+ readonly type: BooleanConstructor;
36
+ readonly default: false;
37
+ };
38
+ readonly filterPlaceholder: {
39
+ readonly type: StringConstructor;
40
+ readonly default: "";
41
+ };
42
+ readonly sourceTitle: {
43
+ readonly type: StringConstructor;
44
+ readonly default: "源列表";
45
+ };
46
+ readonly targetTitle: {
47
+ readonly type: StringConstructor;
48
+ readonly default: "目标列表";
49
+ };
50
+ readonly tree: {
51
+ readonly type: BooleanConstructor;
52
+ readonly default: false;
53
+ };
54
+ readonly virtual: {
55
+ readonly type: BooleanConstructor;
56
+ readonly default: false;
57
+ };
58
+ readonly itemHeight: {
59
+ readonly type: NumberConstructor;
60
+ readonly default: 32;
61
+ };
62
+ readonly scrollLoad: {
63
+ readonly type: BooleanConstructor;
64
+ readonly default: false;
65
+ };
66
+ readonly onLoad: {
67
+ readonly type: import("vue").PropType<() => Promise<void>>;
68
+ readonly default: undefined;
69
+ };
70
+ readonly loading: {
71
+ readonly type: BooleanConstructor;
72
+ readonly default: false;
73
+ };
74
+ readonly remoteSearch: {
75
+ readonly type: BooleanConstructor;
76
+ readonly default: false;
77
+ };
78
+ readonly remoteMethod: {
79
+ readonly type: import("vue").PropType<(query: Record<string, any>) => Promise<TransferOption[]>>;
80
+ readonly default: undefined;
81
+ };
82
+ readonly customFields: {
83
+ readonly type: import("vue").PropType<TransferFields>;
84
+ readonly default: () => {
85
+ label: string;
86
+ value: string;
87
+ children: string;
88
+ };
89
+ };
90
+ readonly maxCount: {
91
+ readonly type: NumberConstructor;
92
+ readonly default: 0;
93
+ };
94
+ }>, TransferExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
95
+ change: (value: TransferValue) => any;
96
+ "scroll-bottom": (keyword: string) => any;
97
+ "update:value": (value: TransferValue) => any;
98
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
99
+ readonly value: {
100
+ readonly type: import("vue").PropType<TransferValue>;
101
+ readonly default: () => never[];
102
+ };
103
+ readonly options: {
104
+ readonly type: import("vue").PropType<TransferOption[]>;
105
+ readonly default: () => never[];
106
+ };
107
+ readonly selectedOptions: {
108
+ readonly type: import("vue").PropType<TransferOption[]>;
109
+ readonly default: () => never[];
110
+ };
111
+ readonly disabled: {
112
+ readonly type: BooleanConstructor;
113
+ readonly default: false;
114
+ };
115
+ readonly filterable: {
116
+ readonly type: BooleanConstructor;
117
+ readonly default: false;
118
+ };
119
+ readonly filterPlaceholder: {
120
+ readonly type: StringConstructor;
121
+ readonly default: "";
122
+ };
123
+ readonly sourceTitle: {
124
+ readonly type: StringConstructor;
125
+ readonly default: "源列表";
126
+ };
127
+ readonly targetTitle: {
128
+ readonly type: StringConstructor;
129
+ readonly default: "目标列表";
130
+ };
131
+ readonly tree: {
132
+ readonly type: BooleanConstructor;
133
+ readonly default: false;
134
+ };
135
+ readonly virtual: {
136
+ readonly type: BooleanConstructor;
137
+ readonly default: false;
138
+ };
139
+ readonly itemHeight: {
140
+ readonly type: NumberConstructor;
141
+ readonly default: 32;
142
+ };
143
+ readonly scrollLoad: {
144
+ readonly type: BooleanConstructor;
145
+ readonly default: false;
146
+ };
147
+ readonly onLoad: {
148
+ readonly type: import("vue").PropType<() => Promise<void>>;
149
+ readonly default: undefined;
150
+ };
151
+ readonly loading: {
152
+ readonly type: BooleanConstructor;
153
+ readonly default: false;
154
+ };
155
+ readonly remoteSearch: {
156
+ readonly type: BooleanConstructor;
157
+ readonly default: false;
158
+ };
159
+ readonly remoteMethod: {
160
+ readonly type: import("vue").PropType<(query: Record<string, any>) => Promise<TransferOption[]>>;
161
+ readonly default: undefined;
162
+ };
163
+ readonly customFields: {
164
+ readonly type: import("vue").PropType<TransferFields>;
165
+ readonly default: () => {
166
+ label: string;
167
+ value: string;
168
+ children: string;
169
+ };
170
+ };
171
+ readonly maxCount: {
172
+ readonly type: NumberConstructor;
173
+ readonly default: 0;
174
+ };
175
+ }>> & Readonly<{
176
+ onChange?: ((value: TransferValue) => any) | undefined;
177
+ "onScroll-bottom"?: ((keyword: string) => any) | undefined;
178
+ "onUpdate:value"?: ((value: TransferValue) => any) | undefined;
179
+ }>, {
180
+ readonly value: TransferValue;
181
+ readonly disabled: boolean;
182
+ readonly onLoad: () => Promise<void>;
183
+ readonly options: TransferOption[];
184
+ readonly filterable: boolean;
185
+ readonly loading: boolean;
186
+ readonly remoteMethod: (query: Record<string, any>) => Promise<TransferOption[]>;
187
+ readonly selectedOptions: TransferOption[];
188
+ readonly filterPlaceholder: string;
189
+ readonly sourceTitle: string;
190
+ readonly targetTitle: string;
191
+ readonly tree: boolean;
192
+ readonly virtual: boolean;
193
+ readonly itemHeight: number;
194
+ readonly scrollLoad: boolean;
195
+ readonly remoteSearch: boolean;
196
+ readonly customFields: TransferFields;
197
+ readonly maxCount: number;
198
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
199
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
200
+ declare const _default: typeof __VLS_export;
201
+ export default _default;
202
+ type __VLS_WithSlots<T, S> = T & {
203
+ new (): {
204
+ $slots: S;
205
+ };
206
+ };
@@ -0,0 +1,143 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import type { TransferOption, TransferFields, TransferValue } from '../types/transfer';
3
+ export declare const transferProps: {
4
+ readonly value: {
5
+ readonly type: PropType<TransferValue>;
6
+ readonly default: () => never[];
7
+ };
8
+ readonly options: {
9
+ readonly type: PropType<TransferOption[]>;
10
+ readonly default: () => never[];
11
+ };
12
+ /**
13
+ * 额外提供的已选项数据(用于远程回显)
14
+ */
15
+ readonly selectedOptions: {
16
+ readonly type: PropType<TransferOption[]>;
17
+ readonly default: () => never[];
18
+ };
19
+ readonly disabled: {
20
+ readonly type: BooleanConstructor;
21
+ readonly default: false;
22
+ };
23
+ readonly filterable: {
24
+ readonly type: BooleanConstructor;
25
+ readonly default: false;
26
+ };
27
+ readonly filterPlaceholder: {
28
+ readonly type: StringConstructor;
29
+ readonly default: "";
30
+ };
31
+ readonly sourceTitle: {
32
+ readonly type: StringConstructor;
33
+ readonly default: "源列表";
34
+ };
35
+ readonly targetTitle: {
36
+ readonly type: StringConstructor;
37
+ readonly default: "目标列表";
38
+ };
39
+ readonly tree: {
40
+ readonly type: BooleanConstructor;
41
+ readonly default: false;
42
+ };
43
+ readonly virtual: {
44
+ readonly type: BooleanConstructor;
45
+ readonly default: false;
46
+ };
47
+ readonly itemHeight: {
48
+ readonly type: NumberConstructor;
49
+ readonly default: 32;
50
+ };
51
+ readonly scrollLoad: {
52
+ readonly type: BooleanConstructor;
53
+ readonly default: false;
54
+ };
55
+ readonly onLoad: {
56
+ readonly type: PropType<() => Promise<void>>;
57
+ readonly default: undefined;
58
+ };
59
+ readonly loading: {
60
+ readonly type: BooleanConstructor;
61
+ readonly default: false;
62
+ };
63
+ readonly remoteSearch: {
64
+ readonly type: BooleanConstructor;
65
+ readonly default: false;
66
+ };
67
+ readonly remoteMethod: {
68
+ readonly type: PropType<(query: Record<string, any>) => Promise<TransferOption[]>>;
69
+ readonly default: undefined;
70
+ };
71
+ readonly customFields: {
72
+ readonly type: PropType<TransferFields>;
73
+ readonly default: () => {
74
+ label: string;
75
+ value: string;
76
+ children: string;
77
+ };
78
+ };
79
+ readonly maxCount: {
80
+ readonly type: NumberConstructor;
81
+ readonly default: 0;
82
+ };
83
+ };
84
+ export type TransferProps = ExtractPropTypes<typeof transferProps>;
85
+ export declare const transferSourcePanelProps: {
86
+ readonly title: {
87
+ readonly type: StringConstructor;
88
+ readonly default: "源列表";
89
+ };
90
+ readonly checkedValues: {
91
+ readonly type: PropType<TransferValue>;
92
+ readonly default: () => never[];
93
+ };
94
+ readonly options: {
95
+ readonly type: PropType<TransferOption[]>;
96
+ readonly default: () => never[];
97
+ };
98
+ readonly disabled: {
99
+ readonly type: BooleanConstructor;
100
+ readonly default: false;
101
+ };
102
+ readonly filterable: {
103
+ readonly type: BooleanConstructor;
104
+ readonly default: false;
105
+ };
106
+ readonly filterPlaceholder: {
107
+ readonly type: StringConstructor;
108
+ readonly default: "";
109
+ };
110
+ readonly tree: {
111
+ readonly type: BooleanConstructor;
112
+ readonly default: false;
113
+ };
114
+ readonly itemHeight: {
115
+ readonly type: NumberConstructor;
116
+ readonly default: 32;
117
+ };
118
+ readonly loading: {
119
+ readonly type: BooleanConstructor;
120
+ readonly default: false;
121
+ };
122
+ readonly remoteSearch: {
123
+ readonly type: BooleanConstructor;
124
+ readonly default: false;
125
+ };
126
+ readonly remoteMethod: {
127
+ readonly type: PropType<(query: Record<string, any>) => Promise<TransferOption[]>>;
128
+ readonly default: undefined;
129
+ };
130
+ readonly customFields: {
131
+ readonly type: PropType<TransferFields>;
132
+ readonly default: () => {
133
+ label: string;
134
+ value: string;
135
+ children: string;
136
+ };
137
+ };
138
+ readonly maxCount: {
139
+ readonly type: NumberConstructor;
140
+ readonly default: 0;
141
+ };
142
+ };
143
+ export type TransferSourcePanelProps = ExtractPropTypes<typeof transferSourcePanelProps>;
@@ -10,6 +10,7 @@ export interface CascaderOption {
10
10
  }
11
11
  export type ExpandTrigger = 'hover' | 'click';
12
12
  export type CheckStrategy = 'all' | 'parent' | 'child';
13
+ export type ShowCheckedStrategy = 'parent' | 'child';
13
14
  export type Filter = (pattern: string, option: CascaderOption, path: CascaderOption[]) => boolean;
14
15
  export type OnLoad = (option: CascaderOption) => Promise<void>;
15
16
  export type OnUpdateValue = (value: CascaderValue | null, option: CascaderOption | null | Array<CascaderOption | null>, path: Array<CascaderOption[] | null> | CascaderOption[] | null) => void;
@@ -34,10 +35,16 @@ export interface CascaderInst {
34
35
  keys: Key[];
35
36
  options: Array<CascaderOption | null>;
36
37
  };
38
+ getTopCheckedKeys: () => Key[];
39
+ getTopCheckedData: () => {
40
+ keys: Key[];
41
+ options: Array<CascaderOption | null>;
42
+ };
37
43
  getIndeterminateData: () => {
38
44
  keys: Key[];
39
45
  options: Array<CascaderOption | null>;
40
46
  };
47
+ removeTag: (key: Key) => void;
41
48
  }
42
49
  export interface CascaderContext {
43
50
  mergedValue: CascaderValue | null;
@@ -49,6 +56,7 @@ export interface CascaderContext {
49
56
  loadingKeySet: Set<Key>;
50
57
  multiple: boolean;
51
58
  cascade: boolean;
59
+ checkStrictly?: boolean;
52
60
  checkStrategy: CheckStrategy;
53
61
  expandTrigger: ExpandTrigger;
54
62
  remote: boolean;
@@ -57,6 +65,9 @@ export interface CascaderContext {
57
65
  valueField: string;
58
66
  childrenField: string;
59
67
  disabledField: string;
68
+ maxChecked?: number;
69
+ isMaxLimitReached?: boolean;
70
+ isOptionDisabledByMax?: (key: Key) => boolean;
60
71
  onLoad?: OnLoad;
61
72
  updateHoverKey: (key: Key | null) => void;
62
73
  updateKeyboardKey: (key: Key | null) => void;
@@ -1,2 +1,6 @@
1
+ export * from './cascader';
2
+ export * from './tag';
3
+ export * from './transfer';
4
+ export * from './virtual-list';
1
5
  export type DefaultType = 'success' | 'info' | 'warning' | 'danger' | 'primary' | 'default';
2
6
  export type DefaultSize = 'small' | 'default' | 'large';
@@ -0,0 +1,84 @@
1
+ /**
2
+ * 穿梭框选项
3
+ */
4
+ export interface TransferOption {
5
+ /**
6
+ * 选项的唯一标识
7
+ */
8
+ value: string | number;
9
+ /**
10
+ * 选项显示的文本
11
+ */
12
+ label: string;
13
+ /**
14
+ * 是否禁用该选项
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * 子节点(用于树形结构)
19
+ */
20
+ children?: TransferOption[];
21
+ [key: string]: any;
22
+ }
23
+ /**
24
+ * 穿梭框组件 Emits
25
+ */
26
+ export interface TransferEmits {
27
+ /**
28
+ * 值变化时触发
29
+ */
30
+ change: [value: TransferValue];
31
+ /**
32
+ * v-model 更新事件
33
+ */
34
+ 'update:value': [value: TransferValue];
35
+ /**
36
+ * 滚动到底部时触发
37
+ */
38
+ 'scroll-bottom': [keyword: string];
39
+ }
40
+ /**
41
+ * 穿梭框组件暴露的方法
42
+ */
43
+ export interface TransferExpose {
44
+ /**
45
+ * 清空目标列表
46
+ */
47
+ clearTarget: () => void;
48
+ /**
49
+ * 全选源列表
50
+ */
51
+ selectAll: () => void;
52
+ /**
53
+ * 追加缓存的选项数据(用于远程回显)
54
+ */
55
+ appendOptions?: (items: TransferOption[]) => void;
56
+ }
57
+ /**
58
+ * 映射字段配置
59
+ */
60
+ export interface TransferFields {
61
+ label?: string;
62
+ value?: string;
63
+ children?: string;
64
+ }
65
+ /**
66
+ * 选中值类型
67
+ */
68
+ export type TransferValue = Array<string | number>;
69
+ /**
70
+ * 源面板 emits
71
+ */
72
+ export interface TransferSourcePanelEmits {
73
+ change: [value: TransferValue];
74
+ 'update:checked': [value: TransferValue];
75
+ 'scroll-bottom': [keyword: string];
76
+ }
77
+ /**
78
+ * 源面板暴露的方法
79
+ */
80
+ export interface TransferSourceExpose {
81
+ setCheckedKeys: (keys: TransferValue) => void;
82
+ getAllEnabledValues: () => TransferValue;
83
+ filterTree: (keyword: string) => void;
84
+ }
@@ -0,0 +1,40 @@
1
+ export type { VirtualListProps, virtualListProps } from '../virtual-list/props';
2
+ export interface VirtualListItem {
3
+ [key: string]: any;
4
+ }
5
+ export interface VirtualListEmits {
6
+ /**
7
+ * 滚动到顶部事件
8
+ */
9
+ 'update:scroll-top': [];
10
+ /**
11
+ * 滚动到底部事件
12
+ */
13
+ 'update:scroll-bottom': [];
14
+ /**
15
+ * 滚动位置变化
16
+ */
17
+ 'update:scroll-position': [position: number];
18
+ /**
19
+ * 滚动事件
20
+ */
21
+ scroll: [position: number, event: Event];
22
+ }
23
+ export interface VirtualListInstance {
24
+ /**
25
+ * 滚动到指定位置
26
+ */
27
+ scrollToPosition: (position: {
28
+ top?: number;
29
+ left?: number;
30
+ } | number) => void;
31
+ /**
32
+ * 滚动到指定项
33
+ */
34
+ scrollToItem: (index: number) => void;
35
+ /**
36
+ * 获取当前滚动位置
37
+ */
38
+ getScrollPosition: () => number;
39
+ }
40
+ export type VirtualListMode = 'fixed' | 'dynamic';
@@ -0,0 +1,5 @@
1
+ export type { VirtualListProps, VirtualListEmits, VirtualListInstance } from '../types/virtual-list';
2
+ import type { Plugin } from 'vue';
3
+ import VirtualListComponent from './index.vue';
4
+ declare const VirtualList: typeof VirtualListComponent & Plugin;
5
+ export default VirtualList;
@@ -0,0 +1,131 @@
1
+ import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
2
+ declare var __VLS_12: {}, __VLS_15: {
3
+ item: any;
4
+ index: any;
5
+ }, __VLS_28: {}, __VLS_37: {
6
+ item: any;
7
+ index: any;
8
+ };
9
+ type __VLS_Slots = {} & {
10
+ after?: (props: typeof __VLS_12) => any;
11
+ } & {
12
+ default?: (props: typeof __VLS_15) => any;
13
+ } & {
14
+ after?: (props: typeof __VLS_28) => any;
15
+ } & {
16
+ default?: (props: typeof __VLS_37) => any;
17
+ };
18
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
19
+ readonly items: {
20
+ readonly type: import("vue").PropType<any[]>;
21
+ readonly required: true;
22
+ };
23
+ readonly mode: {
24
+ readonly type: import("vue").PropType<import("..").VirtualListMode>;
25
+ readonly default: "fixed";
26
+ };
27
+ readonly itemSize: {
28
+ readonly type: import("vue").PropType<number | ((item: any) => number)>;
29
+ readonly default: 32;
30
+ };
31
+ readonly minItemSize: {
32
+ readonly type: NumberConstructor;
33
+ readonly default: 32;
34
+ };
35
+ readonly itemKey: {
36
+ readonly type: StringConstructor;
37
+ readonly default: "id";
38
+ };
39
+ readonly pageMode: {
40
+ readonly type: BooleanConstructor;
41
+ readonly default: false;
42
+ };
43
+ readonly buffer: {
44
+ readonly type: NumberConstructor;
45
+ readonly default: 200;
46
+ };
47
+ readonly prerender: {
48
+ readonly type: NumberConstructor;
49
+ readonly default: 0;
50
+ };
51
+ readonly threshold: {
52
+ readonly type: NumberConstructor;
53
+ readonly default: 50;
54
+ };
55
+ readonly sizeDependencies: {
56
+ readonly type: import("vue").PropType<any[]>;
57
+ readonly default: () => never[];
58
+ };
59
+ }>, {
60
+ scrollToPosition: (position: {
61
+ top?: number;
62
+ left?: number;
63
+ } | number) => void;
64
+ scrollToItem: (index: number) => void;
65
+ getScrollPosition: () => any;
66
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
67
+ "reach-top": (event: Event) => any;
68
+ "reach-bottom": (event: Event) => any;
69
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
70
+ readonly items: {
71
+ readonly type: import("vue").PropType<any[]>;
72
+ readonly required: true;
73
+ };
74
+ readonly mode: {
75
+ readonly type: import("vue").PropType<import("..").VirtualListMode>;
76
+ readonly default: "fixed";
77
+ };
78
+ readonly itemSize: {
79
+ readonly type: import("vue").PropType<number | ((item: any) => number)>;
80
+ readonly default: 32;
81
+ };
82
+ readonly minItemSize: {
83
+ readonly type: NumberConstructor;
84
+ readonly default: 32;
85
+ };
86
+ readonly itemKey: {
87
+ readonly type: StringConstructor;
88
+ readonly default: "id";
89
+ };
90
+ readonly pageMode: {
91
+ readonly type: BooleanConstructor;
92
+ readonly default: false;
93
+ };
94
+ readonly buffer: {
95
+ readonly type: NumberConstructor;
96
+ readonly default: 200;
97
+ };
98
+ readonly prerender: {
99
+ readonly type: NumberConstructor;
100
+ readonly default: 0;
101
+ };
102
+ readonly threshold: {
103
+ readonly type: NumberConstructor;
104
+ readonly default: 50;
105
+ };
106
+ readonly sizeDependencies: {
107
+ readonly type: import("vue").PropType<any[]>;
108
+ readonly default: () => never[];
109
+ };
110
+ }>> & Readonly<{
111
+ "onReach-top"?: ((event: Event) => any) | undefined;
112
+ "onReach-bottom"?: ((event: Event) => any) | undefined;
113
+ }>, {
114
+ readonly itemSize: number | ((item: any) => number);
115
+ readonly mode: import("..").VirtualListMode;
116
+ readonly minItemSize: number;
117
+ readonly itemKey: string;
118
+ readonly pageMode: boolean;
119
+ readonly buffer: number;
120
+ readonly prerender: number;
121
+ readonly threshold: number;
122
+ readonly sizeDependencies: any[];
123
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
124
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
125
+ declare const _default: typeof __VLS_export;
126
+ export default _default;
127
+ type __VLS_WithSlots<T, S> = T & {
128
+ new (): {
129
+ $slots: S;
130
+ };
131
+ };