efront 3.18.2 → 3.19.1
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/api.yml +2 -0
- package/apps/pivot/link/chat.js +8 -11
- package/apps/pivot/link/index.html +2 -0
- package/apps/pivot/link/index.js +13 -0
- package/apps/pivot/link/room.html +0 -0
- package/apps/pivot/link/room.js +10 -0
- package/apps/pivot/main.js +7 -1
- package/apps/pivot/menu.yml +1 -1
- package/apps/pivot/wow/edit.js +3 -0
- package/apps/pivot/wow/root.js +33 -4
- package/coms/basic/cross_.js +8 -1
- package/coms/frame/chat.html +1 -1
- package/coms/frame/chat.js +15 -2
- package/coms/frame/chat.less +3 -3
- package/coms/frame/list.js +13 -4
- package/coms/maps/baidu.js +6 -1
- package/coms/maps/gaode.js +3 -0
- package/coms/maps/google.js +2 -2
- package/coms/maps/osm.js +1 -1
- package/coms/pivot/pedit.less +3 -0
- package/coms/pivot/plist.js +7 -1
- package/coms/random//350/272/253/344/273/275/350/257/201.js +154 -0
- package/coms/reptile/cross.js +9 -4
- package/coms/zimoli/Item.js +32 -23
- package/coms/zimoli/contextmenu.js +6 -23
- package/coms/zimoli/createItemTarget.js +8 -2
- package/coms/zimoli/drag.js +0 -1
- package/coms/zimoli/list.js +1 -1
- package/coms/zimoli/maps.js +323 -144
- package/coms/zimoli/maps.less +8 -0
- package/coms/zimoli/maps_test.html +2 -0
- package/coms/zimoli/maps_test.js +37 -28
- package/coms/zimoli/maps_test.less +4 -6
- package/coms/zimoli/menu.js +2 -2
- package/coms/zimoli/menuItem.html +1 -1
- package/coms/zimoli/menuItem.js +2 -4
- package/coms/zimoli/menuList.html +1 -1
- package/coms/zimoli/menuList.js +5 -4
- package/coms/zimoli/menuList.less +5 -0
- package/coms/zimoli/move.js +5 -23
- package/coms/zimoli/oncemount.js +1 -1
- package/coms/zimoli/onmousewheel.js +1 -0
- package/coms/zimoli/popup.js +2 -1
- package/coms/zimoli/render.js +38 -27
- package/coms/zimoli/resize.js +1 -4
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/maps_test.js
CHANGED
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
function maps_test() {
|
|
2
|
-
var
|
|
2
|
+
var config = {
|
|
3
3
|
center: [/*兰考*/114.834364, 34.82138],
|
|
4
|
-
center: [/*蒙古*/104.751074, 44.163022],
|
|
5
|
-
center: [/*西亚*/48.068813, 29.321316],
|
|
6
|
-
zoom:
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
// center: [/*蒙古*/104.751074, 44.163022],
|
|
5
|
+
// center: [/*西亚*/48.068813, 29.321316],
|
|
6
|
+
zoom: 3
|
|
7
|
+
};
|
|
8
|
+
var page = document.createElement('map-test');
|
|
9
|
+
page.innerHTML = template;
|
|
10
|
+
renderWithDefaults(page, {
|
|
11
|
+
menus: ["高德", "百度", "谷歌", "OSM", { name: "Default", actived: true }].map(a => isObject(a) ? a : { name: a }),
|
|
12
|
+
menu,
|
|
13
|
+
maps: [
|
|
14
|
+
maps$gaode,
|
|
15
|
+
maps$baidu,
|
|
16
|
+
maps$google,
|
|
17
|
+
maps$osm,
|
|
18
|
+
],
|
|
19
|
+
actived: null,
|
|
20
|
+
locat(event) {
|
|
21
|
+
var map = this.map;
|
|
22
|
+
var layerx = event.offsetX || event.layerX || 0;
|
|
23
|
+
var layery = event.offsetY || event.layerY || 0;
|
|
24
|
+
var [lng, lat] = map.location(layerx, layery);
|
|
25
|
+
alert(`${lng},${lat}`);
|
|
26
|
+
},
|
|
27
|
+
open(m) {
|
|
28
|
+
console.log(m, this.actived)
|
|
29
|
+
for (var k in this.actived) {
|
|
30
|
+
delete this.mp.map[k];
|
|
21
31
|
}
|
|
22
|
-
extend(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
extend(this.mp.map, m, { cache: [] });
|
|
33
|
+
this.mp.map.refresh();
|
|
34
|
+
console.log(this.mp.map)
|
|
35
|
+
this.actived = m;
|
|
36
|
+
},
|
|
37
|
+
map() {
|
|
38
|
+
return new maps(config);
|
|
39
|
+
},
|
|
30
40
|
});
|
|
31
|
-
|
|
32
|
-
return option(group(buttons), map, 8);
|
|
41
|
+
return page;
|
|
33
42
|
}
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
background-position: 0 0, @background-size/2 @background-size/2;
|
|
8
8
|
height: 200px;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
.button {
|
|
14
|
-
height: 40px;
|
|
10
|
+
|
|
11
|
+
canvas {
|
|
15
12
|
width: 100%;
|
|
16
|
-
|
|
13
|
+
height: 100%;
|
|
14
|
+
background-color: #035;
|
|
17
15
|
}
|
package/coms/zimoli/menu.js
CHANGED
|
@@ -153,7 +153,7 @@ function main(elem, mode) {
|
|
|
153
153
|
tree(elem, function (index, item, menu) {
|
|
154
154
|
var e = generator(index, item);
|
|
155
155
|
if (!e || e.children.length) return e;
|
|
156
|
-
var m = menuItem(
|
|
156
|
+
var m = menuItem(null, menu, elem.useIcon);
|
|
157
157
|
return m;
|
|
158
158
|
});
|
|
159
159
|
care(elem, function (data) {
|
|
@@ -196,7 +196,7 @@ function main(elem, mode) {
|
|
|
196
196
|
case "vertical":
|
|
197
197
|
if (!direction) mode = "vertical", direction = 'y';
|
|
198
198
|
var emit = function (item, target) {
|
|
199
|
-
active(elem, item
|
|
199
|
+
active(elem, item, null, elem.$src ? createItemTarget.call(elem, item, target) : target);
|
|
200
200
|
};
|
|
201
201
|
if ("$src" in elem) {
|
|
202
202
|
getGenerator(elem, 'menu-item');
|
package/coms/zimoli/menuItem.js
CHANGED
|
@@ -8,16 +8,14 @@ function main(elem, scope, hasIcon) {
|
|
|
8
8
|
var scope = item.$scope;
|
|
9
9
|
}
|
|
10
10
|
if (scope.menu) scope = scope.menu;
|
|
11
|
-
|
|
12
|
-
var icon = scope.icon;
|
|
13
|
-
if (hasIcon === undefined) hasIcon = !!icon;
|
|
11
|
+
if (hasIcon === undefined) hasIcon = !!scope.icon;
|
|
14
12
|
if (scope.disabled || scope.enabled === false) {
|
|
15
13
|
item.setAttribute('disabled', '');
|
|
16
14
|
}
|
|
17
15
|
else {
|
|
18
16
|
item.removeAttribute("disabled");
|
|
19
17
|
}
|
|
20
|
-
render(item.children, scope, hasIcon instanceof Array ? hasIcon : [{ useIcon: hasIcon, hasIcon
|
|
18
|
+
render(item.children, scope, hasIcon instanceof Array ? hasIcon : [{ useIcon: hasIcon, hasIcon }]);
|
|
21
19
|
if (scope.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
|
|
22
20
|
if (scope.hotkey) bindAccesskey(item, scope.hotkey);
|
|
23
21
|
return item;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)" ng-mouseleave="cancel()"
|
|
2
2
|
ng-mouseenter="popMenu.call(this)" ng-mousedown="popMenu1.call(this,event)" ng-class="{'has-children':menu.children&&menu.children.length,
|
|
3
|
-
'warn':menu.
|
|
3
|
+
'warn':menu.warn,
|
|
4
4
|
'actived':menu.isActived()
|
|
5
5
|
}">
|
|
6
6
|
</menu-item>
|
package/coms/zimoli/menuList.js
CHANGED
|
@@ -226,12 +226,12 @@ function main(page, items, active, direction = 'y') {
|
|
|
226
226
|
clear();
|
|
227
227
|
clearTimeout(popTimer);
|
|
228
228
|
}
|
|
229
|
-
var fire = function () {
|
|
229
|
+
var fire = async function () {
|
|
230
230
|
cancel();
|
|
231
231
|
if (this.menu.line) return;
|
|
232
232
|
if (byMousedown) return;
|
|
233
233
|
if (this.hasAttribute("disabled") || this.hasAttribute('line')) return;
|
|
234
|
-
var pop = active(this.menu, this);
|
|
234
|
+
var pop = active(this.menu.value, this);
|
|
235
235
|
if (pop === false) return;
|
|
236
236
|
var root = page.root || page;
|
|
237
237
|
if (root.direction === 't' || root.selected) {
|
|
@@ -297,7 +297,6 @@ function main(page, items, active, direction = 'y') {
|
|
|
297
297
|
a.menu = s;
|
|
298
298
|
return a;
|
|
299
299
|
},
|
|
300
|
-
menus: items,
|
|
301
300
|
hasIcon: hasIcon(),
|
|
302
301
|
open: fire,
|
|
303
302
|
cancel,
|
|
@@ -308,7 +307,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
308
307
|
var src = page.$src;
|
|
309
308
|
var itemName = src.itemName;
|
|
310
309
|
var className = `{'has-children':${itemName}.children&&${itemName}.children.length,
|
|
311
|
-
'warn':${itemName}.
|
|
310
|
+
'warn':${itemName}.warn,
|
|
312
311
|
actived:${itemName}.isActived()
|
|
313
312
|
}`;
|
|
314
313
|
var notHidden = `!${itemName}.hidden`;
|
|
@@ -316,6 +315,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
316
315
|
list(page, function (index) {
|
|
317
316
|
var item = items[index];
|
|
318
317
|
if (!item) return;
|
|
318
|
+
if (!(item instanceof Item)) item = new Item(item);
|
|
319
319
|
var a = $scope["menu-item"](null, item);
|
|
320
320
|
if (src.itemName) a.setAttribute("e-if", notHidden);
|
|
321
321
|
a.setAttribute("e-class", className);
|
|
@@ -334,6 +334,7 @@ function main(page, items, active, direction = 'y') {
|
|
|
334
334
|
}
|
|
335
335
|
else {
|
|
336
336
|
page.innerHTML = menuList;
|
|
337
|
+
$scope.menus = items.map(i => i instanceof Item ? i : new Item(i));
|
|
337
338
|
render(page, $scope);
|
|
338
339
|
vbox(page);
|
|
339
340
|
}
|
package/coms/zimoli/move.js
CHANGED
|
@@ -152,30 +152,12 @@ var fixPosition = move.fixPosition = function (target) {
|
|
|
152
152
|
};
|
|
153
153
|
move.coordIn = coordIn;
|
|
154
154
|
move.trimCoord = trimCoord;
|
|
155
|
-
var
|
|
156
|
-
|
|
157
|
-
resizingTargets.forEach(fixPosition);
|
|
158
|
-
});
|
|
159
|
-
var off;
|
|
160
|
-
var resizeTarget = function () {
|
|
161
|
-
var target = this;
|
|
162
|
-
var index = resizingTargets.indexOf(target);
|
|
163
|
-
if (index < 0) index = resizingTargets.push(target);
|
|
164
|
-
return index;
|
|
155
|
+
var fixTarget = function () {
|
|
156
|
+
fixPosition(this);
|
|
165
157
|
};
|
|
166
|
-
var removeResize = function () {
|
|
167
|
-
removeFromList(resizingTargets, this);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
158
|
move.bindPosition = function (target, position) {
|
|
171
|
-
|
|
159
|
+
oncemount(target, function () {
|
|
172
160
|
setPosition(target, position);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (index >= 0) return;
|
|
176
|
-
on("append")(target, resizeTarget);
|
|
177
|
-
on("remove")(target, removeResize);
|
|
178
|
-
if (isMounted(target)) {
|
|
179
|
-
resizeTarget.call(target);
|
|
180
|
-
}
|
|
161
|
+
});
|
|
162
|
+
on("resize")(target, fixTarget);
|
|
181
163
|
}
|
package/coms/zimoli/oncemount.js
CHANGED
package/coms/zimoli/popup.js
CHANGED
|
@@ -395,4 +395,5 @@ var global = function (element, issingle) {
|
|
|
395
395
|
};
|
|
396
396
|
var popup_as_yextra = _as_yextra.bind(null, global, innerWidth, innerHeight);
|
|
397
397
|
var popup_as_xextra = _as_xextra.bind(null, global, innerHeight, innerWidth);
|
|
398
|
-
var cleanup = new Cleanup(rootElements);
|
|
398
|
+
var cleanup = new Cleanup(rootElements);
|
|
399
|
+
popup.style = animationStyle;
|
package/coms/zimoli/render.js
CHANGED
|
@@ -90,6 +90,8 @@ var createGetter = function (search, isprop = true) {
|
|
|
90
90
|
var initialComment = function (renders, type, expression) {
|
|
91
91
|
var comment = document.createComment(`${type} ${expression}`);
|
|
92
92
|
comment.renders = renders;
|
|
93
|
+
comment.$scope = this.$scope;
|
|
94
|
+
comment.$parentScopes = this.$parentScopes;
|
|
93
95
|
appendChild.after(this, comment);
|
|
94
96
|
if (!/if/i.test(type)) remove(this);
|
|
95
97
|
if (!this.$struct.once) {
|
|
@@ -188,11 +190,9 @@ var createRepeat = function (search, id = 0) {
|
|
|
188
190
|
var clone = element.cloneNode();
|
|
189
191
|
clone.innerHTML = element.innerHTML;
|
|
190
192
|
clone.renderid = id;
|
|
191
|
-
clone.$parentScopes = $parentScopes;
|
|
192
193
|
clone.$scope = $scope;
|
|
193
194
|
clone.$parentScopes = $parentScopes;
|
|
194
195
|
clone.$struct = $struct;
|
|
195
|
-
clone = render(clone, $scope, clone.$parentScopes);
|
|
196
196
|
clonedElements1[k] = clone;
|
|
197
197
|
return clone;
|
|
198
198
|
}, this);
|
|
@@ -201,6 +201,7 @@ var createRepeat = function (search, id = 0) {
|
|
|
201
201
|
if (a.previousSibling !== last) appendChild.after(last, a);
|
|
202
202
|
last = a;
|
|
203
203
|
}, this);
|
|
204
|
+
cloned.forEach(a => render(a));
|
|
204
205
|
for (var k in clonedElements) {
|
|
205
206
|
if (clonedElements1[k] !== clonedElements[k]) remove(clonedElements[k]);
|
|
206
207
|
}
|
|
@@ -212,27 +213,40 @@ var createRepeat = function (search, id = 0) {
|
|
|
212
213
|
once("append")(this, initialComment.bind(this, renders, "repeat", expression));
|
|
213
214
|
}
|
|
214
215
|
};
|
|
216
|
+
var comment = function (elements) {
|
|
217
|
+
for (var cx = elements.length - 2; cx > 1; cx -= 2) {
|
|
218
|
+
var e = elements[cx];
|
|
219
|
+
if (e.previousSibling === this) var c = this;
|
|
220
|
+
else {
|
|
221
|
+
var c = document.createComment('else' + (cx < elements.length - 2 ? "if .." : ''));
|
|
222
|
+
e.parentNode.insertBefore(c, e);
|
|
223
|
+
}
|
|
224
|
+
elements.splice(cx, 0, c);
|
|
225
|
+
remove(e);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
var initIf = function (ifs) {
|
|
229
|
+
for (var s of ifs) {
|
|
230
|
+
comment(s);
|
|
231
|
+
if (s.parent) {
|
|
232
|
+
initialComment.call(s[0], s.renders, "if", s.comment);
|
|
233
|
+
} else {
|
|
234
|
+
once("append")(s[0], initialComment.bind(s[0], s.renders, "if", s.comment));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
215
238
|
var createIf = function (search, id = 0) {
|
|
216
239
|
// 懒渲染
|
|
217
240
|
var getter = createGetter(search).bind(this);
|
|
218
241
|
var element = this;
|
|
219
|
-
var p = element;
|
|
220
|
-
if (p.parentNode) {
|
|
221
|
-
p = p.parentNode;
|
|
222
|
-
for (var cx = 0, dx = if_top.length; cx < dx; cx++) {
|
|
223
|
-
if (if_top[cx].parent === p) {
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
cx++;
|
|
229
|
-
if (cx > 0) if_top.splice(cx, if_top.length - cx);
|
|
230
242
|
var elements = [element, getter];
|
|
231
243
|
if_top.push(elements);
|
|
232
244
|
var savedValue;
|
|
233
|
-
|
|
245
|
+
elements.parent = this.parentNode;
|
|
246
|
+
elements.comment = search[1];
|
|
247
|
+
elements.renders = [function () {
|
|
234
248
|
var shouldMount = -1;
|
|
235
|
-
for (var cx = 0, dx = elements.length; cx < dx; cx +=
|
|
249
|
+
for (var cx = 0, dx = elements.length; cx < dx; cx += 3) {
|
|
236
250
|
var getter = elements[cx + 1];
|
|
237
251
|
if (!getter || getter()) {
|
|
238
252
|
shouldMount = cx;
|
|
@@ -241,10 +255,10 @@ var createIf = function (search, id = 0) {
|
|
|
241
255
|
}
|
|
242
256
|
if (savedValue === shouldMount) return;
|
|
243
257
|
savedValue = shouldMount;
|
|
244
|
-
for (var cx = 0, dx = elements.length; cx < dx; cx +=
|
|
258
|
+
for (var cx = 0, dx = elements.length; cx < dx; cx += 3) {
|
|
245
259
|
var element = elements[cx];
|
|
246
260
|
if (cx === shouldMount) {
|
|
247
|
-
appendChild.
|
|
261
|
+
appendChild.after(cx > 0 ? elements[cx - 1] : this, element);
|
|
248
262
|
if (element.renderid < 0) {
|
|
249
263
|
element.renderid = id;
|
|
250
264
|
elements[cx] = render(element, this.$scope, this.$parentScopes);
|
|
@@ -256,12 +270,6 @@ var createIf = function (search, id = 0) {
|
|
|
256
270
|
}
|
|
257
271
|
|
|
258
272
|
}];
|
|
259
|
-
if (this.parentNode) {
|
|
260
|
-
elements.parent = this.parentNode;
|
|
261
|
-
initialComment.call(this, renders, "if", search[1]);
|
|
262
|
-
} else {
|
|
263
|
-
once("append")(this, initialComment.bind(this, renders, "if", search[1]));
|
|
264
|
-
}
|
|
265
273
|
};
|
|
266
274
|
var parseIfWithRepeat = function (ifExpression, repeatExpression) {
|
|
267
275
|
var repeater = parseRepeat(repeatExpression);
|
|
@@ -355,15 +363,18 @@ var structures = {
|
|
|
355
363
|
createIf.call(this, search);
|
|
356
364
|
},
|
|
357
365
|
"else"(search) {
|
|
358
|
-
var
|
|
359
|
-
|
|
366
|
+
for (var cx = if_top.length - 1; cx >= 0; cx--) {
|
|
367
|
+
if (if_top[cx].parent === this.parentNode) break;
|
|
368
|
+
}
|
|
369
|
+
if (cx < 0) {
|
|
360
370
|
throw new Error("else/elseif前缺少同级if!");
|
|
361
371
|
}
|
|
372
|
+
initIf(if_top.splice(cx + 1, if_top.length - cx - 1));
|
|
373
|
+
var top = if_top[cx];
|
|
362
374
|
if (search && search[1]) {
|
|
363
375
|
var getter = createGetter(search).bind(this);
|
|
364
376
|
}
|
|
365
377
|
top.push(this, getter);
|
|
366
|
-
remove(this);
|
|
367
378
|
},
|
|
368
379
|
repeat(search) {
|
|
369
380
|
createRepeat.call(this, search);
|
|
@@ -852,7 +863,7 @@ function render(element, scope, parentScopes, lazy = true) {
|
|
|
852
863
|
renderlock = false;
|
|
853
864
|
eagermount = false;
|
|
854
865
|
}
|
|
855
|
-
if (if_top_length < if_top.length) if_top.splice(if_top_length, if_top.length - if_top_length);
|
|
866
|
+
if (if_top_length < if_top.length) initIf(if_top.splice(if_top_length, if_top.length - if_top_length));
|
|
856
867
|
return e;
|
|
857
868
|
}
|
|
858
869
|
var digest = lazy(refresh, -{});
|
package/coms/zimoli/resize.js
CHANGED
|
@@ -121,11 +121,8 @@ var handle = {
|
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
123
|
var rect = dragging.rect;
|
|
124
|
-
move.call(rect, isFinite(style.left) ? style.left : rect.offsetLeft, isFinite(style.top) ? style.top : rect.offsetTop);
|
|
125
|
-
delete style.left;
|
|
126
|
-
delete style.top;
|
|
127
|
-
Object.keys(style).forEach(k => style[k] = fromOffset(style[k]));
|
|
128
124
|
css(dragging.rect, style);
|
|
125
|
+
move.call(rect, isFinite(style.left) ? style.left : rect.offsetLeft, isFinite(style.top) ? style.top : rect.offsetTop);
|
|
129
126
|
dispatch(dragging.rect, 'resize');
|
|
130
127
|
resizingList.forEach(a => {
|
|
131
128
|
if (getTargetIn(dragging.rect, a)) {
|