efront 3.22.2 → 3.22.3
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/coms/basic/[]map.js +1 -1
- package/coms/frame/list.less +6 -4
- package/coms/zimoli/autodragchildren.js +29 -13
- 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/render.js +11 -1
- package/coms/zimoli/scrollbar.js +5 -5
- package/coms/zimoli/table.html +15 -9
- package/coms/zimoli/table.js +183 -26
- package/coms/zimoli/table.less +50 -23
- 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/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
|
}
|
|
@@ -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,25 +20,24 @@ 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
|
|
23
|
+
var dragPositionRight = dragPosition.left + dragPosition.width;
|
|
25
24
|
previousElements.map(function (element) {
|
|
26
|
-
if (currentTime - element.moving < 100) return;
|
|
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 + 7 <= dragPositionLeft) {
|
|
30
29
|
recover(element);
|
|
31
|
-
} else {
|
|
30
|
+
} else if (delta - 7 >= dragPositionLeft) {
|
|
32
31
|
moveMargin(element, dragPosition.width);
|
|
33
32
|
}
|
|
34
33
|
});
|
|
35
|
-
var dragPositionRight = dragPosition.left + dragPosition.width;
|
|
36
34
|
followedElements.map(function (element) {
|
|
37
|
-
if (currentTime - element.moving < 100) return;
|
|
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 + 6 <= dragPositionRight) {
|
|
41
39
|
moveMargin(element, -dragPosition.width);
|
|
42
|
-
} else {
|
|
40
|
+
} else if (delta - 6 >= dragPositionRight) {
|
|
43
41
|
recover(element);
|
|
44
42
|
}
|
|
45
43
|
});
|
|
@@ -131,6 +129,18 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
131
129
|
}
|
|
132
130
|
return targets;
|
|
133
131
|
};
|
|
132
|
+
var getBoundingClientRect = function () { return getScreenPosition(this.target) }
|
|
133
|
+
var bindExtra = function (element) {
|
|
134
|
+
var targets = getTargetIn(matcher, element, false);
|
|
135
|
+
if (isArray(targets)) {
|
|
136
|
+
var [target] = targets;
|
|
137
|
+
return {
|
|
138
|
+
style: target.style, target, getBoundingClientRect,
|
|
139
|
+
with: targets
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return targets;
|
|
143
|
+
};
|
|
134
144
|
if (event.target === this) return;
|
|
135
145
|
// var targetChild = getTargetIn(matcher, event.target);
|
|
136
146
|
if (!targetChild) return;
|
|
@@ -241,10 +251,10 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
241
251
|
clearInterval(autoScroll.ing);
|
|
242
252
|
autoScroll.ing = 0;
|
|
243
253
|
};
|
|
244
|
-
var dragmove = function (event) {
|
|
254
|
+
var dragmove = lazy(function (event) {
|
|
245
255
|
rebuildTargets();
|
|
246
256
|
moveChildren.call(this, event);
|
|
247
|
-
};
|
|
257
|
+
}, -100);
|
|
248
258
|
|
|
249
259
|
// 修改margin无效的情况
|
|
250
260
|
function dragclone() {
|
|
@@ -278,6 +288,12 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
278
288
|
function draglist() {
|
|
279
289
|
draginit();
|
|
280
290
|
rebuildTargets();
|
|
291
|
+
var _previousElements = previousElements.map(bindExtra);
|
|
292
|
+
var _followedElements = followedElements.map(bindExtra);
|
|
293
|
+
previousElements.splice(0, previousElements.length);
|
|
294
|
+
followedElements.splice(0, followedElements.length);
|
|
295
|
+
previousElements.push.apply(previousElements, _previousElements);
|
|
296
|
+
followedElements.push.apply(followedElements, _followedElements);
|
|
281
297
|
autoScroll();
|
|
282
298
|
var offall = function () {
|
|
283
299
|
cancelScroll();
|
|
@@ -287,8 +303,8 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
287
303
|
var offdragend = on("dragend")(targetChild, function () {
|
|
288
304
|
offall();
|
|
289
305
|
dragfire();
|
|
290
|
-
previousElements.
|
|
291
|
-
followedElements.
|
|
306
|
+
previousElements.forEach(e => moveMargin(e, false));
|
|
307
|
+
followedElements.forEach(e => moveMargin(e, false));
|
|
292
308
|
});
|
|
293
309
|
var offdragmove = on("dragmove")(targetChild, dragmove);
|
|
294
310
|
}
|
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);
|
package/coms/zimoli/render.js
CHANGED
|
@@ -564,7 +564,17 @@ var createEmiter = function (on) {
|
|
|
564
564
|
search[0] += `with(this.$parentScopes[${scopes.length}])`;
|
|
565
565
|
getter1 = createGetter(search, false);
|
|
566
566
|
}
|
|
567
|
-
|
|
567
|
+
var onkey;
|
|
568
|
+
if (key === 'mounted' || key === 'mount') {
|
|
569
|
+
onkey = on === once ? oncemount : onmounted;
|
|
570
|
+
}
|
|
571
|
+
else if (key === 'wheel' || key === 'mousewheel') {
|
|
572
|
+
onkey = on === once ? once.emit.bind(null, onmousewheel) : onmousewheel;
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
onkey = on(key);
|
|
576
|
+
}
|
|
577
|
+
onkey(this, function (e) {
|
|
568
578
|
digest();
|
|
569
579
|
if (parsedSrc) {
|
|
570
580
|
var target = e.currentTarget || e.target;
|
package/coms/zimoli/scrollbar.js
CHANGED
|
@@ -86,7 +86,7 @@ var scrollbary = function () {
|
|
|
86
86
|
var run = function () {
|
|
87
87
|
var thumbPosition = getScreenPosition(scroller.thumb);
|
|
88
88
|
if (delta > 0 && thumbPosition.bottom - delta / 6 < scrollTimerTarget || delta < 0 && thumbPosition.top - delta / 6 > scrollTimerTarget) {
|
|
89
|
-
var targetTop = scroller
|
|
89
|
+
var targetTop = scroller.$Top() + delta;
|
|
90
90
|
var target = scroller.target;
|
|
91
91
|
scroller.scrollTo(targetTop);
|
|
92
92
|
if (target) setTargetTop(target, targetTop);
|
|
@@ -126,11 +126,11 @@ var scrollbary = function () {
|
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
var setTargetTop = function (target, top) {
|
|
129
|
-
if (target
|
|
129
|
+
if (target.$Top instanceof Function) target.$Top(top);
|
|
130
130
|
else target.scrollTop = top;
|
|
131
131
|
};
|
|
132
132
|
var getTargetTop = function (target) {
|
|
133
|
-
if (target
|
|
133
|
+
if (target.$Top instanceof Function) return target.$Top();
|
|
134
134
|
return target.scrollTop;
|
|
135
135
|
};
|
|
136
136
|
|
|
@@ -152,7 +152,7 @@ var scrollbary = function () {
|
|
|
152
152
|
_scrollbar.autoshow();
|
|
153
153
|
});
|
|
154
154
|
on("change")(_scrollbar, function () {
|
|
155
|
-
var top = _scrollbar
|
|
155
|
+
var top = _scrollbar.$Top();
|
|
156
156
|
setTargetTop(_container, top);
|
|
157
157
|
});
|
|
158
158
|
if (followResize) on("resize")(followResize, _scrollbar.reshape);
|
|
@@ -167,7 +167,7 @@ var scrollbary = function () {
|
|
|
167
167
|
_scrollbar.scrollTo = scrollTo;
|
|
168
168
|
var _handler = document.createElement("scrollbar-thumb");
|
|
169
169
|
_handler.className = "thumb";
|
|
170
|
-
_scrollbar
|
|
170
|
+
_scrollbar.$Top = getTop;
|
|
171
171
|
_scrollbar.autohide = lazy(function () {
|
|
172
172
|
this.thumb.style.opacity = 0;
|
|
173
173
|
}, 600);
|
package/coms/zimoli/table.html
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
<
|
|
2
|
-
<tr
|
|
3
|
-
<td row-index>序号</td>
|
|
4
|
-
<td -repeat="f in fields track by f.id" :style="{width:f.width}" @dblclick="sort(f)"><i
|
|
5
|
-
-class="f.icon"></i
|
|
1
|
+
<thead @mounted="setFixedColumn.call(this.parentNode)">
|
|
2
|
+
<tr inline-block #adapter thead @mounted="resizeT(this)">
|
|
3
|
+
<td fixed row-index>序号</td>
|
|
4
|
+
<td fixed:="f.fixed" -repeat="f in fields track by f.id" :style="{width:f.width}" @dblclick="sort(f)"><i
|
|
5
|
+
-if="f.icon" -class="f.icon"></i><span -if="f.name" -html="f.name"></span><template
|
|
6
|
+
-else> </template>
|
|
6
7
|
</td>
|
|
7
8
|
</tr>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
</thead>
|
|
10
|
+
<tbody -src="(d,i) in data" :style="tbodyHeight(this)">
|
|
11
|
+
<tr inline-block @mounted="this.style.width=adapter.style.width">
|
|
12
|
+
<td fixed row-index -bind="i+1" @mounted="this.style=adapter.firstChild.getAttribute('style')">
|
|
13
|
+
</td>
|
|
14
|
+
<td fixed:="f.fixed" -repeat="(f,i) in fields"
|
|
15
|
+
@mounted="this.style=adapter.children[i+1].getAttribute('style')">
|
|
16
|
+
<model -if="f.key&&!isEmpty(d[f.key])" :field=f :data=d readonly></model>
|
|
17
|
+
<template -else> </template>
|
|
12
18
|
<a on-click="o.do(d)" -if="!f.key&&f.options&&(!o.when||o.when(d))"
|
|
13
19
|
_type="o.type instanceof Function?o.type(d):o.type" -repeat="o in f.options">
|
|
14
20
|
<span -text="o.name instanceof Function?o.name(d):o.name"></span>
|