efront 4.22.13 → 4.22.14
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/zimoli/appendChild.js +1 -0
- package/coms/zimoli/list.js +5 -3
- package/coms/zimoli/render.js +34 -35
- package/package.json +1 -1
- package/public/efront.js +1 -1
|
@@ -110,6 +110,7 @@ var wrapTargetMethod = function (target, methodName) {
|
|
|
110
110
|
};
|
|
111
111
|
newMethod.wrapped = true;
|
|
112
112
|
};
|
|
113
|
+
appendChild.dispatch = _onappend;
|
|
113
114
|
appendChild.wrapTarget = function (target) {
|
|
114
115
|
wrapTargetMethod(target, 'insertBefore');
|
|
115
116
|
wrapTargetMethod(target, 'appendChild');
|
package/coms/zimoli/list.js
CHANGED
|
@@ -51,7 +51,7 @@ function ylist(container, generator, $Y) {
|
|
|
51
51
|
}
|
|
52
52
|
return null;
|
|
53
53
|
};
|
|
54
|
-
var isSticky = child =>
|
|
54
|
+
var isSticky = child => isElement(child) && /^(sticky|fixed|absolute)$/.test(getComputedStyle(child).position);
|
|
55
55
|
var getFirstVisibleElement = function (deltaY) {
|
|
56
56
|
var children = list.childNodes;
|
|
57
57
|
var { scrollTop } = list;
|
|
@@ -60,8 +60,9 @@ function ylist(container, generator, $Y) {
|
|
|
60
60
|
if (deltaY) scrollTop += deltaY;
|
|
61
61
|
for (var cx = 0, dx = children.length; cx < dx; cx++) {
|
|
62
62
|
var child = children[cx];
|
|
63
|
-
if (!isFinite(child.index) || child.index === null
|
|
63
|
+
if (!isFinite(child.index) || child.index === null) continue;
|
|
64
64
|
var c = getNodeTarget(child);
|
|
65
|
+
if (isSticky(c)) continue;
|
|
65
66
|
if (c.offsetTop + c.offsetHeight >= scrollTop + 1) return deltaY === 0 ? child : c;
|
|
66
67
|
}
|
|
67
68
|
return null;
|
|
@@ -108,8 +109,9 @@ function ylist(container, generator, $Y) {
|
|
|
108
109
|
var children = list.children;
|
|
109
110
|
for (var cx = children.length - 1; cx >= 0; cx--) {
|
|
110
111
|
var child = children[cx];
|
|
111
|
-
if (!isFinite(child.index)
|
|
112
|
+
if (!isFinite(child.index)) continue;
|
|
112
113
|
var c = getNodeTarget(child);
|
|
114
|
+
if (isSticky(c)) continue;
|
|
113
115
|
if (c.offsetTop + 1 <= scrollTop + list.clientHeight - paddingBottom) {
|
|
114
116
|
return deltaY === 0 ? child : c;
|
|
115
117
|
}
|
package/coms/zimoli/render.js
CHANGED
|
@@ -60,11 +60,10 @@ var renderidClosed = 0;
|
|
|
60
60
|
var addRenderElement = function () {
|
|
61
61
|
var element = this;
|
|
62
62
|
if (!isNode(element)) return;
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
buildFirst(element);
|
|
64
|
+
if (element.$renderid > 10) {
|
|
65
65
|
renderElements[element.$renderid] = element;
|
|
66
66
|
}
|
|
67
|
-
buildFirst(element);
|
|
68
67
|
};
|
|
69
68
|
var removeRenderElement = function () {
|
|
70
69
|
var element = this;
|
|
@@ -337,11 +336,6 @@ var createRepeat = function (search, id = 0) {
|
|
|
337
336
|
initialComment(comment);
|
|
338
337
|
return comment;
|
|
339
338
|
};
|
|
340
|
-
var initIfs = function (ifs) {
|
|
341
|
-
for (var s of ifs) {
|
|
342
|
-
initialComment(s[0]);
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
339
|
|
|
346
340
|
var ifget = function () {
|
|
347
341
|
var elements = this.$elements;
|
|
@@ -384,6 +378,7 @@ var createIf = function (search, id = 0) {
|
|
|
384
378
|
var comment = elements[0] = createComment.call(element, [new Binder2(ifget, ifset)], 'if', search);
|
|
385
379
|
comment.$id = id;
|
|
386
380
|
comment.$elements = elements;
|
|
381
|
+
initialComment(comment);
|
|
387
382
|
return comment;
|
|
388
383
|
};
|
|
389
384
|
var parseIfWithRepeat = function (ifExpression, repeatExpression) {
|
|
@@ -495,7 +490,7 @@ var structures = {
|
|
|
495
490
|
if (cx < 0) {
|
|
496
491
|
throw new Error(i18n`else/elseif前缺少同级if!`);
|
|
497
492
|
}
|
|
498
|
-
if (cx + 1 < if_top.length)
|
|
493
|
+
if (cx + 1 < if_top.length) if_top.splice(cx + 1, if_top.length - cx - 1);
|
|
499
494
|
var top = if_top[cx];
|
|
500
495
|
if (search) var getter = createGetter(this, search);
|
|
501
496
|
var comment = createComment.call(this, undefined, search ? 'elseif' : 'else', search);
|
|
@@ -838,7 +833,7 @@ function renderProp(elem, props) {
|
|
|
838
833
|
}
|
|
839
834
|
}
|
|
840
835
|
|
|
841
|
-
function renderBinds(element, binds
|
|
836
|
+
function renderBinds(element, binds) {
|
|
842
837
|
var bind = binders._;
|
|
843
838
|
for (var k in binds) {
|
|
844
839
|
if (directives.hasOwnProperty(k)) continue;
|
|
@@ -886,7 +881,7 @@ function renderArray(children, scope, parentScopes, once) {
|
|
|
886
881
|
children[cx] = renderElement(children[cx], scope, parentScopes, once);
|
|
887
882
|
}
|
|
888
883
|
if (if_top_length < if_top.length) {
|
|
889
|
-
|
|
884
|
+
if_top.splice(if_top_length, if_top.length - if_top_length);
|
|
890
885
|
}
|
|
891
886
|
};
|
|
892
887
|
return children;
|
|
@@ -915,7 +910,6 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
915
910
|
throw new Error(i18n`父作用域链的长度必须相等着`);
|
|
916
911
|
}
|
|
917
912
|
}
|
|
918
|
-
element.$parentScopes = parentScopes || [];
|
|
919
913
|
var s = createStructure(element);
|
|
920
914
|
element.$struct = s;
|
|
921
915
|
mountElementIds(element, s.ids);
|
|
@@ -923,14 +917,16 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
923
917
|
element.$eval = $eval;
|
|
924
918
|
}
|
|
925
919
|
element.$scope = scope;
|
|
920
|
+
element.$parentScopes = parentScopes || [];
|
|
926
921
|
if (element.$renderid <= -1) element = renderStructure(element);
|
|
927
922
|
if (!element) return;
|
|
928
923
|
if (element.$renderid < 0 || element.nodeType !== 1) {
|
|
929
924
|
return element;
|
|
930
925
|
}
|
|
931
926
|
var isFirstRender = !element.$renderid;
|
|
932
|
-
|
|
933
927
|
if (isFirstRender) {
|
|
928
|
+
var lockid = renderlock.length;
|
|
929
|
+
renderlock[lockid] = null;
|
|
934
930
|
element.$renderid = 1;
|
|
935
931
|
var parentNode = element.parentNode;
|
|
936
932
|
if (parentNode) {
|
|
@@ -960,7 +956,6 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
960
956
|
if (!replacer.$scope) replacer.$scope = scope;
|
|
961
957
|
if (!replacer.$parentScopes) replacer.$parentScopes = parentScopes;
|
|
962
958
|
createStructure(replacer);
|
|
963
|
-
renderArray(getChildren(replacer), replacer.$scope, replacer.$parentScopes, once);
|
|
964
959
|
renderRest(replacer, replacer.$struct);
|
|
965
960
|
}
|
|
966
961
|
copyAttribute(replacer, copys);
|
|
@@ -973,9 +968,6 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
973
968
|
}
|
|
974
969
|
}
|
|
975
970
|
}
|
|
976
|
-
}
|
|
977
|
-
if (!replacer || element === replacer) renderArray(getChildren(element), scope, parentScopes, once);
|
|
978
|
-
if (isFirstRender) {
|
|
979
971
|
renderRest(element, $struct, replacer);
|
|
980
972
|
if (isNode(replacer) && replacer !== element) {
|
|
981
973
|
if (!replacer.$renders) replacer.$renders = [];
|
|
@@ -984,9 +976,11 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
|
|
|
984
976
|
}
|
|
985
977
|
if (element.$digest || element.$renders.length) {
|
|
986
978
|
element.$ready = true;
|
|
987
|
-
renderlock
|
|
979
|
+
renderlock[lockid] = element;
|
|
988
980
|
}
|
|
981
|
+
else if (renderlock.length === lockid) renderlock.pop();
|
|
989
982
|
}
|
|
983
|
+
renderArray(getChildren(element), element.$scope || scope, element.$parentScopes || parentScopes, once);
|
|
990
984
|
return element;
|
|
991
985
|
}
|
|
992
986
|
var deepcontexts = [];
|
|
@@ -1228,40 +1222,45 @@ function createStructure(element, useExists) {
|
|
|
1228
1222
|
element.$eval = $eval;
|
|
1229
1223
|
return element.$struct = new Struct(ons, types, copys, binds, attr1, props, ids, once);
|
|
1230
1224
|
}
|
|
1231
|
-
function
|
|
1232
|
-
|
|
1225
|
+
function unlock(element) {
|
|
1226
|
+
if (!element) return;
|
|
1227
|
+
if (element.$renderid !== 9) {
|
|
1228
|
+
element.$renderid = ++renderidOffset;
|
|
1229
|
+
on("append")(element, addRenderElement);
|
|
1230
|
+
onremove(element, removeRenderElement);
|
|
1231
|
+
if (element.nodeType === 8);
|
|
1232
|
+
else if (eagermount) buildFirst(element);
|
|
1233
|
+
}
|
|
1234
|
+
else {
|
|
1235
|
+
buildFirst(element);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function renderUnlock(element) {
|
|
1239
|
+
var locked = renderlock;
|
|
1233
1240
|
renderlock = null;
|
|
1234
|
-
locked.forEach(
|
|
1235
|
-
if (element.$renderid !== 9) {
|
|
1236
|
-
element.$renderid = ++renderidOffset;
|
|
1237
|
-
on("append")(element, addRenderElement);
|
|
1238
|
-
onremove(element, removeRenderElement);
|
|
1239
|
-
if (isMounted(element) || element.nodeType === 8);
|
|
1240
|
-
else if (eagermount) buildFirst(element);
|
|
1241
|
-
}
|
|
1242
|
-
else {
|
|
1243
|
-
buildFirst(element);
|
|
1244
|
-
}
|
|
1245
|
-
});
|
|
1241
|
+
locked.forEach(unlock);
|
|
1246
1242
|
eagermount = false;
|
|
1243
|
+
var parentNode = element.parentNode;
|
|
1244
|
+
if (parentNode && isMounted(parentNode)) appendChild.dispatch(element);
|
|
1247
1245
|
}
|
|
1248
|
-
function renderLock() {
|
|
1246
|
+
function renderLock(element) {
|
|
1249
1247
|
if (!renderlock) {
|
|
1250
1248
|
renderlock = [];
|
|
1249
|
+
element.$mounted = false;
|
|
1251
1250
|
return true;
|
|
1252
1251
|
}
|
|
1253
1252
|
return false;
|
|
1254
1253
|
}
|
|
1255
1254
|
var eagermount = false, renderlock = null;
|
|
1256
1255
|
function render(element, scope, parentScopes, lazy = true) {
|
|
1257
|
-
var haslock = renderLock();
|
|
1256
|
+
var haslock = renderLock(element);
|
|
1258
1257
|
var if_top_length = if_top.length;
|
|
1259
1258
|
if (isFinite(scope) && arguments.length === 2) lazy = scope, scope = undefined;
|
|
1260
1259
|
else if (isFinite(parentScopes) && arguments.length === 3) lazy = parentScopes, parentScopes = undefined;
|
|
1261
1260
|
var renderonce = lazy === 0;
|
|
1262
1261
|
if (haslock) eagermount = !+lazy;
|
|
1263
1262
|
var e = renderElement(element, scope, parentScopes, renderonce);
|
|
1264
|
-
if (if_top_length < if_top.length)
|
|
1263
|
+
if (if_top_length < if_top.length) if_top.splice(if_top_length, if_top.length - if_top_length);
|
|
1265
1264
|
if (haslock) renderUnlock(element);
|
|
1266
1265
|
if (haslock) callDigest();
|
|
1267
1266
|
return e;
|