rtcpts 0.0.6 → 0.0.7

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,6 +1,7 @@
1
1
  import { PropType, SlotsType, DefineComponent, ExtractPropTypes, Ref, ComponentOptionsMixin, PublicProps, ComputedRef, ComponentProvideOptions } from 'vue';
2
- import { QBtn, QCard, QCardActions, QCardSection, QIcon, QPopupProxy, ComponentConstructor } from 'quasar';
2
+ import { QCard, QCardActions, QCardSection, QIcon, QPopupProxy, ComponentConstructor, QBtn, QTooltip } from 'quasar';
3
3
  import { t } from '../..';
4
+ import { JQButtonSizeType, JQButtonTypeType, JQButtonSlots } from '../j-q-button/index';
4
5
  type ModelValueType = any;
5
6
  export interface QInputRef {
6
7
  validate: () => boolean;
@@ -150,6 +151,92 @@ declare const _default: DefineComponent<ExtractPropTypes<{
150
151
  QCard: ComponentConstructor<QCard>;
151
152
  QCardSection: ComponentConstructor<QCardSection>;
152
153
  QCardActions: ComponentConstructor<QCardActions>;
153
- QBtn: ComponentConstructor<QBtn>;
154
+ JQButton: DefineComponent<ExtractPropTypes<{
155
+ size: {
156
+ type: PropType< JQButtonSizeType>;
157
+ default: "large";
158
+ validator: (value: JQButtonSizeType) => boolean;
159
+ };
160
+ type: {
161
+ type: PropType< JQButtonTypeType>;
162
+ default: "primary";
163
+ validator: (value: JQButtonTypeType) => boolean;
164
+ };
165
+ label: {
166
+ type: StringConstructor;
167
+ default: string;
168
+ };
169
+ icon: {
170
+ type: StringConstructor;
171
+ default: undefined;
172
+ };
173
+ loading: {
174
+ type: BooleanConstructor;
175
+ default: boolean;
176
+ };
177
+ tips: {
178
+ type: StringConstructor;
179
+ default: string;
180
+ };
181
+ }>, {
182
+ computedClass: ComputedRef<{
183
+ [x: string]: boolean;
184
+ 'j-q-button': boolean;
185
+ 'j-q-button--primary': boolean;
186
+ 'j-q-button--secondary': boolean;
187
+ 'j-q-button--text'?: undefined;
188
+ } | {
189
+ 'j-q-button--text': boolean;
190
+ 'j-q-button'?: undefined;
191
+ 'j-q-button--primary'?: undefined;
192
+ 'j-q-button--secondary'?: undefined;
193
+ }>;
194
+ iconPadding: ComputedRef<{
195
+ 'j-q-button-label': string | (() => any) | undefined;
196
+ }>;
197
+ click: (e: Event) => void;
198
+ qBtnRef: Ref< QBtn | null, QBtn | null>;
199
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
200
+ click: (e: Event) => true;
201
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
202
+ size: {
203
+ type: PropType< JQButtonSizeType>;
204
+ default: "large";
205
+ validator: (value: JQButtonSizeType) => boolean;
206
+ };
207
+ type: {
208
+ type: PropType< JQButtonTypeType>;
209
+ default: "primary";
210
+ validator: (value: JQButtonTypeType) => boolean;
211
+ };
212
+ label: {
213
+ type: StringConstructor;
214
+ default: string;
215
+ };
216
+ icon: {
217
+ type: StringConstructor;
218
+ default: undefined;
219
+ };
220
+ loading: {
221
+ type: BooleanConstructor;
222
+ default: boolean;
223
+ };
224
+ tips: {
225
+ type: StringConstructor;
226
+ default: string;
227
+ };
228
+ }>> & Readonly<{
229
+ onClick?: ((e: Event) => any) | undefined;
230
+ }>, {
231
+ type: JQButtonTypeType;
232
+ size: JQButtonSizeType;
233
+ label: string;
234
+ icon: string;
235
+ loading: boolean;
236
+ tips: string;
237
+ }, SlotsType< JQButtonSlots>, {
238
+ QBtn: ComponentConstructor<QBtn>;
239
+ QTooltip: ComponentConstructor<QTooltip>;
240
+ }, {}, string, ComponentProvideOptions, true, {}, any>;
154
241
  }, {}, string, ComponentProvideOptions, true, {}, any>;
155
242
  export default _default;
@@ -1,18 +1,32 @@
1
1
  import { PropType, SlotsType, DefineComponent, ExtractPropTypes, ComputedRef, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
2
  type FallbackValue = any;
3
3
  declare const _default: DefineComponent<ExtractPropTypes<{
4
+ /**
5
+ * 需要判断是否存在的原始值 (例如:row.name)。
6
+ * * 接受任何类型。
7
+ */
4
8
  value: {
5
9
  type: PropType<FallbackValue>;
6
10
  default: null;
7
11
  };
12
+ /**
13
+ * 无值时显示的默认内容
14
+ */
8
15
  defaultContent: {
9
16
  type: StringConstructor;
10
17
  default: string;
11
18
  };
19
+ /**
20
+ * 是否在无值时彻底隐藏组件,而不是显示 defaultContent
21
+ */
12
22
  rmDom: {
13
23
  type: BooleanConstructor;
14
24
  default: boolean;
15
25
  };
26
+ /**
27
+ * 可选:是否把 0 或 '0' 视为有效值 (true),或视为需要回退的值 (false)。
28
+ * 默认情况下,与 defaultFormat 逻辑保持一致:0 和 '0' 被视为有效值。
29
+ */
16
30
  zeroIsValid: {
17
31
  type: BooleanConstructor;
18
32
  default: boolean;
@@ -24,18 +38,32 @@ declare const _default: DefineComponent<ExtractPropTypes<{
24
38
  }>, {
25
39
  hasValue: ComputedRef<boolean>;
26
40
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
41
+ /**
42
+ * 需要判断是否存在的原始值 (例如:row.name)。
43
+ * * 接受任何类型。
44
+ */
27
45
  value: {
28
46
  type: PropType<FallbackValue>;
29
47
  default: null;
30
48
  };
49
+ /**
50
+ * 无值时显示的默认内容
51
+ */
31
52
  defaultContent: {
32
53
  type: StringConstructor;
33
54
  default: string;
34
55
  };
56
+ /**
57
+ * 是否在无值时彻底隐藏组件,而不是显示 defaultContent
58
+ */
35
59
  rmDom: {
36
60
  type: BooleanConstructor;
37
61
  default: boolean;
38
62
  };
63
+ /**
64
+ * 可选:是否把 0 或 '0' 视为有效值 (true),或视为需要回退的值 (false)。
65
+ * 默认情况下,与 defaultFormat 逻辑保持一致:0 和 '0' 被视为有效值。
66
+ */
39
67
  zeroIsValid: {
40
68
  type: BooleanConstructor;
41
69
  default: boolean;
@@ -1,28 +1,50 @@
1
1
  import { PropType, SlotsType, DefineComponent, ExtractPropTypes, ComputedRef, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ /**
3
+ * 通用的选项类型定义
4
+ */
2
5
  export interface OptionItem {
3
6
  label: string;
4
7
  value: any;
5
8
  [key: string]: any;
6
9
  }
10
+ /**
11
+ * 查找键的类型
12
+ */
7
13
  type LookupKey = 'label' | 'value';
8
14
  declare const _default: DefineComponent<ExtractPropTypes<{
15
+ /**
16
+ * 要查找的值 (例如:表格行中的某个 ID 或名称)。
17
+ */
9
18
  value: {
10
19
  type: PropType<any>;
11
20
  default: null;
12
21
  };
22
+ /**
23
+ * 选项列表,组件会在这个列表中进行查找。
24
+ */
13
25
  options: {
14
26
  type: PropType<OptionItem[]>;
15
27
  required: true;
16
28
  };
29
+ /**
30
+ * 指定查找时是匹配 options 元素的 'value' 还是 'label' 属性。
31
+ * 默认会同时匹配 'value' 和 'label' (如果提供了两个键)。
32
+ */
17
33
  matchKeys: {
18
34
  type: PropType<LookupKey[]>;
19
35
  default: () => string[];
20
36
  validator: (val: LookupKey[]) => boolean;
21
37
  };
38
+ /**
39
+ * 查找失败时显示的默认内容
40
+ */
22
41
  defaultContent: {
23
42
  type: StringConstructor;
24
43
  default: string;
25
44
  };
45
+ /**
46
+ * 是否在查找失败时彻底隐藏组件,而不是显示 defaultContent
47
+ */
26
48
  rmDom: {
27
49
  type: BooleanConstructor;
28
50
  default: boolean;
@@ -31,23 +53,39 @@ declare const _default: DefineComponent<ExtractPropTypes<{
31
53
  hasMatch: ComputedRef<boolean>;
32
54
  displayLabel: ComputedRef<string>;
33
55
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
56
+ /**
57
+ * 要查找的值 (例如:表格行中的某个 ID 或名称)。
58
+ */
34
59
  value: {
35
60
  type: PropType<any>;
36
61
  default: null;
37
62
  };
63
+ /**
64
+ * 选项列表,组件会在这个列表中进行查找。
65
+ */
38
66
  options: {
39
67
  type: PropType<OptionItem[]>;
40
68
  required: true;
41
69
  };
70
+ /**
71
+ * 指定查找时是匹配 options 元素的 'value' 还是 'label' 属性。
72
+ * 默认会同时匹配 'value' 和 'label' (如果提供了两个键)。
73
+ */
42
74
  matchKeys: {
43
75
  type: PropType<LookupKey[]>;
44
76
  default: () => string[];
45
77
  validator: (val: LookupKey[]) => boolean;
46
78
  };
79
+ /**
80
+ * 查找失败时显示的默认内容
81
+ */
47
82
  defaultContent: {
48
83
  type: StringConstructor;
49
84
  default: string;
50
85
  };
86
+ /**
87
+ * 是否在查找失败时彻底隐藏组件,而不是显示 defaultContent
88
+ */
51
89
  rmDom: {
52
90
  type: BooleanConstructor;
53
91
  default: boolean;
@@ -8,15 +8,24 @@ type LabelLike<T> = string | ((ctx: {
8
8
  type TranslateFn = (key: string, variables?: Record<string, any>) => string;
9
9
  export type JCMoreMenuAction<T = any> = {
10
10
  key?: string | number;
11
+ /** 权限码;不传则默认当作有权限 */
11
12
  permissionCode?: string | null;
13
+ /** 无权限时是否移除 DOM(默认 true) */
12
14
  rmDom?: boolean;
15
+ /** 无权限且 rmDom=false 时显示的默认文案 */
13
16
  defaultContent?: string;
17
+ /** 文案:优先 label,其次 i18nKey */
14
18
  label?: LabelLike<T>;
15
19
  i18nKey?: string;
20
+ /** 是否可点击(默认 true) */
16
21
  clickable?: boolean;
22
+ /** 点击后是否自动关闭弹层(默认 true) */
17
23
  closePopup?: boolean;
24
+ /** 是否显示该 action(默认 true) */
18
25
  visible?: BoolLike<T>;
26
+ /** 是否禁用该 action(默认 false) */
19
27
  disabled?: BoolLike<T>;
28
+ /** 点击回调 */
20
29
  onClick?: (item: T) => void | Promise<void>;
21
30
  };
22
31
  declare const _default: DefineComponent<ExtractPropTypes<{
@@ -44,6 +53,9 @@ declare const _default: DefineComponent<ExtractPropTypes<{
44
53
  type: StringConstructor;
45
54
  default: string;
46
55
  };
56
+ /**
57
+ * action preset 时生效:默认 offset/anchor/self/minWidth 贴近业务中的写法
58
+ */
47
59
  offset: {
48
60
  type: PropType<[number, number]>;
49
61
  default: undefined;
@@ -115,6 +127,9 @@ declare const _default: DefineComponent<ExtractPropTypes<{
115
127
  type: StringConstructor;
116
128
  default: string;
117
129
  };
130
+ /**
131
+ * action preset 时生效:默认 offset/anchor/self/minWidth 贴近业务中的写法
132
+ */
118
133
  offset: {
119
134
  type: PropType<[number, number]>;
120
135
  default: undefined;
@@ -3,22 +3,37 @@ type PermissionCode = string;
3
3
  export declare const PAGE_ACTION_PERMISSION_KEY: unique symbol;
4
4
  export declare const PAGE_PERMISSION_KEY: unique symbol;
5
5
  declare const _default: DefineComponent<ExtractPropTypes<{
6
+ /**
7
+ * 权限码。如果传递 falsy 值(如 null, undefined, 或空字符串),则默认认为有权限(用来测试或特殊逻辑)
8
+ */
6
9
  code: {
7
10
  type: PropType<PermissionCode | null>;
8
11
  default: null;
9
12
  };
13
+ /**
14
+ * 无权限时显示的默认内容
15
+ */
10
16
  defaultContent: {
11
17
  type: StringConstructor;
12
18
  default: string;
13
19
  };
20
+ /**
21
+ * 是否在无权限时彻底隐藏组件,而不是显示 defaultContent
22
+ */
14
23
  rmDom: {
15
24
  type: BooleanConstructor;
16
25
  default: boolean;
17
26
  };
27
+ /**
28
+ * 权限码列表(优先用 props 传入的,如果没有则用全局注入的)
29
+ */
18
30
  pagePermissionId: {
19
31
  type: PropType<PermissionCode[]>;
20
32
  default: undefined;
21
33
  };
34
+ /**
35
+ * 操作权限码列表(优先用 props 传入的,如果没有则用全局注入的)
36
+ */
22
37
  pageActionPermissionId: {
23
38
  type: PropType<PermissionCode[]>;
24
39
  default: undefined;
@@ -27,22 +42,37 @@ declare const _default: DefineComponent<ExtractPropTypes<{
27
42
  hasPermission: ComputedRef<boolean>;
28
43
  canRender: ComputedRef<boolean>;
29
44
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
45
+ /**
46
+ * 权限码。如果传递 falsy 值(如 null, undefined, 或空字符串),则默认认为有权限(用来测试或特殊逻辑)
47
+ */
30
48
  code: {
31
49
  type: PropType<PermissionCode | null>;
32
50
  default: null;
33
51
  };
52
+ /**
53
+ * 无权限时显示的默认内容
54
+ */
34
55
  defaultContent: {
35
56
  type: StringConstructor;
36
57
  default: string;
37
58
  };
59
+ /**
60
+ * 是否在无权限时彻底隐藏组件,而不是显示 defaultContent
61
+ */
38
62
  rmDom: {
39
63
  type: BooleanConstructor;
40
64
  default: boolean;
41
65
  };
66
+ /**
67
+ * 权限码列表(优先用 props 传入的,如果没有则用全局注入的)
68
+ */
42
69
  pagePermissionId: {
43
70
  type: PropType<PermissionCode[]>;
44
71
  default: undefined;
45
72
  };
73
+ /**
74
+ * 操作权限码列表(优先用 props 传入的,如果没有则用全局注入的)
75
+ */
46
76
  pageActionPermissionId: {
47
77
  type: PropType<PermissionCode[]>;
48
78
  default: undefined;
@@ -6,6 +6,7 @@ export interface TabOption {
6
6
  label: string;
7
7
  value: TModelValue;
8
8
  disable?: boolean;
9
+ /** 单个 tab 的最大宽度(优先级高于 itemMaxWidth) */
9
10
  maxWidth?: string | number;
10
11
  }
11
12
  declare const _default: DefineComponent<ExtractPropTypes<{
@@ -26,14 +27,17 @@ declare const _default: DefineComponent<ExtractPropTypes<{
26
27
  default: string;
27
28
  validator: (val: string) => boolean;
28
29
  };
30
+ /** tabs 支持换行(多行展示) */
29
31
  wrap: {
30
32
  type: BooleanConstructor;
31
33
  default: boolean;
32
34
  };
35
+ /** tabs 扩展铺满(每个 item 等分) */
33
36
  expand: {
34
37
  type: BooleanConstructor;
35
38
  default: boolean;
36
39
  };
40
+ /** tab item 最大宽度,超出省略号,hover tooltip 显示完整内容 */
37
41
  itemMaxWidth: {
38
42
  type: PropType<string | number>;
39
43
  default: undefined;
@@ -63,14 +67,17 @@ declare const _default: DefineComponent<ExtractPropTypes<{
63
67
  default: string;
64
68
  validator: (val: string) => boolean;
65
69
  };
70
+ /** tabs 支持换行(多行展示) */
66
71
  wrap: {
67
72
  type: BooleanConstructor;
68
73
  default: boolean;
69
74
  };
75
+ /** tabs 扩展铺满(每个 item 等分) */
70
76
  expand: {
71
77
  type: BooleanConstructor;
72
78
  default: boolean;
73
79
  };
80
+ /** tab item 最大宽度,超出省略号,hover tooltip 显示完整内容 */
74
81
  itemMaxWidth: {
75
82
  type: PropType<string | number>;
76
83
  default: undefined;
@@ -12,5 +12,12 @@ interface TransformConfig {
12
12
  optionValue?: string;
13
13
  optionChildren?: string;
14
14
  }
15
+ /**
16
+ * 把通用数组转成 label/value/children 格式的数组。
17
+ *
18
+ * @param array 待转换的原始数组。
19
+ * @param config 包含自定义键名的配置对象。
20
+ * @returns 转换后的 TargetOption 数组。
21
+ */
15
22
  export declare function transformTreeUseLabelAndValue(array: RawItem[], config?: TransformConfig): TargetOption[];
16
23
  export {};
@@ -1,40 +1,54 @@
1
- import { PropType, DefineComponent, ExtractPropTypes, ComputedRef, Slot, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
1
+ import { PropType, SlotsType, DefineComponent, ExtractPropTypes, ComputedRef, Ref, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
2
  import { QBtn, QTooltip, ComponentConstructor } from 'quasar';
3
- declare const enum TypeEnum {
4
- PRIMARY = "primary",
5
- SECONDARY = "secondary",
6
- TEXT = "text"
7
- }
8
- declare const enum IconSizeEnum {
9
- LARGE = "large",
10
- NORMAL = "normal",
11
- SMALL = "small"
12
- }
13
- type Size = IconSizeEnum;
14
- type Type = TypeEnum;
3
+ import { JQButtonSizeType, JQButtonTypeType, JQButtonSlots } from './types';
4
+ export * from './types';
15
5
  declare const _default: DefineComponent<ExtractPropTypes<{
6
+ /**
7
+ * 按钮大小
8
+ * @default 'large'
9
+ */
16
10
  size: {
17
- type: PropType<Size>;
18
- default: string;
19
- validator: (value: Size) => boolean;
11
+ type: PropType<JQButtonSizeType>;
12
+ default: "large";
13
+ validator: (value: JQButtonSizeType) => boolean;
20
14
  };
15
+ /**
16
+ * 按钮类型
17
+ * @default 'primary'
18
+ */
21
19
  type: {
22
- type: PropType<Type>;
23
- default: TypeEnum;
24
- validator: (value: Type) => boolean;
20
+ type: PropType<JQButtonTypeType>;
21
+ default: "primary";
22
+ validator: (value: JQButtonTypeType) => boolean;
25
23
  };
24
+ /**
25
+ * 按钮标签文字
26
+ * @default ''
27
+ */
26
28
  label: {
27
29
  type: StringConstructor;
28
30
  default: string;
29
31
  };
32
+ /**
33
+ * 按钮图标 (Quasar icon name)
34
+ * @default undefined
35
+ */
30
36
  icon: {
31
37
  type: StringConstructor;
32
38
  default: undefined;
33
39
  };
40
+ /**
41
+ * 按钮加载状态
42
+ * @default false
43
+ */
34
44
  loading: {
35
45
  type: BooleanConstructor;
36
46
  default: boolean;
37
47
  };
48
+ /**
49
+ * 按钮提示文字 (tooltip)
50
+ * @default ''
51
+ */
38
52
  tips: {
39
53
  type: StringConstructor;
40
54
  default: string;
@@ -53,35 +67,63 @@ declare const _default: DefineComponent<ExtractPropTypes<{
53
67
  'j-q-button--secondary'?: undefined;
54
68
  }>;
55
69
  iconPadding: ComputedRef<{
56
- 'j-q-button-label': string | Slot<any> | undefined;
70
+ 'j-q-button-label': string | (() => any) | undefined;
57
71
  }>;
58
72
  click: (e: Event) => void;
59
73
  qBtnRef: Ref<QBtn | null, QBtn | null>;
60
74
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
75
+ /**
76
+ * 点击事件
77
+ * @param e 原生点击事件
78
+ */
61
79
  click: (e: Event) => true;
62
80
  }, string, PublicProps, Readonly< ExtractPropTypes<{
81
+ /**
82
+ * 按钮大小
83
+ * @default 'large'
84
+ */
63
85
  size: {
64
- type: PropType<Size>;
65
- default: string;
66
- validator: (value: Size) => boolean;
86
+ type: PropType<JQButtonSizeType>;
87
+ default: "large";
88
+ validator: (value: JQButtonSizeType) => boolean;
67
89
  };
90
+ /**
91
+ * 按钮类型
92
+ * @default 'primary'
93
+ */
68
94
  type: {
69
- type: PropType<Type>;
70
- default: TypeEnum;
71
- validator: (value: Type) => boolean;
95
+ type: PropType<JQButtonTypeType>;
96
+ default: "primary";
97
+ validator: (value: JQButtonTypeType) => boolean;
72
98
  };
99
+ /**
100
+ * 按钮标签文字
101
+ * @default ''
102
+ */
73
103
  label: {
74
104
  type: StringConstructor;
75
105
  default: string;
76
106
  };
107
+ /**
108
+ * 按钮图标 (Quasar icon name)
109
+ * @default undefined
110
+ */
77
111
  icon: {
78
112
  type: StringConstructor;
79
113
  default: undefined;
80
114
  };
115
+ /**
116
+ * 按钮加载状态
117
+ * @default false
118
+ */
81
119
  loading: {
82
120
  type: BooleanConstructor;
83
121
  default: boolean;
84
122
  };
123
+ /**
124
+ * 按钮提示文字 (tooltip)
125
+ * @default ''
126
+ */
85
127
  tips: {
86
128
  type: StringConstructor;
87
129
  default: string;
@@ -89,13 +131,13 @@ declare const _default: DefineComponent<ExtractPropTypes<{
89
131
  }>> & Readonly<{
90
132
  onClick?: ((e: Event) => any) | undefined;
91
133
  }>, {
92
- type: TypeEnum;
93
- size: IconSizeEnum;
134
+ type: JQButtonTypeType;
135
+ size: JQButtonSizeType;
94
136
  label: string;
95
137
  icon: string;
96
138
  loading: boolean;
97
139
  tips: string;
98
- }, {}, {
140
+ }, SlotsType<JQButtonSlots>, {
99
141
  QBtn: ComponentConstructor<QBtn>;
100
142
  QTooltip: ComponentConstructor<QTooltip>;
101
143
  }, {}, string, ComponentProvideOptions, true, {}, any>;