@varlet/ui 2.0.0-alpha.1663499244572 → 2.0.0-alpha.1664031123039
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/CHANGELOG.md +1885 -1885
- package/LICENCE +21 -21
- package/README.md +87 -93
- package/README.zh-CN.md +92 -0
- package/es/button/Button.js +3 -1
- package/es/countdown/Countdown.js +4 -3
- package/es/date-picker/DatePicker.js +4 -3
- package/es/index.d.ts +1 -1
- package/es/input/Input.js +1 -1
- package/es/locale/en-US.d.ts +5 -5
- package/es/locale/zh-CN.d.ts +5 -5
- package/es/space/Space.js +6 -2
- package/es/style-provider/index.js +1 -5
- package/es/themes/dark/index.d.ts +5 -5
- package/es/time-picker/TimePicker.js +3 -2
- package/es/time-picker/clock.js +2 -1
- package/es/utils/elements.js +3 -0
- package/es/utils/{test.js → jest.js} +0 -0
- package/es/utils/shared.js +20 -1
- package/es/varlet.esm.js +3330 -3320
- package/highlight/attributes.json +1882 -1
- package/highlight/tags.json +586 -58
- package/highlight/web-types.json +5312 -151
- package/json/area.json +10706 -10706
- package/lib/button/Button.js +3 -1
- package/lib/countdown/Countdown.js +8 -6
- package/lib/date-picker/DatePicker.js +18 -16
- package/lib/date-picker/src/day-picker-panel.js +13 -13
- package/lib/date-picker/src/month-picker-panel.js +11 -11
- package/lib/date-picker/src/year-picker-panel.js +3 -3
- package/lib/index.d.ts +1 -1
- package/lib/input/Input.js +1 -1
- package/lib/locale/en-US.d.ts +5 -5
- package/lib/locale/zh-CN.d.ts +5 -5
- package/lib/snackbar/style/index.js +1 -1
- package/lib/space/Space.js +6 -2
- package/lib/style-provider/index.js +1 -5
- package/lib/themes/dark/index.d.ts +5 -5
- package/lib/time-picker/TimePicker.js +12 -10
- package/lib/time-picker/clock.js +6 -4
- package/lib/utils/elements.js +4 -0
- package/lib/utils/{test.js → jest.js} +0 -0
- package/lib/utils/shared.js +27 -2
- package/package.json +11 -12
- package/types/actionSheet.d.ts +68 -68
- package/types/appBar.d.ts +17 -17
- package/types/backTop.d.ts +16 -16
- package/types/badge.d.ts +20 -20
- package/types/bottomNavigation.d.ts +23 -23
- package/types/bottomNavigationItem.d.ts +17 -17
- package/types/button.d.ts +29 -29
- package/types/card.d.ts +29 -29
- package/types/cell.d.ts +18 -18
- package/types/checkbox.d.ts +34 -34
- package/types/checkboxGroup.d.ts +29 -29
- package/types/chip.d.ts +20 -20
- package/types/col.d.ts +23 -23
- package/types/collapse.d.ts +17 -17
- package/types/collapseItem.d.ts +14 -14
- package/types/countdown.d.ts +29 -29
- package/types/counter.d.ts +44 -44
- package/types/datePicker.d.ts +29 -29
- package/types/dialog.d.ts +84 -84
- package/types/divider.d.ts +15 -15
- package/types/form.d.ts +18 -18
- package/types/icon.d.ts +16 -16
- package/types/image.d.ts +26 -26
- package/types/imagePreview.d.ts +51 -51
- package/types/indexAnchor.d.ts +11 -11
- package/types/indexBar.d.ts +21 -21
- package/types/input.d.ts +48 -48
- package/types/lazy.d.ts +5 -5
- package/types/list.d.ts +21 -21
- package/types/loading.d.ts +18 -18
- package/types/locale.d.ts +52 -52
- package/types/menu.d.ts +46 -46
- package/types/option.d.ts +12 -12
- package/types/pagination.d.ts +25 -25
- package/types/picker.d.ts +85 -85
- package/types/popup.d.ts +27 -27
- package/types/progress.d.ts +22 -22
- package/types/pullRefresh.d.ts +20 -20
- package/types/radio.d.ts +34 -34
- package/types/radioGroup.d.ts +24 -24
- package/types/rate.d.ts +28 -28
- package/types/ripple.d.ts +5 -5
- package/types/row.d.ts +18 -18
- package/types/select.d.ts +48 -48
- package/types/skeleton.d.ts +21 -21
- package/types/slider.d.ts +30 -30
- package/types/snackbar.d.ts +82 -82
- package/types/space.d.ts +26 -26
- package/types/step.d.ts +13 -13
- package/types/steps.d.ts +15 -15
- package/types/sticky.d.ts +15 -15
- package/types/styleProvider.d.ts +24 -24
- package/types/swipe.d.ts +27 -27
- package/types/swipeItem.d.ts +9 -9
- package/types/switch.d.ts +25 -25
- package/types/tab.d.ts +13 -13
- package/types/tabItem.d.ts +11 -11
- package/types/table.d.ts +11 -11
- package/types/tabs.d.ts +29 -29
- package/types/tabsItems.d.ts +15 -15
- package/types/timePicker.d.ts +30 -30
- package/types/uploader.d.ts +65 -65
- package/types/varComponent.d.ts +18 -18
- package/types/varDirective.d.ts +12 -12
- package/umd/varlet.js +6 -6
- package/README.en-US.md +0 -86
- package/es/themes/dark/tab-item.js +0 -3
- package/lib/themes/dark/tab-item.js +0 -8
package/LICENCE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 varlet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,93 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
</
|
|
6
|
-
<
|
|
7
|
-
<p
|
|
8
|
-
|
|
9
|
-
<a href="https://varlet
|
|
10
|
-
<a href="https://
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<img src="https://img.shields.io/
|
|
15
|
-
<img src="https://img.shields.io/
|
|
16
|
-
<img src="https://img.shields.io/
|
|
17
|
-
<img src="https://img.shields.io/
|
|
18
|
-
<img src="https://img.
|
|
19
|
-
<img src="https://
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
###
|
|
31
|
-
- 🚀
|
|
32
|
-
- 🚀
|
|
33
|
-
- 💪
|
|
34
|
-
- 🛠️
|
|
35
|
-
- 🛠️
|
|
36
|
-
- 🌍
|
|
37
|
-
- 💡
|
|
38
|
-
- 💪
|
|
39
|
-
- 💡
|
|
40
|
-
- 💪
|
|
41
|
-
- 🛠️
|
|
42
|
-
|
|
43
|
-
###
|
|
44
|
-
|
|
45
|
-
### CDN
|
|
46
|
-
`varlet.js`
|
|
47
|
-
|
|
48
|
-
```html
|
|
49
|
-
<div id="app"></div>
|
|
50
|
-
<script src="https://cdn.jsdelivr.net/npm/vue@next"></script>
|
|
51
|
-
<script src="https://cdn.jsdelivr.net/npm/@varlet/ui/umd/varlet.js"></script>
|
|
52
|
-
<script>
|
|
53
|
-
const app = Vue.createApp({
|
|
54
|
-
template: '<var-button
|
|
55
|
-
})
|
|
56
|
-
app.use(Varlet).mount('#app')
|
|
57
|
-
</script>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Webpack / Vite
|
|
61
|
-
```shell
|
|
62
|
-
#
|
|
63
|
-
|
|
64
|
-
# npm
|
|
65
|
-
npm i @varlet/ui -S
|
|
66
|
-
|
|
67
|
-
# yarn
|
|
68
|
-
yarn add @varlet/ui
|
|
69
|
-
|
|
70
|
-
# pnpm
|
|
71
|
-
pnpm add @varlet/ui
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```js
|
|
75
|
-
import App from './App.vue'
|
|
76
|
-
import Varlet from '@varlet/ui'
|
|
77
|
-
import { createApp } from 'vue'
|
|
78
|
-
import '@varlet/ui/es/style.js'
|
|
79
|
-
|
|
80
|
-
createApp(App).use(Varlet).mount('#app')
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
###
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### 感谢贡献者们做出的努力
|
|
90
|
-
|
|
91
|
-
<a href="https://github.com/varletjs/varlet/graphs/contributors">
|
|
92
|
-
<img src="https://contrib.rocks/image?repo=varletjs/varlet" />
|
|
93
|
-
</a>
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://varlet.gitee.io/varlet-ui/#/en-US/home">
|
|
3
|
+
<img src="https://varlet.gitee.io/varlet-ui/logo.svg" width="150">
|
|
4
|
+
</a>
|
|
5
|
+
<h1>VARLET</h1>
|
|
6
|
+
<p>Material design mobile component library for Vue3</p>
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://varlet-varletjs.vercel.app/#/en-US/home">Documentation(Vercel)</a> |
|
|
9
|
+
<a href="https://varlet.gitee.io/varlet-ui/#/en-US/home">Documentation(Gitee)</a> |
|
|
10
|
+
<a href="https://github.com/varletjs/varlet/blob/dev/README.zh-CN.md">中文</a>
|
|
11
|
+
</p>
|
|
12
|
+
<p>
|
|
13
|
+
<img src="https://img.shields.io/npm/v/@varlet/ui?style=flat-square" alt="version">
|
|
14
|
+
<img src="https://img.shields.io/github/stars/varletjs/varlet" alt="stars">
|
|
15
|
+
<img src="https://img.shields.io/badge/vue-v3.2.0%2B-%23407fbc" alt="vue">
|
|
16
|
+
<img src="https://img.shields.io/npm/l/@varlet/ui.svg" alt="licence">
|
|
17
|
+
<img src="https://img.shields.io/codecov/c/github/varletjs/varlet" alt="coverage">
|
|
18
|
+
<img src="https://img.badgesize.io/https://unpkg.com/@varlet/ui/umd/varlet.js?compression=gzip&label=gzip" alt="gzip" />
|
|
19
|
+
<img src="https://github.com/varletjs/varlet/workflows/CI/badge.svg" alt="ci">
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### Intro
|
|
26
|
+
|
|
27
|
+
Varlet is a Material design mobile component library developed based on `Vue3`, developed and maintained by partners in the community.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
- 🚀 Provide 50+ high quality general purpose components
|
|
32
|
+
- 🚀 Components are very lightweight
|
|
33
|
+
- 💪 Developed by Chinese, complete Chinese and English documentation and logistics support
|
|
34
|
+
- 🛠️ Support on-demand introduction
|
|
35
|
+
- 🛠️ Support theme customization
|
|
36
|
+
- 🌍 Support internationalization
|
|
37
|
+
- 💡 Support WebStorm, VS Code component syntax highlighting
|
|
38
|
+
- 💪 Support the SSR
|
|
39
|
+
- 💡 Support the Typescript
|
|
40
|
+
- 💪 Make sure more than 90 percent unit test coverage, providing stability assurance
|
|
41
|
+
- 🛠️ Support dark mode
|
|
42
|
+
|
|
43
|
+
### Install
|
|
44
|
+
|
|
45
|
+
### CDN
|
|
46
|
+
`varlet.js` contain all the styles and logic of the component library, and you can import them.
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<div id="app"></div>
|
|
50
|
+
<script src="https://cdn.jsdelivr.net/npm/vue@next"></script>
|
|
51
|
+
<script src="https://cdn.jsdelivr.net/npm/@varlet/ui/umd/varlet.js"></script>
|
|
52
|
+
<script>
|
|
53
|
+
const app = Vue.createApp({
|
|
54
|
+
template: '<var-button>Button</var-button>'
|
|
55
|
+
})
|
|
56
|
+
app.use(Varlet).mount('#app')
|
|
57
|
+
</script>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Webpack / Vite
|
|
61
|
+
```shell
|
|
62
|
+
# Install with npm or yarn or pnpm
|
|
63
|
+
|
|
64
|
+
# npm
|
|
65
|
+
npm i @varlet/ui -S
|
|
66
|
+
|
|
67
|
+
# yarn
|
|
68
|
+
yarn add @varlet/ui
|
|
69
|
+
|
|
70
|
+
# pnpm
|
|
71
|
+
pnpm add @varlet/ui
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
import App from './App.vue'
|
|
76
|
+
import Varlet from '@varlet/ui'
|
|
77
|
+
import { createApp } from 'vue'
|
|
78
|
+
import '@varlet/ui/es/style.js'
|
|
79
|
+
|
|
80
|
+
createApp(App).use(Varlet).mount('#app')
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Thanks to contributors
|
|
84
|
+
|
|
85
|
+
<a href="https://github.com/varletjs/varlet/graphs/contributors">
|
|
86
|
+
<img src="https://contrib.rocks/image?repo=varletjs/varlet" />
|
|
87
|
+
</a>
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
<div align="center">
|
|
3
|
+
<a href="https://varlet.gitee.io/varlet-ui">
|
|
4
|
+
<img src="https://varlet.gitee.io/varlet-ui/logo.svg" width="150">
|
|
5
|
+
</a>
|
|
6
|
+
<h1>VARLET</h1>
|
|
7
|
+
<p>基于 Vue3 的 Material design 风格移动端组件库</p>
|
|
8
|
+
<p>
|
|
9
|
+
<a href="https://varlet-varletjs.vercel.app">文档(Vercel)</a> |
|
|
10
|
+
<a href="https://varlet.gitee.io/varlet-ui">文档(Gitee)</a>
|
|
11
|
+
</p>
|
|
12
|
+
<p>
|
|
13
|
+
<img src="https://img.shields.io/npm/v/@varlet/ui?style=flat-square" alt="version">
|
|
14
|
+
<img src="https://img.shields.io/github/stars/varletjs/varlet" alt="stars">
|
|
15
|
+
<img src="https://img.shields.io/badge/vue-v3.2.0%2B-%23407fbc" alt="vue">
|
|
16
|
+
<img src="https://img.shields.io/npm/l/@varlet/ui.svg" alt="licence">
|
|
17
|
+
<img src="https://img.shields.io/codecov/c/github/varletjs/varlet" alt="coverage">
|
|
18
|
+
<img src="https://img.badgesize.io/https://unpkg.com/@varlet/ui/umd/varlet.js?compression=gzip&label=gzip" alt="gzip" />
|
|
19
|
+
<img src="https://github.com/varletjs/varlet/workflows/CI/badge.svg" alt="ci">
|
|
20
|
+
</p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### 介绍
|
|
26
|
+
|
|
27
|
+
Varlet 是一个基于 `Vue3` 开发的 Material 风格移动端组件库,全面拥抱 `Vue3` 生态,由社区建立起来的组件库团队进行维护。
|
|
28
|
+
|
|
29
|
+
### 特性
|
|
30
|
+
- 🚀 提供50+个高质量通用组件
|
|
31
|
+
- 🚀 组件十分轻量
|
|
32
|
+
- 💪 由国人开发,完善的中英文文档和后勤保障
|
|
33
|
+
- 🛠️ 支持按需引入
|
|
34
|
+
- 🛠️ 支持主题定制
|
|
35
|
+
- 🌍 支持国际化
|
|
36
|
+
- 💡 支持 webstorm,vscode 组件属性高亮
|
|
37
|
+
- 💪 支持 SSR
|
|
38
|
+
- 💡 支持 Typescript
|
|
39
|
+
- 💪 确保90%以上单元测试覆盖率,提供稳定性保证
|
|
40
|
+
- 🛠️ 支持暗黑模式
|
|
41
|
+
|
|
42
|
+
### 安装
|
|
43
|
+
|
|
44
|
+
### CDN
|
|
45
|
+
`varlet.js` 包含组件库的所有样式和逻辑,引入即可。
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<div id="app"></div>
|
|
49
|
+
<script src="https://cdn.jsdelivr.net/npm/vue@next"></script>
|
|
50
|
+
<script src="https://cdn.jsdelivr.net/npm/@varlet/ui/umd/varlet.js"></script>
|
|
51
|
+
<script>
|
|
52
|
+
const app = Vue.createApp({
|
|
53
|
+
template: '<var-button>按钮</var-button>'
|
|
54
|
+
})
|
|
55
|
+
app.use(Varlet).mount('#app')
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Webpack / Vite
|
|
60
|
+
```shell
|
|
61
|
+
# 通过 npm 或 yarn 或 pnpm 安装
|
|
62
|
+
|
|
63
|
+
# npm
|
|
64
|
+
npm i @varlet/ui -S
|
|
65
|
+
|
|
66
|
+
# yarn
|
|
67
|
+
yarn add @varlet/ui
|
|
68
|
+
|
|
69
|
+
# pnpm
|
|
70
|
+
pnpm add @varlet/ui
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
import App from './App.vue'
|
|
75
|
+
import Varlet from '@varlet/ui'
|
|
76
|
+
import { createApp } from 'vue'
|
|
77
|
+
import '@varlet/ui/es/style.js'
|
|
78
|
+
|
|
79
|
+
createApp(App).use(Varlet).mount('#app')
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 反馈和交流
|
|
83
|
+
|
|
84
|
+
我们推荐使用`issue`列表进行最直接有效的反馈,也可以通过扫描下方二维码进入微信群进行交流
|
|
85
|
+
|
|
86
|
+
<img style="width: 25%" src="https://github.com/varletjs/varlet/blob/dev/sponsor/community.png?raw=true" />
|
|
87
|
+
|
|
88
|
+
### 感谢贡献者们做出的努力
|
|
89
|
+
|
|
90
|
+
<a href="https://github.com/varletjs/varlet/graphs/contributors">
|
|
91
|
+
<img src="https://contrib.rocks/image?repo=varletjs/varlet" />
|
|
92
|
+
</a>
|
package/es/button/Button.js
CHANGED
|
@@ -67,7 +67,9 @@ export default defineComponent({
|
|
|
67
67
|
var attemptAutoLoading = result => {
|
|
68
68
|
if (props.autoLoading) {
|
|
69
69
|
pending.value = true;
|
|
70
|
-
Promise.resolve(result).
|
|
70
|
+
Promise.resolve(result).then(() => {
|
|
71
|
+
pending.value = false;
|
|
72
|
+
}).catch(() => {
|
|
71
73
|
pending.value = false;
|
|
72
74
|
});
|
|
73
75
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { defineComponent, ref, watch } from 'vue';
|
|
2
2
|
import { props } from './props';
|
|
3
3
|
import { requestAnimationFrame, cancelAnimationFrame } from '../utils/elements';
|
|
4
|
-
import { toNumber } from '@varlet/shared';
|
|
5
4
|
import { call, createNamespace } from '../utils/components';
|
|
5
|
+
import { padStart } from '../utils/shared';
|
|
6
|
+
import { toNumber } from '@varlet/shared';
|
|
6
7
|
var {
|
|
7
8
|
n
|
|
8
9
|
} = createNamespace('countdown');
|
|
@@ -47,12 +48,12 @@ export default defineComponent({
|
|
|
47
48
|
if (!format.includes(scannedFormat)) {
|
|
48
49
|
scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
|
|
49
50
|
} else {
|
|
50
|
-
format = format.replace(scannedFormat,
|
|
51
|
+
format = format.replace(scannedFormat, padStart("" + scannedTimes[index], 2, '0'));
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
54
|
|
|
54
55
|
if (format.includes('S')) {
|
|
55
|
-
var ms =
|
|
56
|
+
var ms = padStart("" + scannedTimes[scannedTimes.length - 1], 3, '0');
|
|
56
57
|
|
|
57
58
|
if (format.includes('SSS')) {
|
|
58
59
|
format = format.replace('SSS', ms);
|
|
@@ -7,6 +7,7 @@ import { props, MONTH_LIST, WEEK_HEADER } from './props';
|
|
|
7
7
|
import { isArray, toNumber } from '@varlet/shared';
|
|
8
8
|
import { nextTickFrame } from '../utils/elements';
|
|
9
9
|
import { createNamespace, call } from '../utils/components';
|
|
10
|
+
import { padStart } from '../utils/shared';
|
|
10
11
|
import { pack } from '../locale';
|
|
11
12
|
var {
|
|
12
13
|
n,
|
|
@@ -243,7 +244,7 @@ export default defineComponent({
|
|
|
243
244
|
var week = WEEK_HEADER.find(value => value.index === "" + weekIndex);
|
|
244
245
|
var weekName = (_pack$value$datePicke3 = (_pack$value$datePicke4 = pack.value.datePickerWeekDict) == null ? void 0 : _pack$value$datePicke4[week.index].name) != null ? _pack$value$datePicke3 : '';
|
|
245
246
|
var monthName = (_pack$value$datePicke5 = (_pack$value$datePicke6 = pack.value.datePickerMonthDict) == null ? void 0 : _pack$value$datePicke6[chooseMonth.value.index].name) != null ? _pack$value$datePicke5 : '';
|
|
246
|
-
var showDay = chooseDay.value
|
|
247
|
+
var showDay = padStart(chooseDay.value, 2, '0');
|
|
247
248
|
if (pack.value.lang === 'zh-CN') return chooseMonth.value.index + "-" + showDay + " " + weekName.slice(0, 3);
|
|
248
249
|
return weekName.slice(0, 3) + ", " + monthName.slice(0, 3) + " " + chooseDay.value;
|
|
249
250
|
});
|
|
@@ -257,10 +258,10 @@ export default defineComponent({
|
|
|
257
258
|
return !props.touchable || ['', 'year'].includes(getPanelType.value);
|
|
258
259
|
});
|
|
259
260
|
var slotProps = computed(() => {
|
|
260
|
-
var _chooseMonth$value,
|
|
261
|
+
var _chooseMonth$value, _chooseYear$value, _chooseMonth$value$in, _chooseMonth$value2;
|
|
261
262
|
|
|
262
263
|
var weekIndex = dayjs(chooseYear.value + "-" + ((_chooseMonth$value = chooseMonth.value) == null ? void 0 : _chooseMonth$value.index) + "-" + chooseDay.value).day();
|
|
263
|
-
var date = chooseDay.value ? (
|
|
264
|
+
var date = chooseDay.value ? padStart(chooseDay.value, 2, '0') : '';
|
|
264
265
|
return {
|
|
265
266
|
week: "" + weekIndex,
|
|
266
267
|
year: (_chooseYear$value = chooseYear.value) != null ? _chooseYear$value : '',
|
package/es/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '../types'
|
package/es/input/Input.js
CHANGED
|
@@ -73,7 +73,7 @@ export function render(_ctx, _cache) {
|
|
|
73
73
|
onTouchstart: _cache[4] || (_cache[4] = function () {
|
|
74
74
|
return _ctx.handleTouchstart && _ctx.handleTouchstart(...arguments);
|
|
75
75
|
})
|
|
76
|
-
}, "\
|
|
76
|
+
}, "\n ", 46
|
|
77
77
|
/* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
|
|
78
78
|
, _hoisted_1)) : (_openBlock(), _createElementBlock("input", {
|
|
79
79
|
key: 2,
|
package/es/locale/en-US.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Pack } from '../../types'
|
|
2
|
-
|
|
3
|
-
declare const enUS: Pack
|
|
4
|
-
|
|
5
|
-
export default enUS
|
|
1
|
+
import type { Pack } from '../../types'
|
|
2
|
+
|
|
3
|
+
declare const enUS: Pack
|
|
4
|
+
|
|
5
|
+
export default enUS
|
package/es/locale/zh-CN.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Pack } from '../../types'
|
|
2
|
-
|
|
3
|
-
declare const zhCN: Pack
|
|
4
|
-
|
|
5
|
-
export default zhCN
|
|
1
|
+
import type { Pack } from '../../types'
|
|
2
|
+
|
|
3
|
+
declare const zhCN: Pack
|
|
4
|
+
|
|
5
|
+
export default zhCN
|
package/es/space/Space.js
CHANGED
|
@@ -29,6 +29,10 @@ export default defineComponent({
|
|
|
29
29
|
return isInternalSize ? internalSizes[size] : isArray(size) ? size.map(toPxNum) : [toPxNum(size), toPxNum(size)];
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
var padStartFlex = style => {
|
|
33
|
+
return style === 'start' || style === 'end' ? "flex-" + style : style;
|
|
34
|
+
};
|
|
35
|
+
|
|
32
36
|
return () => {
|
|
33
37
|
var _call;
|
|
34
38
|
|
|
@@ -102,8 +106,8 @@ export default defineComponent({
|
|
|
102
106
|
"class": classes(n(), 'var--box', [inline, n('--inline')]),
|
|
103
107
|
"style": {
|
|
104
108
|
flexDirection: direction,
|
|
105
|
-
justifyContent: justify,
|
|
106
|
-
alignItems: align,
|
|
109
|
+
justifyContent: padStartFlex(justify),
|
|
110
|
+
alignItems: padStartFlex(align),
|
|
107
111
|
flexWrap: wrap ? 'wrap' : 'nowrap',
|
|
108
112
|
margin: direction === 'row' ? "-" + y / 2 + "px 0" : undefined
|
|
109
113
|
}
|
|
@@ -3,13 +3,9 @@ import { formatStyleVars } from '../utils/elements';
|
|
|
3
3
|
var mountedVarKeys = [];
|
|
4
4
|
|
|
5
5
|
function StyleProvider(styleVars) {
|
|
6
|
-
if (styleVars === void 0) {
|
|
7
|
-
styleVars = {};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
6
|
mountedVarKeys.forEach(key => document.documentElement.style.removeProperty(key));
|
|
11
7
|
mountedVarKeys.length = 0;
|
|
12
|
-
var styles = formatStyleVars(styleVars);
|
|
8
|
+
var styles = formatStyleVars(styleVars != null ? styleVars : {});
|
|
13
9
|
Object.entries(styles).forEach(_ref => {
|
|
14
10
|
var [key, value] = _ref;
|
|
15
11
|
document.documentElement.style.setProperty(key, value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StyleVars } from '../../../types'
|
|
2
|
-
|
|
3
|
-
declare const dark: StyleVars
|
|
4
|
-
|
|
5
|
-
export default dark
|
|
1
|
+
import { StyleVars } from '../../../types'
|
|
2
|
+
|
|
3
|
+
declare const dark: StyleVars
|
|
4
|
+
|
|
5
|
+
export default dark
|
|
@@ -4,6 +4,7 @@ import Clock from './clock.js'
|
|
|
4
4
|
import { props, hoursAmpm, hours24 } from './props';
|
|
5
5
|
import { toNumber } from '@varlet/shared';
|
|
6
6
|
import { createNamespace, call } from '../utils/components';
|
|
7
|
+
import { padStart } from '../utils/shared';
|
|
7
8
|
import { getNumberTime, getIsDisableMinute, getIsDisableSecond } from './utils';
|
|
8
9
|
var {
|
|
9
10
|
n,
|
|
@@ -195,7 +196,7 @@ export default defineComponent({
|
|
|
195
196
|
var newHour = findAvailableHour(ampmType);
|
|
196
197
|
if (!newHour) return;
|
|
197
198
|
var second = props.useSeconds ? ":" + time.value.second : '';
|
|
198
|
-
var newTime =
|
|
199
|
+
var newTime = padStart(newHour, 2, '0') + ":" + time.value.minute + second;
|
|
199
200
|
update(newTime);
|
|
200
201
|
};
|
|
201
202
|
|
|
@@ -374,7 +375,7 @@ export default defineComponent({
|
|
|
374
375
|
time.value = getTime(value);
|
|
375
376
|
|
|
376
377
|
if (props.format !== '24hr') {
|
|
377
|
-
ampm.value = ("" + hour
|
|
378
|
+
ampm.value = padStart("" + hour, 2, '0') === formatHour24 && hours24.includes(formatHour24) ? 'pm' : 'am';
|
|
378
379
|
}
|
|
379
380
|
|
|
380
381
|
isInner.value = props.format === '24hr' && hours24.includes(formatHour24);
|
package/es/time-picker/clock.js
CHANGED
|
@@ -4,6 +4,7 @@ import { hoursAmpm, hours24, minSec } from './props';
|
|
|
4
4
|
import { notConvert, convertHour, getIsDisableMinute, getIsDisableSecond, getNumberTime } from './utils';
|
|
5
5
|
import { toNumber } from '@varlet/shared';
|
|
6
6
|
import { createNamespace } from '../utils/components';
|
|
7
|
+
import { padStart } from '../utils/shared';
|
|
7
8
|
var {
|
|
8
9
|
n,
|
|
9
10
|
classes
|
|
@@ -218,7 +219,7 @@ export default defineComponent({
|
|
|
218
219
|
var getHour = () => {
|
|
219
220
|
if (activeItemIndex.value === undefined) return undefined;
|
|
220
221
|
var hours = props.ampm === 'am' ? hoursAmpm : hours24;
|
|
221
|
-
return hours[activeItemIndex.value]
|
|
222
|
+
return padStart(hours[activeItemIndex.value], 2, '0');
|
|
222
223
|
};
|
|
223
224
|
|
|
224
225
|
watch([activeItemIndex, () => props.isInner], (_ref2, _ref3) => {
|
package/es/utils/elements.js
CHANGED
|
@@ -3,6 +3,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
3
3
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
4
|
|
|
5
5
|
import { isNumber, isString, kebabCase, toNumber } from '@varlet/shared';
|
|
6
|
+
import { getGlobalThis } from './shared';
|
|
6
7
|
export function getLeft(element) {
|
|
7
8
|
var {
|
|
8
9
|
left
|
|
@@ -159,9 +160,11 @@ export var multiplySizeUnit = function (value, quantity) {
|
|
|
159
160
|
return "" + parseFloat(legalSize) * quantity + unit;
|
|
160
161
|
};
|
|
161
162
|
export function requestAnimationFrame(fn) {
|
|
163
|
+
var globalThis = getGlobalThis();
|
|
162
164
|
return globalThis.requestAnimationFrame ? globalThis.requestAnimationFrame(fn) : globalThis.setTimeout(fn, 16);
|
|
163
165
|
}
|
|
164
166
|
export function cancelAnimationFrame(handle) {
|
|
167
|
+
var globalThis = getGlobalThis();
|
|
165
168
|
globalThis.cancelAnimationFrame ? globalThis.cancelAnimationFrame(handle) : globalThis.clearTimeout(handle);
|
|
166
169
|
}
|
|
167
170
|
export function nextTickFrame(fn) {
|
|
File without changes
|
package/es/utils/shared.js
CHANGED
|
@@ -44,4 +44,23 @@ export var createCache = max => {
|
|
|
44
44
|
export var linear = value => value;
|
|
45
45
|
export var cubic = value => Math.pow(value, 3);
|
|
46
46
|
export var easeInOutCubic = value => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
|
47
|
-
export var dt = (value, defaultText) => value == null ? defaultText : value;
|
|
47
|
+
export var dt = (value, defaultText) => value == null ? defaultText : value;
|
|
48
|
+
export var getGlobalThis = () => {
|
|
49
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
50
|
+
if (typeof window !== 'undefined') return window;
|
|
51
|
+
return typeof global !== 'undefined' ? global : self;
|
|
52
|
+
};
|
|
53
|
+
export var padStart = function (str, maxLength, fillString) {
|
|
54
|
+
if (str === void 0) {
|
|
55
|
+
str = '';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (fillString === void 0) {
|
|
59
|
+
fillString = '';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (str.length >= maxLength) return str;
|
|
63
|
+
var len = maxLength - str.length;
|
|
64
|
+
var repeatCount = Math.floor(len / fillString.length);
|
|
65
|
+
return fillString.repeat(repeatCount) + fillString.slice(0, len % fillString.length) + str;
|
|
66
|
+
};
|