efront 3.14.0 → 3.14.2

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.
@@ -9,6 +9,10 @@
9
9
  }
10
10
  &+.titlebar>back{
11
11
  height: 44px;
12
+ pointer-events: all;
13
+ }
14
+ &+.titlebar{
15
+ pointer-events: none;
12
16
  }
13
17
 
14
18
  >png {
@@ -216,8 +216,8 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
216
216
  var dstElement = children[dst + delta];
217
217
  src = bindTarget(src, srcElement);
218
218
  dst = bindTarget(dst, dstElement);
219
- isFunction(move) && move(src, dst, dst + delta, appendSibling, targetBox);
220
- if (srcElement === children[src] && dstElement === children[dst + delta] && srcElement && dstElement) appendSibling(dstElement, srcElement);
219
+ var needFire = !isFunction(move) || move(src, dst, dst + delta, appendSibling, targetBox) !== false;
220
+ if (needFire && srcElement === children[src] && dstElement === children[dst + delta] && srcElement && dstElement) appendSibling(dstElement, srcElement);
221
221
  } else if (isMovingSource === false) {
222
222
  move(previousElements.length, previousElements.length, previousElements.length, null, targetBox);
223
223
  }
@@ -2,7 +2,10 @@ function isMounted(parent) {
2
2
  if ("isMounted" in parent) return parent.isMounted;
3
3
  var temp = parent;
4
4
  while (temp && temp !== document.documentElement) {
5
+ if ("isMounted" in temp) {
6
+ return parent.isMounted = temp.isMounted;
7
+ }
5
8
  temp = temp.parentNode;
6
9
  }
7
- return parent.isMounted = !!temp;
10
+ return !!temp;
8
11
  }
@@ -1,5 +1,5 @@
1
1
  // 中文编码 utf8
