@owocow/saber-ui 0.0.2 → 0.0.3
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 +206 -11
- package/dist/BadgeStatus.types.d.ts +1 -1
- package/dist/BadgeStatus.vue.d.ts +1 -1
- package/dist/SaberConfirmModal.vue_vue_type_script_setup_true_lang-Cqp9krYl.js +86 -0
- package/dist/SaberConfirmProvider.vue_vue_type_script_setup_true_lang-DUJ6ftNJ.js +30 -0
- package/dist/SaberDictCheckbox.vue_vue_type_script_setup_true_lang-DUbzy_C6.js +34 -0
- package/dist/SaberDictRadio.vue_vue_type_script_setup_true_lang-DR6-jSID.js +50 -0
- package/dist/SaberDictSelect.vue_vue_type_script_setup_true_lang-B8PTKNKX.js +35 -0
- package/dist/SaberDistrictSelect.vue_vue_type_script_setup_true_lang-BX8nLC35.js +257 -0
- package/dist/SaberInfo.vue_vue_type_script_setup_true_lang-B3W5VsGR.js +58 -0
- package/dist/SaberInfoProvider.vue_vue_type_script_setup_true_lang-3rF6bSCn.js +28 -0
- package/dist/SaberModal.vue_vue_type_script_setup_true_lang-DJno3jA3.js +71 -0
- package/dist/SaberModalWithMobile.vue_vue_type_script_setup_true_lang-aQlToncY.js +87 -0
- package/dist/SaberNoData.types.d.ts +11 -0
- package/dist/SaberNoData.vue.d.ts +24 -0
- package/dist/SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js +125 -0
- package/dist/SaberStatus.vue_vue_type_script_setup_true_lang-D9aRVCow.js +38 -0
- package/dist/SaberSwitchBar.vue_vue_type_script_setup_true_lang-CDx3Dcas.js +47 -0
- package/dist/SaberUploadImage.vue_vue_type_script_setup_true_lang-CAwci2Vr.js +224 -0
- package/dist/colors.d.ts +1 -1
- package/dist/components/SaberConfirmModal.mjs +4 -0
- package/dist/components/SaberConfirmModal.vue.d.ts +28 -0
- package/dist/components/SaberConfirmProvider.mjs +4 -0
- package/dist/components/SaberConfirmProvider.vue.d.ts +2 -0
- package/dist/components/SaberInfo.mjs +4 -0
- package/dist/components/SaberInfo.types.d.ts +14 -0
- package/dist/components/SaberInfo.vue.d.ts +21 -0
- package/dist/components/SaberInfoProvider.mjs +4 -0
- package/dist/components/SaberInfoProvider.vue.d.ts +20 -0
- package/dist/components/SaberModalWithMobile.mjs +4 -0
- package/dist/components/SaberModalWithMobile.vue.d.ts +36 -0
- package/dist/components/SaberStatus.mjs +4 -0
- package/dist/components/SaberStatus.types.d.ts +1 -0
- package/dist/components/SaberStatus.vue.d.ts +8 -0
- package/dist/components/SaberSwitchBar.mjs +4 -0
- package/dist/components/SaberSwitchBar.types.d.ts +13 -0
- package/dist/components/SaberSwitchBar.vue.d.ts +18 -0
- package/dist/components/info-context.d.ts +3 -0
- package/dist/composables/index.d.ts +12 -0
- package/dist/composables/use-address-parse.d.ts +15 -0
- package/dist/composables/use-address-parse.mjs +20 -0
- package/dist/composables/use-boolean.d.ts +8 -0
- package/dist/composables/use-boolean.mjs +20 -0
- package/dist/composables/use-confirm.d.ts +34 -0
- package/dist/composables/use-confirm.mjs +28 -0
- package/dist/composables/use-delay-unmount.d.ts +7 -0
- package/dist/composables/use-delay-unmount.mjs +26 -0
- package/dist/composables/use-delete.d.ts +13 -0
- package/dist/composables/use-delete.mjs +19 -0
- package/dist/composables/use-loading.d.ts +6 -0
- package/dist/composables/use-loading.mjs +8 -0
- package/dist/composables/use-skeleton.d.ts +5 -0
- package/dist/composables/use-skeleton.mjs +23 -0
- package/dist/composables/use-table.d.ts +57 -0
- package/dist/composables/use-table.mjs +87 -0
- package/dist/composables.mjs +21 -0
- package/dist/district-service-cOu1tbQG.js +147 -0
- package/dist/district.d.ts +3 -0
- package/dist/district.mjs +8 -0
- package/dist/forms/components/SaberFilterBar.vue.d.ts +41 -0
- package/dist/forms/components/SaberFormModal.vue.d.ts +31 -0
- package/dist/forms/components/SaberModal.vue.d.ts +34 -0
- package/dist/forms/components/fields/SaberDictCheckbox.vue.d.ts +24 -0
- package/dist/forms/components/fields/SaberDictRadio.vue.d.ts +24 -0
- package/dist/forms/components/fields/SaberDictSelect.vue.d.ts +28 -0
- package/dist/forms/components/fields/SaberDistrictSelect.vue.d.ts +31 -0
- package/dist/forms/components/fields/SaberInput.vue.d.ts +16 -0
- package/dist/forms/components/fields/SaberInputNumber.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberPopSelect.vue.d.ts +25 -0
- package/dist/forms/components/fields/SaberRadioGroup.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberSelect.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberTextarea.vue.d.ts +11 -0
- package/dist/forms/components/fields/SaberUploadImage.vue.d.ts +113 -0
- package/dist/forms/dict-checkbox.mjs +4 -0
- package/dist/forms/dict-radio.mjs +4 -0
- package/dist/forms/dict-select.mjs +4 -0
- package/dist/forms/dict-source.d.ts +3 -0
- package/dist/forms/district-select.mjs +4 -0
- package/dist/forms/district-service.d.ts +46 -0
- package/dist/forms/filter-state.d.ts +4 -0
- package/dist/forms/index.d.ts +24 -0
- package/dist/forms/plugin.d.ts +20 -0
- package/dist/forms/pop-select.mjs +4 -0
- package/dist/forms/presets/basic.d.ts +5 -0
- package/dist/forms/registry.d.ts +15 -0
- package/dist/forms/types.d.ts +102 -0
- package/dist/forms/upload-image-source.d.ts +3 -0
- package/dist/forms/upload-image.mjs +4 -0
- package/dist/forms/use-dict-options.d.ts +8 -0
- package/dist/forms.mjs +45 -0
- package/dist/index.d.ts +62 -1
- package/dist/index.mjs +122 -33
- package/dist/info-context-MfOfJNDT.js +4 -0
- package/dist/plugin-Dr3z0YFg.js +396 -0
- package/dist/types/api.d.ts +30 -0
- package/dist/types/auth.d.ts +54 -0
- package/dist/types/common.d.ts +14 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/upload-image-source-On8NHgmx.js +4 -0
- package/dist/use-dict-options-DjtbYYIa.js +38 -0
- package/dist/utils/addressParse.d.ts +37 -0
- package/dist/utils/addressParse.mjs +623 -0
- package/dist/utils/crypto.d.ts +11 -0
- package/dist/utils/crypto.mjs +36 -0
- package/dist/utils/filter.d.ts +20 -0
- package/dist/utils/filter.mjs +11 -0
- package/dist/utils/format.d.ts +9 -0
- package/dist/utils/format.mjs +7 -0
- package/dist/utils/http.d.ts +45 -0
- package/dist/utils/http.mjs +147 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.mjs +41 -0
- package/dist/utils/klona.d.ts +2 -0
- package/dist/utils/klona.mjs +4 -0
- package/dist/utils/nanoid.d.ts +2 -0
- package/dist/utils/nanoid.mjs +4 -0
- package/dist/utils/permission.d.ts +45 -0
- package/dist/utils/permission.mjs +38 -0
- package/dist/utils/rsa.d.ts +26 -0
- package/dist/utils/rsa.mjs +2073 -0
- package/dist/utils/storage.d.ts +29 -0
- package/dist/utils/storage.mjs +39 -0
- package/dist/utils/toast.d.ts +26 -0
- package/dist/utils/toast.mjs +17 -0
- package/dist/utils/tree.d.ts +20 -0
- package/dist/utils/tree.mjs +30 -0
- package/package.json +179 -9
- package/dist/index.cjs +0 -1
- package/dist/vite.cjs +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# @owocow/saber-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Saber application foundation for Vue 3 projects, built on top of [@nuxt/ui](https://ui.nuxt.com).
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
The VitePress documentation site lives in `docs/` and runs directly against the local `src/` code:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm docs:dev
|
|
11
|
+
pnpm docs:build
|
|
12
|
+
pnpm docs:preview
|
|
13
|
+
```
|
|
4
14
|
|
|
5
15
|
## Install
|
|
6
16
|
|
|
@@ -10,24 +20,39 @@ npm install @owocow/saber-ui @nuxt/ui
|
|
|
10
20
|
|
|
11
21
|
> Requires: `vue` ^3, `@nuxt/ui` ^4
|
|
12
22
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
### Setup (recommended)
|
|
23
|
+
## Consumption contract
|
|
16
24
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
> **重要**:saber-ui 的组件在宿主编译时需要 nuxt/ui 的 `#imports` / `#build/*` 虚拟模块,
|
|
26
|
+
> **任何使用 saber-ui 的宿主都必须运行 `@nuxt/ui/vite`**(Vite 项目下让 nuxt/ui 脱离 Nuxt 运行的标准插件)。
|
|
27
|
+
> 不满足该条件时,组件内的 `<UBadge>` / `<UIcon>` 与主题配置将无法解析。
|
|
20
28
|
|
|
21
29
|
```ts
|
|
22
30
|
// vite.config.ts
|
|
23
31
|
import vue from '@vitejs/plugin-vue'
|
|
24
|
-
import
|
|
32
|
+
import ui from '@nuxt/ui/vite'
|
|
25
33
|
|
|
26
34
|
export default defineConfig({
|
|
27
|
-
plugins: [
|
|
35
|
+
plugins: [
|
|
36
|
+
vue(),
|
|
37
|
+
ui({
|
|
38
|
+
theme: {
|
|
39
|
+
colors: ['primary', 'secondary', 'success', 'info', 'warning', 'error'],
|
|
40
|
+
},
|
|
41
|
+
// ... 主题配置会同样作用到 saber-ui 内部的 nuxt/ui 组件
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
28
44
|
})
|
|
29
45
|
```
|
|
30
46
|
|
|
47
|
+
> **关于 `@owocow/saber-ui/vite`**:它只是 `@nuxt/ui/vite` 的**转发导出**(re-export),
|
|
48
|
+
> saber-ui **不自带** Vite 插件。直接使用 `@nuxt/ui/vite` 即可,不必引入这个入口。
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install @owocow/saber-ui @nuxt/ui
|
|
54
|
+
```
|
|
55
|
+
|
|
31
56
|
```ts
|
|
32
57
|
// main.ts
|
|
33
58
|
import { createApp } from 'vue'
|
|
@@ -51,7 +76,7 @@ app.mount('#app')
|
|
|
51
76
|
|
|
52
77
|
### On-demand import
|
|
53
78
|
|
|
54
|
-
|
|
79
|
+
组件始终需要宿主提供 `@nuxt/ui/vite`,此处仅指按需引入组件而不是注册全部:
|
|
55
80
|
|
|
56
81
|
```vue
|
|
57
82
|
<script setup>
|
|
@@ -66,7 +91,177 @@ import { BadgeStatus } from '@owocow/saber-ui'
|
|
|
66
91
|
</template>
|
|
67
92
|
```
|
|
68
93
|
|
|
69
|
-
|
|
94
|
+
## Forms
|
|
95
|
+
|
|
96
|
+
`app.use(SaberUI)` 会全局注册 `SaberFilterBar`、`SaberFormModal`、`SaberModal` 和基础 Saber 字段,并为动态字段提供 app 级 registry。
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<script setup lang="ts">
|
|
100
|
+
import { ref } from 'vue'
|
|
101
|
+
import type { FilterField } from '@owocow/saber-ui/forms'
|
|
102
|
+
|
|
103
|
+
const params = ref({ keyword: '', status: undefined })
|
|
104
|
+
|
|
105
|
+
const fields: FilterField[] = [
|
|
106
|
+
{
|
|
107
|
+
key: 'keyword',
|
|
108
|
+
which: 'ui-input',
|
|
109
|
+
props: { placeholder: '搜索名称' },
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: 'status',
|
|
113
|
+
which: 'ui-select',
|
|
114
|
+
props: { items: [{ label: '启用', value: 'enabled' }] },
|
|
115
|
+
searchOn: 'update:model-value',
|
|
116
|
+
},
|
|
117
|
+
]
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<template>
|
|
121
|
+
<SaberFilterBar v-model="params" :fields="fields" @search="loadData" @reset="resetParams" />
|
|
122
|
+
</template>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
基础 registry 包含 `saber-input`、`saber-select` 等 Saber 字段,以及 `ui-input`、`ui-select`、`ui-textarea` 等 Nuxt UI 原生字段映射。
|
|
126
|
+
|
|
127
|
+
文本输入默认在 `change` 时触发搜索;Select、Radio 等值变更后立即搜索的字段应设置 `searchOn: 'update:model-value'`。复杂业务字段可使用 `searchOn: 'manual'`。
|
|
128
|
+
|
|
129
|
+
项目自定义字段在安装时提供:
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
import SaberUI from '@owocow/saber-ui'
|
|
133
|
+
import SupplierPicker from './SupplierPicker.vue'
|
|
134
|
+
|
|
135
|
+
app.use(SaberUI, {
|
|
136
|
+
forms: {
|
|
137
|
+
components: {
|
|
138
|
+
'supplier-picker': SupplierPicker,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
字典字段由宿主提供数据源,saber-ui 不依赖具体 store 或接口:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
const dictStore = useDictStore()
|
|
148
|
+
|
|
149
|
+
app.use(SaberUI, {
|
|
150
|
+
forms: {
|
|
151
|
+
dictDataSource: {
|
|
152
|
+
async loadOptions(dictType) {
|
|
153
|
+
await dictStore.loadDict(dictType)
|
|
154
|
+
return dictStore.getOptions(dictType)
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
})
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
配置后可使用 `saber-dict-radio`、`saber-dict-select`、`saber-dict-checkbox`,或直接使用全局组件 `SaberDictRadio`、`SaberDictSelect`、`SaberDictCheckbox`。`SaberDictSelect` 基于 `SaberPopSelect`,适合在 Modal 中使用。
|
|
162
|
+
|
|
163
|
+
行政区划选择和地址解析共用 app 级地区服务。使用内置高德数据源时只需配置 Web 服务 Key:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
app.use(SaberUI, {
|
|
167
|
+
forms: {
|
|
168
|
+
district: {
|
|
169
|
+
amapKey: import.meta.env.VITE_APP_AMAP_KEY,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
})
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
配置后,动态表单可直接使用 `saber-district-select`,无需页面引入组件、加载数据或传递 `districts`:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
const fields = [{
|
|
179
|
+
key: 'districtValue',
|
|
180
|
+
label: '所在地区',
|
|
181
|
+
which: 'saber-district-select',
|
|
182
|
+
}]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
地区数据仅在 `SaberDistrictSelect` 首次渲染或地址首次解析时加载;内置高德数据源默认使用 7 天 localStorage 缓存。也可以通过 `forms.district.dataSource` 替换成其他数据源。
|
|
186
|
+
|
|
187
|
+
自定义数据源、`DistrictService` 和区划类型可从 `@owocow/saber-ui/district` 独立导入;该入口不加载 UI 组件。
|
|
188
|
+
|
|
189
|
+
图片上传组件通过独立入口按需使用,上传、删除和响应字段由宿主适配:
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
import type { UploadImageDataSource } from '@owocow/saber-ui/forms'
|
|
193
|
+
|
|
194
|
+
const uploadImageDataSource: UploadImageDataSource<{ ossId: string; url: string }> = {
|
|
195
|
+
upload: (file, { onProgress }) => uploadFile(file, onProgress),
|
|
196
|
+
remove: value => deleteFile(value.ossId),
|
|
197
|
+
getKey: value => value.ossId,
|
|
198
|
+
getUrl: value => value.url,
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
app.use(SaberUI, {
|
|
202
|
+
forms: { uploadImageDataSource },
|
|
203
|
+
})
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
```vue
|
|
207
|
+
<script setup lang="ts">
|
|
208
|
+
import SaberUploadImage from '@owocow/saber-ui/forms/upload-image'
|
|
209
|
+
</script>
|
|
210
|
+
|
|
211
|
+
<template>
|
|
212
|
+
<SaberUploadImage v-model="avatar" />
|
|
213
|
+
</template>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`SaberUploadImage` 不进入默认 registry;动态表单需要使用时可按页面注册 `saber-upload-image`。远程删除适配器会收到 `initial` 或 `uploaded` 来源,宿主可据此决定是否立即删除文件。
|
|
217
|
+
|
|
218
|
+
## Utilities
|
|
219
|
+
|
|
220
|
+
通用应用能力通过独立子路径提供,不会从 `@owocow/saber-ui` 根入口自动加载:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
import { setupHttp, http } from '@owocow/saber-ui/utils/http'
|
|
224
|
+
import { setupStorage, storage } from '@owocow/saber-ui/utils/storage'
|
|
225
|
+
import { setupPermission, canAccess } from '@owocow/saber-ui/utils/permission'
|
|
226
|
+
import { getToast, setToast } from '@owocow/saber-ui/utils/toast'
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Vue 组件内推荐使用 composable;它会自动等待安装时配置的共享地区服务,并复用地址解析索引:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
import { useAddressParse } from '@owocow/saber-ui/composables/use-address-parse'
|
|
233
|
+
|
|
234
|
+
const { parseAddress } = useAddressParse()
|
|
235
|
+
const results = await parseAddress('张三 浙江省杭州市西湖区文三路90号 13800138000', true)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
底层地址解析器仍是纯函数,适用于 Node 脚本、单元测试或自定义数据:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { createAddressParser } from '@owocow/saber-ui/utils/addressParse'
|
|
242
|
+
const parser = createAddressParser(customDistricts)
|
|
243
|
+
const results = parser.parse('张三 浙江省杭州市西湖区文三路90号 13800138000', true)
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
行政区划节点至少需要包含 `name`、`adcode` 和可选的 `districts`。传入数据应以省级节点作为数组第一层;底层解析器不会请求网络,也不会依赖 Vue。
|
|
247
|
+
|
|
248
|
+
可用入口包括 `http`、`storage`、`rsa`、`crypto`、`permission`、`toast`、`format`、`filter`、`tree`、`klona`、`nanoid` 和 `addressParse`。
|
|
249
|
+
|
|
250
|
+
公共后端协议和基础类型通过独立入口导入:
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
import type { ApiResponse, AuthUserInfo, Id, ListResponse, PageParams } from '@owocow/saber-ui/types'
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
该入口只包含基础、API 和认证协议类型,不包含具体 System 或业务 DTO。
|
|
257
|
+
|
|
258
|
+
`http`、`storage`、`rsa`、`crypto` 与 `toast` 共享模块级初始化状态,迁移或初始化时应始终从 `@owocow/saber-ui/utils/*` 引用,不能与旧的 `@owocow/saber-utils/*` 混用。
|
|
259
|
+
|
|
260
|
+
### 版本对齐
|
|
261
|
+
|
|
262
|
+
`saber-ui` 通过 `@nuxt/ui` 的裸导入引用宿主的 nuxt/ui 副本,请保持 `@nuxt/ui`
|
|
263
|
+
主版本(^4)一致;宿主如遇解析到多份副本,可在 Vite 配置中加
|
|
264
|
+
`resolve: { dedupe: ['@nuxt/ui', '@nuxt/icon'] }` 强制解析到宿主副本。
|
|
70
265
|
|
|
71
266
|
## Components
|
|
72
267
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BadgeStatusProps } from './BadgeStatus.types';
|
|
2
2
|
declare const _default: import('vue').DefineComponent<BadgeStatusProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BadgeStatusProps> & Readonly<{}>, {
|
|
3
3
|
bgOpacity: number;
|
|
4
|
-
textColorWeight:
|
|
4
|
+
textColorWeight: 500 | 600;
|
|
5
5
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
6
6
|
export default _default;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import k from "@nuxt/ui/components/Modal.vue";
|
|
2
|
+
import C from "@nuxt/ui/components/Button.vue";
|
|
3
|
+
import h from "@nuxt/ui/runtime/vue/components/Icon.vue";
|
|
4
|
+
import { defineComponent as B, useModel as M, computed as u, openBlock as f, createBlock as z, withCtx as i, createElementVNode as n, normalizeClass as p, createVNode as c, toDisplayString as r, createElementBlock as N, createCommentVNode as U, createTextVNode as _, mergeModels as v } from "vue";
|
|
5
|
+
const V = { class: "relative z-10 flex flex-col items-center text-center gap-8" }, S = { class: "w-full sm:w-60" }, T = { class: "font-bold mb-3 text-xl" }, D = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "mt-1 text-sm"
|
|
8
|
+
}, E = { class: "flex w-full justify-center gap-3 sm:gap-4" }, A = /* @__PURE__ */ B({
|
|
9
|
+
name: "SaberConfirmModal",
|
|
10
|
+
__name: "SaberConfirmModal",
|
|
11
|
+
props: /* @__PURE__ */ v({
|
|
12
|
+
name: {},
|
|
13
|
+
icon: { default: "i-solar:info-circle-linear" },
|
|
14
|
+
title: { default: "确认操作" },
|
|
15
|
+
description: { default: "" },
|
|
16
|
+
confirmLoading: { type: Boolean, default: !1 },
|
|
17
|
+
type: { default: "delete" },
|
|
18
|
+
confirmText: {}
|
|
19
|
+
}, {
|
|
20
|
+
open: { type: Boolean, default: !1 },
|
|
21
|
+
openModifiers: {}
|
|
22
|
+
}),
|
|
23
|
+
emits: /* @__PURE__ */ v(["confirm", "cancel"], ["update:open"]),
|
|
24
|
+
setup(e, { emit: x }) {
|
|
25
|
+
const l = M(e, "open"), a = e, s = x, t = u(() => a.type === "delete"), b = u(() => a.icon || a.name || "i-solar:info-circle-linear");
|
|
26
|
+
function g() {
|
|
27
|
+
l.value = !1, s("cancel");
|
|
28
|
+
}
|
|
29
|
+
return (L, o) => {
|
|
30
|
+
const w = h, d = C, y = k;
|
|
31
|
+
return f(), z(y, {
|
|
32
|
+
open: l.value,
|
|
33
|
+
"onUpdate:open": o[1] || (o[1] = (m) => l.value = m),
|
|
34
|
+
close: !1,
|
|
35
|
+
ui: { overlay: "z-100", content: "rounded-xl shadow-sm w-full sm:w-110 max-w-[calc(100vw-2rem)] z-100", body: "p-6 sm:p-8" }
|
|
36
|
+
}, {
|
|
37
|
+
body: i(() => [
|
|
38
|
+
n("div", V, [
|
|
39
|
+
n("div", {
|
|
40
|
+
class: p(["rounded-md border p-2.5", t.value ? "border-red-300 bg-red-50 dark:bg-red-950/30" : "border-accented"])
|
|
41
|
+
}, [
|
|
42
|
+
c(w, {
|
|
43
|
+
name: b.value,
|
|
44
|
+
class: p(["size-8", t.value ? "text-red-500" : ""])
|
|
45
|
+
}, null, 8, ["name", "class"])
|
|
46
|
+
], 2),
|
|
47
|
+
n("div", S, [
|
|
48
|
+
n("h4", T, r(e.title), 1),
|
|
49
|
+
e.description ? (f(), N("p", D, r(e.description), 1)) : U("", !0)
|
|
50
|
+
]),
|
|
51
|
+
n("div", E, [
|
|
52
|
+
c(d, {
|
|
53
|
+
color: "neutral",
|
|
54
|
+
block: "",
|
|
55
|
+
ui: { base: "w-30 h-9" },
|
|
56
|
+
variant: "outline",
|
|
57
|
+
onClick: g
|
|
58
|
+
}, {
|
|
59
|
+
default: i(() => [...o[2] || (o[2] = [
|
|
60
|
+
_("取消", -1)
|
|
61
|
+
])]),
|
|
62
|
+
_: 1
|
|
63
|
+
}),
|
|
64
|
+
c(d, {
|
|
65
|
+
color: t.value ? "error" : "primary",
|
|
66
|
+
loading: e.confirmLoading,
|
|
67
|
+
block: "",
|
|
68
|
+
ui: { base: "w-30 h-9" },
|
|
69
|
+
onClick: o[0] || (o[0] = (m) => s("confirm"))
|
|
70
|
+
}, {
|
|
71
|
+
default: i(() => [
|
|
72
|
+
_(r(e.confirmText ?? (t.value ? "确认删除" : "确定")), 1)
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 8, ["color", "loading"])
|
|
76
|
+
])
|
|
77
|
+
])
|
|
78
|
+
]),
|
|
79
|
+
_: 1
|
|
80
|
+
}, 8, ["open"]);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
export {
|
|
85
|
+
A as _
|
|
86
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent as m, watch as p, openBlock as f, createBlock as s, unref as o } from "vue";
|
|
2
|
+
import { settleConfirm as r, useConfirmState as a } from "./composables/use-confirm.mjs";
|
|
3
|
+
import { _ as l } from "./SaberConfirmModal.vue_vue_type_script_setup_true_lang-Cqp9krYl.js";
|
|
4
|
+
const _ = /* @__PURE__ */ m({
|
|
5
|
+
name: "SaberConfirmProvider",
|
|
6
|
+
__name: "SaberConfirmProvider",
|
|
7
|
+
setup(c) {
|
|
8
|
+
const e = a();
|
|
9
|
+
return p(
|
|
10
|
+
() => e.open,
|
|
11
|
+
(i) => {
|
|
12
|
+
!i && e.resolve && r(!1);
|
|
13
|
+
}
|
|
14
|
+
), (i, n) => (f(), s(l, {
|
|
15
|
+
open: o(e).open,
|
|
16
|
+
"onUpdate:open": n[0] || (n[0] = (t) => o(e).open = t),
|
|
17
|
+
title: o(e).title,
|
|
18
|
+
description: o(e).message,
|
|
19
|
+
icon: o(e).icon,
|
|
20
|
+
type: o(e).type,
|
|
21
|
+
"confirm-loading": o(e).loading,
|
|
22
|
+
"confirm-text": o(e).confirmText,
|
|
23
|
+
onConfirm: n[1] || (n[1] = (t) => o(r)(!0)),
|
|
24
|
+
onCancel: n[2] || (n[2] = (t) => o(r)(!1))
|
|
25
|
+
}, null, 8, ["open", "title", "description", "icon", "type", "confirm-loading", "confirm-text"]));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
_
|
|
30
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import b from "@nuxt/ui/components/CheckboxGroup.vue";
|
|
2
|
+
import { defineComponent as _, useModel as h, toRef as n, openBlock as g, createBlock as k, mergeProps as x, unref as s, mergeModels as i } from "vue";
|
|
3
|
+
import { u as V } from "./use-dict-options-DjtbYYIa.js";
|
|
4
|
+
const B = /* @__PURE__ */ _({
|
|
5
|
+
name: "SaberDictCheckbox",
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "SaberDictCheckbox",
|
|
8
|
+
props: /* @__PURE__ */ i({
|
|
9
|
+
dictType: {},
|
|
10
|
+
dataSource: { default: void 0 },
|
|
11
|
+
disabled: { type: Boolean, default: !1 }
|
|
12
|
+
}, {
|
|
13
|
+
modelValue: { default: () => [] },
|
|
14
|
+
modelModifiers: {}
|
|
15
|
+
}),
|
|
16
|
+
emits: /* @__PURE__ */ i(["change"], ["update:modelValue"]),
|
|
17
|
+
setup(o, { expose: m, emit: r }) {
|
|
18
|
+
const t = o, a = h(o, "modelValue"), c = r, { items: l, loading: d, error: u } = V(n(t, "dictType"), n(t, "dataSource"));
|
|
19
|
+
function p(e) {
|
|
20
|
+
a.value = e, c("change", e);
|
|
21
|
+
}
|
|
22
|
+
return m({ items: l, loading: d, error: u }), (e, v) => {
|
|
23
|
+
const f = b;
|
|
24
|
+
return g(), k(f, x({
|
|
25
|
+
"model-value": a.value,
|
|
26
|
+
items: s(l),
|
|
27
|
+
disabled: o.disabled || s(d)
|
|
28
|
+
}, e.$attrs, { "onUpdate:modelValue": p }), null, 16, ["model-value", "items", "disabled"]);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
B as _
|
|
34
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineComponent as c, useModel as f, openBlock as V, createBlock as g, mergeProps as _, mergeModels as m, toRef as r, unref as p } from "vue";
|
|
2
|
+
import h from "@nuxt/ui/components/RadioGroup.vue";
|
|
3
|
+
import { u as R } from "./use-dict-options-DjtbYYIa.js";
|
|
4
|
+
const S = /* @__PURE__ */ c({
|
|
5
|
+
inheritAttrs: !1,
|
|
6
|
+
__name: "SaberRadioGroup",
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: { default: void 0 },
|
|
9
|
+
modelModifiers: {}
|
|
10
|
+
},
|
|
11
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
|
12
|
+
setup(o, { emit: i }) {
|
|
13
|
+
const t = f(o, "modelValue"), a = i;
|
|
14
|
+
function l(e) {
|
|
15
|
+
t.value = e, a("change", e);
|
|
16
|
+
}
|
|
17
|
+
return (e, s) => {
|
|
18
|
+
const d = h;
|
|
19
|
+
return V(), g(d, _({ "model-value": t.value }, e.$attrs, { "onUpdate:modelValue": l }), null, 16, ["model-value"]);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}), D = /* @__PURE__ */ c({
|
|
23
|
+
name: "SaberDictRadio",
|
|
24
|
+
inheritAttrs: !1,
|
|
25
|
+
__name: "SaberDictRadio",
|
|
26
|
+
props: /* @__PURE__ */ m({
|
|
27
|
+
dictType: {},
|
|
28
|
+
dataSource: { default: void 0 },
|
|
29
|
+
disabled: { type: Boolean, default: !1 }
|
|
30
|
+
}, {
|
|
31
|
+
modelValue: {},
|
|
32
|
+
modelModifiers: {}
|
|
33
|
+
}),
|
|
34
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
|
35
|
+
setup(o, { expose: i, emit: t }) {
|
|
36
|
+
const a = o, l = f(o, "modelValue"), e = t, { items: s, loading: d, error: b } = R(r(a, "dictType"), r(a, "dataSource"));
|
|
37
|
+
return i({ items: s, loading: d, error: b }), (v, n) => (V(), g(S, _({
|
|
38
|
+
modelValue: l.value,
|
|
39
|
+
"onUpdate:modelValue": n[0] || (n[0] = (u) => l.value = u),
|
|
40
|
+
items: p(s),
|
|
41
|
+
disabled: o.disabled || p(d)
|
|
42
|
+
}, v.$attrs, {
|
|
43
|
+
onChange: n[1] || (n[1] = (u) => e("change", u))
|
|
44
|
+
}), null, 16, ["modelValue", "items", "disabled"]));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
D as _,
|
|
49
|
+
S as a
|
|
50
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineComponent as V, useModel as g, toRef as s, computed as h, openBlock as v, createBlock as S, mergeProps as y, unref as i, mergeModels as m } from "vue";
|
|
2
|
+
import { _ as B } from "./SaberPopSelect.vue_vue_type_script_setup_true_lang-BcS27NXI.js";
|
|
3
|
+
import { u as D } from "./use-dict-options-DjtbYYIa.js";
|
|
4
|
+
const C = /* @__PURE__ */ V({
|
|
5
|
+
name: "SaberDictSelect",
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "SaberDictSelect",
|
|
8
|
+
props: /* @__PURE__ */ m({
|
|
9
|
+
dictType: {},
|
|
10
|
+
dataSource: { default: void 0 },
|
|
11
|
+
placeholder: { default: "请选择" },
|
|
12
|
+
clearable: { type: Boolean, default: !0 },
|
|
13
|
+
disabled: { type: Boolean, default: !1 }
|
|
14
|
+
}, {
|
|
15
|
+
modelValue: {},
|
|
16
|
+
modelModifiers: {}
|
|
17
|
+
}),
|
|
18
|
+
emits: /* @__PURE__ */ m(["change"], ["update:modelValue"]),
|
|
19
|
+
setup(e, { expose: n, emit: u }) {
|
|
20
|
+
const a = e, d = g(e, "modelValue"), c = u, { items: r, loading: o, error: p } = D(s(a, "dictType"), s(a, "dataSource")), f = h(() => o.value ? "加载中..." : a.placeholder);
|
|
21
|
+
return n({ items: r, loading: o, error: p }), (b, l) => (v(), S(B, y({
|
|
22
|
+
modelValue: d.value,
|
|
23
|
+
"onUpdate:modelValue": l[0] || (l[0] = (t) => d.value = t),
|
|
24
|
+
items: i(r),
|
|
25
|
+
placeholder: f.value,
|
|
26
|
+
clearable: e.clearable,
|
|
27
|
+
disabled: e.disabled || i(o)
|
|
28
|
+
}, b.$attrs, {
|
|
29
|
+
onChange: l[1] || (l[1] = (t) => c("change", t))
|
|
30
|
+
}), null, 16, ["modelValue", "items", "placeholder", "clearable", "disabled"]));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
C as _
|
|
35
|
+
};
|