jobsys-explore 4.6.21 → 4.7.0
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/.eslintignore +3 -3
- package/CHANGELOG.md +542 -542
- package/README.md +41 -41
- package/TODOs.md +8 -8
- package/business-components/survey/ExSurvey.jsx +193 -193
- package/business-components/survey/index.js +5 -5
- package/business-components/survey/index.less +36 -36
- package/components/button/ExButton.jsx +120 -120
- package/components/button/index.js +4 -4
- package/components/button/index.less +7 -7
- package/components/decorator/ExDecorator.jsx +31 -31
- package/components/decorator/index.js +5 -5
- package/components/decorator/index.less +76 -76
- package/components/form/ExAddress.jsx +195 -195
- package/components/form/ExCascader.jsx +171 -171
- package/components/form/ExCheckbox.jsx +59 -59
- package/components/form/ExDate.jsx +143 -143
- package/components/form/ExDatetime.jsx +166 -166
- package/components/form/ExField.jsx +138 -138
- package/components/form/ExFieldUploader.jsx +50 -50
- package/components/form/ExForm.jsx +544 -544
- package/components/form/ExMatrixCheckbox.jsx +99 -99
- package/components/form/ExMatrixRadio.jsx +86 -86
- package/components/form/ExMatrixScale.jsx +97 -97
- package/components/form/ExNumber.jsx +51 -51
- package/components/form/ExRadio.jsx +58 -58
- package/components/form/ExRate.jsx +51 -51
- package/components/form/ExSelect.jsx +251 -251
- package/components/form/ExSlider.jsx +55 -55
- package/components/form/ExSwitch.jsx +51 -51
- package/components/form/ExTime.jsx +99 -99
- package/components/form/FormItem.jsx +307 -307
- package/components/form/PickerWrapper.jsx +120 -120
- package/components/form/index.js +46 -46
- package/components/form/index.less +178 -178
- package/components/form/utils.js +62 -62
- package/components/grid/ExGrid.jsx +53 -53
- package/components/grid/index.js +4 -4
- package/components/grid/index.less +2 -2
- package/components/index.js +12 -12
- package/components/pagination/ExPagination.jsx +457 -440
- package/components/pagination/index.js +5 -5
- package/components/pagination/index.less +3 -3
- package/components/provider/ExProvider.jsx +173 -173
- package/components/qrcode/ExQrcode.jsx +86 -86
- package/components/qrcode/index.js +5 -5
- package/components/qrcode/index.less +8 -8
- package/components/result/ExResult.jsx +122 -122
- package/components/result/index.js +5 -5
- package/components/result/index.less +59 -59
- package/components/search/ExSearch.jsx +370 -326
- package/components/search/components/Expand.jsx +77 -77
- package/components/search/components/Field.jsx +27 -27
- package/components/search/components/Quick.jsx +57 -57
- package/components/search/components/index.js +5 -5
- package/components/search/index.js +5 -5
- package/components/search/index.less +118 -118
- package/components/search/utils.js +30 -30
- package/components/sector/ExSector.jsx +52 -52
- package/components/sector/README.md +26 -26
- package/components/sector/index.js +5 -5
- package/components/sector/index.less +122 -122
- package/components/theme/ExTheme.jsx +10 -10
- package/components/theme/index.js +4 -4
- package/components/theme/index.less +98 -98
- package/components/uploader/ExUploader.jsx +293 -293
- package/components/uploader/index.js +5 -5
- package/components/utils.js +187 -187
- package/directives/auth.js +113 -113
- package/directives/index.js +4 -4
- package/dist/cipher-98df1050.cjs.map +1 -1
- package/dist/cipher-f2ed5ee6.js.map +1 -1
- package/dist/directives.cjs.map +1 -1
- package/dist/directives.js.map +1 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/jobsys-explore.cjs +6 -6
- package/dist/jobsys-explore.cjs.map +1 -1
- package/dist/jobsys-explore.js +464 -407
- package/dist/jobsys-explore.js.map +1 -1
- package/docgen.config.js +15 -15
- package/docs/.vuepress/.cache/deps/_metadata.json +52 -52
- package/docs/.vuepress/.cache/deps/lodash-es.js +8442 -8442
- package/docs/.vuepress/.cache/deps/lodash-es.js.map +7 -7
- package/docs/.vuepress/.temp/internal/clientConfigs.js +17 -17
- package/docs/.vuepress/.temp/internal/pagesComponents.js +24 -24
- package/docs/.vuepress/.temp/internal/pagesData.js +22 -22
- package/docs/.vuepress/.temp/internal/pagesRoutes.js +12 -12
- package/docs/.vuepress/.temp/internal/themeData.js +1 -1
- package/docs/.vuepress/.temp/pages/components/decorator/ExDecorator.html.js +1 -1
- package/docs/.vuepress/.temp/pages/components/decorator/ExDecorator.html.vue +37 -37
- package/docs/.vuepress/.temp/pages/components/sector/ExSector.html.js +1 -1
- package/docs/.vuepress/.temp/pages/components/sector/ExSector.html.vue +71 -71
- package/docs/.vuepress/.temp/styles/index.scss +1 -1
- package/docs/.vuepress/config.js +61 -61
- package/docs/.vuepress/dist/404.html +33 -33
- package/docs/.vuepress/dist/assets/404.html-a0ce2184.js +1 -1
- package/docs/.vuepress/dist/assets/ExButton.html-ad283101.js +1 -1
- package/docs/.vuepress/dist/assets/ExDecorator.html-42d09114.js +1 -1
- package/docs/.vuepress/dist/assets/ExDecorator.html-c82c5fe8.js +1 -1
- package/docs/.vuepress/dist/assets/ExForm.html-9e3f8000.js +1 -1
- package/docs/.vuepress/dist/assets/ExProvider.html-78fdc6cd.js +1 -1
- package/docs/.vuepress/dist/assets/ExSearch.html-103f6f34.js +1 -1
- package/docs/.vuepress/dist/assets/ExSector.html-a1e24c3a.js +7 -7
- package/docs/.vuepress/dist/assets/ExSector.html-cff3fefd.js +1 -1
- package/docs/.vuepress/dist/assets/ExUploader.html-8310e424.js +1 -1
- package/docs/.vuepress/dist/assets/app-29fe8d1e.js +10 -10
- package/docs/.vuepress/dist/assets/hooks.html-90ccbc1a.js +1 -1
- package/docs/.vuepress/dist/assets/index.html-85b79c97.js +43 -43
- package/docs/.vuepress/dist/assets/style-46d7e227.css +1 -1
- package/docs/.vuepress/dist/components/button/ExButton.html +33 -33
- package/docs/.vuepress/dist/components/decorator/ExDecorator.html +33 -33
- package/docs/.vuepress/dist/components/form/ExForm.html +33 -33
- package/docs/.vuepress/dist/components/provider/ExProvider.html +33 -33
- package/docs/.vuepress/dist/components/search/ExSearch.html +33 -33
- package/docs/.vuepress/dist/components/sector/ExSector.html +39 -39
- package/docs/.vuepress/dist/components/uploader/ExUploader.html +33 -33
- package/docs/.vuepress/dist/hooks.html +33 -33
- package/docs/.vuepress/dist/index.html +75 -75
- package/docs/.vuepress/styles/index.scss +7 -7
- package/docs/components/decorator/ExDecorator.md +14 -14
- package/docs/components/sector/ExSector.md +43 -43
- package/docs/index.md +82 -82
- package/hooks/cipher.js +44 -44
- package/hooks/datetime.js +69 -69
- package/hooks/form.js +188 -188
- package/hooks/utils.js +282 -282
- package/index.html +17 -17
- package/package.json +1 -1
- package/playground/App.vue +191 -191
- package/playground/TestButton.vue +61 -61
- package/playground/TestCascader.vue +2442 -2442
- package/playground/TestDecorator.vue +14 -14
- package/playground/TestForm.vue +429 -429
- package/playground/TestFormItem.vue +110 -110
- package/playground/TestGrid.vue +22 -22
- package/playground/TestPagination.vue +1250 -1248
- package/playground/TestQrcode.vue +7 -7
- package/playground/TestResult.vue +12 -12
- package/playground/TestSearch.vue +115 -115
- package/playground/TestSector.vue +15 -15
- package/playground/TestSurvey.vue +27 -27
- package/playground/TestUploader.vue +14 -14
- package/playground/main.js +22 -22
- package/utils/style.js +13 -13
- package/vite.config.js +54 -54
- package/.changeset/blue-spiders-roll.md +0 -5
- package/.changeset/cyan-monkeys-draw.md +0 -5
- package/.changeset/dry-feet-float.md +0 -5
- package/.changeset/empty-mice-share.md +0 -5
- package/.changeset/famous-yaks-doubt.md +0 -5
- package/.changeset/five-fans-type.md +0 -5
- package/.changeset/funny-hats-drop.md +0 -5
- package/.changeset/khaki-cobras-bathe.md +0 -5
- package/.changeset/khaki-forks-shave.md +0 -5
- package/.changeset/lazy-yaks-crash.md +0 -5
- package/.changeset/light-cycles-flow.md +0 -5
- package/.changeset/loud-mirrors-explain.md +0 -5
- package/.changeset/lovely-balloons-protect.md +0 -5
- package/.changeset/mean-pens-travel.md +0 -5
- package/.changeset/moody-doors-grow.md +0 -5
- package/.changeset/moody-laws-change.md +0 -5
- package/.changeset/nasty-goats-joke.md +0 -5
- package/.changeset/odd-forks-drop.md +0 -5
- package/.changeset/olive-windows-suffer.md +0 -5
- package/.changeset/popular-carpets-jog.md +0 -5
- package/.changeset/popular-planets-play.md +0 -5
- package/.changeset/rare-gorillas-boil.md +0 -5
- package/.changeset/rare-moose-teach.md +0 -5
- package/.changeset/sharp-tools-hope.md +0 -5
- package/.changeset/slimy-sloths-refuse.md +0 -5
- package/.changeset/slow-boats-search.md +0 -5
- package/.changeset/small-experts-bake.md +0 -5
- package/.changeset/smooth-horses-tie.md +0 -5
- package/.changeset/tame-feet-reply.md +0 -5
- package/.changeset/tidy-items-reflect.md +0 -5
- package/.changeset/weak-chicken-admire.md +0 -5
- package/.changeset/weak-rockets-compare.md +0 -5
- package/.changeset/wild-glasses-bathe.md +0 -5
- package/.changeset/wise-ears-turn.md +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--content-width: 90%;
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
html {
|
|
7
|
-
}
|
|
1
|
+
:root {
|
|
2
|
+
--content-width: 90%;
|
|
3
|
+
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
html {
|
|
7
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
# ExDecorator
|
|
2
|
-
|
|
3
|
-
> 装饰组件
|
|
4
|
-
|
|
5
|
-
Version: 1.0.0
|
|
6
|
-
|
|
7
|
-
## Props
|
|
8
|
-
|
|
9
|
-
| Prop name | Description | Type | Values | Default |
|
|
10
|
-
| --------- | ----------- | -------------- | ---------------------------------- | ------- |
|
|
11
|
-
| color | 自定义颜色 | string | `green`, `blue`, `black`, `orange` | "green" |
|
|
12
|
-
| height | 高度 | number\|string | - | "auto" |
|
|
13
|
-
|
|
14
|
-
---
|
|
1
|
+
# ExDecorator
|
|
2
|
+
|
|
3
|
+
> 装饰组件
|
|
4
|
+
|
|
5
|
+
Version: 1.0.0
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop name | Description | Type | Values | Default |
|
|
10
|
+
| --------- | ----------- | -------------- | ---------------------------------- | ------- |
|
|
11
|
+
| color | 自定义颜色 | string | `green`, `blue`, `black`, `orange` | "green" |
|
|
12
|
+
| height | 高度 | number\|string | - | "auto" |
|
|
13
|
+
|
|
14
|
+
---
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
# ExSector
|
|
2
|
-
|
|
3
|
-
> 块状导航
|
|
4
|
-
|
|
5
|
-
Version: 1.0.0
|
|
6
|
-
|
|
7
|
-
## Props
|
|
8
|
-
|
|
9
|
-
| Prop name | Description | Type | Values | Default |
|
|
10
|
-
| --------- | ----------- | -------------- | -------------------------------- | ------- |
|
|
11
|
-
| color | 自定义颜色 | string | `green`, `blue`, `orange`, `red` | "green" |
|
|
12
|
-
| height | 高度 | number\|string | - | "100px" |
|
|
13
|
-
| title | 标题 | string | - | "" |
|
|
14
|
-
| subtitle | 副标题 | string | - | "" |
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## 示例
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
<script setup>
|
|
23
|
-
import { ref, h } from "vue";
|
|
24
|
-
import ExSector from "@components/sector/ExSector.jsx";
|
|
25
|
-
|
|
26
|
-
</script>
|
|
27
|
-
<div style="width:200px">
|
|
28
|
-
<ExSector title="普通的标题" subtitle="有描述" />
|
|
29
|
-
<ExSector title="有slot的写法" color="blue">
|
|
30
|
-
<template #subtitle>
|
|
31
|
-
<view style="color: red">红色</view>与蓝色
|
|
32
|
-
</template>
|
|
33
|
-
</ExSector>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
```vue
|
|
37
|
-
<ExSector title="普通的标题" subtitle="有描述" />
|
|
38
|
-
<ExSector title="有slot的写法" color="blue">
|
|
39
|
-
<template #subtitle>
|
|
40
|
-
<view style="color: red">红色</view>与蓝色
|
|
41
|
-
</template>
|
|
42
|
-
</ExSector>
|
|
43
|
-
```
|
|
1
|
+
# ExSector
|
|
2
|
+
|
|
3
|
+
> 块状导航
|
|
4
|
+
|
|
5
|
+
Version: 1.0.0
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Prop name | Description | Type | Values | Default |
|
|
10
|
+
| --------- | ----------- | -------------- | -------------------------------- | ------- |
|
|
11
|
+
| color | 自定义颜色 | string | `green`, `blue`, `orange`, `red` | "green" |
|
|
12
|
+
| height | 高度 | number\|string | - | "100px" |
|
|
13
|
+
| title | 标题 | string | - | "" |
|
|
14
|
+
| subtitle | 副标题 | string | - | "" |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 示例
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<script setup>
|
|
23
|
+
import { ref, h } from "vue";
|
|
24
|
+
import ExSector from "@components/sector/ExSector.jsx";
|
|
25
|
+
|
|
26
|
+
</script>
|
|
27
|
+
<div style="width:200px">
|
|
28
|
+
<ExSector title="普通的标题" subtitle="有描述" />
|
|
29
|
+
<ExSector title="有slot的写法" color="blue">
|
|
30
|
+
<template #subtitle>
|
|
31
|
+
<view style="color: red">红色</view>与蓝色
|
|
32
|
+
</template>
|
|
33
|
+
</ExSector>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
```vue
|
|
37
|
+
<ExSector title="普通的标题" subtitle="有描述" />
|
|
38
|
+
<ExSector title="有slot的写法" color="blue">
|
|
39
|
+
<template #subtitle>
|
|
40
|
+
<view style="color: red">红色</view>与蓝色
|
|
41
|
+
</template>
|
|
42
|
+
</ExSector>
|
|
43
|
+
```
|
package/docs/index.md
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
# Explore-UI
|
|
2
|
-
|
|
3
|
-
基于 Vant Vue3 的增强组件
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
使用 `npm`
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm i "jobsys-explore"
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
使用 `yarn`
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
yarn i "jobsys-explore"
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
使用 `pnpm`
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pnpm i "jobsys-explore"
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
> 由于 `explore-ui` 使用了 `rem` 作为单位以适应不同的屏幕尺寸,所以需要在 `Vite` 里进行适配
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
pnpm i -D "postcss-pxtorem"
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
//vite.config.js
|
|
33
|
-
|
|
34
|
-
import pixelToRem from "postcss-pxtorem"
|
|
35
|
-
|
|
36
|
-
export default defineConfig({
|
|
37
|
-
css: {
|
|
38
|
-
postcss: {
|
|
39
|
-
plugins: [
|
|
40
|
-
pixelToRem({
|
|
41
|
-
rootValue({file}) {
|
|
42
|
-
//在这里可以根据 file 路径进行判断与定制,默认的 rootValue 是 37.5
|
|
43
|
-
return 37.5
|
|
44
|
-
},
|
|
45
|
-
propList: ["*"],
|
|
46
|
-
}),
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
})
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## 示例
|
|
54
|
-
|
|
55
|
-
引入样式
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
//app.js
|
|
59
|
-
import "jobsys-explore/dist/style.css"
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
```js
|
|
63
|
-
//app.js
|
|
64
|
-
import { createApp } from "vue"
|
|
65
|
-
import Explore from "jobsys-explore"
|
|
66
|
-
|
|
67
|
-
const app = createApp({
|
|
68
|
-
setup: () => {}
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
app.use(Explore).mount("#app")
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```vue
|
|
75
|
-
<template>
|
|
76
|
-
<ExButton type="primary">点兵</ExButton>
|
|
77
|
-
</template>
|
|
78
|
-
<script setup>
|
|
79
|
-
import { ref } from "vue"
|
|
80
|
-
|
|
81
|
-
const password = ref("")
|
|
82
|
-
</script>
|
|
1
|
+
# Explore-UI
|
|
2
|
+
|
|
3
|
+
基于 Vant Vue3 的增强组件
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
使用 `npm`
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i "jobsys-explore"
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
使用 `yarn`
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
yarn i "jobsys-explore"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
使用 `pnpm`
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm i "jobsys-explore"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> 由于 `explore-ui` 使用了 `rem` 作为单位以适应不同的屏幕尺寸,所以需要在 `Vite` 里进行适配
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm i -D "postcss-pxtorem"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
//vite.config.js
|
|
33
|
+
|
|
34
|
+
import pixelToRem from "postcss-pxtorem"
|
|
35
|
+
|
|
36
|
+
export default defineConfig({
|
|
37
|
+
css: {
|
|
38
|
+
postcss: {
|
|
39
|
+
plugins: [
|
|
40
|
+
pixelToRem({
|
|
41
|
+
rootValue({file}) {
|
|
42
|
+
//在这里可以根据 file 路径进行判断与定制,默认的 rootValue 是 37.5
|
|
43
|
+
return 37.5
|
|
44
|
+
},
|
|
45
|
+
propList: ["*"],
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 示例
|
|
54
|
+
|
|
55
|
+
引入样式
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
//app.js
|
|
59
|
+
import "jobsys-explore/dist/style.css"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
//app.js
|
|
64
|
+
import { createApp } from "vue"
|
|
65
|
+
import Explore from "jobsys-explore"
|
|
66
|
+
|
|
67
|
+
const app = createApp({
|
|
68
|
+
setup: () => {}
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
app.use(Explore).mount("#app")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<template>
|
|
76
|
+
<ExButton type="primary">点兵</ExButton>
|
|
77
|
+
</template>
|
|
78
|
+
<script setup>
|
|
79
|
+
import { ref } from "vue"
|
|
80
|
+
|
|
81
|
+
const password = ref("")
|
|
82
|
+
</script>
|
|
83
83
|
```
|
package/hooks/cipher.js
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { sm2, sm3, sm4 } from "sm-crypto-v2"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 国密 sm2 加密
|
|
5
|
-
* @param msg
|
|
6
|
-
* @param key
|
|
7
|
-
* @param {Object} [cipherMode]
|
|
8
|
-
* @return {Uint8Array}
|
|
9
|
-
*/
|
|
10
|
-
export function useSm2Encrypt(msg, key, cipherMode) {
|
|
11
|
-
return sm2.doEncrypt(msg, key, cipherMode)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 国密 sm3 加密
|
|
16
|
-
* @param msg
|
|
17
|
-
* @param {Object} [options]
|
|
18
|
-
* @return {*}
|
|
19
|
-
*/
|
|
20
|
-
export function useSm3(msg, options) {
|
|
21
|
-
return sm3(msg, options) // 杂凑
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 国密 sm4 加密
|
|
26
|
-
* @param msg
|
|
27
|
-
* @param key
|
|
28
|
-
* @param {Object} [options]
|
|
29
|
-
* @return {Uint8Array}
|
|
30
|
-
*/
|
|
31
|
-
export function useSm4Encrypt(msg, key, options) {
|
|
32
|
-
return sm4.encrypt(msg, key, options)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 国密 sm4 解密
|
|
37
|
-
* @param encryptData
|
|
38
|
-
* @param key
|
|
39
|
-
* @param {Object} [options]
|
|
40
|
-
* @return {Uint8Array}
|
|
41
|
-
*/
|
|
42
|
-
export function useSm4Decrypt(encryptData, key, options) {
|
|
43
|
-
return sm4.encrypt(encryptData, key, options)
|
|
44
|
-
}
|
|
1
|
+
import { sm2, sm3, sm4 } from "sm-crypto-v2"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 国密 sm2 加密
|
|
5
|
+
* @param msg
|
|
6
|
+
* @param key
|
|
7
|
+
* @param {Object} [cipherMode]
|
|
8
|
+
* @return {Uint8Array}
|
|
9
|
+
*/
|
|
10
|
+
export function useSm2Encrypt(msg, key, cipherMode) {
|
|
11
|
+
return sm2.doEncrypt(msg, key, cipherMode)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 国密 sm3 加密
|
|
16
|
+
* @param msg
|
|
17
|
+
* @param {Object} [options]
|
|
18
|
+
* @return {*}
|
|
19
|
+
*/
|
|
20
|
+
export function useSm3(msg, options) {
|
|
21
|
+
return sm3(msg, options) // 杂凑
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 国密 sm4 加密
|
|
26
|
+
* @param msg
|
|
27
|
+
* @param key
|
|
28
|
+
* @param {Object} [options]
|
|
29
|
+
* @return {Uint8Array}
|
|
30
|
+
*/
|
|
31
|
+
export function useSm4Encrypt(msg, key, options) {
|
|
32
|
+
return sm4.encrypt(msg, key, options)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 国密 sm4 解密
|
|
37
|
+
* @param encryptData
|
|
38
|
+
* @param key
|
|
39
|
+
* @param {Object} [options]
|
|
40
|
+
* @return {Uint8Array}
|
|
41
|
+
*/
|
|
42
|
+
export function useSm4Decrypt(encryptData, key, options) {
|
|
43
|
+
return sm4.encrypt(encryptData, key, options)
|
|
44
|
+
}
|
package/hooks/datetime.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import dayjs from "dayjs"
|
|
2
|
-
import { isString } from "lodash-es"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 根据格式创建 Dayjs 对象
|
|
6
|
-
* @param {string|number} date
|
|
7
|
-
* @param {string} [format] - 日期格式
|
|
8
|
-
* @return {dayjs.Dayjs}
|
|
9
|
-
*/
|
|
10
|
-
export function useDayjs(date, format) {
|
|
11
|
-
if ((/^\d+$/.test(date) || /^-\d+$/.test(date)) && String(date).length <= 10) {
|
|
12
|
-
date = parseInt(date + "000")
|
|
13
|
-
}
|
|
14
|
-
return format ? dayjs(date, format) : dayjs(date)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 格式化日期
|
|
19
|
-
* @param {dayjs.Dayjs|Date} date
|
|
20
|
-
* @param {string} format
|
|
21
|
-
* @return {string}
|
|
22
|
-
*/
|
|
23
|
-
export function useDateFormat(date, format) {
|
|
24
|
-
if (!date) {
|
|
25
|
-
return ""
|
|
26
|
-
}
|
|
27
|
-
if (!dayjs.isDayjs(date)) {
|
|
28
|
-
date = dayjs(date)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return date.format(format || "YYYY-MM-DD HH:mm")
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 获取日期的 Unix 时间戳
|
|
36
|
-
* @param {dayjs.Dayjs|Date} date
|
|
37
|
-
* @return {number|string}
|
|
38
|
-
*/
|
|
39
|
-
export function useDateUnix(date) {
|
|
40
|
-
if (!date) {
|
|
41
|
-
return ""
|
|
42
|
-
}
|
|
43
|
-
if (!dayjs.isDayjs(date)) {
|
|
44
|
-
date = dayjs(date)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return date.unix()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 根据时间戳格式化日期
|
|
52
|
-
* @param timestamp 时间戳
|
|
53
|
-
* @param [format] 日期格式
|
|
54
|
-
* @return {string}
|
|
55
|
-
*/
|
|
56
|
-
export function useTimestampFormat(timestamp, format) {
|
|
57
|
-
if (timestamp && isString(timestamp)) {
|
|
58
|
-
timestamp = parseInt(timestamp)
|
|
59
|
-
}
|
|
60
|
-
if (!timestamp) {
|
|
61
|
-
return ""
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (timestamp < 9999999999) {
|
|
65
|
-
timestamp *= 1000
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return useDateFormat(new Date(timestamp), format)
|
|
69
|
-
}
|
|
1
|
+
import dayjs from "dayjs"
|
|
2
|
+
import { isString } from "lodash-es"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 根据格式创建 Dayjs 对象
|
|
6
|
+
* @param {string|number} date
|
|
7
|
+
* @param {string} [format] - 日期格式
|
|
8
|
+
* @return {dayjs.Dayjs}
|
|
9
|
+
*/
|
|
10
|
+
export function useDayjs(date, format) {
|
|
11
|
+
if ((/^\d+$/.test(date) || /^-\d+$/.test(date)) && String(date).length <= 10) {
|
|
12
|
+
date = parseInt(date + "000")
|
|
13
|
+
}
|
|
14
|
+
return format ? dayjs(date, format) : dayjs(date)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 格式化日期
|
|
19
|
+
* @param {dayjs.Dayjs|Date} date
|
|
20
|
+
* @param {string} format
|
|
21
|
+
* @return {string}
|
|
22
|
+
*/
|
|
23
|
+
export function useDateFormat(date, format) {
|
|
24
|
+
if (!date) {
|
|
25
|
+
return ""
|
|
26
|
+
}
|
|
27
|
+
if (!dayjs.isDayjs(date)) {
|
|
28
|
+
date = dayjs(date)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return date.format(format || "YYYY-MM-DD HH:mm")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 获取日期的 Unix 时间戳
|
|
36
|
+
* @param {dayjs.Dayjs|Date} date
|
|
37
|
+
* @return {number|string}
|
|
38
|
+
*/
|
|
39
|
+
export function useDateUnix(date) {
|
|
40
|
+
if (!date) {
|
|
41
|
+
return ""
|
|
42
|
+
}
|
|
43
|
+
if (!dayjs.isDayjs(date)) {
|
|
44
|
+
date = dayjs(date)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return date.unix()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 根据时间戳格式化日期
|
|
52
|
+
* @param timestamp 时间戳
|
|
53
|
+
* @param [format] 日期格式
|
|
54
|
+
* @return {string}
|
|
55
|
+
*/
|
|
56
|
+
export function useTimestampFormat(timestamp, format) {
|
|
57
|
+
if (timestamp && isString(timestamp)) {
|
|
58
|
+
timestamp = parseInt(timestamp)
|
|
59
|
+
}
|
|
60
|
+
if (!timestamp) {
|
|
61
|
+
return ""
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (timestamp < 9999999999) {
|
|
65
|
+
timestamp *= 1000
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return useDateFormat(new Date(timestamp), format)
|
|
69
|
+
}
|