vue-devui 1.0.0-beta.17 → 1.0.0-beta.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 CHANGED
@@ -1,179 +1,187 @@
1
- <p align="center">
2
- <a href="https://devui.design/home" target="_blank" rel="noopener noreferrer">
3
- <img alt="DevUI Logo" src="https://github.com/DevCloudFE/vue-devui/raw/dev/packages/devui-vue/public/logo.svg" width="180" style="max-width:100%;">
4
- </a>
5
- </p>
6
-
7
- Vue DevUI 是 Vue3 版本的 DevUI 组件库,基于 [https://github.com/devcloudfe/ng-devui](https://github.com/devcloudfe/ng-devui),倡导`沉浸`、`灵活`、`至简`的设计价值观。
8
-
9
- DevUI 官方网站:[https://devui.design](https://devui.design)
10
-
11
- ## 当前状态: Beta
12
-
13
- 该项目还处于孵化和演进阶段,欢迎大家参与到 Vue DevUI 项目的建设中来!🎉🎉
14
-
15
- 通过参与 Vue DevUI 项目,你可以:
16
- - 🔥 学习最新的 `Vite`+`Vue3`+`TypeScript`+`JSX` 技术
17
- - 🎁 学习如何设计和开发组件
18
- - ⭐ 参与到开源社区中来
19
- - 🎊 结识一群热爱学习、热爱开源的朋友
20
-
21
- [贡献指南](https://github.com/DevCloudFE/vue-devui/wiki/%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97)
22
-
23
- ## 快速开始
24
-
25
- ### 1 安装依赖
26
-
27
- ```
28
- pnpm i
29
- ```
30
-
31
- ### 2 启动
32
-
33
- ```
34
- pnpm dev
35
- ```
36
-
37
- ### 3 访问
38
-
39
- [http://localhost:3000/](http://localhost:3000/)
40
-
41
- ### 4 生产打包
42
-
43
- ```
44
- pnpm build
45
- ```
46
-
47
- ## 使用 Vue DevUI
48
-
49
- ### 1. 安装
50
-
51
- ```
52
- pnpm i vue-devui
53
- ```
54
-
55
- ### 2. 全量引入
56
-
57
- 在`main.ts`文件中编写以下代码:
58
- ```
59
- import { createApp } from 'vue'
60
- import App from './App.vue'
61
-
62
- // Step 1: 引入 Vue DevUI 组件库
63
- import DevUI from 'vue-devui'
64
- // Step 2: 引入组件库样式
65
- import 'vue-devui/style.css'
66
-
67
- createApp(App)
68
- .use(DevUI) // Step 3: 使用 Vue DevUI
69
- .mount('#app')
70
- ```
71
-
72
- ### 3. 按需引入
73
-
74
- 除了全量引入,我们也支持单个组件按需引入。
75
-
76
- 在`main.ts`文件中编写以下代码:
77
- ```
78
- import { createApp } from 'vue'
79
- import App from './App.vue'
80
-
81
- // Step 1: 引入单个组件
82
- import { Button } from 'vue-devui'
83
- // or import Button from 'vue-devui/button'
84
- // Step 2: 引入组件样式
85
- import 'vue-devui/button/style.css'
86
-
87
- createApp(App)
88
- .use(Button) // Step 3: 使用组件
89
- .mount('#app')
90
- ```
91
-
92
- ### 4. 配置自动按需引入`unplugin-vue-components`(推荐)
93
-
94
- 配置`unplugin-vue-components`插件可以无需引入Vue DevUI就可以直接按需使用其中的组件,具体使用方式如下:
95
-
96
- 在`vite.config.ts`文件中添加以下代码:
97
- ```
98
- import Components from 'unplugin-vue-components/vite'
99
- import { DevUiResolver } from 'unplugin-vue-components/resolvers'
100
-
101
- export default defineConfig({
102
- plugins: [
103
- vue(),
104
-
105
- // 新增
106
- Components({
107
- resolvers: [
108
- DevUiResolver()
109
- ]
110
- })
111
- ]
112
- })
113
- ```
114
-
115
- 配置了以上插件,就可以直接在代码中使用`Vue DevUI`的组件,而无需在`main.ts`文件中引入`Vue DevUI`。
116
-
117
- ### 5. 使用
118
-
119
- ```
120
- <template>
121
- <d-button>确定</d-button>
122
- </template>
123
- ```
124
-
125
- ## 图标库
126
-
127
- 图标库推荐使用[DevUI图标库](https://devui.design/icon/ruleResource),也可以使用第三方图标库,比如:iconfont。
128
-
129
- ### 使用DevUI图标库
130
-
131
- #### 安装
132
-
133
- ```
134
- pnpm i @devui-design/icons
135
- ```
136
-
137
- #### 引入
138
-
139
- 在`main.ts`文件中,编写以下代码:
140
-
141
- ```
142
- import '@devui-design/icons/icomoon/devui-icon.css'
143
- ```
144
-
145
- #### 使用
146
-
147
- ```
148
- <d-icon name="love" color="red"></d-icon>
149
- ```
150
-
151
- ## Contributors ✨
152
-
153
- Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
154
-
155
- <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
156
- <!-- prettier-ignore-start -->
157
- <!-- markdownlint-disable -->
158
- <table>
159
- <tr>
160
- <td align="center"><a href="https://juejin.cn/user/712139267650141"><img src="https://avatars.githubusercontent.com/u/9566362?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kagol</b></sub></a><br /><a href="#maintenance-kagol" title="Maintenance">🚧</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=kagol" title="Code">💻</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=kagol" title="Documentation">📖</a></td>
161
- <td align="center"><a href="https://github.com/TinsFox"><img src="https://avatars.githubusercontent.com/u/33956589?v=4?s=100" width="100px;" alt=""/><br /><sub><b>TinsFox</b></sub></a><br /><a href="#maintenance-TinsFox" title="Maintenance">🚧</a> <a href="#infra-TinsFox" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
162
- <td align="center"><a href="https://github.com/lnzhangsong"><img src="https://avatars.githubusercontent.com/u/15092594?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nif</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=lnzhangsong" title="Code">💻</a></td>
163
- <td align="center"><a href="https://github.com/Zcating"><img src="https://avatars.githubusercontent.com/u/13329558?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zcating</b></sub></a><br /><a href="#maintenance-Zcating" title="Maintenance">🚧</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=Zcating" title="Code">💻</a></td>
164
- <td align="center"><a href="https://github.com/sufuwang"><img src="https://avatars.githubusercontent.com/u/46395105?v=4?s=100" width="100px;" alt=""/><br /><sub><b>王凯</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=sufuwang" title="Code">💻</a></td>
165
- <td align="center"><a href="https://github.com/iel-h"><img src="https://avatars.githubusercontent.com/u/53589602?v=4?s=100" width="100px;" alt=""/><br /><sub><b>iel</b></sub></a><br /><a href="#maintenance-iel-h" title="Maintenance">🚧</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=iel-h" title="Code">💻</a></td>
166
- <td align="center"><a href="https://github.com/chenxi24"><img src="https://avatars.githubusercontent.com/u/40349890?v=4?s=100" width="100px;" alt=""/><br /><sub><b>chenxi24</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=chenxi24" title="Code">💻</a></td>
167
- </tr>
168
- </table>
169
-
170
- <!-- markdownlint-restore -->
171
- <!-- prettier-ignore-end -->
172
-
173
- <!-- ALL-CONTRIBUTORS-LIST:END -->
174
-
175
- This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
176
-
177
- ## License
178
-
179
- [MIT](https://github.com/DevCloudFE/vue-devui/blob/dev/LICENSE)
1
+ <p align="center">
2
+ <a href="https://devui.design/home" target="_blank" rel="noopener noreferrer">
3
+ <img alt="DevUI Logo" src="https://github.com/DevCloudFE/vue-devui/raw/dev/packages/devui-vue/public/logo.svg" width="180" style="max-width:100%;">
4
+ </a>
5
+ </p>
6
+
7
+ Vue DevUI 是 Vue3 版本的 DevUI 组件库,基于 [https://github.com/devcloudfe/ng-devui](https://github.com/devcloudfe/ng-devui),倡导`沉浸`、`灵活`、`至简`的设计价值观。
8
+
9
+ DevUI 官方网站:[https://devui.design](https://devui.design)
10
+
11
+ ## 当前状态: Beta
12
+
13
+ 该项目还处于孵化和演进阶段,欢迎大家参与到 Vue DevUI 项目的建设中来!🎉🎉
14
+
15
+ 通过参与 Vue DevUI 项目,你可以:
16
+ - 🔥 学习最新的 `Vite`+`Vue3`+`TypeScript`+`JSX` 技术
17
+ - 🎁 学习如何设计和开发组件
18
+ - ⭐ 参与到开源社区中来
19
+ - 🎊 结识一群热爱学习、热爱开源的朋友
20
+
21
+ [贡献指南](https://github.com/DevCloudFE/vue-devui/wiki/%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97)
22
+
23
+ ## 快速开始
24
+
25
+ ### 1 安装依赖
26
+
27
+ ```
28
+ pnpm i
29
+ ```
30
+
31
+ ### 2 启动
32
+
33
+ ```
34
+ pnpm dev
35
+ ```
36
+
37
+ ### 3 访问
38
+
39
+ [http://localhost:3000/](http://localhost:3000/)
40
+
41
+ ### 4 生产打包
42
+
43
+ ```
44
+ pnpm build
45
+ ```
46
+
47
+ ## 使用 Vue DevUI
48
+
49
+ ### 1. 安装
50
+
51
+ ```
52
+ pnpm i vue-devui
53
+ ```
54
+
55
+ ### 2. 全量引入
56
+
57
+ 在`main.ts`文件中编写以下代码:
58
+ ```
59
+ import { createApp } from 'vue'
60
+ import App from './App.vue'
61
+
62
+ // Step 1: 引入 Vue DevUI 组件库
63
+ import DevUI from 'vue-devui'
64
+ // Step 2: 引入组件库样式
65
+ import 'vue-devui/style.css'
66
+
67
+ createApp(App)
68
+ .use(DevUI) // Step 3: 使用 Vue DevUI
69
+ .mount('#app')
70
+ ```
71
+
72
+ ### 3. 按需引入
73
+
74
+ 除了全量引入,我们也支持单个组件按需引入。
75
+
76
+ 在`main.ts`文件中编写以下代码:
77
+ ```
78
+ import { createApp } from 'vue'
79
+ import App from './App.vue'
80
+
81
+ // Step 1: 引入单个组件
82
+ import { Button } from 'vue-devui'
83
+ // or import Button from 'vue-devui/button'
84
+ // Step 2: 引入组件样式
85
+ import 'vue-devui/button/style.css'
86
+
87
+ createApp(App)
88
+ .use(Button) // Step 3: 使用组件
89
+ .mount('#app')
90
+ ```
91
+
92
+ ### 4. 配置自动按需引入`unplugin-vue-components`(推荐)
93
+
94
+ 配置`unplugin-vue-components`插件可以无需引入Vue DevUI就可以直接按需使用其中的组件,具体使用方式如下:
95
+
96
+ 在`vite.config.ts`文件中添加以下代码:
97
+ ```
98
+ import Components from 'unplugin-vue-components/vite'
99
+ import { DevUiResolver } from 'unplugin-vue-components/resolvers'
100
+
101
+ export default defineConfig({
102
+ plugins: [
103
+ vue(),
104
+
105
+ // 新增
106
+ Components({
107
+ resolvers: [
108
+ DevUiResolver()
109
+ ]
110
+ })
111
+ ]
112
+ })
113
+ ```
114
+
115
+ 配置了以上插件,就可以直接在代码中使用`Vue DevUI`的组件,而无需在`main.ts`文件中引入`Vue DevUI`。
116
+
117
+ ### 5. 使用
118
+
119
+ ```
120
+ <template>
121
+ <d-button>确定</d-button>
122
+ </template>
123
+ ```
124
+
125
+ ## 图标库
126
+
127
+ 图标库推荐使用[DevUI图标库](https://devui.design/icon/ruleResource),也可以使用第三方图标库,比如:iconfont。
128
+
129
+ ### 使用DevUI图标库
130
+
131
+ #### 安装
132
+
133
+ ```
134
+ pnpm i @devui-design/icons
135
+ ```
136
+
137
+ #### 引入
138
+
139
+ 在`main.ts`文件中,编写以下代码:
140
+
141
+ ```
142
+ import '@devui-design/icons/icomoon/devui-icon.css'
143
+ ```
144
+
145
+ #### 使用
146
+
147
+ ```
148
+ <d-icon name="love" color="red"></d-icon>
149
+ ```
150
+
151
+ ## Contributors ✨
152
+
153
+ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
154
+
155
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
156
+ <!-- prettier-ignore-start -->
157
+ <!-- markdownlint-disable -->
158
+ <table>
159
+ <tr>
160
+ <td align="center"><a href="https://juejin.cn/user/712139267650141"><img src="https://avatars.githubusercontent.com/u/9566362?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kagol</b></sub></a><br /><a href="#maintenance-kagol" title="Maintenance">🚧</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=kagol" title="Code">💻</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=kagol" title="Documentation">📖</a></td>
161
+ <td align="center"><a href="https://github.com/TinsFox"><img src="https://avatars.githubusercontent.com/u/33956589?v=4?s=100" width="100px;" alt=""/><br /><sub><b>TinsFox</b></sub></a><br /><a href="#maintenance-TinsFox" title="Maintenance">🚧</a> <a href="#infra-TinsFox" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a></td>
162
+ <td align="center"><a href="https://github.com/lnzhangsong"><img src="https://avatars.githubusercontent.com/u/15092594?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nif</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=lnzhangsong" title="Code">💻</a></td>
163
+ <td align="center"><a href="https://github.com/Zcating"><img src="https://avatars.githubusercontent.com/u/13329558?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zcating</b></sub></a><br /><a href="#maintenance-Zcating" title="Maintenance">🚧</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=Zcating" title="Code">💻</a></td>
164
+ <td align="center"><a href="https://github.com/sufuwang"><img src="https://avatars.githubusercontent.com/u/46395105?v=4?s=100" width="100px;" alt=""/><br /><sub><b>王凯</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=sufuwang" title="Code">💻</a></td>
165
+ <td align="center"><a href="https://github.com/iel-h"><img src="https://avatars.githubusercontent.com/u/53589602?v=4?s=100" width="100px;" alt=""/><br /><sub><b>iel</b></sub></a><br /><a href="#maintenance-iel-h" title="Maintenance">🚧</a> <a href="https://github.com/DevCloudFE/vue-devui/commits?author=iel-h" title="Code">💻</a></td>
166
+ <td align="center"><a href="https://github.com/chenxi24"><img src="https://avatars.githubusercontent.com/u/40349890?v=4?s=100" width="100px;" alt=""/><br /><sub><b>chenxi24</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=chenxi24" title="Code">💻</a></td>
167
+ </tr>
168
+ <tr>
169
+ <td align="center"><a href="https://github.com/asdlml6"><img src="https://avatars.githubusercontent.com/u/61737780?v=4?s=100" width="100px;" alt=""/><br /><sub><b>小九九</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=asdlml6" title="Code">💻</a></td>
170
+ <td align="center"><a href="http://blog.alanlee.top"><img src="https://avatars.githubusercontent.com/u/42601044?v=4?s=100" width="100px;" alt=""/><br /><sub><b>AlanLee</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=AlanLee97" title="Code">💻</a></td>
171
+ <td align="center"><a href="https://github.com/ForeseeBear"><img src="https://avatars.githubusercontent.com/u/15258339?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Echo</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=ForeseeBear" title="Code">💻</a></td>
172
+ <td align="center"><a href="https://github.com/GaoNeng-wWw"><img src="https://avatars.githubusercontent.com/u/31283122?v=4?s=100" width="100px;" alt=""/><br /><sub><b>GaoNeng</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=GaoNeng-wWw" title="Code">💻</a></td>
173
+ <td align="center"><a href="https://github.com/xingyan95"><img src="https://avatars.githubusercontent.com/u/11143986?v=4?s=100" width="100px;" alt=""/><br /><sub><b>行言</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=xingyan95" title="Code">💻</a></td>
174
+ <td align="center"><a href="https://devin974.github.io/"><img src="https://avatars.githubusercontent.com/u/67035714?v=4?s=100" width="100px;" alt=""/><br /><sub><b>devin</b></sub></a><br /><a href="https://github.com/DevCloudFE/vue-devui/commits?author=devin974" title="Code">💻</a></td>
175
+ </tr>
176
+ </table>
177
+
178
+ <!-- markdownlint-restore -->
179
+ <!-- prettier-ignore-end -->
180
+
181
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
182
+
183
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
184
+
185
+ ## License
186
+
187
+ [MIT](https://github.com/DevCloudFE/vue-devui/blob/dev/LICENSE)
@@ -18,7 +18,7 @@ var __publicField = (obj, key, value) => {
18
18
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
19
  return value;
20
20
  };
21
- import { defineComponent, createVNode, ref, h, render, computed, mergeProps, withDirectives, resolveDirective } from "vue";
21
+ import { defineComponent, createVNode, ref, h, render, computed, toRefs, withDirectives, resolveDirective } from "vue";
22
22
  var Icon = defineComponent({
23
23
  name: "DIcon",
24
24
  props: {
@@ -265,49 +265,59 @@ const loadingDirective = {
265
265
  }
266
266
  };
267
267
  const buttonProps = {
268
- type: {
269
- type: String,
270
- default: "button"
271
- },
272
268
  variant: {
273
269
  type: String,
274
- default: "primary"
270
+ default: "outline"
275
271
  },
276
272
  size: {
277
273
  type: String,
278
274
  default: "md"
279
275
  },
280
- position: {
281
- type: String,
282
- default: "default"
283
- },
284
- bordered: {
285
- type: Boolean,
286
- default: false
276
+ color: {
277
+ type: String
287
278
  },
288
279
  icon: {
289
280
  type: String,
290
281
  default: ""
291
282
  },
292
- showLoading: {
283
+ loading: {
293
284
  type: Boolean,
294
285
  default: false
295
286
  },
296
- width: {
297
- type: String
298
- },
299
287
  disabled: {
300
288
  type: Boolean,
301
289
  default: false
302
- },
303
- autofocus: {
304
- type: Boolean,
305
- default: false
306
- },
307
- onClick: {
308
- type: Function
309
290
  }
310
291
  };
292
+ function useButton(props, ctx) {
293
+ const hasContent = computed(() => ctx.slots.default);
294
+ const colorMap = {
295
+ solid: "primary",
296
+ outline: "secondary",
297
+ text: "secondary"
298
+ };
299
+ const defaultColor = colorMap[props.variant];
300
+ const classes = computed(() => ({
301
+ "devui-btn": true,
302
+ [`devui-btn-${props.variant}`]: true,
303
+ [`devui-btn-${props.variant}-${props.color || defaultColor}`]: true,
304
+ [`devui-btn-${props.size}`]: true,
305
+ "devui-btn-icon-wrap": props.icon,
306
+ "devui-btn-icon": props.icon && !hasContent.value && props.variant !== "solid"
307
+ }));
308
+ const iconClass = computed(() => {
309
+ if (!props.icon) {
310
+ return;
311
+ }
312
+ const origin = "devui-icon-fix icon";
313
+ if (hasContent.value) {
314
+ return `${origin} clear-right-5`;
315
+ } else {
316
+ return origin;
317
+ }
318
+ });
319
+ return { classes, iconClass };
320
+ }
311
321
  var button = "";
312
322
  var Button = defineComponent({
313
323
  name: "DButton",
@@ -315,81 +325,45 @@ var Button = defineComponent({
315
325
  devLoading: loadingDirective
316
326
  },
317
327
  props: buttonProps,
328
+ emits: ["click"],
318
329
  setup(props, ctx) {
319
- const buttonContent = ref(null);
330
+ const {
331
+ icon,
332
+ disabled,
333
+ loading: loading2
334
+ } = toRefs(props);
335
+ const {
336
+ classes,
337
+ iconClass
338
+ } = useButton(props, ctx);
320
339
  const onClick = (e) => {
321
- var _a;
322
- if (props.showLoading) {
340
+ if (loading2.value) {
323
341
  return;
324
342
  }
325
- (_a = props.onClick) == null ? void 0 : _a.call(props, e);
343
+ ctx.emit("click", e);
326
344
  };
327
- const hasContent = computed(() => ctx.slots.default);
328
- const btnClass = computed(() => {
329
- const {
330
- variant,
331
- size,
332
- position,
333
- bordered,
334
- icon
335
- } = props;
336
- const origin = `devui-btn devui-btn-${variant} devui-btn-${size} devui-btn-${position}`;
337
- const borderedClass = bordered ? "bordered" : "";
338
- const btnIcon = !!icon && !hasContent.value && variant !== "primary" ? "d-btn-icon" : "";
339
- const btnIconWrap = !!icon ? "d-btn-icon-wrap" : "";
340
- return `${origin} ${borderedClass} ${btnIcon} ${btnIconWrap}`;
341
- });
342
- const iconClass = computed(() => {
343
- if (!props.icon) {
344
- return;
345
- }
346
- const origin = "devui-icon-fix icon";
347
- if (hasContent.value) {
348
- return `${origin} clear-right-5`;
349
- } else {
350
- return origin;
351
- }
352
- });
353
345
  return () => {
354
346
  var _a, _b;
355
- const {
356
- icon,
357
- type,
358
- disabled,
359
- showLoading,
360
- width
361
- } = props;
362
- return createVNode("div", mergeProps({
363
- "class": "devui-btn-host"
364
- }, ctx.attrs), [withDirectives(createVNode("button", {
365
- "class": btnClass.value,
366
- "type": type,
367
- "disabled": disabled,
368
- "style": {
369
- width
370
- },
347
+ return withDirectives(createVNode("button", {
348
+ "class": classes.value,
349
+ "disabled": disabled.value,
371
350
  "onClick": onClick
372
- }, [!!icon ? createVNode(Icon, {
373
- "name": icon,
351
+ }, [icon.value && createVNode(Icon, {
352
+ "name": icon.value,
353
+ "size": "12px",
374
354
  "class": iconClass.value
375
- }, null) : null, createVNode("span", {
376
- "class": "button-content",
377
- "ref": buttonContent
378
- }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("devLoading"), showLoading]])]);
355
+ }, null), createVNode("span", {
356
+ "class": "button-content"
357
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)])]), [[resolveDirective("dLoading"), loading2.value]]);
379
358
  };
380
359
  }
381
360
  });
382
- defineComponent(Loading);
383
- Button.install = function(app) {
384
- app.directive("dLoading", loadingDirective);
385
- app.component(Button.name, Button);
386
- };
387
361
  var index = {
388
362
  title: "Button \u6309\u94AE",
389
363
  category: "\u901A\u7528",
390
364
  status: "100%",
391
365
  install(app) {
392
- app.use(Button);
366
+ app.component(Button.name, Button);
393
367
  }
394
368
  };
395
369
  export { Button, buttonProps, index as default };
@@ -1 +1 @@
1
- var F=Object.defineProperty;var $=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var S=(i,t,r)=>t in i?F(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,u=(i,t)=>{for(var r in t||(t={}))W.call(t,r)&&S(i,r,t[r]);if($)for(var r of $(t))q.call(t,r)&&S(i,r,t[r]);return i};var l=(i,t,r)=>(S(i,typeof t!="symbol"?t+"":t,r),r);(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.index={},i.Vue))})(this,function(i,t){"use strict";var r=t.defineComponent({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup(e){return u({},e)},render(){const{name:e,size:n,color:o,classPrefix:s}=this;return/^((https?):)?\/\//.test(e)?t.createVNode("img",{src:e,alt:e.split("/")[e.split("/").length-1],style:{width:n,verticalAlign:"text-bottom"}},null):t.createVNode("i",{class:`${s} ${s}-${e}`,style:{fontSize:n,color:o}},null)}});r.install=function(e){e.component(r.name,r)};class V{constructor(){l(this,"top","50%");l(this,"left","50%")}}const I={message:String,backdrop:Boolean,view:{type:Object,default:()=>new V},zIndex:Number,isFull:{type:Boolean,default:!1}};class O{constructor(){l(this,"target");l(this,"message");l(this,"loadingTemplateRef");l(this,"backdrop",!0);l(this,"positionType","relative");l(this,"view",new V);l(this,"zIndex")}}var Y="",C=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:I,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const o=t.ref(!1);return{style:n,isShow:o,open:()=>{o.value=!0},close:()=>{o.value=!1}}},render(){var g;const{isShow:e,isFull:n,backdrop:o,style:s,message:a,$slots:m}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((g=m.default)==null?void 0:g.call(m))||t.createVNode("div",{class:"devui-loading-wrapper"},[o?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:s,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),a?t.createVNode("span",{class:"devui-loading-text"},[a]):null])])])}});const P=Symbol("dev_component_container");function E(e,n,o=null){const s=t.h(e,u({},n),o),a=document.createElement("div");return s[P]=a,t.render(s,a),s.component}function j(e){t.render(null,e==null?void 0:e.vnode[P])}const D=t.defineComponent(C),f=new WeakSet,v=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},k=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),_=e=>{switch(k(e)){case"promise":return[e];case"array":return e.some(o=>k(o)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},A=e=>{f.delete(e),e.instance.proxy.close(),j(e.instance)},x=(e,n)=>{if(n.value){const o=_(n.value);if(o==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),f.add(e),o&&Promise.all(o).catch(s=>{console.error(new Error("Promise handling errors"),s)}).finally(()=>{A(e)})}else A(e)},B=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},L=(e,n)=>{const o=u(u({},new O),n),s=o.loadingTemplateRef,a=E(D,u({},o),s?()=>s:null);e.style.position=o.positionType,e.options=o,e.instance=a,e.mask=a.proxy.$el},T={mounted:function(e,n,o){L(e,o.props),B(e),!v(n.value)&&x(e,n)},updated:function(e,n,o){!v(n.value)&&f.has(e)||v(n.value)&&!f.has(e)||(!f.has(e)&&L(e,o.props),B(e),x(e,n))}},z={type:{type:String,default:"button"},variant:{type:String,default:"primary"},size:{type:String,default:"md"},position:{type:String,default:"default"},bordered:{type:Boolean,default:!1},icon:{type:String,default:""},showLoading:{type:Boolean,default:!1},width:{type:String},disabled:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},onClick:{type:Function}};var G="",p=t.defineComponent({name:"DButton",directives:{devLoading:T},props:z,setup(e,n){const o=t.ref(null),s=d=>{var c;e.showLoading||(c=e.onClick)==null||c.call(e,d)},a=t.computed(()=>n.slots.default),m=t.computed(()=>{const{variant:d,size:c,position:w,bordered:N,icon:y}=e,b=`devui-btn devui-btn-${d} devui-btn-${c} devui-btn-${w}`,h=N?"bordered":"",R=!!y&&!a.value&&d!=="primary"?"d-btn-icon":"";return`${b} ${h} ${R} ${y?"d-btn-icon-wrap":""}`}),g=t.computed(()=>{if(!e.icon)return;const d="devui-icon-fix icon";return a.value?`${d} clear-right-5`:d});return()=>{var b,h;const{icon:d,type:c,disabled:w,showLoading:N,width:y}=e;return t.createVNode("div",t.mergeProps({class:"devui-btn-host"},n.attrs),[t.withDirectives(t.createVNode("button",{class:m.value,type:c,disabled:w,style:{width:y},onClick:s},[d?t.createVNode(r,{name:d,class:g.value},null):null,t.createVNode("span",{class:"button-content",ref:o},[(h=(b=n.slots).default)==null?void 0:h.call(b)])]),[[t.resolveDirective("devLoading"),N]])])}}});t.defineComponent(C),p.install=function(e){e.directive("dLoading",T),e.component(p.name,p)};var M={title:"Button \u6309\u94AE",category:"\u901A\u7528",status:"100%",install(e){e.use(p)}};i.Button=p,i.buttonProps=z,i.default=M,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
1
+ var D=Object.defineProperty;var P=Object.getOwnPropertySymbols;var _=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var v=(i,t,r)=>t in i?D(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r,u=(i,t)=>{for(var r in t||(t={}))_.call(t,r)&&v(i,r,t[r]);if(P)for(var r of P(t))I.call(t,r)&&v(i,r,t[r]);return i};var l=(i,t,r)=>(v(i,typeof t!="symbol"?t+"":t,r),r);(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.index={},i.Vue))})(this,function(i,t){"use strict";var r=t.defineComponent({name:"DIcon",props:{name:{type:String,required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}},setup(e){return u({},e)},render(){const{name:e,size:o,color:n,classPrefix:a}=this;return/^((https?):)?\/\//.test(e)?t.createVNode("img",{src:e,alt:e.split("/")[e.split("/").length-1],style:{width:o,verticalAlign:"text-bottom"}},null):t.createVNode("i",{class:`${a} ${a}-${e}`,style:{fontSize:o,color:n}},null)}});r.install=function(e){e.component(r.name,r)};class b{constructor(){l(this,"top","50%");l(this,"left","50%")}}const C={message:String,backdrop:Boolean,view:{type:Object,default:()=>new b},zIndex:Number,isFull:{type:Boolean,default:!1}};class z{constructor(){l(this,"target");l(this,"message");l(this,"loadingTemplateRef");l(this,"backdrop",!0);l(this,"positionType","relative");l(this,"view",new b);l(this,"zIndex")}}var R="",T=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:C,setup(e){const o={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(o.background="none");const n=t.ref(!1);return{style:o,isShow:n,open:()=>{n.value=!0},close:()=>{n.value=!1}}},render(){var d;const{isShow:e,isFull:o,backdrop:n,style:a,message:s,$slots:c}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",o?"devui-loading--full":""]},[((d=c.default)==null?void 0:d.call(c))||t.createVNode("div",{class:"devui-loading-wrapper"},[n?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:a,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),s?t.createVNode("span",{class:"devui-loading-text"},[s]):null])])])}});const h=Symbol("dev_component_container");function B(e,o,n=null){const a=t.h(e,u({},o),n),s=document.createElement("div");return a[h]=s,t.render(a,s),a.component}function L(e){t.render(null,e==null?void 0:e.vnode[h])}const O=t.defineComponent(T),f=new WeakSet,g=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},w=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),$=e=>{switch(w(e)){case"promise":return[e];case"array":return e.some(n=>w(n)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},N=e=>{f.delete(e),e.instance.proxy.close(),L(e.instance)},S=(e,o)=>{if(o.value){const n=$(o.value);if(n==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),f.add(e),n&&Promise.all(n).catch(a=>{console.error(new Error("Promise handling errors"),a)}).finally(()=>{N(e)})}else N(e)},V=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},k=(e,o)=>{const n=u(u({},new z),o),a=n.loadingTemplateRef,s=B(O,u({},n),a?()=>a:null);e.style.position=n.positionType,e.options=n,e.instance=s,e.mask=s.proxy.$el},E={mounted:function(e,o,n){k(e,n.props),V(e),!g(o.value)&&S(e,o)},updated:function(e,o,n){!g(o.value)&&f.has(e)||g(o.value)&&!f.has(e)||(!f.has(e)&&k(e,n.props),V(e),S(e,o))}},x={variant:{type:String,default:"outline"},size:{type:String,default:"md"},color:{type:String},icon:{type:String,default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}};function M(e,o){const n=t.computed(()=>o.slots.default),s={solid:"primary",outline:"secondary",text:"secondary"}[e.variant],c=t.computed(()=>({"devui-btn":!0,[`devui-btn-${e.variant}`]:!0,[`devui-btn-${e.variant}-${e.color||s}`]:!0,[`devui-btn-${e.size}`]:!0,"devui-btn-icon-wrap":e.icon,"devui-btn-icon":e.icon&&!n.value&&e.variant!=="solid"})),d=t.computed(()=>{if(!e.icon)return;const p="devui-icon-fix icon";return n.value?`${p} clear-right-5`:p});return{classes:c,iconClass:d}}var q="",y=t.defineComponent({name:"DButton",directives:{devLoading:E},props:x,emits:["click"],setup(e,o){const{icon:n,disabled:a,loading:s}=t.toRefs(e),{classes:c,iconClass:d}=M(e,o),p=m=>{s.value||o.emit("click",m)};return()=>{var m,A;return t.withDirectives(t.createVNode("button",{class:c.value,disabled:a.value,onClick:p},[n.value&&t.createVNode(r,{name:n.value,size:"12px",class:d.value},null),t.createVNode("span",{class:"button-content"},[(A=(m=o.slots).default)==null?void 0:A.call(m)])]),[[t.resolveDirective("dLoading"),s.value]])}}}),j={title:"Button \u6309\u94AE",category:"\u901A\u7528",status:"100%",install(e){e.component(y.name,y)}};i.Button=y,i.buttonProps=x,i.default=j,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});