web-component-gallery 1.3.12 → 2.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/dist/923.umd.js +1 -0
- package/dist/index.umd.js +1 -12252
- package/dist/js.umd.js +1 -0
- package/dist/style.css +17 -0
- package/dist/style.umd.js +1 -0
- package/{method → extensions}/AMap.js +1 -5
- package/{plugins/method → extensions}/Dialog.js +2 -2
- package/{lib/lazy_use.js → extensions/index.js} +16 -2
- package/lib/{amap/components/AmapSearch/index.jsx → amap-comp/AmapSearch.jsx} +3 -5
- package/lib/amap-comp/index.js +18 -0
- package/{plugins/lib/amap/components/AmapSearch/index.less → lib/amap-comp/style/AmapSearch.less} +5 -3
- package/lib/amap-comp/style/index.js +1 -0
- package/lib/amap-comp/style/index.less +1 -0
- package/lib/{amap/AmapDraw.jsx → amap-draw/index.jsx} +2 -4
- package/lib/amap-draw/style/index.js +1 -0
- package/lib/{amap/AmapDraw.less → amap-draw/style/index.less} +6 -3
- package/lib/browse/index.jsx +0 -2
- package/lib/browse/style/index.js +1 -0
- package/lib/button/Button.js +1 -3
- package/lib/button/style/index.js +1 -0
- package/{plugins/lib/dateTime → lib/date-time}/index.vue +3 -13
- package/lib/date-time/style/index.js +1 -0
- package/lib/date-time/style/index.less +7 -0
- package/lib/{descriptions → descriptions-list}/index.jsx +1 -3
- package/lib/descriptions-list/style/index.js +1 -0
- package/{plugins/lib/tree → lib/directory}/Directory.js +4 -21
- package/lib/directory/index.js +8 -0
- package/lib/directory/style/index.js +1 -0
- package/lib/{tree/style/Directory.less → directory/style/index.less} +3 -4
- package/{plugins/lib/form/components → lib/form-comp}/ACascaderMultiple.vue +1 -106
- package/lib/form-comp/ARadio.vue +70 -0
- package/lib/{form/components → form-comp}/ARangePicker.vue +9 -20
- package/lib/{form/components → form-comp}/ASelectCustom.vue +1 -8
- package/lib/form-comp/ATagsInput.vue +88 -0
- package/lib/form-comp/ATimePicker.vue +127 -0
- package/lib/{form/components → form-comp}/AUpload.vue +2 -17
- package/lib/form-comp/index.js +37 -0
- package/lib/form-comp/style/ACascaderMultiple.less +117 -0
- package/lib/form-comp/style/ARadio.less +0 -0
- package/lib/form-comp/style/ARangePicker.less +11 -0
- package/lib/form-comp/style/ASelectCustom.less +4 -0
- package/lib/form-comp/style/ATagsInput.less +24 -0
- package/lib/form-comp/style/ATimePicker.less +8 -0
- package/lib/form-comp/style/AUpload.less +15 -0
- package/lib/form-comp/style/index.js +1 -0
- package/lib/form-comp/style/index.less +7 -0
- package/lib/index.js +60 -45
- package/lib/modal/index.jsx +4 -6
- package/lib/modal/style/index.js +1 -0
- package/lib/modal/{index.less → style/index.less} +6 -7
- package/{plugins/lib/form → lib/model}/Model.js +1 -3
- package/lib/model/index.js +7 -0
- package/lib/model/style/index.js +1 -0
- package/lib/{form/style/Model.less → model/style/index.less} +10 -10
- package/{plugins/lib/form → lib/model}/utils/render.js +1 -1
- package/lib/{form → model}/utils/resetFields.js +1 -1
- package/lib/no-data/directive.js +65 -0
- package/lib/no-data/index.js +21 -0
- package/lib/no-data/index.vue +35 -0
- package/lib/no-data/style/index.js +1 -0
- package/lib/no-data/style/index.less +15 -0
- package/lib/search/index.js +7 -0
- package/{plugins/lib/form/Search.vue → lib/search/index.vue} +3 -6
- package/lib/search/style/index.js +1 -0
- package/{plugins/lib/form/style/Search.less → lib/search/style/index.less} +7 -8
- package/lib/style/mixins.less +1 -1
- package/lib/{svgIcon → svg-icon}/index.vue +1 -17
- package/lib/svg-icon/style/index.js +1 -0
- package/lib/svg-icon/style/index.less +15 -0
- package/lib/table/index.vue +4 -8
- package/lib/table/style/index.js +1 -0
- package/lib/table/style/index.less +12 -13
- package/lib/tree/index.js +2 -11
- package/{plugins/lib/tree/Tree.vue → lib/tree/index.vue} +2 -5
- package/lib/tree/style/index.js +1 -0
- package/{plugins/lib/tree/style/Tree.less → lib/tree/style/index.less} +4 -4
- package/lib/weather/index.vue +1 -9
- package/lib/weather/style/index.js +1 -0
- package/lib/weather/style/index.less +7 -0
- package/package.json +16 -34
- package/utils/Axios.js +91 -82
- package/utils/Postcss.js +12 -8
- package/README.md +0 -24
- package/dist/amap.umd.js +0 -12252
- package/dist/avatar.umd.js +0 -5337
- package/dist/button.umd.js +0 -5845
- package/dist/dateTime.umd.js +0 -1287
- package/dist/form.umd.js +0 -9981
- package/dist/multiTab.umd.js +0 -5556
- package/dist/svgIcon.umd.js +0 -1167
- package/dist/table.umd.js +0 -6306
- package/dist/tree.umd.js +0 -5393
- package/dist/weather.umd.js +0 -1167
- package/lib/amap/components/AmapSearch/index.less +0 -16
- package/lib/amap/index.js +0 -13
- package/lib/avatar/index.js +0 -7
- package/lib/avatar/index.vue +0 -47
- package/lib/basic/404.vue +0 -24
- package/lib/dateTime/index.vue +0 -43
- package/lib/form/Model.js +0 -153
- package/lib/form/Search.vue +0 -159
- package/lib/form/components/ACascaderMultiple.vue +0 -766
- package/lib/form/components/ARadio.vue +0 -74
- package/lib/form/components/ATagsInput.vue +0 -93
- package/lib/form/components/ATimePicker.vue +0 -73
- package/lib/form/index.js +0 -55
- package/lib/form/style/Search.less +0 -34
- package/lib/form/utils/render.js +0 -85
- package/lib/iframe/events.js +0 -2
- package/lib/iframe/index.jsx +0 -234
- package/lib/iframe/index.less +0 -19
- package/lib/multiTab/APIEnums.js +0 -17
- package/lib/multiTab/MultiTab.jsx +0 -237
- package/lib/multiTab/RouteAPI.js +0 -71
- package/lib/multiTab/RouteContent.jsx +0 -90
- package/lib/multiTab/RouteKeepAlive.js +0 -183
- package/lib/multiTab/events.js +0 -2
- package/lib/multiTab/index.js +0 -15
- package/lib/multiTab/index.less +0 -73
- package/lib/style/index.less +0 -2
- package/lib/tree/Directory.js +0 -428
- package/lib/tree/Tree.vue +0 -181
- package/lib/tree/style/Tree.less +0 -52
- package/method/Dialog.js +0 -134
- package/method/index.js +0 -12
- package/plugins/lib/amap/AmapDraw.jsx +0 -349
- package/plugins/lib/amap/AmapDraw.less +0 -45
- package/plugins/lib/amap/components/AmapSearch/index.jsx +0 -73
- package/plugins/lib/amap/index.js +0 -13
- package/plugins/lib/avatar/index.js +0 -7
- package/plugins/lib/avatar/index.vue +0 -47
- package/plugins/lib/basic/404.vue +0 -24
- package/plugins/lib/browse/index.jsx +0 -76
- package/plugins/lib/browse/index.less +0 -4
- package/plugins/lib/button/Button.js +0 -89
- package/plugins/lib/button/index.js +0 -7
- package/plugins/lib/dateTime/index.js +0 -7
- package/plugins/lib/descriptions/index.jsx +0 -108
- package/plugins/lib/descriptions/index.less +0 -15
- package/plugins/lib/form/components/ARadio.vue +0 -74
- package/plugins/lib/form/components/ARangePicker.vue +0 -129
- package/plugins/lib/form/components/ASelectCustom.vue +0 -226
- package/plugins/lib/form/components/ATagsInput.vue +0 -93
- package/plugins/lib/form/components/ATimePicker.vue +0 -73
- package/plugins/lib/form/components/AUpload.vue +0 -183
- package/plugins/lib/form/components/RenderComp.vue +0 -69
- package/plugins/lib/form/index.js +0 -55
- package/plugins/lib/form/style/Model.less +0 -53
- package/plugins/lib/form/utils/resetFields.js +0 -16
- package/plugins/lib/iframe/events.js +0 -2
- package/plugins/lib/iframe/index.jsx +0 -234
- package/plugins/lib/iframe/index.less +0 -19
- package/plugins/lib/index.js +0 -72
- package/plugins/lib/lazy_use.js +0 -40
- package/plugins/lib/modal/index.jsx +0 -53
- package/plugins/lib/modal/index.less +0 -50
- package/plugins/lib/multiTab/APIEnums.js +0 -17
- package/plugins/lib/multiTab/MultiTab.jsx +0 -237
- package/plugins/lib/multiTab/RouteAPI.js +0 -71
- package/plugins/lib/multiTab/RouteContent.jsx +0 -90
- package/plugins/lib/multiTab/RouteKeepAlive.js +0 -183
- package/plugins/lib/multiTab/events.js +0 -2
- package/plugins/lib/multiTab/index.js +0 -15
- package/plugins/lib/multiTab/index.less +0 -73
- package/plugins/lib/style/index.less +0 -2
- package/plugins/lib/style/mixins.less +0 -79
- package/plugins/lib/svgIcon/index.js +0 -7
- package/plugins/lib/svgIcon/index.vue +0 -77
- package/plugins/lib/table/index.js +0 -7
- package/plugins/lib/table/index.vue +0 -217
- package/plugins/lib/table/style/index.less +0 -50
- package/plugins/lib/tree/index.js +0 -17
- package/plugins/lib/tree/style/Directory.less +0 -119
- package/plugins/lib/weather/index.js +0 -7
- package/plugins/lib/weather/index.vue +0 -58
- package/plugins/method/AMap.js +0 -368
- package/plugins/method/PageLoading.jsx +0 -106
- package/plugins/method/Theme.js +0 -88
- package/plugins/method/index.js +0 -12
- package/plugins/store/auth.js +0 -31
- package/plugins/store/cache.js +0 -56
- package/plugins/store/chat.js +0 -74
- package/plugins/store/project.js +0 -46
- package/plugins/utils/Axios.js +0 -105
- package/plugins/utils/Base64.js +0 -314
- package/plugins/utils/Filter.js +0 -249
- package/plugins/utils/PostMessage.js +0 -16
- package/plugins/utils/Postcss.js +0 -9
- package/plugins/utils/Rem.js +0 -24
- package/plugins/utils/Request.js +0 -38
- package/plugins/utils/Storage.js +0 -73
- package/plugins/utils/Tree.js +0 -169
- package/plugins/utils/Utils.js +0 -51
- package/plugins/utils/Validate.js +0 -33
- package/plugins/utils/Websocket.js +0 -186
- package/utils/PostMessage.js +0 -16
- package/utils/Request.js +0 -38
- /package/{method → extensions}/PageLoading.jsx +0 -0
- /package/{method → extensions}/Theme.js +0 -0
- /package/{plugins/font → font}/DS-DIGI-1.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIB-2.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGII-3.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIT-4.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Black.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Bold.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Medium.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Regular.ttf +0 -0
- /package/{plugins/font → font}/PANGMENZHENGDAOBIAOTITI-1.TTF +0 -0
- /package/{plugins/font → font}/PingFang SC.ttf +0 -0
- /package/{plugins/font → font}/YouSheBiaoTiHei.ttf +0 -0
- /package/{plugins/font → font}/font.css +0 -0
- /package/{plugins/font → font}//345/255/227/351/255/20235/345/217/267-/347/273/217/345/205/270/351/233/205/351/273/221.ttf" +0 -0
- /package/lib/browse/{index.less → style/index.less} +0 -0
- /package/{dist/css/index.css → lib/button/style/index.less} +0 -0
- /package/lib/{dateTime → date-time}/index.js +0 -0
- /package/lib/{descriptions → descriptions-list/style}/index.less +0 -0
- /package/lib/{form/components → form-comp}/RenderComp.vue +0 -0
- /package/lib/{svgIcon → svg-icon}/index.js +0 -0
package/lib/amap/index.js
DELETED
package/lib/avatar/index.js
DELETED
package/lib/avatar/index.vue
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Dropdown placement="bottomRight">
|
|
3
|
-
<span class="ant-pro-account-avatar" style="margin-right: 12px; margin-bottom: 6px;">
|
|
4
|
-
<slot name="avatar" />
|
|
5
|
-
</span>
|
|
6
|
-
<Menu class="ant-pro-drop-down menu" slot="overlay" >
|
|
7
|
-
<MenuItem key="logout" @click="handleLogout">
|
|
8
|
-
<Icon type="logout" />
|
|
9
|
-
退出登录
|
|
10
|
-
</MenuItem>
|
|
11
|
-
</Menu>
|
|
12
|
-
</Dropdown>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script>
|
|
16
|
-
import { Modal, Dropdown, Menu, Icon } from 'ant-design-vue'
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: 'Avatar',
|
|
20
|
-
components: {
|
|
21
|
-
Dropdown,
|
|
22
|
-
Menu,
|
|
23
|
-
MenuItem: Menu.Item,
|
|
24
|
-
Icon
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
logoutMessage: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: '确定要退出登录吗?'
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
handleLogout (e) {
|
|
34
|
-
Modal.confirm({
|
|
35
|
-
content: this.logoutMessage,
|
|
36
|
-
onOk: () => {
|
|
37
|
-
return this.$emit('handleLogout')
|
|
38
|
-
},
|
|
39
|
-
onCancel () {}
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<style lang="less" scoped>
|
|
47
|
-
</style>
|
package/lib/basic/404.vue
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Result status="404" title="404" sub-title="对不起,您访问的页面不存在">
|
|
3
|
-
<template #extra>
|
|
4
|
-
<Button type="primary" @click="toHomePage">返回首页</Button>
|
|
5
|
-
</template>
|
|
6
|
-
</Result>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
import { mapGetters } from 'vuex'
|
|
11
|
-
import { Result, Button } from 'ant-design-vue'
|
|
12
|
-
export default {
|
|
13
|
-
name: 'Exception404',
|
|
14
|
-
components: { Result, Button },
|
|
15
|
-
computed: {
|
|
16
|
-
...mapGetters(['toHome'])
|
|
17
|
-
},
|
|
18
|
-
methods: {
|
|
19
|
-
toHomePage() {
|
|
20
|
-
this.$router.replace(this.toHome ?? '/')
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
</script>
|
package/lib/dateTime/index.vue
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="dateTime">
|
|
3
|
-
<span class="dateTime__Date">{{ time | formatDate('{y}.{m}.{d}') }}</span>
|
|
4
|
-
<span class="dateTime__Week">星期{{ time | formatDate('{a}') }}</span>
|
|
5
|
-
<span class="dateTime__Time">{{ time | formatDate('{h}:{i}:{s}') }}</span>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
|
|
11
|
-
import {formatDate} from '../../utils/Filter'
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
name: 'dateTime',
|
|
15
|
-
data() {
|
|
16
|
-
return {
|
|
17
|
-
time: new Date(),
|
|
18
|
-
timer: null
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
filters: {
|
|
22
|
-
formatDate
|
|
23
|
-
},
|
|
24
|
-
mounted() {
|
|
25
|
-
this.timer = setInterval(
|
|
26
|
-
() => this.time = new Date(), 1000 )
|
|
27
|
-
},
|
|
28
|
-
destroyed() {
|
|
29
|
-
clearInterval(this.timer)
|
|
30
|
-
this.timer = null
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<style scoped lang="less">
|
|
38
|
-
.dateTime {
|
|
39
|
-
display: flex;
|
|
40
|
-
gap: 0 14px;
|
|
41
|
-
font-size: 16px;
|
|
42
|
-
}
|
|
43
|
-
</style>
|
package/lib/form/Model.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { FormModel } from 'ant-design-vue'
|
|
2
|
-
import { getFormWidth, setFormItemRule, setFormItem } from './utils/render'
|
|
3
|
-
|
|
4
|
-
import './style/Model.less'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
name: 'Model',
|
|
8
|
-
model: {
|
|
9
|
-
prop: 'value',
|
|
10
|
-
event: 'Change:Model'
|
|
11
|
-
},
|
|
12
|
-
data() {
|
|
13
|
-
return {
|
|
14
|
-
formRules: {}
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
props: {
|
|
18
|
-
value: {
|
|
19
|
-
type: Object,
|
|
20
|
-
default: () => ({})
|
|
21
|
-
},
|
|
22
|
-
/* Form布局方式 */
|
|
23
|
-
layout: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: 'vertical'
|
|
26
|
-
},
|
|
27
|
-
/* 一行显示几个 PS:最多5个 */
|
|
28
|
-
layoutSize: {
|
|
29
|
-
type: Number,
|
|
30
|
-
default: 4,
|
|
31
|
-
validator: value => {
|
|
32
|
-
return value <= 5
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
/* 表单项配置 */
|
|
36
|
-
formSetting: Array
|
|
37
|
-
},
|
|
38
|
-
computed: {
|
|
39
|
-
form: {
|
|
40
|
-
get() {
|
|
41
|
-
/** 校验单独赋值延迟的字段 */
|
|
42
|
-
for (const k in this.value) {
|
|
43
|
-
Object.hasOwnProperty.call(this.formRules, k) && this.$refs.FormModel?.validateField(k)
|
|
44
|
-
}
|
|
45
|
-
return this.value
|
|
46
|
-
},
|
|
47
|
-
set(value) {
|
|
48
|
-
this.$emit('Change:Model', value)
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
formAttrs() {
|
|
52
|
-
let attr = {
|
|
53
|
-
labelCol: { span: 4 },
|
|
54
|
-
wrapperCol: { span: 20 },
|
|
55
|
-
...this.$attrs
|
|
56
|
-
}
|
|
57
|
-
this.layout === 'vertical' && (
|
|
58
|
-
delete attr.labelCol,
|
|
59
|
-
delete attr.wrapperCol
|
|
60
|
-
)
|
|
61
|
-
return attr
|
|
62
|
-
},
|
|
63
|
-
filterSetting() {
|
|
64
|
-
return this.formSetting.filter(settingItem => !settingItem.hidden)
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
watch: {
|
|
68
|
-
filterSetting: {
|
|
69
|
-
handler(newVal, oldVal) {
|
|
70
|
-
newVal.forEach(node =>
|
|
71
|
-
this.$set(this.formRules, node.model, setFormItemRule.call(this, node))
|
|
72
|
-
)
|
|
73
|
-
},
|
|
74
|
-
immediate: true
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
mounted() {
|
|
78
|
-
this.$emit('update:refForm', this.$refs.FormModel)
|
|
79
|
-
},
|
|
80
|
-
methods: {
|
|
81
|
-
/** 包含单表单项,多表单项,动态增减表单项合并处理 */
|
|
82
|
-
setModelRender(props) {
|
|
83
|
-
const dynamicModel = this.form[props.model]
|
|
84
|
-
return (
|
|
85
|
-
/**
|
|
86
|
-
* multiple为动态多项
|
|
87
|
-
* multipleConfig为配置的动态项数据 */
|
|
88
|
-
<div class={props.multiple && ['MultipleForm']} {...{ attrs: { style: getFormWidth.call(this, props, this.layoutSize) } }}>
|
|
89
|
-
{/* 使用场景:添加分层提示信息及其他隔层操作 */}
|
|
90
|
-
{this.$scopedSlots[`${props.model}Tips`] && this.$scopedSlots[`${props.model}Tips`](props)}
|
|
91
|
-
{
|
|
92
|
-
/** 处理动态增减表单 */
|
|
93
|
-
dynamicModel instanceof Array && props.multiple ?
|
|
94
|
-
dynamicModel.map( (modelItem, index) =>
|
|
95
|
-
props.multipleConfig.map( (configItem, key) => {
|
|
96
|
-
/** 为动态项时重新定义绑定key、prop等来进行检验 */
|
|
97
|
-
/** 目前还有一个动态项layoutSize排版问题 */
|
|
98
|
-
const childAttrs = {
|
|
99
|
-
key: index,
|
|
100
|
-
prop: `${props.model}.${index}.${configItem.model}`,
|
|
101
|
-
style: getFormWidth.call(this, configItem, this.layoutSize ?? props.layoutSize),
|
|
102
|
-
rules: setFormItemRule.call(this, configItem, props),
|
|
103
|
-
parentModel: props.model
|
|
104
|
-
}
|
|
105
|
-
return setFormItem.call(this, h, modelItem, configItem, childAttrs)
|
|
106
|
-
} )
|
|
107
|
-
) :
|
|
108
|
-
setFormItem.call(this, h, this.form, props)
|
|
109
|
-
}
|
|
110
|
-
{/* 使用场景:如另起一行添加其他额外信息及操作 */}
|
|
111
|
-
{this.$scopedSlots[`${props.model}Operate`] && this.$scopedSlots[`${props.model}Operate`](props)}
|
|
112
|
-
</div>
|
|
113
|
-
)
|
|
114
|
-
},
|
|
115
|
-
/** 提交测验 */
|
|
116
|
-
formSubmit() {
|
|
117
|
-
return new Promise((resolve, reject) => {
|
|
118
|
-
this.$refs.FormModel.validate()
|
|
119
|
-
.then(resolve)
|
|
120
|
-
.catch(err =>
|
|
121
|
-
this.$nextTick(() => {
|
|
122
|
-
const errorDiv = document.getElementsByClassName('has-error')
|
|
123
|
-
errorDiv[0].scrollIntoView({
|
|
124
|
-
behavior: "smooth",
|
|
125
|
-
block: "center"
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
)
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
render() {
|
|
133
|
-
const {layout, formAttrs, setModelRender} = this
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<FormModel
|
|
137
|
-
ref="FormModel"
|
|
138
|
-
class="FormModel"
|
|
139
|
-
props={{
|
|
140
|
-
model: this.form,
|
|
141
|
-
rules: this.formRules,
|
|
142
|
-
layout,
|
|
143
|
-
...formAttrs
|
|
144
|
-
}}
|
|
145
|
-
>
|
|
146
|
-
{
|
|
147
|
-
this.$slots.default ??
|
|
148
|
-
this.filterSetting.map(props => setModelRender(props))
|
|
149
|
-
}
|
|
150
|
-
</FormModel>
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
}
|
package/lib/form/Search.vue
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FormModel :model="form" ref="searchForm" layout="inline" @submit="handleSearch" class="WebComponentFormSearch">
|
|
3
|
-
|
|
4
|
-
<template v-for="(node, i) in copyFormSetting.slice(0, count)" v-if="!node.hidden">
|
|
5
|
-
<FormModelItem
|
|
6
|
-
:key="i"
|
|
7
|
-
:prop="node.model"
|
|
8
|
-
:label="node.label"
|
|
9
|
-
:style="getFormWidth(node, matchMediaSize)"
|
|
10
|
-
>
|
|
11
|
-
<RenderComp
|
|
12
|
-
v-on="node.event"
|
|
13
|
-
v-bind="node.attrs"
|
|
14
|
-
v-model="form[node.model]"
|
|
15
|
-
:component="node.is || 'Input'"
|
|
16
|
-
/>
|
|
17
|
-
</FormModelItem>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<div class="WebComponentFormSearch__Actions">
|
|
21
|
-
<Button type="primary" html-type="submit">{{ actionsText.primary }}</Button>
|
|
22
|
-
<Button :style="{ marginLeft: '8px' }" @click="handleReset">{{ actionsText.cancel }}</Button>
|
|
23
|
-
<a @click="advanced = !advanced" style="margin-left: 8px" v-if="copyFormSetting.length > this.matchMediaSize - 1">
|
|
24
|
-
{{ advanced ? '收起' : '展开' }}
|
|
25
|
-
<Icon :type="advanced ? 'up' : 'down'" />
|
|
26
|
-
</a>
|
|
27
|
-
</div>
|
|
28
|
-
</FormModel>
|
|
29
|
-
</template>
|
|
30
|
-
<script>
|
|
31
|
-
|
|
32
|
-
import resetFields from './utils/resetFields'
|
|
33
|
-
import RenderComp from './components/RenderComp.vue'
|
|
34
|
-
import { Icon, Button, FormModel } from 'ant-design-vue'
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
name: 'Search',
|
|
38
|
-
components: {
|
|
39
|
-
Icon,
|
|
40
|
-
Button,
|
|
41
|
-
FormModel,
|
|
42
|
-
FormModelItem: FormModel.Item,
|
|
43
|
-
RenderComp
|
|
44
|
-
},
|
|
45
|
-
data() {
|
|
46
|
-
return {
|
|
47
|
-
// 是否收起
|
|
48
|
-
advanced: false,
|
|
49
|
-
matchMediaSize: 0
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
model: {
|
|
53
|
-
prop: 'value',
|
|
54
|
-
event: 'change'
|
|
55
|
-
},
|
|
56
|
-
props: {
|
|
57
|
-
/* 双向数据绑定Form */
|
|
58
|
-
value: {
|
|
59
|
-
type: Object,
|
|
60
|
-
default: () => ({})
|
|
61
|
-
},
|
|
62
|
-
/* 配置表单项 */
|
|
63
|
-
formSetting: {
|
|
64
|
-
type: Array,
|
|
65
|
-
default: () => []
|
|
66
|
-
},
|
|
67
|
-
/* 一行显示多少项 */
|
|
68
|
-
layoutSize: {
|
|
69
|
-
type: Number,
|
|
70
|
-
default: 4,
|
|
71
|
-
validator: value => {
|
|
72
|
-
return value <= 5
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
// 紧凑型和宽松型
|
|
76
|
-
// default 宽松型
|
|
77
|
-
// middle 紧凑型
|
|
78
|
-
searchStyle: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: 'default'
|
|
81
|
-
},
|
|
82
|
-
/* 操作显示文字 */
|
|
83
|
-
actionsText: {
|
|
84
|
-
type: Object,
|
|
85
|
-
default: () => ({
|
|
86
|
-
primary: '搜索',
|
|
87
|
-
cancel: '重置'
|
|
88
|
-
})
|
|
89
|
-
},
|
|
90
|
-
/* 是否自动查询(默认为true) */
|
|
91
|
-
autoCall: {
|
|
92
|
-
type: Boolean,
|
|
93
|
-
default: true
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
computed: {
|
|
97
|
-
form: {
|
|
98
|
-
get() {
|
|
99
|
-
return this.value
|
|
100
|
-
},
|
|
101
|
-
set(newValue) {
|
|
102
|
-
this.$emit('change', newValue)
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
matchMedia() {
|
|
106
|
-
return {
|
|
107
|
-
'(max-width: 576px)': 1,
|
|
108
|
-
'(min-width: 576px) and (max-width: 992px)': this.layoutSize - 2,
|
|
109
|
-
'(min-width: 992px)': this.layoutSize
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
copyFormSetting() {
|
|
113
|
-
return this.formSetting.filter(node => !node.hidden)
|
|
114
|
-
},
|
|
115
|
-
count() {
|
|
116
|
-
return this.advanced ? this.copyFormSetting.length : this.matchMediaSize - 1
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
mounted() {
|
|
120
|
-
this.autoCall && this.handleSearch()
|
|
121
|
-
this.matchMediaSize = this.layoutSize
|
|
122
|
-
Object.keys(this.matchMedia).forEach(media =>
|
|
123
|
-
window.matchMedia(media).addEventListener('change', this.handleResize)
|
|
124
|
-
)
|
|
125
|
-
},
|
|
126
|
-
methods: {
|
|
127
|
-
handleResize(x) {
|
|
128
|
-
x.matches && (this.matchMediaSize = this.matchMedia[x.media])
|
|
129
|
-
},
|
|
130
|
-
getFormWidth(e) {
|
|
131
|
-
const gap = {
|
|
132
|
-
middle: '16px',
|
|
133
|
-
default: '24px'
|
|
134
|
-
}
|
|
135
|
-
return `flex: 0 1 calc((${(100 / this.matchMediaSize) * (e.size ?? 1)}% - ${
|
|
136
|
-
gap[this.searchStyle]
|
|
137
|
-
})); margin-right: ${gap[this.searchStyle]};`
|
|
138
|
-
},
|
|
139
|
-
handleSearch(e) {
|
|
140
|
-
e && e.preventDefault()
|
|
141
|
-
const searchForm = {}
|
|
142
|
-
// 排除掉form当中hidden的隐藏项
|
|
143
|
-
this.copyFormSetting.forEach(node =>
|
|
144
|
-
this.$set( searchForm, node.model, this.form[node.model] ))
|
|
145
|
-
this.form = { ...searchForm }
|
|
146
|
-
this.$emit('handleSearch', searchForm)
|
|
147
|
-
},
|
|
148
|
-
handleReset() {
|
|
149
|
-
// 初步猜测是因这里的清空导致数据双向绑定得不到最新
|
|
150
|
-
this.form = resetFields(this.form)
|
|
151
|
-
this.$refs.searchForm.clearValidate()
|
|
152
|
-
this.$emit('handleReset')
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
</script>
|
|
157
|
-
<style lang="less" scoped>
|
|
158
|
-
@import url('./style/Search.less');
|
|
159
|
-
</style>
|