@idooel/components 0.0.0 → 0.0.1-beta.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/dist/@idooel/components.esm.js +2634 -0
- package/dist/@idooel/components.umd.js +1019 -179
- package/package.json +44 -41
- package/packages/button/index.js +4 -4
- package/packages/button/src/index.vue +54 -24
- package/packages/composite-components/button-group/index.js +4 -4
- package/packages/composite-components/button-group/src/index.vue +50 -46
- package/packages/composite-components/search-area/index.js +4 -4
- package/packages/composite-components/search-area/src/index.vue +171 -128
- package/packages/composite-components/search-area/src/label.vue +35 -35
- package/packages/date/index.js +4 -4
- package/packages/date/src/index.vue +39 -39
- package/packages/index.js +50 -49
- package/packages/input/index.js +4 -4
- package/packages/input/src/index.vue +23 -23
- package/packages/select/index.js +4 -4
- package/packages/select/src/index.vue +34 -34
- package/packages/table/index.js +4 -4
- package/packages/table/src/action.vue +131 -44
- package/packages/table/src/index.vue +157 -88
- package/packages/theme/index.scss +12 -0
- package/packages/theme/variables.scss +34 -0
- package/packages/tpl/index.js +4 -4
- package/packages/tpl/src/index.vue +50 -39
- package/packages/tree/index.js +4 -4
- package/packages/tree/src/TreeNode.vue +29 -29
- package/packages/tree/src/index.vue +101 -96
- package/packages/tree-table-model/index.js +4 -4
- package/packages/tree-table-model/src/index.vue +306 -289
- package/scripts/rollup.config.js +35 -41
- package/scripts/rollup.esm.config.js +12 -0
- package/scripts/rollup.umd.config.js +14 -14
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="g-search__label">
|
|
3
|
-
<span class="label__title">{{ label }}</span>
|
|
4
|
-
<span class="label__suffix">:</span>
|
|
5
|
-
</div>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
props: {
|
|
11
|
-
label: {
|
|
12
|
-
type: String
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<style lang="scss" scoped>
|
|
19
|
-
.g-search__label {
|
|
20
|
-
/* width: 69px; */
|
|
21
|
-
flex-basis: 69px;
|
|
22
|
-
height: 32px;
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-direction: row;
|
|
25
|
-
align-items: center;
|
|
26
|
-
justify-content: space-between;
|
|
27
|
-
.label__title, .label__suffix {
|
|
28
|
-
font-size: 14px;
|
|
29
|
-
color: rgba(0, 0, 0, 0.88);
|
|
30
|
-
white-space: nowrap;
|
|
31
|
-
}
|
|
32
|
-
.label__suffix {
|
|
33
|
-
margin-left: 4px;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="g-search__label">
|
|
3
|
+
<span class="label__title">{{ label }}</span>
|
|
4
|
+
<span class="label__suffix">:</span>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
props: {
|
|
11
|
+
label: {
|
|
12
|
+
type: String
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<style lang="scss" scoped>
|
|
19
|
+
.g-search__label {
|
|
20
|
+
/* width: 69px; */
|
|
21
|
+
flex-basis: 69px;
|
|
22
|
+
height: 32px;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
.label__title, .label__suffix {
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
color: rgba(0, 0, 0, 0.88);
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
32
|
+
.label__suffix {
|
|
33
|
+
margin-left: 4px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
36
|
</style>
|
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,40 +1,40 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-date-picker
|
|
3
|
-
style="width: 100%;"
|
|
4
|
-
mode="year"
|
|
5
|
-
:open="open"
|
|
6
|
-
:value="value"
|
|
7
|
-
@focus="onFocus"
|
|
8
|
-
@panelChange="onPanelChange"
|
|
9
|
-
:format="format">
|
|
10
|
-
</a-date-picker>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
export default {
|
|
15
|
-
name: 'ele-date',
|
|
16
|
-
props: {
|
|
17
|
-
value: {
|
|
18
|
-
type: Object
|
|
19
|
-
},
|
|
20
|
-
format: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: 'YYYY/MM/DD'
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
data () {
|
|
26
|
-
return {
|
|
27
|
-
open: false
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
methods: {
|
|
31
|
-
onFocus () {
|
|
32
|
-
this.open = true
|
|
33
|
-
},
|
|
34
|
-
onPanelChange (value, mode) {
|
|
35
|
-
this.$emit('input', value)
|
|
36
|
-
this.open = false
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<a-date-picker
|
|
3
|
+
style="width: 100%;"
|
|
4
|
+
mode="year"
|
|
5
|
+
:open="open"
|
|
6
|
+
:value="value"
|
|
7
|
+
@focus="onFocus"
|
|
8
|
+
@panelChange="onPanelChange"
|
|
9
|
+
:format="format">
|
|
10
|
+
</a-date-picker>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'ele-date',
|
|
16
|
+
props: {
|
|
17
|
+
value: {
|
|
18
|
+
type: Object
|
|
19
|
+
},
|
|
20
|
+
format: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'YYYY/MM/DD'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
data () {
|
|
26
|
+
return {
|
|
27
|
+
open: false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
onFocus () {
|
|
32
|
+
this.open = true
|
|
33
|
+
},
|
|
34
|
+
onPanelChange (value, mode) {
|
|
35
|
+
this.$emit('input', value)
|
|
36
|
+
this.open = false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
40
|
</script>
|
package/packages/index.js
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import EleButton from './button/index.js'
|
|
2
|
-
import EleDate from './date/index.js'
|
|
3
|
-
import EleInput from './input/index.js'
|
|
4
|
-
import EleSelect from './select/index.js'
|
|
5
|
-
import EleTable from './table/index.js'
|
|
6
|
-
import EleTree from './tree/index.js'
|
|
7
|
-
import EleTpl from './tpl/index.js'
|
|
8
|
-
|
|
9
|
-
import EleButtonGroup from './composite-components/button-group/index.js'
|
|
10
|
-
import EleSearchArea from './composite-components/search-area/index.js'
|
|
11
|
-
|
|
12
|
-
import EleTreeTableModel from './tree-table-model/index.js'
|
|
13
|
-
|
|
14
|
-
const compositeComponents = [
|
|
15
|
-
EleButtonGroup,
|
|
16
|
-
EleSearchArea
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
const models = [
|
|
20
|
-
EleTreeTableModel
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
const components = [
|
|
24
|
-
EleButton,
|
|
25
|
-
EleDate,
|
|
26
|
-
EleInput,
|
|
27
|
-
EleSelect,
|
|
28
|
-
EleTable,
|
|
29
|
-
EleTree,
|
|
30
|
-
EleTpl,
|
|
31
|
-
...compositeComponents,
|
|
32
|
-
...models
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
const install = (Vue) => {
|
|
36
|
-
if (install.installed) return
|
|
37
|
-
install.installed = true
|
|
38
|
-
components.forEach(component => {
|
|
39
|
-
Vue.component(component.name, component)
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
export default install
|
|
43
|
-
export {
|
|
44
|
-
EleButton,
|
|
45
|
-
EleDate,
|
|
46
|
-
EleInput,
|
|
47
|
-
EleSelect,
|
|
48
|
-
EleTable,
|
|
49
|
-
EleTree
|
|
1
|
+
import EleButton from './button/index.js'
|
|
2
|
+
import EleDate from './date/index.js'
|
|
3
|
+
import EleInput from './input/index.js'
|
|
4
|
+
import EleSelect from './select/index.js'
|
|
5
|
+
import EleTable from './table/index.js'
|
|
6
|
+
import EleTree from './tree/index.js'
|
|
7
|
+
import EleTpl from './tpl/index.js'
|
|
8
|
+
|
|
9
|
+
import EleButtonGroup from './composite-components/button-group/index.js'
|
|
10
|
+
import EleSearchArea from './composite-components/search-area/index.js'
|
|
11
|
+
|
|
12
|
+
import EleTreeTableModel from './tree-table-model/index.js'
|
|
13
|
+
|
|
14
|
+
const compositeComponents = [
|
|
15
|
+
EleButtonGroup,
|
|
16
|
+
EleSearchArea
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
export const models = [
|
|
20
|
+
EleTreeTableModel
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const components = [
|
|
24
|
+
EleButton,
|
|
25
|
+
EleDate,
|
|
26
|
+
EleInput,
|
|
27
|
+
EleSelect,
|
|
28
|
+
EleTable,
|
|
29
|
+
EleTree,
|
|
30
|
+
EleTpl,
|
|
31
|
+
...compositeComponents,
|
|
32
|
+
...models
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
const install = (Vue) => {
|
|
36
|
+
if (install.installed) return
|
|
37
|
+
install.installed = true
|
|
38
|
+
components.forEach(component => {
|
|
39
|
+
Vue.component(component.name, component)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
export default install
|
|
43
|
+
export {
|
|
44
|
+
EleButton,
|
|
45
|
+
EleDate,
|
|
46
|
+
EleInput,
|
|
47
|
+
EleSelect,
|
|
48
|
+
EleTable,
|
|
49
|
+
EleTree,
|
|
50
|
+
EleTpl
|
|
50
51
|
}
|
package/packages/input/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EleInput from './src/index.vue'
|
|
2
|
-
|
|
3
|
-
EleInput.install = Vue => Vue.component(EleInput.name, EleInput)
|
|
4
|
-
|
|
1
|
+
import EleInput from './src/index.vue'
|
|
2
|
+
|
|
3
|
+
EleInput.install = Vue => Vue.component(EleInput.name, EleInput)
|
|
4
|
+
|
|
5
5
|
export default EleInput
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-input :value="value" @change="onChange"></a-input>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
name: 'ele-input',
|
|
8
|
-
props: {
|
|
9
|
-
value: {
|
|
10
|
-
type: String
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
methods: {
|
|
14
|
-
onChange (e) {
|
|
15
|
-
this.$emit('change', e.target.value)
|
|
16
|
-
this.$emit('input', e.target.value)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<style scoped>
|
|
23
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<a-input :value="value" @change="onChange"></a-input>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'ele-input',
|
|
8
|
+
props: {
|
|
9
|
+
value: {
|
|
10
|
+
type: String
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
onChange (e) {
|
|
15
|
+
this.$emit('change', e.target.value)
|
|
16
|
+
this.$emit('input', e.target.value)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style scoped>
|
|
23
|
+
|
|
24
24
|
</style>
|
package/packages/select/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EleSelect from './src/index.vue'
|
|
2
|
-
|
|
3
|
-
EleSelect.install = Vue => Vue.component(EleSelect.name, EleSelect)
|
|
4
|
-
|
|
1
|
+
import EleSelect from './src/index.vue'
|
|
2
|
+
|
|
3
|
+
EleSelect.install = Vue => Vue.component(EleSelect.name, EleSelect)
|
|
4
|
+
|
|
5
5
|
export default EleSelect
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-select :value="value" style="width: 100%" @change="onChange">
|
|
3
|
-
<a-select-option v-for="item in dataSource" :key="item.value" :value="item.value">
|
|
4
|
-
{{ item.label }}
|
|
5
|
-
</a-select-option>
|
|
6
|
-
</a-select>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
export default {
|
|
11
|
-
name: 'ele-select',
|
|
12
|
-
props: {
|
|
13
|
-
value: {
|
|
14
|
-
type: [String, Array, Number]
|
|
15
|
-
},
|
|
16
|
-
defaultValue: {
|
|
17
|
-
type: [String, Array, Number]
|
|
18
|
-
},
|
|
19
|
-
dataSource: {
|
|
20
|
-
type: Array,
|
|
21
|
-
default: () => []
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
methods: {
|
|
25
|
-
onChange (value) {
|
|
26
|
-
this.$emit('change', value)
|
|
27
|
-
this.$emit('input', value)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<style lang="scss" scoped>
|
|
34
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<a-select :value="value" style="width: 100%" @change="onChange">
|
|
3
|
+
<a-select-option v-for="item in dataSource" :key="item.value" :value="item.value">
|
|
4
|
+
{{ item.label }}
|
|
5
|
+
</a-select-option>
|
|
6
|
+
</a-select>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
name: 'ele-select',
|
|
12
|
+
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: [String, Array, Number]
|
|
15
|
+
},
|
|
16
|
+
defaultValue: {
|
|
17
|
+
type: [String, Array, Number]
|
|
18
|
+
},
|
|
19
|
+
dataSource: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: () => []
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
onChange (value) {
|
|
26
|
+
this.$emit('change', value)
|
|
27
|
+
this.$emit('input', value)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<style lang="scss" scoped>
|
|
34
|
+
|
|
35
35
|
</style>
|
package/packages/table/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EleTable from './src/index.vue'
|
|
2
|
-
|
|
3
|
-
EleTable.install = Vue => Vue.component(EleTable.name, EleTable)
|
|
4
|
-
|
|
1
|
+
import EleTable from './src/index.vue'
|
|
2
|
+
|
|
3
|
+
EleTable.install = Vue => Vue.component(EleTable.name, EleTable)
|
|
4
|
+
|
|
5
5
|
export default EleTable
|
|
@@ -1,45 +1,132 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="g-table__action">
|
|
3
|
-
<div class="table-action__item" v-for="(item, idx) in dataSource" :key="idx">
|
|
4
|
-
<template v-if="item.type == 'text'">
|
|
5
|
-
<span
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="g-table__action">
|
|
3
|
+
<div class="table-action__item" v-for="(item, idx) in execOperationExpression(dataSource)" :key="idx">
|
|
4
|
+
<template v-if="item.type == 'text'">
|
|
5
|
+
<span>{{ item.label }}</span>
|
|
6
|
+
</template>
|
|
7
|
+
<template v-else-if="item.type == 'dropdown'">
|
|
8
|
+
<a-dropdown>
|
|
9
|
+
<a-menu slot="overlay" @click="handleDropdownClick">
|
|
10
|
+
<a-menu-item :key="`${item.key || ''}${menuKeyDelimiter}${opt.value || ''}`" v-for="opt in execOperationExpression(item.optionList)">
|
|
11
|
+
<template v-if="opt.type == 'confirm'">
|
|
12
|
+
<a-popconfirm :title="opt.message" @confirm="handleClickConfirm(opt)">
|
|
13
|
+
{{ opt.label }}
|
|
14
|
+
</a-popconfirm>
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else>
|
|
17
|
+
{{ opt.label }}
|
|
18
|
+
</template>
|
|
19
|
+
</a-menu-item>
|
|
20
|
+
</a-menu>
|
|
21
|
+
<span>{{ item.label }}</span>
|
|
22
|
+
</a-dropdown>
|
|
23
|
+
</template>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { v5 as uuidv5 } from 'uuid'
|
|
30
|
+
import { type, route } from '@idooel/shared'
|
|
31
|
+
import { parse } from '@idooel/expression'
|
|
32
|
+
const MENU_KEY_NAMESPACE = 'f7b3b8b0-1b7b-11ec-9621-0242ac130002'
|
|
33
|
+
export default {
|
|
34
|
+
props: {
|
|
35
|
+
record: {
|
|
36
|
+
type: Object
|
|
37
|
+
},
|
|
38
|
+
dataSource: {
|
|
39
|
+
type: Array,
|
|
40
|
+
default: () => []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
inject: {
|
|
44
|
+
requestTreeData: {
|
|
45
|
+
default: void 0
|
|
46
|
+
},
|
|
47
|
+
requestTableData: {
|
|
48
|
+
default: void 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
computed: {
|
|
52
|
+
menuKeyDelimiter () {
|
|
53
|
+
return uuidv5('_', MENU_KEY_NAMESPACE)
|
|
54
|
+
},
|
|
55
|
+
builtInMethods () {
|
|
56
|
+
return {
|
|
57
|
+
requestTreeData: this.requestTreeData,
|
|
58
|
+
requestTableData: this.requestTableData
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
execOperationExpression (dataSource = []) {
|
|
64
|
+
const ret = dataSource.map(item => {
|
|
65
|
+
const { show } = item
|
|
66
|
+
if (type.isUndefined(show)) {
|
|
67
|
+
return item
|
|
68
|
+
} else if (type.isBool(show)) {
|
|
69
|
+
if (show) return item
|
|
70
|
+
} else if (type.isStr(show)) {
|
|
71
|
+
const parseRet = parse(show, {
|
|
72
|
+
...this.record,
|
|
73
|
+
_route: route.searchToQueryParams(window.location.search)
|
|
74
|
+
})
|
|
75
|
+
if (parseRet) return item
|
|
76
|
+
}
|
|
77
|
+
}).filter(item => item)
|
|
78
|
+
return ret
|
|
79
|
+
},
|
|
80
|
+
handleClickConfirm (props) {
|
|
81
|
+
//TODO generate event by special rule
|
|
82
|
+
const { eventName, value } = props
|
|
83
|
+
this.$emit(eventName, {
|
|
84
|
+
key: value,
|
|
85
|
+
record: this.record,
|
|
86
|
+
builtInMethods: this.builtInMethods
|
|
87
|
+
})
|
|
88
|
+
},
|
|
89
|
+
handleDropdownClick (props) {
|
|
90
|
+
const { key } = props
|
|
91
|
+
const [parent, child] = key.split(this.menuKeyDelimiter)
|
|
92
|
+
if (!parent || !child) {
|
|
93
|
+
throw new Error('key is required')
|
|
94
|
+
}
|
|
95
|
+
const currentDropdown = this.dataSource.find(item => item.key === parent)
|
|
96
|
+
const currentClickTarget = currentDropdown.optionList.find(item => item.value === child)
|
|
97
|
+
const { eventName, type } = currentClickTarget
|
|
98
|
+
//TODO generate event by special rule
|
|
99
|
+
if (type === 'confirm') return
|
|
100
|
+
this.$emit(eventName, {
|
|
101
|
+
key: child,
|
|
102
|
+
record: this.record,
|
|
103
|
+
builtInMethods: this.builtInMethods
|
|
104
|
+
})
|
|
105
|
+
},
|
|
106
|
+
handleClickText (props) {
|
|
107
|
+
const { eventName, key } = props
|
|
108
|
+
this.$emit(eventName, {
|
|
109
|
+
key,
|
|
110
|
+
record: this.record,
|
|
111
|
+
builtInMethods: this.builtInMethods
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<style lang="scss" scoped>
|
|
119
|
+
.g-table__action {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: row;
|
|
122
|
+
.table-action__item {
|
|
123
|
+
font-size: 14px;
|
|
124
|
+
color: #409EFF;
|
|
125
|
+
margin-left: 16px;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
&:first-child {
|
|
128
|
+
margin-left: 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
45
132
|
</style>
|