efront 3.12.4 → 3.13.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.
Files changed (53) hide show
  1. package/apps/pivot/api.yml +2 -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 +24 -0
  6. package/apps/pivot/log/boot.less +3 -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/menu.yml +7 -1
  11. package/apps/pivot/share/list.less +0 -4
  12. package/apps/pivot/user/edit.js +1 -0
  13. package/apps/pivot/user/list.js +4 -0
  14. package/apps/pivot/user/tag/edit.js +1 -0
  15. package/apps/pivot/user/tag/list.js +3 -0
  16. package/coms/basic/parseYML.js +1 -1
  17. package/coms/basic/renderExpress.js +1 -1
  18. package/coms/frame/route.js +4 -0
  19. package/coms/pivot/plist.js +1 -1
  20. package/coms/zimoli/AudioContext_test.html +1 -1
  21. package/coms/zimoli/AudioContext_test.js +3 -3
  22. package/coms/zimoli/bind.js +4 -2
  23. package/coms/zimoli/cloneVisible.js +9 -2
  24. package/coms/zimoli/css.js +13 -5
  25. package/coms/zimoli/data.js +1 -1
  26. package/coms/zimoli/drag.js +3 -2
  27. package/coms/zimoli/field.html +15 -10
  28. package/coms/zimoli/menu.js +33 -13
  29. package/coms/zimoli/menu.less +31 -9
  30. package/coms/zimoli/menuItem.js +1 -1
  31. package/coms/zimoli/menuList.html +5 -3
  32. package/coms/zimoli/menuList.js +63 -28
  33. package/coms/zimoli/menuList.less +5 -0
  34. package/coms/zimoli/model.js +22 -2
  35. package/coms/zimoli/on.js +5 -3
  36. package/coms/zimoli/picture.js +30 -335
  37. package/coms/zimoli/picture_.js +356 -0
  38. package/coms/zimoli/prompt.js +3 -1
  39. package/coms/zimoli/render.js +22 -10
  40. package/coms/zimoli/renderDefaults.js +1 -0
  41. package/coms/zimoli/search.js +5 -4
  42. package/coms/zimoli/select.js +12 -8
  43. package/coms/zimoli/selectList.js +12 -9
  44. package/coms/zimoli/selectListEdit.js +1 -1
  45. package/coms/zimoli/slider.js +13 -6
  46. package/coms/zimoli/success.js +4 -0
  47. package/coms/zimoli/success.less +13 -0
  48. package/coms/zimoli/table.html +6 -8
  49. package/coms/zimoli/table.js +25 -2
  50. package/coms/zimoli/table.less +24 -4
  51. package/coms/zimoli/view.less +4 -0
  52. package/package.json +1 -1
  53. package/public/efront.js +1 -1
@@ -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,
@@ -100,7 +106,7 @@ var constructors = {
100
106
  break;
101
107
  }
102
108
  }
103
- var pad = selectList(field.options, field.multi, true);
109
+ var pad = selectList(field.options, !!field.multi, true);
104
110
  var e = document.createElement('select');
105
111
  e.innerHTML = `<option selected value="${opt ? opt.key : ''}">${opt ? opt.name : '请选择'}</option>`;
106
112
  e.value = opt ? opt.key : '';
@@ -149,16 +155,30 @@ 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
+ var createOptionsMap = function (options) {
176
+ var map = Object.create(null);
177
+ for (var o of options) {
178
+ map[o.key] = o;
179
+ }
180
+ return map;
181
+ }
162
182
  readonly_types.select = readonly_types.swap;
163
183
  function main(elem) {
164
184
  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;