efront 3.12.6 → 3.13.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.
Files changed (61) hide show
  1. package/apps/pivot/api.yml +8 -0
  2. package/apps/pivot/home/welcome.html +1 -1
  3. package/apps/pivot/home/welcome.js +6 -9
  4. package/apps/pivot/log/boot.html +2 -0
  5. package/apps/pivot/log/boot.js +39 -0
  6. package/apps/pivot/log/boot.less +11 -0
  7. package/apps/pivot/log/count.html +5 -0
  8. package/apps/pivot/log/count.js +22 -0
  9. package/apps/pivot/log/count.less +16 -0
  10. package/apps/pivot/main.js +9 -10
  11. package/apps/pivot/menu.yml +8 -2
  12. package/apps/pivot/proxy/edit.js +1 -0
  13. package/apps/pivot/proxy/list.js +12 -0
  14. package/apps/pivot/share/list.less +0 -4
  15. package/apps/pivot/user/edit.js +1 -0
  16. package/apps/pivot/user/list.js +4 -0
  17. package/apps/pivot/user/tag/edit.js +1 -0
  18. package/apps/pivot/user/tag/list.js +3 -0
  19. package/coms/basic/cross_.js +8 -1
  20. package/coms/basic/encodePack.js +2 -9
  21. package/coms/basic/parseURL_test.js +2 -0
  22. package/coms/basic/parseYML.js +1 -1
  23. package/coms/basic/renderExpress.js +1 -1
  24. package/coms/frame/route.js +4 -0
  25. package/coms/pivot/plist.js +1 -1
  26. package/coms/zimoli/AudioContext_test.html +1 -1
  27. package/coms/zimoli/AudioContext_test.js +3 -3
  28. package/coms/zimoli/bind.js +4 -2
  29. package/coms/zimoli/cloneVisible.js +9 -2
  30. package/coms/zimoli/cross.js +2 -3
  31. package/coms/zimoli/data.js +22 -4
  32. package/coms/zimoli/drag.js +3 -2
  33. package/coms/zimoli/field.html +15 -10
  34. package/coms/zimoli/menu.js +33 -13
  35. package/coms/zimoli/menu.less +31 -9
  36. package/coms/zimoli/menuItem.js +1 -1
  37. package/coms/zimoli/menuList.html +5 -3
  38. package/coms/zimoli/menuList.js +63 -28
  39. package/coms/zimoli/menuList.less +5 -0
  40. package/coms/zimoli/model.js +22 -1
  41. package/coms/zimoli/on.js +5 -3
  42. package/coms/zimoli/picture.js +30 -335
  43. package/coms/zimoli/picture_.js +356 -0
  44. package/coms/zimoli/prompt.js +3 -1
  45. package/coms/zimoli/render.js +22 -10
  46. package/coms/zimoli/renderDefaults.js +1 -0
  47. package/coms/zimoli/search.js +5 -4
  48. package/coms/zimoli/select.js +7 -3
  49. package/coms/zimoli/selectList.js +7 -7
  50. package/coms/zimoli/selectListEdit.js +1 -1
  51. package/coms/zimoli/success.js +4 -0
  52. package/coms/zimoli/success.less +13 -0
  53. package/coms/zimoli/table.html +6 -8
  54. package/coms/zimoli/table.js +25 -2
  55. package/coms/zimoli/table.less +24 -4
  56. package/coms/zimoli/view.less +4 -0
  57. package/package.json +1 -1
  58. package/public/efront.js +1 -1
  59. package/apps/pivot/home/short.html +0 -1
  60. package/apps/pivot/home/short.js +0 -5
  61. package/apps/pivot/home/short.less +0 -1