2
- function ylist(container, generator, $Y) {
2
+ function ylist(container, generator, $Y, group) {
3
3
  const cache_height = 2000;
4
4
  var restHeight = cache_height;
5
5
  var list = container || div();
@@ -118,7 +118,7 @@ function ylist(container, generator, $Y) {
118
118
  if (isNaN(itemIndex)) return;
119
119
  itemIndex = +itemIndex;
120
120
  __animated = false;
121
- if (!list.offsetHeight && !list.offsetWidth && !list.isMounted) {
121
+ if (!list.offsetHeight && !list.offsetWidth && !isMounted(list)) {
122
122
  saved_itemIndex = itemIndex;
123
123
  return;
124
124
  }
@@ -174,7 +174,7 @@ function ylist(container, generator, $Y) {
174
174
  }
175
175
  var indexed_item = getIndexedElement(index) || bottom_item;
176
176
  if (indexed_item) {
177
- list.scrollTop = indexed_item.offsetTop + indexed_item.offsetHeight * ratio - parseFloat(getComputedStyle(list).paddingTop);
177
+ list.scrollTop = -getFirstElement().offsetTop + indexed_item.offsetTop + indexed_item.offsetHeight * ratio;
178
178
  }
179
179
  };
180
180
  var runbuild = lazy(function () {
@@ -264,8 +264,6 @@ function ylist(container, generator, $Y) {
264
264
  }
265
265
  }
266
266
  if (collection.length) {
267
- var item = collection[collection.length - 1];
268
- scrollTop -= item.offsetTop + getOffsetHeight(item) - collection[0].offsetTop;
269
267
  var { paddingCount, paddingMax } = list;
270
268
  if (paddingCount > 0 && paddingMax > 0 && paddingCount < paddingMax) {
271
269
  let item = collection[collection.length - 1];
@@ -276,6 +274,13 @@ function ylist(container, generator, $Y) {
276
274
  item = item.nextSibling;
277
275
  }
278
276
  }
277
+ var item = collection[collection.length - 1];
278
+ if (item) item = item.nextSibling;
279
+ while (item && item.index % group) {
280
+ item = collection.pop();
281
+ }
282
+ var item = collection[collection.length - 1];
283
+ if (item) scrollTop -= item.offsetTop + getOffsetHeight(item) - collection[0].offsetTop;
279
284
  remove(collection);
280
285
  }
281
286
  //滚动到相应的位置
@@ -297,7 +302,7 @@ function ylist(container, generator, $Y) {
297
302
  if (!(paddingCount > 0 && paddingMax > 0 && paddingCount < paddingMax) || !(scrollTop < targetHeight)) {
298
303
  paddingCount = 0;
299
304
  }
300
- while (scrollTop < targetHeight || paddingCount > 0) {
305
+ while (scrollTop < targetHeight || paddingCount > 0 || offset % group) {
301
306
  offset--;
302
307
  if (!(scrollTop < targetHeight)) {
303
308
  paddingCount--;
@@ -350,7 +355,7 @@ function ylist(container, generator, $Y) {
350
355
  list.stopY = function () {
351
356
  var firstElement = getFirstVisibleElement();
352
357
  if (!firstElement) return;
353
- var paddingTop = parseFloat(getComputedStyle(list).paddingTop);
358
+ var paddingTop = getFirstElement().offsetTop;
354
359
  var paddingBottom = parseFloat(getComputedStyle(list).paddingBottom);
355
360
 
356
361
  var scrolled_t = (list.scrollTop + paddingTop - firstElement.offsetTop) / firstElement.offsetHeight;
@@ -398,10 +403,11 @@ function ylist(container, generator, $Y) {
398
403
  list.scrollBy = scrollBy;
399
404
  list.index = function (update) {
400
405
  if (update === false) return saved_itemIndex;
401
- var firstElement = getFirstVisibleElement();
402
- if (!firstElement) return saved_itemIndex;
403
- var index = firstElement.index;
404
- var scrolled = (list.scrollTop - firstElement.offsetTop + parseFloat(getComputedStyle(list).paddingTop) + .5 | 0) / firstElement.offsetHeight;
406
+ var firstVisible = getFirstVisibleElement();
407
+ if (!firstVisible) return saved_itemIndex;
408
+ var index = firstVisible.index;
409
+ var firstElement = getFirstElement();
410
+ var scrolled = (list.scrollTop - firstVisible.offsetTop + firstElement.offsetTop + .5 | 0) / firstVisible.offsetHeight;
405
411
  return index + scrolled;
406
412
  };
407
413
  list.topIndex = function () {
@@ -477,8 +483,10 @@ function list() {
477
483
  $Y = container.getAttribute("direction") || container.tagName;
478
484
  }
479
485
  }
486
+ var groupCount = /\d+/.exec($Y);
487
+ if (groupCount) groupCount = +groupCount[0];
480
488
  $Y = /^[xh]|[xh]$/i.test($Y) ? "X" : "Y";
481
- var list = ($Y === "X" ? xlist : ylist)(container, generator, $Y);
489
+ var list = ($Y === "X" ? xlist : ylist)(container, generator, $Y, groupCount || 2);
482
490
  if (bindSrc instanceof Array) {
483
491
  list.src = bindSrc;
484
492
  container.go(container.index() || 0);
@@ -2,12 +2,14 @@ var hasOwnProperty = {}.hasOwnProperty;
2
2
  var renderElements = Object.create(null);
3
3
  var presets = Object.create(null);
4
4
  presets.template = function (t) {
5
- var node = document.createElement("div");
6
5
  var comment = document.createComment('template');
7
- node.innerHTML = t.innerHTML;
8
- comment.with = [].slice.call(node.childNodes, 0);
9
- renderElement(comment.with, t.$scope, t.$parentScopes);
10
- remove(node.childNodes);
6
+ once("append")(comment, function () {
7
+ var node = document.createElement(comment.parentNode.tagName || "div");
8
+ node.innerHTML = t.innerHTML;
9
+ comment.with = [].slice.call(node.childNodes, 0);
10
+ appendChild.after(comment,comment.with);
11
+ renderElement(comment.with, comment.$scope, comment.$parentScopes);
12
+ });
11
13
  return comment;
12
14
  };
13
15
  window.renderElements = renderElements;
@@ -624,7 +626,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
624
626
  element.renderid = 1;
625
627
  var parentNode = element.parentNode;
626
628
  if (parentNode) {
627
- if (parentNode.renderid > 1 || parentNode.isMounted) element.renderid = 2;
629
+ if (parentNode.renderid > 1 || isMounted(parentNode)) element.renderid = 2;
628
630
  }
629
631
  element.renders = element.renders ? [].concat(element.renders) : [];
630
632
  var { ons, copys, attrs, props, binds, context: withContext, ids } = element.$struct;
@@ -698,7 +700,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
698
700
  rebuild(element);
699
701
  onappend(element, addRenderElement);
700
702
  onremove(element, removeRenderElement);
701
- if (element.isMounted || element.renderid > 1) addRenderElement.call(element);
703
+ if (isMounted(element) || element.renderid > 1) addRenderElement.call(element);
702
704
  }
703
705
  if (elementid) scope[elementid] = element;
704
706
  for (var id of ids) {
@@ -5,7 +5,10 @@ function search(seartext, options, path = "name") {
5
5
  var name = seek(o, path);
6
6
  if (name === seartext) hasFullmatch = true;
7
7
  var [power, m] = mark.power(name, seartext);
8
- return { power, [path]: m, value: o.value, item: o };
8
+ o = Object.create(o);
9
+ o.power = power;
10
+ if (path) o[path] = m;
11
+ return o;
9
12
  }).filter(a => a.power > 0);
10
13
  a.sort(function (a, b) {
11
14
  return b.power - a.power;
@@ -1,10 +1,12 @@
1
- <tbody -src="d in data" :style="{'max-height':((innerHeight-46)/32|0)*32+36}">
1
+ <tbody -src="(d,i) in data" :style="tbodyHeight()">
2
2
  <tr thead #adapter insert>
3
+ <td row-index>序号</td>
3
4
  <td -repeat="f in fields track by f.id" :style="{width:f.width}" @dblclick="sort(f)"><i -if="f.icon"
4
5
  -class="f.icon"></i></span><span -if="f.name" -html="f.name"></span>
5
6
  </td>
6
7
  </tr>
7
8
  <tr>
9
+ <td row-index -bind="i+1"></td>
8
10
  <td -repeat="f in fields">
9
11
  <model -if="f.key" :field=f :data=d readonly></model>
10
12
  <a on-click="o.do(d)" -if="!f.key&&f.options&&(!o.when||o.when(d))"
@@ -146,7 +146,6 @@ function enrichField(f) {
146
146
  f.width = width + 60;
147
147
  }
148
148
 
149
-
150
149
  function table(elem) {
151
150
  var tableElement = isElement(elem) ? elem : document.createElement("table");
152
151
  var activeCols = [];
@@ -214,18 +213,21 @@ function table(elem) {
214
213
  table.dragbox = function () {
215
214
  return thead;
216
215
  };
216
+ var tbodyHeight = e => ({ 'max-height': ((innerHeight - getScreenPosition(table).top - 46) / 32 | 0) * 32 + 36 });
217
217
  care(table, function ([fields, data]) {
218
218
  thead = null;
219
- this.innerHTML = template;
220
219
  fields.forEach(enrichField);
220
+ remove(this.children);
221
+ this.innerHTML = template;
222
+
221
223
  render(this, {
222
224
  fields,
223
- tbody: list,
224
- innerHeight: {
225
- valueOf() {
226
- return innerHeight - getScreenPosition(table).top;
227
- }
225
+ tbody() {
226
+ var e = list.apply(null, arguments);
227
+ css(e, tbodyHeight());
228
+ return e;
228
229
  },
230
+ tbodyHeight,
229
231
  data,
230
232
  adapter: null,
231
233
  model,
@@ -250,9 +252,10 @@ function table(elem) {
250
252
  cellMatchManager,
251
253
  function (src, dst, rel, append, parentNode) {
252
254
  if (table.src) {
253
- var [fields] = table.src;
254
- var [f] = fields.splice(src, 1);
255
- fields.splice(dst, 0, f);
255
+ if (src < 1 || dst < 1) return false;
256
+ var fields = parentNode.$scope.fields;
257
+ var [f] = fields.splice(src - 1, 1);
258
+ fields.splice(dst - 1, 0, f);
256
259
  }
257
260
  var children = parentNode.children;
258
261
  var srcElement = children[src];
@@ -10,6 +10,9 @@
10
10
  box-shadow: 1px 0 0 0 #00000033, -1px 0 0 0 #00000033;
11
11
  }
12
12
 
13
+ &:insert {
14
+ background: #999;
15
+ }
13
16
  }
14
17
  }
15
18
 
@@ -25,10 +28,15 @@ table,
25
28
  box-sizing: border-box;
26
29
  }
27
30
 
31
+ * {
32
+ vertical-align: top;
33
+ }
34
+
28
35
  & {
29
36
  outline: 1px solid #0006;
30
37
  }
31
38
 
39
+
32
40
  .y-ing {
33
41
  &:before {
34
42
  content: "";
@@ -91,21 +99,14 @@ table,
91
99
  }
92
100
 
93
101
  &:nth-of-type(odd) {
94
-
95
- >td,
96
- >th {
97
- background-color: #eee;
98
- }
102
+ background-color: #eee;
99
103
  }
100
104
 
101
105
  &:nth-of-type(even) {
102
-
103
- >td,
104
- >th {
105
- background-color: #fff;
106
- }
106
+ background-color: #fff;
107
107
  }
108
108
 
109
+
109
110
  &:hover {
110
111
 
111
112
  >td,
@@ -121,12 +122,28 @@ table,
121
122
  z-index: 1;
122
123
 
123
124
  >td {
124
- background: #6669;
125
- backdrop-filter: blur(20px);
126
125
  z-index: 1;
126
+ background: #999;
127
127
  color: #fff;
128
128
  }
129
129
  }
130
+
131
+ }
132
+
133
+
134
+ tr {
135
+
136
+ >th,
137
+ >td {
138
+ background: inherit;
139
+
140
+ &[row-index] {
141
+ user-select: none;
142
+ // pointer-events: none;
143
+ background: #fff;
144
+ text-align: right;
145
+ }
146
+ }
130
147
  }
131
148
 
132
149
  [thead] {
@@ -5,7 +5,6 @@ function ybox(generator) {
5
5
  var sign = Math.sign || function (a) {
6
6
  return +a > 0 ? 1 : -a > 0 ? -1 : 0;
7
7
  };
8
- var { min, max } = Math;
9
8
  var _box;
10
9
  if (isNode(generator)) {
11
10
  _box = generator;
@@ -63,7 +62,7 @@ function ybox(generator) {
63
62
  return _Top;
64
63
  };
65
64
  var __speed = 0;
66
- var smooth = function (useIncrease = true) {
65
+ var smooth = function smooth(useIncrease = true) {
67
66
  var abs_speed = abs(__speed << 2) / time_splitter;
68
67
  var abs_speed = abs(__speed << 2) / time_splitter;
69
68
  if (abs_speed < 1) {
@@ -107,9 +106,24 @@ function ybox(generator) {
107
106
  remove(increaser);
108
107
  return 0;
109
108
  };
109
+ var stop_timer = 0, stop_id = 0, cancel_id = 0;
110
+ var stop = lazy(function stop() {
111
+ if (cancel_id !== stop_id) return;
112
+ if (Math.abs(_box.stopY() - _box.Top() )> 0.0001) stop_timer = setTimeout(stop, 16);
113
+ }, 310);
114
+ var cancelFrame = function () {
115
+ __speed = _speed(0);
116
+ clearTimeout(stop_timer);
117
+ cancelAnimationFrame(smooth_timer);
118
+ cancelAnimationFrame(decrease_timer);
119
+ return ++cancel_id;
120
+ };
110
121
  var decrease = function () {
111
122
  if (_decrease(increaser_t) + _decrease(increaser_b)) decrease_timer = requestAnimationFrame(decrease);
112
- else if (_box.stopY() - _box.Top()) decrease_timer = requestAnimationFrame(decrease);
123
+ else {
124
+ stop_id = cancel_id;
125
+ stop();
126
+ }
113
127
  };
114
128
  var increase = function (deltaY, minusOnly) {
115
129
  var t_height = increaser_t.height || 0;
@@ -170,9 +184,7 @@ function ybox(generator) {
170
184
  });
171
185
  bindtouch(_box, {
172
186
  start() {
173
- cancelAnimationFrame(smooth_timer);
174
- cancelAnimationFrame(decrease_timer);
175
- _speed(0);
187
+ cancelFrame();
176
188
  },
177
189
  move(scrolled) {
178
190
  var y = -this.Top();
@@ -203,11 +215,7 @@ function ybox(generator) {
203
215
  }
204
216
  if (isMounted(_box)) initScrollId.call(_box);
205
217
  on("append")(_box, initScrollId);
206
- _box.cancelFrame = function () {
207
- cancelAnimationFrame(smooth_timer);
208
- cancelAnimationFrame(decrease_timer);
209
- __speed = _speed(0);
210
- };
218
+ _box.cancelFrame = cancelFrame;
211
219
  preventOverflowScrolling(_box);
212
220
  return _box;
213
221
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.14.0",
3
+ "version": "3.14.2",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {