@yeepay/yee-boss-ui 0.1.13 → 0.1.15

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.
Files changed (39) hide show
  1. package/README.md +245 -17
  2. package/dist/components/PlatformConfigProvider.vue.d.ts +4 -9
  3. package/dist/components/descriptions/YeeDescriptions.vue.d.ts +5 -7
  4. package/dist/components/descriptions/index.d.ts +1 -1
  5. package/dist/components/descriptions/types.d.ts +25 -1
  6. package/dist/components/ellipsis-text/YeeEllipsisText.vue.d.ts +2 -8
  7. package/dist/components/ellipsis-text/index.d.ts +1 -1
  8. package/dist/components/ellipsis-text/types.d.ts +12 -1
  9. package/dist/components/file-preview/YeeFilePreview.vue.d.ts +3 -3
  10. package/dist/components/file-preview/index.d.ts +1 -1
  11. package/dist/components/file-preview/types.d.ts +38 -0
  12. package/dist/components/file-upload/YeeFileUpload.vue.d.ts +5 -14
  13. package/dist/components/file-upload/index.d.ts +1 -1
  14. package/dist/components/file-upload/types.d.ts +51 -0
  15. package/dist/components/form/YeeForm.vue.d.ts +2 -2
  16. package/dist/components/form/component-map.d.ts +9 -0
  17. package/dist/components/form/form-api.d.ts +10 -4
  18. package/dist/components/form/index.d.ts +1 -1
  19. package/dist/components/form/types.d.ts +114 -5
  20. package/dist/components/grid/YeeGrid.vue.d.ts +4 -110
  21. package/dist/components/grid/index.d.ts +2 -2
  22. package/dist/components/grid/types.d.ts +40 -3
  23. package/dist/components/grid/use-yee-grid.d.ts +6 -3
  24. package/dist/components/grid/yee-grid-api.d.ts +11 -3
  25. package/dist/components/modal/YeeModal.vue.d.ts +3 -14
  26. package/dist/components/modal/index.d.ts +3 -2
  27. package/dist/components/modal/types.d.ts +64 -2
  28. package/dist/components/page/YeePage.vue.d.ts +2 -8
  29. package/dist/components/page/index.d.ts +1 -1
  30. package/dist/components/page/types.d.ts +22 -0
  31. package/dist/components/platform-config-provider/types.d.ts +12 -0
  32. package/dist/components/select/YeeSelect.vue.d.ts +15 -13
  33. package/dist/components/select/index.d.ts +3 -2
  34. package/dist/components/select/types.d.ts +115 -13
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +1104 -1032
  37. package/dist/style.css +1 -1
  38. package/dist/theme/types.d.ts +65 -0
  39. package/package.json +4 -3
package/README.md CHANGED
@@ -74,6 +74,22 @@ import '@yeepay/yee-boss-ui/theme.css'
74
74
 
75
75
  `--yee-radius`、`--yee-radius-lg` 与 `--yee-radius-sm` 默认分别为 `4px`、`8px` 与 `2px`。公共组件使用基础圆角,Ant Design Vue 映射按对应尺寸消费这组语义化变量;需要特殊圆角时由 Portal 通过 `theme.tokens` 显式覆盖。
76
76
 
77
+ ## TypeScript 类型
78
+
79
+ 组件的公共类型都可以从包根入口导入。命名统一使用 `组件名 + Props / Emits / Slots`;存在组件实例方法时额外提供 `Expose`,例如 `YeeFileUploadExpose`。公共字段带中文 JSDoc,业务项目在编写 Props、监听事件、使用插槽或组件 `ref` 时可以直接获得 IDE 提示。
80
+
81
+ ```ts
82
+ import type {
83
+ YeeFileUploadEmits,
84
+ YeeFileUploadExpose,
85
+ YeeGridSlots,
86
+ YeeModalProps,
87
+ YeeSelectProps,
88
+ } from '@yeepay/yee-boss-ui'
89
+ ```
90
+
91
+ `YeeModal` 和 `YeeSelect` 的 Props 同时包含 Ant Design Vue 原生透传属性。`useYeeGrid<Row, QueryValues>` 会把行类型传递给列、事件、查询函数和具名插槽,不需要在页面中重复断言类型。
92
+
77
93
  ## Tailwind CSS
