efront 4.15.3 → 4.17.0

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 (38) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +15 -0
  2. package/coms/basic/Matrix.js +181 -304
  3. package/coms/basic/mark.js +1 -9
  4. package/coms/basic/parseYML.js +1 -1
  5. package/coms/basic/parseYML_test.js +26 -1
  6. package/coms/basic_/asyncAster_.js +5 -1
  7. package/coms/compile/Javascript.js +35 -7
  8. package/coms/compile/Javascript_test.js +1 -0
  9. package/coms/compile/Program.js +4 -0
  10. package/coms/compile/common.js +98 -40
  11. package/coms/compile/downLevel.js +30 -7
  12. package/coms/compile/downLevel_test.js +62 -10
  13. package/coms/compile/run-test262.js +19 -9
  14. package/coms/compile/translate.js +4 -4
  15. package/coms/compile/unstruct.js +12 -3
  16. package/coms/compile/unstruct_test.js +3 -1
  17. package/coms/compile//347/264/240/351/246/250.js +1 -0
  18. package/coms/compile//347/264/240/351/246/250_test.js +1 -0
  19. package/coms/zimoli/checker.less +1 -1
  20. package/coms/zimoli/css.js +9 -2
  21. package/coms/zimoli/getTypedChildren.js +4 -0
  22. package/coms/zimoli/input.js +1 -0
  23. package/coms/zimoli/input.less +5 -1
  24. package/coms/zimoli/list.js +1 -0
  25. package/coms/zimoli/menuList.less +1 -0
  26. package/coms/zimoli/model.js +18 -6
  27. package/coms/zimoli/model.less +35 -1
  28. package/coms/zimoli/on.js +3 -3
  29. package/coms/zimoli/picture.js +3 -0
  30. package/coms/zimoli/popup.js +1 -1
  31. package/coms/zimoli/select.js +49 -7
  32. package/coms/zimoli/select.less +22 -4
  33. package/coms/zimoli/selectList.js +14 -2
  34. package/coms/zimoli/view.js +4 -2
  35. package/coms/zimoli/view.less +1 -2
  36. package/coms/zimoli/vscroll.js +0 -1
  37. package/package.json +1 -1
  38. package/public/efront.js +1 -1
@@ -2,11 +2,11 @@ var scanner2 = require("./scanner2");
2
2
  var { SCOPED, QUOTED, SCOPED, PROPERTY, STAMP, PIECE, setqueue, splice, relink, patchArrawScope, number_reg, replace, canbeDuplicate, createString } = require("./common");
3
3
  var strings = require("../basic/strings");
4
4
  var program = null;
