efront 3.7.8 → 3.8.5

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.
@@ -24,8 +24,8 @@ var multipleClick = function () {
24
24
  };
25
25
 
26
26
  function main(children, multiple, addable) {
27
- var list = div();
28
- list.value = multiple ? [] : "";
27
+ var page = div();
28
+ page.value = multiple ? [] : "";
29
29
  var firstValue = false;
30
30
  var clicker = multiple ? multipleClick : singleClick;
31
31
  var itemMap = Object.create(null);
@@ -33,7 +33,6 @@ function main(children, multiple, addable) {
33
33
  var key = option.key || option.value;
34
34
  if (key in itemMap) return itemMap[key];
35
35
  var item = itemMap[option.value] = document.createElement('div');
36
-
37
36
  item.setAttribute("item", '');
38
37
  item.innerHTML = option.innerHTML || option.name;
39
38
  item.name = option.name || option.innerHTML;
@@ -47,12 +46,12 @@ function main(children, multiple, addable) {
47
46
  iconed = icon;
48
47
  if (multiple) {
49
48
  item.setAttribute("selected", "");
50
- list.value.push(option.value);
49
+ page.value.push(option.value);
51
50
  } else if (!firstValue) {
52
51
  item.setAttribute("selected", "");
53
- list.activeNode = item;
52
+ page.activeNode = item;
54
53
  firstValue = true;
55
- list.value = option.value
54
+ page.value = option.value
56
55
  }
57
56
  }
58
57
  if (option.disabled) {
@@ -64,10 +63,22 @@ function main(children, multiple, addable) {
64
63
 
65
64
  }
66
65
  var hasIcon = false, iconed = '';
67
- appendChild(list, [].map.call(children, createItem));
66
+ var page = list(page, function (i) {
67
+ if (i < 0 || i >= children.length) return;
68
+ return createItem(children[i]);
69
+ });
70
+ on("append")(page, function () {
71
+ page.clean();
72
+ page.go(0);
73
+ if (adder) {
74
+ remove(adder);
75
+ appendChild(page, adder);
76
+ }
77
+ })
68
78
  if (addable) {
69
79
  var adder = document.createElement("div");;
70
80
  adder.innerHTML = "<a>添加</a><a>管理</a>";
81
+ adder.setAttribute('insert', '');
71
82
  button(adder.firstChild);
72
83
  button(adder.children[1]);
73
84
  on("click")(adder, async function (event) {
@@ -81,43 +92,43 @@ function main(children, multiple, addable) {
81
92
  return false;
82
93
  }
83
94
  });
84
- list.with = a;
95
+ page.with = a;
85
96
  on('remove')(a, function () {
86
- list.with = null;
97
+ page.with = null;
87
98
  });
88
99
  a = await a;
89
100
  if (a in itemMap) return false;
90
- cast(list.target, "add-option", a);
101
+ cast(page.target, "add-option", a);
91
102
  children.push({ name: a, key: a });
92
- list.insertBefore(createItem({
103
+ page.insertBefore(createItem({
93
104
  name: a,
94
105
  value: a,
95
106
  }), adder);
96
107
  break;
97
108
  case this.children[1]:
98
- var options = [].slice.call(list.children, 0, list.children.length - 1);
109
+ var options = [].slice.call(children, 0, children.length);
99
110
  var edit = selectListEdit(options.slice(0));
100
-
101
- list.with = edit;
111
+ page.with = edit;
102
112
  on("remove")(edit, function () {
103
- list.with = null;
104
- remove([].slice.call(list.children, 0, list.children.length - 1));
113
+ page.with = null;
105
114
  children.splice(0, children.length);
106
115
  children.push.apply(children, edit.$scope.options.map(o => ({ key: o.key || o.value, name: o.name || o.innerHTML })))
107
- appendChild.before(adder, edit.$scope.options.map(createItem));
108
- cast(list.target, 'set-options', edit.$scope.options);
116
+ cast(page.target, 'set-options', edit.$scope.options);
117
+ page.clean();
118
+ remove(adder);
119
+ page.go(0);
120
+ appendChild(page, adder);
109
121
  });
110
122
  popup(edit, [.5, .5]);
111
123
  break;
112
124
  }
113
- })
125
+ });
114
126
  adder.setAttribute("adder", '');
115
- list.appendChild(adder)
116
127
  }
117
128
  if (hasIcon) {
118
- list.setAttribute('iconed', '');
129
+ page.setAttribute('iconed', '');
119
130
  }
120
- list.icon = iconed;
121
- on('mousedown')(list, e => e.preventDefault());
122
- return list;
131
+ page.icon = iconed;
132
+ on('mousedown')(page, e => e.preventDefault());
133
+ return page;
123
134
  }
@@ -5,6 +5,10 @@
5
5
  box-shadow: 0 0 20px -6px rgba(0, 0, 0, .1);
6
6
  box-sizing: border-box;
7
7
  border: 1px solid #0003;
8
+ overflow: hidden;
9
+ width: auto;
10
+ height: auto;
11
+ max-height: 360px;
8
12
 
9
13
  >[item] {
10
14
  cursor: default;
@@ -20,7 +20,6 @@ function main(options) {
20
20
  }
21
21
  }
22
22
  if (i >= 0) options.splice(i, 1);
23
- console.log(i)
24
23
  this.research();
25
24
  },
26
25
  get search() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.7.8",
3
+ "version": "3.8.5",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {
@@ -10,7 +10,7 @@
10
10
  "efront": "public/efront.js"
11
11
  },
12
12
  "scripts": {
13
- "prepare": "node tools/build-efront.js",
13
+ "prepare": "node tools/build-efront.js --uplevel",
14
14
  "start": "efront ./efront/ --libs=typescript,esprima,escodegen,esmangle,pngjs,less-node"
15
15
  },
16
16
  "repository": {