efront 4.22.19 → 4.23.0
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/#/345/233/275/351/231/205/345/214/226.yml +6 -0
- package/apps/kugou/search/search.js +4 -3
- package/apps/noice/main.js +1 -1
- package/apps/pivot/auth/login.js +4 -4
- package/apps/pivot/dht/list.js +5 -5
- package/apps/pivot/link/chat.js +1 -1
- package/apps/pivot/link/index.js +1 -1
- package/apps/pivot/link/list.js +5 -4
- package/apps/pivot/share/list.js +6 -5
- package/apps/pivot/wow/root.js +3 -2
- package/coms/basic/LoadingArray.js +1 -0
- package/coms/basic/cross_.js +4 -1
- package/coms/basic/data.js +16 -13
- package/coms/basic_/WeakMap.js +23 -0
- package/coms/compile/Javascript.js +2 -1
- package/coms/explorer/context.js +10 -7
- package/coms/explorer/edit.js +1 -1
- package/coms/explorer/fileitem.js +9 -7
- package/coms/explorer/main.js +20 -17
- package/coms/frame/chat.js +17 -16
- package/coms/frame/list.js +6 -5
- package/coms/kugou/bindScroll.js +0 -1
- package/coms/kugou/buildScroll.js +5 -4
- package/coms/kugou/krc.js +2 -2
- package/coms/kugou/player.js +2 -2
- package/coms/kugou/song.js +1 -1
- package/coms/layer/leftCenter.js +5 -5
- package/coms/pivot/checkGeo.js +0 -1
- package/coms/zimoli/$eval.js +1 -0
- package/coms/zimoli/$mounted.js +1 -0
- package/coms/zimoli/$parented.js +1 -0
- package/coms/zimoli/$renders.js +1 -0
- package/coms/zimoli/$scoped.js +1 -0
- package/coms/zimoli/$structed.js +1 -0
- package/coms/zimoli/HexEditor.js +1 -1
- package/coms/zimoli/appendChild.js +2 -2
- package/coms/zimoli/autodragchildren_test.js +1 -1
- package/coms/zimoli/checkbox.js +1 -1
- package/coms/zimoli/container.js +4 -3
- package/coms/zimoli/createItemTarget.js +10 -6
- package/coms/zimoli/cross.js +1 -1
- package/coms/zimoli/field.js +3 -3
- package/coms/zimoli/gallery_test.js +4 -3
- package/coms/zimoli/getArgsChildren.js +1 -1
- package/coms/zimoli/getGenerator.js +36 -28
- package/coms/zimoli/grid.js +2 -2
- package/coms/zimoli/isMounted.js +6 -3
- package/coms/zimoli/lattice.js +2 -4
- package/coms/zimoli/maps.js +1 -2
- package/coms/zimoli/menu.js +1 -0
- package/coms/zimoli/menuItem.js +4 -3
- package/coms/zimoli/menuList.js +8 -8
- package/coms/zimoli/menu_test.js +4 -3
- package/coms/zimoli/model.js +8 -6
- package/coms/zimoli/on.js +28 -20
- package/coms/zimoli/picture.js +0 -7
- package/coms/zimoli/radio.js +1 -1
- package/coms/zimoli/remove.js +3 -3
- package/coms/zimoli/render.js +193 -99
- package/coms/zimoli/scrollbar.js +90 -42
- package/coms/zimoli/scrollbar.less +5 -3
- package/coms/zimoli/select.js +3 -3
- package/coms/zimoli/selectList.js +1 -1
- package/coms/zimoli/selectListEdit.js +5 -4
- package/coms/zimoli/table.html +6 -4
- package/coms/zimoli/table.js +82 -41
- package/coms/zimoli/table.less +22 -0
- package/coms/zimoli/vbox.less +2 -2
- package/coms/zimoli/zimoli.js +6 -5
- package/docs/version-desc.md +3 -1
- package/docs//347/211/210/346/234/254/350/257/264/346/230/216.md +3 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/scrollbar.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
var scrollbary = function () {
|
|
2
2
|
var reshape = function (scrollHeight, offsetHeight) {
|
|
3
3
|
var target = this.target;
|
|
4
|
+
var targetHeight = target.offsetHeight;
|
|
5
|
+
var targetTop = target.offsetTop;
|
|
6
|
+
var restHeight = scrollHeight - offsetHeight;
|
|
7
|
+
if (targetHeight === this.targetHeight && targetTop === this.targetTop && restHeight === this.restHeight) return;
|
|
4
8
|
if (target) {
|
|
5
|
-
|
|
9
|
+
if (targetHeight !== this.targetHeight || targetTop !== this.targetTop)
|
|
10
|
+
css(this, { height: targetHeight, top: targetTop });
|
|
6
11
|
}
|
|
7
12
|
var scrollbarHeight = this.offsetHeight;
|
|
8
13
|
var ratio = offsetHeight / scrollHeight;
|
|
9
14
|
var thumbHeight = scrollbarHeight * ratio;
|
|
10
|
-
if (thumbHeight <
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
15
|
+
if (thumbHeight < 36) thumbHeight = 36;
|
|
16
|
+
this.targetHeight = targetHeight;
|
|
17
|
+
this.targetTop = targetTop;
|
|
18
|
+
this.restHeight = restHeight;
|
|
19
|
+
if (thumbHeight !== this.thumb.height) css(this.thumb, {
|
|
14
20
|
height: thumbHeight
|
|
15
21
|
});
|
|
22
|
+
this.thumb.height = thumbHeight;
|
|
16
23
|
if (thumbHeight >= this.clientHeight) {
|
|
17
24
|
this.style.opacity = 0;
|
|
18
25
|
} else {
|
|
@@ -21,19 +28,25 @@ var scrollbary = function () {
|
|
|
21
28
|
}
|
|
22
29
|
};
|
|
23
30
|
var getTop = function () {
|
|
24
|
-
var availableHeight = this.
|
|
31
|
+
var availableHeight = this.clientHeight - this.thumb.offsetHeight | 0;
|
|
25
32
|
if (!availableHeight) return 0;
|
|
26
|
-
|
|
33
|
+
if (availableHeight < 1) {
|
|
34
|
+
availableHeight = 0;
|
|
35
|
+
}
|
|
36
|
+
var offsetTop = this.thumb.offsetTop;
|
|
37
|
+
if (offsetTop < 1) offsetTop = 0;
|
|
38
|
+
if (offsetTop > availableHeight - 1) offsetTop = availableHeight;
|
|
39
|
+
return offsetTop / availableHeight * this.restHeight;
|
|
27
40
|
};
|
|
28
41
|
|
|
29
42
|
var scrollTo = function (scrollTop) {
|
|
30
43
|
var thumb = this.thumb;
|
|
31
|
-
var deltaHeight = this.
|
|
44
|
+
var deltaHeight = this.clientHeight - thumb.offsetHeight;
|
|
32
45
|
if (deltaHeight > 0) {
|
|
33
46
|
var ratio = scrollTop / this.restHeight;
|
|
34
47
|
var targetTop = +(ratio * deltaHeight).toFixed(4);
|
|
35
|
-
if (targetTop > deltaHeight) targetTop = deltaHeight;
|
|
36
|
-
if (targetTop <
|
|
48
|
+
if (targetTop > deltaHeight - 1) targetTop = deltaHeight;
|
|
49
|
+
if (targetTop < 1) targetTop = 0;
|
|
37
50
|
targetTop += "px";
|
|
38
51
|
if (thumb.style.top !== targetTop) thumb.style.top = targetTop;
|
|
39
52
|
}
|
|
@@ -42,6 +55,7 @@ var scrollbary = function () {
|
|
|
42
55
|
var moving = null;
|
|
43
56
|
|
|
44
57
|
var mousemove = function (event) {
|
|
58
|
+
event.moveLocked = true;
|
|
45
59
|
var deltaY = event.clientY - moving.y;
|
|
46
60
|
if (!moving.ing) {
|
|
47
61
|
if (Math.abs(deltaY) < MOVELOCK_DELTA) return;
|
|
@@ -65,13 +79,6 @@ var scrollbary = function () {
|
|
|
65
79
|
css(thumb, { top: targetY });
|
|
66
80
|
dispatch(target, "change");
|
|
67
81
|
}
|
|
68
|
-
var tt = target.target;
|
|
69
|
-
if (tt) {
|
|
70
|
-
var { Height, height } = getTargetHeight(tt);
|
|
71
|
-
var top = targetY * (Height - height) / (target.clientHeight - thumb.offsetHeight);
|
|
72
|
-
setTargetTop(tt, top);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
82
|
};
|
|
76
83
|
|
|
77
84
|
var mouseup = function () {
|
|
@@ -96,7 +103,7 @@ var scrollbary = function () {
|
|
|
96
103
|
var targetTop = scroller.$Top() + delta;
|
|
97
104
|
var target = scroller.target;
|
|
98
105
|
scroller.scrollTo(targetTop);
|
|
99
|
-
if (target)
|
|
106
|
+
if (target) scroller.setTTop(targetTop);
|
|
100
107
|
}
|
|
101
108
|
scrollingTimer = setTimeout(run, nextTickTime);
|
|
102
109
|
delta = (delta + saved_delta) / 2;
|
|
@@ -132,46 +139,86 @@ var scrollbary = function () {
|
|
|
132
139
|
}
|
|
133
140
|
|
|
134
141
|
|
|
135
|
-
var setTargetTop = function (
|
|
142
|
+
var setTargetTop = function (top) {
|
|
143
|
+
var target = this.target;
|
|
136
144
|
if (target.$Top instanceof Function) target.$Top(top);
|
|
137
145
|
else target.scrollTop = top;
|
|
138
146
|
};
|
|
139
|
-
var getTargetTop = function (
|
|
147
|
+
var getTargetTop = function () {
|
|
148
|
+
var target = this.target;
|
|
140
149
|
if (target.$Top instanceof Function) return target.$Top();
|
|
141
150
|
return target.scrollTop;
|
|
142
151
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
|
|
152
|
+
var getListTop = function () {
|
|
153
|
+
var target = this.target;
|
|
154
|
+
var f = target.getFirstVisibleElement(0);
|
|
155
|
+
if (!f) return;
|
|
156
|
+
return f.index;
|
|
157
|
+
}
|
|
158
|
+
var isList = function (target) {
|
|
159
|
+
return isObject(target) && isFunction(target.index) && isFunction(target.go) && isFunction(target.getFirstVisibleElement) && isFunction(target.getLastVisibleElement);
|
|
160
|
+
}
|
|
161
|
+
var getListHeight = function () {
|
|
162
|
+
var target = this.target;
|
|
163
|
+
var f = target.getFirstVisibleElement(0);
|
|
164
|
+
var l = target.getLastVisibleElement(0);
|
|
165
|
+
var height = 1;
|
|
166
|
+
if (f && l) {
|
|
167
|
+
height = 1 + l.index - f.index
|
|
168
|
+
}
|
|
169
|
+
return [target.src.length, height];
|
|
170
|
+
}
|
|
171
|
+
var getTargetHeight = function () {
|
|
172
|
+
var target = this.target;
|
|
173
|
+
var Height, height;
|
|
174
|
+
if (target.$Height instanceof Function) Height = target.$Height();
|
|
175
|
+
else Height = target.scrollHeight;
|
|
176
|
+
if (target.$height instanceof Function) height = target.$height();
|
|
177
|
+
else height = target.clientHeight;
|
|
178
|
+
return [Height, height];
|
|
179
|
+
};
|
|
180
|
+
var setListTop = function (top) {
|
|
181
|
+
this.target.go(top);
|
|
149
182
|
};
|
|
150
183
|
|
|
151
184
|
function scrollbar(elem) {
|
|
152
185
|
var onscroll = function () {
|
|
153
|
-
|
|
154
|
-
_scrollbar.
|
|
155
|
-
|
|
186
|
+
if (moving) return;
|
|
187
|
+
var top = _scrollbar.getTTop();
|
|
188
|
+
if (Number.isFinite(top)) {
|
|
189
|
+
_scrollbar.scrollTo(top);
|
|
190
|
+
_scrollbar.autoshow();
|
|
191
|
+
}
|
|
156
192
|
};
|
|
157
193
|
var onchange = function () {
|
|
158
194
|
var top = _scrollbar.$Top();
|
|
159
|
-
|
|
195
|
+
this.setTTop(top);
|
|
160
196
|
};
|
|
161
197
|
function bindTarget(_container, followResize = _container) {
|
|
162
198
|
_container.with = _scrollbar;
|
|
163
199
|
_scrollbar.target = _container;
|
|
164
|
-
|
|
200
|
+
if (isList(_container) && hasClass(_container, "list-y")) {
|
|
201
|
+
this.getTTop = getListTop;
|
|
202
|
+
this.setTTop = setListTop;
|
|
203
|
+
this.getTHeight = getListHeight;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
this.getTHeight = getTargetHeight;
|
|
207
|
+
this.getTTop = getTargetTop;
|
|
208
|
+
this.setTTop = setTargetTop;
|
|
209
|
+
}
|
|
165
210
|
on("scroll")(_container, onscroll);
|
|
166
211
|
on("change")(_scrollbar, onchange);
|
|
167
212
|
if (followResize) resizingList.set(followResize, _scrollbar.reshape);
|
|
168
213
|
}
|
|
169
214
|
var _scrollbar = elem || document.createElement("scrollbar");
|
|
170
|
-
_scrollbar.reshape =
|
|
171
|
-
|
|
172
|
-
var
|
|
215
|
+
_scrollbar.$digest = _scrollbar.reshape = function () {
|
|
216
|
+
if (!this.target) return;
|
|
217
|
+
var [Height, height] = this.getTHeight();
|
|
218
|
+
if (!isHandled(Height) || !isHandled(height)) return;
|
|
173
219
|
reshape.call(_scrollbar, Height, height);
|
|
174
|
-
}
|
|
220
|
+
};
|
|
221
|
+
|
|
175
222
|
_scrollbar.scrollTo = scrollTo;
|
|
176
223
|
var _handler = document.createElement("scrollbar-thumb");
|
|
177
224
|
_handler.className = "thumb";
|
|
@@ -201,7 +248,7 @@ var scrollbary = function () {
|
|
|
201
248
|
var scrollbar_y = scrollbary();
|
|
202
249
|
var scrollbar_x = arriswise(scrollbary, arguments)();
|
|
203
250
|
var isBody = function (elem) {
|
|
204
|
-
return hasClass(elem, 'body') || elem.hasAttribute('body');
|
|
251
|
+
return elem ? hasClass(elem, 'body') || elem.hasAttribute('body') || /body$/i.test(elem.tagName) : false;
|
|
205
252
|
}
|
|
206
253
|
function main(elem) {
|
|
207
254
|
var direction, bar, target;
|
|
@@ -210,18 +257,19 @@ function main(elem) {
|
|
|
210
257
|
elem = null;
|
|
211
258
|
}
|
|
212
259
|
else if (isElement(elem)) {
|
|
213
|
-
direction =
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
260
|
+
if (elem.hasAttribute('y') || hasClass(elem, 'y')) direction = "y";
|
|
261
|
+
else if (elem.hasAttribute('x') || hasClass(elem, 'x')) direction = "x";
|
|
262
|
+
else direction = elem.tagName;
|
|
263
|
+
target = elem.target;
|
|
264
|
+
if (!target) {
|
|
265
|
+
if (isBody(elem.previousElementSibling)) {
|
|
218
266
|
target = elem.previousElementSibling;
|
|
219
267
|
}
|
|
220
268
|
else if (isBody(elem.nextElementSibling)) {
|
|
221
269
|
target = elem.nextElementSibling;
|
|
222
270
|
}
|
|
271
|
+
else if (!/^(\w*\-?)?scroll/i.test(direction)) target = elem, elem = null;
|
|
223
272
|
}
|
|
224
|
-
else if (!/^(\w*\-?)?scroll/i.test(direction)) target = elem, elem = null;
|
|
225
273
|
}
|
|
226
274
|
else {
|
|
227
275
|
elem = null;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
& {
|
|
2
2
|
position: absolute;
|
|
3
|
-
width: 6px;
|
|
4
3
|
border-radius: 7px;
|
|
5
|
-
height: 100px;
|
|
6
|
-
border-left: 3px solid transparent;
|
|
7
4
|
|
|
8
5
|
&[x],
|
|
9
6
|
&.x {
|
|
10
7
|
left: 0;
|
|
8
|
+
height: 12px;
|
|
9
|
+
width: 100px;
|
|
11
10
|
bottom: 0;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
&[y],
|
|
15
14
|
&.y {
|
|
15
|
+
border-left: 3px solid transparent;
|
|
16
16
|
top: 0;
|
|
17
|
+
height: 100px;
|
|
18
|
+
width: 6px;
|
|
17
19
|
right: 0;
|
|
18
20
|
}
|
|
19
21
|
|
package/coms/zimoli/select.js
CHANGED
|
@@ -163,11 +163,11 @@ function select() {
|
|
|
163
163
|
var optionsMap = {};
|
|
164
164
|
var $key = 'key';
|
|
165
165
|
var $name = 'name';
|
|
166
|
-
var template =
|
|
166
|
+
var template = generator.$template;
|
|
167
167
|
var isIndexedKey = false;
|
|
168
168
|
var $item = '';
|
|
169
169
|
if (template) a: {
|
|
170
|
-
var { attrs, binds } = template.childNodes[0]
|
|
170
|
+
var { attrs, binds } = $structed.get(template.childNodes[0]);
|
|
171
171
|
if (!attrs.value && !binds.value) break a;
|
|
172
172
|
$key = attrs.value || binds.value;
|
|
173
173
|
if ($key === target.$src.indexName || $key === target.$src.keyName) isIndexedKey = true;
|
|
@@ -192,7 +192,7 @@ function select() {
|
|
|
192
192
|
var s = optionsMap[v];
|
|
193
193
|
var name = s ? s.name : '';
|
|
194
194
|
if (s && template) {
|
|
195
|
-
name =
|
|
195
|
+
name = $eval.call(this, $name, this.$src.createScope(s, v, v));
|
|
196
196
|
}
|
|
197
197
|
this.innerHTML = `<option selected value="${v}">${name || ''}</option>`;
|
|
198
198
|
this.value = v;
|
|
@@ -210,7 +210,7 @@ function main() {
|
|
|
210
210
|
page.with = null;
|
|
211
211
|
children.splice(0, children.length);
|
|
212
212
|
if (optholder) children.push(optholder);
|
|
213
|
-
children.push.apply(children, edit
|
|
213
|
+
children.push.apply(children, $scoped.get(edit).options.map(o => ({ value: o.key || o.value, name: o.name || o.innerHTML })))
|
|
214
214
|
cast(page.target, 'set-options', children);
|
|
215
215
|
page.clean();
|
|
216
216
|
remove(adder);
|
|
@@ -2,7 +2,7 @@ function main(options) {
|
|
|
2
2
|
var page = view();
|
|
3
3
|
page.innerHTML = template;
|
|
4
4
|
on("submit")(page, e => e.preventDefault());
|
|
5
|
-
|
|
5
|
+
var scope = {
|
|
6
6
|
options, a: button, input, _search: '',
|
|
7
7
|
add() {
|
|
8
8
|
var a = this._search;
|
|
@@ -46,7 +46,8 @@ function main(options) {
|
|
|
46
46
|
remove(page);
|
|
47
47
|
},
|
|
48
48
|
filtered: []
|
|
49
|
-
}
|
|
49
|
+
};
|
|
50
|
+
render(page, scope);
|
|
50
51
|
drag.on(page.firstChild, page);
|
|
51
52
|
on("append")(page, function () {
|
|
52
53
|
setTimeout(function () {
|
|
@@ -59,8 +60,8 @@ function main(options) {
|
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
page.onback = function () {
|
|
62
|
-
if (
|
|
63
|
-
|
|
63
|
+
if (scope.search) {
|
|
64
|
+
scope.search = '';
|
|
64
65
|
return false;
|
|
65
66
|
}
|
|
66
67
|
};
|
package/coms/zimoli/table.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<thead @mounted="setFixedColumn.call(this.parentNode),setContextMenu(this)">
|
|
1
|
+
<thead @mounted="setFixedColumn.call(this.parentNode),setContextMenu(this),updateStyles()">
|
|
2
2
|
<tr inline-block #adapter thead @append="resizeT(this)">
|
|
3
3
|
<td draggable="false" fixed row-index>
|
|
4
4
|
<mask></mask>${i18n`序号`}
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
</thead>
|
|
14
14
|
<tbody -src="(d,i) in data" :style="tbodyHeight(this,hasFoot,adapter.offsetWidth)">
|
|
15
15
|
<tr inline-block @click="rowClick(d,i,event)" once-mounted="resizeR(this)">
|
|
16
|
-
<td fixed row-index @append="this.style=
|
|
16
|
+
<td fixed row-index @append="this.style=thStyles[0]">
|
|
17
17
|
<mask></mask><span -bind="i+1"></span>
|
|
18
18
|
</td>
|
|
19
|
-
<td fixed:="f.fixed" -repeat="(f,i) in fields"
|
|
19
|
+
<td fixed:="f.fixed" -repeat="(f,i) in fields" @append="this.style=thStyles[i+1]">
|
|
20
20
|
<mask></mask>
|
|
21
21
|
<model -if="!isEmpty(f.key)" :field=f :data=d readonly></model>
|
|
22
22
|
<template -else> </template>
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
</td>
|
|
31
31
|
</tr>
|
|
32
32
|
</tbody>
|
|
33
|
+
<scrollbar y></scrollbar>
|
|
33
34
|
<tfoot>
|
|
34
35
|
<tr .fade -if="!data||!data.length" style="padding-bottom: 20px;">
|
|
35
36
|
<td style="text-align: center;">
|
|
@@ -43,4 +44,5 @@
|
|
|
43
44
|
${i18n`共${" <span -bind=data.length></span> "}个`}
|
|
44
45
|
</td>
|
|
45
46
|
</tr>
|
|
46
|
-
</tfoot>
|
|
47
|
+
</tfoot>
|
|
48
|
+
<scrollbar x :target="this.parentNode"></scrollbar>
|
package/coms/zimoli/table.js
CHANGED
|
@@ -108,10 +108,19 @@ var getTbody = function (table) {
|
|
|
108
108
|
var isTfoot = function (c) {
|
|
109
109
|
return /^tfoot$/i.test(c.tagName) || c.hasAttribute("tfoot");
|
|
110
110
|
}
|
|
111
|
-
var
|
|
111
|
+
var getTExtras = function (table) {
|
|
112
|
+
var tfoot, xb, yb;
|
|
112
113
|
for (var c of table.children) {
|
|
113
|
-
if (isTfoot(c))
|
|
114
|
+
if (isTfoot(c)) {
|
|
115
|
+
tfoot = c;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (hasClass(c, 'scrollbar')) {
|
|
119
|
+
if (c.hasAttribute('x') || hasClass(c, 'x')) xb = c;
|
|
120
|
+
else yb = c;
|
|
121
|
+
}
|
|
114
122
|
}
|
|
123
|
+
return [tfoot, xb, yb];
|
|
115
124
|
};
|
|
116
125
|
var isTableRow = function (e) {
|
|
117
126
|
return trElementReg.test(e.tagName);
|
|
@@ -170,7 +179,7 @@ var resizeTarget = function (event) {
|
|
|
170
179
|
if (targetW < 20) targetW = 20;
|
|
171
180
|
resizeColumn.call(this, target, targetW);
|
|
172
181
|
resizing.clientX = event.clientX;
|
|
173
|
-
setFixedColumn.call(this);
|
|
182
|
+
setFixedColumn.call(this, target);
|
|
174
183
|
};
|
|
175
184
|
var getFirstSingleColCell = function (table, col) {
|
|
176
185
|
var tds = getTdsByCol(table, col, col);
|
|
@@ -304,44 +313,55 @@ var setFixed = function (children, scrolled, left, borderRight) {
|
|
|
304
313
|
}
|
|
305
314
|
|
|
306
315
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
var setFixedColumn = function (remark) {
|
|
310
|
-
var thead = getThead(this);
|
|
316
|
+
var getTheadChildren = function (table) {
|
|
317
|
+
var thead = getThead(table);
|
|
311
318
|
if (!thead) return;
|
|
312
|
-
remark = remark === true;
|
|
313
|
-
if (remark) remark = [], forEachRow(thead, function (tr) {
|
|
314
|
-
markRowTds(tr, remark);
|
|
315
|
-
});
|
|
316
319
|
if (!isTableRow(thead)) thead = thead.querySelector('tr');
|
|
317
320
|
if (!thead) return;
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (
|
|
323
|
-
|
|
324
|
-
if (lastFieldChild) css(lastChild, { width: 0 }), lastChild = lastFieldChild, cindex = children.length - 2;
|
|
325
|
-
var deltaW = thead.scrollWidth - lastChild.offsetWidth;
|
|
326
|
-
if (this.clientWidth > deltaW + lastChild.offsetWidth) {
|
|
327
|
-
css(lastChild, { width: this.clientWidth - deltaW });
|
|
328
|
-
css(thead, { width: this.clientWidth });
|
|
329
|
-
resizeColumn.call(this, lastChild, this.clientWidth - deltaW);
|
|
330
|
-
remark = true;
|
|
331
|
-
}
|
|
332
|
-
if (remark) {
|
|
333
|
-
var tbody = getTbody(this);
|
|
334
|
-
forEachRow(tbody, function (tr) {
|
|
335
|
-
css(tr.children[cindex], lastChild.style);
|
|
336
|
-
});
|
|
337
|
-
css(tbody, { width: thead.offsetWidth });
|
|
338
|
-
}
|
|
321
|
+
return Array.apply(null, thead.children);
|
|
322
|
+
}
|
|
323
|
+
var fixScroll = function (children) {
|
|
324
|
+
var scrollOnly = !children;
|
|
325
|
+
if (scrollOnly) children = getTheadChildren(this);
|
|
326
|
+
if (!children) return;
|
|
339
327
|
setFixed.call(this, children, this.scrollLeft, 'left', 'borderRight');
|
|
340
328
|
setFixed.call(this, children.reverse(), this.scrollWidth - this.clientWidth - this.scrollLeft, 'right', 'borderLeft');
|
|
341
|
-
var tfoot =
|
|
329
|
+
var [tfoot, xsb, ysb] = getTExtras(this);
|
|
342
330
|
if (tfoot) {
|
|
343
331
|
css(tfoot, { left: this.scrollLeft });
|
|
344
332
|
}
|
|
333
|
+
if (xsb) {
|
|
334
|
+
if (!scrollOnly) xsb.reshape();
|
|
335
|
+
css(xsb, { left: this.scrollLeft });
|
|
336
|
+
}
|
|
337
|
+
if (ysb) {
|
|
338
|
+
css(ysb, { marginRight: -this.scrollLeft });
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
var setFixedColumn = function (remark) {
|
|
342
|
+
var children = getTheadChildren(this);
|
|
343
|
+
if (!children || children.length < 2) return;
|
|
344
|
+
var cindex = children.length - 1;
|
|
345
|
+
var lastChild = children[cindex];
|
|
346
|
+
if (!lastChild) return;
|
|
347
|
+
if (remark !== false) {
|
|
348
|
+
var scrollWidth = this.clientWidth + this.scrollLeft;
|
|
349
|
+
var restWidth = scrollWidth - lastChild.offsetLeft;
|
|
350
|
+
if (restWidth > 20 || restWidth > lastChild.offsetWidth) {
|
|
351
|
+
var lastStyle = { width: restWidth }
|
|
352
|
+
css(lastChild, lastStyle);
|
|
353
|
+
var thead = getThead(this);
|
|
354
|
+
css(thead, { width: scrollWidth });
|
|
355
|
+
resizeColumn.call(this, lastChild, restWidth);
|
|
356
|
+
var tbody = getTbody(this);
|
|
357
|
+
forEachRow(tbody, function (tr) {
|
|
358
|
+
css(tr.children[cindex], lastStyle);
|
|
359
|
+
});
|
|
360
|
+
css(tbody, { width: thead.offsetWidth });
|
|
361
|
+
remark = true;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
fixScroll.call(this, children);
|
|
345
365
|
};
|
|
346
366
|
var setClass = function (tds, cls, old) {
|
|
347
367
|
tds.forEach(td => td[cls] = true);
|
|
@@ -421,6 +441,13 @@ function table(elem) {
|
|
|
421
441
|
var activeCols = [];
|
|
422
442
|
bind('mousemove')(tableElement, adaptTarget);
|
|
423
443
|
var updateSummaryFields = null;
|
|
444
|
+
var thStyles = [];
|
|
445
|
+
var updateStyles = function () {
|
|
446
|
+
thStyles.splice(0, thStyles.length);
|
|
447
|
+
thStyles.push.apply(thStyles, getTheadChildren(table).map(a => {
|
|
448
|
+
return a.getAttribute('style');
|
|
449
|
+
}));
|
|
450
|
+
}
|
|
424
451
|
moveupon(tableElement, {
|
|
425
452
|
start(event) {
|
|
426
453
|
if (this.resizing) return event.preventDefault();
|
|
@@ -429,7 +456,7 @@ function table(elem) {
|
|
|
429
456
|
var th = getTargetIn(thead, event.target, false);
|
|
430
457
|
if (!th) return;
|
|
431
458
|
if (th.tagName.toLowerCase() === 'tr') th = getTargetIn(th, event.target, false);
|
|
432
|
-
var field = th
|
|
459
|
+
var field = $scoped.get(th).f;
|
|
433
460
|
if (!field || field.fixed || !isHandled(field.key)) return;
|
|
434
461
|
swapping = lazySwap(th, function (value) {
|
|
435
462
|
field.summary = value;
|
|
@@ -440,6 +467,7 @@ function table(elem) {
|
|
|
440
467
|
move: resizeTarget,
|
|
441
468
|
end() {
|
|
442
469
|
if (swapping) swapping.end(), swapping = null;
|
|
470
|
+
updateStyles();
|
|
443
471
|
}
|
|
444
472
|
});
|
|
445
473
|
var activeRows = [];
|
|
@@ -496,15 +524,25 @@ function table(elem) {
|
|
|
496
524
|
};
|
|
497
525
|
watch(table, {
|
|
498
526
|
showTotal(v) {
|
|
499
|
-
|
|
500
|
-
|
|
527
|
+
var ts = $scoped.get(this);
|
|
528
|
+
ts.showTotal = v;
|
|
529
|
+
if (v) ts.hasFoot = true;
|
|
501
530
|
}
|
|
502
531
|
})
|
|
503
532
|
table.useIncrease = false;
|
|
504
533
|
var _vbox = function () {
|
|
505
534
|
table.$Left = function (x) {
|
|
506
|
-
if (isFinite(x))
|
|
507
|
-
|
|
535
|
+
if (isFinite(x)) {
|
|
536
|
+
var thd = getTbody(this);
|
|
537
|
+
if (thd.offsetLeft + thd.offsetWidth < x + this.clientWidth) {
|
|
538
|
+
x = thd.offsetLeft + thd.offsetWidth - this.clientWidth;
|
|
539
|
+
}
|
|
540
|
+
this.scrollLeft = x, fixScroll.call(this);
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
x = this.scrollLeft;
|
|
544
|
+
}
|
|
545
|
+
return x;
|
|
508
546
|
};
|
|
509
547
|
vbox(table, 'x');
|
|
510
548
|
};
|
|
@@ -542,11 +580,13 @@ function table(elem) {
|
|
|
542
580
|
fields: fields.filter(f => !f.hidden),
|
|
543
581
|
isEmpty,
|
|
544
582
|
hasFoot: true,
|
|
583
|
+
thStyles,
|
|
545
584
|
setContextMenu,
|
|
546
585
|
tbody0: null,
|
|
547
586
|
rowClick(d, i, event) {
|
|
548
587
|
active(table, i, d, event.target);
|
|
549
588
|
},
|
|
589
|
+
updateStyles,
|
|
550
590
|
tbody() {
|
|
551
591
|
var e = list.apply(null, arguments);
|
|
552
592
|
css(e, tbodyHeight(e, this.hasFoot));
|
|
@@ -569,6 +609,7 @@ function table(elem) {
|
|
|
569
609
|
resizeT,
|
|
570
610
|
resizeR,
|
|
571
611
|
model,
|
|
612
|
+
scrollbar,
|
|
572
613
|
sort(f) {
|
|
573
614
|
this.data.sort(f);
|
|
574
615
|
},
|
|
@@ -579,21 +620,21 @@ function table(elem) {
|
|
|
579
620
|
setFixedColumn,
|
|
580
621
|
pagination
|
|
581
622
|
};
|
|
582
|
-
render(this, $scope,
|
|
623
|
+
render(this, $scope, tableScopes);
|
|
583
624
|
await data;
|
|
584
625
|
if (!data.is_errored) $scope.data = Table.from(fields, data);
|
|
585
626
|
$scope.data.callback = function () {
|
|
586
627
|
render.digest();
|
|
587
628
|
};
|
|
588
629
|
})
|
|
589
|
-
|
|
630
|
+
var tableScopes = render.getScopes(this);
|
|
590
631
|
autodragchildren(
|
|
591
632
|
table,
|
|
592
633
|
cellMatchManager,
|
|
593
634
|
function (src, dst, rel, append, parentNode) {
|
|
594
635
|
if (table.src) {
|
|
595
636
|
if (src < 1 || dst < 1) return false;
|
|
596
|
-
var fields = parentNode
|
|
637
|
+
var fields = $scoped.get(parentNode).fields;
|
|
597
638
|
var [f] = fields.splice(src - 1, 1);
|
|
598
639
|
fields.splice(dst - 1, 0, f);
|
|
599
640
|
}
|
package/coms/zimoli/table.less
CHANGED
|
@@ -262,4 +262,26 @@ tbody,
|
|
|
262
262
|
color: #666;
|
|
263
263
|
overflow: hidden;
|
|
264
264
|
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
tfoot,
|
|
268
|
+
[tfoot] {
|
|
269
|
+
pointer-events: none;
|
|
270
|
+
z-index: 1;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
scrollbar[y] {
|
|
274
|
+
height: 100%;
|
|
275
|
+
width: 12px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
scrollbar[x] {
|
|
279
|
+
height: 30px;
|
|
280
|
+
|
|
281
|
+
>.thumb {
|
|
282
|
+
border-radius: 0 0 3px 3px;
|
|
283
|
+
background-color: #29c3;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
width: 100%;
|
|
265
287
|
}
|
package/coms/zimoli/vbox.less
CHANGED
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -49,8 +49,8 @@ onhashchange(window, function (event) {
|
|
|
49
49
|
});
|
|
50
50
|
// body
|
|
51
51
|
var location_pathname = location.pathname;
|
|
52
|
-
var _zimoli_params_key =
|
|
53
|
-
var _zimoli_state_prefix =
|
|
52
|
+
var _zimoli_params_key = `紫茉莉:${location_pathname}#`;
|
|
53
|
+
var _zimoli_state_prefix = `茉莉紫:${location_pathname}#`;
|
|
54
54
|
|
|
55
55
|
function getReverseStyle(style) {
|
|
56
56
|
if (!isObject(style)) {
|
|
@@ -371,17 +371,18 @@ function create(pagepath, args, from, needroles) {
|
|
|
371
371
|
var pg = pagepath;
|
|
372
372
|
var { with: _with_elements = [], state = {}, onback: _pageback_listener, roles } = pg;
|
|
373
373
|
}
|
|
374
|
+
var h = history[current_history];
|
|
374
375
|
if (!checkroles(user.roles, roles) || !checkroles(user.roles, needroles)) {
|
|
375
376
|
// 检查权限
|
|
376
377
|
if (!user.isLogin && user.loginPath) {
|
|
377
378
|
var pg = create(user.loginPath);
|
|
378
|
-
|
|
379
|
+
if (h) h.wardable = false;
|
|
379
380
|
return pg;
|
|
380
381
|
}
|
|
381
382
|
return alert(i18n`没有权限!`, 0);
|
|
382
383
|
}
|
|
383
384
|
if (!pg) return;
|
|
384
|
-
if (
|
|
385
|
+
if (h) h.wardable = true;
|
|
385
386
|
var _with_length = _with_elements.length;
|
|
386
387
|
state.onback = function (handler) {
|
|
387
388
|
_pageback_listener = handler;
|
|
@@ -460,7 +461,7 @@ var global = {};
|
|
|
460
461
|
var history = {};
|
|
461
462
|
var current_history, default_history = current_history = "";
|
|
462
463
|
history[current_history] = createEmptyHistory('/main', false);
|
|
463
|
-
var history_session_object_key =
|
|
464
|
+
var history_session_object_key = `紫茉莉:${location_pathname}`;
|
|
464
465
|
try {
|
|
465
466
|
history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
|
|
466
467
|
} catch (e) {
|
package/docs/version-desc.md
CHANGED
|
@@ -10,4 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
4.0 No longer relying on `typescript` (nearly 170000 lines of source code), the compilation speed has increased by four times, the memory usage has been reduced to 1/8 of the original, and the self compilation time on GitHub has also been reduced to about 15 seconds.
|
|
12
12
|
|
|
13
|
-
4.1 No longer relying on `less-node` or `pngjs`, while the `less-node` is replaced with [suxin](https://www.npmjs.com/package/suxin) from `efront`.
|
|
13
|
+
4.1 No longer relying on `less-node` or `pngjs`, while the `less-node` is replaced with [suxin](https://www.npmjs.com/package/suxin) from `efront`.
|
|
14
|
+
|
|
15
|
+
4.23 The `zimoli` library has adjusted the component rendering method to provide a relatively clean DOM for developers. When calling methods such as `on` and `render`, associated data is no longer attached to DOM elements (except for browsers without WeakMap). Code that uses corresponding underlying features needs to be modified.
|
|
@@ -10,4 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
4.0版本 不再依赖`typescipt`(近17万行源码),编译速度再次提升4倍,占用内存减少到原来的1/8,github上自我编译时间也减少到15秒左右。
|
|
12
12
|
|
|
13
|
-
4.1版本 不再依赖`less-node`和`pngjs`,其中`less-node` 由`efront`自建的css工具[素馨](https://www.npmjs.com/package/suxin)代替。
|
|
13
|
+
4.1版本 不再依赖`less-node`和`pngjs`,其中`less-node` 由`efront`自建的css工具[素馨](https://www.npmjs.com/package/suxin)代替。
|
|
14
|
+
|
|
15
|
+
4.23版本 紫茉莉库`zimoli`调整组件渲染方式,给开发一个相对干净的DOM,调用`on`和`render`等方法时,不再将关联的数据挂载到dom元素,(无WeakMap的浏览器除外),用到相应的底层特性的代码需要修改。
|