efront 3.35.3 → 3.35.4

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.
@@ -23,6 +23,7 @@ var {
23
23
  console,
24
24
  efrontURI,
25
25
  parseFloat,
26
+ encodeURI,
26
27
  preventFrame,
27
28
  PREVENT_FRAMEWORK_MODE = preventFrame,
28
29
  devicePixelRatio = 1,
@@ -46,6 +47,7 @@ var efront_time = +new Date;
46
47
  var _devicePixelRatio = devicePixelRatio;
47
48
  var request = window.request || function (url, onload, onerror, version) {
48
49
  var xhr = new (XMLHttpRequest || ActiveXObject)("Microsoft.XMLHTTP");
50
+ url = encodeURI(url);
49
51
  xhr.open("POST", url);
50
52
  xhr.onreadystatechange = function () {
51
53
  if (xhr.readyState === 4) {
@@ -41,20 +41,25 @@ function inertia(gun) {
41
41
  var id = smooth_timer;
42
42
  var res = gun.apply(that, args);
43
43
  if (id !== smooth_timer) return;
44
+
44
45
  if (false === res) {
45
46
  spd.reset();
46
47
  train.state = 回弹;
47
48
  smooth_timer = requestAnimationFrame(_decrease);
48
49
  return;
49
50
  }
50
- if (decrease && args.filter(a => Math.abs(a) > 1).length === 0) {
51
+ if (args.stop || rate && args.rate < rate) {
52
+ if (!decrease) {
53
+ train.state = 停止;
54
+ return;
55
+ }
51
56
  train.state = 回弹;
52
57
  smooth_timer = requestAnimationFrame(_decrease);
53
58
  return;
54
59
  }
55
60
  smooth_timer = requestAnimationFrame(smooth);
56
61
  };
57
- var spd, smooth_timer, that, decrease;
62
+ var spd, smooth_timer, that, decrease, rate;
58
63
  var train = function () {
59
64
  _cancel();
60
65
  var args = [].slice.call(arguments, 0, arguments.length);
@@ -63,9 +68,10 @@ function inertia(gun) {
63
68
  gun.apply(this, args);
64
69
  that = this;
65
70
  };
66
- train.smooth = function (d) {
71
+ train.smooth = function (d, r) {
67
72
  _cancel();
68
73
  decrease = d;
74
+ rate = r;
69
75
  if (train.state === 移动) {
70
76
  train.state = 减速;
71
77
  smooth_timer = requestAnimationFrame(smooth);
@@ -162,16 +168,20 @@ class Speed extends Array {
162
168
  for (var v of values) sum += v * v;
163
169
  v = Math.sqrt(sum);
164
170
  var a = this.accelerate * Math.atan(v + 1);
171
+ values.rate = v;
165
172
  if (v > a + 1e-14) {
166
173
  v = Math.sqrt(v * (v - a)) / v;
167
174
  }
168
175
  else {
169
- v = 1e-9;
176
+ if (v < 1e-6) {
177
+ values.stop = true;
178
+ }
179
+ v = 0.6180339887498949;
170
180
  }
171
181
  var r = ratio * v;
172
182
  for (var cx = 0, dx = values.length; cx < dx; cx++) {
173
183
  values[cx] *= r;
174
- if (Math.abs(this[cx]) > .1) this[cx] *= v;
184
+ if (Math.abs(this[cx]) > 1e-16) this[cx] *= v;
175
185
  }
176
186
  return values;
177
187
  }
@@ -0,0 +1,58 @@
1
+ var test = function (queue, wait = 40) {
2
+ var spd = new Speed;
3
+ var now = 0;
4
+ var writted = [];
5
+ for (var cx = 0, dx = queue.length; cx < dx; cx++) {
6
+ var s = queue[cx];
7
+ if (s instanceof Array && !Array.isArray(queue[cx + 1])) {
8
+ spd.write(s, now = queue[++cx]);
9
+ writted.push(s, now);
10
+ }
11
+ else {
12
+ spd.write([].concat(s), now = cx * 16 + 20 + Math.random() * 16);
13
+ writted.push([].concat(s), now);
14
+ }
15
+ }
16
+ for (var cx = now + wait, dx = now + 20000; cx < dx; cx += 16 + Math.random() * 16) {
17
+ var a = spd.read(cx);
18
+ if (a.stop) break;
19
+ }
20
+ if (!a.stop) {
21
+ console.log("测试数据:", writted, "\r\n当前状态:", a);
22
+ throw `已等待 ${+((cx - now) / 1000).toFixed(3)} 秒,未停止运行`;
23
+ }
24
+ console.log(cx - now, a.stop);
25
+ };
26
+ Speed.debug = true;
27
+ test([
28
+ [2.1878654669544666],
29
+ 27.956586758709825,
30
+ [2.1878654669544666],
31
+ 37.21775999809554,
32
+ [3.1878654669544666],
33
+ 67.83162606867668
34
+ ])
35
+ test([1.1878654669544668, 1.1878654669544668, 1.1878654669544668]);
36
+ test([2.1878654669544668, 2.1878654669544668, 3.1878654669544668]);
37
+ test([
38
+ 0.3251661026176258,
39
+ 0.44988734829376603,
40
+ 0.43652435853899707,
41
+ 0.43652435853899707,
42
+ 0.47438616350792273,
43
+ 0.4253885330796093,
44
+ 0.5300652921323553,
45
+ 0.5256109608866051,
46
+ ]);
47
+ test([
48
+ [0, false], 2880.300000011921,
49
+ [0, false], 2894.300000011921,
50
+ [0, false], 2969,
51
+ [0, false], 2971.199999988079,
52
+ [0, false], 3019.600000023842,
53
+ [0, false], 3026.800000011921,
54
+ [0, false], 3044.5,
55
+ [0, false], 3114.900000035763,
56
+ [0, false], 3250.199999988079,
57
+ [0, false], 3314.699999988079
58
+ ], 900);
@@ -243,7 +243,7 @@ Html.prototype.createString = function (code) {
243
243
  for (var c of code) {
244
244
  switch (c.type) {
245
245
  case PIECE:
246
- if (p && p.type === PIECE) dist.push(" ");
246
+ if (p && p.type & (PIECE | EXPRESS)) dist.push(" ");
247
247
  dist.push(c.text);
248
248
  break;
249
249
  case SPACE:
@@ -549,6 +549,9 @@ class Program {
549
549
  var scope = [];
550
550
  scope.entry = m;
551
551
  scope.type = SCOPED;
552
+ scope.start = match.index;
553
+ scope.col = match.index - colstart;
554
+ scope.row = row;
552
555
  var last = queue.last;
553
556
  if (m === "{") {
554
557
  if (!last) {
@@ -579,7 +582,6 @@ class Program {
579
582
  scope.isExpress = queue.inExpress;
580
583
  scope.inExpress = true;
581
584
  }
582
- scope.start = match.index;
583
585
  push_parents(scope);
584
586
  continue;
585
587
  }
@@ -596,13 +598,13 @@ class Program {
596
598
  pop_parents();
597
599
  continue;
598
600
  }
599
-
601
+ if (this.scope_leave[m]) console.warn("标记不匹配", queue.entry, m, "queue:", `${queue.row}:${queue.col}`, "position:", `${row}:${index - colstart}\r\n`, text.slice(queue.start, index));
600
602
  if (this.stamp_reg.test(m)) {
601
603
  save(STAMP);
602
604
  }
603
605
 
604
606
  }
605
- if (queue !== origin) throw console.log(createString(origin), createString([queue])), new Error("代码异常结束");
607
+ if (queue !== origin) throw console.log(createString(origin), `\r\n------ deep: ${parents.length} - enrty: ${queue.entry} - length: ${queue.length} - last: ${createString([queue.last])} -----\r\n`, createString([queue])), "代码异常结束";
606
608
  return queue;
607
609
  }
608
610
  commit() {
@@ -619,11 +621,13 @@ class Program {
619
621
  quoteslike.forEach(q => {
620
622
  var a = q[0];
621
623
  if (a instanceof RegExp) a = stringsFromRegExp(a);
622
- if (typeof a === "string" && a.length === 1) tokens[a] = true;
623
624
  if (a instanceof Array) {
624
- a.forEach(a => quote_map[a] = q);
625
+ a.forEach(a => {
626
+ quote_map[a] = q;
627
+ tokens[a.charAt(0)] = true;
628
+ });
625
629
  }
626
- else quote_map[a] = q;
630
+ else quote_map[a] = q, tokens[a.charAt(0)] = true;
627
631
  var r = q.slice(q[2] ? 2 : 3).concat(q[1]).map(q => {
628
632
  if (q instanceof Array) {
629
633
  q = q[q.length - 2];
@@ -76,7 +76,7 @@ source += source.toUpperCase() + "_$";
76
76
  var number = source + '0123456789';
77
77
  // source += "ªµºΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρςστυφχψω";
78
78
  source += function () {
79
- var reg = /\xAA\xB5\xBA\xC0-\xD5\xD8-\xF2\xF8-\u02af\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA/;
79
+ var reg = /\xAA\xB5\xBA\xC0-\xD5\xD8-\xF2\xF8-\u02AF\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0523\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA/;
80
80
  var dist = [];
81
81
  reg.source.replace(/\\[xu]([0-9a-f]+)(?:\-\\[xu]([0-9a-f]+))?/ig, function (_, a, b) {
82
82
  a = parseInt(a, 16);
@@ -96,15 +96,21 @@ function testJsxOnlyHtml() {
96
96
  <component1 ng-bind="expression"><child1></child1></component1>`);
97
97
  console.log(m.toString());
98
98
  }
99
+ function testSpaceLess() {
100
+ var m = scanner(`if(n<0)return'_f("'+t+'")('+e+")"`);
101
+ console.log(m.toString());
102
+ }
103
+ Program.debug = true;
99
104
  // testSpeed();
100
105
  // testVariables();
101
106
  // testRegexp();
102
107
  // testStatic();
103
108
  // testAssign();
104
109
  // testFormat();
105
- testJsx();
106
- testJsx2();
110
+ // testJsx();
111
+ // testJsx2();
107
112
  // testJsx3();
108
- testJsxOnlyHtml();
113
+ // testJsxOnlyHtml();
114
+ testSpaceLess();
109
115
  // var typescript = require("../typescript/index");
110
116
  // typescript.transpile(data.toString(), { noEmitHelpers: true });
@@ -70,6 +70,7 @@ var scrollX = function (targetBox, moveChildren) {
70
70
  scrollDelta = dragPosition.right + 20 - areaPosition.right;
71
71
  }
72
72
  if (scrollDelta) {
73
+ if (targetBox === document.documentElement) return;
73
74
  vscroll.X.call(targetBox, scrollDelta / 16, false);
74
75
  moveChildren();
75
76
  }
@@ -20,7 +20,7 @@ function main(elem = document.createElement("checkbox-group")) {
20
20
  options,
21
21
  select(a) {
22
22
  a.checked = !a.checked;
23
- elem.value = this.options.filter(a => !!a.checked);
23
+ elem.checked = elem.value = this.options.filter(a => !!a.checked);
24
24
  buildValue(elem.value, this.options);
25
25
  dispatch(elem, 'change');
26
26
  }
@@ -308,6 +308,7 @@ function grid(breakpoints) {
308
308
  }
309
309
  class Point extends Array {
310
310
  constructor(value, range) {
311
+ super();
311
312
  var solid = false;
312
313
  if (isObject(value)) {
313
314
  this.value = value.value;
@@ -390,7 +390,7 @@ function ylist(container, generator, $Y) {
390
390
  }
391
391
  if (absy <= 1) y = target_y;
392
392
  else {
393
- var speed = Math.abs(spd.read()[0]);
393
+ var speed = spd.read().rate;
394
394
  if (speed < 1) speed = 1;
395
395
  if (absy < 3) speed = .5;
396
396
  y = last_y + (target_y > last_y ? speed : -speed);
@@ -1,14 +1,17 @@
1
- <template -if='useIcon?||hasIcon?||icon?'>
2
- <i -class="icon?" -style="{color:color?}"></i>
3
- <template -if="name?">
1
+ <template -if='hasIcon?'>
2
+ <i -class="icon?" -style="{color:menu.color}"></i>
3
+ <template -if="menu.name">
4
4
  &nbsp;&nbsp;
5
5
  </template>
6
6
  </template>
7
- <span -html="name?" -style="{color:color?}"></span>
8
- <template -if="typeof hotkey==='string'">
7
+ <span -html="menu.name" -style="{color:menu.color}"></span>
8
+ <template -if="typeof menu.hotkey==='string'">
9
9
  &nbsp;&nbsp; <span class="hotkey" -html="hotkey"></span>
10
10
  </template>
11
- <template -elseif="hotkey?.length">
12
- &nbsp;&nbsp; <span ng-repeat="k of hotkey" class="hotkey" ng-html="k"></span>
11
+ <template -elseif="menu.hotkey?.length">
12
+ &nbsp;&nbsp; <span ng-repeat="k of menu.hotkey" class="hotkey" ng-html="k"></span>
13
+ </template>
14
+ <template -if="menu.isChecked?menu.isChecked():''">
15
+ &nbsp;&nbsp;✓
13
16
  </template>
14
17
  <s></s>
@@ -7,16 +7,21 @@ function main(elem, scope, hasIcon) {
7
7
  else if (item.$scope) {
8
8
  var scope = item.$scope;
9
9
  }
10
- if (scope.menu || scope.$item) scope = scope.menu || scope.$item;
11
- if (hasIcon === undefined) hasIcon = !!scope.icon;
12
- if (scope.disabled || scope.enabled === false) {
10
+ var menu = scope;
11
+ if (menu.menu || menu.$item) menu = menu.menu || menu.$item;
12
+ if (menu.disabled || menu.enabled === false) {
13
13
  item.setAttribute('disabled', '');
14
14
  }
15
15
  else {
16
16
  item.removeAttribute("disabled");
17
17
  }
18
- render(item.children, scope, hasIcon instanceof Array ? hasIcon : [{ useIcon: hasIcon, hasIcon }]);
19
- if (scope.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
18
+ scope = {
19
+ menu,
20
+ checker,
21
+ };
22
+ if (hasIcon) scope.hasIcon = true;
23
+ render(item.children, scope);
24
+ if (menu.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
20
25
  return item;
21
26
  }
22
27
  main.template = menuItem;
@@ -4,7 +4,7 @@
4
4
  top: 0;
5
5
  left: 0;
6
6
  bottom: 0;
7
- padding: 0 !important;
7
+ padding: 0;
8
8
  color: #333;
9
9
  right: 0;
10
10
  display: block;
@@ -1,18 +1,18 @@
1
- <thead @mounted="setFixedColumn.call(this.parentNode)">
1
+ <thead @mounted="setFixedColumn.call(this.parentNode),setContextMenu(this)">
2
2
  <tr inline-block #adapter thead @mounted="resizeT(this)">
3
3
  <td draggable="false" fixed row-index>序号</td>
4
4
  <td fixed:="f.fixed" -repeat="f in fields track by f.id" :style="{width:f.width}" @dblclick="sort(f)"><i
5
5
  -if="f.icon" -class="f.icon"></i><span -if="f.name" -html="f.name"></span><template
6
6
  -else>&nbsp;</template>
7
7
  </td>
8
+ <td style="min-width: 0;" draggable="false">&nbsp;</td>
8
9
  </tr>
9
10
  </thead>
10
- <tbody -src="(d,i) in data" :style="tbodyHeight(this)">
11
- <tr inline-block @mounted="this.style.width=adapter.style.width">
12
- <td draggable="false" fixed row-index -bind="i+1" @mounted="this.style=adapter.firstChild.getAttribute('style')">
11
+ <tbody -src="(d,i) in data" :style="tbodyHeight(this,hasFoot)">
12
+ <tr inline-block :style="{width:adapter.style.width}" @click="rowClick(d,i,event)">
13
+ <td fixed row-index -bind="i+1" :style="adapter.firstChild.getAttribute('style')">
13
14
  </td>
14
- <td fixed:="f.fixed" -repeat="(f,i) in fields"
15
- @mounted="this.style=adapter.children[i+1].getAttribute('style')">
15
+ <td fixed:="f.fixed" -repeat="(f,i) in fields" :style="adapter.children[i+1].getAttribute('style')">
16
16
  <model -if="f.key&&!isEmpty(d[f.key])" :field=f :data=d readonly></model>
17
17
  <template -else>&nbsp;</template>
18
18
  <a on-click="o.do(d)" -if="!f.key&&f.options&&(!o.when||o.when(d))"
@@ -20,13 +20,19 @@
20
20
  <span -text="o.name instanceof Function?o.name(d):o.name"></span>
21
21
  </a>
22
22
  </td>
23
+ <td :style="adapter.lastChild.getAttribute('style')">&nbsp;</td>
23
24
  </tr>
24
25
  </tbody>
25
26
  <tfoot>
26
- <tr -if="!data||!data.length" style="padding-bottom: 20px;">
27
+ <tr .fade -if="!data||!data.length" style="padding-bottom: 20px;">
27
28
  <td style="text-align: center;">
28
29
  <template -if="data.is_loading">加载中</template>
29
30
  <template -else>无数据</template>
30
31
  </td>
31
32
  </tr>
33
+ <tr -elseif="hasFoot">
34
+ <td>
35
+ 共&nbsp;<span -bind="data.length"></span>&nbsp;个
36
+ </td>
37
+ </tr>
32
38
  </tfoot>
@@ -41,6 +41,7 @@ var markRowTds = function (tr, deltas, colstart, colend) {
41
41
  };
42
42
  var forEachRow = function (tbody, call) {
43
43
  for (var tr of tbody.children) {
44
+ if (isTfoot(tr)) continue;
44
45
  if (isTableRow(tr)) {
45
46
  call(tr);
46
47
  }
@@ -86,9 +87,12 @@ var getTbody = function (table) {
86
87
  if (/^tbody$/i.test(c.tagName) || c.hasAttribute("tbody")) return c;
87
88
  }
88
89
  };
90
+ var isTfoot = function (c) {
91
+ return /^tfoot$/i.test(c.tagName) || c.hasAttribute("tfoot");
92
+ }
89
93
  var getTfoot = function (table) {
90
94
  for (var c of table.children) {
91
- if (/^tfoot$/i.test(c.tagName) || c.hasAttribute("tfoot")) return c;
95
+ if (isTfoot(c)) return c;
92
96
  }
93
97
  };
94
98
  var isTableRow = function (e) {
@@ -106,6 +110,7 @@ var resizeColumn = function (target, targetW) {
106
110
  resizeT(tr, tr.offsetWidth + deltaW);
107
111
  });
108
112
  for (var c of this.children) {
113
+ if (isTfoot(c)) continue;
109
114
  if (!isTableRow(c)) {
110
115
  var tr = c.querySelector('tr');
111
116
  if (!tr) continue;
@@ -230,8 +235,9 @@ function enrichField(f) {
230
235
  f.fixed = true;
231
236
  }
232
237
  }
233
- var tbodyHeight = function (tbody) {
234
- return { 'max-height': ((innerHeight - getScreenPosition(tbody).top - 8) / 36 | 0) * 36 }
238
+ var tbodyHeight = function (tbody, hasFoot) {
239
+ var rowHeight = calcPixel(36);
240
+ return { 'max-height': ((innerHeight - (!!hasFoot ? rowHeight : 6) - getScreenPosition(tbody).top - 10) / rowHeight | 0) * rowHeight }
235
241
  };
236
242
 
237
243
  var setFixed = function (children, scrolled, left, borderRight) {
@@ -247,18 +253,17 @@ var setFixed = function (children, scrolled, left, borderRight) {
247
253
  for (var c of children) {
248
254
  var pc = getScreenPosition(c);
249
255
  var isfixed = c.hasAttribute('fixed');
250
- if (fixedWidth + scrolled > offset && fixedWidth + pc.width < this.clientWidth / 3) {
251
- if (isfixed) {
256
+ if (isfixed) {
257
+ if (fixedWidth + scrolled > offset && fixedWidth + pc.width < this.clientWidth / 3) {
252
258
  css(c, { [left]: scrolled - offset + fixedWidth, [borderRight]: '' });
253
259
  fixedElements.push(c);
254
260
  fixedWidth += pc.width;
255
261
  }
256
- }
257
- else {
258
- setBorderRight(fixedElements);
259
- if (isfixed && c.style[left]) {
260
- css(c, { [left]: '', [borderRight]: '' })
261
- fixedElements.push(c);
262
+ else {
263
+ if (c.style[left]) {
264
+ css(c, { [left]: '', [borderRight]: '' })
265
+ fixedElements.push(c);
266
+ }
262
267
  }
263
268
  }
264
269
  offset += pc.width;
@@ -275,18 +280,34 @@ var setFixed = function (children, scrolled, left, borderRight) {
275
280
  };
276
281
 
277
282
 
278
- var setFixedColumn = function () {
283
+ var setFixedColumn = function (remark) {
279
284
  var thead = getThead(this);
280
285
  if (!thead) return;
286
+ remark = remark === true;
287
+ if (remark) remark = [], forEachRow(thead, function (tr) {
288
+ markRowTds(tr, remark);
289
+ });
281
290
  if (!isTableRow(thead)) thead = thead.querySelector('tr');
282
291
  var children = Array.prototype.slice.call(thead.children);
283
292
  var lastChild = children[children.length - 1];
293
+ var lastFieldChild = children[children.length - 2];
294
+ if (children.length <= 2) lastFieldChild = null;
284
295
  if (!lastChild) return;
296
+ var cindex = children.length - 1;
297
+ if (lastFieldChild) css(lastChild, { width: 0 }), lastChild = lastFieldChild, cindex = children.length - 2;
285
298
  var deltaW = thead.scrollWidth - lastChild.offsetWidth;
286
- if (this.clientWidth > deltaW + 200) {
299
+ if (this.clientWidth > deltaW + lastChild.offsetWidth) {
287
300
  css(lastChild, { width: this.clientWidth - deltaW });
288
301
  css(thead, { width: this.clientWidth });
289
302
  resizeColumn.call(this, lastChild, this.clientWidth - deltaW);
303
+ remark = true;
304
+ }
305
+ if (remark) {
306
+ var tbody = getTbody(this);
307
+ forEachRow(tbody, function (tr) {
308
+ css(tr.children[cindex], lastChild.style);
309
+ });
310
+ css(tbody, { width: thead.offsetWidth });
290
311
  }
291
312
  setFixed.call(this, children, this.scrollLeft, 'left', 'borderRight');
292
313
  setFixed.call(this, children.reverse(), this.scrollWidth - this.clientWidth - this.scrollLeft, 'right', 'borderLeft');
@@ -295,6 +316,7 @@ var setFixedColumn = function () {
295
316
  css(tfoot, { left: this.scrollLeft });
296
317
  }
297
318
  };
319
+ var setLazyFixedColumn = lazy(setFixedColumn, 0);
298
320
  var setClass = function (tds, cls, old) {
299
321
  tds.forEach(td => td[cls] = true);
300
322
  old.forEach(td => { if (!td[cls]) removeClass(td, cls) });
@@ -348,7 +370,31 @@ var getTdsOfSameRow = function (td) {
348
370
  }
349
371
  return tds;
350
372
  };
351
-
373
+ function setContextMenu(thead) {
374
+ var fields = this.fields.slice();
375
+ var scope = this;
376
+ var menuItems = fields.map(f => {
377
+ return {
378
+ name: f.name || "&nbsp;",
379
+ checked: !f.hidden,
380
+ width: f.width,
381
+ do() {
382
+ this.checked = !this.checked;
383
+ f.hidden = !this.checked;
384
+ scope.fields = fields.filter(f => !f.hidden);
385
+ var width = thead.scrollWidth / scope.fields.length;
386
+ if (!width || width < 200) width = 200;
387
+ forEachRow(thead, function (tr) {
388
+ for (var td of tr.children) {
389
+ if (td.offsetWidth > width) css(td, { width });
390
+ }
391
+ });
392
+ setLazyFixedColumn.call(thead.parentNode, true)
393
+ }
394
+ }
395
+ });
396
+ contextmenu(thead, menuItems);
397
+ }
352
398
  function table(elem) {
353
399
  var tableElement = isElement(elem) ? elem : document.createElement("table");
354
400
  var activeCols = [];
@@ -378,7 +424,7 @@ function table(elem) {
378
424
  thead = getThead(table);
379
425
  }
380
426
  if (!getTargetIn(thead, event.target)) return;
381
- var tds = getTargetIn(cellMatchManager, event.target);
427
+ var tds = cellMatchManager(event.target);
382
428
  if (!tds) return;
383
429
  setClass(tds, 'y-ing', activeCols);
384
430
  removeXIng(activeRows);
@@ -408,12 +454,16 @@ function table(elem) {
408
454
  var { colstart, colend } = element;
409
455
  return getTdsByCol(table, colstart, colend);
410
456
  };
411
-
457
+ watch(table, {
458
+ showTotal(v) {
459
+ this.$scope.showTotal = v;
460
+ if (v) this.$scope.hasFoot = true;
461
+ }
462
+ })
412
463
  table.useIncrease = false;
413
464
  var _vbox = function () {
414
465
  table.$Left = function (x) {
415
- if (isFinite(x)) this.scrollLeft = x;
416
- setFixedColumn.call(this);
466
+ if (isFinite(x)) this.scrollLeft = x, setFixedColumn.call(this);
417
467
  return this.scrollLeft;
418
468
  };
419
469
  vbox(table, 'x');
@@ -435,10 +485,15 @@ function table(elem) {
435
485
  var $scope = {
436
486
  fields,
437
487
  isEmpty,
488
+ hasFoot: true,
489
+ setContextMenu,
438
490
  tbody0: null,
491
+ rowClick(d, i, event) {
492
+ active(table, i, d, event.target);
493
+ },
439
494
  tbody(e) {
440
495
  var e = list.apply(null, arguments);
441
- css(e, tbodyHeight(e));
496
+ css(e, tbodyHeight(e, this.hasFoot));
442
497
  css(e, { width: this.adapter.offsetWidth, display: 'block' });
443
498
  this.tbody0 = e;
444
499
  return e;
@@ -522,9 +577,7 @@ function table(elem) {
522
577
  }
523
578
  markThead();
524
579
  markedRows = true;
525
- requestAnimationFrame(function () {
526
- setFixedColumn.call(table)
527
- })
580
+ setLazyFixedColumn.call(table);
528
581
  }
529
582
  );
530
583
  resizingList.set(table, setFixedColumn);
@@ -62,6 +62,10 @@ td {
62
62
  }
63
63
  }
64
64
 
65
+ [draggable="false"]:before {
66
+ display: none;
67
+ }
68
+
65
69
  thead {
66
70
 
67
71
  .y-ing,
@@ -102,11 +106,14 @@ thead {
102
106
  border-right: 1px solid transparent;
103
107
  }
104
108
 
109
+ .fade {
110
+ color: #bbb;
111
+ }
112
+
105
113
  >tfoot {
106
114
  width: 100%;
107
115
  display: block;
108
116
  position: relative;
109
- color: #bbb;
110
117
 
111
118
  >tr {
112
119
  width: 100%;
@@ -27,7 +27,7 @@ function titlebar(elem) {
27
27
  }
28
28
  use_back = use_back !== false;
29
29
  var bar = nav.cloneNode();
30
- var title = label();
30
+ var title = document.createElement("label");
31
31
  var _back = back();
32
32
  text(title, page_title || document.title);
33
33
  appendChild(bar, title);
@@ -91,12 +91,12 @@ function ybox(generator) {
91
91
  };
92
92
  var stop = _box.$stopY || _box.stopY;
93
93
  var stop2 = lazy(function () {
94
- scrollY.smooth(stop);
94
+ scrollY.smooth(stop, 4);
95
95
  }, 40);
96
96
  var decrease = function (t) {
97
97
  var res = _decrease(increaser_t, t) + _decrease(increaser_b, t);
98
98
  if (!res) {
99
- scrollY.smooth(stop);
99
+ scrollY.smooth(stop, 4);
100
100
  }
101
101
  return true;
102
102
  };
package/docs/index.html CHANGED
@@ -10,6 +10,14 @@
10
10
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11
11
  <link rel="Shortcut Icon" href="favicon.ico" type="image/x-icon" />
12
12
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width" />
13
+ <script>
14
+ if (/Trident/i.test(navigator.userAgent)) document.createElement = function (createElement) {
15
+ return function (a) {
16
+ if (/\W/.test(a)) return createElement.call(this, 'efront');
17
+ return createElement.call(this, a);
18
+ };
19
+ }(document.createElement);
20
+ </script>
13
21
  <title>efront 文档</title>
14
22
  <style>
15
23
  body,
@@ -18,6 +26,7 @@
18
26
  margin: 0;
19
27
  overflow: hidden;
20
28
  }
29
+
21
30
  *,
22
31
  ::before,
23
32
  ::after {