@@ -101,23 +101,34 @@ function main(elem, mode) {
101
101
  // }
102
102
  // elem.setAttribute('browser', os);
103
103
  var mode = elem.getAttribute('mode') || elem.getAttribute('type');
104
+ if (!mode) {
105
+ if (elem.hasAttribute("inline")) mode = 'inline';
106
+ else if (elem.hasAttribute("vertical")) mode = "vertical";
107
+ else if (elem.hasAttribute("horizonal")) mode = "horizonal";
108
+ else if (
109
+ elem.hasAttribute("toolbar")
110
+ || elem.hasAttribute('tool')
111
+ || elem.hasAttribute('tools')
112
+ || elem.hasAttribute('bar')
113
+ ) mode = "toolbar";
114
+ }
104
115
  if (!mode) {
105
116
  if (/^[xyhvtci]/i.test(elem.tagName)) {
106
117
  mode = elem.tagName.slice(0, 1);
118
+ if (/^t$/i.test(mode)) mode = elem.tagName.slice(0, 2);
107
119
  }
108
- else if (/[xyhvtci]$/i.test(elem.tagName)) {
109
- mode = elem.tagName.slice(0, 1);
120
+ else if (/[xyhvci]$/i.test(elem.tagName)) {
121
+ mode = elem.tagName.slice(elem.tagName.length - 1);
110
122
  }
111
123
  }
112
124
  mode = mode ? mode.toLowerCase() : "horizonal";
113
-
125
+ var direction;
114
126
  switch (mode) {
127
+ case "tr":
115
128
  case "i":
116
129
  case "c":
117
130
  case "inline":
118
- case "t":
119
- case "tree":
120
- mode = "tree";
131
+ mode = "inline";
121
132
  if (elem) {
122
133
  var generator = getGenerator(elem, 'menu-item');
123
134
  tree(elem, function (index, item) {
@@ -145,22 +156,31 @@ function main(elem, mode) {
145
156
  elem = inlineMenu.call(elem, nodes);
146
157
  }
147
158
  break;
159
+ case "to":
160
+ case "t":
161
+ case "b":
162
+ case "tool":
163
+ case "tools":
164
+ case "bar":
165
+ case "toolbar":
166
+ direction = 't';
167
+ mode = "toolbar";
148
168
  case "h":
149
169
  case "x":
150
170
  case "horizonal":
151
- var direction = 'x';
152
- mode = "horizonal";
171
+ if (!direction) {
172
+ direction = 'x';
173
+ mode = "horizonal";
174
+ }
153
175
  case "v":
154
176
  case "y":
155
177
  case "vertical":
178
+ if (!direction) mode = "vertical", direction = 'y';
156
179
  var emit = function (item, target) {
157
180
  active(elem, item.value, item, target);
158
181
  };
159
182
  if ("$src" in elem) {
160
183
  getGenerator(elem, 'menu-item');
161
- on("append")(elem, function () {
162
- elem.registerAsRoot();
163
- });
164
184
  var src0 = [];
165
185
  menuList(elem, src0, emit, direction);
166
186
  care(elem, function (src) {
@@ -177,7 +197,6 @@ function main(elem, mode) {
177
197
  var nodes = getArrayNodes(elem);
178
198
  remove(elem.children);
179
199
  elem = menuList(elem, nodes, emit, direction);
180
- elem.registerAsRoot();
181
200
  }
182
201
  break;
183
202
  default:
@@ -187,7 +206,8 @@ function main(elem, mode) {
187
206
  mode = mode || "horizonal";
188
207
  elem = menu.apply(null, arguments);
189
208
  }
190
- elem.setAttribute('mode', mode);
209
+ if (!elem.hasAttribute('mode')) elem.setAttribute('mode', mode);
210
+ if (!elem.hasAttribute(mode)) elem.setAttribute(mode, '');
191
211
  return elem;
192
212
 
193
213
  }
@@ -82,13 +82,11 @@ body:active & {
82
82
  width: 100%;
83
83
  }
84
84
 
85
- &[mode=vertical],
86
- &[type=vertical] {
85
+ &[vertical] {
87
86
  display: block;
88
87
  }
89
88
 
90
- &[mode=horizonal],
91
- &[type=horizonal] {
89
+ &[horizonal] {
92
90
  display: block;
93
91
  overflow: hidden;
94
92
  text-overflow: hidden;
@@ -115,11 +113,35 @@ body:active & {
115
113
 
116
114
  }
117
115
 
118
- &[mode=tree],
119
- &[mode=tree],
120
- &[type=tree],
121
- &[mode=inline],
122
- &[type=inline] {
116
+ &[toolbar] {
117
+ >menu-item{
118
+ padding-left: 6px;
119
+ padding-right: 6px;
120
+ text-align: center;
121
+ }
122
+ >menu-item.has-children {
123
+ &::after {
124
+ display: block;
125
+ content: "";
126
+ width: 0;
127
+ height: 0;
128
+ font-size: 0;
129
+ transform: none;
130
+ border: 2px solid;
131
+ border-top-color: transparent;
132
+ border-left-color: transparent;
133
+ position: absolute;
134
+ right: 3px;
135
+ bottom: 3px;
136
+ box-sizing: border-box;
137
+ line-height: 0;
138
+ top: auto;
139
+ margin: 0;
140
+ }
141
+ }
142
+ }
143
+
144
+ &[inline] {
123
145
  height: auto;
124
146
  box-shadow: none;
125
147
  padding: 0;
@@ -11,7 +11,7 @@ function main(elem, scope, hasIcon) {
11
11
  var name = scope.name;
12
12
  var icon = scope.icon;
13
13
  if (hasIcon === undefined) hasIcon = !!icon;
14
- render(item.children, { useIcon: hasIcon, hasIcon, name, icon });
14
+ render(item.children, scope, hasIcon instanceof Array ? hasIcon : [{ useIcon: hasIcon, hasIcon, name, icon }]);
15
15
  if (scope.line) item.setAttribute("line", ''), on("click")(item, preventDefault);
16
16
  return item;
17
17
  }
@@ -1,4 +1,6 @@
1
- <menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)"
2
- ng-mouseleave="cancel()" ng-mouseenter="popMenu.call(this)"
3
- ng-class="{'has-children':menu.children&&menu.children.length,'warn':menu.type==='danger'||menu.type==='warn'||menu.type==='red'}">
1
+ <menu-item ng-repeat="menu in menus" ng-if="!menu.hidden" ng-click="open.call(this)" ng-mouseleave="cancel()"
2
+ ng-mouseenter="popMenu.call(this)" ng-mousedown="popMenu1.call(this,event)" ng-class="{'has-children':menu.children&&menu.children.length,
3
+ 'warn':menu.type==='danger'||menu.type==='warn'||menu.type==='red',
4
+ 'selected':menu.selected
5
+ }">
4
6
  </menu-item>
@@ -102,23 +102,23 @@ var keyAction = function (deltax, deltay) {
102
102
  }
103
103
  };
104
104
  function keyalt() {
105
- if (root_menu === document.activeElement) root_menu.blur();
106
- else {
105
+ if (this === document.activeElement) this.blur();
106
+ else if (root_menu === this && root_menu !== document.activeElement) {
107
107
  root_menu.tabIndex = 0;
108
108
  root_menu.focus();
109
- root_menu.setFocus(this.firstMenu);
109
+ root_menu.setFocus(root_menu.firstMenu);
110
110
  }
111
111
  }
112
112
  function keytab(event) {
113
- if (root_menu !== document.activeElement) return;
114
113
  var menu = mounted_menus[mounted_menus.length - 1] || root_menu;
115
114
  event.preventDefault();
116
115
  menu.moveFocus(event.shiftKey ? -1 : 1);
117
116
  }
118
117
  function keyesc() {
119
- if (root_menu === document.activeElement && !mounted_menus.length) {
120
- if (!root_menu.ispop) root_menu.blur();
121
- else root_menu.ispop = false;
118
+ if (this !== document.activeElement) return;
119
+ if (!mounted_menus.length) {
120
+ if (!this.ispop) this.blur();
121
+ else this.ispop = false;
122
122
  }
123
123
  }
124
124
  function keyup() {
@@ -134,7 +134,6 @@ function keyright() {
134
134
  keyAction(1, 0);
135
135
  }
136
136
  function keyspace() {
137
- if (root_menu !== document.activeElement) return;
138
137
  var menu = mounted_menus[mounted_menus.length - 1];
139
138
  if (!menu || !menu.focused) menu = mounted_menus[mounted_menus.length - 2] || root_menu;
140
139
  if (menu.focused) {
@@ -142,23 +141,26 @@ function keyspace() {
142
141
  }
143
142
  }
144
143
  function register() {
145
- root_menu = this;
146
- bind('keydown.tab')(root_menu, keytab);
147
- bind('keydown.alt.')(root_menu, keyalt);
148
- bind('keydown.esc')(root_menu, keyesc);
149
- bind('keydown.left')(root_menu, keyleft);
150
- bind('keydown.right')(root_menu, keyright);
151
- bind('keydown.up')(root_menu, keyup);
152
- bind('keydown.down')(root_menu, keydown);
153
- bind('keydown.enter')(root_menu, keyspace);
154
- bind('keydown.space')(root_menu, keyspace);
144
+ var menu = this;
145
+ // if (!root_menu) root_menu = this;
146
+ bind('keydown.alt.')(menu, keyalt);
147
+ bind('keydown.esc')(menu, keyesc);
148
+ on('keydown.tab')(menu, keytab);
149
+ on('keydown.left')(menu, keyleft);
150
+ on('keydown.right')(menu, keyright);
151
+ on('keydown.up')(menu, keyup);
152
+ on('keydown.down')(menu, keydown);
153
+ on('keydown.enter')(menu, keyspace);
154
+ on('keydown.space')(menu, keyspace);
155
+ on("contextmenu")(menu, e => e.preventDefault());
155
156
  }
156
157
  function main(page, items, active, direction = 'y') {
157
158
  if (!isNode(page)) {
158
159
  var page = div();
159
160
  }
160
161
  var main = this;
161
- if (direction !== 'x') page.ispop = true;
162
+ if (direction == 'y') page.ispop = true;
163
+ var istoolbar = direction === 't';
162
164
  function popMenu(item, target) {
163
165
  if (page.actived) {
164
166
  clear();
@@ -195,7 +197,7 @@ function main(page, items, active, direction = 'y') {
195
197
  if (offenter1) offenter1();
196
198
  });
197
199
  }
198
- if (!page.ispop) on("blur")(page, unfocus);
200
+ on("blur")(page, unfocus);
199
201
  var template = page.tempalte || document.createElement("ylist");
200
202
  if (!page.tempalte) {
201
203
  template.className = '';
@@ -203,14 +205,19 @@ function main(page, items, active, direction = 'y') {
203
205
  template.innerHTML = page.innerHTML;
204
206
  page.tempalte = template;
205
207
  }
206
- var popTimer = 0;
207
- var open = function () {
208
+ var popTimer = 0, byMousedown;
209
+ var open = function (time) {
208
210
  cancel();
209
211
  var elem = this;
210
- if (page.ispop) popTimer = setTimeout(function () {
212
+ time = +time;
213
+ if (byMousedown && !time) return;
214
+ if (time) byMousedown = false;
215
+
216
+ if (page.ispop || time) popTimer = setTimeout(function () {
217
+ if (time) byMousedown = elem;
211
218
  page.setFocus(elem);
212
219
  popMenu(elem.menu, elem);
213
- }, 60);
220
+ }, time || 60);
214
221
  };
215
222
  var cancel = function () {
216
223
  clearTimeout(popTimer);
@@ -218,13 +225,29 @@ function main(page, items, active, direction = 'y') {
218
225
  var fire = function () {
219
226
  cancel();
220
227
  if (this.menu.line) return;
228
+ if (byMousedown) return;
221
229
  var pop = active(this.menu, this);
222
230
  if (pop === false) return;
223
231
  var root = page.root || page;
232
+ if (root.direction === 't') {
233
+ var menu = this.menu;
234
+ if (root !== page) {
235
+ delete menu.children;
236
+ var target = root.actived.target;
237
+ menu = extend(target.menu, menu);
238
+ }
239
+ else {
240
+ target = this;
241
+ }
242
+ if (root.selected) root.selected.selected = false;
243
+ menu.selected = true;
244
+ root.selected = target.menu;
245
+ }
224
246
  if (root.ispop === 1) root.ispop = false;
225
247
  if (page.actived && page.actived.target === this) {
226
248
  while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page.actived) remove(mounted_menus.pop());
227
249
  if (!mounted_menus.length) {
250
+ if (byMousedown === false) return;
228
251
  popMenu(this.menu, this);
229
252
  }
230
253
  else {
@@ -233,14 +256,17 @@ function main(page, items, active, direction = 'y') {
233
256
  }
234
257
  else {
235
258
  while (mounted_menus.length && mounted_menus[mounted_menus.length - 1] !== page) remove(mounted_menus.pop());
259
+ if (byMousedown === false) return;
236
260
  popMenu(this.menu, this);
237
261
  if (!page.actived) {
238
262
  (page.root || page).blur();
239
263
  }
240
264
  }
241
265
  };
242
-
243
-
266
+ var open1 = function (event) {
267
+ if (event.which === 3) event.preventDefault();
268
+ if (istoolbar) open.call(this, event.button ? 20 : 600);
269
+ };
244
270
  if (!page.children.length || page.menutype === 1) {
245
271
  page.menutype = 1;
246
272
  var hasIcon = function () {
@@ -268,11 +294,15 @@ function main(page, items, active, direction = 'y') {
268
294
  open: fire,
269
295
  cancel,
270
296
  popMenu: open,
297
+ popMenu1: open1
271
298
  };
272
299
  if (page.$src) {
273
300
  var src = page.$src;
274
301
  var itemName = src.itemName;
275
- var className = `{'has-children':${itemName}.children&&${itemName}.children.length,'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red'}`;
302
+ var className = `{'has-children':${itemName}.children&&${itemName}.children.length,
303
+ 'warn':${itemName}.type==='danger'||${itemName}.type==='warn'||${itemName}.type==='red',
304
+ 'selected':${itemName}.selected
305
+ }`;
276
306
  var notHidden = `!${itemName}.hidden`;
277
307
  var generator = getGenerator(page, 'menu-item');
278
308
  list(page, function (index) {
@@ -286,6 +316,7 @@ function main(page, items, active, direction = 'y') {
286
316
  a.menu = item;
287
317
  on("mouseleave")(a, cancel);
288
318
  on("mouseenter")(a, open);
319
+ if (istoolbar) on("mousedown")(a, open1);
289
320
  on("click")(a, fire);
290
321
  return a;
291
322
  });
@@ -316,6 +347,7 @@ function main(page, items, active, direction = 'y') {
316
347
  elem.menu = this.src[index];
317
348
  on("mouseleave")(elem, cancel);
318
349
  on("mouseenter")(elem, open);
350
+ if (istoolbar) on("mousedown")(elem, open1);
319
351
  on("click")(elem, fire);
320
352
  return elem;
321
353
  }, direction);
@@ -326,11 +358,14 @@ function main(page, items, active, direction = 'y') {
326
358
  page.active = function (a) {
327
359
  fire.call(a);
328
360
  };
329
- page.registerAsRoot = register;
330
361
  page.setFocus = setFocus;
331
362
  page.moveFocus = moveFocus;
332
363
  page.openFocus = openFocus;
333
364
  page.closeFocus = closeFocus;
334
365
  page.direction = direction;
366
+ register.call(page);
367
+ page.registerAsRoot = function () {
368
+ root_menu = this;
369
+ };
335
370
  return page;
336
371
  }
@@ -29,6 +29,11 @@
29
29
  color: #29c;
30
30
  }
31
31
 
32
+ &.selected {
33
+ background: #29c;
34
+ color: #fff;
35
+ }
36
+
32
37
  &.has-children {
33
38
  padding-right: 24px;
34
39
  padding-left: 16px;
@@ -48,6 +48,12 @@ var constructors = {
48
48
  }
49
49
  return e;
50
50
  },
51
+ success(e) {
52
+ success(e);
53
+ e.innerHTML = `<span ng-html="field.comment"></span>`;
54
+ render(e.children, e.$scope, e.$parentScopes);
55
+ return e;
56
+ },
51
57
  switch: swap,
52
58
  row: textarea,
53
59
  password,
@@ -149,16 +155,31 @@ var readonly_types = {
149
155
  var f = data[field.key];
150
156
  return size(f);
151
157
  },
158
+ html(a, data) {
159
+ var t = document.createElement("span");
160
+ t.innerHTML = seek(data, a.field.key);
161
+ return t;
162
+ },
152
163
  swap(e, data) {
153
164
  var { field } = e;
154
165
  var v = data[field.key];
155
166
  if (field.options) {
156
- var o = field.options[v];
167
+ if (!field.optionsMap) field.optionsMap = createOptionsMap(field.options);
168
+ var o = field.optionsMap[v];
157
169
  if (o) return o.name;
158
170
  }
171
+ if (isEmpty(v)) v = '';
159
172
  return v;
160
173
  },
161
174
  };
175
+ readonly_types.anchor = readonly_types.url;
176
+ var createOptionsMap = function (options) {
177
+ var map = Object.create(null);
178
+ for (var o of options) {
179
+ map[o.key] = o;
180
+ }
181
+ return map;
182
+ }
162
183
  readonly_types.select = readonly_types.swap;
163
184
  function main(elem) {
164
185
  var build = function () {
package/coms/zimoli/on.js CHANGED
@@ -155,14 +155,16 @@ function checkKeyNeed(eventtypes, e) {
155
155
  }
156
156
  return true;
157
157
  }
158
+ var pendingid = 0;
158
159
  function wrapHandler(h) {
159
160
  if (h instanceof Function) {
160
161
  return function () {
161
162
  var res = h.apply(this, arguments);
162
163
  if (res && isFunction(res.then)) {
163
- this.setAttribute('pending', '');
164
+ var id = ++pendingid & 0x1fffffffffffff;
165
+ this.setAttribute('pending', id);
164
166
  var removePending = () => {
165
- this.removeAttribute('pending');
167
+ if (+this.getAttribute('pending') === id) this.removeAttribute('pending');
166
168
  };
167
169
  res.then(removePending, removePending);
168
170
  }
@@ -273,7 +275,7 @@ if (is_addEventListener_enabled) {
273
275
  }
274
276
  if (e.button) {
275
277
  if (e.buttons === undefined) e.buttons = e.button;
276
- if (e.which === undefined) e.which = e.button;
278
+ if (e.which === undefined) e.which = e.button + 1;
277
279
  }
278
280
  if (e.keyCode) {
279
281
  if (e.which === undefined) e.which = e.keyCode;