78
94
 
79
95
  ```js
@@ -122,21 +138,71 @@ export default {
122
138
  { label: '订单号', name: 'orderNo', value: orderNo, copyable: true },
123
139
  { label: '状态', name: 'status', value: status },
124
140
  ]"
125
- />
141
+ >
142
+ <template #content-status="{ item }">
143
+ <span>{{ item.value }}</span>
144
+ </template>
145
+ </YeeDescriptions>
126
146
  ```
127
147
 
128
148
  ### YeeFileUpload
129
149
 
130
150
  组件不接受上传 URL,也不依赖业务请求客户端。自动上传由 `customRequest` 完成;手动模式监听 `file-select`,完成后调用组件实例的 `addResult(uid, { url, name? })` 或 `addError(uid)`。
131
151
 
152
+ 自动上传模式通过回调接入项目统一请求层:
153
+
154
+ ```ts
155
+ import type { YeeUploadRequestOptions } from '@yeepay/yee-boss-ui'
156
+
157
+ async function uploadFile(options: YeeUploadRequestOptions): Promise<void> {
158
+ try {
159
+ const result = await uploadAttachment(options.file, options.onProgress)
160
+ options.onSuccess({ name: result.name, url: result.url })
161
+ }
162
+ catch (error) {
163
+ options.onError(error instanceof Error ? error : new Error('上传失败'))
164
+ }
165
+ }
166
+ ```
167
+
168
+ 手动模式适合先选择文件,再由页面决定何时请求或回写结果:
169
+
132
170
  ```vue
133
- <YeeFileUpload
134
- v-model:file-list="fileList"
135
- :custom-request="uploadFile"
136
- @file-removed="removeFile"
137
- />
171
+ <script setup lang="ts">
172
+ import { shallowRef } from 'vue'
173
+ import {
174
+ YeeFileUpload,
175
+ type YeeFileSelectPayload,
176
+ type YeeFileUploadExpose,
177
+ type YeeUploadFile,
178
+ } from '@yeepay/yee-boss-ui'
179
+
180
+ const uploadRef = shallowRef<YeeFileUploadExpose>()
181
+ const fileList = shallowRef<YeeUploadFile[]>([])
182
+
183
+ async function handleFileSelect({ file, uid }: YeeFileSelectPayload): Promise<void> {
184
+ try {
185
+ const result = await uploadAttachment(file)
186
+ uploadRef.value?.addResult(uid, { name: result.name, url: result.url })
187
+ }
188
+ catch {
189
+ uploadRef.value?.addError(uid)
190
+ }
191
+ }
192
+ </script>
193
+
194
+ <template>
195
+ <YeeFileUpload
196
+ ref="uploadRef"
197
+ v-model:file-list="fileList"
198
+ manual
199
+ @file-select="handleFileSelect"
200
+ />
201
+ </template>
138
202
  ```
139
203
 
204
+ 组件实例还提供 `getFiles()`,用于读取当前列表中的原始 `File[]`。
205
+
140
206
  ### YeeFilePreview
141
207
 
142
208
  `YeeFilePreview` 不依赖业务请求层,支持传入文件地址、`Blob`、`File` 或 `ArrayBuffer`。解析器由组件库统一提供,并按文件类型动态加载;消费者不需要额外安装 `xlsx`、`docx-preview`、`postal-mime` 等解析依赖。
