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
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import SlTitle from './index.vue'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/SlTitle',
|
|
5
|
-
component: SlTitle,
|
|
6
|
-
argTypes: {
|
|
7
|
-
title: { control: 'text', description: '标题文字' }
|
|
8
|
-
},
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: {
|
|
11
|
-
description: {
|
|
12
|
-
component: '页面标题组件,左侧显示标题文字(带蓝色竖线装饰),右侧插槽可放置操作按钮。'
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const codeBlock = (code) => `
|
|
19
|
-
<div style="margin-top:24px;border-top:1px solid #eee;padding-top:16px">
|
|
20
|
-
<p style="font-size:14px;font-weight:600;color:#666;margin-bottom:8px;">使用代码:</p>
|
|
21
|
-
<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>
|
|
22
|
-
</div>`
|
|
23
|
-
|
|
24
|
-
function escapeHtml(str) {
|
|
25
|
-
return str
|
|
26
|
-
.replace(/&/g, '&')
|
|
27
|
-
.replace(/</g, '<')
|
|
28
|
-
.replace(/>/g, '>')
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ---- 基础用法(带操作按钮) ----
|
|
32
|
-
const defaultCode = `<!-- 使用方式 -->
|
|
33
|
-
<sl-title title="基本信息">
|
|
34
|
-
<el-button type="primary" size="small">编辑</el-button>
|
|
35
|
-
</sl-title>`
|
|
36
|
-
|
|
37
|
-
export const Default = (args, { argTypes }) => ({
|
|
38
|
-
components: { SlTitle },
|
|
39
|
-
props: Object.keys(argTypes),
|
|
40
|
-
template: `
|
|
41
|
-
<div>
|
|
42
|
-
<sl-title v-bind="$props">
|
|
43
|
-
<el-button type="primary" size="small">编辑</el-button>
|
|
44
|
-
</sl-title>
|
|
45
|
-
${codeBlock(defaultCode)}
|
|
46
|
-
</div>`
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
Default.args = {
|
|
50
|
-
title: '基本信息'
|
|
51
|
-
}
|
|
52
|
-
Default.storyName = '基础用法'
|
|
53
|
-
|
|
54
|
-
// ---- 纯标题 ----
|
|
55
|
-
const noActionCode = `<!-- 纯标题,无右侧操作 -->
|
|
56
|
-
<sl-title title="纯标题" />`
|
|
57
|
-
|
|
58
|
-
export const NoAction = (args, { argTypes }) => ({
|
|
59
|
-
components: { SlTitle },
|
|
60
|
-
props: Object.keys(argTypes),
|
|
61
|
-
template: `
|
|
62
|
-
<div>
|
|
63
|
-
<sl-title v-bind="$props" />
|
|
64
|
-
${codeBlock(noActionCode)}
|
|
65
|
-
</div>`
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
NoAction.args = {
|
|
69
|
-
title: '纯标题'
|
|
70
|
-
}
|
|
71
|
-
NoAction.storyName = '纯标题'
|
|
72
|
-
|
|
73
|
-
// ---- 多个操作按钮 ----
|
|
74
|
-
const multiActionCode = `<!-- 多个操作按钮 -->
|
|
75
|
-
<sl-title title="用户列表">
|
|
76
|
-
<el-button type="primary" size="mini">新增</el-button>
|
|
77
|
-
<el-button type="success" size="mini">导出</el-button>
|
|
78
|
-
<el-button size="mini">刷新</el-button>
|
|
79
|
-
</sl-title>`
|
|
80
|
-
|
|
81
|
-
export const MultiAction = (args, { argTypes }) => ({
|
|
82
|
-
components: { SlTitle },
|
|
83
|
-
props: Object.keys(argTypes),
|
|
84
|
-
template: `
|
|
85
|
-
<div>
|
|
86
|
-
<sl-title v-bind="$props">
|
|
87
|
-
<el-button type="primary" size="mini">新增</el-button>
|
|
88
|
-
<el-button type="success" size="mini">导出</el-button>
|
|
89
|
-
<el-button size="small">刷新</el-button>
|
|
90
|
-
</sl-title>
|
|
91
|
-
${codeBlock(multiActionCode)}
|
|
92
|
-
</div>`
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
MultiAction.args = {
|
|
96
|
-
title: '用户列表'
|
|
97
|
-
}
|
|
98
|
-
MultiAction.storyName = '多个操作按钮'
|
package/src/SlTitle/index.vue
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="sl_title">
|
|
3
|
-
<div class="title_name">
|
|
4
|
-
{{ title }}
|
|
5
|
-
</div>
|
|
6
|
-
<div>
|
|
7
|
-
<slot></slot>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
<script>
|
|
12
|
-
export default {
|
|
13
|
-
name: 'SlTitle',
|
|
14
|
-
props: {
|
|
15
|
-
title: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: ''
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
data() {
|
|
21
|
-
return {
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
methods: {
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
</script>
|
|
29
|
-
<style lang="css" scoped>
|
|
30
|
-
.sl_title {
|
|
31
|
-
display: flex;
|
|
32
|
-
justify-content: space-between;
|
|
33
|
-
margin: 10px 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.title_name {
|
|
37
|
-
font-weight: 700;
|
|
38
|
-
color: #000;
|
|
39
|
-
font-size: 12px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.title_name::before {
|
|
44
|
-
content: " ";
|
|
45
|
-
border: 2px solid #409EFF;
|
|
46
|
-
margin-right: 10px;
|
|
47
|
-
margin-left: 2px;
|
|
48
|
-
}
|
|
49
|
-
</style>
|
package/src/global.css
DELETED
package/src/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// CPSB Component Library Entry Point
|
|
2
|
-
// Supports Vue.use() global registration and named imports
|
|
3
|
-
|
|
4
|
-
import SlAlert from './SlAlert/index.vue'
|
|
5
|
-
import SlDescriptions from './SlDescriptions/index.vue'
|
|
6
|
-
import SlForm from './SlForm/index.vue'
|
|
7
|
-
import SlGuide from './SlGuide/index.vue'
|
|
8
|
-
import SlPage from './SlPage/index.vue'
|
|
9
|
-
import SlTable from './SlTable/index.vue'
|
|
10
|
-
import SlTitle from './SlTitle/index.vue'
|
|
11
|
-
|
|
12
|
-
export { createCommandDialog } from './SlDialog/index.js'
|
|
13
|
-
export { createCommandDialogPlus } from './SlDialog/dialogPlus.js'
|
|
14
|
-
export { createCommandDrawer } from './SlDrawer/index.js'
|
|
15
|
-
export { showConfirmMessageBox } from './SlMessageBox/index.js'
|
|
16
|
-
|
|
17
|
-
export * from './utils/index.js'
|
|
18
|
-
|
|
19
|
-
const components = {
|
|
20
|
-
SlAlert,
|
|
21
|
-
SlDescriptions,
|
|
22
|
-
SlForm,
|
|
23
|
-
SlGuide,
|
|
24
|
-
SlPage,
|
|
25
|
-
SlTable,
|
|
26
|
-
SlTitle
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function install(Vue, options = {}) {
|
|
30
|
-
if (install.installed) return
|
|
31
|
-
install.installed = true
|
|
32
|
-
|
|
33
|
-
Object.keys(components).forEach(name => {
|
|
34
|
-
Vue.component(name, components[name])
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (typeof window !== 'undefined' && window.Vue) {
|
|
39
|
-
window.Vue.use(install)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { SlAlert, SlDescriptions, SlForm, SlGuide, SlPage, SlTable, SlTitle }
|
|
43
|
-
|
|
44
|
-
export default {
|
|
45
|
-
install,
|
|
46
|
-
version: '1.0.0'
|
|
47
|
-
}
|
package/src/store/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// SlPage 组件的 store 适配层,底层使用 localStorage 存取列配置
|
|
2
|
-
import { getColConfig, saveColConfig, getAllColConfig } from '@/components/global/utils/tableConfig'
|
|
3
|
-
|
|
4
|
-
const store = {
|
|
5
|
-
state: {
|
|
6
|
-
tableConfig: {
|
|
7
|
-
get colConfig() {
|
|
8
|
-
return getAllColConfig()
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
dispatch(action, payload) {
|
|
13
|
-
if (action === 'saveStorageCustomCol') {
|
|
14
|
-
saveColConfig(payload.key, payload.type, payload.value)
|
|
15
|
-
}
|
|
16
|
-
// getStorageCustomCol 无需操作,computed 中直接读取 state.tableConfig.colConfig
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default store
|
package/src/utils/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import CryptoJS from 'crypto-js'
|
|
2
|
-
export function typeOf(fn, type) {
|
|
3
|
-
return typeof fn === type
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function hasKey(obj, keys) {
|
|
7
|
-
if (!Array.isArray(keys) && typeOf(keys, 'string')) {
|
|
8
|
-
return obj.hasOwnProperty(keys)
|
|
9
|
-
}
|
|
10
|
-
return keys.every(key => obj.hasOwnProperty(key))
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function filterKey(obj = {}, fiterAry = []) {
|
|
14
|
-
return Object.keys(obj)
|
|
15
|
-
.filter((key) => !fiterAry.includes(key))
|
|
16
|
-
.reduce((pre, key) => {
|
|
17
|
-
pre[key] = obj[key]
|
|
18
|
-
return pre
|
|
19
|
-
}, {})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function transformName(str) {
|
|
23
|
-
return str.split('-').reduce((pre, word) => {
|
|
24
|
-
pre += word.slice(0, 1).toUpperCase() + word.slice(1)
|
|
25
|
-
return pre
|
|
26
|
-
}, '')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function generateUniqueId(input) {
|
|
30
|
-
try {
|
|
31
|
-
const hash = CryptoJS.SHA256(input)
|
|
32
|
-
return hash.toString(CryptoJS.enc.Base64)
|
|
33
|
-
} catch (error) {
|
|
34
|
-
throw new Error('生成唯一字符失败')
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function getValueByPath(obj, path) {
|
|
39
|
-
if (typeof path === 'string') {
|
|
40
|
-
path = path.split(',')
|
|
41
|
-
}
|
|
42
|
-
return path.reduce((acc, key) => acc && acc[key], obj)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function isMobileDevice() {
|
|
46
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
47
|
-
}
|
package/src/utils/tableConfig.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// 表格列配置的 localStorage 存取工具
|
|
2
|
-
|
|
3
|
-
const STORAGE_KEY = 'colConfig'
|
|
4
|
-
|
|
5
|
-
function readAll() {
|
|
6
|
-
try {
|
|
7
|
-
return JSON.parse(localStorage.getItem(STORAGE_KEY)) || {}
|
|
8
|
-
} catch (e) {
|
|
9
|
-
return {}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function writeAll(data) {
|
|
14
|
-
localStorage.setItem(STORAGE_KEY, JSON.stringify(data))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function getColConfig(key) {
|
|
18
|
-
const all = readAll()
|
|
19
|
-
return all[key] || {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function saveColConfig(key, type, value) {
|
|
23
|
-
const all = readAll()
|
|
24
|
-
if (!all[key]) {
|
|
25
|
-
all[key] = {}
|
|
26
|
-
}
|
|
27
|
-
all[key][type] = value
|
|
28
|
-
writeAll(all)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getAllColConfig() {
|
|
32
|
-
return readAll()
|
|
33
|
-
}
|