5
- var patchTranslate = function (c) {
5
+ var patchTranslate = function (c, raw) {
6
6
  if (c.length) {
7
7
  var canbeDup = true;
8
8
  c.translate = c.map((o, i) => {
9
- if (o.type === PIECE) return strings.decode(`\`${o.text}\``);
9
+ if (o.type === PIECE) return raw ? o.text : strings.decode(`\`${o.text}\``);
10
10
  if (canbeDup && !canbeDuplicate(o)) canbeDup = false;
11
11
  return `$${i + 1 >> 1}`;
12
12
  }).join('').replace(/\r\n|\r|\n/g, '\r\n');
@@ -14,7 +14,7 @@ var patchTranslate = function (c) {
14
14
  }
15
15
  else {
16
16
  if (/^['"`]/.test(c.text) && c.text.length > 2) {
17
- var text = strings.decode(c.text).replace(/\r\n|\r|\n/g, '\r\n');
17
+ var text = raw ? c.text.slice(1, c.text.length - 1) : strings.decode(c.text).replace(/\r\n|\r|\n/g, '\r\n');
18
18
  c.translate = text;
19
19
  }
20
20
  }
@@ -54,7 +54,7 @@ function getI18nPrefixedText(code, dist = []) {
54
54
  if (!n || n.type !== QUOTED || n.length && n.entry !== '`') continue;
55
55
  var c = n;
56
56
  c.transtype = t;
57
- patchTranslate(c);
57
+ patchTranslate(c, t === 字段名);
58
58
  f(c);
59
59
  }
60
60
  };
@@ -590,7 +590,7 @@ var _invoke = function (t, getname) {
590
590
  if (q0f?.type === STRAP && !q0f.transive) remove_end_comma(queue[queue.length - 1]);
591
591
  }
592
592
  var qe = q[q.length - 1];
593
- splice(o, by, ey - by, ...qe ? cloneNode(qe.name) : []);
593
+ splice(o, by, ey - by, ...qe?.name ? cloneNode(qe.name) : []);
594
594
  cy = by + 1;
595
595
  }
596
596
  else {
@@ -1206,7 +1206,6 @@ function toqueue(body, getname, ret = false, result = []) {
1206
1206
  else if (ei >= 0) break;
1207
1207
  _poplabel();
1208
1208
  }
1209
-
1210
1209
  if (o.type === LABEL) {
1211
1210
  o.scope = scopes[scopes.length - 1];
1212
1211
  o.final = body.indexOf(skipSentenceQueue(o.next), cx);
@@ -1231,6 +1230,10 @@ function toqueue(body, getname, ret = false, result = []) {
1231
1230
  if (/^(new|typeof|delete|await|void|debugger)$/.test(o.text)) {
1232
1231
  break a;
1233
1232
  }
1233
+ if (/^(var|let|const)$/i.test(o.text)) {
1234
+ bx = ++cx;
1235
+ continue;
1236
+ }
1234
1237
  if (brk("yield", YIELD, skipAssignment)) break a;
1235
1238
  if (brk("return", RETURN, skipSentenceQueue)) break a;
1236
1239
  if (brk("throw", THROW, skipSentenceQueue)) break a;
@@ -1340,7 +1343,13 @@ function toqueue(body, getname, ret = false, result = []) {
1340
1343
  }
1341
1344
  }
1342
1345
  else {
1343
- cx++;
1346
+ cx = skipAssignment(body, cx);
1347
+ if (cx > bx) {
1348
+ var b = body.slice(bx, cx);
1349
+ var bs = ternary(b, getname, ret);
1350
+ for (var b of bs) pushstep(result, b);
1351
+ }
1352
+ else cx++;
1344
1353
  }
1345
1354
  bx = cx;
1346
1355
  continue;
@@ -159,4 +159,6 @@ r++// test("if(a)else {}",'')
159
159
  test("if(a){if(b){c}d}else{e}", `if (!a) return [2, 0]; if (!b) return [1, 0]; c; return [1, 0];\r\n d; return [2, 0];\r\n e; return [1, 0]`)
160
160
  test("if(a){if(b){c}else{d}}else{e}", `if (!a) return [3, 0]; if (!b) return [1, 0]; c; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n e; return [1, 0]`)
161
161
  test("if(a&&b||c){d}", `_ = a; if (!_) return [1, 0]; _ = b;\r\n if (_) return [1, 0]; _ = c;\r\n if (!_) return [1, 0]; d; return [1, 0]`, true);
162
- test("if(a)switch(b){case c:d;break;} else{h}", `if (!a) return [3, 0]; if (b === c) return [1, 0]; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n h; return [1, 0]`)
162
+ test("if(a)switch(b){case c:d;break;} else{h}", `if (!a) return [3, 0]; if (b === c) return [1, 0]; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n h; return [1, 0]`)
163
+ test("var res = null, krc;", `res = null; krc`)
164
+ test("res = null, krc;", `res = null; krc`)
@@ -497,6 +497,7 @@ var killneg = function (v, n) {
497
497
  v = n + v;
498
498
  }
499
499
  }
500
+ else if (n) v = n + v;
500
501
  return v;
501
502
  };
502
503
  var calcvars = function (v) {
@@ -87,6 +87,7 @@ assert(素馨(`a{a:extract(2 3,2)}`), `a{a:3;}`);
87
87
  assert(素馨(`value: range(10px, 30px, 10);`, '', true), `value:10px 20px 30px;`);
88
88
  assert(素馨(`value: range(4);`, '', true), `value:1 2 3 4;`);
89
89
  assert(素馨(`@a:-1;b{a:-@a}`, '', true), `b{a:1;}`);
90
+ assert(素馨(`--mwidth:0px;--bwidth:2px;--qwidth: var(--mwidth)+var(--bwidth);width:--qwidth`, '', true), `width:2px;`);
90
91
  assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[0].text, '-0.2em');
91
92
  assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[0].isdigit, true);
92
93
  assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[2].text, ".3em");
