@xn-lib/component 0.1.41 → 0.1.43

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.
@@ -14,7 +14,8 @@ import XnTable from './table/index';
14
14
  import XnModal from './modal/index';
15
15
  import XnSelectInput from './select-input/index';
16
16
  import XnListCard from './list-card/index';
17
- export { XnCascader, XnTag, XnTransfer, XnVirtualList, XnEllipsis, XnEditableText, XnEditableTextarea, XnTimeRangePicker, XnTextRuleConfig, XnFormList, XnTable, XnModal, XnSelectInput, XnListCard };
17
+ import XnSelectPanel from './select-panel/index';
18
+ export { XnCascader, XnTag, XnTransfer, XnVirtualList, XnEllipsis, XnEditableText, XnEditableTextarea, XnTimeRangePicker, XnTextRuleConfig, XnFormList, XnTable, XnModal, XnSelectInput, XnListCard, XnSelectPanel };
18
19
  export declare const components: Record<string, Component>;
19
20
  export type { CascaderProps } from './cascader/props';
20
21
  export type { TagProps } from './tag/props';
@@ -23,10 +24,12 @@ export type { EditableTextProps } from './editable-text/props';
23
24
  export type { EditableTextareaProps } from './editable-textarea/props';
24
25
  export type { TimeRangePickerProps, TimeRangeValue, TimeRange } from './time-range-picker/props';
25
26
  export type { TextRuleConfigProps } from './text-rule-config/props';
27
+ export type { WildcardOption } from './types/text-rule-config';
26
28
  export type { FormListProps, FormListRow, FormListDefaultRow } from './form-list/props';
27
29
  export type { SelectInputProps } from './select-input/props';
28
30
  export type { SelectInputValue, SelectInputInst } from './types/select-input';
29
31
  export type { ListCardProps } from './list-card/props';
32
+ export type { SelectPanelProps } from './select-panel/props';
30
33
  export { useFormList, useFormListActions, useFormListLayout, useFormListRowForms, useFormListUidSync, generateUid, cssLength, getFormListRowKey, ensureRowUids, stripUidRow } from './form-list/index';
31
34
  export type { FormListExpose, FormListSubmitRow, RowKeyOptions, UseFormListOptions, UseFormListReturn } from './form-list/index';
32
35
  export * from './types';
@@ -1,22 +1,19 @@
1
1
  import 'vue-virtual-scroller';
