@idooel/components 0.0.2-beta.3 → 0.0.2-beta.30
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 +98 -98
- package/dist/@idooel/components.esm.js +3622 -1592
- package/dist/@idooel/components.umd.js +3676 -1647
- package/jsconfig.json +7 -7
- package/package.json +64 -50
- package/packages/alert/index.js +4 -4
- package/packages/alert/src/index.vue +45 -45
- package/packages/batch-export/index.js +4 -4
- package/packages/batch-export/src/index.vue +104 -104
- package/packages/business-components/modal-fsm/index.js +4 -4
- package/packages/business-components/modal-fsm/src/index.vue +163 -163
- package/packages/business-components/modal-import/index.js +4 -4
- package/packages/business-components/modal-import/src/index.vue +222 -139
- package/packages/business-components/modal-timeline/index.js +4 -4
- package/packages/business-components/modal-timeline/src/index.vue +77 -77
- package/packages/business-components/tabs-sub-center/index.js +4 -4
- package/packages/business-components/tabs-sub-center/src/index.vue +116 -116
- package/packages/button/index.js +4 -4
- package/packages/button/src/index.vue +65 -65
- package/packages/checkbox/index.js +4 -4
- package/packages/checkbox/src/index.vue +52 -52
- package/packages/composite-components/button-group/index.js +4 -4
- package/packages/composite-components/button-group/src/index.vue +151 -151
- package/packages/composite-components/form-attachment/src/index.vue +14 -14
- package/packages/composite-components/form-img-crop/index.js +4 -4
- package/packages/composite-components/form-img-crop/src/index.vue +131 -131
- package/packages/composite-components/modal-confirm/index.js +4 -4
- package/packages/composite-components/modal-confirm/src/index.vue +103 -103
- package/packages/composite-components/modal-form/index.js +4 -4
- package/packages/composite-components/modal-form/src/index.vue +230 -230
- package/packages/composite-components/modal-img-crop/index.js +4 -4
- package/packages/composite-components/modal-img-crop/src/index.vue +298 -298
- package/packages/composite-components/modal-table/index.js +4 -4
- package/packages/composite-components/modal-table/src/index.vue +155 -155
- package/packages/composite-components/modal-tree/index.js +4 -4
- package/packages/composite-components/modal-tree/src/index.vue +75 -75
- package/packages/composite-components/search-area/index.js +4 -4
- package/packages/composite-components/search-area/src/index.vue +239 -237
- package/packages/composite-components/search-area/src/label.vue +35 -35
- package/packages/composite-components/select-entity-modal-table/index.js +4 -4
- package/packages/composite-components/select-entity-modal-table/src/index.vue +171 -171
- package/packages/date/index.js +4 -4
- package/packages/date/src/index.vue +112 -112
- package/packages/date-range/index.js +4 -4
- package/packages/date-range/src/index.vue +47 -47
- package/packages/form/index.js +4 -4
- package/packages/form/src/index.vue +393 -319
- package/packages/icon/index.js +4 -4
- package/packages/icon/src/index.vue +31 -31
- package/packages/index.js +159 -153
- package/packages/input/index.js +4 -4
- package/packages/input/src/index.vue +35 -35
- package/packages/input-number/index.js +4 -4
- package/packages/input-number/src/index.vue +23 -23
- package/packages/loading/index.js +4 -4
- package/packages/loading/src/index.vue +36 -36
- package/packages/meta/provider.js +4 -0
- package/packages/modal/index.js +4 -4
- package/packages/modal/src/index.vue +184 -184
- package/packages/models/form-group-model/index.js +4 -4
- package/packages/models/form-group-model/src/index.vue +271 -273
- package/packages/models/form-model/index.js +4 -4
- package/packages/models/form-model/src/index.vue +236 -232
- package/packages/models/step-model/index.js +4 -4
- package/packages/models/step-model/src/index.vue +224 -224
- package/packages/models/tree-table-model/README.md +0 -0
- package/packages/models/tree-table-model/index.js +4 -4
- package/packages/models/tree-table-model/src/index.vue +964 -689
- package/packages/pagination/index.js +5 -0
- package/packages/pagination/src/index.vue +372 -0
- package/packages/radio/index.js +4 -4
- package/packages/radio/src/index.vue +56 -56
- package/packages/select/index.js +4 -4
- package/packages/select/src/index.vue +113 -105
- package/packages/select-entity/index.js +4 -4
- package/packages/select-entity/src/index.vue +119 -119
- package/packages/table/index.js +4 -4
- package/packages/table/src/action.vue +176 -172
- package/packages/table/src/index.vue +605 -319
- package/packages/tabs/index.js +4 -4
- package/packages/tabs/src/index.vue +55 -55
- package/packages/text/index.js +4 -4
- package/packages/text/src/index.vue +47 -47
- package/packages/text-editor/index.js +4 -4
- package/packages/text-editor/src/index.vue +72 -72
- package/packages/textarea/index.js +4 -4
- package/packages/textarea/src/index.vue +57 -57
- package/packages/theme/form.scss +21 -21
- package/packages/theme/index.scss +43 -43
- package/packages/theme/overrid.scss +7 -7
- package/packages/theme/styleClass.scss +2 -2
- package/packages/theme/variables.scss +55 -55
- package/packages/timeline/index.js +4 -4
- package/packages/timeline/src/index.vue +257 -257
- package/packages/tpl/index.js +4 -4
- package/packages/tpl/src/index.vue +55 -55
- package/packages/tree/index.js +4 -4
- package/packages/tree/src/TreeNode.vue +29 -29
- package/packages/tree/src/index.vue +101 -101
- package/packages/tree-select/index.js +4 -4
- package/packages/tree-select/src/index.vue +142 -142
- package/packages/upload/index.js +4 -4
- package/packages/upload/src/index.vue +998 -494
- package/packages/utils/README.md +172 -0
- package/packages/utils/index.js +66 -62
- package/packages/utils/runtime-context/dataPoolAPI.js +501 -0
- package/packages/utils/runtime-context/globalDataPool.js +279 -0
- package/packages/utils/runtime-context/index.js +76 -0
- package/packages/utils/runtime-context/modelSchema.js +174 -0
- package/scripts/rollup.config.js +42 -42
- package/scripts/rollup.esm.config.js +11 -11
- package/scripts/rollup.umd.config.js +17 -14
- package/vitest.config.js +17 -0
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="select__entity--modal-table">
|
|
3
|
-
<ele-select-entity :multiple="multiple" :maxCount="maxCount" :value="entityValue" @close="onClosSelectEntity" @evoke="evokeSelectEntity"></ele-select-entity>
|
|
4
|
-
<ele-modal-table
|
|
5
|
-
@handleEntitySave="handleEntitySave"
|
|
6
|
-
@handleEntityCancel="handleEntityCancel"
|
|
7
|
-
:meta="buildMeta"
|
|
8
|
-
v-model="showModalTableValue">
|
|
9
|
-
</ele-modal-table>
|
|
10
|
-
</section>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import { type } from '@idooel/shared'
|
|
15
|
-
export default {
|
|
16
|
-
name: 'ele-select-entity-modal-table',
|
|
17
|
-
model: {
|
|
18
|
-
prop: 'value',
|
|
19
|
-
event: 'change'
|
|
20
|
-
},
|
|
21
|
-
props: {
|
|
22
|
-
value: {
|
|
23
|
-
type: [Array, Object],
|
|
24
|
-
default: () => []
|
|
25
|
-
},
|
|
26
|
-
title: {
|
|
27
|
-
type: String
|
|
28
|
-
},
|
|
29
|
-
maxCount: {
|
|
30
|
-
type: Number
|
|
31
|
-
},
|
|
32
|
-
tableMeta: {
|
|
33
|
-
type: Object,
|
|
34
|
-
default: () => ({})
|
|
35
|
-
},
|
|
36
|
-
returnValues: {
|
|
37
|
-
type: [String, Object],
|
|
38
|
-
default: () => ({})
|
|
39
|
-
},
|
|
40
|
-
replaceFields: {
|
|
41
|
-
type: Object
|
|
42
|
-
},
|
|
43
|
-
multiple: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
data() {
|
|
49
|
-
return {
|
|
50
|
-
showModalTableValue: false,
|
|
51
|
-
entityValue: [],
|
|
52
|
-
emitValue: void 0
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
watch: {
|
|
56
|
-
value: {
|
|
57
|
-
handler(innerValue) {
|
|
58
|
-
const _innerValue = type.isArray(innerValue) ? innerValue : [innerValue]
|
|
59
|
-
const { label, value } = this.replaceFields
|
|
60
|
-
this.entityValue = _innerValue.map(item => {
|
|
61
|
-
return {
|
|
62
|
-
label: item[label],
|
|
63
|
-
value: item[value]
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
},
|
|
67
|
-
immediate: true
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
computed: {
|
|
71
|
-
buildMeta () {
|
|
72
|
-
const { tableMeta } = this.tableMeta
|
|
73
|
-
Object.assign(tableMeta, { multiple: this.multiple })
|
|
74
|
-
return {
|
|
75
|
-
...this.tableMeta,
|
|
76
|
-
footerMeta: {
|
|
77
|
-
elements: (ctx) => [
|
|
78
|
-
{
|
|
79
|
-
label: '确定',
|
|
80
|
-
type: 'primary',
|
|
81
|
-
key: 'save',
|
|
82
|
-
eventName: 'handleEntitySave'
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
label: '返回',
|
|
86
|
-
key: 'cancel',
|
|
87
|
-
eventName: 'handleEntityCancel'
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
created () {
|
|
95
|
-
this.emitValue = this.multiple ? [] : void 0
|
|
96
|
-
},
|
|
97
|
-
methods: {
|
|
98
|
-
handleEntityCancel () {
|
|
99
|
-
this.showModalTableValue = false
|
|
100
|
-
},
|
|
101
|
-
buildEntityValueForEmitObjectReturnValues (dataSource = []) {
|
|
102
|
-
const keys = Object.keys(this.returnValues)
|
|
103
|
-
const ret = dataSource.map(props => {
|
|
104
|
-
const ret = {}
|
|
105
|
-
keys.forEach(key => {
|
|
106
|
-
ret[key] = props[this.returnValues[key]]
|
|
107
|
-
})
|
|
108
|
-
return ret
|
|
109
|
-
})
|
|
110
|
-
return this.multiple ? ret : ret[0]
|
|
111
|
-
},
|
|
112
|
-
emitEntityValue (dataSource = []) {
|
|
113
|
-
this.emitValue = this.value
|
|
114
|
-
if (this.multiple) {
|
|
115
|
-
if (type.isStr(this.returnValues)) {
|
|
116
|
-
const ret = dataSource.map(props => {
|
|
117
|
-
return props[this.returnValues]
|
|
118
|
-
})
|
|
119
|
-
this.emitValue.push(...ret)
|
|
120
|
-
} else if (type.isObject(this.returnValues)) {
|
|
121
|
-
this.emitValue.push(...this.buildEntityValueForEmitObjectReturnValues(dataSource))
|
|
122
|
-
}
|
|
123
|
-
} else {
|
|
124
|
-
if (type.isStr(this.returnValues)) {
|
|
125
|
-
this.emitValue = dataSource ? dataSource[this.returnValues] : ''
|
|
126
|
-
} else if (type.isObject(this.returnValues)) {
|
|
127
|
-
this.emitValue = dataSource ? this.buildEntityValueForEmitObjectReturnValues([dataSource]) : ''
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
this.$emit('change', this.emitValue)
|
|
131
|
-
},
|
|
132
|
-
onClosSelectEntity (props) {
|
|
133
|
-
this.entityValue = this.entityValue.filter(item => item.value !== props.value)
|
|
134
|
-
if (this.multiple) {
|
|
135
|
-
if (type.isStr(this.returnValues)) {
|
|
136
|
-
this.emitValue = this.emitValue.filter(item => item !== props.value)
|
|
137
|
-
} else if (type.isObject(this.returnValues)) {
|
|
138
|
-
const reverseReturnValues = Object.fromEntries(Object.entries(this.returnValues).map(([key, value]) => [value, key]))
|
|
139
|
-
const primaryKey =
|
|
140
|
-
this.emitValue = this.emitValue.filter(item => item[primaryKey] !== props.value)
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
if (type.isStr(this.returnValues)) {
|
|
144
|
-
this.emitValue = ''
|
|
145
|
-
} else if (type.isObject(this.returnValues)) {
|
|
146
|
-
this.emitValue =
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
this.$emit('change', this.emitValue)
|
|
150
|
-
},
|
|
151
|
-
handleEntitySave (props) {
|
|
152
|
-
const { exposed = {} } = props
|
|
153
|
-
const { currentTableSelection } = exposed
|
|
154
|
-
const currentTableSelectionRet = type.isArray(currentTableSelection) ? currentTableSelection : [currentTableSelection]
|
|
155
|
-
this.entityValue = currentTableSelectionRet.map(item => {
|
|
156
|
-
return {
|
|
157
|
-
label: item[this.replaceFields.label],
|
|
158
|
-
value: item[this.replaceFields.value]
|
|
159
|
-
}
|
|
160
|
-
})
|
|
161
|
-
this.emitEntityValue(currentTableSelection)
|
|
162
|
-
this.showModalTableValue = false
|
|
163
|
-
},
|
|
164
|
-
showModalTable () {
|
|
165
|
-
this.showModalTableValue = true
|
|
166
|
-
},
|
|
167
|
-
evokeSelectEntity () {
|
|
168
|
-
this.showModalTable()
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<section class="select__entity--modal-table">
|
|
3
|
+
<ele-select-entity :multiple="multiple" :maxCount="maxCount" :value="entityValue" @close="onClosSelectEntity" @evoke="evokeSelectEntity"></ele-select-entity>
|
|
4
|
+
<ele-modal-table
|
|
5
|
+
@handleEntitySave="handleEntitySave"
|
|
6
|
+
@handleEntityCancel="handleEntityCancel"
|
|
7
|
+
:meta="buildMeta"
|
|
8
|
+
v-model="showModalTableValue">
|
|
9
|
+
</ele-modal-table>
|
|
10
|
+
</section>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { type } from '@idooel/shared'
|
|
15
|
+
export default {
|
|
16
|
+
name: 'ele-select-entity-modal-table',
|
|
17
|
+
model: {
|
|
18
|
+
prop: 'value',
|
|
19
|
+
event: 'change'
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
value: {
|
|
23
|
+
type: [Array, Object],
|
|
24
|
+
default: () => []
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
type: String
|
|
28
|
+
},
|
|
29
|
+
maxCount: {
|
|
30
|
+
type: Number
|
|
31
|
+
},
|
|
32
|
+
tableMeta: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({})
|
|
35
|
+
},
|
|
36
|
+
returnValues: {
|
|
37
|
+
type: [String, Object],
|
|
38
|
+
default: () => ({})
|
|
39
|
+
},
|
|
40
|
+
replaceFields: {
|
|
41
|
+
type: Object
|
|
42
|
+
},
|
|
43
|
+
multiple: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
showModalTableValue: false,
|
|
51
|
+
entityValue: [],
|
|
52
|
+
emitValue: void 0
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
watch: {
|
|
56
|
+
value: {
|
|
57
|
+
handler(innerValue) {
|
|
58
|
+
const _innerValue = type.isArray(innerValue) ? innerValue : [innerValue]
|
|
59
|
+
const { label, value } = this.replaceFields
|
|
60
|
+
this.entityValue = _innerValue.map(item => {
|
|
61
|
+
return {
|
|
62
|
+
label: item[label],
|
|
63
|
+
value: item[value]
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
immediate: true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
buildMeta () {
|
|
72
|
+
const { tableMeta } = this.tableMeta
|
|
73
|
+
Object.assign(tableMeta, { multiple: this.multiple })
|
|
74
|
+
return {
|
|
75
|
+
...this.tableMeta,
|
|
76
|
+
footerMeta: {
|
|
77
|
+
elements: (ctx) => [
|
|
78
|
+
{
|
|
79
|
+
label: '确定',
|
|
80
|
+
type: 'primary',
|
|
81
|
+
key: 'save',
|
|
82
|
+
eventName: 'handleEntitySave'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: '返回',
|
|
86
|
+
key: 'cancel',
|
|
87
|
+
eventName: 'handleEntityCancel'
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
created () {
|
|
95
|
+
this.emitValue = this.multiple ? [] : void 0
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
handleEntityCancel () {
|
|
99
|
+
this.showModalTableValue = false
|
|
100
|
+
},
|
|
101
|
+
buildEntityValueForEmitObjectReturnValues (dataSource = []) {
|
|
102
|
+
const keys = Object.keys(this.returnValues)
|
|
103
|
+
const ret = dataSource.map(props => {
|
|
104
|
+
const ret = {}
|
|
105
|
+
keys.forEach(key => {
|
|
106
|
+
ret[key] = props[this.returnValues[key]]
|
|
107
|
+
})
|
|
108
|
+
return ret
|
|
109
|
+
})
|
|
110
|
+
return this.multiple ? ret : ret[0]
|
|
111
|
+
},
|
|
112
|
+
emitEntityValue (dataSource = []) {
|
|
113
|
+
this.emitValue = this.value
|
|
114
|
+
if (this.multiple) {
|
|
115
|
+
if (type.isStr(this.returnValues)) {
|
|
116
|
+
const ret = dataSource.map(props => {
|
|
117
|
+
return props[this.returnValues]
|
|
118
|
+
})
|
|
119
|
+
this.emitValue.push(...ret)
|
|
120
|
+
} else if (type.isObject(this.returnValues)) {
|
|
121
|
+
this.emitValue.push(...this.buildEntityValueForEmitObjectReturnValues(dataSource))
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
if (type.isStr(this.returnValues)) {
|
|
125
|
+
this.emitValue = dataSource ? dataSource[this.returnValues] : ''
|
|
126
|
+
} else if (type.isObject(this.returnValues)) {
|
|
127
|
+
this.emitValue = dataSource ? this.buildEntityValueForEmitObjectReturnValues([dataSource]) : ''
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
this.$emit('change', this.emitValue)
|
|
131
|
+
},
|
|
132
|
+
onClosSelectEntity (props) {
|
|
133
|
+
this.entityValue = this.entityValue.filter(item => item.value !== props.value)
|
|
134
|
+
if (this.multiple) {
|
|
135
|
+
if (type.isStr(this.returnValues)) {
|
|
136
|
+
this.emitValue = this.emitValue.filter(item => item !== props.value)
|
|
137
|
+
} else if (type.isObject(this.returnValues)) {
|
|
138
|
+
// const reverseReturnValues = Object.fromEntries(Object.entries(this.returnValues).map(([key, value]) => [value, key]))
|
|
139
|
+
const primaryKey = this.replaceFields.value
|
|
140
|
+
this.emitValue = this.emitValue.filter(item => item[primaryKey] !== props.value)
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
if (type.isStr(this.returnValues)) {
|
|
144
|
+
this.emitValue = ''
|
|
145
|
+
} else if (type.isObject(this.returnValues)) {
|
|
146
|
+
this.emitValue = null
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
this.$emit('change', this.emitValue)
|
|
150
|
+
},
|
|
151
|
+
handleEntitySave (props) {
|
|
152
|
+
const { exposed = {} } = props
|
|
153
|
+
const { currentTableSelection } = exposed
|
|
154
|
+
const currentTableSelectionRet = type.isArray(currentTableSelection) ? currentTableSelection : [currentTableSelection]
|
|
155
|
+
this.entityValue = currentTableSelectionRet.map(item => {
|
|
156
|
+
return {
|
|
157
|
+
label: item[this.returnValues[this.replaceFields.label]],
|
|
158
|
+
value: item[this.returnValues[this.replaceFields.value]]
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
this.emitEntityValue(currentTableSelection)
|
|
162
|
+
this.showModalTableValue = false
|
|
163
|
+
},
|
|
164
|
+
showModalTable () {
|
|
165
|
+
this.showModalTableValue = true
|
|
166
|
+
},
|
|
167
|
+
evokeSelectEntity () {
|
|
168
|
+
this.showModalTable()
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
172
|
</script>
|
package/packages/date/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EleDate from './src/index.vue'
|
|
2
|
-
|
|
3
|
-
EleDate.install = Vue => Vue.component(EleDate.name, EleDate)
|
|
4
|
-
|
|
1
|
+
import EleDate from './src/index.vue'
|
|
2
|
+
|
|
3
|
+
EleDate.install = Vue => Vue.component(EleDate.name, EleDate)
|
|
4
|
+
|
|
5
5
|
export default EleDate
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ele-date__wrapper">
|
|
3
|
-
<a-date-picker
|
|
4
|
-
style="width: 100%;"
|
|
5
|
-
:mode="modeValue"
|
|
6
|
-
v-if="modeValue == 'year'"
|
|
7
|
-
:open="open"
|
|
8
|
-
:disabled="disabled"
|
|
9
|
-
:value="value"
|
|
10
|
-
:placeholder="placeholder"
|
|
11
|
-
:show-time="showTime"
|
|
12
|
-
:show-today="showToday"
|
|
13
|
-
:valueFormat="innerValueFormat"
|
|
14
|
-
@panelChange="onPanelChange"
|
|
15
|
-
@openChange="openChange"
|
|
16
|
-
@change="onChange"
|
|
17
|
-
:format="format">
|
|
18
|
-
</a-date-picker>
|
|
19
|
-
<a-date-picker
|
|
20
|
-
v-else
|
|
21
|
-
style="width: 100%;"
|
|
22
|
-
:placeholder="placeholder"
|
|
23
|
-
:open="open"
|
|
24
|
-
:disabled="disabled"
|
|
25
|
-
:value="value"
|
|
26
|
-
:show-time="showTime"
|
|
27
|
-
:show-today="showToday"
|
|
28
|
-
:valueFormat="innerValueFormat"
|
|
29
|
-
@panelChange="onPanelChange"
|
|
30
|
-
@openChange="openChange"
|
|
31
|
-
@change="onChange"
|
|
32
|
-
:format="format">
|
|
33
|
-
</a-date-picker>
|
|
34
|
-
</div>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script>
|
|
38
|
-
import moment from 'moment'
|
|
39
|
-
export default {
|
|
40
|
-
name: 'ele-date',
|
|
41
|
-
model: {
|
|
42
|
-
prop: 'value',
|
|
43
|
-
event: 'change'
|
|
44
|
-
},
|
|
45
|
-
props: {
|
|
46
|
-
value: {
|
|
47
|
-
type: [String, Object]
|
|
48
|
-
},
|
|
49
|
-
disabled: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: false
|
|
52
|
-
},
|
|
53
|
-
format: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: 'YYYY/MM/DD'
|
|
56
|
-
},
|
|
57
|
-
mode: {
|
|
58
|
-
type: String
|
|
59
|
-
},
|
|
60
|
-
valueFormat: {
|
|
61
|
-
type: String
|
|
62
|
-
},
|
|
63
|
-
showTime: {
|
|
64
|
-
type: [Boolean, Object],
|
|
65
|
-
default: true
|
|
66
|
-
},
|
|
67
|
-
showToday: {
|
|
68
|
-
type: Boolean,
|
|
69
|
-
default: true
|
|
70
|
-
},
|
|
71
|
-
placeholder: {
|
|
72
|
-
type: String,
|
|
73
|
-
default: '请选择日期'
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
data () {
|
|
77
|
-
return {
|
|
78
|
-
open: false
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
computed: {
|
|
82
|
-
innerValueFormat () {
|
|
83
|
-
if (this.valueFormat) return this.valueFormat
|
|
84
|
-
return this.format
|
|
85
|
-
},
|
|
86
|
-
modeValue () {
|
|
87
|
-
if (this.mode) return this.mode
|
|
88
|
-
if (this.format === 'YYYY') return 'year'
|
|
89
|
-
return 'date'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
methods: {
|
|
93
|
-
onChange (_, dataString) {
|
|
94
|
-
this.$emit('input', dataString)
|
|
95
|
-
this.$emit('change', dataString)
|
|
96
|
-
},
|
|
97
|
-
onPanelChange (value, mode) {
|
|
98
|
-
if (this.modeValue !== 'year') return
|
|
99
|
-
this.$emit('input', moment(value).format(this.format))
|
|
100
|
-
this.$emit('change', moment(value).format(this.format))
|
|
101
|
-
this.open = false
|
|
102
|
-
},
|
|
103
|
-
openChange (open) {
|
|
104
|
-
this.open = open
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
</script>
|
|
109
|
-
<style lang="scss" scoped>
|
|
110
|
-
.ele-date__wrapper {
|
|
111
|
-
width: 100%;
|
|
112
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ele-date__wrapper">
|
|
3
|
+
<a-date-picker
|
|
4
|
+
style="width: 100%;"
|
|
5
|
+
:mode="modeValue"
|
|
6
|
+
v-if="modeValue == 'year'"
|
|
7
|
+
:open="open"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:value="value"
|
|
10
|
+
:placeholder="placeholder"
|
|
11
|
+
:show-time="showTime"
|
|
12
|
+
:show-today="showToday"
|
|
13
|
+
:valueFormat="innerValueFormat"
|
|
14
|
+
@panelChange="onPanelChange"
|
|
15
|
+
@openChange="openChange"
|
|
16
|
+
@change="onChange"
|
|
17
|
+
:format="format">
|
|
18
|
+
</a-date-picker>
|
|
19
|
+
<a-date-picker
|
|
20
|
+
v-else
|
|
21
|
+
style="width: 100%;"
|
|
22
|
+
:placeholder="placeholder"
|
|
23
|
+
:open="open"
|
|
24
|
+
:disabled="disabled"
|
|
25
|
+
:value="value"
|
|
26
|
+
:show-time="showTime"
|
|
27
|
+
:show-today="showToday"
|
|
28
|
+
:valueFormat="innerValueFormat"
|
|
29
|
+
@panelChange="onPanelChange"
|
|
30
|
+
@openChange="openChange"
|
|
31
|
+
@change="onChange"
|
|
32
|
+
:format="format">
|
|
33
|
+
</a-date-picker>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
import moment from 'moment'
|
|
39
|
+
export default {
|
|
40
|
+
name: 'ele-date',
|
|
41
|
+
model: {
|
|
42
|
+
prop: 'value',
|
|
43
|
+
event: 'change'
|
|
44
|
+
},
|
|
45
|
+
props: {
|
|
46
|
+
value: {
|
|
47
|
+
type: [String, Object]
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
format: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: 'YYYY/MM/DD'
|
|
56
|
+
},
|
|
57
|
+
mode: {
|
|
58
|
+
type: String
|
|
59
|
+
},
|
|
60
|
+
valueFormat: {
|
|
61
|
+
type: String
|
|
62
|
+
},
|
|
63
|
+
showTime: {
|
|
64
|
+
type: [Boolean, Object],
|
|
65
|
+
default: true
|
|
66
|
+
},
|
|
67
|
+
showToday: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
placeholder: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: '请选择日期'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
data () {
|
|
77
|
+
return {
|
|
78
|
+
open: false
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
computed: {
|
|
82
|
+
innerValueFormat () {
|
|
83
|
+
if (this.valueFormat) return this.valueFormat
|
|
84
|
+
return this.format
|
|
85
|
+
},
|
|
86
|
+
modeValue () {
|
|
87
|
+
if (this.mode) return this.mode
|
|
88
|
+
if (this.format === 'YYYY') return 'year'
|
|
89
|
+
return 'date'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
methods: {
|
|
93
|
+
onChange (_, dataString) {
|
|
94
|
+
this.$emit('input', dataString)
|
|
95
|
+
this.$emit('change', dataString)
|
|
96
|
+
},
|
|
97
|
+
onPanelChange (value, mode) {
|
|
98
|
+
if (this.modeValue !== 'year') return
|
|
99
|
+
this.$emit('input', moment(value).format(this.format))
|
|
100
|
+
this.$emit('change', moment(value).format(this.format))
|
|
101
|
+
this.open = false
|
|
102
|
+
},
|
|
103
|
+
openChange (open) {
|
|
104
|
+
this.open = open
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
<style lang="scss" scoped>
|
|
110
|
+
.ele-date__wrapper {
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
113
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EleDateRange from './src/index.vue'
|
|
2
|
-
|
|
3
|
-
EleDateRange.install = Vue => Vue.component(EleDateRange.name, EleDateRange)
|
|
4
|
-
|
|
1
|
+
import EleDateRange from './src/index.vue'
|
|
2
|
+
|
|
3
|
+
EleDateRange.install = Vue => Vue.component(EleDateRange.name, EleDateRange)
|
|
4
|
+
|
|
5
5
|
export default EleDateRange
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-range-picker
|
|
3
|
-
style="width: 100%;"
|
|
4
|
-
:disabled="disabled"
|
|
5
|
-
:show-time="showTime"
|
|
6
|
-
:value="value"
|
|
7
|
-
:format="format"
|
|
8
|
-
@change="onChange">
|
|
9
|
-
</a-range-picker>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
name: 'ele-date-range',
|
|
15
|
-
model: {
|
|
16
|
-
prop: 'value',
|
|
17
|
-
event: 'change'
|
|
18
|
-
},
|
|
19
|
-
props: {
|
|
20
|
-
disabled: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
default: false
|
|
23
|
-
},
|
|
24
|
-
showTime: {
|
|
25
|
-
type: Object
|
|
26
|
-
},
|
|
27
|
-
format: {
|
|
28
|
-
type: Array,
|
|
29
|
-
default: () => ['YYYY-MM-DD', 'YYYY-MM-DD']
|
|
30
|
-
},
|
|
31
|
-
value: {
|
|
32
|
-
type: Array,
|
|
33
|
-
default: () => []
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
methods: {
|
|
37
|
-
onChange (date, dateString) {
|
|
38
|
-
this.$emit('change', dateString)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<style lang="scss" scoped>
|
|
45
|
-
|
|
46
|
-
</style>
|
|
47
|
-
import { models } from '../..';
|
|
1
|
+
<template>
|
|
2
|
+
<a-range-picker
|
|
3
|
+
style="width: 100%;"
|
|
4
|
+
:disabled="disabled"
|
|
5
|
+
:show-time="showTime"
|
|
6
|
+
:value="value"
|
|
7
|
+
:format="format"
|
|
8
|
+
@change="onChange">
|
|
9
|
+
</a-range-picker>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'ele-date-range',
|
|
15
|
+
model: {
|
|
16
|
+
prop: 'value',
|
|
17
|
+
event: 'change'
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
disabled: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
showTime: {
|
|
25
|
+
type: Object
|
|
26
|
+
},
|
|
27
|
+
format: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => ['YYYY-MM-DD', 'YYYY-MM-DD']
|
|
30
|
+
},
|
|
31
|
+
value: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => []
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
onChange (date, dateString) {
|
|
38
|
+
this.$emit('change', dateString)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style lang="scss" scoped>
|
|
45
|
+
|
|
46
|
+
</style>
|
|
47
|
+
import { models } from '../..';
|