efront 4.4.14 → 4.5.3

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 (60) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +83 -5
  2. package/apps/pivot/api.yml +4 -0
  3. package/apps/pivot/cert/edit.js +1 -0
  4. package/apps/pivot/cert/list.js +9 -0
  5. package/apps/pivot/cert/main.xht +188 -0
  6. package/apps/pivot/cert/orders.xht +232 -0
  7. package/apps/pivot/cert/update.xht +7 -0
  8. package/apps/pivot/menu.yml +1 -0
  9. package/coms/basic/assert.js +40 -16
  10. package/coms/basic/cross_.js +22 -4
  11. package/coms/basic/renderTags.js +23 -0
  12. package/coms/basic/shallowClone.js +8 -0
  13. package/coms/basic/shallowEqual.js +13 -4
  14. package/coms/basic/valid.js +19 -4
  15. package/coms/compile/Javascript.js +25 -12
  16. package/coms/compile//347/264/240/351/246/250.js +2 -1
  17. package/coms/docs/codetext.xht +3 -3
  18. package/coms/frame/chat.js +1 -1
  19. package/coms/frame/edit.html +1 -0
  20. package/coms/frame/edit.js +3 -2
  21. package/coms/kugou/bindScroll.js +1 -1
  22. package/coms/kugou/krc.js +2 -2
  23. package/coms/layer/leftCenter.js +5 -5
  24. package/coms/pivot/acme2.js +290 -0
  25. package/coms/pivot/pedit.js +13 -5
  26. package/coms/pivot/plist.js +12 -5
  27. package/coms/reptile/colored_console.js +5 -17
  28. package/coms/zimoli/appendChild.js +3 -2
  29. package/coms/zimoli/autofocus.js +2 -2
  30. package/coms/zimoli/button.less +5 -3
  31. package/coms/zimoli/checker.js +34 -15
  32. package/coms/zimoli/checker.less +2 -3
  33. package/coms/zimoli/container.js +26 -15
  34. package/coms/zimoli/data.js +124 -169
  35. package/coms/zimoli/field.js +3 -3
  36. package/coms/zimoli/field.less +8 -2
  37. package/coms/zimoli/filterTime.js +39 -8
  38. package/coms/zimoli/fromBase64.js +2 -0
  39. package/coms/zimoli/grid.js +2 -2
  40. package/coms/zimoli/isMounted.js +3 -3
  41. package/coms/zimoli/list.js +5 -5
  42. package/coms/zimoli/maps.js +1 -1
  43. package/coms/zimoli/menuList.js +1 -1
  44. package/coms/zimoli/model.js +61 -8
  45. package/coms/zimoli/on.js +4 -4
  46. package/coms/zimoli/remove.js +3 -3
  47. package/coms/zimoli/render.js +25 -33
  48. package/coms/zimoli/scrollbar.js +54 -19
  49. package/coms/zimoli/scrollbar.less +14 -2
  50. package/coms/zimoli/scrollbar_test.less +1 -0
  51. package/coms/zimoli/select.js +3 -3
  52. package/coms/zimoli/table.js +1 -1
  53. package/coms/zimoli/toBase64.js +16 -6
  54. package/coms/zimoli/view.js +24 -14
  55. package/coms/zimoli/view.less +6 -4
  56. package/coms/zimoli/watch.js +1 -1
  57. package/docs/loader.js +1 -1
  58. package/docs//347/273/204/344/273/266.xht +0 -1
  59. package/package.json +1 -1
  60. package/public/efront.js +1 -1
@@ -2,21 +2,29 @@ function send(type, key, value, origin) {
2
2
  return data.from(origin ? "edit" : "add", {
3
3
  type,
4
4
  key: encode62.timeencode(key),
5
- value: encode62.timeencode(JSON.stringify(value)),
6
- }).loading_promise;
5
+ value: isHandled(value) ? encode62.timeencode(JSON.stringify(value)) : '',
6
+ }, e => e ? JSAM.parse(encode62.timedecode(e)) : '').loading_promise;
7
7
  }
