sh-view 2.5.5 → 2.5.7
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/package.json +1 -1
- package/packages/components/global-components/sh-table/js/useTable.js +8 -13
- package/packages/vxeTable/render/cell/vxe-render-code.vue +36 -28
- package/packages/vxeTable/render/cell/vxe-render-input.vue +53 -83
- package/packages/vxeTable/render/cell/vxe-render-select.vue +52 -44
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +8 -0
- package/packages/vxeTable/render/mixin/cell-hooks.js +26 -0
package/package.json
CHANGED
|
@@ -71,12 +71,9 @@ export default function (props, context, proxy, isGrid) {
|
|
|
71
71
|
const tableViewData = computed(() => tableFilterData.value || props.dataSourse)
|
|
72
72
|
const tablePrevColumns = computed(() => {
|
|
73
73
|
let prevColumns = []
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
prevColumns.push(columnsMapDefault[prev])
|
|
78
|
-
}
|
|
79
|
-
})
|
|
74
|
+
const { seq, selectType } = tableGlobalConfig.value
|
|
75
|
+
if (seq) prevColumns.push(columnsMapDefault.seq)
|
|
76
|
+
if (selectType) prevColumns.push(columnsMapDefault[selectType])
|
|
80
77
|
return prevColumns
|
|
81
78
|
})
|
|
82
79
|
const tableColumns = computed(() => {
|
|
@@ -155,7 +152,8 @@ export default function (props, context, proxy, isGrid) {
|
|
|
155
152
|
return selectionRows.value || []
|
|
156
153
|
}
|
|
157
154
|
// 获取全部数据
|
|
158
|
-
|
|
155
|
+
// visible为true获取视图数据
|
|
156
|
+
const getFullData = ({ visible }) => {
|
|
159
157
|
let data = $vUtils.clone(tableRef.value.getTableData().fullData, true)
|
|
160
158
|
const columns = tableRef.value.getColumns()
|
|
161
159
|
let rnameColumns = columns.filter(col => col.rname)
|
|
@@ -165,7 +163,7 @@ export default function (props, context, proxy, isGrid) {
|
|
|
165
163
|
let cellValue = $vUtils.get(row, property)
|
|
166
164
|
if (!$vUtils.isNone(cellValue)) {
|
|
167
165
|
let { rvalue, rtext } = $vUtils.formatRender(cellValue, property, row, rname, rprops, proxy)
|
|
168
|
-
$vUtils.set(row, property, ['$vMoney'].includes(rname) ? rtext : rvalue)
|
|
166
|
+
$vUtils.set(row, property, visible || ['$vMoney'].includes(rname) ? rtext : rvalue)
|
|
169
167
|
}
|
|
170
168
|
})
|
|
171
169
|
})
|
|
@@ -397,13 +395,10 @@ export default function (props, context, proxy, isGrid) {
|
|
|
397
395
|
searchFields.push({ rkey: col.property, rname: renderObj.name, rprops: Object.assign({}, renderObj.props, col.rprops) })
|
|
398
396
|
}
|
|
399
397
|
})
|
|
400
|
-
|
|
398
|
+
let fullVisibleData = getFullData({ visible: true })
|
|
399
|
+
filterData = $vUtils.searchTree(fullVisibleData, row => {
|
|
401
400
|
return searchFields.some(item => {
|
|
402
401
|
let cellValue = $vUtils.get(row, item.rkey)
|
|
403
|
-
if ($vxePluginNames.expendRenders && $vxePluginNames.expendRenders.includes(item.rname)) {
|
|
404
|
-
let { rtext } = $vUtils.formatRender(cellValue, item.rkey, row, item.rname, item.rprops, proxy)
|
|
405
|
-
return String(rtext).toLowerCase().indexOf(filterText) > -1
|
|
406
|
-
}
|
|
407
402
|
return $vUtils.trim(cellValue).toLowerCase().indexOf(filterText) > -1
|
|
408
403
|
})
|
|
409
404
|
})
|
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
|
-
<template v-if="redit || isEditAll">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
|
+
<template v-if="redit || isEditAll">
|
|
4
|
+
<span v-if="rprops.prefixText && rform" class="prefix">
|
|
5
|
+
<vxe-button v-if="prefixButton" v-bind="psButtonConfig" @click="vxeInputPrefixClick">{{ rprops.prefixText }}</vxe-button>
|
|
6
|
+
<span v-else @click="vxeInputPrefixClick">{{ rprops.prefixText }}</span>
|
|
7
|
+
</span>
|
|
8
|
+
<sh-code-editor v-model="renderValue" v-bind="rprops" @change="vxeInputChange" @blur="vxeBlurCallback"></sh-code-editor>
|
|
9
|
+
<span v-if="rprops.suffixText && rform" class="suffix">
|
|
10
|
+
<vxe-button v-if="suffixButton" v-bind="psButtonConfig" @click="vxeInputSuffixClick">{{ rprops.suffixText }}</vxe-button>
|
|
11
|
+
<span v-else @click="vxeInputSuffixClick">{{ rprops.suffixText }}</span>
|
|
12
|
+
</span>
|
|
13
|
+
</template>
|
|
14
|
+
<template v-else>
|
|
15
|
+
<span>{{ renderText }}</span>
|
|
16
|
+
</template>
|
|
17
|
+
</span>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { defineComponent, getCurrentInstance } from 'vue'
|
|
22
|
+
import cellProps from '../mixin/cell-props'
|
|
23
|
+
import cellHooks from '../mixin/cell-hooks'
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
name: 'VxeRenderCode',
|
|
26
|
+
props: cellProps,
|
|
27
|
+
setup(props, context) {
|
|
28
|
+
const { proxy } = getCurrentInstance()
|
|
29
|
+
const useCell = cellHooks(props, context, proxy)
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
...useCell
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
</script>
|
|
@@ -1,83 +1,53 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform, 'flex-render': controlButton }">
|
|
3
|
-
<template v-if="redit || isEditAll">
|
|
4
|
-
<span v-if="rprops.prefixText && rform" class="prefix">
|
|
5
|
-
<vxe-button v-if="prefixButton" v-bind="psButtonConfig" @click="vxeInputPrefixClick">{{ rprops.prefixText }}</vxe-button>
|
|
6
|
-
<span v-else @click="vxeInputPrefixClick">{{ rprops.prefixText }}</span>
|
|
7
|
-
</span>
|
|
8
|
-
<span v-else-if="controlButton" class="control-btn before" @click="vxeControlClick(false)">-</span>
|
|
9
|
-
<vxe-input v-model="renderValue" v-bind="rprops" :size="rsize" @change="vxeInputChange" @blur="vxeBlurCallback" @clear="vxeBlurCallback"></vxe-input>
|
|
10
|
-
<span v-if="rprops.suffixText && rform" class="suffix">
|
|
11
|
-
<vxe-button v-if="suffixButton" v-bind="psButtonConfig" @click="vxeInputSuffixClick">{{ rprops.suffixText }}</vxe-button>
|
|
12
|
-
<span v-else @click="vxeInputSuffixClick">{{ rprops.suffixText }}</span>
|
|
13
|
-
</span>
|
|
14
|
-
<span v-else-if="controlButton" class="control-btn after" @click="vxeControlClick(true)">+</span>
|
|
15
|
-
</template>
|
|
16
|
-
<template v-else>
|
|
17
|
-
<span v-if="rprops.prefixText && renderText" class="prefix">{{ rprops.prefixText }}</span>
|
|
18
|
-
<span v-html="renderText"></span>
|
|
19
|
-
<span v-if="rprops.suffixText && renderText" class="suffix">{{ rprops.suffixText }}</span>
|
|
20
|
-
</template>
|
|
21
|
-
</span>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script>
|
|
25
|
-
import { computed, defineComponent, getCurrentInstance } from 'vue'
|
|
26
|
-
import cellProps from '../mixin/cell-props'
|
|
27
|
-
import cellHooks from '../mixin/cell-hooks'
|
|
28
|
-
export default defineComponent({
|
|
29
|
-
name: 'VxeRenderInput',
|
|
30
|
-
props: cellProps,
|
|
31
|
-
setup(props, context) {
|
|
32
|
-
const { proxy } = getCurrentInstance()
|
|
33
|
-
const { $vUtils } = proxy
|
|
34
|
-
const useCell = cellHooks(props, context, proxy)
|
|
35
|
-
|
|
36
|
-
const controlButton = computed(() => props.rprops.control && ['number', 'float', 'integer'].includes(props.rprops.type))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
// 输入框后缀点击事件
|
|
56
|
-
const vxeInputSuffixClick = () => {
|
|
57
|
-
if (props.rprops.disabled) return
|
|
58
|
-
if (useCell.rform.value) {
|
|
59
|
-
let { $form } = props.rparams
|
|
60
|
-
$form.context.emit('suffix-click', props.rparams)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// 输入框数字加减控制
|
|
64
|
-
const vxeControlClick = bol => {
|
|
65
|
-
const { step = 1, min, max } = props.rprops
|
|
66
|
-
let value = bol ? $vUtils.add(useCell.renderValue.value, step) : $vUtils.subtract(useCell.renderValue.value, step)
|
|
67
|
-
if ((min !== undefined && value < min) || (max !== undefined && value > max)) return
|
|
68
|
-
useCell.setRenderValue(value)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
...useCell,
|
|
73
|
-
controlButton,
|
|
74
|
-
psButtonConfig,
|
|
75
|
-
prefixButton,
|
|
76
|
-
suffixButton,
|
|
77
|
-
vxeInputPrefixClick,
|
|
78
|
-
vxeInputSuffixClick,
|
|
79
|
-
vxeControlClick
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform, 'flex-render': controlButton }">
|
|
3
|
+
<template v-if="redit || isEditAll">
|
|
4
|
+
<span v-if="rprops.prefixText && rform" class="prefix">
|
|
5
|
+
<vxe-button v-if="prefixButton" v-bind="psButtonConfig" @click="vxeInputPrefixClick">{{ rprops.prefixText }}</vxe-button>
|
|
6
|
+
<span v-else @click="vxeInputPrefixClick">{{ rprops.prefixText }}</span>
|
|
7
|
+
</span>
|
|
8
|
+
<span v-else-if="controlButton" class="control-btn before" @click="vxeControlClick(false)">-</span>
|
|
9
|
+
<vxe-input v-model="renderValue" v-bind="rprops" :size="rsize" @change="vxeInputChange" @blur="vxeBlurCallback" @clear="vxeBlurCallback"></vxe-input>
|
|
10
|
+
<span v-if="rprops.suffixText && rform" class="suffix">
|
|
11
|
+
<vxe-button v-if="suffixButton" v-bind="psButtonConfig" @click="vxeInputSuffixClick">{{ rprops.suffixText }}</vxe-button>
|
|
12
|
+
<span v-else @click="vxeInputSuffixClick">{{ rprops.suffixText }}</span>
|
|
13
|
+
</span>
|
|
14
|
+
<span v-else-if="controlButton" class="control-btn after" @click="vxeControlClick(true)">+</span>
|
|
15
|
+
</template>
|
|
16
|
+
<template v-else>
|
|
17
|
+
<span v-if="rprops.prefixText && renderText" class="prefix">{{ rprops.prefixText }}</span>
|
|
18
|
+
<span v-html="renderText"></span>
|
|
19
|
+
<span v-if="rprops.suffixText && renderText" class="suffix">{{ rprops.suffixText }}</span>
|
|
20
|
+
</template>
|
|
21
|
+
</span>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import { computed, defineComponent, getCurrentInstance } from 'vue'
|
|
26
|
+
import cellProps from '../mixin/cell-props'
|
|
27
|
+
import cellHooks from '../mixin/cell-hooks'
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
name: 'VxeRenderInput',
|
|
30
|
+
props: cellProps,
|
|
31
|
+
setup(props, context) {
|
|
32
|
+
const { proxy } = getCurrentInstance()
|
|
33
|
+
const { $vUtils } = proxy
|
|
34
|
+
const useCell = cellHooks(props, context, proxy)
|
|
35
|
+
|
|
36
|
+
const controlButton = computed(() => props.rprops.control && ['number', 'float', 'integer'].includes(props.rprops.type))
|
|
37
|
+
|
|
38
|
+
// 输入框数字加减控制
|
|
39
|
+
const vxeControlClick = bol => {
|
|
40
|
+
const { step = 1, min, max } = props.rprops
|
|
41
|
+
let value = bol ? $vUtils.add(useCell.renderValue.value, step) : $vUtils.subtract(useCell.renderValue.value, step)
|
|
42
|
+
if ((min !== undefined && value < min) || (max !== undefined && value > max)) return
|
|
43
|
+
useCell.setRenderValue(value)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
...useCell,
|
|
48
|
+
controlButton,
|
|
49
|
+
vxeControlClick
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
@@ -1,44 +1,52 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
|
-
<template v-if="redit || isEditAll">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</template>
|
|
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
|
+
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
|
+
<template v-if="redit || isEditAll">
|
|
4
|
+
<span v-if="rprops.prefixText && rform" class="prefix">
|
|
5
|
+
<vxe-button v-if="prefixButton" v-bind="psButtonConfig" @click="vxeInputPrefixClick">{{ rprops.prefixText }}</vxe-button>
|
|
6
|
+
<span v-else @click="vxeInputPrefixClick">{{ rprops.prefixText }}</span>
|
|
7
|
+
</span>
|
|
8
|
+
<vxe-select v-model="renderValue" v-bind="rprops" :size="rsize" @change="vxeChangeCallBack" />
|
|
9
|
+
<span v-if="rprops.suffixText && rform" class="suffix">
|
|
10
|
+
<vxe-button v-if="suffixButton" v-bind="psButtonConfig" @click="vxeInputSuffixClick">{{ rprops.suffixText }}</vxe-button>
|
|
11
|
+
<span v-else @click="vxeInputSuffixClick">{{ rprops.suffixText }}</span>
|
|
12
|
+
</span>
|
|
13
|
+
</template>
|
|
14
|
+
<template v-else-if="!redit && showType">
|
|
15
|
+
<template v-for="showTag in showTags" :key="showTag.value">
|
|
16
|
+
<sh-tag :color="showTag.tagColor || rprops.tagColor" :type="showTag.tagType || rprops.tagType">{{ showTag.label }}</sh-tag>
|
|
17
|
+
</template>
|
|
18
|
+
</template>
|
|
19
|
+
<span v-else v-html="renderText"></span>
|
|
20
|
+
</span>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { computed, defineComponent, getCurrentInstance } from 'vue'
|
|
25
|
+
import cellProps from '../mixin/cell-props'
|
|
26
|
+
import cellHooks from '../mixin/cell-hooks'
|
|
27
|
+
export default defineComponent({
|
|
28
|
+
name: 'VxeRenderSelect',
|
|
29
|
+
props: cellProps,
|
|
30
|
+
setup(props, context) {
|
|
31
|
+
const { proxy } = getCurrentInstance()
|
|
32
|
+
const useCell = cellHooks(props, context, proxy)
|
|
33
|
+
|
|
34
|
+
const showType = computed(() => props.rprops.showType === 'tag')
|
|
35
|
+
|
|
36
|
+
const showTags = computed(() => {
|
|
37
|
+
const renderValue = useCell.renderValue.value
|
|
38
|
+
const { options = [], multiple } = props.rprops
|
|
39
|
+
if (multiple && Array.isArray(renderValue)) {
|
|
40
|
+
return options.filter(option => renderValue.includes(option.value))
|
|
41
|
+
}
|
|
42
|
+
return options.filter(option => String(option.value) === String(renderValue))
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
...useCell,
|
|
47
|
+
showType,
|
|
48
|
+
showTags
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
</script>
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span class="vxe-render--inner" :class="{ 'form-render': rform, 'td-render': !rform }">
|
|
3
3
|
<template v-if="redit || isEditAll">
|
|
4
|
+
<span v-if="rprops.prefixText && rform" class="prefix">
|
|
5
|
+
<vxe-button v-if="prefixButton" v-bind="psButtonConfig" @click="vxeInputPrefixClick">{{ rprops.prefixText }}</vxe-button>
|
|
6
|
+
<span v-else @click="vxeInputPrefixClick">{{ rprops.prefixText }}</span>
|
|
7
|
+
</span>
|
|
4
8
|
<sh-tree v-model="renderValue" v-bind="rprops" :field="rkey" :value-data="rdata" :size="rsize" is-select @change="vxeTreeCallback"></sh-tree>
|
|
9
|
+
<span v-if="rprops.suffixText && rform" class="suffix">
|
|
10
|
+
<vxe-button v-if="suffixButton" v-bind="psButtonConfig" @click="vxeInputSuffixClick">{{ rprops.suffixText }}</vxe-button>
|
|
11
|
+
<span v-else @click="vxeInputSuffixClick">{{ rprops.suffixText }}</span>
|
|
12
|
+
</span>
|
|
5
13
|
</template>
|
|
6
14
|
<template v-else>
|
|
7
15
|
<span v-html="renderText"></span>
|
|
@@ -45,6 +45,11 @@ export default function (props, context, proxy) {
|
|
|
45
45
|
let endIndex = cnGroups.findIndex(cn => cn.fullText === billStart)
|
|
46
46
|
return cnGroups.slice(startIndex, endIndex)
|
|
47
47
|
})
|
|
48
|
+
const psButtonConfig = computed(() => {
|
|
49
|
+
return { disabled: props.rprops.disabled, size: props.rsize, status: 'theme' }
|
|
50
|
+
})
|
|
51
|
+
const prefixButton = computed(() => props.rprops.prefixType.toLowerCase() === 'button')
|
|
52
|
+
const suffixButton = computed(() => props.rprops.suffixType.toLowerCase() === 'button')
|
|
48
53
|
|
|
49
54
|
// 初始化数据
|
|
50
55
|
const initData = () => {
|
|
@@ -52,6 +57,22 @@ export default function (props, context, proxy) {
|
|
|
52
57
|
formatValueFun(keyValue)
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
// 输入框前缀点击事件
|
|
61
|
+
const vxeInputPrefixClick = () => {
|
|
62
|
+
if (props.rprops.disabled) return
|
|
63
|
+
if (rform.value) {
|
|
64
|
+
let { $form } = props.rparams
|
|
65
|
+
$form.context.emit('prefix-click', props.rparams)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// 输入框后缀点击事件
|
|
69
|
+
const vxeInputSuffixClick = () => {
|
|
70
|
+
if (props.rprops.disabled) return
|
|
71
|
+
if (rform.value) {
|
|
72
|
+
let { $form } = props.rparams
|
|
73
|
+
$form.context.emit('suffix-click', props.rparams)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
55
76
|
// 输入框变化
|
|
56
77
|
const vxeInputChange = async ({ value, $event }) => {
|
|
57
78
|
// 此操作火狐浏览器(bug(vxe):编辑后不触发渲染器的blur问题)触发edit-closed,故在edit-close重新赋值
|
|
@@ -154,6 +175,11 @@ export default function (props, context, proxy) {
|
|
|
154
175
|
isEditAll,
|
|
155
176
|
moneyUnitText,
|
|
156
177
|
billGroups,
|
|
178
|
+
psButtonConfig,
|
|
179
|
+
prefixButton,
|
|
180
|
+
suffixButton,
|
|
181
|
+
vxeInputPrefixClick,
|
|
182
|
+
vxeInputSuffixClick,
|
|
157
183
|
vxeInputChange,
|
|
158
184
|
vxeChangeCallBack,
|
|
159
185
|
vxeRadioCallBack,
|