@lambo-design/detail-table 1.0.0-beta.30 → 1.0.0-beta.31
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/index.js +8 -8
- package/package.json +3 -3
- package/src/components/Col.js +149 -149
- package/src/components/Row.js +73 -73
- package/src/components/props-util.js +335 -335
- package/src/components/vnode.js +147 -147
- package/src/detail-table-item.vue +23 -23
- package/src/detail-table.vue +180 -181
- package/src/styles/css/index.less +144 -144
package/src/components/vnode.js
CHANGED
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
import { filterEmpty, parseStyleText } from './props-util';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
|
|
4
|
-
export function cloneVNode(vnode, deep) {
|
|
5
|
-
const componentOptions = vnode.componentOptions;
|
|
6
|
-
const data = vnode.data;
|
|
7
|
-
|
|
8
|
-
let listeners = {};
|
|
9
|
-
if (componentOptions && componentOptions.listeners) {
|
|
10
|
-
listeners = { ...componentOptions.listeners };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let on = {};
|
|
14
|
-
if (data && data.on) {
|
|
15
|
-
on = { ...data.on };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const cloned = new vnode.constructor(
|
|
19
|
-
vnode.tag,
|
|
20
|
-
data ? { ...data, on } : data,
|
|
21
|
-
vnode.children,
|
|
22
|
-
vnode.text,
|
|
23
|
-
vnode.elm,
|
|
24
|
-
vnode.context,
|
|
25
|
-
componentOptions ? { ...componentOptions, listeners } : componentOptions,
|
|
26
|
-
vnode.asyncFactory,
|
|
27
|
-
);
|
|
28
|
-
cloned.ns = vnode.ns;
|
|
29
|
-
cloned.isStatic = vnode.isStatic;
|
|
30
|
-
cloned.key = vnode.key;
|
|
31
|
-
cloned.isComment = vnode.isComment;
|
|
32
|
-
cloned.fnContext = vnode.fnContext;
|
|
33
|
-
cloned.fnOptions = vnode.fnOptions;
|
|
34
|
-
cloned.fnScopeId = vnode.fnScopeId;
|
|
35
|
-
cloned.isCloned = true;
|
|
36
|
-
if (deep) {
|
|
37
|
-
if (vnode.children) {
|
|
38
|
-
cloned.children = cloneVNodes(vnode.children, true);
|
|
39
|
-
}
|
|
40
|
-
if (componentOptions && componentOptions.children) {
|
|
41
|
-
componentOptions.children = cloneVNodes(componentOptions.children, true);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return cloned;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function cloneVNodes(vnodes, deep) {
|
|
48
|
-
const len = vnodes.length;
|
|
49
|
-
const res = new Array(len);
|
|
50
|
-
for (let i = 0; i < len; i++) {
|
|
51
|
-
res[i] = cloneVNode(vnodes[i], deep);
|
|
52
|
-
}
|
|
53
|
-
return res;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function cloneElement(n, nodeProps = {}, deep) {
|
|
57
|
-
let ele = n;
|
|
58
|
-
if (Array.isArray(n)) {
|
|
59
|
-
ele = filterEmpty(n)[0];
|
|
60
|
-
}
|
|
61
|
-
if (!ele) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
const node = cloneVNode(ele, deep);
|
|
65
|
-
// // 函数式组件不支持clone https://github.com/vueComponent/ant-design-vue/pull/1947
|
|
66
|
-
// warning(
|
|
67
|
-
// !(node.fnOptions && node.fnOptions.functional),
|
|
68
|
-
// `can not use cloneElement for functional component (${node.fnOptions && node.fnOptions.name})`,
|
|
69
|
-
// );
|
|
70
|
-
const { props = {}, key, on = {}, nativeOn = {}, children, directives = [] } = nodeProps;
|
|
71
|
-
const data = node.data || {};
|
|
72
|
-
let cls = {};
|
|
73
|
-
let style = {};
|
|
74
|
-
const {
|
|
75
|
-
attrs = {},
|
|
76
|
-
ref,
|
|
77
|
-
domProps = {},
|
|
78
|
-
style: tempStyle = {},
|
|
79
|
-
class: tempCls = {},
|
|
80
|
-
scopedSlots = {},
|
|
81
|
-
} = nodeProps;
|
|
82
|
-
|
|
83
|
-
if (typeof data.style === 'string') {
|
|
84
|
-
style = parseStyleText(data.style);
|
|
85
|
-
} else {
|
|
86
|
-
style = { ...data.style, ...style };
|
|
87
|
-
}
|
|
88
|
-
if (typeof tempStyle === 'string') {
|
|
89
|
-
style = { ...style, ...parseStyleText(style) };
|
|
90
|
-
} else {
|
|
91
|
-
style = { ...style, ...tempStyle };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (typeof data.class === 'string' && data.class.trim() !== '') {
|
|
95
|
-
data.class.split(' ').forEach(c => {
|
|
96
|
-
cls[c.trim()] = true;
|
|
97
|
-
});
|
|
98
|
-
} else if (Array.isArray(data.class)) {
|
|
99
|
-
classNames(data.class)
|
|
100
|
-
.split(' ')
|
|
101
|
-
.forEach(c => {
|
|
102
|
-
cls[c.trim()] = true;
|
|
103
|
-
});
|
|
104
|
-
} else {
|
|
105
|
-
cls = { ...data.class, ...cls };
|
|
106
|
-
}
|
|
107
|
-
if (typeof tempCls === 'string' && tempCls.trim() !== '') {
|
|
108
|
-
tempCls.split(' ').forEach(c => {
|
|
109
|
-
cls[c.trim()] = true;
|
|
110
|
-
});
|
|
111
|
-
} else {
|
|
112
|
-
cls = { ...cls, ...tempCls };
|
|
113
|
-
}
|
|
114
|
-
node.data = Object.assign({}, data, {
|
|
115
|
-
style,
|
|
116
|
-
attrs: { ...data.attrs, ...attrs },
|
|
117
|
-
class: cls,
|
|
118
|
-
domProps: { ...data.domProps, ...domProps },
|
|
119
|
-
scopedSlots: { ...data.scopedSlots, ...scopedSlots },
|
|
120
|
-
directives: [...(data.directives || []), ...directives],
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
if (node.componentOptions) {
|
|
124
|
-
node.componentOptions.propsData = node.componentOptions.propsData || {};
|
|
125
|
-
node.componentOptions.listeners = node.componentOptions.listeners || {};
|
|
126
|
-
node.componentOptions.propsData = { ...node.componentOptions.propsData, ...props };
|
|
127
|
-
node.componentOptions.listeners = { ...node.componentOptions.listeners, ...on };
|
|
128
|
-
if (children) {
|
|
129
|
-
node.componentOptions.children = children;
|
|
130
|
-
}
|
|
131
|
-
} else {
|
|
132
|
-
if (children) {
|
|
133
|
-
node.children = children;
|
|
134
|
-
}
|
|
135
|
-
node.data.on = { ...(node.data.on || {}), ...on };
|
|
136
|
-
}
|
|
137
|
-
node.data.on = { ...(node.data.on || {}), ...nativeOn };
|
|
138
|
-
|
|
139
|
-
if (key !== undefined) {
|
|
140
|
-
node.key = key;
|
|
141
|
-
node.data.key = key;
|
|
142
|
-
}
|
|
143
|
-
if (typeof ref === 'string') {
|
|
144
|
-
node.data.ref = ref;
|
|
145
|
-
}
|
|
146
|
-
return node;
|
|
147
|
-
}
|
|
1
|
+
import { filterEmpty, parseStyleText } from './props-util';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
|
|
4
|
+
export function cloneVNode(vnode, deep) {
|
|
5
|
+
const componentOptions = vnode.componentOptions;
|
|
6
|
+
const data = vnode.data;
|
|
7
|
+
|
|
8
|
+
let listeners = {};
|
|
9
|
+
if (componentOptions && componentOptions.listeners) {
|
|
10
|
+
listeners = { ...componentOptions.listeners };
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let on = {};
|
|
14
|
+
if (data && data.on) {
|
|
15
|
+
on = { ...data.on };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const cloned = new vnode.constructor(
|
|
19
|
+
vnode.tag,
|
|
20
|
+
data ? { ...data, on } : data,
|
|
21
|
+
vnode.children,
|
|
22
|
+
vnode.text,
|
|
23
|
+
vnode.elm,
|
|
24
|
+
vnode.context,
|
|
25
|
+
componentOptions ? { ...componentOptions, listeners } : componentOptions,
|
|
26
|
+
vnode.asyncFactory,
|
|
27
|
+
);
|
|
28
|
+
cloned.ns = vnode.ns;
|
|
29
|
+
cloned.isStatic = vnode.isStatic;
|
|
30
|
+
cloned.key = vnode.key;
|
|
31
|
+
cloned.isComment = vnode.isComment;
|
|
32
|
+
cloned.fnContext = vnode.fnContext;
|
|
33
|
+
cloned.fnOptions = vnode.fnOptions;
|
|
34
|
+
cloned.fnScopeId = vnode.fnScopeId;
|
|
35
|
+
cloned.isCloned = true;
|
|
36
|
+
if (deep) {
|
|
37
|
+
if (vnode.children) {
|
|
38
|
+
cloned.children = cloneVNodes(vnode.children, true);
|
|
39
|
+
}
|
|
40
|
+
if (componentOptions && componentOptions.children) {
|
|
41
|
+
componentOptions.children = cloneVNodes(componentOptions.children, true);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return cloned;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function cloneVNodes(vnodes, deep) {
|
|
48
|
+
const len = vnodes.length;
|
|
49
|
+
const res = new Array(len);
|
|
50
|
+
for (let i = 0; i < len; i++) {
|
|
51
|
+
res[i] = cloneVNode(vnodes[i], deep);
|
|
52
|
+
}
|
|
53
|
+
return res;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function cloneElement(n, nodeProps = {}, deep) {
|
|
57
|
+
let ele = n;
|
|
58
|
+
if (Array.isArray(n)) {
|
|
59
|
+
ele = filterEmpty(n)[0];
|
|
60
|
+
}
|
|
61
|
+
if (!ele) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const node = cloneVNode(ele, deep);
|
|
65
|
+
// // 函数式组件不支持clone https://github.com/vueComponent/ant-design-vue/pull/1947
|
|
66
|
+
// warning(
|
|
67
|
+
// !(node.fnOptions && node.fnOptions.functional),
|
|
68
|
+
// `can not use cloneElement for functional component (${node.fnOptions && node.fnOptions.name})`,
|
|
69
|
+
// );
|
|
70
|
+
const { props = {}, key, on = {}, nativeOn = {}, children, directives = [] } = nodeProps;
|
|
71
|
+
const data = node.data || {};
|
|
72
|
+
let cls = {};
|
|
73
|
+
let style = {};
|
|
74
|
+
const {
|
|
75
|
+
attrs = {},
|
|
76
|
+
ref,
|
|
77
|
+
domProps = {},
|
|
78
|
+
style: tempStyle = {},
|
|
79
|
+
class: tempCls = {},
|
|
80
|
+
scopedSlots = {},
|
|
81
|
+
} = nodeProps;
|
|
82
|
+
|
|
83
|
+
if (typeof data.style === 'string') {
|
|
84
|
+
style = parseStyleText(data.style);
|
|
85
|
+
} else {
|
|
86
|
+
style = { ...data.style, ...style };
|
|
87
|
+
}
|
|
88
|
+
if (typeof tempStyle === 'string') {
|
|
89
|
+
style = { ...style, ...parseStyleText(style) };
|
|
90
|
+
} else {
|
|
91
|
+
style = { ...style, ...tempStyle };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (typeof data.class === 'string' && data.class.trim() !== '') {
|
|
95
|
+
data.class.split(' ').forEach(c => {
|
|
96
|
+
cls[c.trim()] = true;
|
|
97
|
+
});
|
|
98
|
+
} else if (Array.isArray(data.class)) {
|
|
99
|
+
classNames(data.class)
|
|
100
|
+
.split(' ')
|
|
101
|
+
.forEach(c => {
|
|
102
|
+
cls[c.trim()] = true;
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
cls = { ...data.class, ...cls };
|
|
106
|
+
}
|
|
107
|
+
if (typeof tempCls === 'string' && tempCls.trim() !== '') {
|
|
108
|
+
tempCls.split(' ').forEach(c => {
|
|
109
|
+
cls[c.trim()] = true;
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
cls = { ...cls, ...tempCls };
|
|
113
|
+
}
|
|
114
|
+
node.data = Object.assign({}, data, {
|
|
115
|
+
style,
|
|
116
|
+
attrs: { ...data.attrs, ...attrs },
|
|
117
|
+
class: cls,
|
|
118
|
+
domProps: { ...data.domProps, ...domProps },
|
|
119
|
+
scopedSlots: { ...data.scopedSlots, ...scopedSlots },
|
|
120
|
+
directives: [...(data.directives || []), ...directives],
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (node.componentOptions) {
|
|
124
|
+
node.componentOptions.propsData = node.componentOptions.propsData || {};
|
|
125
|
+
node.componentOptions.listeners = node.componentOptions.listeners || {};
|
|
126
|
+
node.componentOptions.propsData = { ...node.componentOptions.propsData, ...props };
|
|
127
|
+
node.componentOptions.listeners = { ...node.componentOptions.listeners, ...on };
|
|
128
|
+
if (children) {
|
|
129
|
+
node.componentOptions.children = children;
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
if (children) {
|
|
133
|
+
node.children = children;
|
|
134
|
+
}
|
|
135
|
+
node.data.on = { ...(node.data.on || {}), ...on };
|
|
136
|
+
}
|
|
137
|
+
node.data.on = { ...(node.data.on || {}), ...nativeOn };
|
|
138
|
+
|
|
139
|
+
if (key !== undefined) {
|
|
140
|
+
node.key = key;
|
|
141
|
+
node.data.key = key;
|
|
142
|
+
}
|
|
143
|
+
if (typeof ref === 'string') {
|
|
144
|
+
node.data.ref = ref;
|
|
145
|
+
}
|
|
146
|
+
return node;
|
|
147
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<template></template>
|
|
2
|
-
<script>
|
|
3
|
-
export default {
|
|
4
|
-
name: 'LamboDetailTableItem',
|
|
5
|
-
props: {
|
|
6
|
-
prefixCls: {
|
|
7
|
-
type: String,
|
|
8
|
-
default: "lambo-detail-table",
|
|
9
|
-
},
|
|
10
|
-
label: String,
|
|
11
|
-
span: {
|
|
12
|
-
type: Number,
|
|
13
|
-
default: 1
|
|
14
|
-
},
|
|
15
|
-
promptInfo: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: ""
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
22
|
-
<style lang="less" scoped>
|
|
23
|
-
</style>
|
|
1
|
+
<template></template>
|
|
2
|
+
<script>
|
|
3
|
+
export default {
|
|
4
|
+
name: 'LamboDetailTableItem',
|
|
5
|
+
props: {
|
|
6
|
+
prefixCls: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: "lambo-detail-table",
|
|
9
|
+
},
|
|
10
|
+
label: String,
|
|
11
|
+
span: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 1
|
|
14
|
+
},
|
|
15
|
+
promptInfo: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ""
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
<style lang="less" scoped>
|
|
23
|
+
</style>
|