shujie-ui 0.0.1 → 0.0.2
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 +87 -18
- package/dist/shujie-ui.css +1 -1
- package/dist/shujie-ui.es.js +3 -3
- package/dist/shujie-ui.umd.js +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,49 +1,118 @@
|
|
|
1
|
-
#
|
|
1
|
+
# shujie-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
一个基于 Vue 3 + TypeScript 的 UniApp 组件库,兼容小程序、H5、App。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 特性
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Vue 3 + TypeScript + Composition API
|
|
8
|
+
- SCSS 设计系统(色彩/排版/间距/圆角/阴影)
|
|
9
|
+
- 全平台兼容(微信/支付宝/百度/字节/QQ 小程序 + H5 + App)
|
|
10
|
+
- 按需引入(easycom 自动注册)
|
|
11
|
+
- 单元测试覆盖
|
|
12
|
+
- VitePress 文档站
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
- SCSS design system
|
|
11
|
-
- Full platform compatibility
|
|
12
|
-
- Tree-shakable
|
|
13
|
-
- Comprehensive documentation
|
|
14
|
-
|
|
15
|
-
## Install
|
|
14
|
+
## 安装
|
|
16
15
|
|
|
17
16
|
```bash
|
|
18
|
-
npm install
|
|
17
|
+
npm install shujie-ui
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
##
|
|
20
|
+
## 快速上手
|
|
22
21
|
|
|
23
|
-
###
|
|
22
|
+
### 全局引入
|
|
24
23
|
|
|
25
24
|
```ts
|
|
25
|
+
// main.ts
|
|
26
26
|
import { createSSRApp } from 'vue'
|
|
27
|
-
import SjUI from '
|
|
27
|
+
import SjUI from 'shujie-ui'
|
|
28
|
+
import 'shujie-ui/dist/shujie-ui.css'
|
|
28
29
|
|
|
29
30
|
const app = createSSRApp(App)
|
|
30
31
|
app.use(SjUI)
|
|
31
32
|
```
|
|
32
33
|
|
|
33
|
-
###
|
|
34
|
+
### 按需引入(easycom)
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
在 `pages.json` 中配置:
|
|
36
37
|
|
|
37
38
|
```json
|
|
38
39
|
{
|
|
39
40
|
"easycom": {
|
|
40
41
|
"custom": {
|
|
41
|
-
"^sj-(.*)": "
|
|
42
|
+
"^sj-(.*)": "shujie-ui/src/components/sj-$1/sj-$1.vue"
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
```
|
|
46
47
|
|
|
48
|
+
配置后直接在模板中使用,无需手动 import:
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<template>
|
|
52
|
+
<sj-button type="primary">按钮</sj-button>
|
|
53
|
+
</template>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 手动引入
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<script setup>
|
|
60
|
+
import { SjButton } from 'shujie-ui'
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<sj-button type="primary">按钮</sj-button>
|
|
65
|
+
</template>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 组件列表
|
|
69
|
+
|
|
70
|
+
| 组件 | 说明 |
|
|
71
|
+
|------|------|
|
|
72
|
+
| sj-button | 按钮,支持多种类型/尺寸/形状/状态 |
|
|
73
|
+
| sj-icon | 图标,基于 iconfont 字体 |
|
|
74
|
+
| sj-cell | 单元格,列表项展示 |
|
|
75
|
+
| sj-loading | 加载指示器,支持 circular/spinner |
|
|
76
|
+
|
|
77
|
+
## 设计系统
|
|
78
|
+
|
|
79
|
+
### 主色
|
|
80
|
+
|
|
81
|
+
| 名称 | 色值 | 用途 |
|
|
82
|
+
|------|------|------|
|
|
83
|
+
| Primary | `#2979ff` | 品牌主色 |
|
|
84
|
+
| Success | `#19be6b` | 成功状态 |
|
|
85
|
+
| Warning | `#ff9900` | 警告提示 |
|
|
86
|
+
| Danger | `#fa3534` | 错误/危险 |
|
|
87
|
+
| Info | `#909399` | 次要信息 |
|
|
88
|
+
|
|
89
|
+
### 自定义主题
|
|
90
|
+
|
|
91
|
+
```scss
|
|
92
|
+
// 覆盖变量
|
|
93
|
+
$sj-primary: #1890ff;
|
|
94
|
+
|
|
95
|
+
// 然后引入样式
|
|
96
|
+
@import 'shujie-ui/src/styles/index.scss';
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 工具函数
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { addUnit, debounce, throttle, deepClone, isPhone, isEmail } from 'shujie-ui'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Hooks
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
import { useVisible, useLoading, useScroll } from 'shujie-ui'
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 链接
|
|
112
|
+
|
|
113
|
+
- [npm 包](https://www.npmjs.com/package/shujie-ui)
|
|
114
|
+
- [Gitee 仓库](https://gitee.com/jia-shujie666/shujie-ui)
|
|
115
|
+
|
|
47
116
|
## License
|
|
48
117
|
|
|
49
118
|
MIT
|
package/dist/shujie-ui.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.sj-button[data-v-d5bd5c39]{box-sizing:border-box;text-align:center;white-space:nowrap;appearance:none;cursor:pointer;border:none;outline:none;justify-content:center;align-items:center;margin:0;padding:0;font-weight:500;line-height:1;transition:all .3s cubic-bezier(.645,.045,.355,1);display:inline-flex}.sj-button--small[data-v-d5bd5c39]{height:56rpx;padding:0 24rpx;font-size:24rpx}.sj-button--medium[data-v-d5bd5c39]{height:72rpx;padding:0 32rpx;font-size:28rpx}.sj-button--large[data-v-d5bd5c39]{height:88rpx;padding:0 48rpx;font-size:32rpx}.sj-button--default[data-v-d5bd5c39]{color:#606266;border:1rpx solid #e4e7ed;background:#fff}.sj-button--primary[data-v-d5bd5c39]{color:#fff;background:#2979ff}.sj-button--success[data-v-d5bd5c39]{color:#fff;background:#19be6b}.sj-button--warning[data-v-d5bd5c39]{color:#fff;background:#f90}.sj-button--danger[data-v-d5bd5c39]{color:#fff;background:#fa3534}.sj-button--info[data-v-d5bd5c39]{color:#fff;background:#909399}.sj-button--square[data-v-d5bd5c39]{border-radius:8rpx}.sj-button--round[data-v-d5bd5c39]{border-radius:999rpx}.sj-button--circle[data-v-d5bd5c39]{border-radius:50%;padding:0}.sj-button--circle.sj-button--small[data-v-d5bd5c39]{width:56rpx}.sj-button--circle.sj-button--medium[data-v-d5bd5c39]{width:72rpx}.sj-button--circle.sj-button--large[data-v-d5bd5c39]{width:88rpx}.sj-button--plain[data-v-d5bd5c39]{background:0 0!important}.sj-button--plain.sj-button--primary[data-v-d5bd5c39]{color:#2979ff;border:1rpx solid #2979ff}.sj-button--plain.sj-button--success[data-v-d5bd5c39]{color:#19be6b;border:1rpx solid #19be6b}.sj-button--plain.sj-button--warning[data-v-d5bd5c39]{color:#f90;border:1rpx solid #f90}.sj-button--plain.sj-button--danger[data-v-d5bd5c39]{color:#fa3534;border:1rpx solid #fa3534}.sj-button--plain.sj-button--info[data-v-d5bd5c39]{color:#909399;border:1rpx solid #909399}.sj-button--hairline[data-v-d5bd5c39]{position:relative;border-width:0!important}.sj-button--hairline[data-v-d5bd5c39]:after{content:"";border-radius:inherit;border:1px solid inherit;pointer-events:none;transform-origin:0 0;position:absolute;inset:0;transform:scale(.5)}.sj-button--hairline.sj-button--default[data-v-d5bd5c39]:after{border-color:#e4e7ed}.sj-button--hairline.sj-button--primary[data-v-d5bd5c39]:after{border-color:#2979ff}.sj-button--hairline.sj-button--success[data-v-d5bd5c39]:after{border-color:#19be6b}.sj-button--hairline.sj-button--warning[data-v-d5bd5c39]:after{border-color:#f90}.sj-button--hairline.sj-button--danger[data-v-d5bd5c39]:after{border-color:#fa3534}.sj-button--hairline.sj-button--info[data-v-d5bd5c39]:after{border-color:#909399}.sj-button--disabled[data-v-d5bd5c39]{opacity:.5;cursor:not-allowed;pointer-events:none}.sj-button--loading[data-v-d5bd5c39]{cursor:default}.sj-button--block[data-v-d5bd5c39]{width:100%;display:flex}.sj-button--active[data-v-d5bd5c39]{opacity:.7}.sj-button__icon[data-v-d5bd5c39],.sj-button__loading[data-v-d5bd5c39]{margin-right:8rpx}.sj-button__loading-spinner[data-v-d5bd5c39]{width:32rpx;height:32rpx;border:4rpx solid currentColor;border-top-color:#0000;border-radius:50%;animation:.6s linear infinite sj-spin-d5bd5c39}.sj-button__text[data-v-d5bd5c39]{align-items:center;display:flex}@keyframes sj-spin-d5bd5c39{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.sj-cell[data-v-17f18255]{box-sizing:border-box;width:100%;padding:24rpx 32rpx;font-size:28rpx;background:#fff;align-items:center;line-height:1.5;display:flex;position:relative}.sj-cell[data-v-17f18255]:after{content:"";pointer-events:none;border-bottom:1rpx solid #e4e7ed;transform-origin:0 100%;position:absolute;bottom:0;left:0;right:0}.sj-cell--clickable[data-v-17f18255]{cursor:pointer}.sj-cell--clickable[data-v-17f18255]:active{background:#f2f3f5}.sj-cell--required[data-v-17f18255]:before{content:"*";left:16rpx;color:#fa3534;font-size:32rpx;position:absolute}.sj-cell--borderless[data-v-17f18255]:after{display:none}.sj-cell__left-icon[data-v-17f18255]{margin-right:16rpx;color:#909399}.sj-cell__title[data-v-17f18255]{flex:1;min-width:0}.sj-cell__title-text[data-v-17f18255]{color:#303133;font-size:28rpx}.sj-cell__label[data-v-17f18255]{margin-top:8rpx;color:#909399;font-size:24rpx;line-height:1.2;display:block}.sj-cell__value[data-v-17f18255]{text-align:right;flex:1;min-width:0;overflow:hidden}.sj-cell__value-text[data-v-17f18255]{color:#909399;font-size:28rpx;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.sj-cell__value--alone[data-v-17f18255]{color:#303133;text-align:left}.sj-cell__right-icon[data-v-17f18255]{margin-left:8rpx;color:#c0c4cc;font-size:28rpx}.sj-loading[data-v-
|
|
1
|
+
.sj-button[data-v-d5bd5c39]{box-sizing:border-box;text-align:center;white-space:nowrap;appearance:none;cursor:pointer;border:none;outline:none;justify-content:center;align-items:center;margin:0;padding:0;font-weight:500;line-height:1;transition:all .3s cubic-bezier(.645,.045,.355,1);display:inline-flex}.sj-button--small[data-v-d5bd5c39]{height:56rpx;padding:0 24rpx;font-size:24rpx}.sj-button--medium[data-v-d5bd5c39]{height:72rpx;padding:0 32rpx;font-size:28rpx}.sj-button--large[data-v-d5bd5c39]{height:88rpx;padding:0 48rpx;font-size:32rpx}.sj-button--default[data-v-d5bd5c39]{color:#606266;border:1rpx solid #e4e7ed;background:#fff}.sj-button--primary[data-v-d5bd5c39]{color:#fff;background:#2979ff}.sj-button--success[data-v-d5bd5c39]{color:#fff;background:#19be6b}.sj-button--warning[data-v-d5bd5c39]{color:#fff;background:#f90}.sj-button--danger[data-v-d5bd5c39]{color:#fff;background:#fa3534}.sj-button--info[data-v-d5bd5c39]{color:#fff;background:#909399}.sj-button--square[data-v-d5bd5c39]{border-radius:8rpx}.sj-button--round[data-v-d5bd5c39]{border-radius:999rpx}.sj-button--circle[data-v-d5bd5c39]{border-radius:50%;padding:0}.sj-button--circle.sj-button--small[data-v-d5bd5c39]{width:56rpx}.sj-button--circle.sj-button--medium[data-v-d5bd5c39]{width:72rpx}.sj-button--circle.sj-button--large[data-v-d5bd5c39]{width:88rpx}.sj-button--plain[data-v-d5bd5c39]{background:0 0!important}.sj-button--plain.sj-button--primary[data-v-d5bd5c39]{color:#2979ff;border:1rpx solid #2979ff}.sj-button--plain.sj-button--success[data-v-d5bd5c39]{color:#19be6b;border:1rpx solid #19be6b}.sj-button--plain.sj-button--warning[data-v-d5bd5c39]{color:#f90;border:1rpx solid #f90}.sj-button--plain.sj-button--danger[data-v-d5bd5c39]{color:#fa3534;border:1rpx solid #fa3534}.sj-button--plain.sj-button--info[data-v-d5bd5c39]{color:#909399;border:1rpx solid #909399}.sj-button--hairline[data-v-d5bd5c39]{position:relative;border-width:0!important}.sj-button--hairline[data-v-d5bd5c39]:after{content:"";border-radius:inherit;border:1px solid inherit;pointer-events:none;transform-origin:0 0;position:absolute;inset:0;transform:scale(.5)}.sj-button--hairline.sj-button--default[data-v-d5bd5c39]:after{border-color:#e4e7ed}.sj-button--hairline.sj-button--primary[data-v-d5bd5c39]:after{border-color:#2979ff}.sj-button--hairline.sj-button--success[data-v-d5bd5c39]:after{border-color:#19be6b}.sj-button--hairline.sj-button--warning[data-v-d5bd5c39]:after{border-color:#f90}.sj-button--hairline.sj-button--danger[data-v-d5bd5c39]:after{border-color:#fa3534}.sj-button--hairline.sj-button--info[data-v-d5bd5c39]:after{border-color:#909399}.sj-button--disabled[data-v-d5bd5c39]{opacity:.5;cursor:not-allowed;pointer-events:none}.sj-button--loading[data-v-d5bd5c39]{cursor:default}.sj-button--block[data-v-d5bd5c39]{width:100%;display:flex}.sj-button--active[data-v-d5bd5c39]{opacity:.7}.sj-button__icon[data-v-d5bd5c39],.sj-button__loading[data-v-d5bd5c39]{margin-right:8rpx}.sj-button__loading-spinner[data-v-d5bd5c39]{width:32rpx;height:32rpx;border:4rpx solid currentColor;border-top-color:#0000;border-radius:50%;animation:.6s linear infinite sj-spin-d5bd5c39}.sj-button__text[data-v-d5bd5c39]{align-items:center;display:flex}@keyframes sj-spin-d5bd5c39{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.sj-cell[data-v-17f18255]{box-sizing:border-box;width:100%;padding:24rpx 32rpx;font-size:28rpx;background:#fff;align-items:center;line-height:1.5;display:flex;position:relative}.sj-cell[data-v-17f18255]:after{content:"";pointer-events:none;border-bottom:1rpx solid #e4e7ed;transform-origin:0 100%;position:absolute;bottom:0;left:0;right:0}.sj-cell--clickable[data-v-17f18255]{cursor:pointer}.sj-cell--clickable[data-v-17f18255]:active{background:#f2f3f5}.sj-cell--required[data-v-17f18255]:before{content:"*";left:16rpx;color:#fa3534;font-size:32rpx;position:absolute}.sj-cell--borderless[data-v-17f18255]:after{display:none}.sj-cell__left-icon[data-v-17f18255]{margin-right:16rpx;color:#909399}.sj-cell__title[data-v-17f18255]{flex:1;min-width:0}.sj-cell__title-text[data-v-17f18255]{color:#303133;font-size:28rpx}.sj-cell__label[data-v-17f18255]{margin-top:8rpx;color:#909399;font-size:24rpx;line-height:1.2;display:block}.sj-cell__value[data-v-17f18255]{text-align:right;flex:1;min-width:0;overflow:hidden}.sj-cell__value-text[data-v-17f18255]{color:#909399;font-size:28rpx;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.sj-cell__value--alone[data-v-17f18255]{color:#303133;text-align:left}.sj-cell__right-icon[data-v-17f18255]{margin-left:8rpx;color:#c0c4cc;font-size:28rpx}.sj-loading[data-v-48c28ad3]{align-items:center;gap:16rpx;color:#909399;display:inline-flex}.sj-loading--vertical[data-v-48c28ad3]{gap:8rpx;flex-direction:column}.sj-loading__spinner[data-v-48c28ad3]{box-sizing:border-box;animation:.8s linear infinite sj-loading-rotate-48c28ad3;position:relative}.sj-loading__circular[data-v-48c28ad3]{width:100%;height:100%}.sj-loading__circular-ring[data-v-48c28ad3]{border:4rpx solid currentColor;box-sizing:border-box;border-top-color:#0000;border-radius:50%;width:100%;height:100%}.sj-loading__spinner-dot[data-v-48c28ad3]{opacity:0;background:currentColor;border-radius:50%;width:20%;height:20%;margin-left:-10%;position:absolute;top:0;left:50%}.sj-loading__spinner-dot[data-v-48c28ad3]:first-child{opacity:0;transform:rotate(0)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(2){opacity:.0833333;transform:rotate(30deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(3){opacity:.166667;transform:rotate(60deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(4){opacity:.25;transform:rotate(90deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(5){opacity:.333333;transform:rotate(120deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(6){opacity:.416667;transform:rotate(150deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(7){opacity:.5;transform:rotate(180deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(8){opacity:.583333;transform:rotate(210deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(9){opacity:.666667;transform:rotate(240deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(10){opacity:.75;transform:rotate(270deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(11){opacity:.833333;transform:rotate(300deg)}.sj-loading__spinner-dot[data-v-48c28ad3]:nth-child(12){opacity:.916667;transform:rotate(330deg)}.sj-loading__spinner--spinner[data-v-48c28ad3]{animation:none}.sj-loading__text[data-v-48c28ad3]{color:#909399;font-size:28rpx;line-height:1.5}@keyframes sj-loading-rotate-48c28ad3{0%{transform:rotate(0)}to{transform:rotate(360deg)}}view,text,scroll-view,swiper,input,textarea,button,image{box-sizing:border-box}button{line-height:inherit;font-size:inherit;background:0 0;border:none;outline:none;margin:0;padding:0}button:after{display:none}input,textarea{box-sizing:border-box}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/shujie-ui.es.js
CHANGED
|
@@ -285,15 +285,15 @@ var L = {
|
|
|
285
285
|
color: n.color || void 0
|
|
286
286
|
})
|
|
287
287
|
}, [n.type === "circular" ? (u(), i("view", L, [...s[0] ||= [a("view", { class: "sj-loading__circular-ring" }, null, -1)]])) : (u(), i(e, { key: 1 }, f(12, (e) => a("view", {
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
key: e,
|
|
289
|
+
class: "sj-loading__spinner-dot"
|
|
290
290
|
})), 64))], 6), n.text || t.$slots.default ? (u(), i("text", {
|
|
291
291
|
key: 0,
|
|
292
292
|
class: "sj-loading__text",
|
|
293
293
|
style: l({ fontSize: n.textSize ? h(g)(n.textSize) : void 0 })
|
|
294
294
|
}, [p(t.$slots, "default", {}, () => [o(m(n.text), 1)], !0)], 4)) : r("", !0)], 6));
|
|
295
295
|
}
|
|
296
|
-
}), [["__scopeId", "data-v-
|
|
296
|
+
}), [["__scopeId", "data-v-48c28ad3"]]);
|
|
297
297
|
//#endregion
|
|
298
298
|
//#region src/components/sj-loading/index.ts
|
|
299
299
|
R.install = (e) => {
|
package/dist/shujie-ui.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SjUI={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n(e,t=`rpx`){return e==null?``:typeof e==`string`?/^\d+(\.\d+)?$/.test(e)?`${e}${t}`:e:`${e}${t}`}function r(e){return Number(e.replace(/rpx|px|rem|em|vw|vh/g,``))}function i(e,t,n){return Math.min(Math.max(e,t),n)}function a(e,t=2){return String(e).padStart(t,`0`)}function o(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(e=>o(e));let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}var s=0;function c(e=`sj`){return`${e}-${++s}-${Math.random().toString(36).slice(2,8)}`}function l(e,t=300){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r),n=null},t)}}function u(e,t=300){let n=0;return function(...r){let i=Date.now();i-n>=t&&(e.apply(this,r),n=i)}}function d(e,t){return new Promise(n=>{uni.createSelectorQuery().in(t).select(e).boundingClientRect(e=>{n(e)}).exec()})}var f=(0,t.defineComponent)({__name:`sj-icon`,props:{name:{default:``},color:{default:``},size:{default:`inherit`},prefix:{default:`sj-icon`},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>n(i.size)),s=e=>{a(`click`,e)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{class:(0,t.normalizeClass)([e.prefix,e.name?`${e.prefix}-${e.name}`:``,e.customClass]),style:(0,t.normalizeStyle)([{fontSize:o.value,color:e.color||void 0},e.customStyle]),onClick:s},null,6))}}),p=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},m=p(f,[[`__scopeId`,`data-v-7cac47d7`]]),h=[`disabled`,`form-type`,`hover-class`],g={key:0,class:`sj-button__loading`},_={class:`sj-button__text`},v=p((0,t.defineComponent)({__name:`sj-button`,props:{type:{default:`default`},size:{default:`medium`},shape:{default:`square`},plain:{type:Boolean,default:!1},hairline:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{default:``},loadingSize:{default:`40rpx`},icon:{default:``},iconPrefix:{default:`sj-icon`},block:{type:Boolean,default:!1},nativeType:{default:`button`},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:n}){let r=e,i=n,a=e=>{r.disabled||r.loading||i(`click`,e)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{class:(0,t.normalizeClass)([`sj-button`,`sj-button--${e.type}`,`sj-button--${e.size}`,`sj-button--${e.shape}`,{"sj-button--plain":e.plain,"sj-button--hairline":e.hairline,"sj-button--disabled":e.disabled,"sj-button--loading":e.loading,"sj-button--block":e.block},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle),disabled:e.disabled||e.loading,"form-type":e.nativeType===`submit`||e.nativeType===`reset`?e.nativeType:void 0,"hover-class":e.disabled||e.loading?``:`sj-button--active`,"hover-start-time":`20`,"hover-stay-time":`70`,onClick:a},[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,g,[...r[0]||=[(0,t.createElementVNode)(`view`,{class:`sj-button__loading-spinner`},null,-1)]])):(0,t.createCommentVNode)(``,!0),e.icon&&!e.loading?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,name:e.icon,prefix:e.iconPrefix,class:`sj-button__icon`},null,8,[`name`,`prefix`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,_,[e.loading&&e.loadingText?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)(e.loadingText),1)],64)):(0,t.renderSlot)(n.$slots,`default`,{key:1},void 0,!0)])],14,h))}}),[[`__scopeId`,`data-v-d5bd5c39`]]);v.install=e=>{e.component(`SjButton`,v)},m.install=e=>{e.component(`SjIcon`,m)};var y={class:`sj-cell__title-text`},b={key:0,class:`sj-cell__label`},x={class:`sj-cell__value-text`},S=p((0,t.defineComponent)({__name:`sj-cell`,props:{title:{default:``},value:{default:``},label:{default:``},isLink:{type:Boolean,default:!1},arrowDirection:{default:`right`},required:{type:Boolean,default:!1},clickable:{type:Boolean,default:!1},icon:{default:``},iconSize:{default:``},titleWidth:{default:``},titleAlign:{default:`left`},border:{type:Boolean,default:!0},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:r}){let i=r,a=e=>{i(`click`,e)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{class:(0,t.normalizeClass)([`sj-cell`,{"sj-cell--clickable":e.clickable||e.isLink,"sj-cell--required":e.required,"sj-cell--borderless":!e.border},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle),onClick:a},[e.icon?((0,t.openBlock)(),(0,t.createBlock)(m,{key:0,name:e.icon,size:e.iconSize||`40rpx`,class:`sj-cell__left-icon`},null,8,[`name`,`size`])):(0,t.renderSlot)(r.$slots,`icon`,{key:1},void 0,!0),e.title||r.$slots.title||r.$slots.label||e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{key:2,class:`sj-cell__title`,style:(0,t.normalizeStyle)({textAlign:e.titleAlign,flex:e.titleWidth?`0 0 ${(0,t.unref)(n)(e.titleWidth)}`:``})},[(0,t.renderSlot)(r.$slots,`title`,{},()=>[(0,t.createElementVNode)(`text`,y,(0,t.toDisplayString)(e.title),1)],!0),(0,t.renderSlot)(r.$slots,`label`,{},()=>[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,b,(0,t.toDisplayString)(e.label),1)):(0,t.createCommentVNode)(``,!0)],!0)],4)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`view`,{class:(0,t.normalizeClass)([`sj-cell__value`,{"sj-cell__value--alone":!e.title&&!r.$slots.title}])},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createElementVNode)(`text`,x,(0,t.toDisplayString)(e.value),1)],!0)],2),e.isLink?((0,t.openBlock)(),(0,t.createBlock)(m,{key:3,name:`arrow-${e.arrowDirection}`,class:`sj-cell__right-icon`},null,8,[`name`])):(0,t.renderSlot)(r.$slots,`right-icon`,{key:4},void 0,!0)],6))}}),[[`__scopeId`,`data-v-17f18255`]]);S.install=e=>{e.component(`SjCell`,S)};var C={key:0,class:`sj-loading__circular`},w=p((0,t.defineComponent)({__name:`sj-loading`,props:{type:{default:`circular`},color:{default:``},size:{default:`64rpx`},textSize:{default:``},text:{default:``},vertical:{type:Boolean,default:!1},customClass:{default:``},customStyle:{default:``}},setup(e){let r=e,i=(0,t.computed)(()=>n(r.size));return(r,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{class:(0,t.normalizeClass)([`sj-loading`,{"sj-loading--vertical":e.vertical},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle)},[(0,t.createElementVNode)(`view`,{class:(0,t.normalizeClass)([`sj-loading__spinner`,`sj-loading__spinner--${e.type}`]),style:(0,t.normalizeStyle)({width:i.value,height:i.value,color:e.color||void 0})},[e.type===`circular`?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,C,[...a[0]||=[(0,t.createElementVNode)(`view`,{class:`sj-loading__circular-ring`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(12,e=>(0,t.createElementVNode)(`view`,{class:`sj-loading__spinner-dot
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`)):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.SjUI={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});function n(e,t=`rpx`){return e==null?``:typeof e==`string`?/^\d+(\.\d+)?$/.test(e)?`${e}${t}`:e:`${e}${t}`}function r(e){return Number(e.replace(/rpx|px|rem|em|vw|vh/g,``))}function i(e,t,n){return Math.min(Math.max(e,t),n)}function a(e,t=2){return String(e).padStart(t,`0`)}function o(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(e=>o(e));let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}var s=0;function c(e=`sj`){return`${e}-${++s}-${Math.random().toString(36).slice(2,8)}`}function l(e,t=300){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r),n=null},t)}}function u(e,t=300){let n=0;return function(...r){let i=Date.now();i-n>=t&&(e.apply(this,r),n=i)}}function d(e,t){return new Promise(n=>{uni.createSelectorQuery().in(t).select(e).boundingClientRect(e=>{n(e)}).exec()})}var f=(0,t.defineComponent)({__name:`sj-icon`,props:{name:{default:``},color:{default:``},size:{default:`inherit`},prefix:{default:`sj-icon`},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:r}){let i=e,a=r,o=(0,t.computed)(()=>n(i.size)),s=e=>{a(`click`,e)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{class:(0,t.normalizeClass)([e.prefix,e.name?`${e.prefix}-${e.name}`:``,e.customClass]),style:(0,t.normalizeStyle)([{fontSize:o.value,color:e.color||void 0},e.customStyle]),onClick:s},null,6))}}),p=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},m=p(f,[[`__scopeId`,`data-v-7cac47d7`]]),h=[`disabled`,`form-type`,`hover-class`],g={key:0,class:`sj-button__loading`},_={class:`sj-button__text`},v=p((0,t.defineComponent)({__name:`sj-button`,props:{type:{default:`default`},size:{default:`medium`},shape:{default:`square`},plain:{type:Boolean,default:!1},hairline:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{default:``},loadingSize:{default:`40rpx`},icon:{default:``},iconPrefix:{default:`sj-icon`},block:{type:Boolean,default:!1},nativeType:{default:`button`},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:n}){let r=e,i=n,a=e=>{r.disabled||r.loading||i(`click`,e)};return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{class:(0,t.normalizeClass)([`sj-button`,`sj-button--${e.type}`,`sj-button--${e.size}`,`sj-button--${e.shape}`,{"sj-button--plain":e.plain,"sj-button--hairline":e.hairline,"sj-button--disabled":e.disabled,"sj-button--loading":e.loading,"sj-button--block":e.block},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle),disabled:e.disabled||e.loading,"form-type":e.nativeType===`submit`||e.nativeType===`reset`?e.nativeType:void 0,"hover-class":e.disabled||e.loading?``:`sj-button--active`,"hover-start-time":`20`,"hover-stay-time":`70`,onClick:a},[e.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,g,[...r[0]||=[(0,t.createElementVNode)(`view`,{class:`sj-button__loading-spinner`},null,-1)]])):(0,t.createCommentVNode)(``,!0),e.icon&&!e.loading?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,name:e.icon,prefix:e.iconPrefix,class:`sj-button__icon`},null,8,[`name`,`prefix`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`text`,_,[e.loading&&e.loadingText?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createTextVNode)((0,t.toDisplayString)(e.loadingText),1)],64)):(0,t.renderSlot)(n.$slots,`default`,{key:1},void 0,!0)])],14,h))}}),[[`__scopeId`,`data-v-d5bd5c39`]]);v.install=e=>{e.component(`SjButton`,v)},m.install=e=>{e.component(`SjIcon`,m)};var y={class:`sj-cell__title-text`},b={key:0,class:`sj-cell__label`},x={class:`sj-cell__value-text`},S=p((0,t.defineComponent)({__name:`sj-cell`,props:{title:{default:``},value:{default:``},label:{default:``},isLink:{type:Boolean,default:!1},arrowDirection:{default:`right`},required:{type:Boolean,default:!1},clickable:{type:Boolean,default:!1},icon:{default:``},iconSize:{default:``},titleWidth:{default:``},titleAlign:{default:`left`},border:{type:Boolean,default:!0},customClass:{default:``},customStyle:{default:``}},emits:[`click`],setup(e,{emit:r}){let i=r,a=e=>{i(`click`,e)};return(r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{class:(0,t.normalizeClass)([`sj-cell`,{"sj-cell--clickable":e.clickable||e.isLink,"sj-cell--required":e.required,"sj-cell--borderless":!e.border},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle),onClick:a},[e.icon?((0,t.openBlock)(),(0,t.createBlock)(m,{key:0,name:e.icon,size:e.iconSize||`40rpx`,class:`sj-cell__left-icon`},null,8,[`name`,`size`])):(0,t.renderSlot)(r.$slots,`icon`,{key:1},void 0,!0),e.title||r.$slots.title||r.$slots.label||e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{key:2,class:`sj-cell__title`,style:(0,t.normalizeStyle)({textAlign:e.titleAlign,flex:e.titleWidth?`0 0 ${(0,t.unref)(n)(e.titleWidth)}`:``})},[(0,t.renderSlot)(r.$slots,`title`,{},()=>[(0,t.createElementVNode)(`text`,y,(0,t.toDisplayString)(e.title),1)],!0),(0,t.renderSlot)(r.$slots,`label`,{},()=>[e.label?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,b,(0,t.toDisplayString)(e.label),1)):(0,t.createCommentVNode)(``,!0)],!0)],4)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`view`,{class:(0,t.normalizeClass)([`sj-cell__value`,{"sj-cell__value--alone":!e.title&&!r.$slots.title}])},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createElementVNode)(`text`,x,(0,t.toDisplayString)(e.value),1)],!0)],2),e.isLink?((0,t.openBlock)(),(0,t.createBlock)(m,{key:3,name:`arrow-${e.arrowDirection}`,class:`sj-cell__right-icon`},null,8,[`name`])):(0,t.renderSlot)(r.$slots,`right-icon`,{key:4},void 0,!0)],6))}}),[[`__scopeId`,`data-v-17f18255`]]);S.install=e=>{e.component(`SjCell`,S)};var C={key:0,class:`sj-loading__circular`},w=p((0,t.defineComponent)({__name:`sj-loading`,props:{type:{default:`circular`},color:{default:``},size:{default:`64rpx`},textSize:{default:``},text:{default:``},vertical:{type:Boolean,default:!1},customClass:{default:``},customStyle:{default:``}},setup(e){let r=e,i=(0,t.computed)(()=>n(r.size));return(r,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`view`,{class:(0,t.normalizeClass)([`sj-loading`,{"sj-loading--vertical":e.vertical},e.customClass]),style:(0,t.normalizeStyle)(e.customStyle)},[(0,t.createElementVNode)(`view`,{class:(0,t.normalizeClass)([`sj-loading__spinner`,`sj-loading__spinner--${e.type}`]),style:(0,t.normalizeStyle)({width:i.value,height:i.value,color:e.color||void 0})},[e.type===`circular`?((0,t.openBlock)(),(0,t.createElementBlock)(`view`,C,[...a[0]||=[(0,t.createElementVNode)(`view`,{class:`sj-loading__circular-ring`},null,-1)]])):((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(12,e=>(0,t.createElementVNode)(`view`,{key:e,class:`sj-loading__spinner-dot`})),64))],6),e.text||r.$slots.default?((0,t.openBlock)(),(0,t.createElementBlock)(`text`,{key:0,class:`sj-loading__text`,style:(0,t.normalizeStyle)({fontSize:e.textSize?(0,t.unref)(n)(e.textSize):void 0})},[(0,t.renderSlot)(r.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e.text),1)],!0)],4)):(0,t.createCommentVNode)(``,!0)],6))}}),[[`__scopeId`,`data-v-48c28ad3`]]);w.install=e=>{e.component(`SjLoading`,w)};function T(){return typeof uni<`u`?uni.getSystemInfoSync().uniPlatform||`unknown`:typeof window<`u`?`h5`:`unknown`}function E(){return T()===`h5`}function D(){return T().startsWith(`mp-`)}function O(){return T()===`mp-weixin`}function k(){return T()===`mp-alipay`}function A(){return T()===`app-plus`}function j(){try{return uni.getSystemInfoSync()}catch{return{screenWidth:375,screenHeight:667,windowWidth:375,windowHeight:667,pixelRatio:2,platform:`unknown`}}}function M(e){return e==null?!0:typeof e==`string`?e.trim()===``:Array.isArray(e)?e.length===0:typeof e==`object`?Object.keys(e).length===0:!1}function N(e){return typeof e==`number`&&!isNaN(e)}function P(e){return/^1[3-9]\d{9}$/.test(e)}function F(e){return/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e)}function I(e){return/^https?:\/\/.+/.test(e)}function L(e){return/^\d{15}|\d{18}|\d{17}[Xx]$/.test(e)}function R(e=!1){let n=(0,t.ref)(e);return{visible:n,show:()=>{n.value=!0},hide:()=>{n.value=!1},toggle:()=>{n.value=!n.value}}}function z(e=!1){let n=(0,t.ref)(e),r=()=>{n.value=!0},i=()=>{n.value=!1};return{loading:n,startLoading:r,stopLoading:i,withLoading:async e=>{try{return r(),await e()}finally{i()}}}}function B(e=50){let n=(0,t.ref)({scrollTop:0,scrollLeft:0,isScrollTop:!0,isScrollBottom:!1,direction:`none`}),r=0;return{scrollState:n,onScroll:u(t=>{let{scrollTop:i,scrollLeft:a}=t.detail,o=i>r?`down`:i<r?`up`:`none`;r=i,n.value={scrollTop:i,scrollLeft:a,isScrollTop:i<=e,isScrollBottom:!1,direction:o}},100)}}var V={SjButton:v,SjIcon:m,SjCell:S,SjLoading:w};e.SjButton=v,e.SjCell=S,e.SjIcon=m,e.SjLoading=w,e.addUnit=n,e.clamp=i,e.debounce=l,e.deepClone=o,e.default={install:e=>{Object.entries(V).forEach(([t,n])=>{e.component(t,n)})}},e.getPlatform=T,e.getRect=d,e.getSystemInfo=j,e.isAlipay=k,e.isApp=A,e.isEmail=F,e.isEmpty=M,e.isH5=E,e.isIdCard=L,e.isMP=D,e.isNumber=N,e.isPhone=P,e.isUrl=I,e.isWeixin=O,e.padZero=a,e.removeUnit=r,e.throttle=u,e.uniqueId=c,e.useLoading=z,e.useScroll=B,e.useVisible=R});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shujie-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A UniApp component library for Vue 3, compatible with Mini Programs, H5, and App",
|
|
6
6
|
"keywords": [
|
|
@@ -38,16 +38,17 @@
|
|
|
38
38
|
"docs:dev": "vitepress dev docs",
|
|
39
39
|
"docs:build": "vitepress build docs",
|
|
40
40
|
"docs:preview": "vitepress preview docs",
|
|
41
|
-
"lint": "eslint .
|
|
42
|
-
"lint:fix": "eslint . --
|
|
41
|
+
"lint": "eslint .",
|
|
42
|
+
"lint:fix": "eslint . --fix",
|
|
43
43
|
"format": "prettier --write \"src/**/*.{js,ts,vue,scss,json}\"",
|
|
44
44
|
"prepare": "husky",
|
|
45
45
|
"prepublishOnly": "npm run build && npm run build:types",
|
|
46
|
-
"release": "
|
|
46
|
+
"release": "node scripts/release.js"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@commitlint/cli": "^20.5.0",
|
|
50
50
|
"@commitlint/config-conventional": "^20.5.0",
|
|
51
|
+
"@eslint/js": "^10.0.1",
|
|
51
52
|
"@types/node": "^25.6.0",
|
|
52
53
|
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
53
54
|
"@typescript-eslint/parser": "^8.58.1",
|
|
@@ -84,9 +85,9 @@
|
|
|
84
85
|
},
|
|
85
86
|
"repository": {
|
|
86
87
|
"type": "git",
|
|
87
|
-
"url": ""
|
|
88
|
+
"url": "https://gitee.com/jia-shujie666/shujie-ui.git"
|
|
88
89
|
},
|
|
89
|
-
"homepage": "",
|
|
90
|
+
"homepage": "https://gitee.com/jia-shujie666/shujie-ui",
|
|
90
91
|
"directories": {
|
|
91
92
|
"doc": "docs",
|
|
92
93
|
"example": "examples"
|