jobsys-explore 1.0.3 → 1.0.5
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 +25 -27
- package/components/index.js +10 -9
- package/components/search/ExSearch.jsx +253 -252
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.js +37 -24
- 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 +111 -107
- package/dist/jobsys-explore.js.map +1 -1
- package/hooks/datetime.js +44 -0
- package/hooks/index.js +1 -0
- package/package.json +1 -1
- package/playground/TestForm.vue +283 -271
- package/playground/TestFormItem.vue +110 -110
- package/playground/TestPagination.vue +89 -89
- package/vite.config.js +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# TODOs
|
|
3
2
|
|
|
4
3
|
---
|
|
@@ -6,32 +5,31 @@
|
|
|
6
5
|
## 增强
|
|
7
6
|
|
|
8
7
|
- [ ] ExploreForm
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
8
|
+
- [X] Address
|
|
9
|
+
- [X] Cascader
|
|
10
|
+
- [X] Checkbox
|
|
11
|
+
- [X] Date
|
|
12
|
+
- [ ] Group
|
|
13
|
+
- [ ] Html
|
|
14
|
+
- [X] Input
|
|
15
|
+
- [X] Number
|
|
16
|
+
- [X] Radio
|
|
17
|
+
- [ ] Remote
|
|
18
|
+
- [X] Select
|
|
19
|
+
- [X] Switch
|
|
20
|
+
- [] Tag
|
|
21
|
+
- [X] Text
|
|
22
|
+
- [X] Time
|
|
23
|
+
- [ ] TreeSelect
|
|
24
|
+
- [X] Uploader
|
|
25
|
+
|
|
26
|
+
- [X] ExploreSearch
|
|
27
|
+
- [X] 同上
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
- [X] Field
|
|
31
|
+
- [X] Disabled
|
|
32
|
+
- [X] Help
|
|
35
33
|
|
|
36
34
|
## 新增
|
|
37
35
|
|
package/components/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from "./button"
|
|
2
|
-
export * from "./theme"
|
|
3
|
-
export * from "./form"
|
|
4
|
-
export * from "./provider"
|
|
5
|
-
export * from "./result"
|
|
6
|
-
export * from "./qrcode"
|
|
7
|
-
export * from "./pagination"
|
|
8
|
-
export * from "./search"
|
|
9
|
-
export * from "./uploader"
|
|
1
|
+
export * from "./button"
|
|
2
|
+
export * from "./theme"
|
|
3
|
+
export * from "./form"
|
|
4
|
+
export * from "./provider"
|
|
5
|
+
export * from "./result"
|
|
6
|
+
export * from "./qrcode"
|
|
7
|
+
export * from "./pagination"
|
|
8
|
+
export * from "./search"
|
|
9
|
+
export * from "./uploader"
|
|
10
|
+
export * from "./grid"
|
|
@@ -1,252 +1,253 @@
|
|
|
1
|
-
import { defineComponent, reactive, ref } from "vue"
|
|
2
|
-
import { Button, Icon, Popup, Search } from "vant"
|
|
3
|
-
import { find, isArray, isFunction } from "lodash-es"
|
|
4
|
-
import { createExpand, createField, createQuick } from "./components"
|
|
5
|
-
import "./index.less"
|
|
6
|
-
import ExGrid from "../grid/ExGrid.jsx"
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* ExSearch 搜索组件
|
|
10
|
-
* @version 1.0.0
|
|
11
|
-
*/
|
|
12
|
-
export default defineComponent({
|
|
13
|
-
name: "ExSearch",
|
|
14
|
-
props: {
|
|
15
|
-
modelValue: { type: String, default: "" },
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {Object} ExSearchItemConfig 搜索项
|
|
19
|
-
* @property {string} key 搜索项的 key
|
|
20
|
-
* @property {string} title 搜索项的标题
|
|
21
|
-
* @property {string} type 搜索项的类型
|
|
22
|
-
* @property {boolean} [
|
|
23
|
-
* @property {boolean} [
|
|
24
|
-
* @property {
|
|
25
|
-
* @property {
|
|
26
|
-
* @property {
|
|
27
|
-
* @property {*} [
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
{
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
1
|
+
import { defineComponent, reactive, ref } from "vue"
|
|
2
|
+
import { Button, Icon, Popup, Search } from "vant"
|
|
3
|
+
import { find, isArray, isFunction } from "lodash-es"
|
|
4
|
+
import { createExpand, createField, createQuick } from "./components"
|
|
5
|
+
import "./index.less"
|
|
6
|
+
import ExGrid from "../grid/ExGrid.jsx"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ExSearch 搜索组件
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
name: "ExSearch",
|
|
14
|
+
props: {
|
|
15
|
+
modelValue: { type: String, default: "" },
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {Object} ExSearchItemConfig 搜索项
|
|
19
|
+
* @property {string} key 搜索项的 key
|
|
20
|
+
* @property {string} title 搜索项的标题
|
|
21
|
+
* @property {string} type 搜索项的类型
|
|
22
|
+
* @property {boolean} [quick] 为 true 展示为快速检索项
|
|
23
|
+
* @property {boolean|Object} [expandable] 搜索项是否展开
|
|
24
|
+
* @property {Array|Function} [options] 搜索项的选项
|
|
25
|
+
* @property {Object} [inputProps] 搜索项的输入框属性
|
|
26
|
+
* @property {*} [defaultValue] 搜索项的值
|
|
27
|
+
* @property {*} [_temp] 搜索项的临时值[内部使用]
|
|
28
|
+
* */
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* 搜索项的配置, 详见 [ExSearchItemConfig](#exsearchitemconfig-配置)
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
columns: { type: Array, default: () => [] },
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 占位提示文字
|
|
39
|
+
*/
|
|
40
|
+
placeholder: { type: String, default: "请输入搜索关键词" },
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 名称,作为提交表单时的标识符
|
|
44
|
+
*/
|
|
45
|
+
keyword: { type: String, default: "keyword" },
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 搜索框左侧文本
|
|
49
|
+
*/
|
|
50
|
+
label: { type: String, default: "" },
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 是否将输入框设为只读状态,只读状态下无法输入内容
|
|
54
|
+
*/
|
|
55
|
+
readonly: { type: Boolean, default: false },
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 是否禁用输入框
|
|
59
|
+
*/
|
|
60
|
+
disabled: { type: Boolean, default: false },
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 输入框内容对齐方式
|
|
64
|
+
* @values left, right, center
|
|
65
|
+
*/
|
|
66
|
+
inputAlign: { type: String, default: "left" },
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* [原生配置](https://vant-contrib.gitee.io/vant/#/zh-CN/search)
|
|
70
|
+
*/
|
|
71
|
+
searchProps: { type: Object, default: () => ({}) },
|
|
72
|
+
},
|
|
73
|
+
emits: ["update:modelValue", "search"],
|
|
74
|
+
setup(props, { emit }) {
|
|
75
|
+
const componentValue = ref(props.modelValue)
|
|
76
|
+
|
|
77
|
+
const state = reactive({
|
|
78
|
+
queryForm: {}, // 搜索表单
|
|
79
|
+
quickColumns: [], //快速检索项
|
|
80
|
+
fieldColumns: [], //表单搜索项
|
|
81
|
+
|
|
82
|
+
showFilterPopup: false,
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const initQueryForm = () => {
|
|
86
|
+
const form = {}
|
|
87
|
+
props.columns.forEach((item) => {
|
|
88
|
+
let value = ""
|
|
89
|
+
//如果是展开显示的,那么默认值为空字符串
|
|
90
|
+
//如果展开为多选,那么默认值为 []
|
|
91
|
+
if (item.expandable === "multiple" || item.type === "cascade") {
|
|
92
|
+
value = []
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (item.defaultValue) {
|
|
96
|
+
value = isFunction(item.defaultValue) ? item.defaultValue() : item.defaultValue
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (item.quick && !find(state.quickColumns, { key: item.key })) {
|
|
100
|
+
state.quickColumns.push(item)
|
|
101
|
+
} else {
|
|
102
|
+
if (item.expandable) {
|
|
103
|
+
if (!item.options) {
|
|
104
|
+
console.error(`expandable 为 true 时,必须提供 options 属性`)
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!find(state.fieldColumns, { key: item.key })) {
|
|
110
|
+
state.fieldColumns.push(item)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
form[item.key] = value
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
state.queryForm = form
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
initQueryForm()
|
|
120
|
+
|
|
121
|
+
const onUpdateValue = (value) => {
|
|
122
|
+
emit("update:modelValue", value)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const getQueryForm = () => {
|
|
126
|
+
const form = {}
|
|
127
|
+
Object.keys(state.queryForm).forEach((key) => {
|
|
128
|
+
let value = state.queryForm[key]
|
|
129
|
+
|
|
130
|
+
if (value && (!isArray(value) || value.length)) {
|
|
131
|
+
form[key] = value
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
if (componentValue.value) {
|
|
136
|
+
form[props.keyword] = componentValue.value
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return form
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const onOpenFilter = () => {
|
|
143
|
+
state.showFilterPopup = true
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const onCloseFilter = () => {
|
|
147
|
+
state.showFilterPopup = false
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const onSearch = () => {
|
|
151
|
+
const form = getQueryForm()
|
|
152
|
+
emit("search", form)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const onFieldSearch = () => {
|
|
156
|
+
state.showFilterPopup = false
|
|
157
|
+
onSearch()
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const onClearFields = () => {
|
|
161
|
+
state.fieldColumns.forEach((item) => {
|
|
162
|
+
state.queryForm[item.key] = ""
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/******************* render *********************/
|
|
167
|
+
|
|
168
|
+
const quickElems = () => {
|
|
169
|
+
return state.quickColumns.map((item) => createQuick(item, state.queryForm, onSearch))
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const popupHeaderElem = () => (
|
|
173
|
+
<div class={"ex-search-popup__header van-hairline--bottom"}>
|
|
174
|
+
<h2 class={"ex-search-popup__title"}>{props.title}</h2>
|
|
175
|
+
<span class={"ex-search-popup__closer"}>
|
|
176
|
+
<Icon
|
|
177
|
+
name={"cross"}
|
|
178
|
+
class={"van-badge__wrapper van-popup__close-icon van-popup__close-icon--top-right van-haptics-feedback"}
|
|
179
|
+
onClick={() => (state.showFilterPopup = false)}
|
|
180
|
+
></Icon>
|
|
181
|
+
</span>
|
|
182
|
+
</div>
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
const fieldElems = () => (
|
|
186
|
+
<div class={"ex-search-popup__content"}>
|
|
187
|
+
{state.fieldColumns.map((item) => (item.expandable ? createExpand(item, state.queryForm) : createField(item, state.queryForm)))}
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
const popupFooterElem = () => (
|
|
192
|
+
<div class={"ex-search-popup__footer van-hairline--top"}>
|
|
193
|
+
<ExGrid>
|
|
194
|
+
{{
|
|
195
|
+
default: () => [
|
|
196
|
+
<Button type={"default"} size={"small"} round={true} onClick={onClearFields}>
|
|
197
|
+
清除
|
|
198
|
+
</Button>,
|
|
199
|
+
<Button type={"primary"} size={"small"} round={true} onClick={onFieldSearch}>
|
|
200
|
+
搜索
|
|
201
|
+
</Button>,
|
|
202
|
+
],
|
|
203
|
+
}}
|
|
204
|
+
</ExGrid>
|
|
205
|
+
</div>
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
return () => (
|
|
209
|
+
<div class="ex-search">
|
|
210
|
+
<form action="/">
|
|
211
|
+
<Search
|
|
212
|
+
v-model={componentValue.value}
|
|
213
|
+
name={props.keyword}
|
|
214
|
+
shape={"round"}
|
|
215
|
+
label={props.label}
|
|
216
|
+
inputAlign={props.inputAlign}
|
|
217
|
+
disabled={props.disabled}
|
|
218
|
+
readonly={props.readonly}
|
|
219
|
+
placeholder={props.placeholder}
|
|
220
|
+
onUpdate:modelValue={onUpdateValue}
|
|
221
|
+
onSearch={onSearch}
|
|
222
|
+
{...props.searchProps}
|
|
223
|
+
></Search>
|
|
224
|
+
</form>
|
|
225
|
+
|
|
226
|
+
<div class={"ex-search__quick-bar"}>
|
|
227
|
+
<div class={"ex-search__quick-container"}>{quickElems()}</div>
|
|
228
|
+
{state.fieldColumns?.length ? (
|
|
229
|
+
<div class={"ex-search__filter"} onClick={onOpenFilter}>
|
|
230
|
+
筛选<Icon name={"filter-o"}></Icon>
|
|
231
|
+
</div>
|
|
232
|
+
) : null}
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<Popup
|
|
236
|
+
v-model:show={state.showFilterPopup}
|
|
237
|
+
closeable={false}
|
|
238
|
+
position={"bottom"}
|
|
239
|
+
round={true}
|
|
240
|
+
teleport={"body"}
|
|
241
|
+
closeOnPopstate={true}
|
|
242
|
+
class={`ex-search-popup`}
|
|
243
|
+
safeAreaInsetBottom={true}
|
|
244
|
+
safeAreaInsetTop={true}
|
|
245
|
+
onClickOverlay={onCloseFilter}
|
|
246
|
+
onClickCloseIcon={onCloseFilter}
|
|
247
|
+
>
|
|
248
|
+
{{ default: () => [popupHeaderElem(), fieldElems(), popupFooterElem()] }}
|
|
249
|
+
</Popup>
|
|
250
|
+
</div>
|
|
251
|
+
)
|
|
252
|
+
},
|
|
253
|
+
})
|
package/dist/hooks.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-88ed539a.cjs"),r=require("dayjs");require("lodash-es");require("axios");require("vant");function n(){return s.sm2_exports}function o(e,u){return s.sm32(e,u)}function i(e,u,t){return s.sm4_exports.encrypt(e,u,t)}function m(e,u,t){return s.sm4_exports.encrypt(e,u,t)}function c(e,u){return u?r(e,u):r(e)}function F(e,u){return e?(r.isDayjs(e)||(e=r(e)),e.format(u||"YYYY-MM-DD HH:mm")):""}function a(e){return e?(r.isDayjs(e)||(e=r(e)),e.unix()):""}exports.STATUS=s.STATUS;exports.useFetch=s.useFetch;exports.useFindLabelsFromPath=s.useFindLabelsFromPath;exports.useFindTextsFromPath=s.useFindTextsFromPath;exports.useFormFail=s.useFormFail;exports.useFormFormat=s.useFormFormat;exports.useHiddenForm=s.useHiddenForm;exports.usePage=s.usePage;exports.useProcessStatus=s.useProcessStatus;exports.useProcessStatusSuccess=s.useProcessStatusSuccess;exports.useTextFromOptionsValue=s.useTextFromOptionsValue;exports.useDateFormat=F;exports.useDateUnix=a;exports.useDayjs=c;exports.useSm2=n;exports.useSm3=o;exports.useSm4Decrypt=m;exports.useSm4Encrypt=i;
|
|
2
2
|
//# sourceMappingURL=hooks.cjs.map
|
package/dist/hooks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.cjs","sources":["../hooks/cipher.js"],"sourcesContent":["import { sm2, sm3, sm4 } from \"sm-crypto-v2\"\n\n/**\n * 国密 sm2\n */\nexport function useSm2() {\n\treturn sm2\n}\n\n/**\n * 国密 sm3 加密\n * @param msg\n * @param {Object} [options]\n * @return {*}\n */\nexport function useSm3(msg, options) {\n\treturn sm3(msg, options) // 杂凑\n}\n\n/**\n * 国密 sm4 加密\n * @param msg\n * @param key\n * @param {Object} [options]\n * @return {Uint8Array}\n */\nexport function useSm4Encrypt(msg, key, options) {\n\treturn sm4.encrypt(msg, key, options)\n}\n\n/**\n * 国密 sm4 解密\n * @param encryptData\n * @param key\n * @param {Object} [options]\n * @return {Uint8Array}\n */\nexport function useSm4Decrypt(encryptData, key, options) {\n\treturn sm4.encrypt(encryptData, key, options)\n}\n"],"names":["useSm2","sm2","useSm3","msg","options","sm3","useSm4Encrypt","key","sm4","useSm4Decrypt","encryptData"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.cjs","sources":["../hooks/cipher.js","../hooks/datetime.js"],"sourcesContent":["import { sm2, sm3, sm4 } from \"sm-crypto-v2\"\n\n/**\n * 国密 sm2\n */\nexport function useSm2() {\n\treturn sm2\n}\n\n/**\n * 国密 sm3 加密\n * @param msg\n * @param {Object} [options]\n * @return {*}\n */\nexport function useSm3(msg, options) {\n\treturn sm3(msg, options) // 杂凑\n}\n\n/**\n * 国密 sm4 加密\n * @param msg\n * @param key\n * @param {Object} [options]\n * @return {Uint8Array}\n */\nexport function useSm4Encrypt(msg, key, options) {\n\treturn sm4.encrypt(msg, key, options)\n}\n\n/**\n * 国密 sm4 解密\n * @param encryptData\n * @param key\n * @param {Object} [options]\n * @return {Uint8Array}\n */\nexport function useSm4Decrypt(encryptData, key, options) {\n\treturn sm4.encrypt(encryptData, key, options)\n}\n","import dayjs from \"dayjs\"\n\n/**\n * 根据格式创建 Dayjs 对象\n * @param {string|number} date\n * @param {string} [format] - 日期格式\n * @return {dayjs.Dayjs}\n */\nexport function useDayjs(date, format) {\n\treturn format ? dayjs(date, format) : dayjs(date)\n}\n\n/**\n * 格式化日期\n * @param {dayjs.Dayjs|Date} date\n * @param {string} format\n * @return {string}\n */\nexport function useDateFormat(date, format) {\n\tif (!date) {\n\t\treturn \"\"\n\t}\n\tif (!dayjs.isDayjs(date)) {\n\t\tdate = dayjs(date)\n\t}\n\n\treturn date.format(format || \"YYYY-MM-DD HH:mm\")\n}\n\n/**\n * 获取日期的 Unix 时间戳\n * @param {dayjs.Dayjs|Date} date\n * @return {number|string}\n */\nexport function useDateUnix(date) {\n\tif (!date) {\n\t\treturn \"\"\n\t}\n\tif (!dayjs.isDayjs(date)) {\n\t\tdate = dayjs(date)\n\t}\n\n\treturn date.unix()\n}\n"],"names":["useSm2","sm2","useSm3","msg","options","sm3","useSm4Encrypt","key","sm4","useSm4Decrypt","encryptData","useDayjs","date","format","dayjs","useDateFormat","useDateUnix"],"mappings":"iMAKO,SAASA,GAAS,CACxB,OAAOC,EAAG,WACX,CAQO,SAASC,EAAOC,EAAKC,EAAS,CACpC,OAAOC,EAAG,KAACF,EAAKC,CAAO,CACxB,CASO,SAASE,EAAcH,EAAKI,EAAKH,EAAS,CAChD,OAAOI,EAAG,YAAC,QAAQL,EAAKI,EAAKH,CAAO,CACrC,CASO,SAASK,EAAcC,EAAaH,EAAKH,EAAS,CACxD,OAAOI,EAAG,YAAC,QAAQE,EAAaH,EAAKH,CAAO,CAC7C,CC/BO,SAASO,EAASC,EAAMC,EAAQ,CACtC,OAAOA,EAASC,EAAMF,EAAMC,CAAM,EAAIC,EAAMF,CAAI,CACjD,CAQO,SAASG,EAAcH,EAAMC,EAAQ,CAC3C,OAAKD,GAGAE,EAAM,QAAQF,CAAI,IACtBA,EAAOE,EAAMF,CAAI,GAGXA,EAAK,OAAOC,GAAU,kBAAkB,GANvC,EAOT,CAOO,SAASG,EAAYJ,EAAM,CACjC,OAAKA,GAGAE,EAAM,QAAQF,CAAI,IACtBA,EAAOE,EAAMF,CAAI,GAGXA,EAAK,KAAM,GANV,EAOT"}
|