ylwl-cpscoms 1.0.0 → 1.2.0
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/es/DtTable/index.vue.js +379 -0
- package/es/DtTable/index.vue2.js +719 -0
- package/es/DtTable/index.vue3.js +6 -0
- package/es/SlAlert/index.vue.js +1 -1
- package/es/SlAlert/index.vue3.js +1 -1
- package/es/SlForm/index.vue.js +1 -1
- package/es/SlForm/index.vue3.js +1 -1
- package/es/SlPage/index.vue.js +2 -2
- package/es/SlPage/index.vue3.js +1 -1
- package/es/index.js +3 -1
- package/package.json +2 -3
- package/src/SlAlert/SlAlert.stories.js +0 -108
- package/src/SlAlert/index.vue +0 -54
- package/src/SlAlert/remark.md +0 -16
- package/src/SlDescriptions/SlDescriptions.stories.js +0 -119
- package/src/SlDescriptions/index.vue +0 -60
- package/src/SlDescriptions/renderOptions.vue +0 -27
- package/src/SlDialog/README-PLUS.md +0 -74
- package/src/SlDialog/README.md +0 -114
- package/src/SlDialog/dialogPlus.js +0 -160
- package/src/SlDialog/index.js +0 -170
- package/src/SlDrawer/SlDrawer.stories.js +0 -154
- package/src/SlDrawer/index.js +0 -62
- package/src/SlForm/SlForm.stories.js +0 -120
- package/src/SlForm/index.css +0 -141
- package/src/SlForm/index.vue +0 -365
- package/src/SlForm/mixinRender.js +0 -228
- package/src/SlForm/otherItem/titleItem.vue +0 -31
- package/src/SlForm/remark.md +0 -607
- package/src/SlGuide/SlGuide.stories.js +0 -100
- package/src/SlGuide/index.vue +0 -166
- package/src/SlGuide/remark.md +0 -90
- package/src/SlMessageBox/index.js +0 -35
- package/src/SlPage/README.md +0 -515
- package/src/SlPage/SlPage.stories.js +0 -125
- package/src/SlPage/index.css +0 -38
- package/src/SlPage/index.vue +0 -266
- package/src/SlPage/remark.md +0 -283
- package/src/SlTable/SlTable.stories.js +0 -118
- package/src/SlTable/components/colSetting.vue +0 -86
- package/src/SlTable/index.vue +0 -541
- package/src/SlTitle/SlTitle.stories.js +0 -98
- package/src/SlTitle/index.vue +0 -49
- package/src/global.css +0 -5
- package/src/index.js +0 -47
- package/src/store/index.js +0 -20
- package/src/utils/index.js +0 -47
- package/src/utils/tableConfig.js +0 -33
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".dt_table_header[data-v-2447cdc6]{align-items:center;display:inline-flex}.dt_required_dot[data-v-2447cdc6]{color:#f56c6c;margin-right:4px}.action-buttons[data-v-2447cdc6]{align-items:center;display:flex}.dt_table .el-form-item[data-v-2447cdc6],.dt_table[data-v-2447cdc6] .el-form-item__content{margin-bottom:0!important}.dt_table[data-v-2447cdc6] .el-input__inner{text-align:center!important}.dt_table[data-v-2447cdc6] .el-table__cell{padding:5px 0}";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
package/es/SlAlert/index.vue.js
CHANGED
|
@@ -38,7 +38,7 @@ __vue_render__._withStripped = true;
|
|
|
38
38
|
/* style */
|
|
39
39
|
var __vue_inject_styles__ = undefined;
|
|
40
40
|
/* scoped */
|
|
41
|
-
var __vue_scope_id__ = "data-v-
|
|
41
|
+
var __vue_scope_id__ = "data-v-01bb5e39";
|
|
42
42
|
/* module identifier */
|
|
43
43
|
var __vue_module_identifier__ = undefined;
|
|
44
44
|
/* functional template */
|
package/es/SlAlert/index.vue3.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".message-box[data-v-
|
|
3
|
+
var css_248z = ".message-box[data-v-01bb5e39]{background:#fdf6ec;padding:5px 10px 10px}.message-title[data-v-01bb5e39]{align-items:center;color:#f59a23d8;display:flex;justify-content:space-between}.message-row[data-v-01bb5e39]{color:#606266;font-size:14px}";
|
|
4
4
|
styleInject(css_248z);
|
|
5
5
|
|
|
6
6
|
export { css_248z as default };
|
package/es/SlForm/index.vue.js
CHANGED
|
@@ -9,7 +9,7 @@ var __vue_script__ = script;
|
|
|
9
9
|
/* style */
|
|
10
10
|
var __vue_inject_styles__ = undefined;
|
|
11
11
|
/* scoped */
|
|
12
|
-
var __vue_scope_id__ = "data-v-
|
|
12
|
+
var __vue_scope_id__ = "data-v-2d1ba62b";
|
|
13
13
|
/* module identifier */
|
|
14
14
|
var __vue_module_identifier__ = undefined;
|
|
15
15
|
/* functional template */
|
package/es/SlForm/index.vue3.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".yl-form-item{align-items:center;display:flex}
|
|
3
|
+
var css_248z = ".yl-form-item[data-v-2d1ba62b]{align-items:center;display:flex}[data-v-2d1ba62b] .el-form-item__content{display:flex;flex:1;margin:0!important}.yl-form-fullitem .el-form-item__content[data-v-2d1ba62b]{flex:1}.yl-form-item[data-v-2d1ba62b]{display:inline-flex!important}.yl-form-item .yl-form-item-grid .el-form-item__content[data-v-2d1ba62b]{font-size:0}.item-label[data-v-2d1ba62b]{display:inline-block;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap;width:auto}.yl-form-box-shrink[data-v-2d1ba62b]{background-color:#f1f1f1;overflow:hidden;padding:10px}.yl-form-drawericon[data-v-2d1ba62b]{display:inline-block;vertical-align:top}.yl-form-drawericon-float[data-v-2d1ba62b]{background-image:linear-gradient(270deg,#ffa140,hsla(0,0%,100%,0));opacity:.9;padding:10px 10px 10px 80px;position:absolute;right:0;top:0;z-index:10}.yl-i-lebel[data-v-2d1ba62b]{background-color:#979797;border-radius:4px 4px 0 0;border-radius:0 4px 0 10px;color:#fff;font-size:12px;line-height:12px;padding:2px 8px 4px 10px;position:absolute;right:0;top:0;transform:scale(.8);transform-origin:100% 0;width:auto;z-index:5}.yl-r-icon[data-v-2d1ba62b]{color:red;left:0;line-height:35px;padding:5px;position:absolute;top:50%;transform:translateY(-50%);z-index:5}.yl-form-slider[data-v-2d1ba62b]{border:1px solid #dcdfe6;border-radius:4px;display:flex;line-height:35px;padding:0 20px 0 10px}.yl-form-slider-span[data-v-2d1ba62b]{color:#c0c4cc;padding-right:15px}.yl-form-box[data-v-2d1ba62b]{border-radius:4px;position:relative;transition:all .2s ease-out;white-space:normal}.yl-form-item[data-v-2d1ba62b]{position:relative;white-space:nowrap}.yl-form-range-input[data-v-2d1ba62b]{border:1px solid #dcdfe6;border-radius:4px;padding:0 10px}.yl-form-range-input input[data-v-2d1ba62b]{border:none;border-radius:4px;height:100%;outline:none;padding:7px;text-align:center;width:70px}.yl-form-range-input input[data-v-2d1ba62b]::placeholder{color:#c0c4cc}.el-radio[data-v-2d1ba62b]{margin-bottom:0!important}";
|
|
4
4
|
styleInject(css_248z);
|
|
5
5
|
|
|
6
6
|
export { css_248z as default };
|
package/es/SlPage/index.vue.js
CHANGED
|
@@ -10,7 +10,7 @@ var __vue_render__ = function __vue_render__() {
|
|
|
10
10
|
var _h = _vm.$createElement;
|
|
11
11
|
var _c = _vm._self._c || _h;
|
|
12
12
|
return _c("main", {
|
|
13
|
-
staticClass: "
|
|
13
|
+
staticClass: "main-box",
|
|
14
14
|
style: {
|
|
15
15
|
padding: _vm.notShowPadding ? "" : "20px"
|
|
16
16
|
}
|
|
@@ -127,7 +127,7 @@ __vue_render__._withStripped = true;
|
|
|
127
127
|
/* style */
|
|
128
128
|
var __vue_inject_styles__ = undefined;
|
|
129
129
|
/* scoped */
|
|
130
|
-
var __vue_scope_id__ = "data-v-
|
|
130
|
+
var __vue_scope_id__ = "data-v-68db030e";
|
|
131
131
|
/* module identifier */
|
|
132
132
|
var __vue_module_identifier__ = undefined;
|
|
133
133
|
/* functional template */
|
package/es/SlPage/index.vue3.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".
|
|
3
|
+
var css_248z = ".main-box[data-v-68db030e]{display:flex;flex-direction:column;height:100%;width:100%}.sl-form[data-v-68db030e]{flex:1 0 1;transition:all .3s ease-in-out}.yl-form-box[data-v-68db030e]{display:inline}.search-btn[data-v-68db030e]{float:right;margin-left:20px}.fade-enter-active[data-v-68db030e],.fade-leave-active[data-v-68db030e]{transition:opacity .3s}.fade-enter[data-v-68db030e],.fade-leave-to[data-v-68db030e]{opacity:0}.sl-table-header[data-v-68db030e]{display:flex;justify-content:space-between;margin:10px 0}";
|
|
4
4
|
styleInject(css_248z);
|
|
5
5
|
|
|
6
6
|
export { css_248z as default };
|
package/es/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import SlGuide from './SlGuide/index.vue.js';
|
|
|
5
5
|
import SlPage from './SlPage/index.vue.js';
|
|
6
6
|
import SlTable from './SlTable/index.vue.js';
|
|
7
7
|
import SlTitle from './SlTitle/index.vue.js';
|
|
8
|
+
import DtTable from './DtTable/index.vue.js';
|
|
8
9
|
export { createCommandDialog } from './SlDialog/index.js';
|
|
9
10
|
export { createCommandDialogPlus } from './SlDialog/dialogPlus.js';
|
|
10
11
|
export { createCommandDrawer } from './SlDrawer/index.js';
|
|
@@ -21,7 +22,8 @@ var components = {
|
|
|
21
22
|
SlGuide: SlGuide,
|
|
22
23
|
SlPage: SlPage,
|
|
23
24
|
SlTable: SlTable,
|
|
24
|
-
SlTitle: SlTitle
|
|
25
|
+
SlTitle: SlTitle,
|
|
26
|
+
DtTable: DtTable
|
|
25
27
|
};
|
|
26
28
|
function install(Vue) {
|
|
27
29
|
if (install.installed) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ylwl-cpscoms",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "CPSB业务组件库 - Vue2 + Element UI通用业务组件",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"es/",
|
|
11
11
|
"lib/",
|
|
12
|
-
"dist/"
|
|
13
|
-
"src/"
|
|
12
|
+
"dist/"
|
|
14
13
|
],
|
|
15
14
|
"sideEffects": [
|
|
16
15
|
"**/*.css",
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import SlAlert from './index.vue'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/SlAlert',
|
|
5
|
-
component: SlAlert,
|
|
6
|
-
parameters: {
|
|
7
|
-
docs: {
|
|
8
|
-
description: {
|
|
9
|
-
component: '温馨提示组件,支持展开/收起消息内容,移动端默认收起。提供 message 和 operate 两个插槽。'
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// 代码展示通用模板
|
|
16
|
-
const codeBlock = (code) => `
|
|
17
|
-
<div style="margin-top:24px;border-top:1px solid #eee;padding-top:16px">
|
|
18
|
-
<p style="font-size:14px;font-weight:600;color:#666;margin-bottom:8px;">使用代码:</p>
|
|
19
|
-
<pre style="background:#f5f5f5;padding:16px;border-radius:4px;overflow-x:auto;font-size:13px;line-height:1.6;white-space:pre-wrap;word-break:break-all"><code>${escapeHtml(code.trim())}</code></pre>
|
|
20
|
-
</div>`
|
|
21
|
-
|
|
22
|
-
function escapeHtml(str) {
|
|
23
|
-
return str
|
|
24
|
-
.replace(/&/g, '&')
|
|
25
|
-
.replace(/</g, '<')
|
|
26
|
-
.replace(/>/g, '>')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ---- 基础用法 ----
|
|
30
|
-
const defaultCode = `<!-- 使用方式 -->
|
|
31
|
-
<sl-alert>
|
|
32
|
-
<template slot="message">
|
|
33
|
-
<p>1. 请确保填写的信息真实有效</p>
|
|
34
|
-
<p>2. 审核通过后将无法修改</p>
|
|
35
|
-
</template>
|
|
36
|
-
</sl-alert>`
|
|
37
|
-
|
|
38
|
-
export const Default = () => ({
|
|
39
|
-
components: { SlAlert },
|
|
40
|
-
template: `
|
|
41
|
-
<div>
|
|
42
|
-
<sl-alert>
|
|
43
|
-
<template slot="message">
|
|
44
|
-
<p>1. 请确保填写的信息真实有效</p>
|
|
45
|
-
<p>2. 审核通过后将无法修改</p>
|
|
46
|
-
</template>
|
|
47
|
-
</sl-alert>
|
|
48
|
-
${codeBlock(defaultCode)}
|
|
49
|
-
</div>`
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
Default.storyName = '基础用法'
|
|
53
|
-
|
|
54
|
-
// ---- 带操作按钮 ----
|
|
55
|
-
const operateCode = `<!-- 带操作按钮 -->
|
|
56
|
-
<sl-alert>
|
|
57
|
-
<template slot="message">
|
|
58
|
-
<p>操作提示信息</p>
|
|
59
|
-
</template>
|
|
60
|
-
<template slot="operate">
|
|
61
|
-
<el-button type="text" size="mini">查看帮助</el-button>
|
|
62
|
-
</template>
|
|
63
|
-
</sl-alert>`
|
|
64
|
-
|
|
65
|
-
export const WithOperate = () => ({
|
|
66
|
-
components: { SlAlert },
|
|
67
|
-
template: `
|
|
68
|
-
<div>
|
|
69
|
-
<sl-alert>
|
|
70
|
-
<template slot="message">
|
|
71
|
-
<p>操作提示信息</p>
|
|
72
|
-
</template>
|
|
73
|
-
<template slot="operate">
|
|
74
|
-
<el-button type="text" size="mini">查看帮助</el-button>
|
|
75
|
-
</template>
|
|
76
|
-
</sl-alert>
|
|
77
|
-
${codeBlock(operateCode)}
|
|
78
|
-
</div>`
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
WithOperate.storyName = '带操作按钮'
|
|
82
|
-
|
|
83
|
-
// ---- 多条消息 ----
|
|
84
|
-
const multiCode = `<!-- 多条消息提示 -->
|
|
85
|
-
<sl-alert>
|
|
86
|
-
<template slot="message">
|
|
87
|
-
<p>1. 删除后,该账号自动销号,此操作无法恢复</p>
|
|
88
|
-
<p>2. 删除前请确认所有数据已备份</p>
|
|
89
|
-
<p>3. 如有疑问请联系管理员</p>
|
|
90
|
-
</template>
|
|
91
|
-
</sl-alert>`
|
|
92
|
-
|
|
93
|
-
export const MultiMessage = () => ({
|
|
94
|
-
components: { SlAlert },
|
|
95
|
-
template: `
|
|
96
|
-
<div>
|
|
97
|
-
<sl-alert>
|
|
98
|
-
<template slot="message">
|
|
99
|
-
<p>1. 删除后,该账号自动销号,此操作无法恢复</p>
|
|
100
|
-
<p>2. 删除前请确认所有数据已备份</p>
|
|
101
|
-
<p>3. 如有疑问请联系管理员</p>
|
|
102
|
-
</template>
|
|
103
|
-
</sl-alert>
|
|
104
|
-
${codeBlock(multiCode)}
|
|
105
|
-
</div>`
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
MultiMessage.storyName = '多条消息'
|
package/src/SlAlert/index.vue
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
<div class="slMessage">
|
|
4
|
-
<div class="message-box">
|
|
5
|
-
<div class="message-title">
|
|
6
|
-
<div><i class="el-icon-warning"></i>
|
|
7
|
-
温馨提示
|
|
8
|
-
<el-button size="mini" type="text" class="toggle-button" @click="toggleMessage">
|
|
9
|
-
{{ isMessageVisible ? '收起' : '展开' }}
|
|
10
|
-
<i :class="isMessageVisible ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
|
|
11
|
-
</el-button>
|
|
12
|
-
</div>
|
|
13
|
-
<slot name="operate"></slot>
|
|
14
|
-
</div>
|
|
15
|
-
<div v-if="isMessageVisible" class="message-row" >
|
|
16
|
-
<slot name="message"></slot>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
<script>
|
|
22
|
-
import { isMobileDevice } from '../utils'
|
|
23
|
-
export default {
|
|
24
|
-
data() {
|
|
25
|
-
return {
|
|
26
|
-
isMessageVisible: !isMobileDevice()
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
methods: {
|
|
30
|
-
toggleMessage() {
|
|
31
|
-
this.isMessageVisible = !this.isMessageVisible
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</script>
|
|
36
|
-
<style scoped>
|
|
37
|
-
/* .slMessage { */
|
|
38
|
-
/* padding: 10px 20px 0px 20px; */
|
|
39
|
-
/* } */
|
|
40
|
-
.message-box {
|
|
41
|
-
background: #fdf6ec;
|
|
42
|
-
padding: 5px 10px 10px;
|
|
43
|
-
}
|
|
44
|
-
.message-title {
|
|
45
|
-
color: #f59a23d8;
|
|
46
|
-
display: flex;
|
|
47
|
-
justify-content: space-between;
|
|
48
|
-
align-items: center;
|
|
49
|
-
}
|
|
50
|
-
.message-row {
|
|
51
|
-
font-size: 12px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
</style>
|
package/src/SlAlert/remark.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<sl-alert>
|
|
4
|
-
<template slot="message">
|
|
5
|
-
1、删除后,该账号自动销号,此操作无法恢复'
|
|
6
|
-
</template>
|
|
7
|
-
</sl-alert>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
<script>
|
|
11
|
-
import SlAlert from '@/components/global/SlAlert'
|
|
12
|
-
export default {
|
|
13
|
-
components: {
|
|
14
|
-
SlAlert,
|
|
15
|
-
},
|
|
16
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import SlDescriptions from './index.vue'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/SlDescriptions',
|
|
5
|
-
component: SlDescriptions,
|
|
6
|
-
parameters: {
|
|
7
|
-
docs: {
|
|
8
|
-
description: {
|
|
9
|
-
component: '描述列表组件,基于 el-descriptions 封装。通过 renderData 传入模型和数据,自动渲染描述项。支持 format 格式化、template 自定义插槽、isShow 条件显示。'
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const codeBlock = (code) => `
|
|
16
|
-
<div style="margin-top:24px;border-top:1px solid #eee;padding-top:16px">
|
|
17
|
-
<p style="font-size:14px;font-weight:600;color:#666;margin-bottom:8px;">使用代码:</p>
|
|
18
|
-
<pre style="background:#f5f5f5;padding:16px;border-radius:4px;overflow-x:auto;font-size:13px;line-height:1.6;white-space:pre-wrap;word-break:break-all"><code>${escapeHtml(code.trim())}</code></pre>
|
|
19
|
-
</div>`
|
|
20
|
-
|
|
21
|
-
function escapeHtml(str) {
|
|
22
|
-
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// ---- 基础用法 ----
|
|
26
|
-
const defaultCode = `<!-- 使用方式 -->
|
|
27
|
-
<sl-descriptions :render-data="renderData" />
|
|
28
|
-
|
|
29
|
-
<!-- renderData 结构 -->
|
|
30
|
-
renderData: {
|
|
31
|
-
data: { name: '张三', age: 25, status: 1 },
|
|
32
|
-
model: [
|
|
33
|
-
{ prop: 'name', label: '姓名' },
|
|
34
|
-
{ prop: 'age', label: '年龄' },
|
|
35
|
-
{ prop: 'status', label: '状态' }
|
|
36
|
-
]
|
|
37
|
-
}`
|
|
38
|
-
|
|
39
|
-
export const Default = () => ({
|
|
40
|
-
components: { SlDescriptions },
|
|
41
|
-
data() {
|
|
42
|
-
return {
|
|
43
|
-
renderData: {
|
|
44
|
-
data: { name: '张三', age: 25, status: '启用', createTime: '2024-01-15' },
|
|
45
|
-
model: [
|
|
46
|
-
{ prop: 'name', label: '姓名' },
|
|
47
|
-
{ prop: 'age', label: '年龄' },
|
|
48
|
-
{ prop: 'status', label: '状态' },
|
|
49
|
-
{ prop: 'createTime', label: '创建时间' }
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
template: `
|
|
55
|
-
<div>
|
|
56
|
-
<sl-descriptions :render-data="renderData" />
|
|
57
|
-
${codeBlock(defaultCode)}
|
|
58
|
-
</div>`
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
Default.storyName = '基础用法'
|
|
62
|
-
|
|
63
|
-
// ---- 自定义列数 ----
|
|
64
|
-
const columnCode = `<!-- 自定义列数和尺寸 -->
|
|
65
|
-
<sl-descriptions :render-data="renderData" :el-table-props="{ column: 3, size: 'small' }" />`
|
|
66
|
-
|
|
67
|
-
export const CustomColumn = () => ({
|
|
68
|
-
components: { SlDescriptions },
|
|
69
|
-
data() {
|
|
70
|
-
return {
|
|
71
|
-
renderData: {
|
|
72
|
-
data: { name: '张三', age: 25, status: '启用', dept: '研发部', role: '前端开发', email: 'zhangsan@example.com' },
|
|
73
|
-
model: [
|
|
74
|
-
{ prop: 'name', label: '姓名' },
|
|
75
|
-
{ prop: 'age', label: '年龄' },
|
|
76
|
-
{ prop: 'status', label: '状态' },
|
|
77
|
-
{ prop: 'dept', label: '部门' },
|
|
78
|
-
{ prop: 'role', label: '角色' },
|
|
79
|
-
{ prop: 'email', label: '邮箱' }
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
template: `
|
|
85
|
-
<div>
|
|
86
|
-
<sl-descriptions :render-data="renderData" :el-table-props="{ column: 3, size: 'small' }" />
|
|
87
|
-
${codeBlock(columnCode)}
|
|
88
|
-
</div>`
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
CustomColumn.storyName = '自定义列数'
|
|
92
|
-
|
|
93
|
-
// ---- 空值处理 ----
|
|
94
|
-
const emptyCode = `<!-- 空值自动显示为 "-" -->
|
|
95
|
-
<sl-descriptions :render-data="renderData" />`
|
|
96
|
-
|
|
97
|
-
export const EmptyValue = () => ({
|
|
98
|
-
components: { SlDescriptions },
|
|
99
|
-
data() {
|
|
100
|
-
return {
|
|
101
|
-
renderData: {
|
|
102
|
-
data: { name: '李四', age: 0, status: '', phone: null },
|
|
103
|
-
model: [
|
|
104
|
-
{ prop: 'name', label: '姓名' },
|
|
105
|
-
{ prop: 'age', label: '年龄(0 正常显示)' },
|
|
106
|
-
{ prop: 'status', label: '状态(空值显示 -)' },
|
|
107
|
-
{ prop: 'phone', label: '电话(null 显示 -)' }
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
template: `
|
|
113
|
-
<div>
|
|
114
|
-
<sl-descriptions :render-data="renderData" :el-table-props="{ size: 'small' }" />
|
|
115
|
-
${codeBlock(emptyCode)}
|
|
116
|
-
</div>`
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
EmptyValue.storyName = '空值处理'
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<el-descriptions v-bind="elTableProps" size="small" border>
|
|
4
|
-
<el-descriptions-item v-for="item in renderData.model" v-if="isShow(item)" :key="item.name" >
|
|
5
|
-
<template slot="label">
|
|
6
|
-
{{ item.label }}
|
|
7
|
-
</template>
|
|
8
|
-
<span v-if="!item.format && !item.template"> {{ renderData.data[item.prop] || renderData.data[item.prop] === 0 ? renderData.data[item.prop] : '-' }}</span>
|
|
9
|
-
<renderOptions v-if="item.format && renderData.data" :render-options="item.format" :data="renderData.data" />
|
|
10
|
-
<slot v-if="item.template" :name="item.template" :data="renderData.data" />
|
|
11
|
-
</el-descriptions-item>
|
|
12
|
-
</el-descriptions>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: 'SlDescriptions',
|
|
20
|
-
components: {
|
|
21
|
-
renderOptions: () => import('./renderOptions.vue')
|
|
22
|
-
},
|
|
23
|
-
props: {
|
|
24
|
-
renderData: {
|
|
25
|
-
type: Object,
|
|
26
|
-
required: true
|
|
27
|
-
},
|
|
28
|
-
elTableProps: {
|
|
29
|
-
type: Object,
|
|
30
|
-
default: () => {
|
|
31
|
-
return {
|
|
32
|
-
size: 'small',
|
|
33
|
-
column: 2
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
data() {
|
|
39
|
-
return {}
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
methods: {
|
|
43
|
-
isShow(item) {
|
|
44
|
-
if (item.isShow !== undefined) {
|
|
45
|
-
if (typeof item.isShow === 'function') {
|
|
46
|
-
return item.isShow(this.renderData.data)
|
|
47
|
-
} else {
|
|
48
|
-
return item.isShow
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
return true
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<style lang="css" scoped>
|
|
59
|
-
|
|
60
|
-
</style>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
export default {
|
|
3
|
-
name: 'EcSystemsRenderOptions',
|
|
4
|
-
props: {
|
|
5
|
-
renderOptions: {
|
|
6
|
-
type: Function,
|
|
7
|
-
default: () => ({})
|
|
8
|
-
},
|
|
9
|
-
data: {
|
|
10
|
-
type: Object,
|
|
11
|
-
default: () => ({})
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
render(h) {
|
|
15
|
-
if (this._props.renderOptions) {
|
|
16
|
-
const callback = this._props.renderOptions(h, this._props.data)
|
|
17
|
-
if (typeof callback === 'string') {
|
|
18
|
-
return h('span', callback)
|
|
19
|
-
} else {
|
|
20
|
-
return callback
|
|
21
|
-
}
|
|
22
|
-
} else {
|
|
23
|
-
return ''
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
</script>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# createCommandDialog_v5 使用说明(Portal 传送门版)
|
|
2
|
-
|
|
3
|
-
这是彻底解决“业务组件内聚”与“复用 el-dialog 原生插槽”冲突的最优雅方案。
|
|
4
|
-
|
|
5
|
-
我们在底层实现了一个类似于 Vue 3 `<Teleport>` (或 portal-vue) 的全局辅助组件 `<dialog-footer>`。你只需要在你的业务组件里用这个标签把按钮包起来,它就会自动“飞”到外层弹窗的右下角。
|
|
6
|
-
|
|
7
|
-
## 1. 快速开始
|
|
8
|
-
|
|
9
|
-
### 引入和调用
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
```javascript
|
|
13
|
-
import { createCommandDialog } from './createCommandDialog_v5'
|
|
14
|
-
import MyCustomForm from './MyCustomForm.vue'
|
|
15
|
-
|
|
16
|
-
createCommandDialog({
|
|
17
|
-
title: '编辑用户信息',
|
|
18
|
-
contentComponent: MyCustomForm,
|
|
19
|
-
contentProps: { userId: 123 }
|
|
20
|
-
})
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## 2. 业务组件怎么写? (`MyCustomForm.vue`)
|
|
24
|
-
|
|
25
|
-
在你的组件模板中,正常编写主体内容。在你想写底部按钮的地方,使用 `<dialog-footer>` 标签包裹它们即可!
|
|
26
|
-
|
|
27
|
-
```vue
|
|
28
|
-
<template>
|
|
29
|
-
<div class="my-custom-form">
|
|
30
|
-
<!-- 这里是弹窗的主体内容 -->
|
|
31
|
-
<el-form label-width="80px">
|
|
32
|
-
<el-form-item label="用户名">
|
|
33
|
-
<el-input v-model="form.name"></el-input>
|
|
34
|
-
</el-form-item>
|
|
35
|
-
</el-form>
|
|
36
|
-
|
|
37
|
-
<!-- 🌟 只需要用这个标签包裹你的按钮 🌟 -->
|
|
38
|
-
<!-- 这些按钮会自动跑到 el-dialog 的原生 footer 区域 -->
|
|
39
|
-
<dialog-footer>
|
|
40
|
-
<el-button @click="handleCancel">取 消</el-button>
|
|
41
|
-
<el-button type="warning" @click="handleDraft">暂 存</el-button>
|
|
42
|
-
<el-button type="primary" :loading="loading" @click="handleSubmit">确 定</el-button>
|
|
43
|
-
</dialog-footer>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script>
|
|
48
|
-
export default {
|
|
49
|
-
data() {
|
|
50
|
-
return {
|
|
51
|
-
loading: false,
|
|
52
|
-
form: { name: '' }
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
methods: {
|
|
56
|
-
handleCancel() {
|
|
57
|
-
this.$emit('close') // 关闭弹窗
|
|
58
|
-
},
|
|
59
|
-
handleDraft() {
|
|
60
|
-
// 执行暂存逻辑...
|
|
61
|
-
},
|
|
62
|
-
async handleSubmit() {
|
|
63
|
-
this.loading = true
|
|
64
|
-
// ... 发送请求 ...
|
|
65
|
-
setTimeout(() => {
|
|
66
|
-
this.loading = false
|
|
67
|
-
this.$emit('confirm') // 触发外层 onConfirm 并关闭
|
|
68
|
-
}, 1000)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
</script>
|
|
73
|
-
```
|
|
74
|
-
|