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/zimoli/table.js
CHANGED
|
@@ -16,7 +16,7 @@ var moveMargin = function (element, movePixels) {
|
|
|
16
16
|
var markRowTds = function (tr, deltas, colstart, colend) {
|
|
17
17
|
var inc = 0;
|
|
18
18
|
var collections = [];
|
|
19
|
-
|
|
19
|
+
Array.prototype.forEach.call(tr.children, function (td) {
|
|
20
20
|
while (deltas[inc] > 0) {
|
|
21
21
|
deltas[inc++]--;
|
|
22
22
|
}
|
|
@@ -40,32 +40,95 @@ var markRowTds = function (tr, deltas, colstart, colend) {
|
|
|
40
40
|
});
|
|
41
41
|
return collections;
|
|
42
42
|
};
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (trElementReg.test(tr.tagName)) {
|
|
48
|
-
var collections = markRowTds(tr, savedRowDeltas, start, end);
|
|
49
|
-
savedCollections.push(collections);
|
|
43
|
+
var forEachTableRow = function (table, call) {
|
|
44
|
+
for (var tr of table.children) {
|
|
45
|
+
if (isTableRow(tr)) {
|
|
46
|
+
call(tr);
|
|
50
47
|
}
|
|
51
48
|
else {
|
|
52
|
-
var
|
|
53
|
-
savedCollections.push.apply(savedCollections, collections);
|
|
49
|
+
for (var c of tr.children) if (isTableRow(c)) call(c);
|
|
54
50
|
}
|
|
55
|
-
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
var getRowsOfTdsByCol = function (table, start, end) {
|
|
54
|
+
var savedRowDeltas = [];
|
|
55
|
+
var savedCollections = [];
|
|
56
|
+
forEachTableRow(table, function (tr) {
|
|
57
|
+
var collections = markRowTds(tr, savedRowDeltas, start, end);
|
|
58
|
+
savedCollections.push(collections);
|
|
59
|
+
})
|
|
56
60
|
return savedCollections;
|
|
57
61
|
}
|
|
58
62
|
var getTdsByCol = function (table, start, end) {
|
|
59
63
|
return [].concat.apply([], getRowsOfTdsByCol(table, start, end));
|
|
60
64
|
};
|
|
65
|
+
var resizeT = function (t, w) {
|
|
66
|
+
if (!w) {
|
|
67
|
+
var w = 0;
|
|
68
|
+
for (var cx = 0, dx = t.children.length; cx < dx; cx++) {
|
|
69
|
+
w += t.children[cx].offsetWidth;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
css(t, { width: w });
|
|
73
|
+
}
|
|
74
|
+
var getThead = function (table) {
|
|
75
|
+
for (var c of table.children) {
|
|
76
|
+
if (/^thead$/i.test(c.tagName) || c.hasAttribute('thead')) return c;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var getTbody = function (table) {
|
|
80
|
+
for (var c of table.children) {
|
|
81
|
+
if (/^tbody$/i.test(c.tagName) || c.hasAttribute("tbody")) return c;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var isTableRow = function (e) {
|
|
85
|
+
return trElementReg.test(e.tagName);
|
|
86
|
+
};
|
|
87
|
+
var resizeColumn = function (target, targetW) {
|
|
88
|
+
var deltaW = targetW - target.offsetWidth;
|
|
89
|
+
forEachTableRow(this, function (tr) {
|
|
90
|
+
resizeT(tr, tr.offsetWidth + deltaW);
|
|
91
|
+
});
|
|
92
|
+
for (var c of this.children) {
|
|
93
|
+
if (!isTableRow(c)) {
|
|
94
|
+
var tr = c.querySelector('tr');
|
|
95
|
+
c.style.width = tr.style.width;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
var { colstart, colend } = target;
|
|
99
|
+
if (isEmpty(colstart) || isEmpty(colend)) return;
|
|
100
|
+
var ts = getRowsOfTdsByCol(this, colstart, colend);
|
|
101
|
+
for (var cs of ts) {
|
|
102
|
+
var c = cs[cs.length - 1];
|
|
103
|
+
var w = 0;
|
|
104
|
+
for (var c of cs) {
|
|
105
|
+
w += c.offsetWidth;
|
|
106
|
+
}
|
|
107
|
+
w = targetW - w;
|
|
108
|
+
while (w !== 0) {
|
|
109
|
+
var c = cs.pop();
|
|
110
|
+
var w0 = c.offsetWidth + w;
|
|
111
|
+
if (w0 < 0) {
|
|
112
|
+
w = -w0;
|
|
113
|
+
w0 = w;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
w = 0;
|
|
117
|
+
}
|
|
118
|
+
if (targetW !== w) css(c, { width: w0 });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
61
122
|
var resizeTarget = function (event) {
|
|
62
123
|
var { resizing } = this;
|
|
63
124
|
if (!resizing) return;
|
|
64
125
|
event.moveLocked = true;
|
|
65
126
|
var { restX, target } = resizing;
|
|
66
|
-
var
|
|
67
|
-
|
|
127
|
+
var targetW = event.clientX - restX;
|
|
128
|
+
if (targetW < 20) targetW = 20;
|
|
129
|
+
resizeColumn.call(this, target, targetW);
|
|
68
130
|
resizing.clientX = event.clientX;
|
|
131
|
+
setFixedColumn.call(this);
|
|
69
132
|
};
|
|
70
133
|
var getFirstSingleColCell = function (table, col) {
|
|
71
134
|
var tds = getTdsByCol(table, col, col);
|
|
@@ -122,7 +185,7 @@ function enrichField(f) {
|
|
|
122
185
|
}
|
|
123
186
|
else switch (f.type) {
|
|
124
187
|
case "text":
|
|
125
|
-
width =
|
|
188
|
+
width = 200;
|
|
126
189
|
break;
|
|
127
190
|
case "input":
|
|
128
191
|
width = 200;
|
|
@@ -144,7 +207,71 @@ function enrichField(f) {
|
|
|
144
207
|
}
|
|
145
208
|
if (width > 600) width = 600;
|
|
146
209
|
f.width = width + 60;
|
|
210
|
+
if (!f.key && f.options && isEmpty(f.fixed)) {
|
|
211
|
+
f.fixed = true;
|
|
212
|
+
}
|
|
147
213
|
}
|
|
214
|
+
var tbodyHeight = function (tbody) {
|
|
215
|
+
return { 'max-height': ((innerHeight - getScreenPosition(tbody).top - 16) / 32 | 0) * 32 }
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
var setFixed = function (children, scrolled, left, borderRight) {
|
|
219
|
+
var setBorderRight = function (fixedLeft) {
|
|
220
|
+
var end = fixedLeft[fixedLeft.length - 1];
|
|
221
|
+
if (end && end.style[left]) css(end, {
|
|
222
|
+
[borderRight]: '1px solid #0006'
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
var fixedElements = [];
|
|
226
|
+
var offset = 0;
|
|
227
|
+
var fixedWidth = 0;
|
|
228
|
+
for (var c of children) {
|
|
229
|
+
var pc = getScreenPosition(c);
|
|
230
|
+
var isfixed = c.hasAttribute('fixed');
|
|
231
|
+
if (fixedWidth + scrolled > offset && fixedWidth + pc.width < this.clientWidth / 3) {
|
|
232
|
+
if (isfixed) {
|
|
233
|
+
css(c, { [left]: scrolled - offset + fixedWidth, [borderRight]: '' });
|
|
234
|
+
fixedElements.push(c);
|
|
235
|
+
fixedWidth += pc.width;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
setBorderRight(fixedElements);
|
|
240
|
+
if (isfixed && c.style[left]) {
|
|
241
|
+
css(c, { [left]: '', [borderRight]: '' })
|
|
242
|
+
fixedElements.push(c);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
offset += pc.width;
|
|
246
|
+
}
|
|
247
|
+
setBorderRight(fixedElements);
|
|
248
|
+
for (var f of fixedElements) {
|
|
249
|
+
var cols = getRowsOfTdsByCol(this, f.colstart, f.colend);
|
|
250
|
+
for (var c of cols) css(c[0], {
|
|
251
|
+
[left]: f.style[left],
|
|
252
|
+
[borderRight]: f.style[borderRight]
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
var setFixedColumn = function () {
|
|
260
|
+
var thead = getThead(this);
|
|
261
|
+
if (!thead) return;
|
|
262
|
+
if (!isTableRow(thead)) thead = thead.querySelector('tr');
|
|
263
|
+
var children = Array.prototype.slice.call(thead.children);
|
|
264
|
+
var lastChild = children[children.length - 1];
|
|
265
|
+
if (!lastChild) return;
|
|
266
|
+
var deltaW = thead.scrollWidth - lastChild.offsetWidth;
|
|
267
|
+
if (this.clientWidth > deltaW + 200) {
|
|
268
|
+
css(lastChild, { width: this.clientWidth - deltaW });
|
|
269
|
+
css(thead, { width: this.clientWidth });
|
|
270
|
+
resizeColumn.call(this, lastChild, this.clientWidth - deltaW);
|
|
271
|
+
}
|
|
272
|
+
setFixed.call(this, children, this.scrollLeft, 'left', 'borderRight');
|
|
273
|
+
setFixed.call(this, children.reverse(), this.scrollWidth - this.clientWidth - this.scrollLeft, 'right', 'borderLeft');
|
|
274
|
+
};
|
|
148
275
|
|
|
149
276
|
function table(elem) {
|
|
150
277
|
var tableElement = isElement(elem) ? elem : document.createElement("table");
|
|
@@ -169,11 +296,10 @@ function table(elem) {
|
|
|
169
296
|
});
|
|
170
297
|
onmousemove(tableElement, function (event) {
|
|
171
298
|
if (!thead) {
|
|
172
|
-
|
|
173
|
-
if (!thead) thead = table.querySelector('[thead]');
|
|
299
|
+
thead = getThead(table);
|
|
174
300
|
}
|
|
175
301
|
if (!getTargetIn(thead, event.target)) return;
|
|
176
|
-
|
|
302
|
+
if (table.resizing) return;
|
|
177
303
|
var tds = getTargetIn(cellMatchManager, event.target);
|
|
178
304
|
if (!isArray(tds)) tds = [];
|
|
179
305
|
tds.map(function (td) {
|
|
@@ -195,41 +321,67 @@ function table(elem) {
|
|
|
195
321
|
});
|
|
196
322
|
var table = tableElement;
|
|
197
323
|
var thead;
|
|
324
|
+
var markedRows = false;
|
|
198
325
|
var cellMatchManager = function (element) {
|
|
199
326
|
if (!thead) {
|
|
200
327
|
[thead] = table.getElementsByTagName("thead");
|
|
201
328
|
if (!thead) thead = table.querySelector('[thead]');
|
|
202
329
|
}
|
|
203
|
-
if (table.resizing) return false;
|
|
204
330
|
if (!getTargetIn(thead, element)) return false;
|
|
205
331
|
if (!tdElementReg.test(element.tagName)) return false;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
332
|
+
if (!markedRows) {
|
|
333
|
+
var savedRowDeltas = [];
|
|
334
|
+
[].map.call(thead.children, function (tr) {
|
|
335
|
+
markRowTds(tr, savedRowDeltas);
|
|
336
|
+
});
|
|
337
|
+
markedRows = true;
|
|
338
|
+
}
|
|
210
339
|
var { colstart, colend } = element;
|
|
211
340
|
return getTdsByCol(table, colstart, colend);
|
|
212
341
|
};
|
|
342
|
+
|
|
213
343
|
table.dragbox = function () {
|
|
214
344
|
return thead;
|
|
215
345
|
};
|
|
216
|
-
|
|
346
|
+
table.useIncrease = false;
|
|
347
|
+
var _vbox = function () {
|
|
348
|
+
table.$Left = function (x) {
|
|
349
|
+
if (isFinite(x)) this.scrollLeft = x;
|
|
350
|
+
setFixedColumn.call(this);
|
|
351
|
+
return this.scrollLeft;
|
|
352
|
+
};
|
|
353
|
+
vbox(table, 'x');
|
|
354
|
+
};
|
|
217
355
|
care(table, function ([fields, data]) {
|
|
356
|
+
if (_vbox) _vbox(), _vbox = null;
|
|
218
357
|
thead = null;
|
|
219
358
|
fields.forEach(enrichField);
|
|
220
359
|
remove(this.children);
|
|
221
360
|
this.innerHTML = template;
|
|
222
|
-
|
|
361
|
+
markedRows = false;
|
|
362
|
+
this.style.display = 'block';
|
|
223
363
|
render(this, {
|
|
224
364
|
fields,
|
|
225
|
-
|
|
365
|
+
isEmpty,
|
|
366
|
+
tbody(e) {
|
|
226
367
|
var e = list.apply(null, arguments);
|
|
227
|
-
css(e, tbodyHeight());
|
|
368
|
+
css(e, tbodyHeight(e));
|
|
369
|
+
css(e, { width: this.adapter.offsetWidth, display: 'block' });
|
|
228
370
|
return e;
|
|
229
371
|
},
|
|
372
|
+
thead(t) {
|
|
373
|
+
var tr = document.createElement('thead');
|
|
374
|
+
tr.renders = [function () {
|
|
375
|
+
resizeT(this.firstChild)
|
|
376
|
+
}];
|
|
377
|
+
css(tr, { display: 'block' });
|
|
378
|
+
appendChild(tr, Array.prototype.slice.call(t.children));
|
|
379
|
+
return tr;
|
|
380
|
+
},
|
|
230
381
|
tbodyHeight,
|
|
231
382
|
data,
|
|
232
383
|
adapter: null,
|
|
384
|
+
resizeT,
|
|
233
385
|
model,
|
|
234
386
|
sort(f) {
|
|
235
387
|
f.sign = f.sign > 0 ? -1 : 1;
|
|
@@ -245,6 +397,7 @@ function table(elem) {
|
|
|
245
397
|
css(target, { width: f.width });
|
|
246
398
|
},
|
|
247
399
|
a: button,
|
|
400
|
+
setFixedColumn,
|
|
248
401
|
}, this.$parentScopes.concat(this.$scope));
|
|
249
402
|
})
|
|
250
403
|
autodragchildren(
|
|
@@ -257,6 +410,7 @@ function table(elem) {
|
|
|
257
410
|
var [f] = fields.splice(src - 1, 1);
|
|
258
411
|
fields.splice(dst - 1, 0, f);
|
|
259
412
|
}
|
|
413
|
+
markedRows = false;
|
|
260
414
|
var children = parentNode.children;
|
|
261
415
|
var srcElement = children[src];
|
|
262
416
|
var dstElement = children[rel];
|
|
@@ -290,5 +444,8 @@ function table(elem) {
|
|
|
290
444
|
}
|
|
291
445
|
}
|
|
292
446
|
);
|
|
447
|
+
resizingList.set(table);
|
|
448
|
+
on("resize")(table, setFixedColumn);
|
|
449
|
+
on("scroll")(table, setFixedColumn);
|
|
293
450
|
return table;
|
|
294
451
|
}
|
package/coms/zimoli/table.less
CHANGED
|
@@ -32,10 +32,20 @@ table,
|
|
|
32
32
|
vertical-align: top;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
|
|
36
|
+
tr {
|
|
37
|
+
position: relative;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
width: 100%;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
th,
|
|
43
|
+
td {
|
|
44
|
+
white-space: normal;
|
|
45
|
+
height: 100%;
|
|
46
|
+
border: 1px solid transparent;
|
|
47
|
+
padding: 1px 10px;
|
|
48
|
+
}
|
|
39
49
|
|
|
40
50
|
.y-ing {
|
|
41
51
|
&:before {
|
|
@@ -45,7 +55,7 @@ table,
|
|
|
45
55
|
top: 0;
|
|
46
56
|
bottom: 0;
|
|
47
57
|
right: 0;
|
|
48
|
-
background-color: rgba(0,
|
|
58
|
+
background-color: rgba(0, 30, 69, .06);
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
>* {
|
|
@@ -53,28 +63,47 @@ table,
|
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
@cell-padding: 0 10px;
|
|
57
66
|
|
|
58
67
|
& {
|
|
59
68
|
// text-align: center;
|
|
69
|
+
outline: 1px solid #0006;
|
|
70
|
+
max-width: 100%;
|
|
60
71
|
border-collapse: collapse;
|
|
61
72
|
table-layout: fixed;
|
|
62
73
|
white-space: nowrap;
|
|
74
|
+
height: auto;
|
|
75
|
+
border-radius: 3px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[row-index] {
|
|
79
|
+
user-select: none;
|
|
80
|
+
width: 56px;
|
|
81
|
+
padding-right: 10px;
|
|
82
|
+
text-align: right;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
>tbody {
|
|
86
|
+
[row-index] {
|
|
87
|
+
background: #fff;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
63
90
|
|
|
91
|
+
[fixed] {
|
|
92
|
+
z-index: 2;
|
|
64
93
|
}
|
|
65
94
|
|
|
66
95
|
>thead {
|
|
67
96
|
user-select: none;
|
|
68
97
|
line-height: 36px;
|
|
98
|
+
min-width: 100%;
|
|
69
99
|
|
|
70
100
|
>tr {
|
|
71
101
|
|
|
72
102
|
>td,
|
|
73
103
|
>th {
|
|
74
|
-
padding: @cell-padding;
|
|
75
104
|
position: relative;
|
|
76
105
|
color: #fff;
|
|
77
|
-
background-color: #
|
|
106
|
+
background-color: #395268;
|
|
78
107
|
}
|
|
79
108
|
}
|
|
80
109
|
}
|
|
@@ -83,27 +112,30 @@ table,
|
|
|
83
112
|
line-height: 32px;
|
|
84
113
|
height: 100%;
|
|
85
114
|
min-height: 30px;
|
|
86
|
-
border-top: 4px solid #6669;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
115
|
user-select: auto;
|
|
91
116
|
|
|
92
117
|
>tr {
|
|
93
118
|
|
|
94
119
|
>td,
|
|
95
120
|
>th {
|
|
96
|
-
padding: @cell-padding;
|
|
97
121
|
position: relative;
|
|
98
122
|
overflow: hidden;
|
|
99
123
|
}
|
|
100
124
|
|
|
101
125
|
&:nth-of-type(odd) {
|
|
102
|
-
|
|
126
|
+
|
|
127
|
+
>td,
|
|
128
|
+
>th {
|
|
129
|
+
background-color: #fff;
|
|
130
|
+
}
|
|
103
131
|
}
|
|
104
132
|
|
|
105
133
|
&:nth-of-type(even) {
|
|
106
|
-
|
|
134
|
+
|
|
135
|
+
>td,
|
|
136
|
+
th {
|
|
137
|
+
background-color: #f2f4f6;
|
|
138
|
+
}
|
|
107
139
|
}
|
|
108
140
|
|
|
109
141
|
|
|
@@ -111,7 +143,7 @@ table,
|
|
|
111
143
|
|
|
112
144
|
>td,
|
|
113
145
|
>th {
|
|
114
|
-
background: #
|
|
146
|
+
background: #e9edf2;
|
|
115
147
|
}
|
|
116
148
|
}
|
|
117
149
|
}
|
|
@@ -131,18 +163,13 @@ table,
|
|
|
131
163
|
}
|
|
132
164
|
|
|
133
165
|
|
|
134
|
-
|
|
166
|
+
[inline-block] {
|
|
135
167
|
|
|
136
168
|
>th,
|
|
137
169
|
>td {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
user-select: none;
|
|
142
|
-
// pointer-events: none;
|
|
143
|
-
background: #fff;
|
|
144
|
-
text-align: right;
|
|
145
|
-
}
|
|
170
|
+
white-space: nowrap;
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
display: inline-block;
|
|
146
173
|
}
|
|
147
174
|
}
|
|
148
175
|
|
package/coms/zimoli/vbox.js
CHANGED
|
@@ -6,17 +6,21 @@ function ybox(generator) {
|
|
|
6
6
|
} else {
|
|
7
7
|
_box = createElement(div);
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
var _tmp = isFunction(generator) && generator(_box);
|
|
10
|
+
if (isNode(_tmp)) _box = _tmp;
|
|
11
|
+
var _box_height = _box.$height || _box.height;
|
|
12
|
+
var _box_Height = _box.$Height || _box.Height;
|
|
13
|
+
var _box_Top = _box.$Top || _box.Top;
|
|
14
|
+
if (!isFunction(_box_height)) _box_height = function () {
|
|
10
15
|
return _box.clientHeight;
|
|
11
16
|
};
|
|
12
|
-
isFunction(generator) && generator(_box);
|
|
13
17
|
// totalHeight
|
|
14
|
-
|
|
18
|
+
if (!isFunction(_box_Height)) _box_Height = function () {
|
|
15
19
|
return _box.scrollHeight;
|
|
16
20
|
};
|
|
17
21
|
// currentTop
|
|
18
22
|
var _scrolledTop = _box.scrollTop;
|
|
19
|
-
|
|
23
|
+
if (!isFunction(_box_Top)) _box_Top = function (top) {
|
|
20
24
|
if (isNumber(top)) {
|
|
21
25
|
if (_box.scrollTop !== top) {
|
|
22
26
|
_box.scrollTop = top;
|
|
@@ -25,17 +29,20 @@ function ybox(generator) {
|
|
|
25
29
|
}
|
|
26
30
|
return _box.scrollTop;
|
|
27
31
|
};
|
|
28
|
-
_box
|
|
29
|
-
|
|
32
|
+
if (_box.$Height !== _box_Height) _box.$Height = _box_Height;
|
|
33
|
+
if (_box.$height !== _box_height) _box.$height = _box_height;
|
|
34
|
+
if (_box.$Top !== _box_Top) _box.$Top = _box_Top;
|
|
35
|
+
_box.$scrollY = function (deltay, useIncrease = _box.useIncrease !== false) {
|
|
36
|
+
var _Top = _box.$Top();
|
|
30
37
|
var top = _Top + deltay;
|
|
31
|
-
var height = _box
|
|
32
|
-
var scrollHeight = _box
|
|
38
|
+
var height = _box.$height();
|
|
39
|
+
var scrollHeight = _box.$Height();
|
|
33
40
|
var r = true;
|
|
34
41
|
if (top < 0) {
|
|
35
42
|
if (useIncrease && _Top <= 0) {
|
|
36
43
|
r = increase(top);
|
|
37
44
|
}
|
|
38
|
-
_box
|
|
45
|
+
_box.$Top(0);
|
|
39
46
|
} else if (top + height >= scrollHeight) {
|
|
40
47
|
if (top + height - scrollHeight > increase_height) {
|
|
41
48
|
top = increase_height + scrollHeight - height;
|
|
@@ -43,9 +50,9 @@ function ybox(generator) {
|
|
|
43
50
|
if (useIncrease && top + height >= scrollHeight) {
|
|
44
51
|
r = increase(top + height - scrollHeight);
|
|
45
52
|
}
|
|
46
|
-
_box
|
|
53
|
+
_box.$Top(top);
|
|
47
54
|
} else {
|
|
48
|
-
r = top !== _box
|
|
55
|
+
r = top !== _box.$Top(top);
|
|
49
56
|
increase(deltay, true);
|
|
50
57
|
}
|
|
51
58
|
return r;
|
|
@@ -57,14 +64,14 @@ function ybox(generator) {
|
|
|
57
64
|
var _decrease = function (increaser) {
|
|
58
65
|
var height = parseInt(increaser.height);
|
|
59
66
|
if (height > 1) {
|
|
60
|
-
var scrollTop = _box
|
|
67
|
+
var scrollTop = _box.$Top();
|
|
61
68
|
if (scrollTop > 0 && increaser_t === increaser) {
|
|
62
69
|
var deltaY = scrollTop > height ? height : scrollTop;
|
|
63
70
|
height -= deltaY;
|
|
64
|
-
_box
|
|
71
|
+
_box.$Top(scrollTop - deltaY);
|
|
65
72
|
}
|
|
66
|
-
var tH = _box
|
|
67
|
-
var bH = _box
|
|
73
|
+
var tH = _box.$Height();
|
|
74
|
+
var bH = _box.$height();
|
|
68
75
|
if (scrollTop + bH < tH && increaser_b === increaser) {
|
|
69
76
|
var deltaY = tH - bH - scrollTop > height ? height : tH - bH - scrollTop;
|
|
70
77
|
height -= deltaY;
|
|
@@ -81,7 +88,7 @@ function ybox(generator) {
|
|
|
81
88
|
remove(increaser);
|
|
82
89
|
return 0;
|
|
83
90
|
};
|
|
84
|
-
var stop = _box.stopY;
|
|
91
|
+
var stop = _box.$stopY || _box.stopY;
|
|
85
92
|
var stop2 = lazy(function () {
|
|
86
93
|
scrollY.smooth(stop);
|
|
87
94
|
}, 40);
|
|
@@ -128,6 +135,7 @@ function ybox(generator) {
|
|
|
128
135
|
} else {
|
|
129
136
|
var wheelTime = 0;
|
|
130
137
|
onmousewheel(_box, function (event) {
|
|
138
|
+
event.preventDefault();
|
|
131
139
|
if (event.timeStamp - wheelTime > 40 && Math.abs(event.deltaY) < 12) {
|
|
132
140
|
wheelTime = event.timeStamp;
|
|
133
141
|
return;
|
|
@@ -151,7 +159,7 @@ function ybox(generator) {
|
|
|
151
159
|
scrollY.reset();
|
|
152
160
|
},
|
|
153
161
|
move(scrolled) {
|
|
154
|
-
var y = -
|
|
162
|
+
var y = -_box.$Top();
|
|
155
163
|
if (scrolled) {
|
|
156
164
|
var { deltay } = scrolled;
|
|
157
165
|
scrollY.call(this, -deltay);
|
package/coms/zimoli/vscroll.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
var scroll = function () {
|
|
2
2
|
var scrollY = function (deltay, useIncrease) {
|
|
3
3
|
deltay = scrollOutside.call(this, deltay);
|
|
4
|
-
if (isFunction(this
|
|
4
|
+
if (isFunction(this.$scrollY)) return this.$scrollY(deltay, useIncrease);
|
|
5
5
|
var scrollTop = this.scrollTop;
|
|
6
6
|
this.scrollTop += deltay;
|
|
7
7
|
if (this.scrollTop === scrollTop) return false;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
var Height = function () {
|
|
11
|
-
if (isFunction(this
|
|
11
|
+
if (isFunction(this.$Height)) return this.$Height();
|
|
12
12
|
return this.scrollHeight;
|
|
13
13
|
};
|
|
14
14
|
var Top = function () {
|
|
15
|
-
if (isFunction(this
|
|
15
|
+
if (isFunction(this.$Top)) return this.$Top();
|
|
16
16
|
return this.scrollTop;
|
|
17
17
|
};
|
|
18
18
|
var height = function () {
|
|
19
|
-
if (isFunction(this.height)) return this
|
|
19
|
+
if (isFunction(this.height)) return this.$height();
|
|
20
20
|
return this.clientHeight;
|
|
21
21
|
};
|
|
22
22
|
var { max, min } = Math;
|