vue-amazing-ui 2.0.0 → 2.0.1

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 (73) hide show
  1. package/README.md +80 -35
  2. package/README.zh-CN.md +65 -20
  3. package/dist/index.iife.js +14 -14
  4. package/dist/index.js +584 -584
  5. package/dist/index.umd.cjs +15 -15
  6. package/dist/style.css +1 -1
  7. package/es/avatar/Avatar.d.ts +1 -1
  8. package/es/avatar/index.d.ts +3 -3
  9. package/es/button/Button.d.ts +1 -1
  10. package/es/button/index.d.ts +3 -3
  11. package/es/cascader/Cascader.d.ts +1 -1
  12. package/es/cascader/index.d.ts +3 -3
  13. package/es/components.d.ts +3 -3
  14. package/es/ellipsis/Ellipsis.d.ts +120 -1
  15. package/es/floatbutton/FloatButton.d.ts +1 -1
  16. package/es/floatbutton/index.d.ts +3 -3
  17. package/es/popconfirm/Popconfirm.d.ts +120 -1
  18. package/es/steps/Steps.css +1 -1
  19. package/es/steps/Steps.d.ts +3 -3
  20. package/es/steps/Steps.vue.js +1 -1
  21. package/es/steps/Steps.vue2.js +6 -6
  22. package/es/steps/index.d.ts +4 -4
  23. package/es/table/Table.d.ts +300 -4
  24. package/es/tabs/Tabs.css +1 -1
  25. package/es/tabs/Tabs.d.ts +7 -5
  26. package/es/tabs/Tabs.vue.js +3 -3
  27. package/es/tabs/Tabs.vue2.js +24 -24
  28. package/es/tabs/index.d.ts +8 -6
  29. package/es/tag/Tag.css +1 -1
  30. package/es/tag/Tag.d.ts +7 -4
  31. package/es/tag/Tag.vue.js +2 -2
  32. package/es/tag/Tag.vue2.js +5 -5
  33. package/es/tag/index.d.ts +8 -5
  34. package/es/timeline/Timeline.css +1 -1
  35. package/es/timeline/Timeline.d.ts +3 -1
  36. package/es/timeline/Timeline.vue.js +2 -2
  37. package/es/timeline/Timeline.vue2.js +5 -5
  38. package/es/timeline/index.d.ts +2 -0
  39. package/es/upload/Upload.d.ts +134 -2
  40. package/lib/avatar/Avatar.d.ts +1 -1
  41. package/lib/avatar/index.d.ts +3 -3
  42. package/lib/button/Button.d.ts +1 -1
  43. package/lib/button/index.d.ts +3 -3
  44. package/lib/cascader/Cascader.d.ts +1 -1
  45. package/lib/cascader/index.d.ts +3 -3
  46. package/lib/components.d.ts +3 -3
  47. package/lib/ellipsis/Ellipsis.d.ts +120 -1
  48. package/lib/floatbutton/FloatButton.d.ts +1 -1
  49. package/lib/floatbutton/index.d.ts +3 -3
  50. package/lib/popconfirm/Popconfirm.d.ts +120 -1
  51. package/lib/steps/Steps.css +1 -1
  52. package/lib/steps/Steps.d.ts +3 -3
  53. package/lib/steps/Steps.vue.cjs +1 -1
  54. package/lib/steps/Steps.vue2.cjs +1 -1
  55. package/lib/steps/index.d.ts +4 -4
  56. package/lib/table/Table.d.ts +300 -4
  57. package/lib/tabs/Tabs.css +1 -1
  58. package/lib/tabs/Tabs.d.ts +7 -5
  59. package/lib/tabs/Tabs.vue.cjs +1 -1
  60. package/lib/tabs/Tabs.vue2.cjs +1 -1
  61. package/lib/tabs/index.d.ts +8 -6
  62. package/lib/tag/Tag.css +1 -1
  63. package/lib/tag/Tag.d.ts +7 -4
  64. package/lib/tag/Tag.vue.cjs +1 -1
  65. package/lib/tag/Tag.vue2.cjs +1 -1
  66. package/lib/tag/index.d.ts +8 -5
  67. package/lib/timeline/Timeline.css +1 -1
  68. package/lib/timeline/Timeline.d.ts +3 -1
  69. package/lib/timeline/Timeline.vue.cjs +1 -1
  70. package/lib/timeline/Timeline.vue2.cjs +1 -1
  71. package/lib/timeline/index.d.ts +2 -0
  72. package/lib/upload/Upload.d.ts +134 -2
  73. package/package.json +4 -3
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <h1 align="center">Vue Amazing UI</h1>
8
8
  <p align="center">A Vue 3 Component Library</p>
