@aochuang/common 1.0.0 → 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/common/loading/index.js +7 -0
- package/common/loading/loading.vue +71 -0
- package/common/tips/index.js +7 -0
- package/common/tips/tips.vue +82 -0
- package/common/tooltip/index.js +7 -0
- package/common/tooltip/popper.js +18 -0
- package/common/tooltip/tooltip.vue +55 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-boolean.vue +33 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date-range.vue +30 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime-range.vue +34 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number-range.vue +67 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number.vue +35 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-string.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-value.vue +73 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item.vue +226 -0
- package/components/advanced-filter/advanced-filter-condition-toggle.vue +112 -0
- package/components/advanced-filter/advanced-filter-condition.vue +352 -0
- package/components/advanced-filter/advanced-filter-permanent-item.vue +10 -0
- package/components/advanced-filter/advanced-filter-permanent.vue +10 -0
- package/components/advanced-filter/advanced-filter-scene-form.vue +95 -0
- package/components/advanced-filter/advanced-filter-scene-item.vue +64 -0
- package/components/advanced-filter/advanced-filter-scene-manage.vue +264 -0
- package/components/advanced-filter/advanced-filter-scene-transfer.vue +283 -0
- package/components/advanced-filter/advanced-filter-scene.vue +199 -0
- package/components/advanced-filter/advanced-filter.vue +114 -0
- package/components/advanced-filter/index.js +36 -0
- package/components/advanced-filter/utils.js +132 -0
- package/components/autocomplete/autocomplete.vue +121 -0
- package/components/autocomplete/index.js +7 -0
- package/components/avatar/avatar.png +0 -0
- package/components/avatar/avatar.vue +212 -0
- package/components/avatar/index.js +7 -0
- package/components/brick-wall/brick-wall-skeleton.vue +125 -0
- package/components/brick-wall/brick-wall.vue +293 -0
- package/components/brick-wall/index.js +7 -0
- package/components/button/button.vue +537 -0
- package/components/button/index.js +7 -0
- package/components/button/utils.js +20 -0
- package/components/cascader/cascader.vue +184 -0
- package/components/cascader/index.js +7 -0
- package/components/cascader/util.js +50 -0
- package/components/checkbox/checkbox.vue +114 -0
- package/components/checkbox/index.js +7 -0
- package/components/checkbox-button/index.js +8 -0
- package/components/checkbox-group/checkbox-group.vue +11 -0
- package/components/checkbox-group/index.js +7 -0
- package/components/date-picker/date-picker.vue +300 -0
- package/components/date-picker/index.js +7 -0
- package/components/dialog/dialog.vue +182 -0
- package/components/dialog/index.js +14 -0
- package/components/dialog/utils.js +20 -0
- package/components/drawer/drawer.vue +186 -0
- package/components/drawer/index.js +14 -0
- package/components/drawer/utils.js +36 -0
- package/components/dropdown/dropdown-item.vue +63 -0
- package/components/dropdown/dropdown.vue +286 -0
- package/components/dropdown/index.js +16 -0
- package/components/empty/empty.vue +62 -0
- package/components/empty/index.js +7 -0
- package/components/filter/filter-group.vue +44 -0
- package/components/filter/filter-item.vue +122 -0
- package/components/filter/filter-more.vue +114 -0
- package/components/filter/filter.vue +407 -0
- package/components/filter/index.js +20 -0
- package/components/filter/refresh-line.svg +1 -0
- package/components/filter/util.js +5 -0
- package/components/form/form-cell.vue +231 -0
- package/components/form/form-group.vue +147 -0
- package/components/form/form-row.vue +51 -0
- package/components/form/form.vue +256 -0
- package/components/form/index.js +13 -0
- package/components/grid/grid-card-view/grid-card-view.vue +157 -0
- package/components/grid/grid-column.vue +136 -0
- package/components/grid/grid-filter/grid-filter-group.vue +41 -0
- package/components/grid/grid-filter/grid-filter-item.vue +68 -0
- package/components/grid/grid-filter/grid-filter.vue +115 -0
- package/components/grid/grid-filter/util.js +7 -0
- package/components/grid/grid-filter-operate/grid-filter-operate-item.vue +55 -0
- package/components/grid/grid-filter-operate/grid-filter-operate.vue +46 -0
- package/components/grid/grid-sort/grid-sort-proxy.js +27 -0
- package/components/grid/grid-sort/grid-sort.vue +205 -0
- package/components/grid/grid-sort/icons/asc.png +0 -0
- package/components/grid/grid-sort/icons/desc.png +0 -0
- package/components/grid/grid-sort/index.js +7 -0
- package/components/grid/grid-table-view/grid-table-view.vue +178 -0
- package/components/grid/grid-table.vue +547 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar.vue +129 -0
- package/components/grid/grid-toolbar/grid-global-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-global-toolbar.vue +37 -0
- package/components/grid/grid-toolbar/grid-more-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-more-toolbar.vue +138 -0
- package/components/grid/grid-toolbar/grid-row-toolbar.vue +279 -0
- package/components/grid/grid-view-select.vue +78 -0
- package/components/grid/grid.vue +1102 -0
- package/components/grid/icons/more-line.svg +1 -0
- package/components/grid/icons/refresh.svg +14 -0
- package/components/grid/index.js +61 -0
- package/components/grid/util.js +31 -0
- package/components/icon/demo.css +539 -0
- package/components/icon/demo_index.html +7433 -0
- package/components/icon/icon.vue +96 -0
- package/components/icon/iconfont.css +1275 -0
- package/components/icon/iconfont.eot +0 -0
- package/components/icon/iconfont.js +1 -0
- package/components/icon/iconfont.json +2214 -0
- package/components/icon/iconfont.svg +455 -0
- package/components/icon/iconfont.ttf +0 -0
- package/components/icon/iconfont.woff +0 -0
- package/components/icon/iconfont.woff2 +0 -0
- package/components/icon/index.js +7 -0
- package/components/image/image.vue +299 -0
- package/components/image/index.js +12 -0
- package/components/image/util.js +26 -0
- package/components/index.js +153 -0
- package/components/loading/index.js +7 -0
- package/components/loading/loading.vue +130 -0
- package/components/menu/index.js +14 -0
- package/components/menu/menu-group.vue +240 -0
- package/components/menu/menu-item.vue +215 -0
- package/components/menu/menu.vue +64 -0
- package/components/message/index.js +19 -0
- package/components/message/message.js +28 -0
- package/components/message/message.less +6 -0
- package/components/message-box/index.js +10 -0
- package/components/message-box/message-box.js +140 -0
- package/components/message-box/message-box.less +5 -0
- package/components/pagination/index.js +7 -0
- package/components/pagination/pagination.vue +193 -0
- package/components/panel/index.js +7 -0
- package/components/panel/panel.vue +44 -0
- package/components/popover/index.js +7 -0
- package/components/popover/popover.vue +140 -0
- package/components/popup-select/index.js +7 -0
- package/components/popup-select/popup-select.vue +114 -0
- package/components/radio/index.js +7 -0
- package/components/radio/radio.vue +92 -0
- package/components/radio-button/index.js +7 -0
- package/components/radio-button/radio-button.vue +20 -0
- package/components/radio-group/index.js +7 -0
- package/components/radio-group/radio-group.vue +22 -0
- package/components/searchbox/index.js +7 -0
- package/components/searchbox/searchbox.vue +260 -0
- package/components/select/index.js +9 -0
- package/components/select/select-load-more.vue +53 -0
- package/components/select/select.vue +572 -0
- package/components/skeleton/index.js +14 -0
- package/components/skeleton/skeleton-rows.vue +52 -0
- package/components/skeleton/skeleton.vue +72 -0
- package/components/sortable/index.js +9 -0
- package/components/sortable/sortable-item.vue +77 -0
- package/components/sortable/sortable.vue +62 -0
- package/components/spinner/index.js +7 -0
- package/components/spinner/spinner.vue +121 -0
- package/components/spinner-range/index.js +7 -0
- package/components/spinner-range/spinner-range.vue +97 -0
- package/components/spinner-textarea/index.js +7 -0
- package/components/spinner-textarea/spinner-textarea.vue +65 -0
- package/components/switch/index.js +7 -0
- package/components/switch/switch.vue +105 -0
- package/components/tabs/index.js +10 -0
- package/components/tabs/tabs.vue +115 -0
- package/components/tag/index.js +9 -0
- package/components/tag/tag.less +30 -0
- package/components/text/index.js +7 -0
- package/components/text/text.vue +69 -0
- package/components/textarea/index.js +7 -0
- package/components/textarea/textarea.vue +229 -0
- package/components/textbox/index.js +7 -0
- package/components/textbox/textbox.vue +275 -0
- package/components/time-picker/index.js +7 -0
- package/components/time-picker/time-picker.vue +77 -0
- package/components/toolbar/index.js +14 -0
- package/components/toolbar/toolbar-item.vue +43 -0
- package/components/toolbar/toolbar.vue +81 -0
- package/components/tooltip/index.js +9 -0
- package/components/tooltip/tooltip.vue +86 -0
- package/components/transfer/index.js +7 -0
- package/components/transfer/transfer-load-more.vue +53 -0
- package/components/transfer/transfer.vue +245 -0
- package/components/tree/index.js +7 -0
- package/components/tree/tree.vue +326 -0
- package/components/tree/utils.js +122 -0
- package/components/video/index.js +7 -0
- package/components/video/video.vue +53 -0
- package/package.json +4 -1
- package/utils/date.js +55 -0
- package/utils/emitter.js +3 -0
- package/utils/json.js +19 -0
- package/utils/resize-event.js +35 -0
- package/utils/util.js +12 -0
- package/utils/utils.js +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-form-group" :class="[{'is-divided': divided, 'is-viewable': viewable}, 'ui-form-group--' + type]">
|
|
3
|
+
<div class="ui-form-group__head" v-if="label || $slots.label">
|
|
4
|
+
<div class="ui-form-group__head-left">
|
|
5
|
+
<div class="ui-form-group__head-item">
|
|
6
|
+
<h5 class="ui-form-group__title">
|
|
7
|
+
<slot name="label">{{label}}</slot>
|
|
8
|
+
</h5>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="ui-form-group__head-item" v-if="$slots['head-prepend']">
|
|
11
|
+
<slot name="head-prepend"></slot>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="ui-form-group__head-right">
|
|
15
|
+
<div class="ui-form-group__toolbar" v-if="$slots.toolbar">
|
|
16
|
+
<slot name="toolbar"></slot>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="ui-form-group__body">
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
<script>
|
|
26
|
+
export default {
|
|
27
|
+
name: 'UiFormGroup',
|
|
28
|
+
inject: ['UiForm'],
|
|
29
|
+
props: {
|
|
30
|
+
label: {
|
|
31
|
+
type: String
|
|
32
|
+
},
|
|
33
|
+
divided: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
computed: {
|
|
39
|
+
type () {
|
|
40
|
+
return this.UiForm.type
|
|
41
|
+
},
|
|
42
|
+
viewable () {
|
|
43
|
+
return this.UiForm.viewable
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
<style lang="less">
|
|
49
|
+
.ui-form-group{
|
|
50
|
+
&.is-divided{
|
|
51
|
+
border-bottom: 1px solid #eee;
|
|
52
|
+
padding-bottom: 10px;
|
|
53
|
+
margin-bottom: 18px;
|
|
54
|
+
&:last-child{
|
|
55
|
+
border-bottom: initial;
|
|
56
|
+
padding-bottom: initial;
|
|
57
|
+
margin-bottom: initial;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
.ui-form-group__head{
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: row;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
}
|
|
67
|
+
.ui-form-group__head-item{
|
|
68
|
+
margin-right: 12px;
|
|
69
|
+
}
|
|
70
|
+
.ui-form-group__title{
|
|
71
|
+
font-weight: normal;
|
|
72
|
+
font-size: 14px;
|
|
73
|
+
margin: 0;
|
|
74
|
+
font-weight: bold;
|
|
75
|
+
display: inline-block;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
|
78
|
+
.ui-form-group__head-left{
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: row;
|
|
81
|
+
align-items: center;
|
|
82
|
+
.ui-form-group__head-item{
|
|
83
|
+
+ .ui-form-group__head-item{
|
|
84
|
+
padding-left: 12px;
|
|
85
|
+
position: relative;
|
|
86
|
+
&:before {
|
|
87
|
+
content: '';
|
|
88
|
+
position: absolute;
|
|
89
|
+
height: 16px;
|
|
90
|
+
width: 1px;
|
|
91
|
+
left: 0;
|
|
92
|
+
top: 50%;
|
|
93
|
+
transform: translateY(-50%);
|
|
94
|
+
background-color: #ddd;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
.ui-form-group--default{
|
|
100
|
+
padding-left: 20px;
|
|
101
|
+
padding-right: 20px;
|
|
102
|
+
margin-left: -20px;
|
|
103
|
+
margin-right: -20px;
|
|
104
|
+
&.is-divided{
|
|
105
|
+
border-bottom: 12px solid #f7f6f9;
|
|
106
|
+
}
|
|
107
|
+
.ui-form-group__head{
|
|
108
|
+
background: #fff;
|
|
109
|
+
border: 0;
|
|
110
|
+
padding-left: 0;
|
|
111
|
+
height: 24px;
|
|
112
|
+
line-height: 24px;
|
|
113
|
+
}
|
|
114
|
+
.ui-form-group__title {
|
|
115
|
+
font-weight: bold;
|
|
116
|
+
}
|
|
117
|
+
&:not(.is-viewable) {
|
|
118
|
+
.ui-form-group__head{
|
|
119
|
+
margin-bottom: 18px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
&.is-viewable {
|
|
123
|
+
.ui-form-group__head{
|
|
124
|
+
margin-bottom: 6px;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
.ui-form-group--column{
|
|
129
|
+
.ui-form-group__head{
|
|
130
|
+
height: 34px;
|
|
131
|
+
line-height: 34px;
|
|
132
|
+
background-color: #f6f6f6;
|
|
133
|
+
padding: 0 12px;
|
|
134
|
+
border-radius: 3px;
|
|
135
|
+
}
|
|
136
|
+
.ui-form-group__body{
|
|
137
|
+
padding: 12px;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
.ui-form-group__body{
|
|
141
|
+
&:after{
|
|
142
|
+
content: '';
|
|
143
|
+
display: block;
|
|
144
|
+
clear: both;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-row class="ui-form-row" :class="{'is-full': isFull}" :gutter="gutter">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</el-row>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
import Row from 'element-ui/lib/row'
|
|
8
|
+
import 'element-ui/lib/theme-chalk/row.css'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'UiFormRow',
|
|
12
|
+
components: {
|
|
13
|
+
ElRow: Row
|
|
14
|
+
},
|
|
15
|
+
props: {
|
|
16
|
+
isFull: {
|
|
17
|
+
type: Boolean
|
|
18
|
+
},
|
|
19
|
+
gutter: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 40
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
<style lang="less">
|
|
27
|
+
.ui-form-row.el-row{
|
|
28
|
+
margin-bottom: 0;
|
|
29
|
+
margin: 0;
|
|
30
|
+
&.is-full {
|
|
31
|
+
flex: 1;
|
|
32
|
+
min-height: 0;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
> .ui-form-cell{
|
|
36
|
+
flex: 1;
|
|
37
|
+
min-height: 0;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
> .el-form-item {
|
|
41
|
+
flex: 1;
|
|
42
|
+
min-height: 0;
|
|
43
|
+
> .el-form-item__content{
|
|
44
|
+
flex: 1;
|
|
45
|
+
min-height: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-form
|
|
3
|
+
class="ui-form"
|
|
4
|
+
:class="[
|
|
5
|
+
{'has-toolbar': $slots.toolbar, 'is-stretch': stretch, 'is-fixed-height' : isFixedHeight, 'is-padding': padding, 'is-viewable': viewable},
|
|
6
|
+
'ui-form--' + type
|
|
7
|
+
]"
|
|
8
|
+
ref="form"
|
|
9
|
+
:rules="mergeRules"
|
|
10
|
+
:model="model"
|
|
11
|
+
:label-width="labelWidth"
|
|
12
|
+
:validate-on-rule-change="false"
|
|
13
|
+
:label-position="labelPosition"
|
|
14
|
+
:style="style"
|
|
15
|
+
@submit.native.prevent
|
|
16
|
+
>
|
|
17
|
+
<div class="ui-form__main">
|
|
18
|
+
<slot></slot>
|
|
19
|
+
</div>
|
|
20
|
+
<div class="ui-form__toolbar" v-if="$slots.toolbar" :style="toolbarStyle">
|
|
21
|
+
<slot name="toolbar"></slot>
|
|
22
|
+
</div>
|
|
23
|
+
</el-form>
|
|
24
|
+
</template>
|
|
25
|
+
<script>
|
|
26
|
+
import Form from 'element-ui/lib/form'
|
|
27
|
+
import 'element-ui/lib/theme-chalk/form.css'
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: 'UiForm',
|
|
31
|
+
provide () {
|
|
32
|
+
return {
|
|
33
|
+
UiForm: this
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
components: {
|
|
37
|
+
ElForm: Form
|
|
38
|
+
},
|
|
39
|
+
props: {
|
|
40
|
+
type: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'default', // default | split
|
|
43
|
+
validator (value) {
|
|
44
|
+
return ['default', 'split', 'column'].includes(value)
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
height: {
|
|
48
|
+
type: String
|
|
49
|
+
},
|
|
50
|
+
model: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => ({})
|
|
53
|
+
},
|
|
54
|
+
rules: {
|
|
55
|
+
type: Object,
|
|
56
|
+
default: () => ({})
|
|
57
|
+
},
|
|
58
|
+
stretch: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false
|
|
61
|
+
},
|
|
62
|
+
padding: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
viewable: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
labelWidth: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '60px'
|
|
73
|
+
},
|
|
74
|
+
labelPosition: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: 'left'
|
|
77
|
+
},
|
|
78
|
+
fixedToolbar: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
fixedToolbarOffset: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 0
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
data () {
|
|
88
|
+
return {
|
|
89
|
+
toolbarRect: {},
|
|
90
|
+
dynamicRules: {}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
isFixedHeight () {
|
|
95
|
+
return !!this.height
|
|
96
|
+
},
|
|
97
|
+
style () {
|
|
98
|
+
const sy = {}
|
|
99
|
+
if (this.height) {
|
|
100
|
+
sy.height = this.height
|
|
101
|
+
}
|
|
102
|
+
return sy
|
|
103
|
+
},
|
|
104
|
+
toolbarStyle () {
|
|
105
|
+
if (!this.fixedToolbar) {
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
const marginBottom = this.fixedToolbarOffset + 'px'
|
|
109
|
+
return {
|
|
110
|
+
position: 'fixed',
|
|
111
|
+
left: this.toolbarRect.left + 'px',
|
|
112
|
+
width: this.toolbarRect.width + 'px',
|
|
113
|
+
bottom: this.toolbarRect.bottom + 'px',
|
|
114
|
+
marginBottom: marginBottom
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
mergeRules () {
|
|
118
|
+
const nextRules = {}
|
|
119
|
+
Object.keys(this.rules || {}).forEach(key => {
|
|
120
|
+
if (Array.isArray(this.rules[key])) {
|
|
121
|
+
nextRules[key] = [].concat(this.rules[key])
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
Object.keys(this.dynamicRules || {}).forEach(key => {
|
|
125
|
+
if (Array.isArray(this.dynamicRules[key])) {
|
|
126
|
+
if (nextRules[key]) {
|
|
127
|
+
nextRules[key] = nextRules[key].concat(this.dynamicRules[key])
|
|
128
|
+
} else {
|
|
129
|
+
nextRules[key] = [].concat(this.dynamicRules[key])
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
return nextRules
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
mounted () {
|
|
137
|
+
this.doLayout()
|
|
138
|
+
window.addEventListener('resize', this.handleWindowResize)
|
|
139
|
+
},
|
|
140
|
+
methods: {
|
|
141
|
+
handleWindowResize () {
|
|
142
|
+
this.doLayout()
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* 新增校验规则
|
|
146
|
+
* 比如有些场景是在组件内部配置的规则,如手机号组件,不是通过表单配置的
|
|
147
|
+
*/
|
|
148
|
+
addValidateRule (name, rules) {
|
|
149
|
+
if (!name || !rules || !rules.length) {
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
this.$set(this.dynamicRules, name, rules)
|
|
153
|
+
},
|
|
154
|
+
removeValidateRule (name) {
|
|
155
|
+
this.$delete(this.dynamicRules, name)
|
|
156
|
+
},
|
|
157
|
+
validate () {
|
|
158
|
+
return new Promise((resolve, reject) => {
|
|
159
|
+
this.$refs.form.validate((result) => {
|
|
160
|
+
result ? resolve() : reject()
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
},
|
|
164
|
+
validateField (field) {
|
|
165
|
+
return new Promise((resolve, reject) => {
|
|
166
|
+
this.$refs.form.validateField(field, (result) => {
|
|
167
|
+
result ? resolve() : reject()
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
},
|
|
171
|
+
doLayout () {
|
|
172
|
+
if (!this.fixedToolbar) {
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
const formRect = this.$el.getBoundingClientRect()
|
|
176
|
+
const toolbarRect = {
|
|
177
|
+
left: formRect.left,
|
|
178
|
+
width: formRect.width,
|
|
179
|
+
bottom: formRect.bottom >= window.innerHeight ? 0 : window.innerHeight - formRect.bottom
|
|
180
|
+
}
|
|
181
|
+
this.toolbarRect = toolbarRect
|
|
182
|
+
},
|
|
183
|
+
clearValidate () {
|
|
184
|
+
this.$refs.form.clearValidate()
|
|
185
|
+
},
|
|
186
|
+
resetFields () {
|
|
187
|
+
this.$refs.form.resetFields()
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
</script>
|
|
192
|
+
<style lang="less">
|
|
193
|
+
.ui-dialog{
|
|
194
|
+
.ui-form{
|
|
195
|
+
display: flex;
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
height: 100%;
|
|
198
|
+
}
|
|
199
|
+
.ui-form__main{
|
|
200
|
+
flex: 1;
|
|
201
|
+
min-height: 0;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
.ui-form{
|
|
205
|
+
position: relative;
|
|
206
|
+
min-height: 100%;
|
|
207
|
+
box-sizing: border-box;
|
|
208
|
+
&.has-toolbar{
|
|
209
|
+
padding-bottom: 63px;
|
|
210
|
+
}
|
|
211
|
+
&.is-stretch{
|
|
212
|
+
padding: 22px 0;
|
|
213
|
+
.ui-form-group{
|
|
214
|
+
padding-left: 20px;
|
|
215
|
+
padding-right: 20px;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
&.is-fixed-height{
|
|
219
|
+
display: flex;
|
|
220
|
+
> .ui-form__main{
|
|
221
|
+
flex: 1;
|
|
222
|
+
min-height: 0;
|
|
223
|
+
overflow-y: auto;
|
|
224
|
+
overflow-x: hidden;
|
|
225
|
+
display: flex;
|
|
226
|
+
flex-direction: column;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
&.is-padding{
|
|
230
|
+
> .ui-form__main{
|
|
231
|
+
padding: 20px 20px 8px;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
&.is-viewable{
|
|
235
|
+
.ui-form-cell {
|
|
236
|
+
.el-form-item {
|
|
237
|
+
margin-bottom: 6px;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
.ui-form .ui-form__toolbar{
|
|
243
|
+
padding: 15px 22px;
|
|
244
|
+
border-top: 1px solid #eee;
|
|
245
|
+
position: absolute;
|
|
246
|
+
left: 0;
|
|
247
|
+
right: 0;
|
|
248
|
+
bottom: 0;
|
|
249
|
+
box-sizing: border-box;
|
|
250
|
+
background-color: #fff;
|
|
251
|
+
z-index: 10;
|
|
252
|
+
}
|
|
253
|
+
.ui-form--column {
|
|
254
|
+
|
|
255
|
+
}
|
|
256
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Form from './form.vue'
|
|
2
|
+
import FormGroup from './form-group.vue'
|
|
3
|
+
import FormRow from './form-row.vue'
|
|
4
|
+
import FormCell from './form-cell.vue'
|
|
5
|
+
|
|
6
|
+
Form.install = (Vue) => {
|
|
7
|
+
Vue.component(Form.name, Form)
|
|
8
|
+
Vue.component(FormGroup.name, FormGroup)
|
|
9
|
+
Vue.component(FormRow.name, FormRow)
|
|
10
|
+
Vue.component(FormCell.name, FormCell)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default Form
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="currentViewName === 'card'"
|
|
4
|
+
class="ui-grid-card-view"
|
|
5
|
+
>
|
|
6
|
+
<ui-brick-wall
|
|
7
|
+
ref="brickWall"
|
|
8
|
+
height="100%"
|
|
9
|
+
:id-field="idField"
|
|
10
|
+
:data="data"
|
|
11
|
+
:span="span"
|
|
12
|
+
:base-width="baseWidth"
|
|
13
|
+
:multiple="multiple"
|
|
14
|
+
:selectable="multiple ? true : selectable"
|
|
15
|
+
@selection-change="handleSelectionChange"
|
|
16
|
+
@select-change="handleSelectChange"
|
|
17
|
+
>
|
|
18
|
+
<template slot="item" slot-scope="scope">
|
|
19
|
+
<slot name="item" :row="scope.data" :selected="scope.selected" :toolbar="toolbar"></slot>
|
|
20
|
+
</template>
|
|
21
|
+
</ui-brick-wall>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<script>
|
|
25
|
+
import UiBrickWall from '../../brick-wall'
|
|
26
|
+
import UiGridRowToolbar from '../grid-toolbar/grid-row-toolbar'
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'UiGridCardView',
|
|
30
|
+
inject: ['UiGrid'],
|
|
31
|
+
components: {
|
|
32
|
+
UiBrickWall,
|
|
33
|
+
UiGridRowToolbar
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
span: {
|
|
37
|
+
type: Number
|
|
38
|
+
},
|
|
39
|
+
baseWidth: {
|
|
40
|
+
type: Number
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
computed: {
|
|
44
|
+
idField () {
|
|
45
|
+
return this.UiGrid.idField
|
|
46
|
+
},
|
|
47
|
+
rowToolbar () {
|
|
48
|
+
return this.UiGrid.rowToolbar
|
|
49
|
+
},
|
|
50
|
+
currentViewName () {
|
|
51
|
+
return this.UiGrid.currentViewName
|
|
52
|
+
},
|
|
53
|
+
multiple () {
|
|
54
|
+
return this.UiGrid.multiple
|
|
55
|
+
},
|
|
56
|
+
selectable () {
|
|
57
|
+
return this.UiGrid.selectable
|
|
58
|
+
},
|
|
59
|
+
data () {
|
|
60
|
+
return this.UiGrid.tableData
|
|
61
|
+
},
|
|
62
|
+
toolbar () {
|
|
63
|
+
if (!this.rowToolbar || !this.rowToolbar.length) {
|
|
64
|
+
return null
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
functional: true,
|
|
68
|
+
props: {
|
|
69
|
+
row: {
|
|
70
|
+
type: Object,
|
|
71
|
+
required: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
render: (h, c) => {
|
|
75
|
+
return h(UiGridRowToolbar, {
|
|
76
|
+
props: {
|
|
77
|
+
row: c.props.row,
|
|
78
|
+
moreIconDir: 'horizon',
|
|
79
|
+
moreIconType: 'button',
|
|
80
|
+
items: this.rowToolbar.map(v => {
|
|
81
|
+
return {
|
|
82
|
+
...v,
|
|
83
|
+
more: true
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
created () {
|
|
93
|
+
this.UiGrid.addViewPanel({
|
|
94
|
+
label: '卡片',
|
|
95
|
+
name: 'card',
|
|
96
|
+
icon: `
|
|
97
|
+
<svg t="1717655840748" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="25904" width="200" height="200">
|
|
98
|
+
<path d="M824 160c22.092 0 40 17.908 40 40v624c0 22.092-17.908 40-40 40H200c-22.092 0-40-17.908-40-40V200c0-22.092 17.908-40 40-40z m-344 382H240V784h240v-242z m304 0h-224V784h224v-242zM480 240H240v222h240V240z m304 0h-224v222h224V240z" fill="currentColor"></path>
|
|
99
|
+
</svg>
|
|
100
|
+
`
|
|
101
|
+
})
|
|
102
|
+
},
|
|
103
|
+
watch: {
|
|
104
|
+
currentViewName () {
|
|
105
|
+
if (this.UiGrid.currentViewName === 'card') {
|
|
106
|
+
this.UiGrid.$control = this
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
data () {
|
|
110
|
+
this.$refs.brickWall && this.$refs.brickWall.clearSelection()
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
mounted () {
|
|
114
|
+
if (this.UiGrid.currentViewName === 'card') {
|
|
115
|
+
this.UiGrid.$control = this
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
methods: {
|
|
119
|
+
getSortColumns () {
|
|
120
|
+
return []
|
|
121
|
+
},
|
|
122
|
+
clearSelection () {
|
|
123
|
+
this.$refs.brickWall && this.$refs.brickWall.clearSelection()
|
|
124
|
+
},
|
|
125
|
+
toggleRowSelection(row, isSelected) {
|
|
126
|
+
this.$refs.brickWall && this.$refs.brickWall.toggleSelection(row, isSelected)
|
|
127
|
+
},
|
|
128
|
+
setCurrentRow(row) {
|
|
129
|
+
},
|
|
130
|
+
setCheckboxRow (rows, isSelected = true) {
|
|
131
|
+
this.$refs.brickWall && this.$refs.brickWall.toggleSelection(rows, isSelected)
|
|
132
|
+
},
|
|
133
|
+
setRadioRow (row) {
|
|
134
|
+
this.$refs.brickWall && this.$refs.brickWall.toggleSelection(row, isSelected)
|
|
135
|
+
},
|
|
136
|
+
handleSelectionChange (evt) {
|
|
137
|
+
this.UiGrid.handleCardViewSelectionChange(evt)
|
|
138
|
+
},
|
|
139
|
+
handleSelectChange (evt) {
|
|
140
|
+
this.UiGrid.handleSelectChange(evt ? {
|
|
141
|
+
row: evt.item
|
|
142
|
+
} : null)
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
beforeDestroy () {
|
|
146
|
+
this.UiGrid.removeViewPanel('card')
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
150
|
+
<style lang="less">
|
|
151
|
+
.ui-grid-card-view{
|
|
152
|
+
height: 100%;
|
|
153
|
+
overflow: auto;
|
|
154
|
+
padding-right: 18px;
|
|
155
|
+
margin-right: -24px;
|
|
156
|
+
}
|
|
157
|
+
</style>
|