@@ -144,11 +210,19 @@ export default {
144
210
  ```vue
145
211
  <script setup lang="ts">
146
212
  import { ref } from 'vue'
147
- import { YeeFilePreview } from '@yeepay/yee-boss-ui'
213
+ import {
214
+ YeeFilePreview,
215
+ type YeeFilePreviewError,
216
+ type YeeFilePreviewLoadResult,
217
+ } from '@yeepay/yee-boss-ui'
148
218
 
149
219
  const source = ref<string | Blob>('https://example.com/report.pdf')
150
220
 
151
- function handlePreviewError(error: { message: string }): void {
221
+ function handlePreviewLoad(result: YeeFilePreviewLoadResult): void {
222
+ console.info(result.kind, result.fileName)
223
+ }
224
+
225
+ function handlePreviewError(error: YeeFilePreviewError): void {
152
226
  console.error(error.message)
153
227
  }
154
228
  </script>
@@ -159,6 +233,7 @@ function handlePreviewError(error: { message: string }): void {
159
233
  :max-file-size="50 * 1024 * 1024"
160
234
  height="640"
161
235
  @error="handlePreviewError"
236
+ @load="handlePreviewLoad"
162
237
  />
163
238
  </template>
164
239
  ```
@@ -174,22 +249,147 @@ function handlePreviewError(error: { message: string }): void {
174
249
  使用标准 `v-model:open`。Modal 默认在 header 右侧显示全屏切换按钮,可通过 `v-model:fullscreen` 控制状态,或通过 `:fullscreen-button="false"` 隐藏。`type="drawer"` 适合长详情或复杂表单,不显示全屏按钮;`confirm` 只通知父组件,不会主动关闭,便于父组件在异步提交成功后再更新 `open`。
175
250
 
176
251
  ```vue
177
- <YeeModal
178
- v-model:fullscreen="fullscreen"
179
- v-model:open="open"
180
- title="提交确认"
181
- @confirm="submit"
182
- />
252
+ <script setup lang="ts">
253
+ import { shallowRef } from 'vue'
254
+ import { YeeModal } from '@yeepay/yee-boss-ui'
255
+
256
+ const open = shallowRef(false)
257
+ const submitting = shallowRef(false)
258
+
259
+ async function submit(): Promise<void> {
260
+ submitting.value = true
261
+ try {
262
+ await saveForm()
263
+ open.value = false
264
+ }
265
+ finally {
266
+ submitting.value = false
267
+ }
268
+ }
269
+ </script>
270
+
271
+ <template>
272
+ <YeeModal
273
+ v-model:open="open"
274
+ :confirm-button-loading="submitting"
275
+ title="提交确认"
276
+ @confirm="submit"
277
+ >
278
+ 确认提交当前内容?
279
+ </YeeModal>
280
+ </template>
183
281
  ```
184
282
 
283
+ Drawer 模式使用 `<YeeModal v-model:open="open" type="drawer" placement="right">`,`placement`、`getContainer`、`zIndex` 等原生属性会继续透传。
284
+
185
285
  ### YeeSelect
186
286
 
187
287
  `YeeSelect` 保持 Ant Design Vue `Select` 的透传能力,并针对当前选中项和默认 option 提供完整文案提示。
188
288
 
189
289
  ```vue
190
- <YeeSelect v-model:value="status" :options="statusOptions" />
290
+ <script setup lang="ts">
291
+ import { shallowRef } from 'vue'
292
+ import {
293
+ YeeSelect,
294
+ type YeeSelectExpose,
295
+ type YeeSelectOption,
296
+ type YeeSelectValue,
297
+ } from '@yeepay/yee-boss-ui'
298
+
299
+ const status = shallowRef<YeeSelectValue>()
300
+ const selectRef = shallowRef<YeeSelectExpose>()
301
+ const statusOptions: YeeSelectOption[] = [
302
+ { label: '成功', value: 'SUCCESS' },
303
+ { label: '失败', value: 'FAILED' },
304
+ ]
305
+
306
+ function focusSelect(): void {
307
+ selectRef.value?.focus()
308
+ }
309
+ </script>
310
+
311
+ <template>
312
+ <YeeSelect
313
+ ref="selectRef"
314
+ v-model:value="status"
315
+ allow-clear
316
+ show-search
317
+ :options="statusOptions"
318
+ >
319
+ <template #option="option">
320
+ {{ option.label }}
321
+ </template>
322
+ </YeeSelect>
323
+ <a-button @click="focusSelect">
324
+ 聚焦选择器
325
+ </a-button>
326
+ </template>
327
+ ```
328
+
329
+ 通过 `YeeSelectExpose` 可以调用 `focus()`、`blur()` 和 `scrollTo()`。`change`、`select`、`deselect`、`search`、`clear`、`focus`、`blur`、`popupScroll`、`dropdownVisibleChange` 等原生事件均有参数提示;`option`、`optionLabel`、`tagRender`、`dropdownRender`、`maxTagPlaceholder` 等作用域插槽也会提示对应参数。
330
+
331
+ ### YeeForm
332
+
333
+ `YeeForm` 可以独立使用,也会在 `useYeeGrid` 配置 `formOptions` 后自动挂载。Schema 的 `component` 是判别字段,选择组件后,`componentProps` 会提示对应 Ant Design Vue 组件或 `YeeFileUpload` 的原生属性。
334
+
335
+ 内置支持:`AutoComplete`、`Cascader`、`Checkbox`、`CheckboxGroup`、`DatePicker`、`Input`、`InputNumber`、`InputPassword`、`Mentions`、`Radio`、`RadioGroup`、`RangePicker`、`Rate`、`Segmented`、`Select`、`Slider`、`Switch`、`Textarea`、`TimePicker`、`TimeRangePicker`、`TreeSelect` 和 `Upload`。
336
+
337
+ ```vue
338
+ <script setup lang="ts">
339
+ import {
340
+ YeeForm,
341
+ YeeFormApi,
342
+ type YeeFormOptions,
343
+ } from '@yeepay/yee-boss-ui'
344
+
345
+ interface QueryValues {
346
+ channel?: 'OFFLINE' | 'ONLINE'
347
+ enabled?: boolean
348
+ orderNo?: string
349
+ }
350
+
351
+ const formApi = new YeeFormApi<QueryValues>()
352
+ const formOptions: YeeFormOptions<QueryValues> = {
353
+ schema: [
354
+ {
355
+ component: 'Input',
356
+ componentProps: { allowClear: true, placeholder: '请输入订单号' },
357
+ fieldName: 'orderNo',
358
+ label: '订单号',
359
+ },
360
+ {
361
+ component: 'Switch',
362
+ fieldName: 'enabled',
363
+ label: '是否启用',
364
+ },
365
+ {
366
+ component: 'Custom',
367
+ fieldName: 'channel',
368
+ label: '业务渠道',
369
+ },
370
+ ],
371
+ }
372
+
373
+ function query(values: QueryValues): void {
374
+ console.info(values.orderNo)
375
+ }
376
+ </script>
377
+
378
+ <template>
379
+ <YeeForm :api="formApi" :on-submit="query" :options="formOptions">
380
+ <template #channel="{ field, setValue, value, values }">
381
+ <button type="button" @click="setValue(value === 'ONLINE' ? 'OFFLINE' : 'ONLINE')">
382
+ {{ field.label }}:{{ values.channel ?? '未选择' }}
383
+ </button>
384
+ </template>
385
+ </YeeForm>
386
+ </template>
191
387
  ```
192
388
 
389
+ 字段同名插槽可以覆盖任意内置组件;只使用自定义内容时,将 `component` 设置为 `Custom`。插槽提供 `field`、`value`、`values` 和 `setValue`,其中字段值会根据 `QueryValues` 自动提示类型,并统一写回 `YeeFormApi`。
390
+
391
+ `YeeFormApi` 提供 `getFieldValue`、`getValues`、`setFieldValue`、`setValues`、`resetForm` 和 `updateSchema`;字段名和值会保持 `QueryValues` 中声明的类型。
392
+
193
393
  ## YeePage 与 VXE Grid
194
394
 
195
395
  `YeePage auto-content-height` 会使用宿主布局提供的 `--yee-content-height` 作为可选内容区高度;未注入时按 Page 父容器的 `100%` 计算,适合 Wujie 等嵌入场景。`heightOffset` 会从 Page 的整体高度中扣除宿主额外占用的空间。宿主如果需要注入该变量,可使用导出的 `CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT` 常量。
@@ -227,7 +427,13 @@ const formOptions: YeeFormOptions<QueryValues> = {
227
427
  }
228
428
 
229
429
  const gridOptions: YeeGridOptions<OrderItem, QueryValues> = {
230
- columns: [{ field: 'orderNo', title: '订单号' }],
430
+ columns: [
431
+ {
432
+ field: 'orderNo',
433
+ title: '订单号',
434
+ slots: { default: 'orderNo' },
435
+ },
436
+ ],
231
437
  pagerConfig: {},
232
438
  proxyConfig: {
233
439
  ajax: {
@@ -247,16 +453,38 @@ const [YeeGrid, gridApi] = useYeeGrid({
247
453
  gridOptions,
248
454
  })
249
455
 
456
+ function openDetail(row: OrderItem): void {
457
+ console.info(row.orderNo)
458
+ }
459
+
460
+ function createOrder(): void {
461
+ console.info('create order')
462
+ }
463
+
250
464
  defineExpose({ reload: gridApi.reload })
251
465
  </script>
252
466
 
253
467
  <template>
254
468
  <yee-page auto-content-height>
255
- <yee-grid table-title="订单明细" />
469
+ <yee-grid table-title="订单明细">
470
+ <template #orderNo="{ row }">
471
+ <a-button type="link" @click="openDetail(row)">
472
+ {{ row.orderNo }}
473
+ </a-button>
474
+ </template>
475
+
476
+ <template #toolbar-tools>
477
+ <a-button type="primary" @click="createOrder">
478
+ 新增
479
+ </a-button>
480
+ </template>
481
+ </yee-grid>
256
482
  </yee-page>
257
483
  </template>
258
484
  ```
259
485
 
486
+ `table-title`、`toolbar-actions`、`toolbar-tools` 以及列配置中的具名插槽都有类型提示,其中列插槽的 `row` 会保持 `OrderItem` 类型。`YeeGridApi` 提供 `query`、`reload`、`setGridOptions`、`setLoading`、`setState` 和 `toggleSearchForm`。
487
+
260
488
  组件的 TypeScript 导出使用 `YeeForm`、`YeeGrid`、`YeePage`,Vue 模板标签对应 `yee-form`、`yee-grid`、`yee-page`。新代码统一使用 `useYeeGrid`,不提供旧命名兼容别名。查询接口统一返回 `{ items, total }`。
261
489
 
262
490
  ## 开发
@@ -1,18 +1,13 @@
1
- import { PlatformTheme } from '../theme/types';
2
- interface Props {
3
- theme?: PlatformTheme;
4
- }
1
+ import { PlatformConfigProviderProps, PlatformConfigProviderSlots } from './platform-config-provider/types';
5
2
  declare function __VLS_template(): {
6
3
  attrs: Partial<{}>;
7
- slots: {
8
- default?(_: {}): any;
9
- };
4
+ slots: Readonly<PlatformConfigProviderSlots> & PlatformConfigProviderSlots;
10
5
  refs: {};
11
6
  rootEl: any;
12
7
  };
13
8
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
- declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
15
- theme: PlatformTheme;
9
+ declare const __VLS_component: import('vue').DefineComponent<PlatformConfigProviderProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PlatformConfigProviderProps> & Readonly<{}>, {
10
+ theme: import('..').PlatformTheme;
16
11
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
17
12
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
18
13
  export default _default;
@@ -1,16 +1,14 @@
1
- import { YeeDescriptionItem, YeeDescriptionsProps } from './types';
1
+ import { YeeDescriptionsProps } from './types';
2
2
  declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
- slots: Partial<Record<`content-${string}`, (_: {
5
- item: YeeDescriptionItem;
6
- }) => any>> & Partial<Record<`content-${string}`, (_: {
7
- item: YeeDescriptionItem;
8
- }) => any>>;
4
+ slots: Readonly<Partial<Record<`content-${string}`, (props: import('./types').YeeDescriptionContentSlotProps) => import('vue').VNodeChild>>> & Partial<Record<`content-${string}`, (props: import('./types').YeeDescriptionContentSlotProps) => import('vue').VNodeChild>>;
9
5
  refs: {};
10
6
  rootEl: any;
11
7
  };
12
8
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
- declare const __VLS_component: import('vue').DefineComponent<YeeDescriptionsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<YeeDescriptionsProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
+ declare const __VLS_component: import('vue').DefineComponent<YeeDescriptionsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<YeeDescriptionsProps> & Readonly<{}>, {
10
+ colon: boolean;
11
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
12
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
15
13
  export default _default;
16
14
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,2 +1,2 @@
1
1
  export { default as YeeDescriptions } from './YeeDescriptions.vue';
2
- export type { YeeDescriptionItem, YeeDescriptionsProps } from './types';
2
+ export type { YeeDescriptionContentSlotProps, YeeDescriptionItem, YeeDescriptionsProps, YeeDescriptionsSlots, } from './types';
@@ -1,20 +1,44 @@
1
- import { StyleValue } from 'vue';
1
+ import { StyleValue, VNodeChild } from 'vue';
2
+ /** 详情展示中的单个字段配置。 */
2
3
  export interface YeeDescriptionItem {
4
+ /** 是否显示复制按钮。 */
3
5
  copyable?: boolean;
6
+ /** 是否对过长内容显示省略 Tooltip。 */
4
7
  ellipsis?: boolean;
8
+ /** 字段值下方的补充说明。 */
5
9
  info?: string;
10
+ /** 补充说明的自定义样式。 */
6
11
  infoStyle?: StyleValue;
12
+ /** 字段标题。 */
7
13
  label: string;
14
+ /** 稳定字段名,同时用于生成 content-${name} 插槽名。 */
8
15
  name?: string;
16
+ /** 字段横跨的列数。 */
9
17
  span?: number;
18
+ /** 默认展示值。 */
10
19
  value: unknown;
11
20
  }
21
+ /** YeeDescriptions 的公开属性。 */
12
22
  export interface YeeDescriptionsProps {
23
+ /** 是否显示边框。 */
13
24
  bordered?: boolean;
25
+ /** 是否在字段标题后显示冒号。 */
14
26
  colon?: boolean;
27
+ /** 每行展示的字段列数。 */
15
28
  column?: number;
29
+ /** 详情字段列表。 */
16
30
  items: readonly YeeDescriptionItem[];
31
+ /** 字段标题和值的排列方式。 */
17
32
  layout?: 'horizontal' | 'vertical';
33
+ /** 组件尺寸。 */
18
34
  size?: 'default' | 'middle' | 'small';
35
+ /** 详情区域标题。 */
19
36
  title?: string;
20
37
  }
38
+ /** 动态内容插槽接收的参数。 */
39
+ export interface YeeDescriptionContentSlotProps {
40
+ /** 当前字段配置。 */
41
+ item: YeeDescriptionItem;
42
+ }
43
+ /** YeeDescriptions 的公开插槽,名称格式为 content-${字段 name}。 */
44
+ export type YeeDescriptionsSlots = Partial<Record<`content-${string}`, (props: YeeDescriptionContentSlotProps) => VNodeChild>>;
@@ -1,14 +1,8 @@
1
1
  import { CSSProperties } from 'vue';
2
- import { YeeEllipsisTextProps } from './types';
2
+ import { YeeEllipsisTextProps, YeeEllipsisTextSlots } from './types';
3
3
  declare function __VLS_template(): {
4
4
  attrs: Partial<{}>;
5
- slots: Readonly<{
6
- default?(): unknown;
7
- tooltip?(): unknown;
8
- }> & {
9
- default?(): unknown;
10
- tooltip?(): unknown;
11
- };
5
+ slots: Readonly<YeeEllipsisTextSlots> & YeeEllipsisTextSlots;
12
6
  refs: {
13
7
  text: HTMLDivElement;
14
8
  };
@@ -1,2 +1,2 @@
1
1
  export { default as YeeEllipsisText } from './YeeEllipsisText.vue';
2
- export type { YeeEllipsisTextEmits, YeeEllipsisTextPlacement, YeeEllipsisTextProps, } from './types';
2
+ export type { YeeEllipsisTextEmits, YeeEllipsisTextPlacement, YeeEllipsisTextProps, YeeEllipsisTextSlots, } from './types';
@@ -1,5 +1,7 @@
1
- import { CSSProperties } from 'vue';
1
+ import { CSSProperties, VNodeChild } from 'vue';
2
+ /** Tooltip 相对文本的展示位置。 */
2
3
  export type YeeEllipsisTextPlacement = 'bottom' | 'left' | 'right' | 'top';
4
+ /** YeeEllipsisText 的公开属性。 */
3
5
  export interface YeeEllipsisTextProps {
4
6
  /** 是否允许点击文本展开全部内容。 */
5
7
  expand?: boolean;
@@ -26,6 +28,15 @@ export interface YeeEllipsisTextProps {
26
28
  /** 是否仅在文本实际被截断时启用 Tooltip。 */
27
29
  tooltipWhenEllipsis?: boolean;
28
30
  }
31
+ /** YeeEllipsisText 的公开事件。 */
29
32
  export interface YeeEllipsisTextEmits {
33
+ /** 展开状态变化时触发。 */
30
34
  expandChange: [expanded: boolean];
31
35
  }
36
+ /** YeeEllipsisText 的公开插槽。 */
37
+ export interface YeeEllipsisTextSlots {
38
+ /** 需要省略展示的文本内容。 */
39
+ default?: () => VNodeChild;
40
+ /** Tooltip 中展示的完整内容;未传时复用 default。 */
41
+ tooltip?: () => VNodeChild;
42
+ }
@@ -1,13 +1,13 @@
1
- import { YeeFilePreviewError, YeeFilePreviewLoadResult, YeeFilePreviewProps } from './types';
1
+ import { YeeFilePreviewError, YeeFilePreviewProps } from './types';
2
2
  declare const _default: import('vue').DefineComponent<YeeFilePreviewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
3
  error: (error: YeeFilePreviewError) => any;
4
4
  unsupported: (error: YeeFilePreviewError) => any;
5
- load: (result: YeeFilePreviewLoadResult) => any;
5
+ load: (result: import('./types').YeeFilePreviewLoadResult) => any;
6
6
  download: () => any;
7
7
  }, string, import('vue').PublicProps, Readonly<YeeFilePreviewProps> & Readonly<{
8
8
  onError?: (error: YeeFilePreviewError) => any;
9
9
  onUnsupported?: (error: YeeFilePreviewError) => any;
10
- onLoad?: (result: YeeFilePreviewLoadResult) => any;
10
+ onLoad?: (result: import('./types').YeeFilePreviewLoadResult) => any;
11
11
  onDownload?: () => any;
12
12
  }>, {
13
13
  maxFileSize: number | undefined;
@@ -1,2 +1,2 @@
1
1
  export { default as YeeFilePreview } from './YeeFilePreview.vue';
2
- export type { YeeFilePreviewError, YeeFilePreviewKind, YeeFilePreviewProps, YeeFilePreviewSource, YeeFilePreviewStatus, YeeFilePreviewTableRow, } from './types';
2
+ export type { YeeFilePreviewEmits, YeeFilePreviewEmailMeta, YeeFilePreviewError, YeeFilePreviewKind, YeeFilePreviewLoadResult, YeeFilePreviewProps, YeeFilePreviewSource, YeeFilePreviewStatus, YeeFilePreviewTableRow, } from './types';
@@ -1,32 +1,70 @@
1
+ /** 可直接交给 YeeFilePreview 的文件来源。 */
1
2
  export type YeeFilePreviewSource = string | Blob | File | ArrayBuffer;
3
+ /** YeeFilePreview 当前支持识别的文件类型。 */
2
4
  export type YeeFilePreviewKind = 'image' | 'pdf' | 'text' | 'json' | 'xml' | 'csv' | 'markdown' | 'html' | 'video' | 'audio' | 'docx' | 'spreadsheet' | 'eml' | 'unsupported';
5
+ /** 文件预览的加载状态。 */
3
6
  export type YeeFilePreviewStatus = 'idle' | 'loading' | 'ready' | 'error' | 'unsupported';
7
+ /** YeeFilePreview 的公开属性。 */
4
8
  export interface YeeFilePreviewProps {
9
+ /** 文件地址、Blob、File 或 ArrayBuffer。 */
5
10
  source?: YeeFilePreviewSource | undefined;
11
+ /** 兼容只提供文件地址的调用方式,优先推荐 source。 */
6
12
  url?: string | undefined;
13
+ /** 用于格式识别和下载的文件名。 */
7
14
  fileName?: string | undefined;
15
+ /** 用于格式识别的 MIME 类型或扩展名。 */
8
16
  fileType?: string | undefined;
17
+ /** 预览区域高度,数字按 px 处理。 */
9
18
  height?: string | number | undefined;
19
+ /** 允许解析的最大文件字节数。 */
10
20
  maxFileSize?: number | undefined;
21
+ /** 表格预览最多展示的行数。 */
11
22
  maxRows?: number | undefined;
23
+ /** 表格预览最多展示的列数。 */
12
24
  maxColumns?: number | undefined;
25
+ /** 是否显示文件名和工具栏。 */
13
26
  showHeader?: boolean | undefined;
27
+ /** 是否显示下载按钮。 */
14
28
  showDownload?: boolean | undefined;
29
+ /** 图片预览的替代文本。 */
15
30
  alt?: string | undefined;
16
31
  }
32
+ /** 表格文件解析后的单行数据。 */
17
33
  export interface YeeFilePreviewTableRow {
34
+ /** 当前行的单元格文本。 */
18
35
  cells: string[];
19
36
  }
37
+ /** 文件预览失败或不支持时的错误信息。 */
20
38
  export interface YeeFilePreviewError {
39
+ /** 当前识别到的文件类型。 */
21
40
  kind: YeeFilePreviewKind;
41
+ /** 可直接展示给用户的错误信息。 */
22
42
  message: string;
43
+ /** 原始异常。 */
23
44
  cause?: unknown;
24
45
  }
46
+ /** 文件成功加载后的事件参数。 */
25
47
  export interface YeeFilePreviewLoadResult {
48
+ /** 当前文件类型。 */
26
49
  kind: YeeFilePreviewKind;
50
+ /** 最终解析出的文件名。 */
27
51
  fileName: string;
28
52
  }
53
+ /** EML 文件解析后的头部字段。 */
29
54
  export interface YeeFilePreviewEmailMeta {
55
+ /** 字段标题。 */
30
56
  label: string;
57
+ /** 字段内容。 */
31
58
  value: string;
32
59
  }
60
+ /** YeeFilePreview 的公开事件。 */
61
+ export interface YeeFilePreviewEmits {
62
+ /** 用户触发下载后触发。 */
63
+ download: [];
64
+ /** 文件加载或解析失败时触发。 */
65
+ error: [error: YeeFilePreviewError];
66
+ /** 文件成功加载后触发。 */
67
+ load: [result: YeeFilePreviewLoadResult];
68
+ /** 文件类型暂不支持在线预览时触发。 */
69
+ unsupported: [error: YeeFilePreviewError];
70
+ }
@@ -1,26 +1,17 @@
1
1
  import { YeeFileUploadProps, YeeUploadResult } from './types';
2
- declare function addResult(uid: string, result: Required<Pick<YeeUploadResult, 'url'>> & YeeUploadResult): void;
3
- declare function addError(uid: string): void;
4
- declare function getFiles(): File[];
5
2
  declare const _default: import('vue').DefineComponent<YeeFileUploadProps, {
6
- addError: typeof addError;
7
- addResult: typeof addResult;
8
- getFiles: typeof getFiles;
3
+ addError: (uid: string) => void;
4
+ addResult: (uid: string, result: Required<Pick<YeeUploadResult, "url">> & YeeUploadResult) => void;
5
+ getFiles: () => File[];
9
6
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
7
  fileRemoved: (file: import('ant-design-vue').UploadFile<unknown>) => any;
11
- fileSelect: (payload: {
12
- file: File;
13
- uid: string;
14
- }) => any;
8
+ fileSelect: (payload: import('./types').YeeFileSelectPayload) => any;
15
9
  "update:fileList": (fileList: import('ant-design-vue').UploadFile<unknown>[]) => any;
16
10
  uploadSuccess: () => any;
17
11
  uploadingChange: (isUploading: boolean) => any;
18
12
  }, string, import('vue').PublicProps, Readonly<YeeFileUploadProps> & Readonly<{
19
13
  onFileRemoved?: (file: import('ant-design-vue').UploadFile<unknown>) => any;
20
- onFileSelect?: (payload: {
21
- file: File;
22
- uid: string;
23
- }) => any;
14
+ onFileSelect?: (payload: import('./types').YeeFileSelectPayload) => any;
24
15
  "onUpdate:fileList"?: (fileList: import('ant-design-vue').UploadFile<unknown>[]) => any;
25
16
  onUploadSuccess?: () => any;
26
17
  onUploadingChange?: (isUploading: boolean) => any;
@@ -1,2 +1,2 @@
1
1
  export { default as YeeFileUpload } from './YeeFileUpload.vue';
2
- export type { YeeFileUploadProps, YeeUploadFile, YeeUploadRequestOptions, YeeUploadResult, } from './types';
2
+ export type { YeeFileSelectPayload, YeeFileUploadEmits, YeeFileUploadExpose, YeeFileUploadProps, YeeUploadFile, YeeUploadRequestOptions, YeeUploadResult, } from './types';