@touchvue/ui 0.0.1-alpha.2
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/README.md +70 -0
- package/es/components/article/index.js +66 -0
- package/es/components/article/index.js.map +1 -0
- package/es/components/box/index.js +98 -0
- package/es/components/box/index.js.map +1 -0
- package/es/components/button/index.js +96 -0
- package/es/components/button/index.js.map +1 -0
- package/es/components/calendar/index.js +44 -0
- package/es/components/calendar/index.js.map +1 -0
- package/es/components/card/index.js +290 -0
- package/es/components/card/index.js.map +1 -0
- package/es/components/checkbox/index.js +97 -0
- package/es/components/checkbox/index.js.map +1 -0
- package/es/components/datepicker/index.js +44 -0
- package/es/components/datepicker/index.js.map +1 -0
- package/es/components/form/index.js +303 -0
- package/es/components/form/index.js.map +1 -0
- package/es/components/grid/index.js +253 -0
- package/es/components/grid/index.js.map +1 -0
- package/es/components/header/index.js +233 -0
- package/es/components/header/index.js.map +1 -0
- package/es/components/icon/index.js +98 -0
- package/es/components/icon/index.js.map +1 -0
- package/es/components/input/index.js +436 -0
- package/es/components/input/index.js.map +1 -0
- package/es/components/line/index.js +100 -0
- package/es/components/line/index.js.map +1 -0
- package/es/components/msg/index.js +322 -0
- package/es/components/msg/index.js.map +1 -0
- package/es/components/padding/index.js +92 -0
- package/es/components/padding/index.js.map +1 -0
- package/es/components/page/index.js +334 -0
- package/es/components/page/index.js.map +1 -0
- package/es/components/select/index.js +218 -0
- package/es/components/select/index.js.map +1 -0
- package/es/components/space/index.js +88 -0
- package/es/components/space/index.js.map +1 -0
- package/es/components/step/index.js +127 -0
- package/es/components/step/index.js.map +1 -0
- package/es/components/switch/index.js +120 -0
- package/es/components/switch/index.js.map +1 -0
- package/es/components/tab/index.js +227 -0
- package/es/components/tab/index.js.map +1 -0
- package/es/components/table/index.js +893 -0
- package/es/components/table/index.js.map +1 -0
- package/es/directives/dis/index.js +32 -0
- package/es/directives/dis/index.js.map +1 -0
- package/es/directives/size/index.js +23 -0
- package/es/directives/size/index.js.map +1 -0
- package/es/hooks/index.js +2 -0
- package/es/hooks/index.js.map +1 -0
- package/es/index.js +4209 -0
- package/es/index.js.map +1 -0
- package/es/utils/index.js +90 -0
- package/es/utils/index.js.map +1 -0
- package/lib/components/article/index.js +70 -0
- package/lib/components/article/index.js.map +1 -0
- package/lib/components/box/index.js +102 -0
- package/lib/components/box/index.js.map +1 -0
- package/lib/components/button/index.js +98 -0
- package/lib/components/button/index.js.map +1 -0
- package/lib/components/calendar/index.js +46 -0
- package/lib/components/calendar/index.js.map +1 -0
- package/lib/components/card/index.js +292 -0
- package/lib/components/card/index.js.map +1 -0
- package/lib/components/checkbox/index.js +99 -0
- package/lib/components/checkbox/index.js.map +1 -0
- package/lib/components/datepicker/index.js +46 -0
- package/lib/components/datepicker/index.js.map +1 -0
- package/lib/components/form/index.js +306 -0
- package/lib/components/form/index.js.map +1 -0
- package/lib/components/grid/index.js +256 -0
- package/lib/components/grid/index.js.map +1 -0
- package/lib/components/header/index.js +235 -0
- package/lib/components/header/index.js.map +1 -0
- package/lib/components/icon/index.js +101 -0
- package/lib/components/icon/index.js.map +1 -0
- package/lib/components/input/index.js +438 -0
- package/lib/components/input/index.js.map +1 -0
- package/lib/components/line/index.js +102 -0
- package/lib/components/line/index.js.map +1 -0
- package/lib/components/msg/index.js +324 -0
- package/lib/components/msg/index.js.map +1 -0
- package/lib/components/padding/index.js +94 -0
- package/lib/components/padding/index.js.map +1 -0
- package/lib/components/page/index.js +336 -0
- package/lib/components/page/index.js.map +1 -0
- package/lib/components/select/index.js +220 -0
- package/lib/components/select/index.js.map +1 -0
- package/lib/components/space/index.js +90 -0
- package/lib/components/space/index.js.map +1 -0
- package/lib/components/step/index.js +129 -0
- package/lib/components/step/index.js.map +1 -0
- package/lib/components/switch/index.js +122 -0
- package/lib/components/switch/index.js.map +1 -0
- package/lib/components/tab/index.js +230 -0
- package/lib/components/tab/index.js.map +1 -0
- package/lib/components/table/index.js +898 -0
- package/lib/components/table/index.js.map +1 -0
- package/lib/directives/dis/index.js +34 -0
- package/lib/directives/dis/index.js.map +1 -0
- package/lib/directives/size/index.js +25 -0
- package/lib/directives/size/index.js.map +1 -0
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/index.js +4251 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/index.js +99 -0
- package/lib/utils/index.js.map +1 -0
- package/package.json +35 -0
- package/theme/components/article/index.css +1 -0
- package/theme/components/box/index.css +1 -0
- package/theme/components/button/index.css +1 -0
- package/theme/components/calendar/index.css +0 -0
- package/theme/components/card/index.css +1 -0
- package/theme/components/checkbox/index.css +1 -0
- package/theme/components/datepicker/index.css +0 -0
- package/theme/components/form/index.css +1 -0
- package/theme/components/grid/index.css +1 -0
- package/theme/components/header/index.css +1 -0
- package/theme/components/icon/index.css +1 -0
- package/theme/components/input/index.css +1 -0
- package/theme/components/line/index.css +1 -0
- package/theme/components/msg/index.css +1 -0
- package/theme/components/padding/index.css +1 -0
- package/theme/components/space/index.css +1 -0
- package/theme/components/step/index.css +1 -0
- package/theme/components/switch/index.css +1 -0
- package/theme/components/tab/index.css +1 -0
- package/theme/components/table/index.css +1 -0
- package/theme/img/default.png +0 -0
- package/theme/img/icon-type-fill.ttf +0 -0
- package/theme/img/icon.ttf +0 -0
- package/theme/img/loading-in.png +0 -0
- package/theme/img/loading-out.png +0 -0
- package/theme/img/msg/error-bg.png +0 -0
- package/theme/img/msg/error-icon.png +0 -0
- package/theme/img/msg/success-bg.png +0 -0
- package/theme/img/msg/success-icon.png +0 -0
- package/theme/index.css +1 -0
- package/theme/skin/default.css +1 -0
|
@@ -0,0 +1,898 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
|
|
5
|
+
const _hoisted_1$3 = { class: "to-table-table" };
|
|
6
|
+
const _hoisted_2$2 = { class: "to-table-head" };
|
|
7
|
+
const _hoisted_3$1 = { class: "to-table-head-row" };
|
|
8
|
+
const _hoisted_4$1 = { class: "to-table-body" };
|
|
9
|
+
const _hoisted_5$1 = ["onClick"];
|
|
10
|
+
var _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
11
|
+
...{
|
|
12
|
+
name: "ToTable"
|
|
13
|
+
},
|
|
14
|
+
__name: "table",
|
|
15
|
+
props: {
|
|
16
|
+
columns: { type: Array, required: false, default: () => [] },
|
|
17
|
+
data: { type: Array, required: false, default: () => [] },
|
|
18
|
+
height: { type: [Number, String], required: false, default: "" }
|
|
19
|
+
},
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const flatData = vue.computed(() => flattenTree(props.data));
|
|
23
|
+
const expandedSet = vue.ref(/* @__PURE__ */ new Set());
|
|
24
|
+
let uid = 0;
|
|
25
|
+
function flattenTree(data, level = 0, parentId) {
|
|
26
|
+
const result = [];
|
|
27
|
+
for (const item of data) {
|
|
28
|
+
const id = uid++;
|
|
29
|
+
const { children, ...rest } = item;
|
|
30
|
+
result.push({ ...rest, id, parentId, level });
|
|
31
|
+
if (children && Array.isArray(children)) {
|
|
32
|
+
result.push(...flattenTree(children, level + 1, id));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function isVisible(item, all) {
|
|
38
|
+
let parentId = item.parentId;
|
|
39
|
+
while (parentId !== void 0) {
|
|
40
|
+
if (!expandedSet.value.has(parentId))
|
|
41
|
+
return false;
|
|
42
|
+
const parent = all.find((n) => n.id === parentId);
|
|
43
|
+
parentId = parent == null ? void 0 : parent.parentId;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
const visibleRows = vue.computed(
|
|
48
|
+
() => flatData.value.filter((item) => item.level === 0 || isVisible(item, flatData.value))
|
|
49
|
+
);
|
|
50
|
+
function toggleExpand(row) {
|
|
51
|
+
if (expandedSet.value.has(row.id)) {
|
|
52
|
+
expandedSet.value.delete(row.id);
|
|
53
|
+
} else {
|
|
54
|
+
expandedSet.value.add(row.id);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function hasChildren(row) {
|
|
58
|
+
return flatData.value.some((item) => item.parentId === row.id);
|
|
59
|
+
}
|
|
60
|
+
const setClass = vue.computed(() => {
|
|
61
|
+
const classes = [];
|
|
62
|
+
if (props.height === "full")
|
|
63
|
+
classes.push("height-full");
|
|
64
|
+
return classes;
|
|
65
|
+
});
|
|
66
|
+
const setTdClass = (column) => {
|
|
67
|
+
return vue.computed(() => {
|
|
68
|
+
const classes = [];
|
|
69
|
+
if (column.type === "action")
|
|
70
|
+
classes.push("is-action");
|
|
71
|
+
return classes;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const setStyle = vue.computed(() => {
|
|
75
|
+
const obj = {};
|
|
76
|
+
if (props.height && props.height !== "full") {
|
|
77
|
+
obj.height = isNaN(Number(props.height)) ? String(props.height) : `${props.height}em`;
|
|
78
|
+
}
|
|
79
|
+
return obj;
|
|
80
|
+
});
|
|
81
|
+
return (_ctx, _cache) => {
|
|
82
|
+
const _component_ToCheckbox = vue.resolveComponent("ToCheckbox");
|
|
83
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
class: vue.normalizeClass(["to-table", setClass.value]),
|
|
87
|
+
style: vue.normalizeStyle(setStyle.value)
|
|
88
|
+
},
|
|
89
|
+
[
|
|
90
|
+
vue.createElementVNode("table", _hoisted_1$3, [
|
|
91
|
+
vue.createElementVNode("thead", _hoisted_2$2, [
|
|
92
|
+
vue.createElementVNode("tr", _hoisted_3$1, [
|
|
93
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
94
|
+
vue.Fragment,
|
|
95
|
+
null,
|
|
96
|
+
vue.renderList(_ctx.columns, (column) => {
|
|
97
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
98
|
+
vue.Fragment,
|
|
99
|
+
null,
|
|
100
|
+
[
|
|
101
|
+
column.type === "check" ? (vue.openBlock(), vue.createElementBlock("th", {
|
|
102
|
+
key: column.prop + "check",
|
|
103
|
+
class: "to-table-th is-check"
|
|
104
|
+
}, [
|
|
105
|
+
vue.createVNode(_component_ToCheckbox)
|
|
106
|
+
])) : (vue.openBlock(), vue.createElementBlock(
|
|
107
|
+
"th",
|
|
108
|
+
{
|
|
109
|
+
class: "to-table-th",
|
|
110
|
+
key: column.prop
|
|
111
|
+
},
|
|
112
|
+
vue.toDisplayString(column.label),
|
|
113
|
+
1
|
|
114
|
+
/* TEXT */
|
|
115
|
+
))
|
|
116
|
+
],
|
|
117
|
+
64
|
|
118
|
+
/* STABLE_FRAGMENT */
|
|
119
|
+
);
|
|
120
|
+
}),
|
|
121
|
+
256
|
|
122
|
+
/* UNKEYED_FRAGMENT */
|
|
123
|
+
))
|
|
124
|
+
])
|
|
125
|
+
]),
|
|
126
|
+
vue.createElementVNode("tbody", _hoisted_4$1, [
|
|
127
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
128
|
+
vue.Fragment,
|
|
129
|
+
null,
|
|
130
|
+
vue.renderList(visibleRows.value, (row, rowIndex) => {
|
|
131
|
+
return vue.openBlock(), vue.createElementBlock("tr", {
|
|
132
|
+
class: "to-table-body-row",
|
|
133
|
+
key: rowIndex
|
|
134
|
+
}, [
|
|
135
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
136
|
+
vue.Fragment,
|
|
137
|
+
null,
|
|
138
|
+
vue.renderList(_ctx.columns, (column) => {
|
|
139
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
140
|
+
vue.Fragment,
|
|
141
|
+
null,
|
|
142
|
+
[
|
|
143
|
+
column.type === "check" ? (vue.openBlock(), vue.createElementBlock("td", {
|
|
144
|
+
key: column.prop + "check",
|
|
145
|
+
class: "to-table-td is-check"
|
|
146
|
+
}, [
|
|
147
|
+
vue.createVNode(_component_ToCheckbox)
|
|
148
|
+
])) : (vue.openBlock(), vue.createElementBlock(
|
|
149
|
+
"td",
|
|
150
|
+
{
|
|
151
|
+
class: vue.normalizeClass(["to-table-td", setTdClass(column).value]),
|
|
152
|
+
key: column.prop,
|
|
153
|
+
style: vue.normalizeStyle({ paddingLeft: column.toggler && row.level ? `${row.level + 2}em` : "" })
|
|
154
|
+
},
|
|
155
|
+
[
|
|
156
|
+
hasChildren(row) && column.toggler ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
157
|
+
key: 0,
|
|
158
|
+
onClick: ($event) => toggleExpand(row),
|
|
159
|
+
class: vue.normalizeClass(["to-table-toggle", {
|
|
160
|
+
"is-expand": expandedSet.value.has(row.id)
|
|
161
|
+
}])
|
|
162
|
+
}, null, 10, _hoisted_5$1)) : vue.createCommentVNode("v-if", true),
|
|
163
|
+
vue.renderSlot(_ctx.$slots, column.prop, {
|
|
164
|
+
row,
|
|
165
|
+
index: rowIndex
|
|
166
|
+
}, () => [
|
|
167
|
+
column.prop ? (vue.openBlock(), vue.createElementBlock(
|
|
168
|
+
vue.Fragment,
|
|
169
|
+
{ key: 0 },
|
|
170
|
+
[
|
|
171
|
+
vue.createTextVNode(
|
|
172
|
+
vue.toDisplayString(row[column.prop]),
|
|
173
|
+
1
|
|
174
|
+
/* TEXT */
|
|
175
|
+
)
|
|
176
|
+
],
|
|
177
|
+
64
|
|
178
|
+
/* STABLE_FRAGMENT */
|
|
179
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
180
|
+
])
|
|
181
|
+
],
|
|
182
|
+
6
|
|
183
|
+
/* CLASS, STYLE */
|
|
184
|
+
))
|
|
185
|
+
],
|
|
186
|
+
64
|
|
187
|
+
/* STABLE_FRAGMENT */
|
|
188
|
+
);
|
|
189
|
+
}),
|
|
190
|
+
256
|
|
191
|
+
/* UNKEYED_FRAGMENT */
|
|
192
|
+
))
|
|
193
|
+
]);
|
|
194
|
+
}),
|
|
195
|
+
128
|
|
196
|
+
/* KEYED_FRAGMENT */
|
|
197
|
+
))
|
|
198
|
+
])
|
|
199
|
+
])
|
|
200
|
+
],
|
|
201
|
+
6
|
|
202
|
+
/* CLASS, STYLE */
|
|
203
|
+
);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
var _export_sfc = (sfc, props) => {
|
|
209
|
+
const target = sfc.__vccOpts || sfc;
|
|
210
|
+
for (const [key, val] of props) {
|
|
211
|
+
target[key] = val;
|
|
212
|
+
}
|
|
213
|
+
return target;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
var Table = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/Users/wangding/WorkSpace/AsiaInfo/projects/\u524D\u7AEF\u6846\u67B6/touch-vue3-ui/packages/components/table/src/table.vue"]]);
|
|
217
|
+
|
|
218
|
+
const _hoisted_1$2 = { class: "config" };
|
|
219
|
+
var _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
220
|
+
...{
|
|
221
|
+
name: "ToTableConfig"
|
|
222
|
+
},
|
|
223
|
+
__name: "table-config",
|
|
224
|
+
props: {
|
|
225
|
+
data: { type: Array, default: () => [] }
|
|
226
|
+
},
|
|
227
|
+
emits: ["change"],
|
|
228
|
+
setup(__props, { emit: __emit }) {
|
|
229
|
+
const props = __props;
|
|
230
|
+
const emit = __emit;
|
|
231
|
+
const checked = vue.ref([]);
|
|
232
|
+
const configData = vue.ref([]);
|
|
233
|
+
const configIconRef = vue.ref();
|
|
234
|
+
const floatRef = vue.ref();
|
|
235
|
+
function setConfigData() {
|
|
236
|
+
const data = JSON.parse(JSON.stringify(props.data));
|
|
237
|
+
function setData(data2, path) {
|
|
238
|
+
data2.forEach((dataItem, dataIndex) => {
|
|
239
|
+
if (dataItem.type === "selection" || dataItem.type === "radio") {
|
|
240
|
+
dataItem.label = "\u9009\u62E9\u5668";
|
|
241
|
+
}
|
|
242
|
+
if (dataItem.type === "action") {
|
|
243
|
+
data2.splice(dataIndex, 1);
|
|
244
|
+
}
|
|
245
|
+
dataItem.path = path ? path.concat(dataItem.label) : [dataItem.label];
|
|
246
|
+
if (dataItem.children) {
|
|
247
|
+
setData(dataItem.children, dataItem.path);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
setData(data);
|
|
252
|
+
configData.value = data;
|
|
253
|
+
}
|
|
254
|
+
function setChecked() {
|
|
255
|
+
const arr = [];
|
|
256
|
+
function setData(data) {
|
|
257
|
+
data.forEach((dataItem) => {
|
|
258
|
+
if (dataItem.show !== false) {
|
|
259
|
+
if (dataItem.type === "selection") {
|
|
260
|
+
arr.push("\u9009\u62E9\u5668");
|
|
261
|
+
} else {
|
|
262
|
+
arr.push(dataItem.label);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (dataItem.children) {
|
|
266
|
+
setData(dataItem.children);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
setData(props.data);
|
|
271
|
+
checked.value = arr;
|
|
272
|
+
}
|
|
273
|
+
function flex() {
|
|
274
|
+
var _a, _b;
|
|
275
|
+
(_b = floatRef.value) == null ? void 0 : _b.set((_a = configIconRef.value) == null ? void 0 : _a.$el);
|
|
276
|
+
}
|
|
277
|
+
function check(checkedKeys, checkedNodes, node, checkedFlag) {
|
|
278
|
+
const data = JSON.parse(JSON.stringify(props.data));
|
|
279
|
+
function checkData(data2) {
|
|
280
|
+
data2.forEach((dataItem) => {
|
|
281
|
+
if (dataItem.type === "selection") {
|
|
282
|
+
dataItem.show = checkedKeys.includes("\u9009\u62E9\u5668");
|
|
283
|
+
} else {
|
|
284
|
+
dataItem.show = checkedKeys.includes(dataItem.label) || dataItem.type === "action";
|
|
285
|
+
}
|
|
286
|
+
if (dataItem.children) {
|
|
287
|
+
checkData(dataItem.children);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function setChildrenHide(data2, setHide) {
|
|
292
|
+
data2.forEach((dataItem) => {
|
|
293
|
+
if (setHide) {
|
|
294
|
+
dataItem.show = false;
|
|
295
|
+
checked.value = checked.value.filter((item) => item !== dataItem.label);
|
|
296
|
+
}
|
|
297
|
+
if (dataItem.children) {
|
|
298
|
+
setChildrenHide(dataItem.children, dataItem.label === node.label || setHide);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function setChildrenAndParentShow(data2, setShow) {
|
|
303
|
+
data2.forEach((dataItem) => {
|
|
304
|
+
if (setShow || node.path.includes(dataItem.label)) {
|
|
305
|
+
dataItem.show = true;
|
|
306
|
+
if (!checked.value.includes(dataItem.label)) {
|
|
307
|
+
checked.value.push(dataItem.label);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (dataItem.children) {
|
|
311
|
+
setChildrenAndParentShow(dataItem.children, dataItem.label === node.label || setShow);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
checkData(data);
|
|
316
|
+
if (!checkedFlag) {
|
|
317
|
+
setChildrenHide(data, false);
|
|
318
|
+
checked.value = checked.value.filter((item) => item !== node.label);
|
|
319
|
+
} else {
|
|
320
|
+
setChildrenAndParentShow(data, false);
|
|
321
|
+
checked.value.push(node.label);
|
|
322
|
+
}
|
|
323
|
+
emit("change", data);
|
|
324
|
+
}
|
|
325
|
+
vue.onMounted(() => {
|
|
326
|
+
setConfigData();
|
|
327
|
+
setChecked();
|
|
328
|
+
});
|
|
329
|
+
vue.watch(() => props.data, () => {
|
|
330
|
+
setConfigData();
|
|
331
|
+
setChecked();
|
|
332
|
+
});
|
|
333
|
+
return (_ctx, _cache) => {
|
|
334
|
+
const _component_to_icon = vue.resolveComponent("to-icon");
|
|
335
|
+
const _component_to_tree = vue.resolveComponent("to-tree");
|
|
336
|
+
const _component_to_scroll = vue.resolveComponent("to-scroll");
|
|
337
|
+
const _component_to_float = vue.resolveComponent("to-float");
|
|
338
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
339
|
+
vue.createVNode(
|
|
340
|
+
_component_to_icon,
|
|
341
|
+
{
|
|
342
|
+
ref: "configIcon",
|
|
343
|
+
value: "config",
|
|
344
|
+
color: "info",
|
|
345
|
+
mode: "none",
|
|
346
|
+
link: "",
|
|
347
|
+
fillet: "round",
|
|
348
|
+
onClick: _cache[0] || (_cache[0] = () => {
|
|
349
|
+
var _a;
|
|
350
|
+
return (_a = floatRef.value.value) == null ? void 0 : _a.toggle(configIconRef.value.value);
|
|
351
|
+
})
|
|
352
|
+
},
|
|
353
|
+
null,
|
|
354
|
+
512
|
|
355
|
+
/* NEED_PATCH */
|
|
356
|
+
),
|
|
357
|
+
vue.createVNode(
|
|
358
|
+
_component_to_float,
|
|
359
|
+
{
|
|
360
|
+
ref_key: "floatRef",
|
|
361
|
+
ref: floatRef,
|
|
362
|
+
width: "18",
|
|
363
|
+
lazy: false
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
default: vue.withCtx(() => [
|
|
367
|
+
vue.createVNode(_component_to_scroll, { padding: "0.5" }, {
|
|
368
|
+
default: vue.withCtx(() => [
|
|
369
|
+
vue.createVNode(_component_to_tree, {
|
|
370
|
+
"show-checkbox": "",
|
|
371
|
+
"check-strictly": "",
|
|
372
|
+
expand: "",
|
|
373
|
+
"check-on-click-node": "",
|
|
374
|
+
data: configData.value,
|
|
375
|
+
"value-text": "label",
|
|
376
|
+
"checked-keys": checked.value,
|
|
377
|
+
onCheckChange: check,
|
|
378
|
+
onNodeExpand: flex,
|
|
379
|
+
onNodeCollapse: flex
|
|
380
|
+
}, null, 8, ["data", "checked-keys"])
|
|
381
|
+
]),
|
|
382
|
+
_: 1
|
|
383
|
+
/* STABLE */
|
|
384
|
+
})
|
|
385
|
+
]),
|
|
386
|
+
_: 1
|
|
387
|
+
/* STABLE */
|
|
388
|
+
},
|
|
389
|
+
512
|
|
390
|
+
/* NEED_PATCH */
|
|
391
|
+
)
|
|
392
|
+
]);
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
var TableConfig = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/Users/wangding/WorkSpace/AsiaInfo/projects/\u524D\u7AEF\u6846\u67B6/touch-vue3-ui/packages/components/table/src/table-config.vue"]]);
|
|
398
|
+
|
|
399
|
+
const _hoisted_1$1 = { ref: "row" };
|
|
400
|
+
const _hoisted_2$1 = ["rowspan", "colspan"];
|
|
401
|
+
const _hoisted_3 = ["rowspan", "colspan"];
|
|
402
|
+
const _hoisted_4 = ["rowspan", "colspan", "onClick"];
|
|
403
|
+
const _hoisted_5 = ["rowspan", "colspan"];
|
|
404
|
+
const _hoisted_6 = ["rowspan", "colspan", "onClick"];
|
|
405
|
+
var _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
406
|
+
...{
|
|
407
|
+
name: "ToTableHead"
|
|
408
|
+
},
|
|
409
|
+
__name: "table-head",
|
|
410
|
+
props: {
|
|
411
|
+
name: { type: String, default: "" },
|
|
412
|
+
start: { type: Number, default: null },
|
|
413
|
+
end: { type: Number, default: null },
|
|
414
|
+
data: { type: Array, default: () => [] },
|
|
415
|
+
configurable: Boolean
|
|
416
|
+
},
|
|
417
|
+
emits: ["select-all", "column-change"],
|
|
418
|
+
setup(__props, { emit: __emit }) {
|
|
419
|
+
const t = (str) => str;
|
|
420
|
+
const props = __props;
|
|
421
|
+
const emit = __emit;
|
|
422
|
+
const ToTable = vue.inject("ToTable");
|
|
423
|
+
const showColumn = (column, columnIndex) => {
|
|
424
|
+
console.log(columnIndex);
|
|
425
|
+
if (column.show === false)
|
|
426
|
+
return false;
|
|
427
|
+
if (["selection", "radio", "action"].includes(column.type))
|
|
428
|
+
return true;
|
|
429
|
+
if (ToTable.showColumns || ToTable.showColumns === 0) {
|
|
430
|
+
if (!isNaN(ToTable.showColumns)) {
|
|
431
|
+
const index = ToTable.normalColumn.findIndex((item) => column.prop === item.prop);
|
|
432
|
+
return index !== -1 && index < Number(ToTable.showColumns);
|
|
433
|
+
} else {
|
|
434
|
+
return ToTable.showColumns.split(",").includes(column.prop);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return true;
|
|
438
|
+
};
|
|
439
|
+
function countLeafNodes(tree) {
|
|
440
|
+
if (!tree || tree.length === 0)
|
|
441
|
+
return 0;
|
|
442
|
+
let leafCount = 0;
|
|
443
|
+
for (let i = 0; i < tree.length; i++) {
|
|
444
|
+
if (tree[i].show !== false) {
|
|
445
|
+
if (!tree[i].children || tree[i].children.length === 0 || tree[i].children.every((child) => child.show === false)) {
|
|
446
|
+
leafCount += 1;
|
|
447
|
+
} else {
|
|
448
|
+
leafCount += countLeafNodes(tree[i].children);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return leafCount;
|
|
453
|
+
}
|
|
454
|
+
const tableData = vue.computed(() => {
|
|
455
|
+
const result = [];
|
|
456
|
+
let maxDepth = 0;
|
|
457
|
+
function calculateMaxDepth(heads, depth = 1) {
|
|
458
|
+
heads.forEach((head) => {
|
|
459
|
+
if (head.children) {
|
|
460
|
+
calculateMaxDepth(head.children, depth + 1);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
maxDepth = Math.max(maxDepth, depth);
|
|
464
|
+
}
|
|
465
|
+
calculateMaxDepth(props.data);
|
|
466
|
+
function generateTableData(heads, depth = 0, rowIndex = 0) {
|
|
467
|
+
if (!result[rowIndex])
|
|
468
|
+
result[rowIndex] = [];
|
|
469
|
+
heads.forEach((head) => {
|
|
470
|
+
const cell = Object.assign({}, head, { rowspan: 1, colspan: 1 });
|
|
471
|
+
if (head.children && !head.children.every((child) => child.show === false)) {
|
|
472
|
+
cell.colspan = countLeafNodes(head.children);
|
|
473
|
+
result[rowIndex].push(cell);
|
|
474
|
+
generateTableData(head.children, depth + 1, rowIndex + 1);
|
|
475
|
+
} else {
|
|
476
|
+
cell.rowspan = maxDepth - depth;
|
|
477
|
+
result[rowIndex].push(cell);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
generateTableData(JSON.parse(JSON.stringify(props.data)));
|
|
482
|
+
return result;
|
|
483
|
+
});
|
|
484
|
+
function checkAllChange(checked) {
|
|
485
|
+
emit("select-all", checked);
|
|
486
|
+
}
|
|
487
|
+
function configChange(data) {
|
|
488
|
+
emit("column-change", data);
|
|
489
|
+
}
|
|
490
|
+
return (_ctx, _cache) => {
|
|
491
|
+
const _component_to_checkbox = vue.resolveComponent("to-checkbox");
|
|
492
|
+
const _component_to_icon = vue.resolveComponent("to-icon");
|
|
493
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
494
|
+
"thead",
|
|
495
|
+
_hoisted_1$1,
|
|
496
|
+
[
|
|
497
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
498
|
+
vue.Fragment,
|
|
499
|
+
null,
|
|
500
|
+
vue.renderList(tableData.value, (titem, tindex) => {
|
|
501
|
+
return vue.openBlock(), vue.createElementBlock("tr", { key: tindex }, [
|
|
502
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
503
|
+
vue.Fragment,
|
|
504
|
+
null,
|
|
505
|
+
vue.renderList(titem, (item, index) => {
|
|
506
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
507
|
+
vue.Fragment,
|
|
508
|
+
null,
|
|
509
|
+
[
|
|
510
|
+
showColumn(item, index) ? (vue.openBlock(), vue.createElementBlock(
|
|
511
|
+
vue.Fragment,
|
|
512
|
+
{ key: 0 },
|
|
513
|
+
[
|
|
514
|
+
vue.unref(ToTable).isNeedSelectAll && item.type === "selection" ? (vue.openBlock(), vue.createElementBlock("th", {
|
|
515
|
+
key: index + "_selection",
|
|
516
|
+
class: vue.normalizeClass(["selection", [item.sortable === true ? "sort" : "", "checkbox"]]),
|
|
517
|
+
rowspan: item.rowspan || 1,
|
|
518
|
+
colspan: item.colspan || 1
|
|
519
|
+
}, [
|
|
520
|
+
vue.createVNode(_component_to_checkbox, {
|
|
521
|
+
value: vue.unref(ToTable).isSelectAll && vue.unref(ToTable).iData.length > 0,
|
|
522
|
+
onChange: checkAllChange
|
|
523
|
+
}, null, 8, ["value"])
|
|
524
|
+
], 10, _hoisted_2$1)) : item.type === "radio" ? (vue.openBlock(), vue.createElementBlock("th", {
|
|
525
|
+
key: index + "_radio",
|
|
526
|
+
class: vue.normalizeClass(["radio", [item.sortable === true ? "sort" : "", "index"]]),
|
|
527
|
+
rowspan: item.rowspan || 1,
|
|
528
|
+
colspan: item.colspan || 1
|
|
529
|
+
}, vue.toDisplayString(t("to.common.select")), 11, _hoisted_3)) : item.type === "index" ? (vue.openBlock(), vue.createElementBlock("th", {
|
|
530
|
+
key: index + "_index",
|
|
531
|
+
rowspan: item.rowspan || 1,
|
|
532
|
+
colspan: item.colspan || 1,
|
|
533
|
+
class: vue.normalizeClass([item.sortable === true ? "sort" : "", "index"]),
|
|
534
|
+
onClick: ($event) => vue.unref(ToTable).handleTableHeadCellClick(item, index, $event)
|
|
535
|
+
}, [
|
|
536
|
+
item.sortable === true ? (vue.openBlock(), vue.createElementBlock(
|
|
537
|
+
vue.Fragment,
|
|
538
|
+
{ key: 0 },
|
|
539
|
+
[
|
|
540
|
+
item.orderType == "asc" ? (vue.openBlock(), vue.createBlock(_component_to_icon, {
|
|
541
|
+
key: 0,
|
|
542
|
+
value: "fold"
|
|
543
|
+
})) : vue.createCommentVNode("v-if", true),
|
|
544
|
+
item.orderType == "desc" ? (vue.openBlock(), vue.createBlock(_component_to_icon, {
|
|
545
|
+
key: 1,
|
|
546
|
+
value: "unfold"
|
|
547
|
+
})) : vue.createCommentVNode("v-if", true)
|
|
548
|
+
],
|
|
549
|
+
64
|
|
550
|
+
/* STABLE_FRAGMENT */
|
|
551
|
+
)) : vue.createCommentVNode("v-if", true),
|
|
552
|
+
vue.createElementVNode(
|
|
553
|
+
"span",
|
|
554
|
+
null,
|
|
555
|
+
vue.toDisplayString(vue.unref(ToTable).indexColumnName || item.label),
|
|
556
|
+
1
|
|
557
|
+
/* TEXT */
|
|
558
|
+
)
|
|
559
|
+
], 10, _hoisted_4)) : item.type === "action" && __props.configurable && vue.unref(ToTable).hasAction ? (vue.openBlock(), vue.createElementBlock("th", {
|
|
560
|
+
key: index + "_action",
|
|
561
|
+
rowspan: item.rowspan || 1,
|
|
562
|
+
colspan: item.colspan || 1,
|
|
563
|
+
class: "configTh action"
|
|
564
|
+
}, [
|
|
565
|
+
vue.createVNode(TableConfig, {
|
|
566
|
+
data: vue.unref(ToTable).columns,
|
|
567
|
+
onChange: configChange
|
|
568
|
+
}, null, 8, ["data"])
|
|
569
|
+
], 8, _hoisted_5)) : !(item.type === "action" && vue.unref(ToTable).contextAction) ? (vue.openBlock(), vue.createElementBlock("th", {
|
|
570
|
+
key: index + "_other",
|
|
571
|
+
rowspan: item.rowspan || 1,
|
|
572
|
+
colspan: item.colspan || 1,
|
|
573
|
+
class: vue.normalizeClass([item.sortable === true ? "sort" : "", item.type === "action" ? "action" : ""]),
|
|
574
|
+
onClick: ($event) => vue.unref(ToTable).handleTableHeadCellClick(item, index, $event)
|
|
575
|
+
}, [
|
|
576
|
+
item.sortable === true ? (vue.openBlock(), vue.createElementBlock(
|
|
577
|
+
"span",
|
|
578
|
+
{
|
|
579
|
+
key: 0,
|
|
580
|
+
class: vue.normalizeClass(["to-table-sorticon", `type-${item.orderType}`])
|
|
581
|
+
},
|
|
582
|
+
[
|
|
583
|
+
vue.createVNode(_component_to_icon, {
|
|
584
|
+
value: "fold",
|
|
585
|
+
type: "fill"
|
|
586
|
+
}),
|
|
587
|
+
vue.createVNode(_component_to_icon, {
|
|
588
|
+
value: "unfold",
|
|
589
|
+
type: "fill"
|
|
590
|
+
})
|
|
591
|
+
],
|
|
592
|
+
2
|
|
593
|
+
/* CLASS */
|
|
594
|
+
)) : vue.createCommentVNode("v-if", true),
|
|
595
|
+
vue.renderSlot(_ctx.$slots, item.prop + "_th", {
|
|
596
|
+
column: item,
|
|
597
|
+
index
|
|
598
|
+
}, () => [
|
|
599
|
+
vue.createElementVNode(
|
|
600
|
+
"span",
|
|
601
|
+
null,
|
|
602
|
+
vue.toDisplayString(item.label),
|
|
603
|
+
1
|
|
604
|
+
/* TEXT */
|
|
605
|
+
)
|
|
606
|
+
])
|
|
607
|
+
], 10, _hoisted_6)) : vue.createCommentVNode("v-if", true)
|
|
608
|
+
],
|
|
609
|
+
64
|
|
610
|
+
/* STABLE_FRAGMENT */
|
|
611
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
612
|
+
],
|
|
613
|
+
64
|
|
614
|
+
/* STABLE_FRAGMENT */
|
|
615
|
+
);
|
|
616
|
+
}),
|
|
617
|
+
256
|
|
618
|
+
/* UNKEYED_FRAGMENT */
|
|
619
|
+
))
|
|
620
|
+
]);
|
|
621
|
+
}),
|
|
622
|
+
128
|
|
623
|
+
/* KEYED_FRAGMENT */
|
|
624
|
+
))
|
|
625
|
+
],
|
|
626
|
+
512
|
|
627
|
+
/* NEED_PATCH */
|
|
628
|
+
);
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
var TableHead = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/Users/wangding/WorkSpace/AsiaInfo/projects/\u524D\u7AEF\u6846\u67B6/touch-vue3-ui/packages/components/table/src/table-head.vue"]]);
|
|
634
|
+
|
|
635
|
+
const _hoisted_1 = ["data-index", "onContextmenu"];
|
|
636
|
+
const _hoisted_2 = { key: 0 };
|
|
637
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
638
|
+
...{
|
|
639
|
+
name: "ToTableBody"
|
|
640
|
+
},
|
|
641
|
+
__name: "table-body",
|
|
642
|
+
props: {
|
|
643
|
+
columnData: { type: Array, default: () => [] },
|
|
644
|
+
data: { type: Array, default: () => [] }
|
|
645
|
+
},
|
|
646
|
+
setup(__props) {
|
|
647
|
+
const props = __props;
|
|
648
|
+
const ToTable = vue.inject("ToTable");
|
|
649
|
+
const isClick = vue.ref(false);
|
|
650
|
+
const isDblClick = vue.ref(false);
|
|
651
|
+
const clickTimer = vue.ref(null);
|
|
652
|
+
const showColumn = (column, columnIndex) => {
|
|
653
|
+
console.log(columnIndex);
|
|
654
|
+
if (column.show === false)
|
|
655
|
+
return false;
|
|
656
|
+
if (ToTable.type === "v") {
|
|
657
|
+
if (["key", "desc", "icon", "state", "selection", "radio", "action"].includes(column.type))
|
|
658
|
+
return false;
|
|
659
|
+
} else {
|
|
660
|
+
if (["selection", "radio", "action"].includes(column.type))
|
|
661
|
+
return true;
|
|
662
|
+
}
|
|
663
|
+
if (ToTable.showColumns) {
|
|
664
|
+
if (!isNaN(ToTable.showColumns)) {
|
|
665
|
+
const index = ToTable.normalColumn.findIndex((item) => column.prop === item.prop);
|
|
666
|
+
return index !== -1 && index < Number(ToTable.showColumns);
|
|
667
|
+
} else {
|
|
668
|
+
return ToTable.showColumns.split(",").includes(column.prop);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return true;
|
|
672
|
+
};
|
|
673
|
+
const setClass = (column) => {
|
|
674
|
+
const arr = [];
|
|
675
|
+
if (column.type === "key")
|
|
676
|
+
arr.push("key");
|
|
677
|
+
if (column.type === "action")
|
|
678
|
+
arr.push("action");
|
|
679
|
+
if (column.type === "edit")
|
|
680
|
+
arr.push("edit");
|
|
681
|
+
if (column.type === "desc")
|
|
682
|
+
arr.push("desc");
|
|
683
|
+
if (column.wrap)
|
|
684
|
+
arr.push("wrap");
|
|
685
|
+
if (column.className)
|
|
686
|
+
arr.push(...column.className.split(","));
|
|
687
|
+
return arr;
|
|
688
|
+
};
|
|
689
|
+
console.log(setClass);
|
|
690
|
+
const setTrClass = (dataItem) => {
|
|
691
|
+
const arr = [];
|
|
692
|
+
if (dataItem._on)
|
|
693
|
+
arr.push("on");
|
|
694
|
+
if (dataItem._hover)
|
|
695
|
+
arr.push("hover");
|
|
696
|
+
if (dataItem._active)
|
|
697
|
+
arr.push("active");
|
|
698
|
+
if (dataItem._className)
|
|
699
|
+
arr.push(...dataItem._className.split(","));
|
|
700
|
+
return arr;
|
|
701
|
+
};
|
|
702
|
+
const setTrStyle = vue.computed(() => {
|
|
703
|
+
const obj = {};
|
|
704
|
+
if (ToTable.space)
|
|
705
|
+
obj.marginTop = `${ToTable.space}em`;
|
|
706
|
+
return obj;
|
|
707
|
+
});
|
|
708
|
+
const tableData = vue.computed(() => {
|
|
709
|
+
const result = [];
|
|
710
|
+
function traverse(headers) {
|
|
711
|
+
headers.forEach((header) => {
|
|
712
|
+
if (header.children && !header.children.every((child) => child.show === false)) {
|
|
713
|
+
traverse(header.children);
|
|
714
|
+
} else {
|
|
715
|
+
result.push(header);
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
traverse(props.columnData);
|
|
720
|
+
return result;
|
|
721
|
+
});
|
|
722
|
+
function toggleFold(item, index) {
|
|
723
|
+
if (!item._showChild) {
|
|
724
|
+
item._showChild = true;
|
|
725
|
+
} else {
|
|
726
|
+
item._showChild = false;
|
|
727
|
+
}
|
|
728
|
+
for (let i = index + 1; i < props.data.length; i++) {
|
|
729
|
+
const el = props.data[i];
|
|
730
|
+
if (item._showChild) {
|
|
731
|
+
if (el._level === item._level + 1) {
|
|
732
|
+
el._show = true;
|
|
733
|
+
} else if (el._level <= item._level) {
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
} else {
|
|
737
|
+
if (el._level === item._level + 1) {
|
|
738
|
+
hide(el, i);
|
|
739
|
+
} else if (el._level <= item._level) {
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
function hide(tr, index2) {
|
|
745
|
+
tr._show = false;
|
|
746
|
+
tr._showChild = false;
|
|
747
|
+
if (tr._hasChild) {
|
|
748
|
+
for (let i = index2 + 1; i < props.data.length; i++) {
|
|
749
|
+
const el = props.data[i];
|
|
750
|
+
if (el._level === tr._level + 1) {
|
|
751
|
+
hide(el, i);
|
|
752
|
+
} else {
|
|
753
|
+
break;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
ToTable.adjust();
|
|
759
|
+
}
|
|
760
|
+
console.log(toggleFold);
|
|
761
|
+
function clickHandle(event) {
|
|
762
|
+
const path = event.composedPath ? event.composedPath() : event.path;
|
|
763
|
+
if (ToTable.$listeners && (ToTable.$listeners["row-dblclick"] || ToTable.$listeners["cell-dblclick"])) {
|
|
764
|
+
clickTimer.value = window.setTimeout(() => {
|
|
765
|
+
if (!isDblClick.value) {
|
|
766
|
+
isClick.value = true;
|
|
767
|
+
ToTable.handleTableClick(event, path);
|
|
768
|
+
const timer = window.setTimeout(() => {
|
|
769
|
+
isClick.value = false;
|
|
770
|
+
clearTimeout(timer);
|
|
771
|
+
}, 300);
|
|
772
|
+
} else {
|
|
773
|
+
isDblClick.value = false;
|
|
774
|
+
}
|
|
775
|
+
if (clickTimer.value)
|
|
776
|
+
clearTimeout(clickTimer.value);
|
|
777
|
+
}, 300);
|
|
778
|
+
} else {
|
|
779
|
+
ToTable.handleTableClick(event);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
function dbclickHandle(event) {
|
|
783
|
+
if (!isClick.value) {
|
|
784
|
+
isDblClick.value = true;
|
|
785
|
+
ToTable.handleTableDblClick(event);
|
|
786
|
+
} else {
|
|
787
|
+
isClick.value = false;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return (_ctx, _cache) => {
|
|
791
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
792
|
+
"tbody",
|
|
793
|
+
{
|
|
794
|
+
ref: "tbody",
|
|
795
|
+
onClick: clickHandle,
|
|
796
|
+
onMouseover: _cache[0] || (_cache[0] = //@ts-ignore
|
|
797
|
+
(...args) => vue.unref(ToTable).handleTableMouseover && vue.unref(ToTable).handleTableMouseover(...args)),
|
|
798
|
+
onMouseout: _cache[1] || (_cache[1] = //@ts-ignore
|
|
799
|
+
(...args) => vue.unref(ToTable).handleTableMouseout && vue.unref(ToTable).handleTableMouseout(...args)),
|
|
800
|
+
onMousedown: _cache[2] || (_cache[2] = //@ts-ignore
|
|
801
|
+
(...args) => vue.unref(ToTable).handleTableMousedown && vue.unref(ToTable).handleTableMousedown(...args)),
|
|
802
|
+
onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
|
|
803
|
+
(...args) => vue.unref(ToTable).handleTableMousedown && vue.unref(ToTable).handleTableMousedown(...args)),
|
|
804
|
+
onTouchmove: _cache[4] || (_cache[4] = //@ts-ignore
|
|
805
|
+
(...args) => vue.unref(ToTable).handleTableMousemove && vue.unref(ToTable).handleTableMousemove(...args)),
|
|
806
|
+
onMouseup: _cache[5] || (_cache[5] = //@ts-ignore
|
|
807
|
+
(...args) => vue.unref(ToTable).handleTableMouseup && vue.unref(ToTable).handleTableMouseup(...args)),
|
|
808
|
+
onTouchend: _cache[6] || (_cache[6] = //@ts-ignore
|
|
809
|
+
(...args) => vue.unref(ToTable).handleTableMouseup && vue.unref(ToTable).handleTableMouseup(...args)),
|
|
810
|
+
onDblclick: dbclickHandle
|
|
811
|
+
},
|
|
812
|
+
[
|
|
813
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
814
|
+
vue.Fragment,
|
|
815
|
+
null,
|
|
816
|
+
vue.renderList(__props.data, (dataItem, dataIndex) => {
|
|
817
|
+
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("tr", {
|
|
818
|
+
key: dataIndex,
|
|
819
|
+
class: vue.normalizeClass(setTrClass(dataItem)),
|
|
820
|
+
style: vue.normalizeStyle(setTrStyle.value),
|
|
821
|
+
"data-index": dataIndex,
|
|
822
|
+
onContextmenu: vue.withModifiers(($event) => vue.unref(ToTable).handleTableRowRightClick(dataItem, dataIndex, $event), ["prevent"])
|
|
823
|
+
}, [
|
|
824
|
+
vue.unref(ToTable).type === "v" ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_2, [
|
|
825
|
+
vue.renderSlot(_ctx.$slots, "v", {
|
|
826
|
+
row: dataItem,
|
|
827
|
+
index: dataIndex
|
|
828
|
+
}, () => [
|
|
829
|
+
vue.createCommentVNode(" ... \u4FDD\u6301\u539F\u6709\u7ED3\u6784 ... ")
|
|
830
|
+
])
|
|
831
|
+
])) : (vue.openBlock(true), vue.createElementBlock(
|
|
832
|
+
vue.Fragment,
|
|
833
|
+
{ key: 1 },
|
|
834
|
+
vue.renderList(tableData.value, (column, columnIndex) => {
|
|
835
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
836
|
+
vue.Fragment,
|
|
837
|
+
null,
|
|
838
|
+
[
|
|
839
|
+
showColumn(column, columnIndex) ? (vue.openBlock(), vue.createElementBlock(
|
|
840
|
+
vue.Fragment,
|
|
841
|
+
{ key: 0 },
|
|
842
|
+
[
|
|
843
|
+
vue.createCommentVNode(" ... \u4FDD\u6301\u539F\u6709\u7ED3\u6784 ... ")
|
|
844
|
+
],
|
|
845
|
+
64
|
|
846
|
+
/* STABLE_FRAGMENT */
|
|
847
|
+
)) : vue.createCommentVNode("v-if", true)
|
|
848
|
+
],
|
|
849
|
+
64
|
|
850
|
+
/* STABLE_FRAGMENT */
|
|
851
|
+
);
|
|
852
|
+
}),
|
|
853
|
+
256
|
|
854
|
+
/* UNKEYED_FRAGMENT */
|
|
855
|
+
))
|
|
856
|
+
], 46, _hoisted_1)), [
|
|
857
|
+
[vue.vShow, dataItem._show]
|
|
858
|
+
]);
|
|
859
|
+
}),
|
|
860
|
+
128
|
|
861
|
+
/* KEYED_FRAGMENT */
|
|
862
|
+
))
|
|
863
|
+
],
|
|
864
|
+
544
|
|
865
|
+
/* NEED_HYDRATION, NEED_PATCH */
|
|
866
|
+
);
|
|
867
|
+
};
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
var TableBody = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/wangding/WorkSpace/AsiaInfo/projects/\u524D\u7AEF\u6846\u67B6/touch-vue3-ui/packages/components/table/src/table-body.vue"]]);
|
|
872
|
+
|
|
873
|
+
const withInstall = (main, extra) => {
|
|
874
|
+
main.install = (app) => {
|
|
875
|
+
for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
|
|
876
|
+
app.component(comp.name, comp);
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
if (extra) {
|
|
880
|
+
for (const [key, comp] of Object.entries(extra)) {
|
|
881
|
+
main[key] = comp;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return main;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
navigator.userAgent.toLowerCase();
|
|
888
|
+
|
|
889
|
+
const ToTable = withInstall(Table);
|
|
890
|
+
const ToTableHead = withInstall(TableHead);
|
|
891
|
+
const ToTableBody = withInstall(TableBody);
|
|
892
|
+
const ToTableConfig = withInstall(TableConfig);
|
|
893
|
+
|
|
894
|
+
exports.ToTable = ToTable;
|
|
895
|
+
exports.ToTableBody = ToTableBody;
|
|
896
|
+
exports.ToTableConfig = ToTableConfig;
|
|
897
|
+
exports.ToTableHead = ToTableHead;
|
|
898
|
+
//# sourceMappingURL=index.js.map
|