efront 4.22.19 → 4.23.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.
Files changed (108) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +6 -0
  2. package/apps/kugou/search/search.js +4 -3
  3. package/apps/noice/main.js +1 -1
  4. package/apps/pivot/auth/login.js +4 -4
  5. package/apps/pivot/dht/list.js +5 -5
  6. package/apps/pivot/link/chat.js +1 -1
  7. package/apps/pivot/link/index.js +1 -1
  8. package/apps/pivot/link/list.js +5 -4
  9. package/apps/pivot/share/list.js +6 -5
  10. package/apps/pivot/wow/root.js +3 -2
  11. package/coms/basic/ArrayFill.js +5 -1
  12. package/coms/basic/BigNumber.js +2 -2
  13. package/coms/basic/LoadingArray.js +1 -0
  14. package/coms/basic/cross_.js +4 -1
  15. package/coms/basic/data.js +27 -23
  16. package/coms/basic/extend.js +18 -1
  17. package/coms/basic/isFinit.js +1 -0
  18. package/coms/basic_/&ArrayFill.js +1 -5
  19. package/coms/basic_/&extend.js +1 -18
  20. package/coms/basic_/WeakMap.js +36 -0
  21. package/coms/compile/Javascript.js +2 -1
  22. package/coms/explorer/context.js +10 -7
  23. package/coms/explorer/edit.js +1 -1
  24. package/coms/explorer/fileitem.js +9 -7
  25. package/coms/explorer/main.js +20 -17
  26. package/coms/frame/chat.js +17 -16
  27. package/coms/frame/list.js +6 -5
  28. package/coms/kugou/bindScroll.js +0 -1
  29. package/coms/kugou/buildScroll.js +5 -4
  30. package/coms/kugou/krc.js +2 -2
  31. package/coms/kugou/player.js +2 -2
  32. package/coms/kugou/song.js +1 -1
  33. package/coms/layer/leftCenter.js +5 -5
  34. package/coms/pivot/checkGeo.js +0 -1
  35. package/coms/reptile/alert.js +5 -1
  36. package/coms/reptile/data.js +3 -0
  37. package/coms/zimoli/$cared.js +1 -0
  38. package/coms/zimoli/$casted.js +1 -0
  39. package/coms/zimoli/$eval.js +1 -0
  40. package/coms/zimoli/$mounted.js +1 -0
  41. package/coms/zimoli/$parented.js +1 -0
  42. package/coms/zimoli/$renders.js +1 -0
  43. package/coms/zimoli/$scoped.js +1 -0
  44. package/coms/zimoli/$structed.js +1 -0
  45. package/coms/zimoli/$upwith.js +1 -0
  46. package/coms/zimoli/$watches.js +1 -0
  47. package/coms/zimoli/HexEditor.js +1 -1
  48. package/coms/zimoli/alert.js +4 -2
  49. package/coms/zimoli/appendChild.js +2 -2
  50. package/coms/zimoli/autodragchildren_test.js +1 -1
  51. package/coms/zimoli/care.js +27 -9
  52. package/coms/zimoli/cast.js +13 -14
  53. package/coms/zimoli/checkbox.js +1 -1
  54. package/coms/zimoli/container.js +4 -3
  55. package/coms/zimoli/createItemTarget.js +10 -6
  56. package/coms/zimoli/cross.js +1 -1
  57. package/coms/zimoli/data.js +16 -0
  58. package/coms/zimoli/field.js +3 -3
  59. package/coms/zimoli/gallery_test.js +4 -3
  60. package/coms/zimoli/getArgsChildren.js +1 -1
  61. package/coms/zimoli/getChanged.js +8 -0
  62. package/coms/zimoli/getGenerator.js +36 -28
  63. package/coms/zimoli/grid.js +2 -2
  64. package/coms/zimoli/isMounted.js +6 -3
  65. package/coms/zimoli/lattice.js +2 -4
  66. package/coms/zimoli/maps.js +1 -2
  67. package/coms/zimoli/menu.js +1 -0
  68. package/coms/zimoli/menuItem.js +4 -3
  69. package/coms/zimoli/menuList.js +7 -8
  70. package/coms/zimoli/menu_test.js +4 -3
  71. package/coms/zimoli/model.js +15 -10
  72. package/coms/zimoli/on.js +39 -23
  73. package/coms/zimoli/picture.js +0 -7
  74. package/coms/zimoli/popup.js +5 -5
  75. package/coms/zimoli/radio.js +1 -1
  76. package/coms/zimoli/remove.js +3 -3
  77. package/coms/zimoli/render.js +397 -223
  78. package/coms/zimoli/scrollbar.js +90 -42
  79. package/coms/zimoli/scrollbar.less +5 -3
  80. package/coms/zimoli/select.js +3 -3
  81. package/coms/zimoli/selectList.js +1 -1
  82. package/coms/zimoli/selectListEdit.js +5 -4
  83. package/coms/zimoli/table.html +6 -4
  84. package/coms/zimoli/table.js +82 -41
  85. package/coms/zimoli/table.less +22 -0
  86. package/coms/zimoli/vbox.less +2 -2
  87. package/coms/zimoli/view.js +1 -1
  88. package/coms/zimoli/watch.js +7 -5
  89. package/coms/zimoli/zimoli.js +78 -60
  90. package/docs/version-desc.md +3 -1
  91. package/docs//347/211/210/346/234/254/350/257/264/346/230/216.md +3 -1
  92. package/docs//347/273/204/344/273/266.xht +14 -1
  93. package/package.json +1 -1
  94. package/public/efront.js +1 -1
  95. package/public/pivot/api.yml +46 -0
  96. package/public/pivot/menu.yml +16 -0
  97. package/public/pivot/page/auth/login.txt +1 -0
  98. package/public/pivot/page/cert/main.txt +1 -0
  99. package/public/pivot/page/cert/orders.txt +1 -0
  100. package/public/pivot/page/cert/update.txt +1 -0
  101. package/public/pivot/page/db/act.txt +1 -0
  102. package/public/pivot/page/db/config.txt +1 -0
  103. package/public/pivot/page/db/edit.txt +1 -0
  104. package/public/pivot/page/db/list.txt +1 -0
  105. package/public/pivot//344/270/273/351/241/265.html +46 -0
  106. package/coms/reptile/on.js +0 -4
  107. package/coms/reptile/onmounted.js +0 -1
  108. /package/coms/{zimoli → basic}/encode62.js +0 -0
