sh-view 2.10.6 → 2.10.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 +4 -4
- package/packages/components/sh-split/index.vue +22 -25
- package/packages/components/sh-table/js/useTable.js +1 -1
- package/packages/components/sh-toolbar/index.vue +2 -2
- package/packages/vxeTable/css/index.scss +0 -12
- package/packages/vxeTable/index.js +9 -3
- package/packages/vxeTable/render/cell/vxe-render-goption.vue +14 -32
- package/packages/vxeTable/render/cell/vxe-render-table.vue +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sh-view",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.7",
|
|
4
4
|
"description": "基于vxe-table二次封装,更包含Alert,Badge,Card,CodeEditor,Col,Corner,CountTo,Drawer,Empty,Form,Header,Icon,List,Loading,Modal,Noticebar,Poptip,Progress,PullRefresh,Query,Result,Row,Split,Grid,Table,Tabs,Tag,Toolbar,Tree,Upload,WaterFall,WaterMark等丰富组件库",
|
|
5
5
|
"main": "packages/index.js",
|
|
6
6
|
"typings": "types/index.d.ts",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"jszip": "^3.10.1",
|
|
37
37
|
"lunar-typescript": "^1.6.10",
|
|
38
38
|
"popper.js": "^1.16.1",
|
|
39
|
-
"sh-tools": "^2.3.
|
|
39
|
+
"sh-tools": "^2.3.11",
|
|
40
40
|
"vue": "^3.5.20",
|
|
41
41
|
"vue-masonry": "^0.16.0",
|
|
42
42
|
"vue-router": "^4.5.1",
|
|
43
|
-
"vxe-pc-ui": "^4.11.
|
|
44
|
-
"vxe-table": "^4.17.
|
|
43
|
+
"vxe-pc-ui": "^4.11.43",
|
|
44
|
+
"vxe-table": "^4.17.40"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
|
@@ -40,20 +40,17 @@ export default defineComponent({
|
|
|
40
40
|
},
|
|
41
41
|
props: {
|
|
42
42
|
modelValue: {
|
|
43
|
-
type: [Number, String]
|
|
44
|
-
default: 0.2
|
|
43
|
+
type: [Number, String]
|
|
45
44
|
},
|
|
46
45
|
mode: {
|
|
47
46
|
type: String,
|
|
48
|
-
default: '
|
|
47
|
+
default: '' // horizontal, vertical
|
|
49
48
|
},
|
|
50
49
|
min: {
|
|
51
|
-
type: [Number, String]
|
|
52
|
-
default: 0
|
|
50
|
+
type: [Number, String]
|
|
53
51
|
},
|
|
54
52
|
max: {
|
|
55
|
-
type: [Number, String]
|
|
56
|
-
default: 0.6
|
|
53
|
+
type: [Number, String]
|
|
57
54
|
},
|
|
58
55
|
disabled: {
|
|
59
56
|
type: Boolean,
|
|
@@ -73,12 +70,15 @@ export default defineComponent({
|
|
|
73
70
|
loadingType: {
|
|
74
71
|
type: String,
|
|
75
72
|
default: '2'
|
|
73
|
+
},
|
|
74
|
+
triggerWin: {
|
|
75
|
+
type: Boolean
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
emits: ['update:modelValue', 'move-start', 'moveing', 'move-end'],
|
|
79
79
|
setup(props, context) {
|
|
80
80
|
const vm = getCurrentInstance()
|
|
81
|
-
const { $vUtils } = vm.proxy
|
|
81
|
+
const { $vUtils, $vUiSetup } = vm.proxy
|
|
82
82
|
const { emit, slots } = context
|
|
83
83
|
|
|
84
84
|
const splitRef = ref()
|
|
@@ -88,34 +88,27 @@ export default defineComponent({
|
|
|
88
88
|
const isMoving = ref(false)
|
|
89
89
|
const computedMin = ref(0)
|
|
90
90
|
const computedMax = ref(0)
|
|
91
|
-
const currentValue = ref(props.modelValue)
|
|
91
|
+
const currentValue = ref(props.modelValue || $vUiSetup.splitConfig?.defaultValue || 0)
|
|
92
92
|
|
|
93
93
|
const paneClasses = computed(() => {
|
|
94
94
|
return {
|
|
95
95
|
'sh-split-pane': true,
|
|
96
|
-
'sh-split-pane-moving':
|
|
96
|
+
'sh-split-pane-moving': isMoving.value
|
|
97
97
|
}
|
|
98
98
|
})
|
|
99
|
-
const isHorizontal = computed(() =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
})
|
|
105
|
-
const valueIsPx = computed(() => {
|
|
106
|
-
return typeof props.modelValue === 'string'
|
|
107
|
-
})
|
|
108
|
-
const offsetSize = computed(() => {
|
|
109
|
-
return isHorizontal.value ? 'offsetWidth' : 'offsetHeight'
|
|
110
|
-
})
|
|
99
|
+
const isHorizontal = computed(() => (props.mode || $vUiSetup.splitConfig?.mode) === 'horizontal')
|
|
100
|
+
const anotherOffset = computed(() => 100 - offset.value)
|
|
101
|
+
const valueIsPx = computed(() => typeof props.modelValue === 'string')
|
|
102
|
+
const offsetSize = computed(() => (isHorizontal.value ? 'offsetWidth' : 'offsetHeight'))
|
|
103
|
+
const offsetConfig = computed(() => ({ min: props.min || $vUiSetup.splitConfig?.min || 0, max: props.max || $vUiSetup.splitConfig?.max || 1 }))
|
|
111
104
|
|
|
112
105
|
const px2percent = (numerator, denominator) => {
|
|
113
106
|
return parseFloat(numerator) / parseFloat(denominator)
|
|
114
107
|
}
|
|
115
108
|
const getComputedThresholdValue = type => {
|
|
116
109
|
let size = splitRef.value[offsetSize.value]
|
|
117
|
-
if (valueIsPx.value) return typeof
|
|
118
|
-
else return typeof
|
|
110
|
+
if (valueIsPx.value) return typeof offsetConfig.value[type] === 'string' ? offsetConfig.value[type] : size * offsetConfig.value[type]
|
|
111
|
+
else return typeof offsetConfig.value[type] === 'string' ? px2percent(offsetConfig.value[type], size) : offsetConfig.value[type]
|
|
119
112
|
}
|
|
120
113
|
const getMin = (value1, value2) => {
|
|
121
114
|
if (valueIsPx.value) return `${Math.min(parseFloat(value1), parseFloat(value2))}px`
|
|
@@ -149,6 +142,7 @@ export default defineComponent({
|
|
|
149
142
|
$vUtils.offListener(document, 'mousemove', handleMove)
|
|
150
143
|
$vUtils.offListener(document, 'mouseup', handleUp)
|
|
151
144
|
emit('move-end')
|
|
145
|
+
if (props.triggerWin) window.dispatchEvent(new Event('resize'))
|
|
152
146
|
}
|
|
153
147
|
const handleMousedown = e => {
|
|
154
148
|
initOffset.value = isHorizontal.value ? e.pageX : e.pageY
|
|
@@ -162,7 +156,6 @@ export default defineComponent({
|
|
|
162
156
|
computedMin.value = getComputedThresholdValue('min')
|
|
163
157
|
computedMax.value = getComputedThresholdValue('max')
|
|
164
158
|
offset.value = ((valueIsPx.value ? px2percent(currentValue.value, splitRef.value[offsetSize.value]) : currentValue.value) * 10000) / 100
|
|
165
|
-
// return nextTick()
|
|
166
159
|
}
|
|
167
160
|
const resetOffset = val => {
|
|
168
161
|
if (val !== currentValue.value) {
|
|
@@ -265,6 +258,10 @@ $trigger-bar-con-height: calc(($trigger-bar-weight + $trigger-bar-interval) * 8)
|
|
|
265
258
|
}
|
|
266
259
|
&-trigger {
|
|
267
260
|
border: 1px solid var(--border-radius);
|
|
261
|
+
-webkit-user-select: none;
|
|
262
|
+
-moz-user-select: none;
|
|
263
|
+
-ms-user-select: none;
|
|
264
|
+
user-select: none;
|
|
268
265
|
&-con {
|
|
269
266
|
position: absolute;
|
|
270
267
|
transform: translate(-50%, -50%);
|
|
@@ -620,7 +620,7 @@ export default function (props, context, proxy, isGrid) {
|
|
|
620
620
|
delete addRows[keyField.value]
|
|
621
621
|
}
|
|
622
622
|
let { row: newRow } = await tableRef.value.insertAt(addRows, index)
|
|
623
|
-
await tableRef.value.
|
|
623
|
+
await tableRef.value.setEditRow(newRow)
|
|
624
624
|
if (isTool) emit('toolbaroption', 'add', newRow, tableRef.value)
|
|
625
625
|
}
|
|
626
626
|
// 删除行按钮
|
|
@@ -69,8 +69,8 @@ export default defineComponent({
|
|
|
69
69
|
const leftActive = ref(props.modelValue)
|
|
70
70
|
|
|
71
71
|
const vmSize = computed(() => props.size || $vUiSetup.size)
|
|
72
|
-
const leftConfigBtns = computed(() => props.leftConfig || $vUiSetup.
|
|
73
|
-
const rightConfigBtns = computed(() => props.rightConfig || $vUiSetup.
|
|
72
|
+
const leftConfigBtns = computed(() => props.leftConfig || $vUiSetup.statusList)
|
|
73
|
+
const rightConfigBtns = computed(() => props.rightConfig || $vUiSetup.buttonsList)
|
|
74
74
|
const leftBtns = computed(() => {
|
|
75
75
|
let lBtns = []
|
|
76
76
|
if (props.leftContain && Array.isArray(props.leftContain) && props.leftContain.length > 0) {
|
|
@@ -249,18 +249,6 @@ button:focus, .vxe-button.type--button:not(.is--disabled):focus{
|
|
|
249
249
|
.vxe-input, .vxe-select, .vxe-number-input, .vxe-date-picker, .sh-date{
|
|
250
250
|
width: 100%;
|
|
251
251
|
}
|
|
252
|
-
&.vxe-render--inner--readonly{
|
|
253
|
-
position: relative;
|
|
254
|
-
&::before{
|
|
255
|
-
content: '';
|
|
256
|
-
position: absolute;
|
|
257
|
-
left: 0;
|
|
258
|
-
right: 0;
|
|
259
|
-
top: 0;
|
|
260
|
-
bottom: 0;
|
|
261
|
-
z-index: 2;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
252
|
&.form-render {
|
|
265
253
|
align-items: stretch;
|
|
266
254
|
.prefix, .suffix{
|
|
@@ -76,7 +76,7 @@ let uiOptions = {
|
|
|
76
76
|
text: '加载中...'
|
|
77
77
|
},
|
|
78
78
|
message: { title: '', className: 'sh-message-box', draggable: false },
|
|
79
|
-
|
|
79
|
+
statusList: [
|
|
80
80
|
{ value: '1', code: 'wss', content: '未送审' },
|
|
81
81
|
{ value: '2', code: 'bth', content: '被退回' },
|
|
82
82
|
{ value: '3', code: 'yss', content: '已送审' },
|
|
@@ -85,7 +85,7 @@ let uiOptions = {
|
|
|
85
85
|
{ value: '6', code: 'dsh', content: '待审核' },
|
|
86
86
|
{ value: '7', code: 'ysh', content: '已审核' }
|
|
87
87
|
],
|
|
88
|
-
|
|
88
|
+
buttonsList: [
|
|
89
89
|
{ code: 'add', content: '新增', status: 'primary', icon: 'vxe-icon-add' },
|
|
90
90
|
{ code: 'edit', content: '修改', status: 'warning', icon: 'vxe-icon-edit' },
|
|
91
91
|
{ code: 'delete', content: '删除', status: 'danger', icon: 'vxe-icon-delete' },
|
|
@@ -107,7 +107,13 @@ let uiOptions = {
|
|
|
107
107
|
{ code: 'batch-audit-back', content: '批量退回', status: 'warning', icon: '' },
|
|
108
108
|
{ code: 'batch-audit-back-insert', content: '批量退回到录入', status: 'warning', icon: '' },
|
|
109
109
|
{ code: 'batch-audit-pass', content: '批量审核', status: 'success', icon: '' }
|
|
110
|
-
]
|
|
110
|
+
],
|
|
111
|
+
splitConfig: {
|
|
112
|
+
defaultValue: 0.2,
|
|
113
|
+
min: 0,
|
|
114
|
+
max: 0.6,
|
|
115
|
+
mode: 'horizontal'
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
let tableOptions = {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<vxe-button
|
|
5
5
|
v-if="isBtnRender(renderBtn)"
|
|
6
6
|
:mode="rprops.type"
|
|
7
|
+
:round="rprops.round"
|
|
7
8
|
:size="rsize"
|
|
8
9
|
:icon="getBtnContent(renderBtn).icon"
|
|
9
10
|
:status="getBtnContent(renderBtn).status"
|
|
@@ -18,12 +19,18 @@
|
|
|
18
19
|
import { computed, defineComponent, getCurrentInstance } from 'vue'
|
|
19
20
|
import cellProps from '../mixin/cell-props'
|
|
20
21
|
import cellHooks from '../mixin/cell-hooks'
|
|
22
|
+
const buttonDefaultMap = {
|
|
23
|
+
add: { content: '新增', status: 'primary', icon: 'vxe-icon-add' },
|
|
24
|
+
edit: { content: '编辑', status: 'warning', icon: 'vxe-icon-edit' },
|
|
25
|
+
delete: { content: '删除', status: 'danger', icon: 'vxe-icon-delete' },
|
|
26
|
+
detail: { content: '查看', status: '', icon: 'vxe-icon-information' }
|
|
27
|
+
}
|
|
21
28
|
export default defineComponent({
|
|
22
29
|
name: 'VxeRenderGoption',
|
|
23
30
|
props: cellProps,
|
|
24
31
|
setup(props, context) {
|
|
25
32
|
const { proxy } = getCurrentInstance()
|
|
26
|
-
const { $vUtils } = proxy
|
|
33
|
+
const { $vUtils, $vUiSetup } = proxy
|
|
27
34
|
const useCell = cellHooks(props, context, proxy)
|
|
28
35
|
|
|
29
36
|
const renderBtns = computed(() => {
|
|
@@ -44,44 +51,19 @@ export default defineComponent({
|
|
|
44
51
|
|
|
45
52
|
// 按钮是否显示条件
|
|
46
53
|
const isBtnRender = renderBtn => {
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
let condition = $vUtils.get(renderBtn, 'condition')
|
|
55
|
+
if (!$vUtils.isNone(condition)) {
|
|
49
56
|
return $vUtils.calculate(condition, useCell.rdata.value)
|
|
50
57
|
}
|
|
51
58
|
return true
|
|
52
59
|
}
|
|
53
60
|
// 规定按钮文字
|
|
54
61
|
const getBtnContent = renderBtn => {
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
switch (renderBtn.code) {
|
|
59
|
-
case 'add':
|
|
60
|
-
renderContent = renderBtn.content || '新增'
|
|
61
|
-
renderStatus = renderBtn.status || 'primary'
|
|
62
|
-
renderIcon = renderBtn.icon || 'vxe-icon-add'
|
|
63
|
-
break
|
|
64
|
-
case 'edit':
|
|
65
|
-
renderContent = renderBtn.content || '编辑'
|
|
66
|
-
renderStatus = renderBtn.status || 'warning'
|
|
67
|
-
renderIcon = renderBtn.icon || 'vxe-icon-edit'
|
|
68
|
-
break
|
|
69
|
-
case 'delete':
|
|
70
|
-
renderContent = renderBtn.content || '删除'
|
|
71
|
-
renderStatus = renderBtn.status || 'danger'
|
|
72
|
-
renderIcon = renderBtn.icon || 'vxe-icon-delete'
|
|
73
|
-
break
|
|
74
|
-
case 'detail':
|
|
75
|
-
renderContent = renderBtn.content || '查看'
|
|
76
|
-
renderStatus = renderBtn.status || ''
|
|
77
|
-
renderIcon = renderBtn.icon || 'vxe-icon-information'
|
|
78
|
-
break
|
|
79
|
-
default:
|
|
80
|
-
renderContent = renderBtn.content
|
|
81
|
-
renderStatus = renderBtn.status
|
|
82
|
-
break
|
|
62
|
+
let setupBtn = null
|
|
63
|
+
if (renderBtn.code) {
|
|
64
|
+
setupBtn = ($vUiSetup.buttonsList || []).find(item => item.code === renderBtn.code)
|
|
83
65
|
}
|
|
84
|
-
return {
|
|
66
|
+
return Object.assign({}, setupBtn, renderBtn)
|
|
85
67
|
}
|
|
86
68
|
// 按钮点击回调
|
|
87
69
|
const vxeBtnCallback = ({ $event }, renderBtn) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<span class="vxe-render--inner" style="display: grid; width: 100%">
|
|
3
|
+
<sh-table ref="shTableRef" :disabled="!isEditActive" v-bind="rprops" :size="rsize" :data-sourse="renderValue" @edit-closed="vxeTableCallback" @toolbaroption="onToolbaroption"></sh-table>
|
|
4
|
+
</span>
|
|
3
5
|
</template>
|
|
4
6
|
|
|
5
7
|
<script>
|