8
8
  function pedit(title, type, params, idkey = params.fields[0].key) {
9
+ var pdata = params.data;
9
10
  return frame$edit(title, {
10
11
  submit(a, fields) {
11
12
  a = submit(fields, a);
12
- return send(type, a[idkey], a, params.data);
13
+ return send(type, a[idkey], a, pdata);
13
14
  },
14
-
15
15
  }, params);
16
16
  }
17
17
  pedit.create = function (type, key, value) {
18
18
  return send(type, key, value, false);
19
19
  }
20
- pedit.update = function (type, key, value) {
20
+ var query = pedit.query = function (type, key) {
21
+ return send(type, key, null, true);
22
+ }
23
+ var update = pedit.update = function (type, key, value) {
21
24
  return send(type, key, value, true);
25
+ }
26
+ pedit.merge = async function (type, key, params) {
27
+ var data = await query(type, key);
28
+ extendIfNeeded(params, data);
29
+ return update(type, key, params);
22
30
  }
@@ -1,5 +1,10 @@
1
-
2
- function main() {
1
+ function load(type) {
2
+ return data.from("list", { type }, a => JSAM.parse(encode62.timedecode(a || '')));
3
+ }
4
+ function remove(type, key) {
5
+ return data.from("edit", { type, key: encode62.timeencode(key), value: encode62.timeencode("") }).loading_promise;
6
+ }
7
+ function plist() {
3
8
  var title, type, fields, edit_ref, options, idkey, buttons;
4
9
  var parse = function (a) {
5
10
  switch (typeof a) {
@@ -33,10 +38,10 @@ function main() {
33
38
  if (!idkey) idkey = fields[0].key;
34
39
  return frame$list(title, {
35
40
  load() {
36
- return data.from("list", { type }, a => JSAM.parse(encode62.timedecode(a || '')));
41
+ return load(type);
37
42
  },
38
43
  remove(o) {
39
- return data.from("edit", { type, key: encode62.timeencode(o[idkey]), value: encode62.timeencode("") }).loading_promise;
44
+ return remove(type, o[idkey]);
40
45
  },
41
46
  fields,
42
47
  buttons,
@@ -48,4 +53,6 @@ function main() {
48
53
  move.setPosition(p, [.5, .5]);
49
54
  return p;
50
55
  });
51
- }
56
+ }
57
+ plist.load = load;
58
+ plist.remove = remove;
@@ -2,10 +2,12 @@
2
2
  var colored = Object.create(null);
3
3
  var lazy = require("../basic/lazy");
4
4
  var colors = require("./colors");
5
+ var renderTags = require("../basic/renderTags");
5
6
  var strings = require("../basic/strings");
6
7
  var lastLogLength = 0;
7
8
  var needNextLine = false;
8
9
  var getColor = function (c) {
10
+ if (!c) return colors.Reset;
9
11
  switch (c) {
10
12
  case "red":
11
13
  case "error":
@@ -30,23 +32,9 @@ var getColor = function (c) {
30
32
  }
31
33
  return '';
32
34
  };
33
- var colorReg = /<(\/?)([a-z][\w]*)\>/ig;
35
+ var colorReg = renderTags.reg;
34
36
  var renderColor = function (obj) {
35
- var colorpath = [];
36
- return String(obj).replace(colorReg, function (_, e, c) {
37
- if (!c || c.length < 3 || !getColor(c)) return _;
38
- if (e) {
39
- colorpath.pop();
40
- c = colorpath[colorpath.length - 1];
41
- }
42
- else colorpath.push(c);
43
- if (c) var color = getColor(c);
44
- var res = [];
45
- if (e) res.push(colors.Reset);
46
- if (color) res.push(color);
47
- if (res.length) return res.join('');
48
- return _;
49
- });
37
+ return renderTags(obj, getColor);
50
38
  };
51
39
 
52
40
  var write = function (hasNewLine, str) {
@@ -195,7 +183,7 @@ var format = function (arg, deep = 0) {
195
183
  }
196
184
  if (arg instanceof Buffer || arg instanceof ArrayBuffer || arg instanceof SharedArrayBuffer) {
197
185
  var data = new Uint8Array(arg.buffer || arg, arg.byteOffset || 0, arg.byteLength);
198
- return `<magenta><${arg.constructor.name} ${Array.prototype.slice.call(data, 0, 20).map(a => a < 16 ? "0" + a.toString(16) : a.toString(16)).join(' ')}${arg.byteLength > 20 ? ` ... 其他 ${arg.byteLength - 20} 字节` : ''}></megenta>`;
186
+ return `<magenta><${arg.constructor.name} ${Array.prototype.slice.call(data, 0, 20).map(a => a < 16 ? "0" + a.toString(16) : a.toString(16)).join(' ')}${arg.byteLength > 20 ? ` ... 其他 ${arg.byteLength - 20} 字节` : ''}></magenta>`;
199
187
  }
200
188
  else if (isFinite(arg.length)) {
201
189
  var entry = "[";
@@ -9,9 +9,9 @@ function hasEnterStyle(e) {
9
9
  }
10
10
 
11
11
  function _onappend(node, append = createEvent("append"), mount = createEvent("mounted")) {
12
- if (node.isMounted) return;
12
+ if (node.$mounted) return;
13
13
  if (node.nodeType !== 1 && node.nodeType !== 8) return;
14
- node.isMounted = true;
14
+ node.$mounted = true;
15
15
  dispatch(node, append);
16
16
  var children = Array.apply(null, node.childNodes);
17
17
  for (var c of children) {
@@ -71,6 +71,7 @@ function insertAfter(alreadyMounted, obj, transition) {
71
71
  children = children.reverse();
72
72
  for (var cx = 0, dx = children.length; cx < dx; cx++) {
73
73
  var o = release(children[cx]);
74
+ if (!o) continue;
74
75
  if (o.removeTimer) clearTimeout(o.removeTimer);
75
76
  parent.insertBefore(o, alreadyMounted.nextSibling);
76
77
  o.with && insertBefore(alreadyMounted.nextSibling, o.with, transition);
@@ -1,7 +1,7 @@
1
1
  function autofocus(e) {
2
- if (!e.renders) e.renders = [];
2
+ if (!e.$renders) e.$renders = [];
3
3
  var savedElement;
4
- e.renders.push(function () {
4
+ e.$renders.push(function () {
5
5
  var parent = rootElements[rootElements.length - 1] || document.body;
6
6
  if (savedElement === this) {
7
7
  if (this !== parent || getTargetIn(parent, document.activeElement)) return;
@@ -1,7 +1,10 @@
1
1
  @default-color: #0092cc;
2
2
 
3
+ :not(button, a)& {
4
+ display: inline-block;
5
+ }
6
+
3
7
  & {
4
- font-size: 14px;
5
8
  width: auto;
6
9
  line-height: 28px;
7
10
  background-color: @default-color;
@@ -11,7 +14,6 @@
11
14
  position: relative;
12
15
  border: none;
13
16
  margin: 0;
14
- display: inline-block;
15
17
  white-space: nowrap;
16
18
  text-align: center;
17
19
  overflow: hidden;
@@ -179,7 +181,6 @@
179
181
  content: "↻";
180
182
  font-family: 'Times New Roman', Times, serif;
181
183
  display: inline-block;
182
- vertical-align: middle;
183
184
  position: absolute;
184
185
  animation: busy-pending 2s linear 0s infinite;
185
186
  }
@@ -239,6 +240,7 @@ a&,
239
240
  opacity: 0;
240
241
  box-shadow: none;
241
242
  background: none;
243
+ display: none;
242
244
  }
243
245
  }
244
246
 
@@ -1,15 +1,34 @@
1
- function main(elem = document.createElement("check")) {
2
- var page = elem;
3
- page.innerHTML = checker;
4
- page.setValue = function (value) {
5
- value = !!value;
6
- if (value === this.value) return;
7
- this.value = value;
8
- if (value) {
9
- addClass(page, 'checked');
10
- } else {
11
- removeClass(page, 'checked');
12
- }
13
- };
14
- return page;
15
- }
1
+ var falseMap = Object.create(null);
2
+ falseMap["off"] = "on";
3
+ falseMap["false"] = "true";
4
+ falseMap["null"] = "true";
5
+ falseMap["0"] = "1";
6
+ var trueMap = Object.create(null);
7
+ for (var k in falseMap) trueMap[falseMap[k]] = falseMap[k];
8
+ var isTrue = function (v) {
9
+ return !!+v || v in trueMap;
10
+ };
11
+ var changeValue = function (value) {
12
+ if (typeof value === 'boolean') return !value;
13
+ if (value & 1 === value) return 1 - value;
14
+ if (value in trueMap) return trueMap[value];
15
+ if (typeof value === 'number') return +!+value;
16
+ return !+value;
17
+ };
18
+ var setValue = function (value) {
19
+ if (value === this.value) return;
20
+ this.value = value;
21
+ value = isTrue(value);
22
+ if (value) {
23
+ addClass(this, 'checked');
24
+ } else {
25
+ removeClass(this, 'checked');
26
+ }
27
+ };
28
+ function checker(ck = document.createElement('check')) {
29
+ ck.innerHTML = template;
30
+ ck.setValue = setValue;
31
+ return ck;
32
+ }
33
+ checker.isTrue = isTrue;
34
+ checker.changeValue = changeValue;
@@ -3,14 +3,13 @@
3
3
  width: .8em;
4
4
  position: relative;
5
5
  border: .1em solid;
6
- margin-right: .3em;
6
+ margin: -0.06em .3em -0.06em 0;
7
7
  font-family: sans-serif;
8
8
  display: inline-block;
9
9
  line-height: 1;
10
10
  text-align: center;
11
- margin-top: .15em;
11
+ box-sizing: border-box;
12
12
  border-radius: .12em;
13
- vertical-align: middle;
14
13
 
15
14
  >s {
16
15
  display: none;
@@ -1,34 +1,45 @@
1
- var change = async function (data) {
2
- if (!data) remove(this.with);
3
- else if (isNode(data)) {
4
- if (isElement(data) && this.$struct.copys) {
1
+ var change = lazy(async function (src) {
2
+ if (src !== this.$src) return;
3
+ if (!src) remove(this.with);
4
+ else if (isNode(src)) {
5
+ if (isElement(src) && this.$struct.copys) {
5
6
  for (var c of this.$struct.copys) {
6
7
  if (c.name === 'class') {
7
- addClass(data, c.value);
8
+ addClass(src, c.value);
8
9
  }
9
10
  else if (c.name === 'style') {
10
- css(data, c.value);
11
+ css(src, c.value);
11
12
  }
12
- else data.setAttribute(c.name, c.value);
13
+ else src.setAttribute(c.name, c.value);
13
14
  }
14
15
  }
15
- zimoli.global(data, this);
16
+ zimoli.global(src, this);
16
17
  }
17
- else if (isString(data) || +data < 0) zimoli.go(data, this.params, this);
18
- };
19
- var gosrc = function () {
20
- var { src } = this;
21
- if (this.hasAttribute && this.hasAttribute('src')) {
22
- src = this.getAttribute('src');
18
+ else if (isString(src) || +src < 0) {
19
+ watch(this, 'params', onparams);
20
+ onparams.call(this, this.params);
23
21
  }
22
+ });
23
+ var gosrc = function (src) {
24
+ if (!isHandled(this.$src) && !isHandled(src)) return;
24
25
  if (src !== this.$src) {
25
- change.call(this, src);
26
26
  this.$src = src;
27
+ change.call(this, src);
27
28
  }
28
29
  };
30
+ var onparams = lazy(function (params) {
31
+ zimoli.go(this.$src, params, this);
32
+ });
29
33
  function container(element) {
30
34
  var comment = document.createComment('container');
31
35
  comment.$struct = element.$struct;
32
36
  care(comment, gosrc);
37
+ if (element.hasAttribute && element.hasAttribute('src')) {
38
+ var src = element.getAttribute('src');
39
+ if (src) oncemount(comment, function () {
40
+ if ("$src" in this) return;
41
+ gosrc.call(this, src);
42
+ });
43
+ }
33
44
  return comment;
34
45
  }