@@ -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
- css(this, { height: target.offsetHeight });
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 < 14) thumbHeight = 14;
11
- if (thumbHeight < 0) thumbHeight = 0;
12
- this.restHeight = scrollHeight - offsetHeight;
13
- css(this.thumb, {
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.offsetHeight - this.thumb.offsetHeight;
31
+ var availableHeight = this.clientHeight - this.thumb.offsetHeight | 0;
25
32
  if (!availableHeight) return 0;
26
- return this.thumb.offsetTop / availableHeight * this.restHeight;
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.offsetHeight - thumb.offsetHeight;
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 < 0) targetTop = 0;
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) setTargetTop(target, targetTop);
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 (target, top) {
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 (target) {
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
- var getTargetHeight = function (target) {
145
- var Height = target.scrollHeight, height = target.clientHeight;
146
- if (target.Height instanceof Function) Height = target.Height();
147
- if (target.height instanceof Function) height = target.height();
148
- return { Height, height };
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
- var top = getTargetTop(this);
154
- _scrollbar.scrollTo(top);
155
- _scrollbar.autoshow();
186
+ if (moving) return;
187
+ var top = _scrollbar.getTTop();
188
+ if (isFinit(top)) {
189
+ _scrollbar.scrollTo(top);
190
+ _scrollbar.autoshow();
191
+ }
156
192
  };
157
193
  var onchange = function () {
158
194
  var top = _scrollbar.$Top();
159
- setTargetTop(this, top);
195
+ this.setTTop(top);
160
196
  };
161
197
  function bindTarget(_container, followResize = _container) {
162
198
  _container.with = _scrollbar;
163
199
  _scrollbar.target = _container;
164
- onmounted(_container, _scrollbar.reshape);
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 = lazy(function () {
171
- var _container = _scrollbar.target;
172
- var { Height, height } = getTargetHeight(_container);
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 = elem.tagName;
214
- var $struct = elem.$struct;
215
- if ($struct) {
216
- if ($struct.props?.target);
217
- else if (isBody(elem.previousElementSibling)) {
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
 
@@ -163,11 +163,11 @@ function select() {
163
163
  var optionsMap = {};
164
164
  var $key = 'key';
165
165
  var $name = 'name';
166
- var template = target.$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].$struct;
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 = this.$eval($name, this.$src.createScope(s, v, v));
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.$scope.options.map(o => ({ value: o.key || o.value, name: o.name || o.innerHTML })))
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
- render(page, {
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 (page.$scope.search) {
63
- page.$scope.search = '';
63
+ if (scope.search) {
64
+ scope.search = '';
64
65
  return false;
65
66
  }
66
67
  };
@@ -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=adapter.firstChild.getAttribute('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" once-append="this.style=adapter.children[i+1].getAttribute('style')">
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>&nbsp;</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`共${"&nbsp;<span -bind=data.length></span>&nbsp;"}个`}
44
45
  </td>
45
46
  </tr>
46
- </tfoot>
47
+ </tfoot>
48
+ <scrollbar x :target="this.parentNode"></scrollbar>
@@ -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 getTfoot = function (table) {
111
+ var getTExtras = function (table) {
112
+ var tfoot, xb, yb;
112
113
  for (var c of table.children) {
113
- if (isTfoot(c)) return 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
- var children = Array.prototype.slice.call(thead.children);
319
- var lastChild = children[children.length - 1];
320
- var lastFieldChild = children[children.length - 2];
321
- if (children.length <= 2) lastFieldChild = null;
322
- if (!lastChild) return;
323
- var cindex = children.length - 1;
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 = getTfoot(this);
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.$scope?.f;
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
- this.$scope.showTotal = v;
500
- if (v) this.$scope.hasFoot = true;
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)) this.scrollLeft = x, setFixedColumn.call(this);
507
- return this.scrollLeft;
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, this.$parentScopes.concat(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.$scope.fields;
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
  }
@@ -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
  }
@@ -38,7 +38,7 @@
38
38
  }
39
39
 
40
40
  >.x-insert {
41
- display: block;
42
- float: left;
41
+ display: inline-block;
43
42
  height: 100%;
43
+ vertical-align: top;
44
44
  }
@@ -119,7 +119,7 @@ var resize2 = function () {
119
119
  marginTop: fromOffset(-height)
120
120
  });
121
121
  css(body, {
122
- paddingBottom: fromOffset(body.clientTop + body.clientHeight + body.offsetTop - foot.offsetTop)
122
+ paddingBottom: fromOffset(foot.offsetHeight)
123
123
  });
124
124
  }
125
125
  };
@@ -1,5 +1,5 @@
1
1
  function watcher({ changes }) {
2
- var watches = this.$watches;
2
+ var watches = $watches.get(this);
3
3
  for (var k in changes) {
4
4
  if (k in watches) {
5
5
  var h = watches[k];
@@ -10,18 +10,20 @@ function watcher({ changes }) {
10
10
  }
11
11
  }
12
12
  function watch(elem, prop, handler) {
13
- if (!elem.$watches) {
14
- elem.$watches = {};
13
+ var w = $watches.get(elem);
14
+ if (!w) {
15
+ w = {};
16
+ $watches.set(elem, w);
15
17
  on("changes")(elem, watcher);
16
18
  }
17
19
  if (isFunction(handler)) {
18
- elem.$watches[prop] = handler;
20
+ w[prop] = handler;
19
21
  }
20
22
  else if (isObject(prop)) {
21
23
  var e = 0;
22
24
  for (var k in prop) {
23
25
  if (!isFunction(prop[k])) e++;
24
- else elem.$watches[k] = prop[k];
26
+ else w[k] = prop[k];
25
27
  }
26
28
  if (e > 0) throw new Error(i18n`参数不支持!`);
27
29
  }