rtcpts 0.0.55 → 0.0.56

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.
@@ -2,4 +2,8 @@ export type IEnterFileType = {
2
2
  size: number;
3
3
  accept: string[];
4
4
  };
5
+ /**
6
+ * 文件进入对话框前的校验:校验首个文件的大小与扩展名是否在允许范围内。
7
+ * 不通过时弹出错误提示并返回 undefined;通过则返回原 files 数组。
8
+ */
5
9
  export declare function beforeFileEnter(files: File[], config?: IEnterFileType): File[] | undefined;
@@ -87,25 +87,52 @@ export interface SelectInputConfig {
87
87
  /** 额外的选择框属性 */
88
88
  selectProps?: Record<string, any>;
89
89
  }
90
+ /**
91
+ * `DialogProvider.register(props)` 的入参:与模板中 `JQDialog` 的 Props 大部分相同,并扩展命令式弹窗与 Prompt 模式字段。
92
+ *
93
+ * 行为概要:`dialogId` 由内部生成并注入,无需传入。`dialogType` 为 `text` / `textarea` / `select` 时进入 Prompt 模式,会强制使用内置 `prompt-content` 组件,并需传入对应的 `text` / `textarea` / `select` 配置;此时 `register` 返回 `Promise`(用户确认 resolve 值、关闭等逻辑见 `prompt-content`)。其它或未设 `dialogType` 时按普通对话框处理,传入的 `component` / `content` 等与模板中 `JQDialog` 一致,`register` 返回挂载后的实例,可在 `nextTick` 后调用 `open`、`close`、`setLoading`、`setConfirmVisible` 等(与 `index.vue` 的 `expose` 一致)。
94
+ */
90
95
  export interface JQDialogRegisterProps {
96
+ /** 是否允许焦点落到对话框外;同 `JQDialog` `allowFocusOutside`。 */
91
97
  allowFocusOutside?: boolean;
98
+ /** 是否显示底部按钮栏。 */
92
99
  showFooter?: boolean;
100
+ /** 是否显示确认按钮。 */
93
101
  showConfirm?: boolean;
102
+ /** 普通模式:主体动态组件(与 `content` 二选一)。Prompt 模式下由内部覆盖,无需传。 */
94
103
  component?: any;
104
+ /** 普通模式:无 `component` 时的备用动态组件。 */
95
105
  content?: any;
106
+ /** 传给动态组件的 `v-bind`;Prompt 模式下会与内置 `componentBind` 合并(含 `dialogInstance` 等)。 */
96
107
  componentBind?: Record<string, any>;
108
+ /** 传给动态组件的 `v-on`。Prompt 模式下可提供空对象避免告警。 */
97
109
  componentOn?: Record<string, any>;
110
+ /** 是否允许 ESC 关闭。 */
98
111
  closeOnEsc?: boolean;
112
+ /** 是否允许点击遮罩关闭。 */
99
113
  closeOnMask?: boolean;
114
+ /** 对话框位置;`right` 时为侧栏全高样式。 */
100
115
  position?: DialogPosition;
116
+ /** 是否显示标题栏。 */
101
117
  showHeader?: boolean;
118
+ /** 标题文案。 */
102
119
  title?: string;
120
+ /** 最大宽度;Prompt 模式未传时内部会按视口给默认(如 `30vw` / `25vw`)。 */
103
121
  maxWidth?: string | number;
122
+ /** 内容区最小高度;Prompt 模式未传时可能为 `'auto'`。 */
104
123
  minHeight?: string | number;
124
+ /** 追加在根 `q-dialog` 上的 class。 */
105
125
  dialogClass?: string | string[] | Record<string, boolean>;
126
+ /**
127
+ * `'dialog'` 或未设:普通对话框,用 `component` / `content`。
128
+ * `'text'` | `'textarea'` | `'select'`:Prompt 弹窗,必须配合对应配置对象。
129
+ */
106
130
  dialogType?: DialogType;
131
+ /** `dialogType === 'text'` 时的单行输入配置。 */
107
132
  text?: TextInputConfig;
133
+ /** `dialogType === 'textarea'` 时的多行输入配置。 */
108
134
  textarea?: TextareaInputConfig;
135
+ /** `dialogType === 'select'` 时的下拉配置(须含 `options`)。 */
109
136
  select?: SelectInputConfig;
110
137
  }
