efront 3.22.2 → 3.22.5
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/basic/[]map.js +1 -1
- package/coms/frame/list.less +6 -4
- package/coms/layer/glance.js +4 -2
- package/coms/zimoli/autodragchildren.js +46 -35
- package/coms/zimoli/drag.js +1 -1
- package/coms/zimoli/gallery.js +1 -1
- package/coms/zimoli/getGenerator.js +4 -2
- package/coms/zimoli/list.js +31 -22
- package/coms/zimoli/menu.js +1 -3
- package/coms/zimoli/menuList.js +12 -16
- package/coms/zimoli/on.js +12 -0
- package/coms/zimoli/once.js +9 -7
- package/coms/zimoli/pagination.html +1 -1
- package/coms/zimoli/pagination.js +9 -24
- package/coms/zimoli/pagination.less +34 -19
- package/coms/zimoli/render.js +11 -1
- package/coms/zimoli/resize.js +3 -1
- package/coms/zimoli/scrollbar.js +5 -5
- package/coms/zimoli/table.html +24 -10
- package/coms/zimoli/table.js +270 -61
- package/coms/zimoli/table.less +76 -34
- package/coms/zimoli/table_test.html +32 -0
- package/coms/zimoli/table_test.js +1 -8
- package/coms/zimoli/vbox.js +25 -17
- package/coms/zimoli/vscroll.js +4 -4
- 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/basic/[]map.js
CHANGED
|
@@ -78,6 +78,6 @@ if (!function () { }.bind) Function.prototype.bind = function (context) {
|
|
|
78
78
|
return function () {
|
|
79
79
|
var _args = args.slice.call(arguments, 0, arguments.length);
|
|
80
80
|
args.unshift.apply(_args, args);
|
|
81
|
-
return this.apply(context, _args);
|
|
81
|
+
return this.apply(context === void 0 || context === null ? this : context, _args);
|
|
82
82
|
};
|
|
83
83
|
};
|
package/coms/frame/list.less
CHANGED
|
@@ -4,22 +4,24 @@ btn {
|
|
|
4
4
|
|
|
5
5
|
& {
|
|
6
6
|
height: 100%;
|
|
7
|
-
overflow: auto;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
table {
|
|
11
10
|
|
|
12
11
|
td {
|
|
13
12
|
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
white-space: normal;
|
|
13
|
+
>[type=text] {
|
|
14
|
+
white-space: pre-wrap;
|
|
17
15
|
word-break: break-all;
|
|
18
16
|
overflow: hidden;
|
|
19
17
|
display: -webkit-box;
|
|
20
18
|
-webkit-line-clamp: 2;
|
|
21
19
|
-webkit-box-orient: vertical;
|
|
20
|
+
line-height: 16px;
|
|
21
|
+
font-size: 10px;
|
|
22
22
|
text-overflow: ellipsis;
|
|
23
|
+
color: #666;
|
|
24
|
+
height: 32px;
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
}
|
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();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
var moveMarginX = function moveMarginX(element, movePixels) {
|
|
2
2
|
if (element.moved === movePixels) return;
|
|
3
3
|
element.moved = movePixels;
|
|
4
|
-
element.moving = new Date;
|
|
5
4
|
css(element, {
|
|
6
5
|
transition: movePixels !== false ? "margin .1s" : '',
|
|
7
6
|
userSelect: "none",
|
|
@@ -21,35 +20,34 @@ var moveChildrenX = function (targetBox, previousElements, followedElements, mov
|
|
|
21
20
|
if (area > 0) {
|
|
22
21
|
var dragPosition = getScreenPosition(dragTarget);
|
|
23
22
|
var dragPositionLeft = dragPosition.left;
|
|
24
|
-
var
|
|
25
|
-
previousElements.
|
|
26
|
-
if (currentTime - element.moving < 100) return;
|
|
23
|
+
var dragPositionRight = dragPosition.left + dragPosition.width;
|
|
24
|
+
previousElements.forEach(function (element) {
|
|
27
25
|
var elementPosition = getScreenPosition(element);
|
|
28
26
|
var elementCenter = elementPosition.left + elementPosition.width / 2;
|
|
29
|
-
|
|
27
|
+
var delta = elementCenter - (element.moved || 0);
|
|
28
|
+
if (delta + 2 <= dragPositionLeft) {
|
|
30
29
|
recover(element);
|
|
31
|
-
} else {
|
|
30
|
+
} else if (delta - 2 >= dragPositionLeft) {
|
|
32
31
|
moveMargin(element, dragPosition.width);
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
|
-
|
|
36
|
-
followedElements.map(function (element) {
|
|
37
|
-
if (currentTime - element.moving < 100) return;
|
|
34
|
+
followedElements.forEach(function (element) {
|
|
38
35
|
var elementPosition = getScreenPosition(element);
|
|
39
36
|
var elementCenter = elementPosition.left + elementPosition.width / 2;
|
|
40
|
-
|
|
37
|
+
var delta = elementCenter - (element.moved || 0);
|
|
38
|
+
if (delta + 2 <= dragPositionRight) {
|
|
41
39
|
moveMargin(element, -dragPosition.width);
|
|
42
|
-
} else {
|
|
40
|
+
} else if (delta - 2 >= dragPositionRight) {
|
|
43
41
|
recover(element);
|
|
44
42
|
}
|
|
45
43
|
});
|
|
46
44
|
} else {
|
|
47
|
-
previousElements.
|
|
48
|
-
followedElements.
|
|
45
|
+
previousElements.forEach(recover);
|
|
46
|
+
followedElements.forEach(recover);
|
|
49
47
|
}
|
|
50
48
|
} else {
|
|
51
|
-
previousElements.
|
|
52
|
-
followedElements.
|
|
49
|
+
previousElements.forEach(recover);
|
|
50
|
+
followedElements.forEach(recover);
|
|
53
51
|
}
|
|
54
52
|
};
|
|
55
53
|
var scrollX = function (targetBox, moveChildren) {
|
|
@@ -86,14 +84,8 @@ var bindTarget = function (index, element) {
|
|
|
86
84
|
};
|
|
87
85
|
|
|
88
86
|
var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
89
|
-
var
|
|
90
|
-
if (
|
|
91
|
-
dragbox = dragbox.call(this);
|
|
92
|
-
if (dragbox && !getTargetIn(dragbox, event.target)) return;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
dragbox = this;
|
|
96
|
-
}
|
|
87
|
+
var boxfinder;
|
|
88
|
+
if (isMovingSource === false) boxfinder = matcher, matcher = null;
|
|
97
89
|
var that = this;
|
|
98
90
|
|
|
99
91
|
var draggingSourceOpacity = isMovingSource !== false ? 0 : 1;
|
|
@@ -102,7 +94,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
102
94
|
moveMargin(element, 0);
|
|
103
95
|
};
|
|
104
96
|
var cloneCell = function (element) {
|
|
105
|
-
var targets = getTargetIn(matcher, element, false);
|
|
97
|
+
var targets = matcher ? getTargetIn(matcher, element, false) : element;
|
|
106
98
|
if (isArray(targets)) {
|
|
107
99
|
var extra = targets.slice(1);
|
|
108
100
|
targets = cloneVisible(targets[0]);
|
|
@@ -131,6 +123,19 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
131
123
|
}
|
|
132
124
|
return targets;
|
|
133
125
|
};
|
|
126
|
+
var getBoundingClientRect = function () { return getScreenPosition(this.target) }
|
|
127
|
+
var bindExtra = function (element) {
|
|
128
|
+
if (!matcher) return element;
|
|
129
|
+
var targets = getTargetIn(matcher, element, false);
|
|
130
|
+
if (isArray(targets)) {
|
|
131
|
+
var [target] = targets;
|
|
132
|
+
return {
|
|
133
|
+
style: target.style, target, getBoundingClientRect,
|
|
134
|
+
with: targets
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return targets;
|
|
138
|
+
};
|
|
134
139
|
if (event.target === this) return;
|
|
135
140
|
// var targetChild = getTargetIn(matcher, event.target);
|
|
136
141
|
if (!targetChild) return;
|
|
@@ -140,11 +145,10 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
140
145
|
}
|
|
141
146
|
var targetBox, saved_opacity, saved_filter, moveMargin, moveChildren;
|
|
142
147
|
var previousElements, followedElements, rebuildTargets, scroll;
|
|
143
|
-
var that = this;
|
|
144
148
|
var draginit = function () {
|
|
145
149
|
that.setAttribute('dragchildren', '');
|
|
146
150
|
if (targetBox) addClass(targetBox, 'dropping');
|
|
147
|
-
if (
|
|
151
|
+
if (isMovingSource !== false) {
|
|
148
152
|
targetBox = targetChild.parentNode;
|
|
149
153
|
previousElements = getPreviousElementSiblings(targetChild);
|
|
150
154
|
followedElements = getFollowedElementSiblings(targetChild);
|
|
@@ -158,7 +162,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
158
162
|
followedElements = [];
|
|
159
163
|
moveChildren = () => { };
|
|
160
164
|
rebuildTargets = function () {
|
|
161
|
-
var temp =
|
|
165
|
+
var temp = boxfinder(drag.target);
|
|
162
166
|
if (temp === targetBox) return;
|
|
163
167
|
if (previousElements) previousElements.map(recover);
|
|
164
168
|
if (followedElements) followedElements.map(recover);
|
|
@@ -176,11 +180,12 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
176
180
|
previousElements = [].slice.call(targetBox.children, 0).reverse();
|
|
177
181
|
followedElements = [];
|
|
178
182
|
[moveMargin, moveChildren, scroll] = getMoveFuncs(previousElements[0]);
|
|
179
|
-
moveChildren = moveChildren.bind(null,
|
|
183
|
+
moveChildren = moveChildren.bind(null, targetBox, previousElements, followedElements, moveMargin, recover);
|
|
180
184
|
};
|
|
181
185
|
}
|
|
182
186
|
};
|
|
183
187
|
var dragfire = function () {
|
|
188
|
+
if (!targetBox) return;
|
|
184
189
|
that.removeAttribute('dragchildren');
|
|
185
190
|
removeClass(targetBox, "dropping");
|
|
186
191
|
var dst, appendSibling, delta;
|
|
@@ -241,10 +246,10 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
241
246
|
clearInterval(autoScroll.ing);
|
|
242
247
|
autoScroll.ing = 0;
|
|
243
248
|
};
|
|
244
|
-
var dragmove = function (event) {
|
|
249
|
+
var dragmove = lazy(function (event) {
|
|
245
250
|
rebuildTargets();
|
|
246
251
|
moveChildren.call(this, event);
|
|
247
|
-
};
|
|
252
|
+
}, -100);
|
|
248
253
|
|
|
249
254
|
// 修改margin无效的情况
|
|
250
255
|
function dragclone() {
|
|
@@ -278,6 +283,12 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
278
283
|
function draglist() {
|
|
279
284
|
draginit();
|
|
280
285
|
rebuildTargets();
|
|
286
|
+
var _previousElements = previousElements.map(bindExtra);
|
|
287
|
+
var _followedElements = followedElements.map(bindExtra);
|
|
288
|
+
previousElements.splice(0, previousElements.length);
|
|
289
|
+
followedElements.splice(0, followedElements.length);
|
|
290
|
+
previousElements.push.apply(previousElements, _previousElements);
|
|
291
|
+
followedElements.push.apply(followedElements, _followedElements);
|
|
281
292
|
autoScroll();
|
|
282
293
|
var offall = function () {
|
|
283
294
|
cancelScroll();
|
|
@@ -287,8 +298,8 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
287
298
|
var offdragend = on("dragend")(targetChild, function () {
|
|
288
299
|
offall();
|
|
289
300
|
dragfire();
|
|
290
|
-
previousElements.
|
|
291
|
-
followedElements.
|
|
301
|
+
previousElements.forEach(e => moveMargin(e, false));
|
|
302
|
+
followedElements.forEach(e => moveMargin(e, false));
|
|
292
303
|
});
|
|
293
304
|
var offdragmove = on("dragmove")(targetChild, dragmove);
|
|
294
305
|
}
|
|
@@ -305,7 +316,7 @@ var hookEvent = function (matcher, move, event) {
|
|
|
305
316
|
hooka.call(this, matcher, move, event, targetChild);
|
|
306
317
|
};
|
|
307
318
|
function addhook() {
|
|
308
|
-
var mousedownEvent, targetElement, callback,
|
|
319
|
+
var mousedownEvent, targetElement, callback, boxfinder, dropid, allowdrops;
|
|
309
320
|
[].forEach.call(arguments, function (arg) {
|
|
310
321
|
switch (typeof arg) {
|
|
311
322
|
case "string":
|
|
@@ -315,7 +326,7 @@ function addhook() {
|
|
|
315
326
|
if (!callback) {
|
|
316
327
|
callback = arg;
|
|
317
328
|
} else {
|
|
318
|
-
|
|
329
|
+
boxfinder = callback;
|
|
319
330
|
callback = arg;
|
|
320
331
|
}
|
|
321
332
|
break;
|
|
@@ -338,7 +349,7 @@ function addhook() {
|
|
|
338
349
|
if (!mousedownEvent) return;
|
|
339
350
|
var target = targetElement || mousedownEvent.currentTarget;
|
|
340
351
|
hooka.call(targetElement, function (target) {
|
|
341
|
-
var res =
|
|
352
|
+
var res = Array.prototype.filter.call(allowdrops || (boxfinder ? boxfinder(target) : document.querySelectorAll("[allowdrop]")), function (child) {
|
|
342
353
|
return target && overlap(child, target);
|
|
343
354
|
}).filter(e => {
|
|
344
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)) {
|
package/coms/zimoli/gallery.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
var _slider = createElement(div);
|
|
3
3
|
var getGenerator = function (container, tagName = 'item') {
|
|
4
4
|
if (!container) return;
|
|
5
|
+
var scopes = container.$parentScopes || [];
|
|
6
|
+
if (container.$scope) scopes = scopes.concat(container.$scope);
|
|
7
|
+
container.$generatorScopes = scopes;
|
|
5
8
|
if (container.$generator) return container.$generator;
|
|
6
9
|
var template = document.createElement(tagName);
|
|
7
10
|
var templates = [].concat.apply([], container.childNodes).filter(a => {
|
|
@@ -21,8 +24,6 @@ var getGenerator = function (container, tagName = 'item') {
|
|
|
21
24
|
appendChild(template, templates);
|
|
22
25
|
container.insertBefore = _slider.insertBefore;
|
|
23
26
|
container.appendChild = _slider.appendChild;
|
|
24
|
-
var scopes = container.$parentScopes || [];
|
|
25
|
-
if (container.$scope) scopes = scopes.concat(container.$scope);
|
|
26
27
|
return container.$generator = function (index, com, element) {
|
|
27
28
|
if (com === undefined) {
|
|
28
29
|
if (!container.src || index >= container.src.length) return;
|
|
@@ -39,6 +40,7 @@ var getGenerator = function (container, tagName = 'item') {
|
|
|
39
40
|
if (template1.childNodes.length > 1) element.with = [].concat.apply([], template1.childNodes).slice(1);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
43
|
+
var scopes = container.$generatorScopes;
|
|
42
44
|
var parsedSrc = container.$src;
|
|
43
45
|
if (parsedSrc) {
|
|
44
46
|
var { keyName, itemName, indexName } = parsedSrc;
|
package/coms/zimoli/list.js
CHANGED
|
@@ -14,14 +14,18 @@ function ylist(container, generator, $Y) {
|
|
|
14
14
|
saved_itemIndex = void 0;
|
|
15
15
|
if (a !== void 0) scrollTo(a);
|
|
16
16
|
});
|
|
17
|
+
var getNodeTarget = function (node) {
|
|
18
|
+
if (node.nodeType === 8 && node.template) return node.template;
|
|
19
|
+
return node;
|
|
20
|
+
};
|
|
17
21
|
//取底部元素
|
|
18
22
|
var getLastElement = function (nodeType) {
|
|
19
|
-
var children =
|
|
23
|
+
var children = list.childNodes;
|
|
20
24
|
for (var cx = children.length - 1; cx >= 0; cx--) {
|
|
21
25
|
var child = children[cx];
|
|
22
|
-
if (isFinite(child.index) || nodeType === 2 && child.offsetHeight)
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
if (!(isFinite(child.index) || nodeType === 2 && child.offsetHeight)) continue;
|
|
27
|
+
child = getNodeTarget(child);
|
|
28
|
+
return child;
|
|
25
29
|
}
|
|
26
30
|
return null;
|
|
27
31
|
};
|
|
@@ -30,33 +34,33 @@ function ylist(container, generator, $Y) {
|
|
|
30
34
|
var children = list.childNodes;
|
|
31
35
|
for (var cx = children.length - 1; cx >= 0; cx--) {
|
|
32
36
|
var child = children[cx];
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
if (child.index !== index) continue;
|
|
38
|
+
child = getNodeTarget(child);
|
|
39
|
+
return child;
|
|
36
40
|
}
|
|
37
41
|
return null;
|
|
38
42
|
};
|
|
39
43
|
|
|
40
44
|
//取顶部元素
|
|
41
45
|
var getFirstElement = function (nodeType) {
|
|
42
|
-
var children =
|
|
46
|
+
var children = list.childNodes;
|
|
43
47
|
for (var cx = 0, dx = children.length; cx < dx; cx++) {
|
|
44
48
|
var child = children[cx];
|
|
45
|
-
if (isFinite(child.index) || nodeType === 2 && child.offsetHeight)
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
if (!(isFinite(child.index) || nodeType === 2 && child.offsetHeight)) continue;
|
|
50
|
+
child = getNodeTarget(child);
|
|
51
|
+
return child;
|
|
48
52
|
}
|
|
49
53
|
return null;
|
|
50
54
|
};
|
|
51
55
|
var getFirstVisibleElement = function (deltaY = 0) {
|
|
52
|
-
var children = list.
|
|
56
|
+
var children = list.childNodes;
|
|
53
57
|
var { scrollTop } = list;
|
|
54
58
|
scrollTop += deltaY;
|
|
55
59
|
for (var cx = 0, dx = children.length; cx < dx; cx++) {
|
|
56
60
|
var child = children[cx];
|
|
57
|
-
if (isFinite(child.index)
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
if (!isFinite(child.index)) continue;
|
|
62
|
+
child = getNodeTarget(child);
|
|
63
|
+
if (child.offsetTop + child.offsetHeight > scrollTop) return child;
|
|
60
64
|
}
|
|
61
65
|
return null;
|
|
62
66
|
};
|
|
@@ -88,7 +92,9 @@ function ylist(container, generator, $Y) {
|
|
|
88
92
|
var children = list.children;
|
|
89
93
|
for (var cx = children.length - 1; cx >= 0; cx--) {
|
|
90
94
|
var child = children[cx];
|
|
91
|
-
if (isFinite(child.index)
|
|
95
|
+
if (!isFinite(child.index)) continue;
|
|
96
|
+
child = getNodeTarget(child);
|
|
97
|
+
if (child.offsetTop < scrollTop + list.clientHeight) {
|
|
92
98
|
return child;
|
|
93
99
|
}
|
|
94
100
|
}
|
|
@@ -96,7 +102,7 @@ function ylist(container, generator, $Y) {
|
|
|
96
102
|
};
|
|
97
103
|
//元素表
|
|
98
104
|
var getChildrenMap = function () {
|
|
99
|
-
var children = list.
|
|
105
|
+
var children = list.childNodes;
|
|
100
106
|
var map = {};
|
|
101
107
|
for (var cx = 0, dx = children.length; cx < dx; cx++) {
|
|
102
108
|
var child = children[cx];
|
|
@@ -152,6 +158,7 @@ function ylist(container, generator, $Y) {
|
|
|
152
158
|
if (item.previousElementSibling !== item) list.insertBefore(item, getNextSibling(last_item));
|
|
153
159
|
}
|
|
154
160
|
last_index = offset;
|
|
161
|
+
item = getNodeTarget(item);
|
|
155
162
|
last_item = item;
|
|
156
163
|
if (offset === index || !indexed_item) indexed_item = item;
|
|
157
164
|
if (delta > 0) {
|
|
@@ -249,6 +256,7 @@ function ylist(container, generator, $Y) {
|
|
|
249
256
|
}
|
|
250
257
|
list.insertBefore(item, getNextSibling(last_element));
|
|
251
258
|
}
|
|
259
|
+
item = getNodeTarget(item);
|
|
252
260
|
if (!item.offsetHeight) {
|
|
253
261
|
console.warn(item, '!item.offsetHeight');
|
|
254
262
|
break;
|
|
@@ -312,6 +320,7 @@ function ylist(container, generator, $Y) {
|
|
|
312
320
|
item = createItem(offset);
|
|
313
321
|
if (!item) break;
|
|
314
322
|
list.insertBefore(item, first_element);
|
|
323
|
+
item = getNodeTarget(item);
|
|
315
324
|
scrollTop += flag_element.offsetTop - offsetTop;
|
|
316
325
|
offsetTop = flag_element.offsetTop;
|
|
317
326
|
first_element = item;
|
|
@@ -352,7 +361,7 @@ function ylist(container, generator, $Y) {
|
|
|
352
361
|
}
|
|
353
362
|
};
|
|
354
363
|
list.getLastVisibleElement = getLastVisibleElement;
|
|
355
|
-
list
|
|
364
|
+
list.$stopY = function (count, spd) {
|
|
356
365
|
var firstElement = getFirstVisibleElement();
|
|
357
366
|
var lastElement = getLastVisibleElement();
|
|
358
367
|
if (!firstElement || !lastElement || !list.clientHeight) return false;
|
|
@@ -386,7 +395,7 @@ function ylist(container, generator, $Y) {
|
|
|
386
395
|
if (deltay < 3) speed = .5;
|
|
387
396
|
y = last_y + (target_y > last_y ? speed : -speed);
|
|
388
397
|
}
|
|
389
|
-
list
|
|
398
|
+
list.$Top(y);
|
|
390
399
|
if (target_y === y) {
|
|
391
400
|
return false;
|
|
392
401
|
}
|
|
@@ -394,12 +403,12 @@ function ylist(container, generator, $Y) {
|
|
|
394
403
|
};
|
|
395
404
|
//导出方法
|
|
396
405
|
list.go = scrollTo;
|
|
397
|
-
list
|
|
406
|
+
list.$Height = function () {
|
|
398
407
|
var elem = getLastElement(2);
|
|
399
408
|
var listRestHeight = elem ? elem.offsetHeight + elem.offsetTop - list.scrollTop : list.clientHeight;
|
|
400
409
|
return currentY() + listRestHeight + restHeight;
|
|
401
410
|
};
|
|
402
|
-
list
|
|
411
|
+
list.$Top = function (y) {
|
|
403
412
|
if (isFinite(y)) {
|
|
404
413
|
var last_y = currentY();
|
|
405
414
|
if (y !== last_y) {
|
|
@@ -431,7 +440,7 @@ function ylist(container, generator, $Y) {
|
|
|
431
440
|
on("remove")(list, function () {
|
|
432
441
|
saved_itemIndex = list.index();
|
|
433
442
|
});
|
|
434
|
-
|
|
443
|
+
onmounted(list, function () {
|
|
435
444
|
if (isFinite(saved_itemIndex)) list.go(saved_itemIndex);
|
|
436
445
|
})
|
|
437
446
|
return list;
|
package/coms/zimoli/menu.js
CHANGED
|
@@ -25,9 +25,7 @@ function menu(buttons, map = buttons.map((a, cx) => cx)) {
|
|
|
25
25
|
});
|
|
26
26
|
css(extra_list, "min-width:180px;width:auto;height:auto;border:1px solid #000;background:#fff;padding:4px 0;");
|
|
27
27
|
select(menu_extra, extra_list);
|
|
28
|
-
|
|
29
|
-
extra_list.go(0);
|
|
30
|
-
});
|
|
28
|
+
extra_list.go(0);
|
|
31
29
|
appendChild(menu_box, menu_items, menu_extra);
|
|
32
30
|
return menu_box;
|
|
33
31
|
}
|
package/coms/zimoli/menuList.js
CHANGED
|
@@ -14,6 +14,7 @@ var unfocus = function () {
|
|
|
14
14
|
this.setFocus(null);
|
|
15
15
|
};
|
|
16
16
|
var setFocus = function (focused) {
|
|
17
|
+
console.log(focused)
|
|
17
18
|
if (focused && focused.hasAttribute("disabled")) return;
|
|
18
19
|
var page = this;
|
|
19
20
|
if (focused) {
|
|
@@ -178,6 +179,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
178
179
|
}
|
|
179
180
|
if (emptyFocus !== false) page.setFocus(target);
|
|
180
181
|
if (!item.length) return;
|
|
182
|
+
console.log('popupmenu')
|
|
181
183
|
page.setFocus(target);
|
|
182
184
|
var clone = template.cloneNode();
|
|
183
185
|
clone.$parentScopes = page.$parentScopes;
|
|
@@ -199,6 +201,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
199
201
|
once("remove")(menu, function () {
|
|
200
202
|
removeFromList(mounted_menus, this);
|
|
201
203
|
});
|
|
204
|
+
menu.go(0);
|
|
202
205
|
}
|
|
203
206
|
on("blur")(page, unfocus);
|
|
204
207
|
var template = page.tempalte || document.createElement("ylist");
|
|
@@ -215,7 +218,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
215
218
|
time = +time;
|
|
216
219
|
if (byMousedown && !time) return;
|
|
217
220
|
if (time) byMousedown = false;
|
|
218
|
-
|
|
221
|
+
|
|
219
222
|
if (page.ispop || time) popTimer = setTimeout(function () {
|
|
220
223
|
if (time) byMousedown = elem;
|
|
221
224
|
page.setFocus(elem);
|
|
@@ -312,10 +315,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
312
315
|
}`;
|
|
313
316
|
var notHidden = `!${itemName}.hidden`;
|
|
314
317
|
var generator = getGenerator(page, 'menu-item');
|
|
315
|
-
|
|
316
|
-
fire.apply(this, arguments);
|
|
317
|
-
dispatch(window, 'render');
|
|
318
|
-
};
|
|
318
|
+
page.$generatorScopes.push($scope);
|
|
319
319
|
list(page, function (index) {
|
|
320
320
|
var item = items[index];
|
|
321
321
|
if (!item) return;
|
|
@@ -323,18 +323,15 @@ function main(page, items, active, direction = 'y') {
|
|
|
323
323
|
var a = $scope["menu-item"](null, item);
|
|
324
324
|
if (src.itemName) a.setAttribute("e-if", notHidden);
|
|
325
325
|
a.setAttribute("e-class", className);
|
|
326
|
+
a.setAttribute("on-mouseleave", "cancel.call(this)");
|
|
327
|
+
a.setAttribute("on-mouseenter", "popMenu.call(this)");
|
|
328
|
+
a.setAttribute("on-pointermove", "popMenu.call(this)");
|
|
329
|
+
a.setAttribute("on-click", "open.call(this)");
|
|
330
|
+
a.setAttribute("_menu", src.itemName);
|
|
331
|
+
if (istoolbar) a.setAttribute("on-pointerdown", "popMenu1");
|
|
326
332
|
a = generator(index, item, a);
|
|
327
|
-
a.menu = item;
|
|
328
|
-
on("mouseleave")(a, cancel);
|
|
329
|
-
on("mouseenter")(a, open);
|
|
330
|
-
on("pointermove")(a, open);
|
|
331
|
-
if (istoolbar) on("pointerdown")(a, open1);
|
|
332
|
-
on("click")(a, fire0);
|
|
333
333
|
return a;
|
|
334
334
|
});
|
|
335
|
-
on("append")(page, function () {
|
|
336
|
-
this.go(0);
|
|
337
|
-
})
|
|
338
335
|
}
|
|
339
336
|
else {
|
|
340
337
|
page.innerHTML = menuList;
|
|
@@ -349,7 +346,6 @@ function main(page, items, active, direction = 'y') {
|
|
|
349
346
|
}
|
|
350
347
|
else {
|
|
351
348
|
var generator = getGenerator(page, 'menu-item');
|
|
352
|
-
|
|
353
349
|
list(page, function (index) {
|
|
354
350
|
var elem = generator(index);
|
|
355
351
|
if (!elem) return;
|
|
@@ -362,7 +358,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
362
358
|
on("mouseenter")(elem, open);
|
|
363
359
|
on("pointermove")(elem, cancel);
|
|
364
360
|
if (istoolbar) on("pointerdown")(elem, open1);
|
|
365
|
-
on("click")(elem,
|
|
361
|
+
on("click")(elem, fire);
|
|
366
362
|
return elem;
|
|
367
363
|
}, direction);
|
|
368
364
|
}
|
package/coms/zimoli/on.js
CHANGED
|
@@ -231,6 +231,18 @@ var broadcast = function (k, hk, event) {
|
|
|
231
231
|
var element = this;
|
|
232
232
|
var handlers = element[hk];
|
|
233
233
|
if (handlers.length > 1) handlers = handlers.slice();
|
|
234
|
+
if (event.which === 1 && event.buttons === 0) {
|
|
235
|
+
// firefox 无按键
|
|
236
|
+
Object.defineProperty(event, 'which', { value: 0 });
|
|
237
|
+
}
|
|
238
|
+
if (event.which === 1 && event.buttons === 2) {
|
|
239
|
+
// firefox 右键
|
|
240
|
+
Object.defineProperty(event, 'which', { value: 3 });
|
|
241
|
+
}
|
|
242
|
+
if (event.which === 1 && event.buttons === 4) {
|
|
243
|
+
// firefox 中键
|
|
244
|
+
Object.defineProperty(event, 'which', { value: 2 });
|
|
245
|
+
}
|
|
234
246
|
for (var [eventtypes, handler, context] of handlers) {
|
|
235
247
|
if (eventtypes.self && event.target !== element) continue;
|
|
236
248
|
if (!checkKeyNeed(eventtypes, event)) continue;
|
package/coms/zimoli/once.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var oncetree = {};
|
|
3
|
+
function emit(ontype, target, handler, firstmost) {
|
|
4
|
+
var off = ontype.call(this, target, function (event) {
|
|
5
|
+
off();
|
|
6
|
+
return handler.call(this, event);
|
|
7
|
+
}, firstmost);
|
|
8
|
+
return off;
|
|
9
|
+
}
|
|
3
10
|
function _once(key) {
|
|
4
11
|
if (oncetree[key]) return oncetree[key];
|
|
5
|
-
return oncetree[key] =
|
|
6
|
-
var off = on(key).call(this, target, function (event) {
|
|
7
|
-
off();
|
|
8
|
-
return handler.call(this, event);
|
|
9
|
-
}, firstmost);
|
|
10
|
-
return off;
|
|
11
|
-
};
|
|
12
|
+
return oncetree[key] = emit.bind(null, on(key));
|
|
12
13
|
}
|
|
14
|
+
once.emit = emit;
|
|
13
15
|
function once(key, target, handler, firstmost) {
|
|
14
16
|
if (isFunction(handler) && isNode(target)) return _once(key).call(this, target, handler, firstmost);
|
|
15
17
|
return _once(key);
|