@@ -3,7 +3,7 @@
3
3
  width: .8em;
4
4
  position: relative;
5
5
  border: .1em solid;
6
- margin: -0.2em .3em -0.2em 0;
6
+ margin: -0.2em .3em -0.1em 0;
7
7
  font-family: sans-serif;
8
8
  display: inline-block;
9
9
  line-height: 1;
@@ -11,7 +11,8 @@ var stylePrefix = function (documentStyle) {
11
11
  if ("-o-transform" in documentStyle) return "-o-";
12
12
  return "";
13
13
  }(documentStyle);
14
- var ratioPropReg = /(?:opacity|line\-height|lineHeight|z\-index|zIndex|zoom|weight|count|order|perspective|animation|flex|font\-size\-adjust|tab\-size|scale|grid\-(?:column|row)(?:\-(?:start|end))?)$/i;
14
+ var ratioPropReg = /(?:opacity|lineHeight|zIndex|zoom|weight|count|order|perspective|animation|flex|fontSizeAdjust|tabSize|scale|grid(?:Column|Row)(?:Start|End)?)$/i;
15
+ var urlwrapReg = /(?:backgroundImage|borderImageSource)/;
15
16
  var nodePrefix = stylePrefix.slice(1, stylePrefix.length - 1);
16
17
  var transfromSimpleValue = function (value) {
17
18
  if (isFinite(value)) return fromOffset(+value || 0);
@@ -24,7 +25,13 @@ var transformValue = function (value, k) {
24
25
  return res;
25
26
  }
26
27
  if (ratioPropReg.test(k) || !value) return value;
27
- if (/^[\w\s\.]+$/.test(value)) return isFinite(value) ? transfromSimpleValue(value) : String(value).split(/\s+/).map(transfromSimpleValue).join(' ');
28
+ if (urlwrapReg.test(k)) {
29
+ if (!/^[\w\-]+\(/.test(value)) {
30
+ value = `url('${value}')`;
31
+ }
32
+ return value;
33
+ }
34
+ if (/^[\-\w\s\.]+$/.test(value)) return isFinite(value) ? transfromSimpleValue(value) : String(value).split(/\s+/).map(transfromSimpleValue).join(' ');
28
35
  return value;
29
36
  };
30
37
  var setValue = function (o, k, v) {
@@ -7,12 +7,16 @@ function hasType(target, type) {
7
7
  return function (element, types) {
8
8
  var marked = 0;
9
9
  for (var k in types) {
10
+ var mark0 = marked;
10
11
  for (var c of element.children) {
11
12
  if (hasType(c, types[k])) {
12
13
  types[k] = c;
13
14
  marked++;
14
15
  }
15
16
  }
17
+ if (marked === mark0) {
18
+ types[k] = null;
19
+ }
16
20
  }
17
21
  if (!marked && isArray(types)) {
18
22
  var children = element.children;
@@ -134,6 +134,7 @@ function input(element) {
134
134
  case "integer":
135
135
  case "number":
136
136
  case "num":
137
+ case "digit":
137
138
  on("keydown")(element, number);
138
139
  break;
139
140
  default:
@@ -10,6 +10,8 @@
10
10
  border-radius: 3px;
11
11
  font-size: 16px;
12
12
  -webkit-appearance: none;
13
+ appearance: none;
14
+ -moz-appearance: textfield;
13
15
  box-shadow: none;
14
16
  outline: none;
15
17
 
@@ -22,11 +24,13 @@
22
24
  display: none;
23
25
  }
24
26
 
27
+ &::-moz-focus-inner,
25
28
  &::-webkit-inner-spin-button {
26
29
  display: none;
27
30
  }
28
31
 
29
- &::-webkit-inner-spin-button {
32
+ &::-moz-focus-outer,
33
+ &::-webkit-outer-spin-button {
30
34
  display: none;
31
35
  }
32
36
 
@@ -431,6 +431,7 @@ function ylist(container, generator, $Y) {
431
431
  var elem = getLastElement(2);
432
432
  var listRestHeight = elem ? elem.offsetHeight + elem.offsetTop - list.scrollTop : list.clientHeight;
433
433
  var paddingHeight = elem ? 0 : restHeight;
434
+ if (listRestHeight < list.clientHeight) listRestHeight = list.clientHeight;
434
435
  return currentY() + listRestHeight + paddingHeight;
435
436
  };
436
437
  list.$Top = function (y) {
@@ -6,6 +6,7 @@
6
6
  border: 1px solid #0003;
7
7
  padding: 6px 0;
8
8
  outline: none;
9
+ background: #fff;
9
10
 
10
11
  >menu-item {
11
12
  display: block;
@@ -100,7 +100,7 @@ var constructors = {
100
100
  text: textarea,
101
101
  number(e) {
102
102
  var { data, field } = e;
103
- var content = `<input type=${field.type} -model=data[field.key] />` + (field.unit ? `<span>${field.unit}</span>` : '');
103
+ var content = `<input placeholder="${field.holder || i18n`输入${field.name}`}" type=${field.type} -model=data[field.key] />` + (field.unit ? `<span>${field.unit}</span>` : '');
104
104
  e.innerHTML = content;
105
105
  if (field.unit && field.unit.length <= 6) {
106
106
  e.setAttribute("u" + field.unit.replace(/[\u0080-\ud7ff\uf000-\uffff]/g, '11').length, '')
@@ -118,7 +118,7 @@ var constructors = {
118
118
  },
119
119
  date(m) {
120
120
  var { data, field } = m;
121
- m.innerHTML = `<input placeholder=${field.holder || '选择日期'} readonly -model=data[field.key] />`;
121
+ m.innerHTML = `<input placeholder=${field.holder || i18n`选择日期`} readonly -model=data[field.key] />`;
122
122
  render(m, {
123
123
  data, field, input,
124
124
  });
@@ -126,7 +126,7 @@ var constructors = {
126
126
  },
127
127
  datetime(m) {
128
128
  var { data, field } = m;
129
- m.innerHTML = `<input placeholder=${field.holder || '选择日期和时间'} readonly -model=data[field.key] />`;
129
+ m.innerHTML = `<input placeholder=${field.holder || i18n`选择日期和时间`} readonly -model=data[field.key] />`;
130
130
  render(m, {
131
131
  data, field, input,
132
132
  });
@@ -154,15 +154,27 @@ var constructors = {
154
154
  cast(elem, field);
155
155
  return elem;
156
156
  },
157
- radio({ field }) {
157
+ radio({ data, field }) {
158
158
  var elem = radio();
159
+ elem.value = data[field.key];
159
160
  cast(elem, field);
160
161
  return elem;
161
162
  },
162
163
  select(_, t) {
163
164
  if (!t) {
164
165
  var elem = select();
165
- elem.innerHTML = `<option ng-repeat="(o,i) in field.options" ng-bind="o.name||o" _value="o.key!==undefined?o.key:o"></option>`;
166
+ var { field, data } = _;
167
+ elem.value = data[field.key];
168
+ var o = field.options?.[0];
169
+ if (field.holder) _.innerHTML = `<span -if="isEmpty(data[field.key])" class="placeholder">${field.holder}</span>`;
170
+ if (!isEmpty(o?.key)) {
171
+ field.options.unshift({
172
+ name: i18n`选择${field.name}`,
173
+ key: ''
174
+ })
175
+ }
176
+ render(_.children, { field, data, isEmpty });
177
+ elem.innerHTML = `<option -repeat="(o,i) in field.options" ng-bind="o.name||o" _value="o.key!==undefined?o.key:o"></option>`;
166
178
  }
167
179
  else if (t === 'a') {
168
180
  var { field, data } = _;
@@ -365,7 +377,7 @@ function main(elem) {
365
377
  return input;
366
378
  }()) : null;
367
379
  if (ipt) {
368
- if (ipt !== elem) appendChild(elem, ipt);
380
+ if (ipt !== elem) appendChild.insert(elem, ipt);
369
381
  if (!ipt.$scope) {
370
382
  renderModel.call(ipt, field, data);
371
383
  var saved_sataus;
@@ -3,6 +3,35 @@
3
3
  display: inline-block;
4
4
  }
5
5
 
6
+ &[type=select] {
7
+ position: relative;
8
+
9
+ >.select:hover,
10
+ >.select:active {
11
+ &+.placeholder {
12
+ color: #fff9;
13
+ }
14
+ }
15
+
16
+ .placeholder {
17
+ color: #0009;
18
+ padding-left: 6px;
19
+ position: absolute;
20
+ top: 50%;
21
+ margin-top: -.5em;
22
+ line-height: 1;
23
+ margin-bottom: -1em;
24
+ z-index: 1;
25
+ pointer-events: none;
26
+ display: block;
27
+ }
28
+
29
+ .select[empty] {
30
+ color: transparent;
31
+ }
32
+
33
+ }
34
+
6
35
  &[type=date] {
7
36
  >input {
8
37
  width: 8em;
@@ -21,7 +50,12 @@
21
50
  }
22
51
  }
23
52
 
24
- &[type=int] {
53
+ &[type=int],
54
+ &[type=number],
55
+ &[type=digit],
56
+ &[type=money],
57
+ &[type=price],
58
+ &[type=num] {
25
59
  >input {
26
60
  text-align: right;
27
61
  width: 8em;
package/coms/zimoli/on.js CHANGED
@@ -269,7 +269,7 @@ var remove = function (k, hk, [eventtypes, handler, context]) {
269
269
  if (hs) {
270
270
  for (var cx = hs.length - 1; cx >= 0; cx--) {
271
271
  var [e, h, c] = hs[cx];
272
- if (h === handler && e === eventtypes && c === context) {
272
+ if (h === handler && shallowEqual(e, eventtypes, 2) && c === context) {
273
273
  hs.splice(cx, 1);
274
274
  if (k === changes_key) element.$needchanges--;
275
275
  }
@@ -333,8 +333,8 @@ var append = function (k, hk, listener2, firstmost) {
333
333
  var [eventtypes, handler, context] = listener2;
334
334
  var element = this;
335
335
  var handlers = element[hk];
336
- for (var [h, e, c] of handlers) {
337
- if (h === handler && eventtypes === e && c === context) return;
336
+ for (var [e, h, c] of handlers) {
337
+ if (h === handler && shallowEqual(eventtypes, e, 2) && c === context) return;
338
338
  }
339
339
  if (k === changes_key) {
340
340
  if (!element.$needchanges) element.$needchanges = 0;
@@ -27,6 +27,7 @@ var create = function (url, key, report_error) {
27
27
 
28
28
  var image = picture_();
29
29
  image.url = url;
30
+ var rotate = url.rotate | 0;
30
31
  if (广告 && !广告.parentNode) appendChild(image, 广告);
31
32
  if (isObject(url)) {
32
33
  if (key) {
@@ -69,6 +70,7 @@ var create = function (url, key, report_error) {
69
70
  };
70
71
  var imgpic;
71
72
  image.setImage = function (_imgpic) {
73
+ _imgpic.rotate = rotate;
72
74
  if (!isElement(_imgpic)) _imgpic = this;
73
75
  if (imgpic) {
74
76
  [].forEach.call(imgpic.attributes, a => {
@@ -109,6 +111,7 @@ var create = function (url, key, report_error) {
109
111
  marginTop
110
112
  };
111
113
  }
114
+ image.rotateTo(rotate);
112
115
  return image;
113
116
  };
114
117
 
@@ -172,7 +172,7 @@ var isypop = function (target) {
172
172
  if (
173
173
  target.offsetWidth >= (innerWidth >> 1) &&
174
174
  target.offsetHeight < (innerHeight >> 1) ||
175
- offsetParent.offsetWidth >= (innerWidth >> 1) &&
175
+ offsetParent && offsetParent.offsetWidth >= (innerWidth >> 1) &&
176
176
  offsetParent.offsetHeight < (innerHeight >> 1)) return true;
177
177
  if (
178
178
  nextSibling
@@ -2,15 +2,16 @@ var saved_list;
2
2
  var _remove = function () {
3
3
  var removing_list = saved_list;
4
4
  if (removing_list) {
5
- setTimeout(function run() {
5
+ requestAnimationFrame(function run() {
6
6
  if (removing_list !== saved_list) return remove(removing_list);
7
7
  var { activeElement } = document;
8
- a: if (!getTargetIn(removing_list, activeElement)) {
8
+ a: if (!getTargetIn(removing_list, activeElement) && !getTargetIn(removing_list.target, activeElement)) {
9
9
  var extras = [].concat(removing_list.with);
10
10
  for (var e of extras) {
11
11
  if (getTargetIn(e, activeElement)) break a;
12
12
  }
13
13
  remove(removing_list);
14
+ removing_list.target.focus();
14
15
  if (removing_list === saved_list) saved_list = null;
15
16
  return;
16
17
  }
@@ -40,7 +41,35 @@ on('touchend')(window, function (event) {
40
41
  if (getTargetIn(saved_list, event.target)) return;
41
42
  }
42
43
  activeElement.blur();
43
- })
44
+ });
45
+ var setEmpty = function () {
46
+ if (isEmpty(this.value)) {
47
+ if (!this.empty) {
48
+ this.empty = true;
49
+ this.setAttribute('empty', '')
50
+ }
51
+ }
52
+ else {
53
+ if (this.empty) {
54
+ this.empty = false;
55
+ this.removeAttribute('empty');
56
+ }
57
+ }
58
+ };
59
+ var setFocus = function () {
60
+ if (saved_list && saved_list.target === this) {
61
+ if (!this.focused) {
62
+ this.focused = true;
63
+ this.setAttribute('focus', '');
64
+ }
65
+ }
66
+ else {
67
+ if (this.focused) {
68
+ this.focused = false;
69
+ this.removeAttribute('focus');
70
+ }
71
+ }
72
+ }
44
73
  function select() {
45
74
  var [target, list, removeOnSelect, direction] = arguments;
46
75
  if (/^[yvxh]/i.test(removeOnSelect)) {
@@ -99,6 +128,8 @@ function select() {
99
128
  if (removeOnSelect === null) {
100
129
  onmousedown(list, preventDefault);
101
130
  }
131
+ on("touchend")(target, preventDefault);// 兼容火狐 android
132
+ on("touchend")(list, preventDefault);// 兼容火狐 android
102
133
  on("keydown.up")(target, preventDefault);
103
134
  on("keydown.down")(target, preventDefault);
104
135
  on("keydown.enter")(target, preventDefault1);
@@ -213,15 +244,26 @@ function select() {
213
244
  var mousedown = function () {
214
245
  initList();
215
246
  if (saved_list !== list || !isMounted(list)) {
216
- if (saved_list && saved_list !== list) _remove();
217
- if (document.activeElement !== target) target.focus();
247
+ if (saved_list && saved_list !== list) remove(saved_list);
218
248
  popup(list, target, direction);
249
+ requestAnimationFrame(/*兼容safari*/function () {
250
+ if (document.activeElement !== target) target.focus();
251
+ })
252
+ if (getTargetIn(list, document.activeElement)) {
253
+ on('blur')(document.activeElement, removeByBlur);
254
+ }
219
255
  saved_list = list;
220
256
  }
221
- else _remove();
257
+ else {
258
+ remove(list);
259
+ if (saved_list === list) {
260
+ saved_list = null;
261
+ target.focus();
262
+ }
263
+ }
222
264
  };
223
265
  if (!target.$renders) {
224
- target.$renders = [];
266
+ target.$renders = [setEmpty, setFocus];
225
267
  }
226
268
  target.$renders.push(setIcon);
227
269
  onclick(target, mousedown);
@@ -1,14 +1,23 @@
1
+ & {
2
+ background: #fff;
3
+ }
4
+
1
5
  select& {
2
6
  border: 1px solid #00000033;
3
7
  -webkit-appearance: none;
4
- -moz-appearance: none;
5
- height: 30px;
6
- line-height: 30px;
7
- padding: 0 16px;
8
+ appearance: none;
9
+ height: 28px;
10
+ line-height: 28px;
11
+ padding: 0 6px;
8
12
  outline: none;
9
13
  font-size: inherit;
10
14
  display: inline-block;
11
15
 
16
+ &:focus,
17
+ &[focus] {
18
+ border-color: #29c;
19
+ }
20
+
12
21
  &::-ms-expand {
13
22
  display: none;
14
23
  }
@@ -34,4 +43,13 @@ select& {
34
43
 
35
44
  model>& {
36
45
  width: 100%;
46
+ }
47
+
48
+ &[empty] {
49
+ color: #0009;
50
+
51
+ &:hover,
52
+ &:active {
53
+ color: #fff9;
54
+ }
37
55
  }
@@ -1,6 +1,12 @@
1
1
  var singleClick = function () {
2
2
  var node = this.parentNode;
3
- if (node.activeNode === this) return;
3
+ if (node.activeNode === this) {
4
+ remove(node);
5
+ if (node.target) {
6
+ node.target.focus();
7
+ }
8
+ return;
9
+ }
4
10
  if (node.activeNode) {
5
11
  if (isObject(node.activeNode.origin)) node.activeNode.origin.selected = false;
6
12
  node.activeNode.removeAttribute("selected");
@@ -14,6 +20,7 @@ var singleClick = function () {
14
20
  if (isObject(this.origin)) this.origin.selected = true;
15
21
  dispatch(node, "change");
16
22
  if (getTargetIn(node, document.activeElement)) document.activeElement.blur();
23
+ remove(node);
17
24
  };
18
25
  var multipleClick = function () {
19
26
  var node = this.parentNode;
@@ -33,6 +40,11 @@ var multipleClick = function () {
33
40
  var searchinput = function () {
34
41
  var ipt = document.createElement("input");
35
42
  ipt.placeholder = '搜索';
43
+ on('mounted')(ipt, function () {
44
+ requestAnimationFrame(function () {
45
+ ipt.focus();
46
+ });
47
+ });
36
48
  return ipt;
37
49
  };
38
50
 
@@ -108,7 +120,7 @@ function main() {
108
120
 
109
121
  var hasIcon = false, iconed = '';
110
122
 
111
- if (children.length > 6) {
123
+ if (children.length > 12) {
112
124
  var ipt = searchinput()
113
125
  page.insertBefore(ipt, page.firstChild);
114
126
  var searchtext = function () {
@@ -86,8 +86,10 @@ function getScrollbarWidth() {
86
86
  }
87
87
  var init = function () {
88
88
  init = function () { };
89
- css("." + view.className.split(/\s+/)[0] + ">.body", {
90
- marginRight: -getScrollbarWidth() + "px"
89
+ var className = view.className.split(/\s+/)[0];
90
+ css(`.${className}>.body,.${className}>[body]`, {
91
+ borderRight: 20 - getScrollbarWidth() + "px solid transparent",
92
+ marginRight: -20 + "px"
91
93
  });
92
94
  };
93
95
  var resize2 = function () {
@@ -25,8 +25,7 @@ body>& {
25
25
 
26
26
  >.body,
27
27
  >[body] {
28
- padding: 6px 20px 6px 6px;
29
- margin-right: -20px;
28
+ padding: 6px;
30
29
  display: block;
31
30
  width: auto;
32
31
  height: 100%;
@@ -22,7 +22,6 @@ var scroll = function () {
22
22
  var { max, min } = Math;
23
23
  var scrollOutside = function (deltay) {
24
24
  var _box = this;
25
- if (_box.YScrollBoxId === 1) return deltay;
26
25
  var offsetParent = _box.offsetParent;
27
26
  if (!offsetParent) return deltay;
28
27
  var _boxPosition = getScreenPosition(_box);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.15.3",
3
+ "version": "4.17.0",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {