efront 3.12.3 → 3.13.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.
Files changed (42) hide show
  1. package/apps/pivot/api.yml +1 -0
  2. package/apps/pivot/home/welcome.html +1 -1
  3. package/apps/pivot/home/welcome.js +6 -9
  4. package/apps/pivot/log/count.html +1 -0
  5. package/apps/pivot/log/count.js +15 -0
  6. package/apps/pivot/log/count.less +8 -0
  7. package/apps/pivot/menu.yml +3 -1
  8. package/apps/pivot/share/list.less +0 -4
  9. package/coms/basic/{_cross.js → cross_.js} +9 -9
  10. package/coms/basic/parseYML.js +1 -1
  11. package/coms/frame/route.js +1 -0
  12. package/coms/kugou/parseSongsList.js +0 -1
  13. package/coms/reptile/cross.js +1 -1
  14. package/coms/zimoli/AudioContext_test.html +1 -1
  15. package/coms/zimoli/AudioContext_test.js +3 -3
  16. package/coms/zimoli/bind.js +4 -2
  17. package/coms/zimoli/cloneVisible.js +9 -2
  18. package/coms/zimoli/cross.js +3 -3
  19. package/coms/zimoli/css.js +13 -5
  20. package/coms/zimoli/data.js +6 -5
  21. package/coms/zimoli/drag.js +3 -2
  22. package/coms/zimoli/list.js +6 -6
  23. package/coms/zimoli/menu.js +33 -13
  24. package/coms/zimoli/menu.less +31 -9
  25. package/coms/zimoli/menuItem.js +1 -1
  26. package/coms/zimoli/menuList.html +5 -3
  27. package/coms/zimoli/menuList.js +63 -28
  28. package/coms/zimoli/menuList.less +5 -0
  29. package/coms/zimoli/model.js +1 -1
  30. package/coms/zimoli/on.js +5 -3
  31. package/coms/zimoli/picture.js +30 -335
  32. package/coms/zimoli/picture_.js +356 -0
  33. package/coms/zimoli/render.js +11 -2
  34. package/coms/zimoli/select.js +5 -5
  35. package/coms/zimoli/selectList.js +5 -2
  36. package/coms/zimoli/slider.js +13 -6
  37. package/coms/zimoli/table.html +6 -8
  38. package/coms/zimoli/table.js +25 -2
  39. package/coms/zimoli/table.less +24 -4
  40. package/coms/zimoli/vbox.js +1 -1
  41. package/package.json +1 -1
  42. package/public/efront.js +1 -1
@@ -0,0 +1,356 @@
1
+ var mountedPictures = [];
2
+ on("resize")(window, function () {
3
+ mountedPictures.forEach(a => a.update());
4
+ });
5
+ var getstation = function (n, s) {
6
+ var scale = Math.pow(10, Math.round(Math.log(n) / Math.log(10)));
7
+ var step;
8
+ if (n / scale < 1) {
9
+ step = s ? .01 : .05;
10
+ } else {
11
+ step = s ? .05 : .1;
12
+ }
13
+ step = step * scale;
14
+ n = Math.round(n / step) * step;
15
+ return n;
16
+ };
17
+ var trimCoord = move.trimCoord;
18
+ var isequal = (a, b) => a === b || Math.abs((a - b) / (a + b)) < 1e-12;
19
+ function picture_(image = document.createElement("div")) {
20
+ var image_width, image_height;
21
+ var scaled, x, y, min_scale, loaded_scale, locked_scale, click_scale, loaded_x, loaded_y;
22
+ var origin_width, origin_height;
23
+ var max_scale = 10 * devicePixelRatio;
24
+ var shape = function () {
25
+ image.shape(x, y, scaled / devicePixelRatio, origin_rotate);
26
+ };
27
+ image.reshape = shape;
28
+ var park = function () {
29
+ if (image.park) image.park(x, y, scaled / devicePixelRatio, origin_rotate);
30
+ };
31
+ var setInitParams = function () {
32
+ if (!image.width) return;
33
+ image_width = image.width / devicePixelRatio;
34
+ image_height = image.height / devicePixelRatio;
35
+ origin_width = image.clientWidth;
36
+ origin_height = image.clientHeight;
37
+ origin_rotate = 0;
38
+ locked_scale = loaded_scale = Math.min(image.clientHeight / image_height, image.clientWidth / image_width);
39
+ if (loaded_scale >= 0.9) {
40
+ if (loaded_scale < 1.2) {
41
+ click_scale = 1;
42
+ loaded_scale = .8;
43
+ } else if (loaded_scale < max_scale) {
44
+ click_scale = loaded_scale;
45
+ loaded_scale = 1;
46
+ } else {
47
+ click_scale = max_scale;
48
+ loaded_scale = 1;
49
+ }
50
+ } else {
51
+ click_scale = 1;
52
+ }
53
+ loaded_x = (image.clientWidth - image_width * loaded_scale) / 2;
54
+ loaded_y = (image.clientHeight - image_height * loaded_scale) / 2;
55
+ min_scale = loaded_scale * .75;
56
+ scaled = loaded_scale;
57
+ x = loaded_x;
58
+ y = loaded_y;
59
+ updatexy();
60
+ set_unlock();
61
+ };
62
+ var set_unlock = function () {
63
+ if (!loaded_scale) return;
64
+ fixpos();
65
+ shape();
66
+ };
67
+
68
+ on("append")(image, setInitParams);
69
+
70
+ on("append")(image, function () {
71
+ mountedPictures.push(image);
72
+ });
73
+ on("remove")(image, function () {
74
+ removeFromList(mountedPictures, image);
75
+ });
76
+ image.init = setInitParams;
77
+ image.locked = false;
78
+ var last_click_time = 0;
79
+
80
+ on("click")(image, function (event) {
81
+ var time = +new Date;
82
+ var delta_time = time - last_click_time;
83
+ last_click_time = time;
84
+ if (delta_time > 300) return;
85
+ var image = this;
86
+ var __scaled = scaled, _x = x, _y = y;
87
+ setInitParams();
88
+ image.locked = isequal(__scaled, loaded_scale) && isequal(loaded_x, x) && isequal(loaded_y, y);
89
+ var layerx = event.offsetX || 0;
90
+ var layery = event.offsetY || 0;
91
+ if (layerx)
92
+ if (image.locked) {
93
+ var width = image_width * loaded_scale, height = image_height * loaded_scale;
94
+ if (layerx > loaded_x + width || layerx < loaded_x || width < image.offsetWidth >> 2) {
95
+ layerx = loaded_x + width / 2;
96
+ }
97
+ if (layery > loaded_y + height || layery < loaded_y || height < image.offsetHeight >> 2) {
98
+ layery = loaded_y + height / 2;
99
+ }
100
+ scale(layerx, layery, click_scale / loaded_scale);
101
+ } else {
102
+ set_unlock();
103
+ }
104
+ });
105
+ image.getScale = function () {
106
+ if (!this.locked && !loaded_scale) {
107
+ setInitParams();
108
+ }
109
+ return +String(+scaled + 0.00005).slice(0, 6);
110
+ };
111
+ var fixpos = function () {
112
+ var width = image_width * scaled;
113
+ var height = image_height * scaled;
114
+ var r = image.rotate | 0;
115
+ var [, , w, h] = getrotatedltwh(r);
116
+ var x0 = x + (width - w) / 2;
117
+ var y0 = y + (height - h) / 2;
118
+ var [x1, y1] = trimCoord([image.clientWidth, image.clientHeight], [x0, y0, w, h], -1);
119
+ x += x1 - x0;
120
+ y += y1 - y0;
121
+ };
122
+ var scale = function (layerx, layery, ratio) {
123
+ if (!image.locked) return;
124
+ scaled *= ratio;
125
+ x = (x - layerx) * ratio + layerx;
126
+ y = (y - layery) * ratio + layery;
127
+ shape();
128
+ };
129
+ var touch = function ([x1, y1, x2, y2], [m1, n1, m2, n2]) {
130
+ var l1 = Math.sqrt(Math.pow(m1 - m2, 2) + Math.pow(n1 - n2, 2));
131
+ var l2 = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
132
+ var scale = l1 / l2;
133
+ if (scaled >= max_scale * 1.1 && scale > 1) return;
134
+ if (scaled <= min_scale && scale < 1) return;
135
+ scaled *= scale;
136
+ var centerx = (x1 + x2) / 2;
137
+ var centery = (y1 + y2) / 2;
138
+ var centerm = (m1 + m2) / 2;
139
+ var centern = (n1 + n2) / 2;
140
+ x = (x - centerx) * scale + centerm;
141
+ y = (y - centery) * scale + centern;
142
+ shape();
143
+ };
144
+ var recover = function (change) {
145
+ var aimed_scale = getstation(scaled);
146
+ if (aimed_scale !== scaled) {
147
+ change = true;
148
+ x = (x - image.clientWidth / 2) / scaled * aimed_scale + image.clientWidth / 2;
149
+ y = (y - image.clientHeight / 2) / scaled * aimed_scale + image.clientHeight / 2;
150
+ scaled = aimed_scale;
151
+ }
152
+ if (scaled <= loaded_scale * 1.2) {
153
+ scaled = loaded_scale;
154
+ x = loaded_x;
155
+ y = loaded_y;
156
+ change = true;
157
+ }
158
+ if (scaled > max_scale) {
159
+ change = true;
160
+ x = (x - image.clientWidth / 2) * max_scale / scaled + image.clientWidth / 2;
161
+ y = (y - image.clientHeight / 2) * max_scale / scaled + image.clientHeight / 2;
162
+ scaled = max_scale;
163
+ }
164
+ var saved_x = x, saved_y = y;
165
+ fixpos();
166
+ if (change || saved_x !== x || saved_y !== y) {
167
+ park();
168
+ }
169
+ };
170
+ var move = inertia(function (deltax, deltay) {
171
+ var saved_x = x, saved_y = y;
172
+ x += deltax, y += deltay;
173
+ fixpos();
174
+ shape();
175
+ if (saved_x === x && saved_y === y) return false;
176
+ });
177
+ var saved_event, wheeltime;
178
+ onmousewheel(image, function (event) {
179
+ var { offsetX: layerX, offsetY: layerY, deltaY } = event;
180
+ if (this.locked) event.preventDefault();
181
+ if (!deltaY) return;
182
+ if (!this.locked) setInitParams();
183
+ this.locked = true;
184
+ var ratio = Math.pow(0.99, 20 * Math.atan(deltaY / 20));
185
+ var __scaled = scaled;
186
+ __scaled *= ratio;
187
+ if (__scaled > max_scale && ratio > 1) {
188
+ __scaled = max_scale;
189
+ }
190
+ if (__scaled < min_scale && ratio < 1) {
191
+ __scaled = min_scale;
192
+ }
193
+ ratio = __scaled / scaled;
194
+ scale(layerX, layerY, ratio);
195
+ });
196
+ moveupon(image, {
197
+ start(event) {
198
+ event.preventDefault();
199
+ saved_event = event;
200
+ event.moveLocked = scaled > locked_scale;
201
+ if (!this.locked) {
202
+ setInitParams();
203
+ }
204
+ move.reset();
205
+ },
206
+ move(event) {
207
+ if (event.moveLocked) return;
208
+ event.moveLocked = scaled > locked_scale;
209
+ event.preventDefault();
210
+ if (event.touches && saved_event.touches) {
211
+ if (event.touches.length !== saved_event.touches.length) {
212
+ saved_event = event;
213
+ return;
214
+ }
215
+
216
+ switch (event.touches.length) {
217
+ case 1:
218
+ if (!this.locked) return;
219
+ break;
220
+ case 2:
221
+ this.locked = true;
222
+ event.moveLocked = true;
223
+ var [xy1, xy2] = saved_event.touches;
224
+ var [mn1, mn2] = event.touches;
225
+ var { left, top } = getScreenPosition(image);
226
+ top += image.clientTop;
227
+ left += image.clientLeft;
228
+ touch(
229
+ [xy1.clientX - left, xy1.clientY - top, xy2.clientX - left, xy2.clientY - top],
230
+ [mn1.clientX - left, mn1.clientY - top, mn2.clientX - left, mn2.clientY - top]
231
+ );
232
+ saved_event = event;
233
+ return;
234
+ }
235
+ }
236
+ if (event.which === 3) {
237
+ event.moveLocked = true;
238
+ rotatexy(saved_event.clientX, saved_event.clientY, event.clientX, event.clientY);
239
+ }
240
+ else {
241
+ if (!this.locked) return;
242
+ var deltax = event.clientX - saved_event.clientX,
243
+ deltay = event.clientY - saved_event.clientY;
244
+ move(deltax, deltay);
245
+ }
246
+ saved_event = event;
247
+ },
248
+ end(event) {
249
+ if (saved_event) {
250
+ if (event.timeStamp - saved_event.timeStamp > 120) {
251
+ move.reset();
252
+ }
253
+ }
254
+ saved_event = null;
255
+ event.moveLocked = scaled >= locked_scale;
256
+
257
+ if (this.locked && onclick.preventClick) move.smooth(recover);
258
+ }
259
+ });
260
+ var origin_rotate = 0;
261
+ var rotatexy = function (x1, y1, x2, y2) {
262
+ var centerx = image.clientWidth / 2, centery = image.clientHeight / 2;
263
+ var deltax = x2 - x1, deltay = y2 - y1;
264
+ var rx = x1 - centerx, ry = y1 - centery;
265
+ var sign = -ry * deltax + rx * deltay;
266
+ var delta = 90 * Math.sqrt(deltax * deltax + deltay * deltay) / Math.sqrt(rx * rx + ry * ry);
267
+ if (delta > 10) delta = 10;
268
+ if (sign) image.rotateBy(sign > 0 ? delta : -delta);
269
+ }
270
+ var updatexy = function () {
271
+ var deg = image.rotate - origin_rotate;
272
+ if (isFinite(deg)) {
273
+ origin_rotate = image.rotate;
274
+ [x, y] = getrotatedltwh(deg, scaled);
275
+ }
276
+ };
277
+ var getrotatedltwh = function (a, s = scaled) {
278
+ var w = image_width * s;
279
+ var h = image_height * s;
280
+ var c = [image.clientWidth / 2, image.clientHeight / 2];
281
+ var m = x + w / 2;
282
+ var n = y + h / 2;
283
+ var [c1, c2] = rotate([m, n], -a, c);
284
+ c1 -= w / 2;
285
+ c2 -= h / 2;
286
+ var a = origin_rotate;
287
+ var l = c[0] - w / 2;
288
+ var r = l + w;
289
+ var t = c[1] - h / 2;
290
+ var b = t + h;
291
+ var [x1, y1] = rotate([l, t], a, c);
292
+ var [x2, y2] = rotate([r, t], a, c);
293
+ var [x3, y3] = rotate([l, b], a, c);
294
+ var [x4, y4] = rotate([r, b], a, c);
295
+ var l = Math.min(x1, x2, x3, x4);
296
+ var t = Math.min(y1, y2, y3, y4);
297
+ var w = Math.max(x1, x2, x3, x4) - l;
298
+ var h = Math.max(y1, y2, y3, y4) - t;
299
+ return [c1, c2, w, h];
300
+ };
301
+ image.update = function (animate) {
302
+ if (image.locked) {
303
+ updatexy();
304
+ x += (image.clientWidth - origin_width) / 2;
305
+ y += (image.clientHeight - origin_height) / 2;
306
+ origin_height = image.clientHeight;
307
+ origin_width = image.clientWidth;
308
+ if (animate !== false) fixpos();
309
+ shape();
310
+ return;
311
+ }
312
+ setInitParams();
313
+ if (animate !== false) {
314
+ recover();
315
+ } else {
316
+ if (animate !== false) fixpos();
317
+ shape();
318
+ }
319
+
320
+ };
321
+ image.rotateTo = function (deg) {
322
+ this.rotate = deg;
323
+ this.update();
324
+ };
325
+ image.rotateBy = function (deg) {
326
+ var r = this.rotate | 0;
327
+ if (deg === 90 || deg === -90) {
328
+ r += deg;
329
+ if (deg > 0) {
330
+ // 九进八舍
331
+ var a = r / 90;
332
+ if (Math.ceil(a) - a < .01) {
333
+ r = Math.ceil(a) * 90;
334
+ } else {
335
+ r = Math.floor(a) * 90;
336
+ }
337
+ } else {
338
+ // 一进零舍
339
+ var a = r / 90;
340
+ if (Math.ceil(a) - a > .01) {
341
+ r = Math.ceil(a) * 90;
342
+ } else {
343
+ r = Math.floor(a) * 90;
344
+ }
345
+ }
346
+ } else {
347
+ r += deg;
348
+ }
349
+ this.rotate = r;
350
+ this.update(deg === 90 || deg === -90);
351
+ };
352
+ on("contextmenu")(image, function (e) {
353
+ if (onclick.preventClick) e.preventDefault();
354
+ });
355
+ return image;
356
+ }
@@ -624,7 +624,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
624
624
  if (parentNode.renderid > 1 || parentNode.isMounted) element.renderid = 2;
