@panpanzhao/component-ui 0.0.5 → 0.0.6
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/lib/component-ui.common.js +610 -137
- package/lib/components/crud.js +47 -30
- package/lib/components/dialog.js +4 -4
- package/lib/components/form-dialog.js +14 -12
- package/lib/components/form-group.js +4 -2
- package/lib/components/form-input.js +138 -51
- package/lib/components/form-item.js +4 -4
- package/lib/components/form-view-dialog.js +14 -9
- package/lib/components/form-view-group.js +11 -5
- package/lib/components/form-view.js +7 -3
- package/lib/components/formula.js +358 -18
- package/lib/components/table-column.js +374 -14
- package/lib/components/table-editable.js +400 -22
- package/lib/components/table-search.js +35 -33
- package/lib/components/table.js +18 -12
- package/lib/index.js +1 -1
- package/lib/styles/component-ui.css +1 -1
- package/lib/styles/index.css +1 -1
- package/lib/styles/table-editable.css +1 -1
- package/lib/styles/table.css +1 -1
- package/lib/utils/helper.js +11 -45
- package/lib/utils/index.js +15 -0
- package/lib/utils/tree.js +333 -0
- package/package.json +2 -2
- package/src/index.js +67 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
.popover-error{color:#f56c6c;font-size:14px;line-height:22px;padding:12px;white-space:normal}.popover-error .popper__arrow{left:15px!important}.column-form-item.is-error .el-input__inner,.column-form-item.is-error .el-input__inner:focus,.column-form-item.is-error .el-textarea__inner,.column-form-item.is-error .el-textarea__inner:focus{border-color:#f56c6c}
|
|
1
|
+
.popover-error{color:#f56c6c;font-size:14px;line-height:22px;padding:12px;white-space:normal}.popover-error .popper__arrow{left:15px!important}.column-form-item.is-error .el-input__inner,.column-form-item.is-error .el-input__inner:focus,.column-form-item.is-error .el-textarea__inner,.column-form-item.is-error .el-textarea__inner:focus{border-color:#f56c6c}.table-editable .el-table__row .cell{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.table-editable .el-table__row .cell .column-form-item,.table-editable .el-table__row .cell .column-form-item .el-select{width:100%}
|
package/lib/styles/table.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.el-table__fixed{height:100%!important}.el-radio .el-radio__label{padding-left:0}.tool .el-button+.el-button,.tool .el-button+.el-dropdown,.tool .el-link+.el-dropdown,.tool .el-link+.el-link{margin-left:10px}.table-page_tools{text-align:center}
|
|
1
|
+
.el-table__fixed{height:100%!important}.el-radio .el-radio__label{padding-left:0}.tool{white-space:nowrap}.tool .el-button+.el-button,.tool .el-button+.el-dropdown,.tool .el-link+.el-dropdown,.tool .el-link+.el-link{margin-left:10px}.table-page_tools{text-align:center}
|
package/lib/utils/helper.js
CHANGED
|
@@ -1,48 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
result = item;
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
19
|
-
});
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* 判断树中每个节点是否满足某个条件。
|
|
25
|
-
* @param tree
|
|
26
|
-
* @param iterator
|
|
27
|
-
*/
|
|
28
|
-
function everyTree(tree, iterator, level, paths, indexes) {
|
|
29
|
-
if (level === void 0) {
|
|
30
|
-
level = 1;
|
|
31
|
-
}
|
|
32
|
-
if (paths === void 0) {
|
|
33
|
-
paths = [];
|
|
34
|
-
}
|
|
35
|
-
if (indexes === void 0) {
|
|
36
|
-
indexes = [];
|
|
37
|
-
}
|
|
38
|
-
if (!Array.isArray(tree)) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return tree.every(function (item, index) {
|
|
42
|
-
var value = iterator(item, index, level, paths, indexes);
|
|
43
|
-
if (value && item.children && item.children.splice) {
|
|
44
|
-
return everyTree(item.children, iterator, level + 1, paths.concat(item), indexes.concat(index));
|
|
45
|
-
}
|
|
46
|
-
return value;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
4
|
+
exports.uuid = void 0;
|
|
5
|
+
// 参考 https://github.com/streamich/v4-uuid
|
|
6
|
+
var str = function str() {
|
|
7
|
+
return ('00000000000000000' + (Math.random() * 0xffffffffffffffff).toString(16)).slice(-16);
|
|
8
|
+
};
|
|
9
|
+
var uuid = function uuid() {
|
|
10
|
+
var a = str();
|
|
11
|
+
var b = str();
|
|
12
|
+
return a.slice(0, 8) + '-' + a.slice(8, 12) + '-4' + a.slice(13) + '-a' + b.slice(1, 4) + '-' + b.slice(4);
|
|
13
|
+
};
|
|
14
|
+
exports.uuid = uuid;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
var _helper = require("./helper");
|
|
5
|
+
Object.keys(_helper).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _helper[key]) return;
|
|
8
|
+
exports[key] = _helper[key];
|
|
9
|
+
});
|
|
10
|
+
var _tree = require("./tree");
|
|
11
|
+
Object.keys(_tree).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (key in exports && exports[key] === _tree[key]) return;
|
|
14
|
+
exports[key] = _tree[key];
|
|
15
|
+
});
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.eachTree = eachTree;
|
|
5
|
+
exports.everyTree = everyTree;
|
|
6
|
+
exports.filterTree = filterTree;
|
|
7
|
+
exports.findTree = findTree;
|
|
8
|
+
exports.findTreeIndex = findTreeIndex;
|
|
9
|
+
exports.getTree = getTree;
|
|
10
|
+
exports.getTreeAncestors = getTreeAncestors;
|
|
11
|
+
exports.getTreeDepth = getTreeDepth;
|
|
12
|
+
exports.getTreeParent = getTreeParent;
|
|
13
|
+
exports.mapTree = mapTree;
|
|
14
|
+
exports.someTree = someTree;
|
|
15
|
+
exports.spliceTree = spliceTree;
|
|
16
|
+
exports.spliceTreeSelf = spliceTreeSelf;
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
/**
|
|
19
|
+
* 类似于 arr.map 方法,此方法主要针对类似下面示例的树形结构。
|
|
20
|
+
* [
|
|
21
|
+
* {
|
|
22
|
+
* children: []
|
|
23
|
+
* },
|
|
24
|
+
* // 其他成员
|
|
25
|
+
* ]
|
|
26
|
+
*
|
|
27
|
+
* @param {Tree} tree 树形数据
|
|
28
|
+
* @param {Function} iterator 处理函数,返回的数据会被替换成新的。
|
|
29
|
+
* @return {Tree} 返回处理过的 tree
|
|
30
|
+
*/
|
|
31
|
+
function mapTree(tree, iterator, level, depthFirst, paths) {
|
|
32
|
+
if (level === void 0) {
|
|
33
|
+
level = 1;
|
|
34
|
+
}
|
|
35
|
+
if (depthFirst === void 0) {
|
|
36
|
+
depthFirst = false;
|
|
37
|
+
}
|
|
38
|
+
if (paths === void 0) {
|
|
39
|
+
paths = [];
|
|
40
|
+
}
|
|
41
|
+
return tree.map(function (item, index) {
|
|
42
|
+
if (depthFirst) {
|
|
43
|
+
var children = item.children ? mapTree(item.children, iterator, level + 1, depthFirst, paths.concat(item)) : undefined;
|
|
44
|
+
children && (item = _extends({}, item, {
|
|
45
|
+
children: children
|
|
46
|
+
}));
|
|
47
|
+
item = iterator(item, index, level, paths) || _extends({}, item);
|
|
48
|
+
return item;
|
|
49
|
+
}
|
|
50
|
+
item = iterator(item, index, level, paths) || _extends({}, item);
|
|
51
|
+
if (item.children && item.children.splice) {
|
|
52
|
+
item.children = mapTree(item.children, iterator, level + 1, depthFirst, paths.concat(item));
|
|
53
|
+
}
|
|
54
|
+
return item;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 遍历树
|
|
60
|
+
* @param tree
|
|
61
|
+
* @param iterator
|
|
62
|
+
*/
|
|
63
|
+
function eachTree(tree, iterator, level, paths) {
|
|
64
|
+
if (level === void 0) {
|
|
65
|
+
level = 1;
|
|
66
|
+
}
|
|
67
|
+
if (paths === void 0) {
|
|
68
|
+
paths = [];
|
|
69
|
+
}
|
|
70
|
+
tree.map(function (item, index) {
|
|
71
|
+
var currentPath = paths.concat(item);
|
|
72
|
+
iterator(item, index, level, currentPath);
|
|
73
|
+
if (item.children && item.children.splice) {
|
|
74
|
+
eachTree(item.children, iterator, level + 1, currentPath);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 在树中查找节点。
|
|
80
|
+
* @param tree
|
|
81
|
+
* @param iterator
|
|
82
|
+
*/
|
|
83
|
+
function findTree(tree, iterator) {
|
|
84
|
+
var result = null;
|
|
85
|
+
everyTree(tree, function (item, key, level, paths) {
|
|
86
|
+
if (iterator(item, key, level, paths)) {
|
|
87
|
+
result = item;
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 在树中查找节点, 返回下标数组。
|
|
97
|
+
* @param tree
|
|
98
|
+
* @param iterator
|
|
99
|
+
*/
|
|
100
|
+
function findTreeIndex(tree, iterator) {
|
|
101
|
+
var idx = [];
|
|
102
|
+
findTree(tree, function (item, index, level, paths) {
|
|
103
|
+
if (iterator(item, index, level, paths)) {
|
|
104
|
+
idx = [index];
|
|
105
|
+
paths = paths.concat();
|
|
106
|
+
paths.unshift({
|
|
107
|
+
children: tree
|
|
108
|
+
});
|
|
109
|
+
for (var i = paths.length - 1; i > 0; i--) {
|
|
110
|
+
var prev = paths[i - 1];
|
|
111
|
+
var current = paths[i];
|
|
112
|
+
idx.unshift(prev.children && prev.children.indexOf(current));
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
});
|
|
118
|
+
return idx.length ? idx : undefined;
|
|
119
|
+
}
|
|
120
|
+
function getTree(tree, idx) {
|
|
121
|
+
var indexes = Array.isArray(idx) ? idx.concat() : [idx];
|
|
122
|
+
var lastIndex = indexes.pop();
|
|
123
|
+
var list = tree;
|
|
124
|
+
for (var i = 0, len = indexes.length; i < len; i++) {
|
|
125
|
+
var index = indexes[i];
|
|
126
|
+
if (!list || !list[index]) {
|
|
127
|
+
list = null;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
list = list[index].children;
|
|
131
|
+
}
|
|
132
|
+
return list ? list[lastIndex] : undefined;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* 过滤树节点
|
|
136
|
+
*
|
|
137
|
+
* @param tree
|
|
138
|
+
* @param iterator
|
|
139
|
+
*/
|
|
140
|
+
function filterTree(tree, iterator, level, depthFirst) {
|
|
141
|
+
if (level === void 0) {
|
|
142
|
+
level = 1;
|
|
143
|
+
}
|
|
144
|
+
if (depthFirst === void 0) {
|
|
145
|
+
depthFirst = false;
|
|
146
|
+
}
|
|
147
|
+
if (depthFirst) {
|
|
148
|
+
return tree.map(function (item) {
|
|
149
|
+
var children = item.children ? filterTree(item.children, iterator, level + 1, depthFirst) : undefined;
|
|
150
|
+
if (Array.isArray(children) && Array.isArray(item.children)) {
|
|
151
|
+
item = _extends({}, item, {
|
|
152
|
+
children: children
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return item;
|
|
156
|
+
}).filter(function (item, index) {
|
|
157
|
+
return iterator(item, index, level);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return tree.filter(function (item, index) {
|
|
161
|
+
return iterator(item, index, level);
|
|
162
|
+
}).map(function (item) {
|
|
163
|
+
if (item.children && item.children.splice) {
|
|
164
|
+
var children = filterTree(item.children, iterator, level + 1, depthFirst);
|
|
165
|
+
if (Array.isArray(children) && Array.isArray(item.children)) {
|
|
166
|
+
item = _extends({}, item, {
|
|
167
|
+
children: children
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return item;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* 判断树中每个节点是否满足某个条件。
|
|
177
|
+
* @param tree
|
|
178
|
+
* @param iterator
|
|
179
|
+
*/
|
|
180
|
+
function everyTree(tree, iterator, level, paths, indexes) {
|
|
181
|
+
if (level === void 0) {
|
|
182
|
+
level = 1;
|
|
183
|
+
}
|
|
184
|
+
if (paths === void 0) {
|
|
185
|
+
paths = [];
|
|
186
|
+
}
|
|
187
|
+
if (indexes === void 0) {
|
|
188
|
+
indexes = [];
|
|
189
|
+
}
|
|
190
|
+
if (!Array.isArray(tree)) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return tree.every(function (item, index) {
|
|
194
|
+
var value = iterator(item, index, level, paths, indexes);
|
|
195
|
+
if (value && item.children && item.children.splice) {
|
|
196
|
+
return everyTree(item.children, iterator, level + 1, paths.concat(item), indexes.concat(index));
|
|
197
|
+
}
|
|
198
|
+
return value;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 判断树中是否有某些节点满足某个条件。
|
|
204
|
+
* @param tree
|
|
205
|
+
* @param iterator
|
|
206
|
+
*/
|
|
207
|
+
function someTree(tree, iterator) {
|
|
208
|
+
var result = false;
|
|
209
|
+
everyTree(tree, function (item, key, level, paths) {
|
|
210
|
+
if (iterator(item, key, level, paths)) {
|
|
211
|
+
result = true;
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
return true;
|
|
215
|
+
});
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 操作树,遵循 imutable, 每次返回一个新的树。
|
|
221
|
+
* 类似数组的 splice 不同的地方这个方法不修改原始数据,
|
|
222
|
+
* 同时第二个参数不是下标,而是下标数组,分别代表每一层的下标。
|
|
223
|
+
*
|
|
224
|
+
* 至于如何获取下标数组,请查看 findTreeIndex
|
|
225
|
+
*
|
|
226
|
+
* @param tree
|
|
227
|
+
* @param idx
|
|
228
|
+
* @param deleteCount
|
|
229
|
+
* @param ...items
|
|
230
|
+
*/
|
|
231
|
+
function spliceTree(tree, idx, deleteCount) {
|
|
232
|
+
if (deleteCount === void 0) {
|
|
233
|
+
deleteCount = 0;
|
|
234
|
+
}
|
|
235
|
+
var list = tree.concat();
|
|
236
|
+
for (var _len = arguments.length, items = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
237
|
+
items[_key - 3] = arguments[_key];
|
|
238
|
+
}
|
|
239
|
+
if (typeof idx === 'number') {
|
|
240
|
+
list.splice.apply(list, [idx, deleteCount].concat(items));
|
|
241
|
+
} else if (Array.isArray(idx) && idx.length) {
|
|
242
|
+
idx = idx.concat();
|
|
243
|
+
var lastIdx = idx.pop();
|
|
244
|
+
var host = idx.reduce(function (list, idx) {
|
|
245
|
+
var child = _extends({}, list[idx], {
|
|
246
|
+
children: list[idx].children ? list[idx].children.concat() : []
|
|
247
|
+
});
|
|
248
|
+
list[idx] = child;
|
|
249
|
+
return child.children;
|
|
250
|
+
}, list);
|
|
251
|
+
host.splice.apply(host, [lastIdx, deleteCount].concat(items));
|
|
252
|
+
}
|
|
253
|
+
return list;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* 计算树的深度
|
|
258
|
+
* @param tree
|
|
259
|
+
*/
|
|
260
|
+
function getTreeDepth(tree) {
|
|
261
|
+
return Math.max.apply(Math, tree.map(function (item) {
|
|
262
|
+
if (Array.isArray(item.children)) {
|
|
263
|
+
return 1 + getTreeDepth(item.children);
|
|
264
|
+
}
|
|
265
|
+
return 1;
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* 从树中获取某个值的所有祖先
|
|
271
|
+
* @param tree
|
|
272
|
+
* @param value
|
|
273
|
+
*/
|
|
274
|
+
function getTreeAncestors(tree, value, includeSelf) {
|
|
275
|
+
if (includeSelf === void 0) {
|
|
276
|
+
includeSelf = false;
|
|
277
|
+
}
|
|
278
|
+
var ancestors = null;
|
|
279
|
+
findTree(tree, function (item, index, level, paths) {
|
|
280
|
+
if (item === value) {
|
|
281
|
+
ancestors = paths;
|
|
282
|
+
if (includeSelf) {
|
|
283
|
+
ancestors.push(item);
|
|
284
|
+
}
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
return false;
|
|
288
|
+
});
|
|
289
|
+
return ancestors;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* 从树中获取某个值的上级
|
|
294
|
+
* @param tree
|
|
295
|
+
* @param value
|
|
296
|
+
*/
|
|
297
|
+
function getTreeParent(tree, value) {
|
|
298
|
+
var ancestors = getTreeAncestors(tree, value);
|
|
299
|
+
return ancestors && ancestors.length ? ancestors[ancestors.length - 1] : null;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* 操作树,修车原来的树, 返回修改后的树。
|
|
304
|
+
* 类似数组的 splice 修改原始数据,
|
|
305
|
+
* 同时第二个参数不是下标,而是下标数组,分别代表每一层的下标。
|
|
306
|
+
*
|
|
307
|
+
* 至于如何获取下标数组,请查看 findTreeIndex
|
|
308
|
+
*
|
|
309
|
+
* @param tree
|
|
310
|
+
* @param idx
|
|
311
|
+
* @param deleteCount
|
|
312
|
+
* @param ...items
|
|
313
|
+
*/
|
|
314
|
+
function spliceTreeSelf(tree, idx, deleteCount) {
|
|
315
|
+
if (deleteCount === void 0) {
|
|
316
|
+
deleteCount = 0;
|
|
317
|
+
}
|
|
318
|
+
var list = tree;
|
|
319
|
+
for (var _len2 = arguments.length, items = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
|
320
|
+
items[_key2 - 3] = arguments[_key2];
|
|
321
|
+
}
|
|
322
|
+
if (typeof idx === 'number') {
|
|
323
|
+
list.splice.apply(list, [idx, deleteCount].concat(items));
|
|
324
|
+
} else if (Array.isArray(idx) && idx.length) {
|
|
325
|
+
idx = idx.concat();
|
|
326
|
+
var lastIdx = idx.pop();
|
|
327
|
+
var host = idx.reduce(function (list, idx) {
|
|
328
|
+
return list[idx] && list[idx].children || [];
|
|
329
|
+
}, list);
|
|
330
|
+
host.splice.apply(host, [lastIdx, deleteCount].concat(items));
|
|
331
|
+
}
|
|
332
|
+
return list;
|
|
333
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panpanzhao/component-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A Component Library for Vue.js.",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "src/index.js",
|
|
6
6
|
"unpkg": "lib/index.js",
|
|
7
7
|
"style": "lib/styles/component-ui.css",
|
|
8
8
|
"files": [
|
package/src/index.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import Form from "./components/form/index.js"
|
|
2
|
+
import FormInput from "./components/form-input/index.js"
|
|
3
|
+
import FormItem from "./components/form-item/index.js"
|
|
4
|
+
import FormGroup from "./components/form-group/index.js"
|
|
5
|
+
import FormDialog from "./components/form-dialog/index.js"
|
|
6
|
+
import FormView from "./components/form-view/index.js"
|
|
7
|
+
import FormViewGroup from "./components/form-view-group/index.js"
|
|
8
|
+
import FormViewDialog from "./components/form-view-dialog/index.js"
|
|
9
|
+
import Table from "./components/table/index.js"
|
|
10
|
+
import TableColumn from "./components/table-column/index.js"
|
|
11
|
+
import TableSearch from "./components/table-search/index.js"
|
|
12
|
+
import TableEditable from "./components/table-editable/index.js"
|
|
13
|
+
import Crud from "./components/crud/index.js"
|
|
14
|
+
import Formula from "./components/formula/index.js"
|
|
15
|
+
import Dialog from "./components/dialog/index.js"
|
|
16
|
+
const components = [
|
|
17
|
+
Form,
|
|
18
|
+
FormInput,
|
|
19
|
+
FormItem,
|
|
20
|
+
FormGroup,
|
|
21
|
+
FormDialog,
|
|
22
|
+
FormView,
|
|
23
|
+
FormViewGroup,
|
|
24
|
+
FormViewDialog,
|
|
25
|
+
Table,
|
|
26
|
+
TableColumn,
|
|
27
|
+
TableSearch,
|
|
28
|
+
TableEditable,
|
|
29
|
+
Crud,
|
|
30
|
+
Formula,
|
|
31
|
+
Dialog
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const install = function(Vue, opts = {}) {
|
|
35
|
+
components.forEach(component => {
|
|
36
|
+
Vue.component(component.name, component);
|
|
37
|
+
});
|
|
38
|
+
Vue.prototype.$COMPONENT = opts
|
|
39
|
+
Vue.prototype.$ELEMENT = {
|
|
40
|
+
size: opts.size || 'small',
|
|
41
|
+
zIndex: opts.zIndex || 2000
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/* istanbul ignore if */
|
|
46
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
47
|
+
install(window.Vue);
|
|
48
|
+
}
|
|
49
|
+
export default {
|
|
50
|
+
version: '0.0.1',
|
|
51
|
+
install,
|
|
52
|
+
Form,
|
|
53
|
+
FormInput,
|
|
54
|
+
FormItem,
|
|
55
|
+
FormGroup,
|
|
56
|
+
FormDialog,
|
|
57
|
+
FormView,
|
|
58
|
+
FormViewGroup,
|
|
59
|
+
FormViewDialog,
|
|
60
|
+
Table,
|
|
61
|
+
TableColumn,
|
|
62
|
+
TableSearch,
|
|
63
|
+
TableEditable,
|
|
64
|
+
Crud,
|
|
65
|
+
Formula,
|
|
66
|
+
Dialog
|
|
67
|
+
};
|