2
- declare function handleAddClick(): void;
3
2
  declare var __VLS_1: {}, __VLS_3: {}, __VLS_37: {
4
3
  item: any;
5
4
  index: any;
6
5
  selected: boolean;
7
- }, __VLS_39: {
6
+ }, __VLS_47: {
8
7
  item: any;
9
8
  index: any;
10
- }, __VLS_53: {
9
+ }, __VLS_69: {
11
10
  item: any;
12
11
  index: number;
13
12
  selected: boolean;
14
- }, __VLS_55: {
13
+ }, __VLS_71: {
15
14
  item: any;
16
15
  index: number;
17
- }, __VLS_68: {}, __VLS_70: {
18
- add: typeof handleAddClick;
19
- };
16
+ }, __VLS_84: {}, __VLS_94: {};
20
17
  type __VLS_Slots = {} & {
21
18
  title?: (props: typeof __VLS_1) => any;
22
19
  } & {
@@ -24,15 +21,15 @@ type __VLS_Slots = {} & {
24
21
  } & {
25
22
  item?: (props: typeof __VLS_37) => any;
26
23
  } & {
27
- 'item-actions'?: (props: typeof __VLS_39) => any;
24
+ 'item-actions'?: (props: typeof __VLS_47) => any;
28
25
  } & {
29
- item?: (props: typeof __VLS_53) => any;
26
+ item?: (props: typeof __VLS_69) => any;
30
27
  } & {
31
- 'item-actions'?: (props: typeof __VLS_55) => any;
28
+ 'item-actions'?: (props: typeof __VLS_71) => any;
32
29
  } & {
33
- empty?: (props: typeof __VLS_68) => any;
30
+ empty?: (props: typeof __VLS_84) => any;
34
31
  } & {
35
- footer?: (props: typeof __VLS_70) => any;
32
+ footer?: (props: typeof __VLS_94) => any;
36
33
  };
37
34
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
38
35
  readonly title: {
@@ -103,6 +100,14 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
103
100
  readonly type: import("vue").PropType<string | number>;
104
101
  readonly default: undefined;
105
102
  };
103
+ readonly selectable: {
104
+ readonly type: BooleanConstructor;
105
+ readonly default: false;
106
+ };
107
+ readonly getSelectable: {
108
+ readonly type: import("vue").PropType<(item: any) => boolean>;
109
+ readonly default: () => () => boolean;
110
+ };
106
111
  readonly showHeader: {
107
112
  readonly type: BooleanConstructor;
108
113
  readonly default: true;
@@ -119,13 +124,18 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
119
124
  refresh(): Promise<void>;
120
125
  loadMore(): Promise<void>;
121
126
  clearSearch(): void;
122
- getSelectedValue(): any;
127
+ getSelectedValue(): string | number | undefined;
128
+ clearSelection(): void;
129
+ getSelections(): (string | number)[];
130
+ clearSelections(): void;
123
131
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
124
132
  search: (keyword: string) => any;
125
133
  select: (value: any, index: number, item: any) => any;
126
134
  "update:modelValue": (value: any) => any;
127
135
  add: () => any;
128
136
  "scroll-bottom": () => any;
137
+ "handle-selections-change": (selections: (string | number)[]) => any;
138
+ "handle-all-selections-change": (selections: (string | number)[], checked: boolean) => any;
129
139
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
130
140
  readonly title: {
131
141
  readonly type: StringConstructor;
@@ -195,6 +205,14 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
195
205
  readonly type: import("vue").PropType<string | number>;
196
206
  readonly default: undefined;
197
207
  };
208
+ readonly selectable: {
209
+ readonly type: BooleanConstructor;
210
+ readonly default: false;
211
+ };
212
+ readonly getSelectable: {
213
+ readonly type: import("vue").PropType<(item: any) => boolean>;
214
+ readonly default: () => () => boolean;
215
+ };
198
216
  readonly showHeader: {
199
217
  readonly type: BooleanConstructor;
200
218
  readonly default: true;
@@ -213,6 +231,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
213
231
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
214
232
  onAdd?: (() => any) | undefined;
215
233
  "onScroll-bottom"?: (() => any) | undefined;
234
+ "onHandle-selections-change"?: ((selections: (string | number)[]) => any) | undefined;
235
+ "onHandle-all-selections-change"?: ((selections: (string | number)[], checked: boolean) => any) | undefined;
216
236
  }>, {
217
237
  readonly data: any[];
218
238
  readonly title: string;
@@ -226,6 +246,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
226
246
  readonly itemHeight: number;
227
247
  readonly immediate: boolean;
228
248
  readonly pageSize: number;
249
+ readonly selectable: boolean;
229
250
  readonly showSearch: boolean;
230
251
  readonly searchKey: string;
231
252
  readonly searchPlaceholder: string;
@@ -234,6 +255,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
234
255
  readonly idKey: string;
235
256
  readonly nameKey: string;
236
257
  readonly addText: string;
258
+ readonly getSelectable: (item: any) => boolean;
237
259
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
238
260
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
239
261
  declare const _default: typeof __VLS_export;
@@ -72,6 +72,14 @@ export declare const listCardProps: {
72
72
  readonly type: PropType<string | number>;
73
73
  readonly default: undefined;
74
74
  };
75
+ readonly selectable: {
76
+ readonly type: BooleanConstructor;
77
+ readonly default: false;
78
+ };
79
+ readonly getSelectable: {
80
+ readonly type: PropType<(item: any) => boolean>;
81
+ readonly default: () => () => boolean;
82
+ };
75
83
  readonly showHeader: {
76
84
  readonly type: BooleanConstructor;
77
85
  readonly default: true;
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from 'vue';
2
+ import SelectedPanelComponent from './index.vue';
3
+ declare const SelectPanel: typeof SelectedPanelComponent & Plugin;
4
+ export default SelectPanel;
5
+ export type { SelectPanelProps } from './props.js';
@@ -0,0 +1,108 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ readonly modelValue: {
3
+ readonly type: import("vue").PropType<any[]>;
4
+ readonly default: () => never[];
5
+ };
6
+ readonly max: {
7
+ readonly type: NumberConstructor;
8
+ readonly default: undefined;
9
+ };
10
+ readonly itemKey: {
11
+ readonly type: import("vue").PropType<string | ((item: any) => any)>;
12
+ readonly default: "id";
13
+ };
14
+ readonly itemLabel: {
15
+ readonly type: import("vue").PropType<string | ((item: any) => string)>;
16
+ readonly default: "label";
17
+ };
18
+ readonly showClear: {
19
+ readonly type: BooleanConstructor;
20
+ readonly default: true;
21
+ };
22
+ readonly showRemove: {
23
+ readonly type: import("vue").PropType<boolean | ((item: any, index: number) => boolean)>;
24
+ readonly default: true;
25
+ };
26
+ readonly showRefresh: {
27
+ readonly type: BooleanConstructor;
28
+ readonly default: false;
29
+ };
30
+ readonly emptyText: {
31
+ readonly type: StringConstructor;
32
+ readonly default: "暂无数据";
33
+ };
34
+ readonly title: {
35
+ readonly type: StringConstructor;
36
+ readonly default: "已选";
37
+ };
38
+ readonly maxHeight: {
39
+ readonly type: import("vue").PropType<number | string>;
40
+ readonly default: undefined;
41
+ };
42
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
43
+ "update:modelValue": (value: any[]) => any;
44
+ change: (value: any[]) => any;
45
+ remove: (item: any, index: number) => any;
46
+ clear: () => any;
47
+ refresh: () => any;
48
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
49
+ readonly modelValue: {
50
+ readonly type: import("vue").PropType<any[]>;
51
+ readonly default: () => never[];
52
+ };
53
+ readonly max: {
54
+ readonly type: NumberConstructor;
55
+ readonly default: undefined;
56
+ };
57
+ readonly itemKey: {
58
+ readonly type: import("vue").PropType<string | ((item: any) => any)>;
59
+ readonly default: "id";
60
+ };
61
+ readonly itemLabel: {
62
+ readonly type: import("vue").PropType<string | ((item: any) => string)>;
63
+ readonly default: "label";
64
+ };
65
+ readonly showClear: {
66
+ readonly type: BooleanConstructor;
67
+ readonly default: true;
68
+ };
69
+ readonly showRemove: {
70
+ readonly type: import("vue").PropType<boolean | ((item: any, index: number) => boolean)>;
71
+ readonly default: true;
72
+ };
73
+ readonly showRefresh: {
74
+ readonly type: BooleanConstructor;
75
+ readonly default: false;
76
+ };
77
+ readonly emptyText: {
78
+ readonly type: StringConstructor;
79
+ readonly default: "暂无数据";
80
+ };
81
+ readonly title: {
82
+ readonly type: StringConstructor;
83
+ readonly default: "已选";
84
+ };
85
+ readonly maxHeight: {
86
+ readonly type: import("vue").PropType<number | string>;
87
+ readonly default: undefined;
88
+ };
89
+ }>> & Readonly<{
90
+ "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
91
+ onChange?: ((value: any[]) => any) | undefined;
92
+ onRemove?: ((item: any, index: number) => any) | undefined;
93
+ onClear?: (() => any) | undefined;
94
+ onRefresh?: (() => any) | undefined;
95
+ }>, {
96
+ readonly title: string;
97
+ readonly modelValue: any[];
98
+ readonly maxHeight: string | number;
99
+ readonly emptyText: string;
100
+ readonly itemKey: string | ((item: any) => any);
101
+ readonly max: number;
102
+ readonly itemLabel: string | ((item: any) => string);
103
+ readonly showClear: boolean;
104
+ readonly showRemove: boolean | ((item: any, index: number) => boolean);
105
+ readonly showRefresh: boolean;
106
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
107
+ declare const _default: typeof __VLS_export;
108
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ export declare const selectPanelProps: {
3
+ readonly modelValue: {
4
+ readonly type: PropType<any[]>;
5
+ readonly default: () => never[];
6
+ };
7
+ readonly max: {
8
+ readonly type: NumberConstructor;
9
+ readonly default: undefined;
10
+ };
11
+ readonly itemKey: {
12
+ readonly type: PropType<string | ((item: any) => any)>;
13
+ readonly default: "id";
14
+ };
15
+ readonly itemLabel: {
16
+ readonly type: PropType<string | ((item: any) => string)>;
17
+ readonly default: "label";
18
+ };
19
+ readonly showClear: {
20
+ readonly type: BooleanConstructor;
21
+ readonly default: true;
22
+ };
23
+ readonly showRemove: {
24
+ readonly type: PropType<boolean | ((item: any, index: number) => boolean)>;
25
+ readonly default: true;
26
+ };
27
+ readonly showRefresh: {
28
+ readonly type: BooleanConstructor;
29
+ readonly default: false;
30
+ };
31
+ readonly emptyText: {
32
+ readonly type: StringConstructor;
33
+ readonly default: "暂无数据";
34
+ };
35
+ readonly title: {
36
+ readonly type: StringConstructor;
37
+ readonly default: "已选";
38
+ };
39
+ readonly maxHeight: {
40
+ readonly type: PropType<number | string>;
41
+ readonly default: undefined;
42
+ };
43
+ };
44
+ export type SelectPanelProps = ExtractPropTypes<typeof selectPanelProps>;
@@ -11,7 +11,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
11
11
  readonly default: 3;
12
12
  };
13
13
  readonly wildcards: {
14
- readonly type: import("vue").PropType<import("..").Option[]>;
14
+ readonly type: import("vue").PropType<import("..").WildcardOption[]>;
15
15
  readonly default: () => never[];
16
16
  };
17
17
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
@@ -30,7 +30,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
30
30
  readonly default: 3;
31
31
  };
32
32
  readonly wildcards: {
33
- readonly type: import("vue").PropType<import("..").Option[]>;
33
+ readonly type: import("vue").PropType<import("..").WildcardOption[]>;
34
34
  readonly default: () => never[];
35
35
  };
36
36
  }>> & Readonly<{
@@ -39,7 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
39
39
  }>, {
40
40
  readonly placeholder: string;
41
41
  readonly rows: number;
42
- readonly wildcards: import("..").Option[];
42
+ readonly wildcards: import("..").WildcardOption[];
43
43
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
45
45
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import { ExtractPropTypes, PropType } from 'vue';
2
- import { Option } from '../types';
2
+ import type { WildcardOption } from '../types';
3
3
  export declare const textRuleConfigProps: {
4
4
  readonly modelValue: {
5
5
  readonly type: StringConstructor;
@@ -13,7 +13,7 @@ export declare const textRuleConfigProps: {
13
13
  readonly default: 3;
14
14
  };
15
15
  readonly wildcards: {
16
- readonly type: PropType<Option[]>;
16
+ readonly type: PropType<WildcardOption[]>;
17
17
  readonly default: () => never[];
18
18
  };
19
19
  };
@@ -3,6 +3,7 @@ export * from './tag';
3
3
  export * from './transfer';
4
4
  export * from './virtual-list';
5
5
  export * from './editable-textarea';
6
+ export * from './text-rule-config';
6
7
  export * from './table';
7
8
  export type DefaultType = 'success' | 'info' | 'warning' | 'danger' | 'primary' | 'default';
8
9
  export type DefaultSize = 'small' | 'default' | 'large';
@@ -0,0 +1,14 @@
1
+ export interface WildcardOption {
2
+ /** 显示文案 */
3
+ label: string;
4
+ /** 插入值(无 onClick 时直接插入) */
5
+ value: string;
6
+ /** 提示信息 */
7
+ tip?: string;
8
+ /**
9
+ * 点击交互回调,不传则直接插入 value
10
+ * 传入后,点击通配符不会直接插入,而是调用此函数
11
+ * 调用方在回调内自行处理交互(弹窗、选择器等),完成后调用 done(最终插入值) 完成插入
12
+ */
13
+ onClick?: (done: (value: string) => void) => void;
14
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@xn-lib/component",
4
- "version": "0.1.41",
4
+ "version": "0.1.43",
5
5
  "description": "",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.mjs",