625
625
  }
626
626
  element.renders = element.renders ? [].concat(element.renders) : [];
627
- var { ons, copys, attrs, props, binds, context: withContext } = element.$struct;
627
+ var { ons, copys, attrs, props, binds, context: withContext, ids } = element.$struct;
628
628
  delete element.$struct;
629
629
  if (binds.src) {
630
630
  element.$src = parseRepeat(binds.src);
@@ -698,6 +698,9 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
698
698
  if (element.isMounted || element.renderid > 1) addRenderElement.call(element);
699
699
  }
700
700
  if (elementid) scope[elementid] = element;
701
+ for (var id of ids) {
702
+ scope[id] = element;
703
+ }
701
704
  return element;
702
705
  }
703
706
  function renderStructure(element, scope, parentScopes = []) {
@@ -721,8 +724,14 @@ function renderStructure(element, scope, parentScopes = []) {
721
724
  var binds = {};
722
725
  var attr1 = {};
723
726
  var props = {};
727
+ var ids = [];
724
728
  for (var attr of attrs) {
725
729
  var { name, value } = attr;
730
+ if (/^#/.test(name)) {
731
+ ids.push(name.slice(1));
732
+ element.removeAttribute(name);
733
+ continue;
734
+ };
726
735
  if (/^(?:class|style|src|\:|placeholder)$/i.test(name)) {
727
736
  copys.push(attr);
728
737
  continue;
@@ -771,7 +780,7 @@ function renderStructure(element, scope, parentScopes = []) {
771
780
  props[name.replace(/\-(\w)/g, (_, w) => w.toUpperCase())] = value === "" ? true : value;
772
781
  }
773
782
  }
774
- if (!element.$struct) element.$struct = { ons, copys, binds, attrs: attr1, props, context: withContext };
783
+ if (!element.$struct) element.$struct = { ons, copys, binds, attrs: attr1, props, context: withContext, ids };
775
784
  if (element.renderid <= -1) createStructure.call(element, types.if, types.repeat, withContext);
776
785
  }
777
786
  function render(element, scope, parentScopes) {
@@ -42,12 +42,12 @@ function select(target, list, removeOnSelect, direction) {
42
42
  direction = removeOnSelect;
43
43
  removeOnSelect = arguments[3];
44
44
  }
45
- if (direction === undefined) {
46
- direction = target.getAttribute("direction") || target.direction;
47
- }
48
45
  if (!target) {
49
46
  target = document.createElement("select");
50
47
  }
48
+ if (direction === undefined) {
49
+ direction = target.getAttribute("direction") || target.direction;
50
+ }
51
51
  target.tabIndex = 0;
52
52
  onblur(target, removeByBlur);
53
53
  if (/select/i.test(target.tagName)) {
@@ -116,7 +116,7 @@ function select(target, list, removeOnSelect, direction) {
116
116
  else if (target.$src) {
117
117
  var generator = getGenerator(target);
118
118
  var initList2 = function (src) {
119
- list = selectList(generator, src, target.multiple, target.editable);
119
+ list = selectList(generator, src, !!target.multiple, !!target.editable);
120
120
  if (!target.multiple) {
121
121
  onclick(list, onlistclick);
122
122
  }
@@ -158,7 +158,7 @@ function select(target, list, removeOnSelect, direction) {
158
158
  var allOptions = [].concat.apply([], target.querySelectorAll("option"));
159
159
  if (deepEqual.shallow(allOptions, savedOptions)) return;
160
160
  savedOptions = allOptions;
161
- list = selectList(allOptions, target.multiple, target.editable);
161
+ list = selectList(allOptions, !!target.multiple, !!target.editable);
162
162
  if (!target.multiple) {
163
163
  onclick(list, onlistclick);
164
164
  }
@@ -39,14 +39,17 @@ function main() {
39
39
  generator = a;
40
40
  break;
41
41
  case "boolean":
42
- if (multiple === void 0) multiple = a;
43
- else addable = a;
42
+ case "undefined":
43
+ if (multiple === void 0) multiple = !!a;
44
+ else addable = !!a;
45
+ break;
44
46
  case "object":
45
47
  if (isNode(a)) {
46
48
  page = a;
47
49
  if (!generator) generator = getGenerator(page);
48
50
  }
49
51
  else if (a.length) children = a;
52
+ break;
50
53
 
51
54
  }
52
55
  }
@@ -122,17 +122,23 @@ function slider(autoplay, circle = true) {
122
122
  };
123
123
  var park = function () {
124
124
  direction = 0;
125
- if (delta_negative_index > 0) {
126
- if (negative_index - floor(negative_index) > 0.3 / (1 + abs(_speed())))
125
+ var singleTarget = getSingleTarget();
126
+ if (singleTarget) {
127
+ negative_index = round(negative_index);
128
+ }
129
+ else if (delta_negative_index > 0) {
130
+ if (negative_index - floor(negative_index) > 0.2 / (1 + 6 * abs(_speed())))
127
131
  negative_index = ceil(negative_index);
128
132
  else
129
133
  negative_index = floor(negative_index);
130
- } else if (delta_negative_index < 0) {
131
- if (ceil(negative_index) - negative_index > 0.3 / (1 + abs(_speed())))
134
+ }
135
+ else if (delta_negative_index < 0) {
136
+ if (ceil(negative_index) - negative_index > 0.2 / (1 + 6 * abs(_speed())))
132
137
  negative_index = floor(negative_index);
133
138
  else
134
139
  negative_index = ceil(negative_index);
135
- } else {
140
+ }
141
+ else {
136
142
  negative_index = round(negative_index);
137
143
  }
138
144
  animate();
@@ -173,9 +179,10 @@ function slider(autoplay, circle = true) {
173
179
  }
174
180
  return enabled;
175
181
  };
182
+ var getSingleTarget = () => (!_imageMain || !_imageHelp) && (_imageMain || _imageHelp);
176
183
  var moveDeltaX = function (deltax, event) {
177
184
  var width = outter.clientWidth;
178
- var singleTarget = (!_imageMain || !_imageHelp) && (_imageMain || _imageHelp);
185
+ var singleTarget = getSingleTarget();
179
186
  if (singleTarget) {
180
187
  var current_Left = singleTarget.offsetLeft;
181
188
  var avail_deltaWidth = round(width >> 2);
@@ -1,16 +1,14 @@
1
- <thead>
2
- <tr>
3
- <td -repeat="f in fields track by f.id" :style="{width:f.width}"><i -if="f.icon"
1
+ <tbody -src="d in data" :style="{'max-height':((innerHeight-46)/32|0)*32+36}">
2
+ <tr thead #adapter insert>
3
+ <td -repeat="f in fields track by f.id" :style="{width:f.width}" @dblclick="sort(f)"><i -if="f.icon"
4
4
  -class="f.icon"></i></span><span -if="f.name" -html="f.name"></span>
5
5
  </td>
6
6
  </tr>
7
- </thead>
8
- <tbody -src="d in data">
9
7
  <tr>
10
8
  <td -repeat="f in fields">
11
- <model -if="f.key" :field=f :data=d readonly ></model>
12
- <a on-click="o.do(d)" -if="!f.key&&f.options&&(!o.when||o.when(d))" _type="o.type instanceof Function?o.type(d):o.type"
13
- -repeat="o in f.options">
9
+ <model -if="f.key" :field=f :data=d readonly></model>
10
+ <a on-click="o.do(d)" -if="!f.key&&f.options&&(!o.when||o.when(d))"
11
+ _type="o.type instanceof Function?o.type(d):o.type" -repeat="o in f.options">
14
12
  <span -text="o.name instanceof Function?o.name(d):o.name"></span>
15
13
  </a>
16
14
  </td>
@@ -169,8 +169,12 @@ function table(elem) {
169
169
  move: resizeTarget,
170
170
  });
171
171
  onmousemove(tableElement, function (event) {
172
- if (!thead) [thead] = table.getElementsByTagName("thead");
172
+ if (!thead) {
173
+ [thead] = table.getElementsByTagName("thead");
174
+ if (!thead) thead = table.querySelector('[thead]');
175
+ }
173
176
  if (!getTargetIn(thead, event.target)) return;
177
+
174
178
  var tds = getTargetIn(cellMatchManager, event.target);
175
179
  if (!isArray(tds)) tds = [];
176
180
  tds.map(function (td) {
@@ -193,7 +197,10 @@ function table(elem) {
193
197
  var table = tableElement;
194
198
  var thead;
195
199
  var cellMatchManager = function (element) {
196
- if (!thead) [thead] = table.getElementsByTagName("thead");
200
+ if (!thead) {
201
+ [thead] = table.getElementsByTagName("thead");
202
+ if (!thead) thead = table.querySelector('[thead]');
203
+ }
197
204
  if (table.resizing) return false;
198
205
  if (!getTargetIn(thead, element)) return false;
199
206
  if (!tdElementReg.test(element.tagName)) return false;
@@ -214,8 +221,24 @@ function table(elem) {
214
221
  render(this, {
215
222
  fields,
216
223
  tbody: list,
224
+ innerHeight: {
225
+ valueOf() {
226
+ return innerHeight - getScreenPosition(table).top;
227
+ }
228
+ },
217
229
  data,
230
+ adapter: null,
218
231
  model,
232
+ sort(f) {
233
+ f.sign = f.sign > 0 ? -1 : 1;
234
+ data.sort(function (a, b) {
235
+ a = seek(a, f.key);
236
+ b = seek(b, f.key);
237
+ if (a > b) return f.sign;
238
+ if (a < b) return -f.sign;
239
+ return 0;
240
+ });
241
+ },
219
242
  setWidth(target, f) {
220
243
  css(target, { width: f.width });
221
244
  },
@@ -75,9 +75,11 @@ table,
75
75
  line-height: 32px;
76
76
  height: 100%;
77
77
  min-height: 30px;
78
+ border-top: 4px solid #6669;
79
+
80
+
81
+
78
82
  user-select: auto;
79
- display: table-row-group;
80
- overflow: auto;
81
83
 
82
84
  >tr {
83
85
 
@@ -85,9 +87,10 @@ table,
85
87
  >th {
86
88
  padding: @cell-padding;
87
89
  position: relative;
90
+ overflow: hidden;
88
91
  }
89
92
 
90
- &:nth-of-type(even) {
93
+ &:nth-of-type(odd) {
91
94
 
92
95
  >td,
93
96
  >th {
@@ -95,7 +98,7 @@ table,
95
98
  }
96
99
  }
97
100
 
98
- &:nth-of-type(odd) {
101
+ &:nth-of-type(even) {
99
102
 
100
103
  >td,
101
104
  >th {
@@ -111,6 +114,23 @@ table,
111
114
  }
112
115
  }
113
116
  }
117
+
118
+ >tr[insert] {
119
+ position: sticky;
120
+ top: 0;
121
+ z-index: 1;
122
+
123
+ >td {
124
+ background: #6669;
125
+ backdrop-filter: blur(20px);
126
+ z-index: 1;
127
+ color: #fff;
128
+ }
129
+ }
130
+ }
131
+
132
+ [thead] {
133
+ user-select: none;
114
134
  }
115
135
 
116
136
  .button {
@@ -201,7 +201,7 @@ function ybox(generator) {
201
201
  }
202
202
  this.YScrollBoxId = +scrollId + 1;
203
203
  }
204
- if (_box.isMounted) initScrollId.call(_box);
204
+ if (isMounted(_box)) initScrollId.call(_box);
205
205
  on("append")(_box, initScrollId);
206
206
  _box.cancelFrame = function () {
207
207
  cancelAnimationFrame(smooth_timer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.12.3",
3
+ "version": "3.13.1",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {