@yeepay/yee-boss-ui 0.1.16 → 0.1.18
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.
- package/README.md +124 -59
- package/dist/PlatformConfigProvider-BwqlDDcK.js +34 -0
- package/dist/YeeDescriptions-BZ33odSs.js +128 -0
- package/dist/YeeEllipsisText-CR94Jym2.js +100 -0
- package/dist/YeeFileUpload-DvRN1D-j.js +196 -0
- package/dist/YeePage-Dbvn1TNi.js +99 -0
- package/dist/YeeTabs-BPzlkZy6.js +891 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/app-shell.d.ts +2 -0
- package/dist/app-shell.js +20 -0
- package/dist/components/app-shell/YeeAppShell.vue.d.ts +28 -0
- package/dist/components/app-shell/YeeHeader.vue.d.ts +40 -0
- package/dist/components/app-shell/YeeMenu.vue.d.ts +32 -0
- package/dist/components/app-shell/YeeSidebar.vue.d.ts +35 -0
- package/dist/components/app-shell/YeeTabs.vue.d.ts +69 -0
- package/dist/components/app-shell/index.d.ts +6 -0
- package/dist/components/app-shell/types.d.ts +258 -0
- package/dist/components/app-shell/use-tabs-drag.d.ts +7 -0
- package/dist/components/app-shell/use-tabs-scroll.d.ts +15 -0
- package/dist/components/grid/types.d.ts +1 -4
- package/dist/components/grid/vxe-init.d.ts +1 -1
- package/dist/components/modal/YeeModal.vue.d.ts +3 -3
- package/dist/context-C5gszWl6.js +4 -0
- package/dist/context-DJQ4f46a.js +12 -0
- package/dist/core.d.ts +8 -0
- package/dist/core.js +14 -0
- package/dist/descriptions.d.ts +1 -0
- package/dist/descriptions.js +4 -0
- package/dist/ellipsis-text.d.ts +1 -0
- package/dist/ellipsis-text.js +4 -0
- package/dist/file-upload.d.ts +1 -0
- package/dist/file-upload.js +4 -0
- package/dist/form-api-DbIL_dvg.js +201 -0
- package/dist/form.d.ts +1 -0
- package/dist/form.js +5 -0
- package/dist/grid.d.ts +1 -0
- package/dist/grid.js +5 -0
- package/dist/index-DZP16zRG.js +261 -0
- package/dist/index-kF3hvw2Z.js +132 -0
- package/dist/index.d.ts +2 -4
- package/dist/index.js +36 -2206
- package/dist/modal.d.ts +1 -0
- package/dist/modal.js +4 -0
- package/dist/page.d.ts +1 -0
- package/dist/page.js +4 -0
- package/dist/platform-message-BgD7E-34.js +22 -0
- package/dist/select.d.ts +1 -0
- package/dist/select.js +4 -0
- package/dist/style.css +1 -1
- package/dist/use-yee-grid-rYoenViE.js +464 -0
- package/package.json +68 -24
- package/dist/components/file-preview/YeeFilePreview.vue.d.ts +0 -23
- package/dist/components/file-preview/index.d.ts +0 -2
- package/dist/components/file-preview/source.d.ts +0 -8
- package/dist/components/file-preview/types.d.ts +0 -70
- package/dist/components/file-preview/useFilePreview.d.ts +0 -31
- package/dist/docx-preview.min-lCFRKxYn.js +0 -4852
- package/dist/marked.esm-DaHdfxOj.js +0 -1563
- package/dist/postal-mime-CPJ2QXsD.js +0 -3219
- package/dist/purify.es-HJ4qIUVZ.js +0 -869
- package/dist/xlsx-CF422ARu.js +0 -24728
package/README.md
CHANGED
|
@@ -19,18 +19,26 @@
|
|
|
19
19
|
- `YeeFileUpload` 业务无关的文件选择与上传生命周期。
|
|
20
20
|
- `YeeModal` 统一的 Modal / Drawer 容器。
|
|
21
21
|
- `YeeSelect` 带完整文案提示的选择器。
|
|
22
|
+
- `YeeAppShell`、`YeeHeader`、`YeeSidebar` 应用壳层布局。
|
|
23
|
+
- `YeeMenu` 路由菜单样式与 `YeeTabs` 标签栏样式。
|
|
22
24
|
- Tailwind CSS 语义主题 preset。
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
不提供业务组件或对 Ant Design Vue 基础组件的机械封装,也不依赖任何 `@vben-*` 包。
|
|
25
27
|
|
|
26
28
|
## 安装
|
|
27
29
|
|
|
30
|
+
基础组件和应用壳层:
|
|
31
|
+
|
|
28
32
|
```bash
|
|
29
|
-
pnpm add @yeepay/yee-boss-ui ant-design-vue vue
|
|
33
|
+
pnpm add @yeepay/yee-boss-ui ant-design-vue vue
|
|
30
34
|
```
|
|
31
35
|
|
|
36
|
+
`yee-boss-ui` 会自动安装 `YeeGrid` 所需的 VXE 运行时依赖。
|
|
37
|
+
|
|
32
38
|
## 使用
|
|
33
39
|
|
|
40
|
+
根入口适合兼容已有接入;它会导出全部公共组件。新页面建议使用下方的 feature entry,让 bundler 只加载实际使用的功能。
|
|
41
|
+
|
|
34
42
|
```vue
|
|
35
43
|
<script setup lang="ts">
|
|
36
44
|
import {
|
|
@@ -53,6 +61,104 @@ const theme: PlatformTheme = {
|
|
|
53
61
|
|
|
54
62
|
Portal 负责决定当前主题并通过 Runtime Context 传给子应用;组件库只负责映射和消费。语言与 locale 继续由应用国际化层负责。
|
|
55
63
|
|
|
64
|
+
### 按需引入
|
|
65
|
+
|
|
66
|
+
根入口保留完整 API 兼容性;业务项目如果只使用部分能力,建议使用对应的 feature entry,避免把未使用的 Grid/VXE 代码带入页面:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { YeeAppShell, YeeHeader, YeeSidebar, YeeTabs } from '@yeepay/yee-boss-ui/app-shell'
|
|
70
|
+
import { PlatformConfigProvider } from '@yeepay/yee-boss-ui/core'
|
|
71
|
+
import { YeeDescriptions } from '@yeepay/yee-boss-ui/descriptions'
|
|
72
|
+
import { YeeEllipsisText } from '@yeepay/yee-boss-ui/ellipsis-text'
|
|
73
|
+
import { YeeFileUpload } from '@yeepay/yee-boss-ui/file-upload'
|
|
74
|
+
import { YeeForm, YeeFormApi } from '@yeepay/yee-boss-ui/form'
|
|
75
|
+
import { useYeeGrid } from '@yeepay/yee-boss-ui/grid'
|
|
76
|
+
import { YeeModal } from '@yeepay/yee-boss-ui/modal'
|
|
77
|
+
import { YeePage } from '@yeepay/yee-boss-ui/page'
|
|
78
|
+
import { YeeSelect } from '@yeepay/yee-boss-ui/select'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`@yeepay/yee-boss-ui/grid` 仅在页面确实使用 `YeeGrid` 时引入;VXE 由 `yee-boss-ui` 作为运行时依赖提供,不需要业务项目重复声明。`app-shell`、`core` 及其它入口不会主动加载 Grid/VXE。所有入口共用 `@yeepay/yee-boss-ui/style.css`。
|
|
82
|
+
|
|
83
|
+
### 应用壳层
|
|
84
|
+
|
|
85
|
+
应用壳层只提供布局和展示状态,不读取路由、权限、用户 Store 或 Wujie 上下文。菜单权限、路由跳转、标签增删、刷新、主题切换、全屏和用户操作由应用处理,再通过 Props、Events 和插槽接入。
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<script setup lang="ts">
|
|
89
|
+
import { shallowRef } from 'vue'
|
|
90
|
+
import {
|
|
91
|
+
YeeAppShell,
|
|
92
|
+
YeeHeader,
|
|
93
|
+
YeeSidebar,
|
|
94
|
+
YeeTabs,
|
|
95
|
+
} from '@yeepay/yee-boss-ui/app-shell'
|
|
96
|
+
|
|
97
|
+
const sidebarCollapsed = shallowRef(false)
|
|
98
|
+
const activeTab = shallowRef('overview')
|
|
99
|
+
const menuItems = [
|
|
100
|
+
{ key: 'overview', label: '概览' },
|
|
101
|
+
{ key: 'settings', label: '系统设置' },
|
|
102
|
+
]
|
|
103
|
+
const tabs = [
|
|
104
|
+
{ key: 'overview', label: '概览', closable: false },
|
|
105
|
+
{ key: 'settings', label: '系统设置' },
|
|
106
|
+
]
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<template>
|
|
110
|
+
<YeeAppShell v-model:sidebar-collapsed="sidebarCollapsed">
|
|
111
|
+
<template #header>
|
|
112
|
+
<YeeHeader
|
|
113
|
+
v-model:sidebar-collapsed="sidebarCollapsed"
|
|
114
|
+
title="运营管理平台"
|
|
115
|
+
>
|
|
116
|
+
<template #content>
|
|
117
|
+
<YeeTabs v-model:active-key="activeTab" :items="tabs" />
|
|
118
|
+
</template>
|
|
119
|
+
<template #actions>
|
|
120
|
+
<!-- 可在默认刷新、主题、全屏按钮后追加用户模块等自定义内容。 -->
|
|
121
|
+
</template>
|
|
122
|
+
</YeeHeader>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<template #sidebar>
|
|
126
|
+
<YeeSidebar
|
|
127
|
+
v-model:collapsed="sidebarCollapsed"
|
|
128
|
+
:items="menuItems"
|
|
129
|
+
:selected-keys="[activeTab]"
|
|
130
|
+
/>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<RouterView />
|
|
134
|
+
</YeeAppShell>
|
|
135
|
+
</template>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`YeeSidebar` 的默认插槽是菜单区域,未提供时自动渲染 `YeeMenu`;需要替换或扩展菜单内容时可以使用默认插槽。`YeeMenu` 同一时间只展开当前父级菜单,打开新的父级菜单会自动收起其它父级菜单;受控或未受控模式下,选中子项都会自动展开其父级。菜单项点击会触发 `click` 事件,菜单选中变化仍触发 `select` 事件,因此重复点击当前选中项也可以由业务层处理。`extra` 插槽固定在菜单区域底部,可放帮助入口、版本信息或快捷操作。`YeeHeader` 的 `brand` 插槽可以完整替换左侧品牌区域;不需要完全接管时,可以单独使用 `logo` 和 `title` 插槽覆盖默认 Logo 或标题。`content` 插槽位于 Sidebar 按钮右侧,用于放置 `YeeTabs` 或任意自定义内容;`actions` 插槽用于在默认操作后追加用户模块等内容。Header 默认提供刷新、主题切换和全屏按钮,可通过 `showRefresh`、`showThemeToggle`、`showFullscreen` 关闭对应按钮;刷新通过 `refresh` 事件通知应用,主题通过 `themeMode` 属性和 `theme-change` 事件与 `PlatformConfigProvider` 的受控主题状态连接,全屏由 Header 管理浏览器 Fullscreen API,并通过 `fullscreen-change` 事件同步状态。默认 Sidebar 宽度为 `224px`,收起宽度为 `64px`;在 `YeeAppShell` 内由 Shell 统一控制,单独使用 `YeeHeader` 或 `YeeSidebar` 时再使用它们各自的尺寸 Props。
|
|
139
|
+
|
|
140
|
+
`YeeTabs` 固定使用 Vben 风格的卡片式标签样式,支持图标、固定/取消固定、关闭按钮、鼠标滚轮横向滚动、溢出时的左右滚动按钮、激活标签自动定位、中键关闭和桌面端拖拽排序。固定标签始终显示在未固定标签之前,各组内保持调用方传入的相对顺序。标签支持右键菜单,组件右侧也提供同一套更多操作菜单,默认包含关闭、固定/取消固定、刷新、在新窗口打开、关闭左右侧、关闭其它和关闭全部;可以通过 `contextMenus` 按标签和上下文自定义菜单,或通过 `:show-actions="false"` 隐藏右侧菜单。刷新只通过 `refresh` 事件通知应用,组件不自行重新加载页面。组件不直接修改调用方的路由或标签列表,菜单操作、固定状态和排序都通过事件交给应用处理;需要在其它业务入口触发相同操作时,可以使用组件 ref 调用 `YeeTabsExpose`:
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<script setup lang="ts">
|
|
144
|
+
import { shallowRef } from 'vue'
|
|
145
|
+
import type { YeeTabsExpose } from '@yeepay/yee-boss-ui/app-shell'
|
|
146
|
+
|
|
147
|
+
const tabsRef = shallowRef<YeeTabsExpose>()
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<template>
|
|
151
|
+
<YeeTabs ref="tabsRef" :items="tabs" v-model:active-key="activeKey"
|
|
152
|
+
:draggable="true" :middle-click-to-close="true"
|
|
153
|
+
@close="handleClose" @close-left="handleCloseLeft"
|
|
154
|
+
@close-right="handleCloseRight" @close-others="handleCloseOthers"
|
|
155
|
+
@close-all="handleCloseAll" @pin="handlePin" @sort-tabs="handleSort"
|
|
156
|
+
@refresh="handleRefresh" @open-in-new-window="handleOpen" />
|
|
157
|
+
</template>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`YeeTabItem.pinned` 表示固定状态;固定标签不能关闭或拖拽,组件展示和 `getTabs` 返回值都会将固定标签置于未固定标签之前。实例方法包括 `activateTab`、`closeTab`、`closeLeftTabs`、`closeRightTabs`、`closeOtherTabs`、`closeAllTabs`、`getTabs`、`getTab`、`pinTab`、`refreshTab` 和 `openTabInNewWindow`。方法只发出操作事件并返回是否找到目标标签,标签数组和路由状态仍由调用方维护。
|
|
161
|
+
|
|
56
162
|
只需要公共主题、不使用组件时,可以只引入:
|
|
57
163
|
|
|
58
164
|
```ts
|
|
@@ -76,7 +182,7 @@ import '@yeepay/yee-boss-ui/theme.css'
|
|
|
76
182
|
|
|
77
183
|
## TypeScript 类型
|
|
78
184
|
|
|
79
|
-
|
|
185
|
+
组件的公共类型可以从包根入口或对应的 feature entry 导入。命名统一使用 `组件名 + Props / Emits / Slots`;存在组件实例方法时额外提供 `Expose`,例如 `YeeFileUploadExpose`。公共字段带中文 JSDoc,业务项目在编写 Props、监听事件、使用插槽或组件 `ref` 时可以直接获得 IDE 提示。
|
|
80
186
|
|
|
81
187
|
```ts
|
|
82
188
|
import type {
|
|
@@ -152,7 +258,7 @@ export default {
|
|
|
152
258
|
自动上传模式通过回调接入项目统一请求层:
|
|
153
259
|
|
|
154
260
|
```ts
|
|
155
|
-
import type { YeeUploadRequestOptions } from '@yeepay/yee-boss-ui'
|
|
261
|
+
import type { YeeUploadRequestOptions } from '@yeepay/yee-boss-ui/file-upload'
|
|
156
262
|
|
|
157
263
|
async function uploadFile(options: YeeUploadRequestOptions): Promise<void> {
|
|
158
264
|
try {
|
|
@@ -175,7 +281,7 @@ import {
|
|
|
175
281
|
type YeeFileSelectPayload,
|
|
176
282
|
type YeeFileUploadExpose,
|
|
177
283
|
type YeeUploadFile,
|
|
178
|
-
} from '@yeepay/yee-boss-ui'
|
|
284
|
+
} from '@yeepay/yee-boss-ui/file-upload'
|
|
179
285
|
|
|
180
286
|
const uploadRef = shallowRef<YeeFileUploadExpose>()
|
|
181
287
|
const fileList = shallowRef<YeeUploadFile[]>([])
|
|
@@ -203,47 +309,6 @@ async function handleFileSelect({ file, uid }: YeeFileSelectPayload): Promise<vo
|
|
|
203
309
|
|
|
204
310
|
组件实例还提供 `getFiles()`,用于读取当前列表中的原始 `File[]`。
|
|
205
311
|
|
|
206
|
-
### YeeFilePreview
|
|
207
|
-
|
|
208
|
-
`YeeFilePreview` 不依赖业务请求层,支持传入文件地址、`Blob`、`File` 或 `ArrayBuffer`。解析器由组件库统一提供,并按文件类型动态加载;消费者不需要额外安装 `xlsx`、`docx-preview`、`postal-mime` 等解析依赖。
|
|
209
|
-
|
|
210
|
-
```vue
|
|
211
|
-
<script setup lang="ts">
|
|
212
|
-
import { ref } from 'vue'
|
|
213
|
-
import {
|
|
214
|
-
YeeFilePreview,
|
|
215
|
-
type YeeFilePreviewError,
|
|
216
|
-
type YeeFilePreviewLoadResult,
|
|
217
|
-
} from '@yeepay/yee-boss-ui'
|
|
218
|
-
|
|
219
|
-
const source = ref<string | Blob>('https://example.com/report.pdf')
|
|
220
|
-
|
|
221
|
-
function handlePreviewLoad(result: YeeFilePreviewLoadResult): void {
|
|
222
|
-
console.info(result.kind, result.fileName)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function handlePreviewError(error: YeeFilePreviewError): void {
|
|
226
|
-
console.error(error.message)
|
|
227
|
-
}
|
|
228
|
-
</script>
|
|
229
|
-
|
|
230
|
-
<template>
|
|
231
|
-
<YeeFilePreview
|
|
232
|
-
:source="source"
|
|
233
|
-
:max-file-size="50 * 1024 * 1024"
|
|
234
|
-
height="640"
|
|
235
|
-
@error="handlePreviewError"
|
|
236
|
-
@load="handlePreviewLoad"
|
|
237
|
-
/>
|
|
238
|
-
</template>
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
`source` 也可以直接传入 `Blob`、`File` 或 `ArrayBuffer`;需要兼容只提供地址的调用方时,可以使用 `url`。通常组件会根据文件名或 MIME 类型识别格式,也可以通过 `file-name`、`file-type` 显式指定。
|
|
242
|
-
|
|
243
|
-
当前支持图片、PDF、文本、JSON、XML、CSV、Markdown、HTML、音视频、DOCX、XLS/XLSX 和 EML。EML 会解析正文及 `cid:` 内嵌图片;DOCX 和 Excel 属于基础预览,不保证还原原始复杂排版。PPT/PPTX、DOC 等暂不支持在线解析,会提供下载回退。
|
|
244
|
-
|
|
245
|
-
远程地址的解析型文件需要服务端允许 CORS;图片、PDF、音视频仍由浏览器原生能力加载。远程下载会先读取为 Blob 再触发下载,不会主动打开新窗口。解析默认限制 50 MB、表格 200 行和 50 列,可通过 `max-file-size`、`max-rows`、`max-columns` 调整。
|
|
246
|
-
|
|
247
312
|
### YeeModal
|
|
248
313
|
|
|
249
314
|
使用标准 `v-model:open`。Modal 默认在 header 右侧显示全屏切换按钮,可通过 `v-model:fullscreen` 控制状态,或通过 `:fullscreen-button="false"` 隐藏。`type="drawer"` 适合长详情或复杂表单,不显示全屏按钮;`confirm` 只通知父组件,不会主动关闭,便于父组件在异步提交成功后再更新 `open`。
|
|
@@ -251,7 +316,7 @@ function handlePreviewError(error: YeeFilePreviewError): void {
|
|
|
251
316
|
```vue
|
|
252
317
|
<script setup lang="ts">
|
|
253
318
|
import { shallowRef } from 'vue'
|
|
254
|
-
import { YeeModal } from '@yeepay/yee-boss-ui'
|
|
319
|
+
import { YeeModal } from '@yeepay/yee-boss-ui/modal'
|
|
255
320
|
|
|
256
321
|
const open = shallowRef(false)
|
|
257
322
|
const submitting = shallowRef(false)
|
|
@@ -294,7 +359,7 @@ import {
|
|
|
294
359
|
type YeeSelectExpose,
|
|
295
360
|
type YeeSelectOption,
|
|
296
361
|
type YeeSelectValue,
|
|
297
|
-
} from '@yeepay/yee-boss-ui'
|
|
362
|
+
} from '@yeepay/yee-boss-ui/select'
|
|
298
363
|
|
|
299
364
|
const status = shallowRef<YeeSelectValue>()
|
|
300
365
|
const selectRef = shallowRef<YeeSelectExpose>()
|
|
@@ -340,7 +405,7 @@ import {
|
|
|
340
405
|
YeeForm,
|
|
341
406
|
YeeFormApi,
|
|
342
407
|
type YeeFormOptions,
|
|
343
|
-
} from '@yeepay/yee-boss-ui'
|
|
408
|
+
} from '@yeepay/yee-boss-ui/form'
|
|
344
409
|
|
|
345
410
|
interface QueryValues {
|
|
346
411
|
channel?: 'OFFLINE' | 'ONLINE'
|
|
@@ -396,16 +461,14 @@ function query(values: QueryValues): void {
|
|
|
396
461
|
|
|
397
462
|
`YeeGrid` 在普通 `YeePage` 或未使用 `YeePage` 时按表格内容自然撑高;放在开启 `auto-content-height` 的 `YeePage` 中时会自动占满查询表单之后的剩余高度,工具栏和分页器固定在可用区域内,数据超出后由表格内部滚动。表头和单元格内容超出时默认省略并提供 Tooltip;列宽默认允许拖拽调整,可通过 `gridOptions.columnConfig.resizable: false` 关闭。显式传入 `gridOptions.height` 时仍以该配置为准。
|
|
398
463
|
|
|
464
|
+
VXE Grid 样式已随公共 `style.css` 一起发布。使用 `YeeGrid` 或 `useYeeGrid` 时只需引入 `style.css`,无需额外加载样式文件。
|
|
465
|
+
|
|
399
466
|
```vue
|
|
400
467
|
<script setup lang="ts">
|
|
401
|
-
import type {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
} from '@yeepay/yee-boss-ui'
|
|
405
|
-
import {
|
|
406
|
-
YeePage,
|
|
407
|
-
useYeeGrid,
|
|
408
|
-
} from '@yeepay/yee-boss-ui'
|
|
468
|
+
import type { YeeFormOptions } from '@yeepay/yee-boss-ui/form'
|
|
469
|
+
import type { YeeGridOptions } from '@yeepay/yee-boss-ui/grid'
|
|
470
|
+
import { useYeeGrid } from '@yeepay/yee-boss-ui/grid'
|
|
471
|
+
import { YeePage } from '@yeepay/yee-boss-ui/page'
|
|
409
472
|
|
|
410
473
|
interface OrderItem {
|
|
411
474
|
orderNo: string
|
|
@@ -483,7 +546,7 @@ defineExpose({ reload: gridApi.reload })
|
|
|
483
546
|
</template>
|
|
484
547
|
```
|
|
485
548
|
|
|
486
|
-
`table-title`、`toolbar-actions`、`toolbar-tools` 以及列配置中的具名插槽都有类型提示,其中列插槽的 `row` 会保持 `OrderItem` 类型。`YeeGridApi` 提供 `query`、`reload`、`setGridOptions`、`setLoading`、`setState` 和 `toggleSearchForm
|
|
549
|
+
`table-title`、`toolbar-actions`、`toolbar-tools` 以及列配置中的具名插槽都有类型提示,其中列插槽的 `row` 会保持 `OrderItem` 类型。`YeeGridApi` 提供 `query`、`reload`、`setGridOptions`、`setLoading`、`setState` 和 `toggleSearchForm`;需要隐藏查询区时,可在 `useYeeGrid` 配置中设置 `showSearchForm: false`,不再提供工具栏显隐按钮。
|
|
487
550
|
|
|
488
551
|
组件的 TypeScript 导出使用 `YeeForm`、`YeeGrid`、`YeePage`,Vue 模板标签对应 `yee-form`、`yee-grid`、`yee-page`。新代码统一使用 `useYeeGrid`,不提供旧命名兼容别名。查询接口统一返回 `{ items, total }`。
|
|
489
552
|
|
|
@@ -497,10 +560,12 @@ pnpm pack --dry-run
|
|
|
497
560
|
|
|
498
561
|
## 组件演示
|
|
499
562
|
|
|
563
|
+
在线预览:[Yee Boss UI 组件演示](https://qaboss.yeepay.com/boss-ui-example/index.html)
|
|
564
|
+
|
|
500
565
|
本地演示入口覆盖当前公共组件与 light/dark 主题切换:
|
|
501
566
|
|
|
502
567
|
```bash
|
|
503
568
|
pnpm example
|
|
504
569
|
```
|
|
505
570
|
|
|
506
|
-
执行 `pnpm build:example`
|
|
571
|
+
执行 `pnpm build:example` 可验证演示入口的生产构建。演示产物独立部署,不会打入 npm 包。
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent as n, computed as t, provide as l, openBlock as i, createBlock as f, unref as d, withCtx as c, createElementVNode as p, normalizeStyle as h, renderSlot as _ } from "vue";
|
|
2
|
+
import { ConfigProvider as u } from "ant-design-vue";
|
|
3
|
+
import { r as v, t as C, a as P } from "./tokens-Dw6w0SSs.js";
|
|
4
|
+
import { p as T } from "./context-DJQ4f46a.js";
|
|
5
|
+
import { _ as g } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
+
const N = "--yee-content-height", y = ["data-theme"], x = /* @__PURE__ */ n({
|
|
7
|
+
name: "PlatformConfigProvider",
|
|
8
|
+
__name: "PlatformConfigProvider",
|
|
9
|
+
props: {
|
|
10
|
+
theme: { default: () => ({}) }
|
|
11
|
+
},
|
|
12
|
+
setup(o) {
|
|
13
|
+
const r = o, e = t(() => v(r.theme)), a = t(() => C(e.value)), s = t(() => P(e.value));
|
|
14
|
+
return l(T, e), (m, A) => (i(), f(d(u), {
|
|
15
|
+
"prefix-cls": "yee",
|
|
16
|
+
theme: a.value
|
|
17
|
+
}, {
|
|
18
|
+
default: c(() => [
|
|
19
|
+
p("div", {
|
|
20
|
+
class: "yee-ui-platform-theme",
|
|
21
|
+
"data-theme": e.value.mode,
|
|
22
|
+
style: h(s.value)
|
|
23
|
+
}, [
|
|
24
|
+
_(m.$slots, "default", {}, void 0, !0)
|
|
25
|
+
], 12, y)
|
|
26
|
+
]),
|
|
27
|
+
_: 3
|
|
28
|
+
}, 8, ["theme"]));
|
|
29
|
+
}
|
|
30
|
+
}), b = /* @__PURE__ */ g(x, [["__scopeId", "data-v-7e0afdd9"]]);
|
|
31
|
+
export {
|
|
32
|
+
N as C,
|
|
33
|
+
b as P
|
|
34
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { defineComponent as D, computed as d, reactive as E, onBeforeUnmount as Y, openBlock as n, createBlock as c, unref as i, mergeProps as N, withCtx as y, createElementBlock as f, Fragment as V, renderList as I, createElementVNode as _, renderSlot as b, createTextVNode as h, toDisplayString as m, normalizeClass as K, createCommentVNode as k, normalizeStyle as O } from "vue";
|
|
2
|
+
import { CheckOutlined as x, CopyOutlined as A } from "@ant-design/icons-vue";
|
|
3
|
+
import { Descriptions as C, Tooltip as g } from "ant-design-vue";
|
|
4
|
+
import { p as v } from "./platform-message-BgD7E-34.js";
|
|
5
|
+
import { _ as F } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
6
|
+
async function L(r) {
|
|
7
|
+
if (!r) return !1;
|
|
8
|
+
try {
|
|
9
|
+
return await navigator.clipboard.writeText(r), !0;
|
|
10
|
+
} catch {
|
|
11
|
+
const o = document.createElement("textarea");
|
|
12
|
+
o.value = r, o.style.position = "fixed", o.style.opacity = "0", document.body.append(o), o.focus(), o.select();
|
|
13
|
+
try {
|
|
14
|
+
return document.execCommand("copy");
|
|
15
|
+
} catch {
|
|
16
|
+
return !1;
|
|
17
|
+
} finally {
|
|
18
|
+
o.remove();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const M = { class: "yee-ui-descriptions__item" }, P = { class: "yee-ui-descriptions__content-row" }, U = { class: "yee-ui-descriptions__value yee-ui-descriptions__value--ellipsis" }, j = {
|
|
23
|
+
key: 1,
|
|
24
|
+
class: "yee-ui-descriptions__value"
|
|
25
|
+
}, q = ["aria-label", "disabled", "onClick"], G = /* @__PURE__ */ D({
|
|
26
|
+
name: "YeeDescriptions",
|
|
27
|
+
__name: "YeeDescriptions",
|
|
28
|
+
props: {
|
|
29
|
+
bordered: { type: Boolean },
|
|
30
|
+
colon: { type: Boolean, default: !0 },
|
|
31
|
+
column: {},
|
|
32
|
+
items: {},
|
|
33
|
+
layout: {},
|
|
34
|
+
size: {},
|
|
35
|
+
title: {}
|
|
36
|
+
},
|
|
37
|
+
setup(r) {
|
|
38
|
+
const o = r, w = d(() => o.bordered ?? !1), z = d(() => o.colon), S = d(() => o.column ?? 3), T = d(() => o.layout ?? "horizontal"), $ = d(() => o.size ?? "default"), a = E(/* @__PURE__ */ new Set()), p = /* @__PURE__ */ new Set();
|
|
39
|
+
function l(s, u) {
|
|
40
|
+
return s.name ?? `${s.label}-${u}`;
|
|
41
|
+
}
|
|
42
|
+
async function B(s, u) {
|
|
43
|
+
const e = String(s.value ?? "");
|
|
44
|
+
if (!e.trim()) {
|
|
45
|
+
v.warning("没有可复制的内容");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (!await L(e)) {
|
|
49
|
+
v.error("复制失败");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
a.add(u), v.success("已复制");
|
|
53
|
+
const t = setTimeout(() => {
|
|
54
|
+
a.delete(u), p.delete(t);
|
|
55
|
+
}, 1500);
|
|
56
|
+
p.add(t);
|
|
57
|
+
}
|
|
58
|
+
return Y(() => {
|
|
59
|
+
p.forEach((s) => clearTimeout(s)), p.clear();
|
|
60
|
+
}), (s, u) => (n(), c(i(C), N({
|
|
61
|
+
class: "yee-ui-descriptions",
|
|
62
|
+
bordered: w.value,
|
|
63
|
+
colon: z.value,
|
|
64
|
+
column: S.value,
|
|
65
|
+
layout: T.value,
|
|
66
|
+
size: $.value
|
|
67
|
+
}, o.title === void 0 ? {} : { title: o.title }), {
|
|
68
|
+
default: y(() => [
|
|
69
|
+
(n(!0), f(V, null, I(r.items, (e, t) => (n(), c(i(C).Item, {
|
|
70
|
+
key: l(e, t),
|
|
71
|
+
label: e.label,
|
|
72
|
+
span: e.span ?? 1
|
|
73
|
+
}, {
|
|
74
|
+
default: y(() => [
|
|
75
|
+
_("div", M, [
|
|
76
|
+
_("div", P, [
|
|
77
|
+
e.ellipsis ? (n(), c(i(g), {
|
|
78
|
+
key: 0,
|
|
79
|
+
title: String(e.value ?? "")
|
|
80
|
+
}, {
|
|
81
|
+
default: y(() => [
|
|
82
|
+
_("span", U, [
|
|
83
|
+
b(s.$slots, `content-${e.name ?? e.label}`, { item: e }, () => [
|
|
84
|
+
h(m(e.value), 1)
|
|
85
|
+
], !0)
|
|
86
|
+
])
|
|
87
|
+
]),
|
|
88
|
+
_: 2
|
|
89
|
+
}, 1032, ["title"])) : (n(), f("span", j, [
|
|
90
|
+
b(s.$slots, `content-${e.name ?? e.label}`, { item: e }, () => [
|
|
91
|
+
h(m(e.value), 1)
|
|
92
|
+
], !0)
|
|
93
|
+
])),
|
|
94
|
+
e.copyable ? (n(), c(i(g), {
|
|
95
|
+
key: 2,
|
|
96
|
+
title: a.has(l(e, t)) ? "已复制" : "复制"
|
|
97
|
+
}, {
|
|
98
|
+
default: y(() => [
|
|
99
|
+
_("button", {
|
|
100
|
+
class: K(["yee-ui-descriptions__copy", { "yee-ui-descriptions__copy--copied": a.has(l(e, t)) }]),
|
|
101
|
+
"aria-label": a.has(l(e, t)) ? "已复制" : "复制",
|
|
102
|
+
disabled: a.has(l(e, t)),
|
|
103
|
+
type: "button",
|
|
104
|
+
onClick: (H) => B(e, l(e, t))
|
|
105
|
+
}, [
|
|
106
|
+
a.has(l(e, t)) ? (n(), c(i(x), { key: 0 })) : (n(), c(i(A), { key: 1 }))
|
|
107
|
+
], 10, q)
|
|
108
|
+
]),
|
|
109
|
+
_: 2
|
|
110
|
+
}, 1032, ["title"])) : k("", !0)
|
|
111
|
+
]),
|
|
112
|
+
e.info ? (n(), f("span", {
|
|
113
|
+
key: 0,
|
|
114
|
+
class: "yee-ui-descriptions__info",
|
|
115
|
+
style: O(e.infoStyle)
|
|
116
|
+
}, m(e.info), 5)) : k("", !0)
|
|
117
|
+
])
|
|
118
|
+
]),
|
|
119
|
+
_: 2
|
|
120
|
+
}, 1032, ["label", "span"]))), 128))
|
|
121
|
+
]),
|
|
122
|
+
_: 3
|
|
123
|
+
}, 16, ["bordered", "colon", "column", "layout", "size"]));
|
|
124
|
+
}
|
|
125
|
+
}), Z = /* @__PURE__ */ F(G, [["__scopeId", "data-v-cd55dc37"]]);
|
|
126
|
+
export {
|
|
127
|
+
Z as Y
|
|
128
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineComponent as w, inject as O, useTemplateRef as F, shallowRef as d, computed as l, onMounted as R, onUpdated as Y, watch as K, onBeforeUnmount as N, openBlock as j, createBlock as A, unref as H, mergeProps as m, withCtx as y, createElementVNode as I, renderSlot as v, nextTick as L } from "vue";
|
|
2
|
+
import { Tooltip as P } from "ant-design-vue";
|
|
3
|
+
import { p as U } from "./context-DJQ4f46a.js";
|
|
4
|
+
import { _ as D } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
const V = ["aria-expanded", "role", "tabindex"], q = /* @__PURE__ */ w({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
name: "YeeEllipsisText",
|
|
8
|
+
__name: "YeeEllipsisText",
|
|
9
|
+
props: {
|
|
10
|
+
expand: { type: Boolean, default: !1 },
|
|
11
|
+
ellipsisThreshold: { default: 3 },
|
|
12
|
+
line: { default: 1 },
|
|
13
|
+
maxWidth: { default: "100%" },
|
|
14
|
+
placement: { default: "top" },
|
|
15
|
+
tooltip: { type: Boolean, default: !0 },
|
|
16
|
+
tooltipBackgroundColor: {},
|
|
17
|
+
tooltipColor: {},
|
|
18
|
+
tooltipFontSize: {},
|
|
19
|
+
tooltipMaxWidth: {},
|
|
20
|
+
tooltipOverlayStyle: { default: () => ({ textAlign: "justify" }) },
|
|
21
|
+
tooltipWhenEllipsis: { type: Boolean, default: !1 }
|
|
22
|
+
},
|
|
23
|
+
emits: ["expandChange"],
|
|
24
|
+
setup(W, { emit: g }) {
|
|
25
|
+
const t = W, C = g, n = O(U, void 0), c = F("text"), p = d(!1), o = d(!1), u = d(0), i = l(() => Number.isFinite(t.line) ? Math.max(1, Math.floor(t.line)) : 1), T = l(() => Number.isFinite(t.ellipsisThreshold) ? Math.max(0, t.ellipsisThreshold) : 3), b = l(() => typeof t.maxWidth == "number" ? `${t.maxWidth}px` : t.maxWidth), k = l(() => {
|
|
26
|
+
const e = { maxWidth: b.value };
|
|
27
|
+
return !o.value && i.value > 1 && (e.webkitLineClamp = i.value), e;
|
|
28
|
+
}), E = l(() => ({
|
|
29
|
+
"yee-ui-ellipsis-text--expandable": t.expand,
|
|
30
|
+
"yee-ui-ellipsis-text--expanded": o.value,
|
|
31
|
+
"yee-ui-ellipsis-text--multi-line": !o.value && i.value > 1,
|
|
32
|
+
"yee-ui-ellipsis-text--single-line": !o.value && i.value === 1
|
|
33
|
+
})), a = l(() => t.tooltipMaxWidth !== void 0 ? t.tooltipMaxWidth : u.value > 0 ? u.value + 24 : void 0), S = l(() => {
|
|
34
|
+
const e = {};
|
|
35
|
+
return a.value !== void 0 && (e.maxWidth = `${a.value}px`), e;
|
|
36
|
+
}), B = l(() => {
|
|
37
|
+
const e = {
|
|
38
|
+
...t.tooltipOverlayStyle,
|
|
39
|
+
backgroundColor: f.value,
|
|
40
|
+
color: t.tooltipColor || n?.value.tokens.popoverForeground || "var(--yee-popover-foreground)",
|
|
41
|
+
fontSize: t.tooltipFontSize === void 0 ? n ? `${n.value.tokens.fontSize}px` : "var(--yee-font-size)" : `${t.tooltipFontSize}px`
|
|
42
|
+
};
|
|
43
|
+
return a.value !== void 0 && (e.maxWidth = `${a.value}px`), e;
|
|
44
|
+
}), f = l(() => t.tooltipBackgroundColor || n?.value.tokens.popover || "var(--yee-popover)"), M = l(() => t.tooltip && !o.value && (!t.tooltipWhenEllipsis || p.value)), _ = l(() => M.value ? {} : { open: !1 });
|
|
45
|
+
let s;
|
|
46
|
+
function r() {
|
|
47
|
+
const e = c.value;
|
|
48
|
+
if (!e) return;
|
|
49
|
+
const h = e.getBoundingClientRect().width || e.clientWidth;
|
|
50
|
+
if (u.value = Math.ceil(h), !t.tooltipWhenEllipsis || o.value || !e.textContent?.trim()) {
|
|
51
|
+
p.value = !1;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const $ = i.value === 1 ? e.scrollWidth - e.clientWidth : e.scrollHeight - e.clientHeight;
|
|
55
|
+
p.value = $ > T.value;
|
|
56
|
+
}
|
|
57
|
+
function x() {
|
|
58
|
+
t.expand && (o.value = !o.value, C("expandChange", o.value), L(r));
|
|
59
|
+
}
|
|
60
|
+
function z(e) {
|
|
61
|
+
!t.expand || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), x());
|
|
62
|
+
}
|
|
63
|
+
return R(() => {
|
|
64
|
+
const e = c.value;
|
|
65
|
+
e && typeof ResizeObserver < "u" && (s = new ResizeObserver(r), s.observe(e)), r();
|
|
66
|
+
}), Y(r), K(() => t.expand, (e) => {
|
|
67
|
+
e || (o.value = !1);
|
|
68
|
+
}), N(() => {
|
|
69
|
+
s?.disconnect(), s = void 0;
|
|
70
|
+
}), (e, h) => (j(), A(H(P), m(_.value, {
|
|
71
|
+
color: f.value,
|
|
72
|
+
"overlay-inner-style": B.value,
|
|
73
|
+
"overlay-style": S.value,
|
|
74
|
+
placement: t.placement
|
|
75
|
+
}), {
|
|
76
|
+
title: y(() => [
|
|
77
|
+
v(e.$slots, "tooltip", {}, () => [
|
|
78
|
+
v(e.$slots, "default", {}, void 0, !0)
|
|
79
|
+
], !0)
|
|
80
|
+
]),
|
|
81
|
+
default: y(() => [
|
|
82
|
+
I("div", m({ ref: "text" }, e.$attrs, {
|
|
83
|
+
"aria-expanded": t.expand ? o.value : void 0,
|
|
84
|
+
class: ["yee-ui-ellipsis-text", E.value],
|
|
85
|
+
role: t.expand ? "button" : void 0,
|
|
86
|
+
style: k.value,
|
|
87
|
+
tabindex: t.expand ? 0 : void 0,
|
|
88
|
+
onClick: x,
|
|
89
|
+
onKeydown: z
|
|
90
|
+
}), [
|
|
91
|
+
v(e.$slots, "default", {}, void 0, !0)
|
|
92
|
+
], 16, V)
|
|
93
|
+
]),
|
|
94
|
+
_: 3
|
|
95
|
+
}, 16, ["color", "overlay-inner-style", "overlay-style", "placement"]));
|
|
96
|
+
}
|
|
97
|
+
}), Z = /* @__PURE__ */ D(q, [["__scopeId", "data-v-3aaa7ae9"]]);
|
|
98
|
+
export {
|
|
99
|
+
Z as Y
|
|
100
|
+
};
|