9
- <p align="center">Uses TypeScript, Each component is a Single-File Component (SFC), which can be used Independently</p>
9
+ <p align="center">Uses TypeScript, All components are single-file components (SFC), Supports tree shaking.</p>
10
10
  <p align="center">Kinda Interesting</p>
11
11
  <p align="center">English | <a href="README.zh-CN.md">中文</a></p>
12
12
 
@@ -54,7 +54,7 @@ app.mount('#app')
54
54
 
55
55
  **Global Registration Some Components**
56
56
 
57
- *Both global and local importing of components result in only the imported components being packaged.*
57
+ *In this form, only components imported will be bundled.*
58
58
 
59
59
  ```ts
60
60
  import { createApp } from 'vue'
@@ -82,6 +82,68 @@ import 'vue-amazing-ui/es/button/Button.css'
82
82
  </template>
83
83
  ```
84
84
 
85
+ **Automatic On-Demand Import (Strongly Recommended)**
86
+
87
+ Use the [`unplugin-vue-components`](https://github.com/unplugin/unplugin-vue-components) plugin to automatically import components on demand. The plugin will automatically parse the components used in the template and import the components and styles.
88
+
89
+ ```sh
90
+ pnpm add unplugin-vue-components -D
91
+ # or
92
+ npm install unplugin-vue-components -D
93
+ # or
94
+ yarn add unplugin-vue-components -D
95
+ # or
96
+ bun add unplugin-vue-components -D
97
+ ```
98
+
99
+ ```ts
100
+ // vite.config.ts
101
+ import { defineConfig } from 'vite'
102
+ import vue from '@vitejs/plugin-vue'
103
+ import Components from 'unplugin-vue-components/vite'
104
+ // vue-amazing-ui on-demand import
105
+ import { VueAmazingUIResolver } from 'vue-amazing-ui'
106
+
107
+ // https://vitejs.dev/config/
108
+ export default defineConfig({
109
+ plugins: [
110
+ vue(),
111
+ Components({
112
+ resolvers: [
113
+ // auto import components from VueAmazingUI
114
+ VueAmazingUIResolver()
115
+ ]
116
+ })
117
+ ]
118
+ })
119
+ ```
120
+
121
+ Then, you can directly use all components from `vue-amazing-ui` in your code.
122
+
123
+ ```vue
124
+ <template>
125
+ <Button>button</Button>
126
+ <Tag>tag</Tag>
127
+ </template>
128
+ ```
129
+
130
+ ## Use Types
131
+
132
+ *All types can be directly imported and used from `vue-amazing-ui` without any additional installation.*
133
+
134
+ ```vue
135
+ <script setup lang="ts">
136
+ import { Button } from 'vue-amazing-ui'
137
+ import type { ButtonProps } from 'vue-amazing-ui'
138
+ import 'vue-amazing-ui/es/button/Button.css'
139
+
140
+ const shape = ref<ButtonProps['shape']>('default')
141
+ </script>
142
+ <template>
143
+ <Button :shape="shape">button</Button>
144
+ </template>
145
+ ```
146
+
85
147
  ## Use Functions
86
148
 
87
149
  ```vue
@@ -107,23 +169,6 @@ import {
107
169
  </script>
108
170
  ```
109
171
 
110
- ## Use Types
111
-
112
- *All types can be directly imported from vue-amazing-ui without the need for additional installation.*
113
-
114
- ```vue
115
- <script setup lang="ts">
116
- import { Button } from 'vue-amazing-ui'
117
- import type { ButtonProps } from 'vue-amazing-ui'
118
- import 'vue-amazing-ui/es/button/Button.css'
119
-
120
- const shape = ref<ButtonProps['shape']>('default')
121
- </script>
122
- <template>
123
- <Button :shape="shape">button</Button>
124
- </template>
125
- ```
126
-
127
172
  ## Project
128
173
 
129
174
  - Get the project code
@@ -191,19 +236,19 @@ Watermark | 水印
191
236
 
192
237
  Name | Description | Type
193
238
  :--- | :--- | :---
194
- dateFormat | 格式化日期时间字符串函数 | (value: number &#124; string &#124; Date = Date.now(), format: string = 'YYYY-MM-DD HH:mm:ss') => string
195
- formatNumber | 数字格式化函数 | (value: number &#124; string, precision: number = 2, separator: string = ',', decimal: string = '.', prefix?: string, suffix?: string) => string
196
- rafTimeout | 使用 `requestAnimationFrame` 实现的延迟 `setTimeout` 或间隔 `setInterval` 调用函数 | (fn: Function, delay: number = 0, interval: boolean = false) => object
197
- cancelRaf | 用于取消 `rafTimeout` 函数 | (raf: { id: number }) => void
198
- throttle | 节流函数 | (fn: Function, delay: number = 300) => any
199
- debounce | 防抖函数 | (fn: Function, delay: number = 300) => any
200
- add | 消除 `js` 加减精度问题的加法函数 | (num1: number, num2: number) => number
201
- downloadFile | 下载文件并自定义文件名,未传 `name` 时,从文件地址中自动提取文件名称 | (url: string, fileName?: string) => void
202
- toggleDark | 一键切换暗黑模式函数 | () => void
203
- useEventListener | 使用 `Vue` 的生命周期钩子添加和移除事件监听器 | (target: HTMLElement &#124; Window &#124; Document, event: string, callback: Function) => void
204
- useMutationObserver | 使用 `MutationObserver` 观察 `DOM` 元素的变化 | (target: Ref &#124; Ref[] &#124; HTMLElement &#124; HTMLElement[], callback: MutationCallback, options = {}) => object
205
- useScroll | 实时监测目标元素滚动位置及状态 | (target: Ref &#124; HTMLElement &#124; Window &#124; Document = window, throttleDelay: number = 0, onScroll?: (e: Event) => void, onStop?: (e: Event) => void) => object
206
- useFps | 实时监测浏览器刷新率FPS | () => object
207
- useMediaQuery | 使用媒体查询来判断当前环境是否符合指定的媒体查询条件 | (mediaQuery: string) => object
208
- useResizeObserver | 使用 `ResizeObserver` 观察 `DOM` 元素尺寸变化 | (target: Ref &#124; Ref[] &#124; HTMLElement &#124; HTMLElement[], callback: ResizeObserverCallback, options = {}) => object
209
- useSlotsExist | 监听给定名称或名称数组的插槽是否存在,支持监听单个插槽或一组插槽的存在 | (slotsName: string &#124; string[] = 'default') => Reactive &#124; Ref\<boolean>
239
+ dateFormat | Format date-time string function | (value: number &#124; string &#124; Date = Date.now(), format: string = 'YYYY-MM-DD HH:mm:ss') => string
240
+ formatNumber | Number formatting function | (value: number &#124; string, precision: number = 2, separator: string = ',', decimal: string = '.', prefix?: string, suffix?: string) => string
241
+ rafTimeout | Function to implement `setTimeout` or `setInterval` using `requestAnimationFrame` | (fn: Function, delay: number = 0, interval: boolean = false) => object
242
+ cancelRaf | Function to cancel the `rafTimeout` function | (raf: { id: number }) => void
243
+ throttle | Throttle function | (fn: Function, delay: number = 300) => any
244
+ debounce | Debounce function | (fn: Function, delay: number = 300) => any
245
+ add | Addition function that eliminates precision issues in JavaScript arithmetic | (num1: number, num2: number) => number
246
+ downloadFile | Function to download a file with a custom filename; if no name is provided, it extracts the filename from the URL | (url: string, fileName?: string) => void
247
+ toggleDark | Function to toggle dark mode | () => void
248
+ useEventListener | Function to add and remove event listeners using Vue lifecycle hooks | (target: HTMLElement &#124; Window &#124; Document, event: string, callback: Function) => void
249
+ useMutationObserver | Function to observe changes in DOM elements using `MutationObserver` | (target: Ref &#124; Ref[] &#124; HTMLElement &#124; HTMLElement[], callback: MutationCallback, options = {}) => object
250
+ useScroll | Function to monitor the scroll position and state of a target element in real time | (target: Ref &#124; HTMLElement &#124; Window &#124; Document = window, throttleDelay: number = 0, onScroll?: (e: Event) => void, onStop?: (e: Event) => void) => object
251
+ useFps | Function to monitor the browser's refresh rate (FPS) in real time | () => object
252
+ useMediaQuery | Function to determine if the current environment matches a specified media query condition | (mediaQuery: string) => object
253
+ useResizeObserver | Function to observe changes in the dimensions of DOM elements using `ResizeObserver` | (target: Ref &#124; Ref[] &#124; HTMLElement &#124; HTMLElement[], callback: ResizeObserverCallback, options = {}) => object
254
+ useSlotsExist | Function to watch for the existence of slots with given names, supporting single slots or an array of slots | (slotsName: string &#124; string[] = 'default') => Reactive &#124; Ref\<boolean>
package/README.zh-CN.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <h1 align="center">Vue Amazing UI</h1>
8
8
  <p align="center">一个 Vue 3 组件库</p>
9
- <p align="center">使用 TypeScript,每个组件都是单文件组件 (SFC), 可独立使用</p>
9
+ <p align="center">使用 TypeScript,都是单文件组件 (SFC),支持 tree shaking</p>
10
10
  <p align="center">有点意思</p>
11
11
  <p align="center"><a href="README.md">English</a> | 中文</p>
12
12
 
@@ -54,7 +54,7 @@ app.mount('#app')
54
54
 
55
55
  **全局部分注册**
56
56
 
57
- *全局或局部引入部分组件,都只有导入的组件才会被打包*
57
+ *这种情况下,只有导入的组件才会被打包*
58
58
 
59
59
  ```ts
60
60
  import { createApp } from 'vue'
@@ -82,6 +82,68 @@ import 'vue-amazing-ui/es/button/Button.css'
82
82
  </template>
83
83
  ```
84
84
 
85
+ **自动按需引入(强烈推荐)**
86
+
87
+ 使用 [`unplugin-vue-components`](https://github.com/unplugin/unplugin-vue-components) 插件来按需自动加载组件,插件会自动解析模板中的使用到的组件,并导入组件和样式
88
+
89
+ ```sh
90
+ pnpm add unplugin-vue-components -D
91
+ # or
92
+ npm install unplugin-vue-components -D
93
+ # or
94
+ yarn add unplugin-vue-components -D
95
+ # or
96
+ bun add unplugin-vue-components -D
97
+ ```
98
+
99
+ ```ts
100
+ // vite.config.ts
101
+ import { defineConfig } from 'vite'
102
+ import vue from '@vitejs/plugin-vue'
103
+ import Components from 'unplugin-vue-components/vite'
104
+ // vue-amazing-ui 按需引入
105
+ import { VueAmazingUIResolver } from 'vue-amazing-ui'
106
+
107
+ // https://vitejs.dev/config/
108
+ export default defineConfig({
109
+ plugins: [
110
+ vue(),
111
+ Components({
112
+ resolvers: [
113
+ // auto import components from VueAmazingUI
114
+ VueAmazingUIResolver()
115
+ ]
116
+ })
117
+ ]
118
+ })
119
+ ```
120
+
121
+ 然后,你可以在代码中直接使用 `vue-amazing-ui` 的所有组件
122
+
123
+ ```vue
124
+ <template>
125
+ <Button>button</Button>
126
+ <Tag>tag</Tag>
127
+ </template>
128
+ ```
129
+
130
+ ## 使用类型
131
+
132
+ *所有类型均可直接从 `vue-amazing-ui` 中引入使用,无需任何额外安装*
133
+
134
+ ```vue
135
+ <script setup lang="ts">
136
+ import { Button } from 'vue-amazing-ui'
137
+ import type { ButtonProps } from 'vue-amazing-ui'
138
+ import 'vue-amazing-ui/es/button/Button.css'
139
+
140
+ const shape = ref<ButtonProps['shape']>('default')
141
+ </script>
142
+ <template>
143
+ <Button :shape="shape">button</Button>
144
+ </template>
145
+ ```
146
+
85
147
  ## 使用工具函数
86
148
 
87
149
  ```vue
@@ -107,23 +169,6 @@ import {
107
169
  </script>
108
170
  ```
109
171
 
110
- ## 使用类型
111
-
112
- *所有类型均可直接从 `vue-amazing-ui` 中引入使用,无需额外安装*
113
-
114
- ```vue
115
- <script setup lang="ts">
116
- import { Button } from 'vue-amazing-ui'
117
- import type { ButtonProps } from 'vue-amazing-ui'
118
- import 'vue-amazing-ui/es/button/Button.css'
119
-
120
- const shape = ref<ButtonProps['shape']>('default')
121
- </script>
122
- <template>
123
- <Button :shape="shape">button</Button>
124
- </template>
125
- ```
126
-
127
172
  ## 项目
128
173
 
129
174
  - 获取项目代码
@@ -193,7 +238,7 @@ Watermark | 水印
193
238
  :--- | :--- | :---
194
239
  dateFormat | 格式化日期时间字符串函数 | (value: number &#124; string &#124; Date = Date.now(), format: string = 'YYYY-MM-DD HH:mm:ss') => string
195
240
  formatNumber | 数字格式化函数 | (value: number &#124; string, precision: number = 2, separator: string = ',', decimal: string = '.', prefix?: string, suffix?: string) => string
196
- rafTimeout | 使用 `requestAnimationFrame` 实现的延迟 `setTimeout` 或间隔 `setInterval` 调用函数 | (fn: Function, delay: number = 0, interval: boolean = false) => object
241
+ rafTimeout | 使用 `requestAnimationFrame` 实现的 `setTimeout` `setInterval` 调用函数 | (fn: Function, delay: number = 0, interval: boolean = false) => object
197
242
  cancelRaf | 用于取消 `rafTimeout` 函数 | (raf: { id: number }) => void
198
243
  throttle | 节流函数 | (fn: Function, delay: number = 300) => any
199
244
  debounce | 防抖函数 | (fn: Function, delay: number = 300) => any