jobsys-explore 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +4 -0
- package/.eslintrc.cjs +38 -0
- package/.prettierrc.cjs +38 -0
- package/README.md +42 -0
- package/components/button/ExButton.jsx +119 -0
- package/components/button/index.js +4 -0
- package/components/button/index.less +8 -0
- package/components/form/ExAddress.jsx +125 -0
- package/components/form/ExCascader.jsx +98 -0
- package/components/form/ExCheckbox.jsx +59 -0
- package/components/form/ExDate.jsx +130 -0
- package/components/form/ExDatetime.jsx +152 -0
- package/components/form/ExField.jsx +123 -0
- package/components/form/ExFieldUploader.jsx +44 -0
- package/components/form/ExForm.jsx +395 -0
- package/components/form/ExNumber.jsx +49 -0
- package/components/form/ExRadio.jsx +58 -0
- package/components/form/ExRate.jsx +47 -0
- package/components/form/ExSelect.jsx +151 -0
- package/components/form/ExSlider.jsx +53 -0
- package/components/form/ExSwitch.jsx +49 -0
- package/components/form/ExTime.jsx +104 -0
- package/components/form/FormItem.jsx +229 -0
- package/components/form/PickerWrapper.jsx +111 -0
- package/components/form/addressData.json +1 -0
- package/components/form/index.js +37 -0
- package/components/form/index.less +108 -0
- package/components/form/utils.js +47 -0
- package/components/grid/ExGrid.jsx +53 -0
- package/components/grid/index.js +4 -0
- package/components/grid/index.less +3 -0
- package/components/index.js +9 -0
- package/components/pagination/ExPagination.jsx +148 -0
- package/components/pagination/index.js +5 -0
- package/components/pagination/index.less +15 -0
- package/components/provider/ExProvider.jsx +91 -0
- package/components/provider/index.js +4 -0
- package/components/qrcode/ExQrcode.jsx +86 -0
- package/components/qrcode/index.js +5 -0
- package/components/qrcode/index.less +8 -0
- package/components/result/ExResult.jsx +122 -0
- package/components/result/index.js +5 -0
- package/components/result/index.less +60 -0
- package/components/search/ExSearch.jsx +252 -0
- package/components/search/components/Expand.jsx +77 -0
- package/components/search/components/Field.jsx +27 -0
- package/components/search/components/Quick.jsx +53 -0
- package/components/search/components/index.js +5 -0
- package/components/search/index.js +5 -0
- package/components/search/index.less +119 -0
- package/components/search/utils.js +30 -0
- package/components/theme/ExTheme.jsx +10 -0
- package/components/theme/index.js +4 -0
- package/components/theme/index.less +97 -0
- package/components/uploader/ExUploader.jsx +248 -0
- package/components/uploader/index.js +5 -0
- package/components/utils.js +150 -0
- package/dist/__vite-browser-external-2447137e.mjs +5 -0
- package/dist/__vite-browser-external-2447137e.mjs.map +1 -0
- package/dist/__vite-browser-external-b3701507.js +2 -0
- package/dist/__vite-browser-external-b3701507.js.map +1 -0
- package/dist/hooks.cjs +2 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.js +35 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-82d74e5f.mjs +2120 -0
- package/dist/index-82d74e5f.mjs.map +1 -0
- package/dist/index-b8729555.js +2 -0
- package/dist/index-b8729555.js.map +1 -0
- package/dist/jobsys-explore.cjs +9 -0
- package/dist/jobsys-explore.cjs.map +1 -0
- package/dist/jobsys-explore.js +18673 -0
- package/dist/jobsys-explore.js.map +1 -0
- package/dist/style.css +1 -0
- package/docgen.config.cjs +9 -0
- package/docs/.vitepress/cache/deps/_metadata.json +19 -0
- package/docs/.vitepress/cache/deps/package.json +3 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +162 -0
- package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/docs/.vitepress/cache/deps/vue.js +10795 -0
- package/docs/.vitepress/cache/deps/vue.js.map +7 -0
- package/docs/.vitepress/config.mjs +43 -0
- package/docs/.vitepress/dist/404.html +19 -0
- package/docs/.vitepress/dist/assets/app.e0eb4814.js +1 -0
- package/docs/.vitepress/dist/assets/chunks/framework.7a64ad8e.js +2 -0
- package/docs/.vitepress/dist/assets/chunks/theme.ffc5f35c.js +7 -0
- package/docs/.vitepress/dist/assets/inter-italic-cyrillic-ext.33bd5a8e.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-cyrillic.ea42a392.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-greek-ext.4fbe9427.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-greek.8f4463c4.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-latin-ext.bd8920cc.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-latin.bd3b6f56.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-italic-vietnamese.6ce511fb.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-cyrillic-ext.e75737ce.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-cyrillic.5f2c6c8c.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-greek-ext.ab0619bc.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-greek.d5a6d92a.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-latin-ext.0030eebd.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-latin.2ed14f66.woff2 +0 -0
- package/docs/.vitepress/dist/assets/inter-roman-vietnamese.14ce25a6.woff2 +0 -0
- package/docs/.vitepress/dist/assets/style.6747f984.css +1 -0
- package/docs/.vitepress/dist/hashmap.json +1 -0
- package/docs/.vitepress/theme/index.css +0 -0
- package/docs/.vitepress/theme/index.js +12 -0
- package/hooks/cipher.js +40 -0
- package/hooks/form.js +176 -0
- package/hooks/index.js +4 -0
- package/hooks/network.js +153 -0
- package/hooks/utils.js +61 -0
- package/index.html +17 -0
- package/index.js +10 -0
- package/package.json +75 -0
- package/playground/App.vue +45 -0
- package/playground/TestButton.vue +15 -0
- package/playground/TestForm.vue +271 -0
- package/playground/TestFormItem.vue +110 -0
- package/playground/TestGrid.vue +22 -0
- package/playground/TestPagination.vue +89 -0
- package/playground/TestQrcode.vue +7 -0
- package/playground/TestResult.vue +12 -0
- package/playground/TestSearch.vue +84 -0
- package/playground/http.js +23 -0
- package/playground/main.js +12 -0
- package/postcss.config.cjs +8 -0
- package/utils/style.js +13 -0
- package/utils/withInstall.js +7 -0
- package/vite.config.js +52 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import "./index.less"
|
|
2
|
+
|
|
3
|
+
import withInstall from "../../utils/withInstall"
|
|
4
|
+
import _ExField from "./ExField.jsx"
|
|
5
|
+
import _ExAddress, { useAddressFullCode as _useAddressFullCode } from "./ExAddress.jsx"
|
|
6
|
+
import _ExCascader from "./ExCascader.jsx"
|
|
7
|
+
import _ExCheckbox from "./ExCheckbox.jsx"
|
|
8
|
+
import _ExDate from "./ExDate.jsx"
|
|
9
|
+
import _ExDatetime from "./ExDatetime.jsx"
|
|
10
|
+
import _ExTime from "./ExTime.jsx"
|
|
11
|
+
import _ExNumber from "./ExNumber.jsx"
|
|
12
|
+
import _ExRadio from "./ExRadio.jsx"
|
|
13
|
+
import _ExSelect from "./ExSelect.jsx"
|
|
14
|
+
import _ExSwitch from "./ExSwitch.jsx"
|
|
15
|
+
import _ExRate from "./ExRate.jsx"
|
|
16
|
+
import _ExSlider from "./ExSlider.jsx"
|
|
17
|
+
import _ExFieldUploader from "./ExFieldUploader.jsx"
|
|
18
|
+
|
|
19
|
+
import _ExForm from "./ExForm.jsx"
|
|
20
|
+
|
|
21
|
+
export const useAddressFullCode = _useAddressFullCode
|
|
22
|
+
export const ExAddress = withInstall(_ExAddress)
|
|
23
|
+
export const ExField = withInstall(_ExField)
|
|
24
|
+
export const ExCascader = withInstall(_ExCascader)
|
|
25
|
+
export const ExCheckbox = withInstall(_ExCheckbox)
|
|
26
|
+
export const ExDate = withInstall(_ExDate)
|
|
27
|
+
export const ExDatetime = withInstall(_ExDatetime)
|
|
28
|
+
export const ExTime = withInstall(_ExTime)
|
|
29
|
+
export const ExNumber = withInstall(_ExNumber)
|
|
30
|
+
export const ExRadio = withInstall(_ExRadio)
|
|
31
|
+
export const ExSelect = withInstall(_ExSelect)
|
|
32
|
+
export const ExSwitch = withInstall(_ExSwitch)
|
|
33
|
+
export const ExRate = withInstall(_ExRate)
|
|
34
|
+
export const ExSlider = withInstall(_ExSlider)
|
|
35
|
+
export const ExFieldUploader = withInstall(_ExFieldUploader)
|
|
36
|
+
|
|
37
|
+
export const ExForm = withInstall(_ExForm)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
.ex-form {
|
|
2
|
+
|
|
3
|
+
& > .van-cell-group {
|
|
4
|
+
margin-bottom: var(--van-padding-md);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&.ex-form__fixed {
|
|
8
|
+
& > .van-cell-group {
|
|
9
|
+
margin-bottom: 100px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ex-form__footer {
|
|
14
|
+
margin: var(--van-padding-md);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ex-form__submit-btn {
|
|
18
|
+
padding: var(--van-padding-md);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ex-form__submit-btn-fixed {
|
|
22
|
+
position: fixed;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
left: 0;
|
|
25
|
+
right: 0;
|
|
26
|
+
background: var(--van-white);
|
|
27
|
+
padding: var(--van-padding-md);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ex-field {
|
|
32
|
+
.ex-field__label {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
|
|
35
|
+
.ex-field__help-handler {
|
|
36
|
+
margin-left: 4px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ex-field__help {
|
|
42
|
+
padding: 4px 8px;
|
|
43
|
+
font-size: 13px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ex-field-popup {
|
|
47
|
+
background: var(--van-gray-1) !important;
|
|
48
|
+
|
|
49
|
+
&.ex-field-popup-inset {
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
padding: 0 var(--van-padding-md) 10px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
.ex-field-popup__header {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
height: 48px;
|
|
60
|
+
padding: 0 var(--van-padding-md);
|
|
61
|
+
|
|
62
|
+
.ex-field-popup__title {
|
|
63
|
+
font-weight: var(--vant-font-bold);
|
|
64
|
+
font-size: var(--van-font-size-lg);
|
|
65
|
+
line-height: 20px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.van-collapse {
|
|
70
|
+
border-radius: var(--van-radius-lg);
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
&.ex-datetime_collapse {
|
|
75
|
+
.van-collapse-item {
|
|
76
|
+
.van-cell {
|
|
77
|
+
.van-cell__value {
|
|
78
|
+
color: var(--van-primary-color)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.van-cascader {
|
|
86
|
+
border-radius: var(--van-radius-lg);
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
background: var(--van-white);
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.ex-field-popup__clear-btn {
|
|
93
|
+
background: var(--ex-white);
|
|
94
|
+
margin: var(--van-padding-sm);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ex-slider-button {
|
|
99
|
+
width: var(--van-slider-button-width);
|
|
100
|
+
height: var(--van-slider-button-height);
|
|
101
|
+
text-align: center;
|
|
102
|
+
color: #FFF;
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
line-height: var(--van-slider-button-height);
|
|
105
|
+
background: var(--van-primary-color);
|
|
106
|
+
border-radius: var(--van-slider-button-radius);
|
|
107
|
+
box-shadow: var(--van-slider-button-shadow);
|
|
108
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isArray, isDate, isFunction, isUndefined } from "lodash-es"
|
|
2
|
+
import { useAddressFullCode } from "./ExAddress.jsx"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 初始化表单项默认值
|
|
6
|
+
* @param {FormItemConfig} item
|
|
7
|
+
* @param {Object} existingData
|
|
8
|
+
* @param {Object} submitForm
|
|
9
|
+
* @param {Object} provider
|
|
10
|
+
*/
|
|
11
|
+
const initItemDefaultValue = (item, existingData, submitForm, provider) => {
|
|
12
|
+
let value = ""
|
|
13
|
+
|
|
14
|
+
const { uploaderProvider } = provider
|
|
15
|
+
|
|
16
|
+
if (existingData && !isUndefined(existingData[item.key])) {
|
|
17
|
+
value = existingData[item.key]
|
|
18
|
+
} else if (!isUndefined(item.defaultValue)) {
|
|
19
|
+
value = isFunction(item.defaultValue) ? item.defaultValue(submitForm) : item.defaultValue
|
|
20
|
+
}
|
|
21
|
+
if (item.type === "number" || item.type === "rate") {
|
|
22
|
+
value = value ? Number(value) : 0
|
|
23
|
+
} else if (item.type === "slider") {
|
|
24
|
+
value = item.defaultProps && item.defaultProps.range ? value || [0, 100] : value ? Number(value) : 0
|
|
25
|
+
} else if (item.type === "switch") {
|
|
26
|
+
value = value === "true" || value === 1 || value === "1" || value === true
|
|
27
|
+
} else if (item.type === "date" || item.type === "datetime") {
|
|
28
|
+
value = isDate(value) ? value : null
|
|
29
|
+
} else if (item.type === "checkbox" || item.type === "group" || item.type === "cascade") {
|
|
30
|
+
value = value || []
|
|
31
|
+
} else if (item.type === "address") {
|
|
32
|
+
value = value || []
|
|
33
|
+
if (!isArray(value)) {
|
|
34
|
+
value = useAddressFullCode(value)
|
|
35
|
+
}
|
|
36
|
+
} else if (item.type === "uploader") {
|
|
37
|
+
if (item.defaultProps && item.defaultProps.maxNum && item.defaultProps.maxNum > 1) {
|
|
38
|
+
value = value || []
|
|
39
|
+
} else {
|
|
40
|
+
value = value || { [uploaderProvider.path]: "", [uploaderProvider.url]: "" }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return value
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { initItemDefaultValue }
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineComponent } from "vue"
|
|
2
|
+
import "./index.less"
|
|
3
|
+
import { isArray } from "lodash-es"
|
|
4
|
+
import { genPixel } from "../../utils/style"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Grid 布局组件
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: "ExGrid",
|
|
12
|
+
props: {
|
|
13
|
+
/**
|
|
14
|
+
* 间距方向
|
|
15
|
+
* @values vertical, horizontal
|
|
16
|
+
*/
|
|
17
|
+
direction: { type: String, default: "horizontal" },
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 列数,如果没有定义将会把元素置于同一行
|
|
21
|
+
*/
|
|
22
|
+
columns: { type: Number, default: 0 },
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 间距大小,如 20px 2em,默认单位为 px,支持数组形式来分别设置横向和纵向间距
|
|
26
|
+
*/
|
|
27
|
+
gutter: { type: [Array, Number, String], default: 20 },
|
|
28
|
+
},
|
|
29
|
+
setup(props, { slots }) {
|
|
30
|
+
return () => {
|
|
31
|
+
const columns = props.columns || slots.default()?.length
|
|
32
|
+
|
|
33
|
+
let gridTemplateColumns = ""
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < columns; i++) {
|
|
36
|
+
gridTemplateColumns += " 1fr"
|
|
37
|
+
}
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
class={"ex-grid"}
|
|
41
|
+
style={{
|
|
42
|
+
gridAutoFlow: props.direction === "horizontal" ? "row" : "column",
|
|
43
|
+
gridRowGap: isArray(props.gutter) ? genPixel(props.gutter?.[1]) : "0",
|
|
44
|
+
gridColumnGap: isArray(props.gutter) ? genPixel(props.gutter?.[0]) : genPixel(props.gutter),
|
|
45
|
+
gridTemplateColumns,
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{slots.default?.()}
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
})
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { computed, defineComponent, ref } from "vue"
|
|
2
|
+
import { usePage } from "../../hooks"
|
|
3
|
+
import { Empty, List } from "vant"
|
|
4
|
+
import ExSearch from "../search/ExSearch.jsx"
|
|
5
|
+
import "./index.less"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ExPagination 翻页
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export default defineComponent({
|
|
12
|
+
name: "ExPagination",
|
|
13
|
+
props: {
|
|
14
|
+
/**
|
|
15
|
+
* 翻页数据
|
|
16
|
+
*/
|
|
17
|
+
pagination: { type: Object, default: () => ({}) },
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* ExSearch 搜索的 columns 配置
|
|
21
|
+
*/
|
|
22
|
+
search: { type: Object, default: null },
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 请求数据URL
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
url: { type: String, default: "" },
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 请求时的附带参数
|
|
32
|
+
*/
|
|
33
|
+
extraData: { type: Object, default: () => ({}) },
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 是否自动加载
|
|
37
|
+
*/
|
|
38
|
+
autoLoad: { type: Boolean, default: false },
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 加载后数据的回调函数
|
|
42
|
+
*/
|
|
43
|
+
afterFetched: { type: Function, default: null },
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 数据为空文案
|
|
47
|
+
*/
|
|
48
|
+
emptyText: { type: String, default: "暂无内容" },
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 加载完毕文案
|
|
52
|
+
*/
|
|
53
|
+
finishText: { type: String, default: "加载完毕" },
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 加载错误文案
|
|
57
|
+
*/
|
|
58
|
+
errorText: { type: String, default: "请求失败,点击重新加载" },
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 是否使用 store
|
|
62
|
+
* 如果使用 store, 请确认 store 中定义了 pagination 和 initPagination 方法
|
|
63
|
+
*/
|
|
64
|
+
useStore: { type: Object, default: () => null },
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* [原生配置](https://vant-contrib.gitee.io/vant/#/zh-CN/list)
|
|
68
|
+
*/
|
|
69
|
+
listProps: { type: Object, default: () => ({}) },
|
|
70
|
+
},
|
|
71
|
+
setup(props, { expose, slots }) {
|
|
72
|
+
let pagination = ref(null)
|
|
73
|
+
if (props.useStore?.initPagination) {
|
|
74
|
+
props.useStore.initPagination({
|
|
75
|
+
uri: props.url,
|
|
76
|
+
params: props.extraData,
|
|
77
|
+
})
|
|
78
|
+
pagination = computed(() => props.useStore.pagination)
|
|
79
|
+
} else {
|
|
80
|
+
pagination = ref({
|
|
81
|
+
uri: props.url,
|
|
82
|
+
params: props.extraData,
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const loadMore = (refresh) => {
|
|
87
|
+
usePage(pagination?.value, refresh)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const onSearch = (params) => {
|
|
91
|
+
pagination.value.params = params
|
|
92
|
+
loadMore(true)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (props.autoLoad) {
|
|
96
|
+
loadMore()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/****************** exposed ******************/
|
|
100
|
+
|
|
101
|
+
const items = () => {
|
|
102
|
+
return pagination.value.items || []
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
expose({ loadMore, items, pagination })
|
|
106
|
+
|
|
107
|
+
/****************** render ******************/
|
|
108
|
+
|
|
109
|
+
return () => (
|
|
110
|
+
<div class={`ex-pagination ${props.search ? "ex-pagination__with-search" : ""}`}>
|
|
111
|
+
{props.search ? (
|
|
112
|
+
<div class={"ex-pagination__search"}>
|
|
113
|
+
<ExSearch {...props.search} onSearch={onSearch}></ExSearch>
|
|
114
|
+
</div>
|
|
115
|
+
) : null}
|
|
116
|
+
|
|
117
|
+
{pagination.value.empty ? (
|
|
118
|
+
<Empty description={props.emptyText}></Empty>
|
|
119
|
+
) : (
|
|
120
|
+
<List
|
|
121
|
+
/*v-model:loading={pagination.value.loading}*/
|
|
122
|
+
v-model:error={pagination.value.error}
|
|
123
|
+
immediateCheck={props.autoLoad}
|
|
124
|
+
finished={pagination.value.finished}
|
|
125
|
+
finishedText={props.finishText}
|
|
126
|
+
errorText={props.errorText}
|
|
127
|
+
onLoad={() => loadMore(false)}
|
|
128
|
+
{...props.listProps}
|
|
129
|
+
>
|
|
130
|
+
{{
|
|
131
|
+
default: () =>
|
|
132
|
+
pagination.value.items
|
|
133
|
+
? pagination.value.items.map((item, index) =>
|
|
134
|
+
slots.renderItem
|
|
135
|
+
? slots.renderItem({
|
|
136
|
+
item,
|
|
137
|
+
index,
|
|
138
|
+
})
|
|
139
|
+
: null,
|
|
140
|
+
)
|
|
141
|
+
: null,
|
|
142
|
+
}}
|
|
143
|
+
</List>
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
})
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineComponent, provide } from "vue"
|
|
2
|
+
|
|
3
|
+
export const EX_UPLOADER = Symbol("EX_UPLOADER")
|
|
4
|
+
export const EX_FORM = Symbol("EX_FORM")
|
|
5
|
+
export const EX_SEARCH = Symbol("EX_SEARCH")
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Explore 配置组件
|
|
9
|
+
* @version 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
export default defineComponent({
|
|
12
|
+
name: "ExProvider",
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} ProviderProps
|
|
15
|
+
* @property {UploaderProviderProps} [uploader] `ExUploader` 配置
|
|
16
|
+
* @property {FormProviderProps} [form] `ExForm` 配置
|
|
17
|
+
* @property {SearchProviderProps} [search] `ExSearch` 配置
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
props: {
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} UploaderProviderProps `ExUploader` 配置
|
|
23
|
+
* @property {string} uploadUrl 上传地址
|
|
24
|
+
* @property {UploadFileItem} defaultFileItem 默认文件项
|
|
25
|
+
*
|
|
26
|
+
* @typedef {Object} UploadFileItem 文件项
|
|
27
|
+
* @property {string} [id] 文件 ID
|
|
28
|
+
* @property {string} [name] 文件名
|
|
29
|
+
* @property {string} defaultFileItem.url 文件地址
|
|
30
|
+
* @property {string} defaultFileItem.path 文件路径
|
|
31
|
+
* @property {string} [thumbUrl] 缩略图地址
|
|
32
|
+
*/
|
|
33
|
+
uploader: {
|
|
34
|
+
type: Object,
|
|
35
|
+
default: () => ({
|
|
36
|
+
uploadUrl: "",
|
|
37
|
+
defaultFileItem: {
|
|
38
|
+
id: "id",
|
|
39
|
+
name: "name",
|
|
40
|
+
url: "url",
|
|
41
|
+
path: "path",
|
|
42
|
+
thumbUrl: "thumbUrl",
|
|
43
|
+
},
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {Object} FormProviderProps `ExForm` 配置
|
|
49
|
+
* @property {Object} [format] 格式化配置, 如 {date: true} 表示在提交表单时使用 `useFormFormat` 格式所有日期字段
|
|
50
|
+
* @property {Function} [afterFetched] 处理接口返回数据的函数
|
|
51
|
+
*/
|
|
52
|
+
form: {
|
|
53
|
+
type: Object,
|
|
54
|
+
default: () => ({
|
|
55
|
+
format: {},
|
|
56
|
+
afterFetched: null,
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {Object} SearchProviderProps `ExSearch` 配置
|
|
62
|
+
* @property {Object} [maskClass] 定制伪 Input 样式
|
|
63
|
+
* @property {Object} [inputClass] 弹层中 Input 的样式
|
|
64
|
+
*/
|
|
65
|
+
search: {
|
|
66
|
+
type: Object,
|
|
67
|
+
default: () => ({
|
|
68
|
+
maskClass: "",
|
|
69
|
+
inputClass: "",
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
setup(props, { slots }) {
|
|
74
|
+
provide(EX_UPLOADER, {
|
|
75
|
+
id: "id",
|
|
76
|
+
name: "name",
|
|
77
|
+
url: "url",
|
|
78
|
+
path: "path",
|
|
79
|
+
thumbUrl: "thumbUrl",
|
|
80
|
+
...props.uploader,
|
|
81
|
+
})
|
|
82
|
+
provide(EX_FORM, { format: {}, ...props.form })
|
|
83
|
+
provide(EX_SEARCH, {
|
|
84
|
+
maskClass: "",
|
|
85
|
+
inputClass: "",
|
|
86
|
+
...props.search,
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
return () => <div>{slots.default?.()}</div>
|
|
90
|
+
},
|
|
91
|
+
})
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { defineComponent, onBeforeUpdate, onMounted, ref, watch } from "vue"
|
|
2
|
+
import QRCode from "qrcode"
|
|
3
|
+
import "./index.less"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ExQrcode 二维码
|
|
7
|
+
* @version 1.0.0
|
|
8
|
+
*/
|
|
9
|
+
export default defineComponent({
|
|
10
|
+
name: "ExQrcode",
|
|
11
|
+
props: {
|
|
12
|
+
/**
|
|
13
|
+
* 是否居中显示
|
|
14
|
+
*/
|
|
15
|
+
center: { type: Boolean, default: false },
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 二维码内容
|
|
19
|
+
*/
|
|
20
|
+
text: { type: [String, Number], default: "" },
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 二维码尺寸
|
|
24
|
+
*/
|
|
25
|
+
size: { type: Number, default: 120 },
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 边距
|
|
29
|
+
*/
|
|
30
|
+
margin: { type: Number, default: 0 },
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 前景色
|
|
34
|
+
*/
|
|
35
|
+
colorDark: { type: String, default: "#000000" },
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 背景色
|
|
39
|
+
*/
|
|
40
|
+
colorLight: { type: String, default: "#FFFFFF" },
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 纠错级别
|
|
44
|
+
* @values L, M, Q, H
|
|
45
|
+
*/
|
|
46
|
+
correctLevel: { type: String, default: "H" },
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
setup(props) {
|
|
50
|
+
const containerRef = ref()
|
|
51
|
+
|
|
52
|
+
const create = () => {
|
|
53
|
+
QRCode.toDataURL(containerRef.value, String(props.text), {
|
|
54
|
+
errorCorrectionLevel: props.correctLevel,
|
|
55
|
+
color: {
|
|
56
|
+
dark: props.colorDark,
|
|
57
|
+
light: props.colorLight,
|
|
58
|
+
},
|
|
59
|
+
width: props.size,
|
|
60
|
+
margin: props.margin,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
watch(
|
|
65
|
+
() => props,
|
|
66
|
+
() => {
|
|
67
|
+
create()
|
|
68
|
+
},
|
|
69
|
+
{ deep: true },
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
onBeforeUpdate(() => {
|
|
73
|
+
containerRef.value = null
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
onMounted(() => {
|
|
77
|
+
create()
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
return () => (
|
|
81
|
+
<div class={`ex-qrcode ${props.center ? "ex-qrcode__center" : ""}`}>
|
|
82
|
+
<canvas ref={containerRef}></canvas>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
},
|
|
86
|
+
})
|