lw-cdp-ui 1.5.1 → 1.5.3
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/components/lwFormMini/ViewItem.vue +7 -8
- package/dist/components/lwFormMini/textToPassword.vue +2 -0
- package/dist/components/lwTour/index.vue +118 -118
- package/dist/lw-cdp-ui.esm.js +1559 -1560
- package/dist/lw-cdp-ui.umd.js +11 -11
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -37,9 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
<!-- input -->
|
|
39
39
|
<template v-if="item.component == 'input'">
|
|
40
|
-
<
|
|
41
|
-
<textToPassword v-model="objItem.value" :password="item?.options?.password" />
|
|
42
|
-
<template v-if="item?.options?.append">{{ item?.options.append }}</template>
|
|
40
|
+
<textToPassword v-model="objItem.value" :password="item?.options?.password" :append="item?.options?.append" />
|
|
43
41
|
</template>
|
|
44
42
|
<!-- upload -->
|
|
45
43
|
<template v-else-if="item.component == 'upload'">
|
|
@@ -284,7 +282,7 @@ export default {
|
|
|
284
282
|
return items?.map((item) => item.label).join('、') || val || '--'
|
|
285
283
|
},
|
|
286
284
|
// 根据 value 从树形数据中查找 label(支持自定义 props)
|
|
287
|
-
getLabelByValue(data,
|
|
285
|
+
getLabelByValue(data, val, props = {}) {
|
|
288
286
|
const {
|
|
289
287
|
value: valueKey = 'value', // 默认字段名:value
|
|
290
288
|
label: labelKey = 'label', // 默认字段名:label
|
|
@@ -293,13 +291,14 @@ export default {
|
|
|
293
291
|
|
|
294
292
|
const findNode = (nodes) => {
|
|
295
293
|
for (const node of nodes) {
|
|
296
|
-
if (node[valueKey]
|
|
297
|
-
|
|
294
|
+
if (node[valueKey] == val) return node[labelKey]
|
|
295
|
+
|
|
296
|
+
if (node[childrenKey] && node[childrenKey].length > 0) {
|
|
298
297
|
const result = findNode(node[childrenKey])
|
|
299
|
-
if (result) return result
|
|
298
|
+
if (result !== '--') return result
|
|
300
299
|
}
|
|
301
300
|
}
|
|
302
|
-
return '--'
|
|
301
|
+
return '--'
|
|
303
302
|
}
|
|
304
303
|
|
|
305
304
|
return findNode(data)
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
</el-tooltip>
|
|
7
7
|
<!-- 切换加密/解密按钮 -->
|
|
8
8
|
<el-icon v-if="password" class="primary" @click="toggleEncryption"><el-icon-view /></el-icon>
|
|
9
|
+
<span v-if="append" class="text">{{ append }}</span>
|
|
9
10
|
</span>
|
|
10
11
|
</template>
|
|
11
12
|
|
|
@@ -14,6 +15,7 @@ export default {
|
|
|
14
15
|
props: {
|
|
15
16
|
modelValue: { type: [String, Array, Boolean], default: '' }, // 传入的字符串或数组
|
|
16
17
|
width: { type: String, default: '' },
|
|
18
|
+
append: { type: String, default: '' },
|
|
17
19
|
password: { type: Boolean, default: false } // 是否需要加密显示
|
|
18
20
|
},
|
|
19
21
|
data() {
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tour v-model="isOpen" :current="currentStep">
|
|
3
|
-
<el-tour-step
|
|
4
|
-
v-for="(step, index) in formattedSteps"
|
|
5
|
-
:key="index"
|
|
6
|
-
:target="step.target"
|
|
7
|
-
:title="step.title"
|
|
8
|
-
:description="step.description" />
|
|
9
|
-
</el-tour>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
import { ref, getCurrentInstance, onMounted, nextTick, onUnmounted } from 'vue'
|
|
14
|
-
import { useRouter } from 'vue-router'
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: 'LwTour',
|
|
18
|
-
props: {
|
|
19
|
-
steps: {
|
|
20
|
-
type: Array,
|
|
21
|
-
required: true,
|
|
22
|
-
validator: (value) => {
|
|
23
|
-
return value.every((step) => {
|
|
24
|
-
return step.css && step.title && step.description
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
// 是否在组件挂载后自动开始引导
|
|
29
|
-
autoStart: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: false
|
|
32
|
-
},
|
|
33
|
-
currentStep: {
|
|
34
|
-
type: Number,
|
|
35
|
-
default: 0
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
setup(props, { emit }) {
|
|
39
|
-
const {
|
|
40
|
-
proxy: { $api, $expression, t, $tool, $bus }
|
|
41
|
-
} = getCurrentInstance()
|
|
42
|
-
const router = useRouter()
|
|
43
|
-
$bus.$on(`lwTourChange`, () => {
|
|
44
|
-
startTour()
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
onUnmounted(() => {
|
|
48
|
-
$bus.$emit(`lwTourOpen`, false)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const isOpen = ref(false)
|
|
52
|
-
const formattedSteps = ref([])
|
|
53
|
-
|
|
54
|
-
// 开始引导
|
|
55
|
-
const startTour = () => {
|
|
56
|
-
// 如果 router 未初始化,延迟执行
|
|
57
|
-
if (!router) {
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
startTour()
|
|
60
|
-
}, 100)
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const allElementsExist = props.steps.every((step) => {
|
|
65
|
-
return document.querySelector(step.css)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
if (!allElementsExist) {
|
|
69
|
-
console.warn('元素未加载完成')
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
startTour()
|
|
72
|
-
}, 100)
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
formattedSteps.value = props.steps.map((step) => {
|
|
77
|
-
const targetElement = document.querySelector(step.css)
|
|
78
|
-
return {
|
|
79
|
-
target: targetElement || undefined,
|
|
80
|
-
title: step.title,
|
|
81
|
-
description: step.description,
|
|
82
|
-
placement: 'bottom'
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
isOpen.value = true
|
|
86
|
-
|
|
87
|
-
let LwTour = $tool.data.get('LwTour') || {}
|
|
88
|
-
const currentRoute = router?.currentRoute?.value
|
|
89
|
-
if (currentRoute) {
|
|
90
|
-
const { path, meta } = currentRoute
|
|
91
|
-
LwTour[`${meta?.title || ''}${path}`] = true
|
|
92
|
-
$tool.data.set('LwTour', LwTour)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// 组件挂载后自动开始引导
|
|
97
|
-
onMounted(() => {
|
|
98
|
-
let LwTour = $tool.data.get('LwTour') || {}
|
|
99
|
-
const currentRoute = router?.currentRoute?.value
|
|
100
|
-
if (currentRoute) {
|
|
101
|
-
const { path, meta } = currentRoute
|
|
102
|
-
if (!LwTour[`${meta?.title || ''}${path}`]) {
|
|
103
|
-
nextTick(() => {
|
|
104
|
-
startTour()
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
$bus.$emit(`lwTourOpen`, true)
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
formattedSteps,
|
|
113
|
-
isOpen,
|
|
114
|
-
startTour
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<el-tour v-model="isOpen" :current="currentStep">
|
|
3
|
+
<el-tour-step
|
|
4
|
+
v-for="(step, index) in formattedSteps"
|
|
5
|
+
:key="index"
|
|
6
|
+
:target="step.target"
|
|
7
|
+
:title="step.title"
|
|
8
|
+
:description="step.description" />
|
|
9
|
+
</el-tour>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import { ref, getCurrentInstance, onMounted, nextTick, onUnmounted } from 'vue'
|
|
14
|
+
import { useRouter } from 'vue-router'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'LwTour',
|
|
18
|
+
props: {
|
|
19
|
+
steps: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true,
|
|
22
|
+
validator: (value) => {
|
|
23
|
+
return value.every((step) => {
|
|
24
|
+
return step.css && step.title && step.description
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// 是否在组件挂载后自动开始引导
|
|
29
|
+
autoStart: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
currentStep: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 0
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
setup(props, { emit }) {
|
|
39
|
+
const {
|
|
40
|
+
proxy: { $api, $expression, t, $tool, $bus }
|
|
41
|
+
} = getCurrentInstance()
|
|
42
|
+
const router = useRouter()
|
|
43
|
+
$bus.$on(`lwTourChange`, () => {
|
|
44
|
+
startTour()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
onUnmounted(() => {
|
|
48
|
+
$bus.$emit(`lwTourOpen`, false)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const isOpen = ref(false)
|
|
52
|
+
const formattedSteps = ref([])
|
|
53
|
+
|
|
54
|
+
// 开始引导
|
|
55
|
+
const startTour = () => {
|
|
56
|
+
// 如果 router 未初始化,延迟执行
|
|
57
|
+
if (!router) {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
startTour()
|
|
60
|
+
}, 100)
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const allElementsExist = props.steps.every((step) => {
|
|
65
|
+
return document.querySelector(step.css)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
if (!allElementsExist) {
|
|
69
|
+
console.warn('元素未加载完成')
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
startTour()
|
|
72
|
+
}, 100)
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
formattedSteps.value = props.steps.map((step) => {
|
|
77
|
+
const targetElement = document.querySelector(step.css)
|
|
78
|
+
return {
|
|
79
|
+
target: targetElement || undefined,
|
|
80
|
+
title: step.title,
|
|
81
|
+
description: step.description,
|
|
82
|
+
placement: 'bottom'
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
isOpen.value = true
|
|
86
|
+
|
|
87
|
+
let LwTour = $tool.data.get('LwTour') || {}
|
|
88
|
+
const currentRoute = router?.currentRoute?.value
|
|
89
|
+
if (currentRoute) {
|
|
90
|
+
const { path, meta } = currentRoute
|
|
91
|
+
LwTour[`${meta?.title || ''}${path}`] = true
|
|
92
|
+
$tool.data.set('LwTour', LwTour)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 组件挂载后自动开始引导
|
|
97
|
+
onMounted(() => {
|
|
98
|
+
let LwTour = $tool.data.get('LwTour') || {}
|
|
99
|
+
const currentRoute = router?.currentRoute?.value
|
|
100
|
+
if (currentRoute) {
|
|
101
|
+
const { path, meta } = currentRoute
|
|
102
|
+
if (!LwTour[`${meta?.title || ''}${path}`]) {
|
|
103
|
+
nextTick(() => {
|
|
104
|
+
startTour()
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
$bus.$emit(`lwTourOpen`, true)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
formattedSteps,
|
|
113
|
+
isOpen,
|
|
114
|
+
startTour
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
</script>
|