111
138
  export interface JQDialogExposed {
@@ -121,10 +148,29 @@ export interface JQDialogExposed {
121
148
  value: boolean;
122
149
  }) => void;
123
150
  }
151
+ /**
152
+ * 命令式弹窗入口:`DialogProvider` 单例的类型描述。
153
+ *
154
+ * 使用前可调用 {@link DialogProviderType.configure | configure} 注入路由、状态、国际化等;再通过 {@link DialogProviderType.register | register} 挂载对话框。
155
+ */
124
156
  export interface DialogProviderType {
157
+ /**
158
+ * 设置后续 `register` 创建子应用时复用的全局依赖(router、store、i18n、额外插件、图标映射、权限 provide 等)。
159
+ * 通常在应用启动时调用一次即可。
160
+ */
125
161
  configure(options: DialogProviderOptions): void;
162
+ /**
163
+ * 创建并挂载对话框;Prompt 模式返回 `Promise`,普通模式返回挂载实例。详见 `DialogProvider.register` 实现上的 JSDoc。
164
+ * @param props 见 {@link JQDialogRegisterProps}
165
+ */
126
166
  register(props: JQDialogRegisterProps): Promise<any>;
167
+ /**
168
+ * 按 `register` 注入的 `dialogId` 卸载对应子应用并从 DOM 移除容器;`id` 不存在时静默返回。
169
+ */
127
170
  destroy(dialogId: string): void;
171
+ /**
172
+ * 卸载并清理当前已登记的全部命令式对话框(内部 Map 清空)。
173
+ */
128
174
  destroyAll(): void;
129
175
  }
130
176
  export declare const DialogProvider: DialogProviderType;
@@ -1,4 +1,6 @@
1
1
  import { DefineComponent, SlotsType } from 'vue';
2
+ import { IEnterFileType } from './file';
3
+ import { formRules } from './form-rules';
2
4
  /** 对话框位置类型 */
