efront 3.22.3 → 3.22.4
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/apps/pivot/auth/login.html +3 -0
- package/apps/pivot/auth/login.js +1 -1
- package/apps/pivot/auth/login.less +16 -3
- package/apps/pivot/log/boot.js +3 -2
- package/coms/layer/glance.js +4 -2
- package/coms/zimoli/autodragchildren.js +21 -26
- package/coms/zimoli/drag.js +1 -1
- package/coms/zimoli/pagination.html +1 -1
- package/coms/zimoli/pagination.js +9 -24
- package/coms/zimoli/pagination.less +34 -19
- package/coms/zimoli/table.html +9 -1
- package/coms/zimoli/table.js +99 -47
- package/coms/zimoli/table.less +32 -17
- package/coms/zimoli/table_test.html +32 -0
- package/coms/zimoli/table_test.js +1 -8
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/auth/login.js
CHANGED
|
@@ -4,11 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
[foot],
|
|
6
6
|
[head] {
|
|
7
|
-
&::before{
|
|
7
|
+
&::before {
|
|
8
8
|
display: none;
|
|
9
9
|
}
|
|
10
|
+
|
|
10
11
|
text-align: center;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
[message] {
|
|
15
|
+
padding: 2px 4px;
|
|
16
|
+
line-height: 1.2;
|
|
17
|
+
text-align: center;
|
|
18
|
+
color: #29c;
|
|
19
|
+
border-top: 1px solid #29c;
|
|
20
|
+
background: #29c1;
|
|
21
|
+
margin: 0 auto;
|
|
22
|
+
font-size: 12px;
|
|
14
23
|
}
|
|
24
|
+
|
|
25
|
+
.button {
|
|
26
|
+
padding: 0px 40px;
|
|
27
|
+
}
|
package/apps/pivot/log/boot.js
CHANGED
|
@@ -5,10 +5,11 @@ var fields = refilm`
|
|
|
5
5
|
var ip = e.data[e.field.key];
|
|
6
6
|
var m = /(\d+\.){3}\d+$/.exec(ip);
|
|
7
7
|
if (m) {
|
|
8
|
+
var l = document.createElement('label');
|
|
9
|
+
appendChild(e, l);
|
|
10
|
+
l.innerHTML = ' ';
|
|
8
11
|
var setAddress = function (a) {
|
|
9
|
-
var l = document.createElement('label');
|
|
10
12
|
l.innerText = a;
|
|
11
|
-
appendChild(e, l);
|
|
12
13
|
};
|
|
13
14
|
if (e.data.address) setAddress(e.data.address);
|
|
14
15
|
else e.data.address = data.from("iplocation", { ip: m[0] }, function (a) {
|
package/coms/layer/glance.js
CHANGED
|
@@ -139,10 +139,12 @@ function main(mainPath, historyName = "") {
|
|
|
139
139
|
}, 20);
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
|
|
142
|
+
var update = function (event) {
|
|
143
143
|
if (event.target !== this) return;
|
|
144
144
|
dispatch(window, 'resize');
|
|
145
|
-
}
|
|
145
|
+
};
|
|
146
|
+
on("transitionrun")(layer, update);
|
|
147
|
+
on("transitionend")(layer, update);
|
|
146
148
|
layer.closeLeft = function () {
|
|
147
149
|
closed = true;
|
|
148
150
|
bindClass();
|
|
@@ -21,33 +21,33 @@ var moveChildrenX = function (targetBox, previousElements, followedElements, mov
|
|
|
21
21
|
var dragPosition = getScreenPosition(dragTarget);
|
|
22
22
|
var dragPositionLeft = dragPosition.left;
|
|
23
23
|
var dragPositionRight = dragPosition.left + dragPosition.width;
|
|
24
|
-
previousElements.
|
|
24
|
+
previousElements.forEach(function (element) {
|
|
25
25
|
var elementPosition = getScreenPosition(element);
|
|
26
26
|
var elementCenter = elementPosition.left + elementPosition.width / 2;
|
|
27
27
|
var delta = elementCenter - (element.moved || 0);
|
|
28
|
-
if (delta +
|
|
28
|
+
if (delta + 2 <= dragPositionLeft) {
|
|
29
29
|
recover(element);
|
|
30
|
-
} else if (delta -
|
|
30
|
+
} else if (delta - 2 >= dragPositionLeft) {
|
|
31
31
|
moveMargin(element, dragPosition.width);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
followedElements.
|
|
34
|
+
followedElements.forEach(function (element) {
|
|
35
35
|
var elementPosition = getScreenPosition(element);
|
|
36
36
|
var elementCenter = elementPosition.left + elementPosition.width / 2;
|
|
37
37
|
var delta = elementCenter - (element.moved || 0);
|
|
38
|
-
if (delta +
|
|
38
|
+
if (delta + 2 <= dragPositionRight) {
|
|
39
39
|
moveMargin(element, -dragPosition.width);
|
|
40
|
-
} else if (delta -
|
|
40
|
+
} else if (delta - 2 >= dragPositionRight) {
|
|
41
41
|
recover(element);
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
} else {
|
|
45
|
-
previousElements.
|
|
46
|
-
followedElements.
|
|
45
|
+
previousElements.forEach(recover);
|
|
46
|
+
followedElements.forEach(recover);
|
|
47
47
|
}
|
|
48
48
|
} else {
|
|
49
|
-
previousElements.
|
|
50
|
-
followedElements.
|
|
49
|
+
previousElements.forEach(recover);
|
|
50
|
+
followedElements.forEach(recover);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
var scrollX = function (targetBox, moveChildren) {
|
|
@@ -84,14 +84,8 @@ var bindTarget = function (index, element) {
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
87
|
-
var
|
|
88
|
-
if (
|
|
89
|
-
dragbox = dragbox.call(this);
|
|
90
|
-
if (dragbox && !getTargetIn(dragbox, event.target)) return;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
dragbox = this;
|
|
94
|
-
}
|
|
87
|
+
var boxfinder;
|
|
88
|
+
if (isMovingSource === false) boxfinder = matcher, matcher = null;
|
|
95
89
|
var that = this;
|
|
96
90
|
|
|
97
91
|
var draggingSourceOpacity = isMovingSource !== false ? 0 : 1;
|
|
@@ -100,7 +94,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
100
94
|
moveMargin(element, 0);
|
|
101
95
|
};
|
|
102
96
|
var cloneCell = function (element) {
|
|
103
|
-
var targets = getTargetIn(matcher, element, false);
|
|
97
|
+
var targets = matcher ? getTargetIn(matcher, element, false) : element;
|
|
104
98
|
if (isArray(targets)) {
|
|
105
99
|
var extra = targets.slice(1);
|
|
106
100
|
targets = cloneVisible(targets[0]);
|
|
@@ -131,6 +125,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
131
125
|
};
|
|
132
126
|
var getBoundingClientRect = function () { return getScreenPosition(this.target) }
|
|
133
127
|
var bindExtra = function (element) {
|
|
128
|
+
if (!matcher) return element;
|
|
134
129
|
var targets = getTargetIn(matcher, element, false);
|
|
135
130
|
if (isArray(targets)) {
|
|
136
131
|
var [target] = targets;
|
|
@@ -150,11 +145,10 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
150
145
|
}
|
|
151
146
|
var targetBox, saved_opacity, saved_filter, moveMargin, moveChildren;
|
|
152
147
|
var previousElements, followedElements, rebuildTargets, scroll;
|
|
153
|
-
var that = this;
|
|
154
148
|
var draginit = function () {
|
|
155
149
|
that.setAttribute('dragchildren', '');
|
|
156
150
|
if (targetBox) addClass(targetBox, 'dropping');
|
|
157
|
-
if (
|
|
151
|
+
if (isMovingSource !== false) {
|
|
158
152
|
targetBox = targetChild.parentNode;
|
|
159
153
|
previousElements = getPreviousElementSiblings(targetChild);
|
|
160
154
|
followedElements = getFollowedElementSiblings(targetChild);
|
|
@@ -168,7 +162,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
168
162
|
followedElements = [];
|
|
169
163
|
moveChildren = () => { };
|
|
170
164
|
rebuildTargets = function () {
|
|
171
|
-
var temp =
|
|
165
|
+
var temp = boxfinder(drag.target);
|
|
172
166
|
if (temp === targetBox) return;
|
|
173
167
|
if (previousElements) previousElements.map(recover);
|
|
174
168
|
if (followedElements) followedElements.map(recover);
|
|
@@ -186,11 +180,12 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
186
180
|
previousElements = [].slice.call(targetBox.children, 0).reverse();
|
|
187
181
|
followedElements = [];
|
|
188
182
|
[moveMargin, moveChildren, scroll] = getMoveFuncs(previousElements[0]);
|
|
189
|
-
moveChildren = moveChildren.bind(null,
|
|
183
|
+
moveChildren = moveChildren.bind(null, targetBox, previousElements, followedElements, moveMargin, recover);
|
|
190
184
|
};
|
|
191
185
|
}
|
|
192
186
|
};
|
|
193
187
|
var dragfire = function () {
|
|
188
|
+
if (!targetBox) return;
|
|
194
189
|
that.removeAttribute('dragchildren');
|
|
195
190
|
removeClass(targetBox, "dropping");
|
|
196
191
|
var dst, appendSibling, delta;
|
|
@@ -321,7 +316,7 @@ var hookEvent = function (matcher, move, event) {
|
|
|
321
316
|
hooka.call(this, matcher, move, event, targetChild);
|
|
322
317
|
};
|
|
323
318
|
function addhook() {
|
|
324
|
-
var mousedownEvent, targetElement, callback,
|
|
319
|
+
var mousedownEvent, targetElement, callback, boxfinder, dropid, allowdrops;
|
|
325
320
|
[].forEach.call(arguments, function (arg) {
|
|
326
321
|
switch (typeof arg) {
|
|
327
322
|
case "string":
|
|
@@ -331,7 +326,7 @@ function addhook() {
|
|
|
331
326
|
if (!callback) {
|
|
332
327
|
callback = arg;
|
|
333
328
|
} else {
|
|
334
|
-
|
|
329
|
+
boxfinder = callback;
|
|
335
330
|
callback = arg;
|
|
336
331
|
}
|
|
337
332
|
break;
|
|
@@ -354,7 +349,7 @@ function addhook() {
|
|
|
354
349
|
if (!mousedownEvent) return;
|
|
355
350
|
var target = targetElement || mousedownEvent.currentTarget;
|
|
356
351
|
hooka.call(targetElement, function (target) {
|
|
357
|
-
var res =
|
|
352
|
+
var res = Array.prototype.filter.call(allowdrops || (boxfinder ? boxfinder(target) : document.querySelectorAll("[allowdrop]")), function (child) {
|
|
358
353
|
return target && overlap(child, target);
|
|
359
354
|
}).filter(e => {
|
|
360
355
|
var a = e.getAttribute("allowdrop");
|
package/coms/zimoli/drag.js
CHANGED
|
@@ -33,7 +33,7 @@ var setZIndex = function () {
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
function drag(target, initialEvent, preventOverflow, isMovingSource) {
|
|
36
|
-
if (/^(?:select|input|textarea)$/i.test(initialEvent.target.tagName) || getTargetIn(a => a.nodrag || a.hasAttribute('nodrag')
|
|
36
|
+
if (/^(?:select|input|textarea)$/i.test(initialEvent.target.tagName) || getTargetIn(a => a.nodrag || a.hasAttribute('nodrag'), initialEvent.target)) return;
|
|
37
37
|
if (target.dragable === false) return;
|
|
38
38
|
initialEvent.preventDefault();
|
|
39
39
|
if (isArray(target)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function main(element) {
|
|
2
|
-
var page = element ||
|
|
2
|
+
var page = element || document.createElement('pagination');
|
|
3
3
|
page.innerHTML = pagination;
|
|
4
4
|
render(page, {
|
|
5
5
|
xlist: list,
|
|
@@ -7,26 +7,10 @@ function main(element) {
|
|
|
7
7
|
fromPixel,
|
|
8
8
|
pages: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
|
|
9
9
|
next() {
|
|
10
|
-
|
|
11
|
-
index += 10;
|
|
12
|
-
if (this.pages.length < index + 10) {
|
|
13
|
-
index = this.pages.length - 10;
|
|
14
|
-
}
|
|
15
|
-
if (index < 0) {
|
|
16
|
-
index = 0;
|
|
17
|
-
}
|
|
18
|
-
this.pglist.go(index);
|
|
10
|
+
this.pglist.scrollBy(this.pglist.clientWidth);
|
|
19
11
|
},
|
|
20
12
|
prev() {
|
|
21
|
-
|
|
22
|
-
index -= 10;
|
|
23
|
-
if (this.pages.length < index + 10) {
|
|
24
|
-
index = this.pages.length - 10;
|
|
25
|
-
}
|
|
26
|
-
if (index < 0) {
|
|
27
|
-
index = 0;
|
|
28
|
-
}
|
|
29
|
-
this.pglist.go(index);
|
|
13
|
+
this.pglist.scrollBy(-this.pglist.clientWidth);
|
|
30
14
|
},
|
|
31
15
|
start() {
|
|
32
16
|
this.pglist.go(0);
|
|
@@ -39,10 +23,11 @@ function main(element) {
|
|
|
39
23
|
this.pglist.go(index);
|
|
40
24
|
}
|
|
41
25
|
});
|
|
42
|
-
|
|
43
|
-
page
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
var pglist = page.querySelector('xlist');
|
|
27
|
+
onmounted(page, function () {
|
|
28
|
+
console.log(pglist)
|
|
29
|
+
pglist.XScrollBoxId = 1;
|
|
30
|
+
pglist.go(0);
|
|
31
|
+
});
|
|
47
32
|
return page;
|
|
48
33
|
}
|
|
@@ -1,26 +1,41 @@
|
|
|
1
|
+
*{
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
1
4
|
& {
|
|
2
5
|
white-space: nowrap;
|
|
6
|
+
display: block;
|
|
7
|
+
min-width: 240px;
|
|
8
|
+
width: 100%;
|
|
9
|
+
position: relative;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
>xlist {
|
|
3
13
|
display: inline-block;
|
|
14
|
+
text-overflow: clip;
|
|
15
|
+
text-align: center;
|
|
16
|
+
position: relative;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
vertical-align: top;
|
|
19
|
+
border-left: 72px solid transparent;
|
|
20
|
+
border-right: 72px solid transparent;
|
|
21
|
+
margin: 0 -72px 0 -72px;
|
|
4
22
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
display: inline-block;
|
|
8
|
-
text-overflow: clip;
|
|
9
|
-
min-width: 40px;
|
|
10
|
-
text-align: center;
|
|
11
|
-
max-width: 400px;
|
|
12
|
-
position: relative;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
vertical-align: top;
|
|
23
|
+
.button {
|
|
24
|
+
border-radius: 0;
|
|
15
25
|
}
|
|
26
|
+
}
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
btn.button {
|
|
29
|
+
box-shadow: none;
|
|
30
|
+
padding: 0 10px;
|
|
31
|
+
min-width: 36px;
|
|
32
|
+
height: 28px;
|
|
33
|
+
line-height: 28px;
|
|
34
|
+
color: #999;
|
|
35
|
+
margin: 0;
|
|
36
|
+
vertical-align: top;
|
|
37
|
+
display: inline-block;
|
|
38
|
+
background-color: inherit;
|
|
39
|
+
color: inherit;
|
|
40
|
+
z-index: 1;
|
|
26
41
|
}
|
package/coms/zimoli/table.html
CHANGED
|
@@ -21,4 +21,12 @@
|
|
|
21
21
|
</a>
|
|
22
22
|
</td>
|
|
23
23
|
</tr>
|
|
24
|
-
</tbody>
|
|
24
|
+
</tbody>
|
|
25
|
+
<tfoot>
|
|
26
|
+
<tr -if="!data||!data.length" style="padding-bottom: 20px;">
|
|
27
|
+
<td style="text-align: center;">
|
|
28
|
+
<template -if="data.is_loading">加载中</template>
|
|
29
|
+
<template -else>无数据</template>
|
|
30
|
+
</td>
|
|
31
|
+
</tr>
|
|
32
|
+
</tfoot>
|
package/coms/zimoli/table.js
CHANGED
|
@@ -12,7 +12,6 @@ var moveMargin = function (element, movePixels) {
|
|
|
12
12
|
marginRight: movePixels ? -movePixels + "px" : ""
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
|
|
16
15
|
var markRowTds = function (tr, deltas, colstart, colend) {
|
|
17
16
|
var inc = 0;
|
|
18
17
|
var collections = [];
|
|
@@ -20,8 +19,8 @@ var markRowTds = function (tr, deltas, colstart, colend) {
|
|
|
20
19
|
while (deltas[inc] > 0) {
|
|
21
20
|
deltas[inc++]--;
|
|
22
21
|
}
|
|
23
|
-
var colspan =
|
|
24
|
-
var rowspan =
|
|
22
|
+
var colspan = getColspan(td);
|
|
23
|
+
var rowspan = getRowspan(td);
|
|
25
24
|
rowspan = rowspan > 1 ? rowspan - 1 : 0;
|
|
26
25
|
colspan = colspan > 1 ? colspan - 1 : 0;
|
|
27
26
|
for (var cx = inc, dx = colspan + inc; cx <= dx; cx++) {
|
|
@@ -40,8 +39,8 @@ var markRowTds = function (tr, deltas, colstart, colend) {
|
|
|
40
39
|
});
|
|
41
40
|
return collections;
|
|
42
41
|
};
|
|
43
|
-
var
|
|
44
|
-
for (var tr of
|
|
42
|
+
var forEachRow = function (tbody, call) {
|
|
43
|
+
for (var tr of tbody.children) {
|
|
45
44
|
if (isTableRow(tr)) {
|
|
46
45
|
call(tr);
|
|
47
46
|
}
|
|
@@ -51,12 +50,18 @@ var forEachTableRow = function (table, call) {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
var getRowsOfTdsByCol = function (table, start, end) {
|
|
54
|
-
var savedRowDeltas = [];
|
|
55
53
|
var savedCollections = [];
|
|
56
|
-
|
|
54
|
+
var thead = getThead(table);
|
|
55
|
+
var tbody = getTbody(table);
|
|
56
|
+
var savedRowDeltas;
|
|
57
|
+
if (thead) savedRowDeltas = [], forEachRow(thead, function (tr) {
|
|
57
58
|
var collections = markRowTds(tr, savedRowDeltas, start, end);
|
|
58
59
|
savedCollections.push(collections);
|
|
59
|
-
})
|
|
60
|
+
});
|
|
61
|
+
if (tbody) savedRowDeltas = [], forEachRow(tbody, function (tr) {
|
|
62
|
+
var collections = markRowTds(tr, savedRowDeltas, start, end);
|
|
63
|
+
savedCollections.push(collections);
|
|
64
|
+
});
|
|
60
65
|
return savedCollections;
|
|
61
66
|
}
|
|
62
67
|
var getTdsByCol = function (table, start, end) {
|
|
@@ -81,17 +86,29 @@ var getTbody = function (table) {
|
|
|
81
86
|
if (/^tbody$/i.test(c.tagName) || c.hasAttribute("tbody")) return c;
|
|
82
87
|
}
|
|
83
88
|
};
|
|
89
|
+
var getTfoot = function (table) {
|
|
90
|
+
for (var c of table.children) {
|
|
91
|
+
if (/^tfoot$/i.test(c.tagName) || c.hasAttribute("tfoot")) return c;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
84
94
|
var isTableRow = function (e) {
|
|
85
95
|
return trElementReg.test(e.tagName);
|
|
86
96
|
};
|
|
97
|
+
var getRowspan = function (e) {
|
|
98
|
+
return +e.getAttribute('rowspan') || 1;
|
|
99
|
+
};
|
|
100
|
+
var getColspan = function (e) {
|
|
101
|
+
return +e.getAttribute('colspan') || 1;
|
|
102
|
+
}
|
|
87
103
|
var resizeColumn = function (target, targetW) {
|
|
88
104
|
var deltaW = targetW - target.offsetWidth;
|
|
89
|
-
|
|
105
|
+
forEachRow(this, function (tr) {
|
|
90
106
|
resizeT(tr, tr.offsetWidth + deltaW);
|
|
91
107
|
});
|
|
92
108
|
for (var c of this.children) {
|
|
93
109
|
if (!isTableRow(c)) {
|
|
94
110
|
var tr = c.querySelector('tr');
|
|
111
|
+
if (!tr) continue;
|
|
95
112
|
c.style.width = tr.style.width;
|
|
96
113
|
}
|
|
97
114
|
}
|
|
@@ -104,6 +121,7 @@ var resizeColumn = function (target, targetW) {
|
|
|
104
121
|
for (var c of cs) {
|
|
105
122
|
w += c.offsetWidth;
|
|
106
123
|
}
|
|
124
|
+
if (!cs.length) continue;
|
|
107
125
|
w = targetW - w;
|
|
108
126
|
while (w !== 0) {
|
|
109
127
|
var c = cs.pop();
|
|
@@ -134,8 +152,8 @@ var getFirstSingleColCell = function (table, col) {
|
|
|
134
152
|
var tds = getTdsByCol(table, col, col);
|
|
135
153
|
while (tds.length) {
|
|
136
154
|
var td = tds.shift();
|
|
137
|
-
var colspan = td
|
|
138
|
-
if (1 ===
|
|
155
|
+
var colspan = getColspan(td);
|
|
156
|
+
if (1 === colspan) return td;
|
|
139
157
|
}
|
|
140
158
|
}
|
|
141
159
|
var adaptTarget = function (event) {
|
|
@@ -212,7 +230,7 @@ function enrichField(f) {
|
|
|
212
230
|
}
|
|
213
231
|
}
|
|
214
232
|
var tbodyHeight = function (tbody) {
|
|
215
|
-
return { 'max-height': ((innerHeight - getScreenPosition(tbody).top -
|
|
233
|
+
return { 'max-height': ((innerHeight - getScreenPosition(tbody).top - 8) / 36 | 0) * 36 }
|
|
216
234
|
};
|
|
217
235
|
|
|
218
236
|
var setFixed = function (children, scrolled, left, borderRight) {
|
|
@@ -271,67 +289,103 @@ var setFixedColumn = function () {
|
|
|
271
289
|
}
|
|
272
290
|
setFixed.call(this, children, this.scrollLeft, 'left', 'borderRight');
|
|
273
291
|
setFixed.call(this, children.reverse(), this.scrollWidth - this.clientWidth - this.scrollLeft, 'right', 'borderLeft');
|
|
292
|
+
var tfoot = getTfoot(this);
|
|
293
|
+
if (tfoot) {
|
|
294
|
+
css(tfoot, { left: this.scrollLeft });
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
var setClass = function (tds, cls, old) {
|
|
298
|
+
tds.forEach(td => td[cls] = true);
|
|
299
|
+
old.forEach(td => { if (!td[cls]) removeClass(td, cls) });
|
|
300
|
+
tds.forEach(td => { addClass(td, cls); delete td[cls] });
|
|
301
|
+
};
|
|
302
|
+
var getTdsOfSameRow = function (td) {
|
|
303
|
+
var tds = [td];
|
|
304
|
+
var tmp = td;
|
|
305
|
+
var rowspan = getRowspan(td);
|
|
306
|
+
var { colstart, colend } = td;
|
|
307
|
+
while (tmp) {
|
|
308
|
+
tmp = tmp.previousElementSibling;
|
|
309
|
+
if (!tmp) break;
|
|
310
|
+
if (colstart - tmp.colend > 1) break;
|
|
311
|
+
if (getRowspan(tmp) > rowspan) break;
|
|
312
|
+
tds.push(tmp);
|
|
313
|
+
colstart = tmp.colstart;
|
|
314
|
+
};
|
|
315
|
+
tmp = td;
|
|
316
|
+
while (tmp) {
|
|
317
|
+
tmp = tmp.nextElementSibling;
|
|
318
|
+
if (!tmp) break;
|
|
319
|
+
if (tmp.colstart - colend > 1) break;
|
|
320
|
+
if (getRowspan(tmp) > rowspan) break;
|
|
321
|
+
tds.push(tmp);
|
|
322
|
+
colend = tmp.colend;
|
|
323
|
+
}
|
|
324
|
+
var tr = td.parentNode;
|
|
325
|
+
while (rowspan > 1) {
|
|
326
|
+
tr = tr.nextElementSibling;
|
|
327
|
+
if (!tr) break;
|
|
328
|
+
for (var c of tr.children) {
|
|
329
|
+
if (c.colstart >= colstart && c.colend <= colend) {
|
|
330
|
+
if (getRowspan(c) <= rowspan) {
|
|
331
|
+
tds.push(c);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
rowspan--;
|
|
336
|
+
}
|
|
337
|
+
return tds;
|
|
274
338
|
};
|
|
275
|
-
|
|
276
339
|
function table(elem) {
|
|
277
340
|
var tableElement = isElement(elem) ? elem : document.createElement("table");
|
|
278
341
|
var activeCols = [];
|
|
279
|
-
|
|
280
|
-
var off;
|
|
281
|
-
tableElement.init = function () {
|
|
282
|
-
off = on("mousemove")(window, adaptCursor);
|
|
283
|
-
};
|
|
284
|
-
tableElement.dispose = tableElement.destroy = function () {
|
|
285
|
-
off();
|
|
286
|
-
};
|
|
287
|
-
on("append")(tableElement, tableElement.init);
|
|
288
|
-
on("remove")(tableElement, tableElement.destroy);
|
|
289
|
-
if (isMounted(tableElement)) tableElement.init();
|
|
290
|
-
|
|
342
|
+
bind('mousemove')(tableElement, adaptTarget);
|
|
291
343
|
moveupon(tableElement, {
|
|
292
344
|
start(event) {
|
|
293
345
|
if (this.resizing) event.preventDefault();
|
|
294
346
|
},
|
|
295
347
|
move: resizeTarget,
|
|
296
348
|
});
|
|
349
|
+
var activeRows = [];
|
|
297
350
|
onmousemove(tableElement, function (event) {
|
|
351
|
+
if (table.resizing) return;
|
|
352
|
+
var tbody = getTbody(table);
|
|
353
|
+
a: if (tbody) {
|
|
354
|
+
var tr = getTargetIn(tbody, event.target, false);
|
|
355
|
+
if (!tr) break a;
|
|
356
|
+
var td = getTargetIn(tr, event.target, false);
|
|
357
|
+
if (!td) break a;
|
|
358
|
+
var tds = getTdsOfSameRow(td);
|
|
359
|
+
setClass(tds, 'x-ing', activeRows);
|
|
360
|
+
activeRows = tds;
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
298
363
|
if (!thead) {
|
|
299
364
|
thead = getThead(table);
|
|
300
365
|
}
|
|
301
366
|
if (!getTargetIn(thead, event.target)) return;
|
|
302
|
-
if (table.resizing) return;
|
|
303
367
|
var tds = getTargetIn(cellMatchManager, event.target);
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
td.ying = true;
|
|
307
|
-
});
|
|
308
|
-
activeCols.map(function (td) {
|
|
309
|
-
if (!td.ying) removeClass(td, "y-ing");
|
|
310
|
-
});
|
|
311
|
-
activeCols = tds.map(function (td) {
|
|
312
|
-
addClass(td, "y-ing");
|
|
313
|
-
delete td.ying;
|
|
314
|
-
return td;
|
|
315
|
-
});
|
|
368
|
+
setClass(tds, 'y-ing', activeCols);
|
|
369
|
+
activeCols = tds;
|
|
316
370
|
});
|
|
317
371
|
onmouseleave(tableElement, function () {
|
|
318
|
-
activeCols.
|
|
372
|
+
activeCols.forEach(function (td) {
|
|
319
373
|
removeClass(td, "y-ing");
|
|
320
374
|
});
|
|
375
|
+
activeRows.forEach(function (td) {
|
|
376
|
+
removeClass(td, 'x-ing');
|
|
377
|
+
});
|
|
321
378
|
});
|
|
322
379
|
var table = tableElement;
|
|
323
380
|
var thead;
|
|
324
381
|
var markedRows = false;
|
|
325
382
|
var cellMatchManager = function (element) {
|
|
326
|
-
if (!thead)
|
|
327
|
-
[thead] = table.getElementsByTagName("thead");
|
|
328
|
-
if (!thead) thead = table.querySelector('[thead]');
|
|
329
|
-
}
|
|
383
|
+
if (!thead) thead = getThead(table);
|
|
330
384
|
if (!getTargetIn(thead, element)) return false;
|
|
331
385
|
if (!tdElementReg.test(element.tagName)) return false;
|
|
332
386
|
if (!markedRows) {
|
|
333
387
|
var savedRowDeltas = [];
|
|
334
|
-
|
|
388
|
+
Array.prototype.forEach.call(thead.children, function (tr) {
|
|
335
389
|
markRowTds(tr, savedRowDeltas);
|
|
336
390
|
});
|
|
337
391
|
markedRows = true;
|
|
@@ -340,9 +394,6 @@ function table(elem) {
|
|
|
340
394
|
return getTdsByCol(table, colstart, colend);
|
|
341
395
|
};
|
|
342
396
|
|
|
343
|
-
table.dragbox = function () {
|
|
344
|
-
return thead;
|
|
345
|
-
};
|
|
346
397
|
table.useIncrease = false;
|
|
347
398
|
var _vbox = function () {
|
|
348
399
|
table.$Left = function (x) {
|
|
@@ -398,6 +449,7 @@ function table(elem) {
|
|
|
398
449
|
},
|
|
399
450
|
a: button,
|
|
400
451
|
setFixedColumn,
|
|
452
|
+
pagination
|
|
401
453
|
}, this.$parentScopes.concat(this.$scope));
|
|
402
454
|
})
|
|
403
455
|
autodragchildren(
|