3
5
  export declare const DialogPosition: {
4
6
  readonly STANDARD: "standard";
@@ -9,84 +11,88 @@ export declare const DialogPosition: {
9
11
  };
10
12
  /** 对话框位置类型 */
11
13
  export type DialogPositionType = (typeof DialogPosition)[keyof typeof DialogPosition];
12
- /** JQDialog Props 接口 */
14
+ /**
15
+ * JQDialog 组件 Props(与 `index.vue` 中 `props` 一致)。
16
+ *
17
+ * 使用方式:模板内挂载后通过 `ref` 调用 `open` / `close` 等(见 `JQDialogExpose`);命令式创建请用 `DialogProvider.register`(见 `index.ts` 的 `JQDialogRegisterProps`)。
18
+ */
13
19
  export interface JQDialogProps {
14
20
  /**
15
- * 是否允许点击外部区域
21
+ * 是否允许焦点落到对话框外(对应 Quasar `QDialog` 的 `allow-focus-outside`)。
16
22
  * @default true
17
23
  */
18
24
  allowFocusOutside?: boolean;
19
25
  /**
20
- * 是否显示底部
26
+ * 是否显示底部按钮栏(取消 / 确认)。
21
27
  * @default true
22
28
  */
23
29
  showFooter?: boolean;
24
30
  /**
25
- * 是否显示确认按钮
31
+ * 是否显示确认按钮;也可在打开后通过 `setConfirmVisible` 再改。
26
32
  * @default true
27
33
  */
28
34
  showConfirm?: boolean;
29
35
  /**
30
- * 动态组件
36
+ * 主体区域渲染的动态组件(`:is="component"`),与 `content` 二选一;会合并 `componentBind` / `componentOn`,并向子组件注入 `dialogInstance`(见实现)。
31
37
  */
32
38
  component?: any;
33
39
  /**
34
- * 内容组件
40
+ * 无 `component` 时使用的备用动态组件(仅 `v-bind` 无额外注入)。
35
41
  */
36
42
  content?: any;
37
43
  /**
38
- * 组件绑定属性
44
+ * 传给动态组件的 `v-bind`;实现中会合并 `dialogInstance`(含 `open`、`close`、`rules`、`beforeFile` 等)。
39
45
  */
40
46
  componentBind?: Record<string, any>;
41
47
  /**
42
- * 组件事件监听
48
+ * 传给动态组件的 `v-on`(事件名到处理函数)。
43
49
  */
44
- componentOn?: Record<string, Function>;
50
+ componentOn?: Record<string, (...args: unknown[]) => unknown>;
45
51
  /**
46
- * 是否允许按 ESC 关闭
52
+ * 是否允许按 ESC 关闭(对应 `no-esc-dismiss` 的反义)。
47
53
  * @default true
48
54
  */
49
55
  closeOnEsc?: boolean;
50
56
  /**
51
- * 是否允许点击遮罩关闭
57
+ * 是否允许点击遮罩关闭(对应 `no-backdrop-dismiss` 的反义)。
52
58
  * @default true
53
59
  */
54
60
  closeOnMask?: boolean;
55
61
  /**
56
- * 对话框唯一标识
62
+ * 供 `DialogProvider` 注册实例使用;关闭时若存在则会 `DialogProvider.destroy(dialogId)`。
57
63
  */
58
64
  dialogId?: string;
59
65
  /**
60
- * 对话框位置
66
+ * 对话框位置;`right` 时启用全高与侧滑过渡。
61
67
  * @default 'standard'
62
68
  */
63
69
  position?: DialogPositionType;
64
70
  /**
65
- * 是否显示头部
71
+ * 是否显示标题栏与关闭图标。
66
72
  * @default true
67
73
  */
68
74
  showHeader?: boolean;
69
75
  /**
70
- * 对话框标题
76
+ * 默认标题文案;可用 `#title` 插槽覆盖。
71
77
  */
72
78
  title?: string;
73
79
  /**
74
- * 最大宽度
80
+ * 最大宽度;仅在 `position === 'standard'` 时作用于卡片宽度样式。
75
81
  */
76
82
  maxWidth?: string | number;
77
83
  /**
78
- * 最小高度
84
+ * 内容区最小高度(数字视为 px)。
79
85
  * @default 320
80
86
  */
81
87
  minHeight?: string | number;
82
88
  /**
83
- * 追加在对话框根节点(q-dialog)上的 class
89
+ * 追加在根节点 `q-dialog` 上的 class(与内部 `j-q-dialog` 等并列)。
84
90
  */
85
91
  dialogClass?: string | string[] | Record<string, boolean>;
86
92
  }
87
- /** JQDialog Emits 接口 */
93
+ /** 组件未声明 `emit`;交互通过 `expose`(`JQDialogExpose`)与 `ref` 完成。 */
88
94
  export interface JQDialogEmits {
89
- [key: string]: any;
95
+ [key: string]: never;
90
96
  }
91
97
  /** JQDialog Slots 接口 */
92
98
  export interface JQDialogSlots {
@@ -127,9 +133,14 @@ export interface JQDialogExpose {
127
133
  */
128
134
  changeConfirmText: (text: string) => void;
129
135
  /**
130
- * 表单验证规则
136
+ * 与 `formRules(i18n)` 返回值一致,供子表单与 `componentBind.dialogInstance` 使用。
137
+ */
138
+ rules: ReturnType<typeof formRules>;
139
+ /**
140
+ * 与 `./file` 中 `beforeFileEnter` 相同:校验首个文件大小与扩展名;不通过时提示并返回 `undefined`,通过则返回原 `files`。
141
+ * 默认配置为 5MB、`xls`/`xlsx`。经 `componentBind.dialogInstance` 注入子组件;也可通过模板 `ref` 调用。
131
142
  */
132
- rules: any;
143
+ beforeFile: (files: File[], config?: IEnterFileType) => File[] | undefined;
133
144
  }
134
145
  /** JQDialog 组件类型定义 */
135
146
  export type JQDialogComponent = DefineComponent<JQDialogProps, JQDialogExpose, {}, {}, {}, {}, SlotsType<JQDialogSlots>, {}>;