efront 3.7.6 → 3.8.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 (40) hide show
  1. package/apps/kugou/api.js +1 -1
  2. package/apps/kugou/index.html +3 -0
  3. package/apps/pivot/api.yml +2 -2
  4. package/apps/pivot/menu.yml +9 -5
  5. package/apps/pivot/task/edit.js +1 -0
  6. package/apps/pivot/task/list.js +6 -0
  7. package/apps/pivot/tick/list.js +5 -0
  8. package/apps/pivot/token/edit.js +1 -10
  9. package/apps/pivot/token/list.js +2 -9
  10. package/coms/basic/strings.js +1 -1
  11. package/coms/compile/common.js +24 -6
  12. package/coms/compile/scanner2.js +129 -28
  13. package/coms/crypt/encode62.js +1 -1
  14. package/coms/frame/list.js +36 -34
  15. package/coms/frame/list.less +3 -1
  16. package/coms/kugou/buildScroll.less +3 -0
  17. package/coms/pivot/pedit.js +13 -0
  18. package/coms/pivot/plist.js +13 -0
  19. package/coms/zimoli/bggrid-func.less +16 -0
  20. package/coms/zimoli/color.js +18 -4
  21. package/coms/zimoli/colorlabel.js +3 -2
  22. package/coms/zimoli/colorlabel.less +24 -3
  23. package/coms/zimoli/colorpad.html +4 -0
  24. package/coms/zimoli/colorpad.js +120 -103
  25. package/coms/zimoli/colorpad.less +49 -47
  26. package/coms/zimoli/colorpicker.js +1 -1
  27. package/coms/zimoli/createElement.js +1 -1
  28. package/coms/zimoli/data.js +5 -1
  29. package/coms/zimoli/model.js +22 -2
  30. package/coms/zimoli/popup.js +2 -2
  31. package/coms/zimoli/render.js +2 -1
  32. package/coms/zimoli/select.js +3 -3
  33. package/coms/zimoli/selectList.js +35 -24
  34. package/coms/zimoli/selectList.less +4 -0
  35. package/coms/zimoli/selectListEdit.js +0 -1
  36. package/coms/zimoli/swap.less +1 -1
  37. package/coms/zimoli/table.html +2 -2
  38. package/coms/zimoli/table.js +1 -0
  39. package/package.json +2 -2
  40. package/public/efront.js +1 -1
package/apps/kugou/api.js CHANGED
@@ -12,7 +12,7 @@
12
12
  "singer-list": "get:[].singer-img-list>li singer/list/:id#href=a!href&=a!href\\singer-info&imgurl=img!_src&name=p|innerText",
13
13
  "singer-info": "mget:[].singer-songs-list>li singer/info/:id#hash=!id&singer=.singer-name|innerText&name=.song-name|innerText&data=em/innerText"
14
14
  },
15
- "https://mobilecdn.kugou.com/": {
15
+ "http://mobilecdn.kugou.com/": {
16
16
  "search?keyword": "get:data.info api/v3/search/song?format=json&page=1&pagesize=30&showtype=1"
17
17
  }
18
18
  })
@@ -17,6 +17,9 @@
17
17
  <script>
18
18
  cross_host = 'efront.cc';
19
19
  </script>
20
+ <script deleteoncompile>
21
+ cross_host = '';
22
+ </script>
20
23
  <style>
21
24
  *,
22
25
  ::before,
@@ -4,5 +4,5 @@
4
4
  share: options ::share-:opt?:path
5
5
  folder: options ::file-:opt:::path?:to
6
6
  cluster: options ::cluster-:opt?:id
7
- private-list: options ::private
8
- private-edit: options ::private-:key?:value
7
+ list: options :::type
8
+ edit: options :::type-:key?:value
@@ -1,7 +1,11 @@
1
1
  首页: /home/welcome
2
- 共享目录管理: /share/list
3
- 短链接: /home/short
4
- WEB文件管理: /wow/root
5
- 长连接管理: /link/list
6
- 密钥管理: /token/list
2
+ WEB:
3
+ 共享目录: /share/list
4
+ 短链接: /home/short
5
+ 文件管理: /wow/root
6
+ 长连接管理: /link/list
7
+ 任务:
8
+ 密钥管理: /token/list
9
+ 任务建立: /task/list
10
+ 定期执行: /tick/list
7
11
  # 用户列表: /user/list
@@ -0,0 +1 @@
1
+ pedit.bind(null, "任务", "task");
@@ -0,0 +1,6 @@
1
+ plist.bind(null, '任务管理', "task", refilm`
2
+ *任务ID/key 100
3
+ *任务名/name 100
4
+ *启用/status swap [关闭,开启]
5
+ 任务代码/code text
6
+ `, '/task/edit');
@@ -0,0 +1,5 @@
1
+ function main() {
2
+ var a = div();
3
+ a.innerHTML = "定时任务管理,敬请期待";
4
+ return a;
5
+ }
@@ -1,10 +1 @@
1
- frame$edit.bind(null, "密钥", {
2
- submit(a, fields) {
3
- a = submit(fields, a);
4
- return data.from("private-edit", {
5
- key: encode62.timeencode(a.key),
6
- value: encode62.timeencode(JSON.stringify(a)),
7
- }).loading_promise;
8
- },
9
-
10
- });
1
+ pedit.bind(null, "密钥", "private");
@@ -1,13 +1,6 @@
1
- frame$list.bind(null, "密钥管理", {
2
- load() {
3
- return data.from("private-list", a => JSAM.parse(encode62.timedecode(a)));
4
- },
5
- remove(o) {
6
- return data.from("private-edit", { key: encode62.timeencode(o.key), value: encode62.timeencode("") }).loading_promise;
7
- },
8
- fields: refilm`
1
+ plist.bind(null, '密钥管理', "private", refilm`
9
2
  *键名/key 100
10
3
  显示名/name input/300
11
4
  密钥/value text/100
12
5
  备注/comment text/200
13
- `}, "/token/edit");
6
+ `, "/token/edit");
@@ -25,7 +25,7 @@ function encode(str) {
25
25
  }) + "\"";
26
26
  }
27
27
  function decode(s) {
28
- var r = /^(['"])([\s\S]*)\1$/.exec(s);
28
+ var r = /^(['"`])([\s\S]*)\1$/.exec(s);
29
29
  if (!r) return s;
30
30
  return r[2].replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\([\s\S])/ig, (a, b) => {
31
31
  if (!b) {
@@ -118,6 +118,7 @@ var createScoped = function (parsed) {
118
118
  var isFunction = false;
119
119
  var isScope = false;
120
120
  var isArrow = false;
121
+ var isDeclare = false;
121
122
  switch (o.type) {
122
123
  case QUOTED:
123
124
  if (o.length) {
@@ -130,13 +131,18 @@ var createScoped = function (parsed) {
130
131
  if (o.next) {
131
132
  if (o.next.type !== STAMP || o.next.text !== ",") break;
132
133
  }
134
+ if (o.prev && o.prev.type === STRAP && o.prev.text === 'as') {
135
+ break;
136
+ }
133
137
  case VALUE:
134
138
  if (number_reg.test(o.text)) break;
135
139
  case EXPRESS:
136
140
  if (o.prev && o.prev.type === EXPRESS) {
137
141
  if (/\.$/.test(o.prev.text)) break;
138
142
  }
139
- var u = o.text.replace(/^([^\.\[]*)[\s\S]*$/, '$1');
143
+ var u = o.text;
144
+ if (/^\.\.\./.test(u)) u = u.slice(3);
145
+ var u = u.replace(/^([^\.\[]*)[\s\S]*$/, '$1');
140
146
  if (!u) break;
141
147
  if (o.next && o.next.type === STAMP && o.next.text === "=>") {
142
148
  isScope = true;
@@ -157,6 +163,9 @@ var createScoped = function (parsed) {
157
163
  case STRAP:
158
164
  var s = o.text;
159
165
  switch (s) {
166
+ case "as":
167
+ case "from":
168
+ break;
160
169
  case "var":
161
170
  case "import":
162
171
  var m = vars;
@@ -184,6 +193,7 @@ var createScoped = function (parsed) {
184
193
 
185
194
  if (o.type === EXPRESS) {
186
195
  vars[o.text] = true;
196
+ isDeclare = true;
187
197
  o.kind = isFunction ? 'function' : 'class';
188
198
  saveTo(used, o.text, o);
189
199
 
@@ -237,7 +247,7 @@ var createScoped = function (parsed) {
237
247
  scoped.used = used;
238
248
  }
239
249
  if (isArrow);
240
- else if (o.isExpress && o.type !== SCOPED) {
250
+ else if (o.isExpress && o.type !== SCOPED && !isDeclare) {
241
251
  o = o.next;
242
252
  if (o.type === EXPRESS) {
243
253
  vars[o.text] = true;
@@ -358,10 +368,19 @@ var getDeclared = function (o, kind) {
358
368
  }
359
369
  }
360
370
  switch (o.type) {
371
+ case STAMP:
372
+ if (o.text === "*" && o.next) {
373
+ if (o.next.type === STRAP && o.next.text === 'as') {
374
+ o = o.next.next;
375
+ continue;
376
+ }
377
+ }
361
378
  case PROPERTY:
362
- if (o.next && o.next.type === STAMP && o.next.text === ":") {
363
- o = o.next.next;
364
- continue;
379
+ if (o.next) {
380
+ if (o.next.type === STAMP && o.next.text === ":") {
381
+ o = o.next.next;
382
+ continue;
383
+ }
365
384
  }
366
385
  case STRAP:
367
386
  case VALUE:
@@ -379,7 +398,6 @@ var getDeclared = function (o, kind) {
379
398
  Object.assign(declared, d);
380
399
  o = o.next;
381
400
  break;
382
-
383
401
  default:
384
402
  console.log(o);
385
403
  throw new Error("代码结构异常");
@@ -95,8 +95,8 @@ var compress = function (scoped, maped) {
95
95
 
96
96
  var strings = require("../basic/strings");
97
97
 
98
- var insertAfter = function (o,) {
99
- var queue = o.queue;
98
+ var insertAfter = function (o) {
99
+ var queue = o.queue || this;
100
100
  var index = queue.indexOf(o) + 1;
101
101
  var os = [].slice.call(arguments, 1);
102
102
  queue.splice.apply(queue, [index, 0].concat(os));
@@ -111,6 +111,20 @@ var insertAfter = function (o,) {
111
111
  next.prev = o;
112
112
  }
113
113
  };
114
+ var detourTemplate = function (raw, params) {
115
+ var spliter = { text: ",", type: STAMP };
116
+ var template = scan(`extend([],{["raw"]:[]})`);
117
+ var str0 = template[1].first;
118
+ var str1 = template[1][2][2];
119
+ for (var r of raw) {
120
+ str0.push({ text: strings.encode(strings.decode("`" + r.text + "`")), type: QUOTED }, spliter);
121
+ str1.push({ text: strings.encode(r.text), type: QUOTED }, spliter);
122
+ }
123
+ str0.pop();
124
+ str1.pop();
125
+ for (var p of params) template.push(spliter, p);
126
+ return template;
127
+ };
114
128
 
115
129
  var detour = function (o, ie) {
116
130
  while (o) {
@@ -121,31 +135,103 @@ var detour = function (o, ie) {
121
135
  case EXPRESS:
122
136
  if (!/^\.\.\.|\.\.\.$/.test(o.text)) {
123
137
  var ot = o.text;
124
- o.text = o.text.replace(/\.([^\.\[]+)/g, (_, a) => !ie || program.strap_reg.test(a) ? `[${strings.encode(strings.decode(a))}]` : _);
138
+ o.text = o.text.replace(/\.([^\.\[]+)/g, (_, a) => ie === undefined || program.strap_reg.test(a) ? `[${strings.encode(strings.decode(a))}]` : _);
125
139
  }
126
140
  break;
127
141
  case QUOTED:
128
142
  if (o.length) {
129
- detour(o.first, ie);
143
+ if (!o.prev || o.prev.type === STAMP || o.prev.type === STRAP) {
144
+ o.type = SCOPED;
145
+ o.entry = '[';
146
+ o.leave = `]["join"]('')`;
147
+ for (var cx = o.length - 1; cx >= 0; cx--) {
148
+ var c = o[cx];
149
+ if (c.type === PIECE) {
150
+ c.type = QUOTED;
151
+ c.text = strings.encode(strings.decode("`" + c.text + "`"));
152
+ }
153
+ else {
154
+ insertAfter.call(o, c.prev, { type: STAMP, text: ',' });
155
+ c.entry = "(";
156
+ c.leave = ")";
157
+ insertAfter.call(o, c, { type: STAMP, text: ',' });
158
+ detour(c.first, ie);
159
+ }
160
+ }
161
+ }
162
+ else {
163
+ var raw = [];
164
+ var params = [];
165
+
166
+ for (var c of o) {
167
+ if (c.type === PIECE) {
168
+ raw.push(c);
169
+ } else {
170
+ c.entry = '(';
171
+ c.leave = ")";
172
+ detour(c, ie);
173
+ params.push(c.length === 1 ? c[0] : c);
174
+ }
175
+ }
176
+ o.type = SCOPED;
177
+ o.entry = "(";
178
+ o.leave = ")";
179
+ var temp = detourTemplate(raw, params);
180
+ o.splice(0, o.length);
181
+ o.push.apply(o, temp);
182
+ }
130
183
  break;
131
184
  }
185
+ else if (!o.prev || o.prev.type === STAMP || o.prev.type === STRAP) {
186
+ if (/^[`]/.test(o.text)) {
187
+ o.text = strings.encode(strings.decode(o.text));
188
+ }
189
+ }
190
+ else {
191
+ if (/^`/.test(o.text)) {
192
+ o.text = o.text.replace(/^`|`$/g, '');
193
+ var template = detourTemplate([o], []);
194
+ o.type = SCOPED;
195
+ o.entry = "(";
196
+ o.leave = ")";
197
+ delete o.text;
198
+ o.push.apply(o, template);
199
+ }
200
+ }
132
201
  if (!o.isprop) break;
133
202
  case PROPERTY:
134
203
  if (/^(get|set|async|static)$/.test(o.text) && o.next && (o.next.type === PROPERTY || o.next.isprop)) break;
135
204
  if (o.text === 'static' && o.next && o.next.type === SCOPED && o.next.entry === '{') break;
136
- if (!ie || program.strap_reg.test(o.text)) {
205
+ if (ie === undefined || program.strap_reg.test(o.text)) {
137
206
  if (!/^\[/.test(o.text) && o.queue.isObject) {
138
207
  if (o.short) {
139
208
  insertAfter(o, { text: ':', type: STAMP }, { text: o.text, type: EXPRESS, isExpress: true });
140
209
  o.short = false;
141
210
  }
142
211
  var text = strings.encode(strings.decode(o.text));
143
- o.text = ie ? text : `[${text}]`;
212
+ o.text = ie !== undefined ? text : `[${text}]`;
213
+ }
214
+ if (!/^\[/.test(o.text) && o.queue.isClass) {
215
+ if (o.text === 'constructor') break;
216
+ if (o.text === 'get') console.log(o.text, o.type, o.next);
217
+ var text = strings.encode(strings.decode(o.text));
218
+ if (o.prev) {
219
+ var prev = o.prev;
220
+ if (prev && prev.type === PROPERTY && /^(get|set|static|async)$/.test(prev.text)) {
221
+ prev = prev.prev;
222
+ }
223
+ if (prev && (prev.type !== STAMP || prev.text !== ';')) insertAfter(prev, { text: ';', type: STAMP });
224
+ }
225
+ o.text = `[${text}]`;
226
+ if (o.next && o.next.type === SCOPED && o.next.entry === "(") { }
227
+ else if (!o.next || o.next.type !== STAMP || o.next.text !== "=") {
228
+ insertAfter(o, { text: "=", type: STAMP }, { text: "undefined", type: VALUE, isExpress: true });
229
+ }
144
230
  }
145
231
  }
146
232
  break;
147
233
  }
148
- o = o.next;
234
+ if (o) o = o.next;
149
235
  }
150
236
  };
151
237
 
@@ -215,7 +301,7 @@ class Program extends Array {
215
301
  break;
216
302
  }
217
303
  case SCOPED:
218
- if (!this.pressed && (lasttype === STRAP || lasttype === SCOPED && o.entry === "{") && o.type !== QUOTED) result.push(" ");
304
+ if (!this.pressed && (lasttype === STRAP || lasttype === STAMP || lasttype === SCOPED && o.entry === "{") && o.type !== QUOTED) result.push(" ");
219
305
  result.push(o.entry);
220
306
  if (o.length > 0) {
221
307
  if (o.entry === "{" && result[0].type !== SPACE) {
@@ -290,8 +376,8 @@ class Program extends Array {
290
376
  return this;
291
377
  }
292
378
  // 绕开低版本ie的异常属性
293
- detour() {
294
- detour(this.first, true);
379
+ detour(ie) {
380
+ detour(this.first, !!ie);
295
381
  return this;
296
382
  }
297
383
  // 压缩
@@ -319,7 +405,7 @@ class Javascript {
319
405
  ["{", "}"],
320
406
  ]
321
407
  stamps = "/=+;|:?<>-!~@#%^&*,".split("")
322
- value_reg = /^(false|true|null|Infinity|NaN|undefined|arguments|this|eval)$/
408
+ value_reg = /^(false|true|null|Infinity|NaN|undefined|arguments|this|eval|super)$/
323
409
  number_reg = number_reg;
324
410
  transive = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|export|default|instanceof|throw|extends|import|from)$/
325
411
  straps = `if,in,do,as,of
@@ -364,15 +450,15 @@ class Javascript {
364
450
  scope.isprop = isProperty();
365
451
  }
366
452
  else if (scope.type === SCOPED && scope.entry === '[') {
367
- if (queue.isObject) {
368
- scope.isprop = !last || last.type === STAMP && last.text === ','
369
- }
370
- else if (queue.isClass) {
371
- scope.isprop = !last || last.type === STAMP && /^(\+\+|\-\-|;)$/.test(last.text)
372
- }
453
+ if (queue.isObject) scope.isprop = isProperty();
454
+ if (queue.isClass) scope.isprop = !last || last.isprop || last.type === STAMP && last.text === ';';
455
+ }
456
+ else if (scope.type === PROPERTY) {
457
+ scope.isprop = true;
373
458
  }
374
459
  if (scope.type !== COMMENT && scope.type !== SPACE) {
375
- if (scope.type === PROPERTY || scope.isprop) scope.queue = queue;
460
+ Object.defineProperty(scope, 'queue', { value: queue });
461
+ if (scope.type === PROPERTY || scope.isprop);
376
462
  else if (scope.type === STRAP && /^(get|set|static)$/.test(scope.text)) {
377
463
  scope.type = EXPRESS;
378
464
  }
@@ -395,8 +481,11 @@ class Javascript {
395
481
  else {
396
482
  scope.prev = last;
397
483
  }
484
+ scope.row = row;
485
+ scope.col = scope.start - colstart;
398
486
  queue.push(scope);
399
487
  };
488
+ var row = 1, colstart = -1;
400
489
  var save = (type) => {
401
490
  if (lasttype === STAMP && type === STAMP && !/[,;\:\?]/.test(m)) {
402
491
  var scope = queue[queue.length - 1];
@@ -437,19 +526,26 @@ class Javascript {
437
526
  }
438
527
  else if (isProperty()) type = PROPERTY;
439
528
  else if (m === 'from') {
440
- if (!last || last.type === STRAP && last.text !== 'import') {
529
+ if (!last || last.type === STRAP && !/^(im|ex)port$/.test(last.text)) {
441
530
  type = EXPRESS;
442
531
  break;
443
532
  }
444
533
  var temp = last;
445
- while (temp.type === EXPRESS || temp.type === VALUE || temp.type === SCOPED) {
446
- var prev = last.prev;
534
+ while (temp.type === STAMP && temp.text === "*" || temp.type === EXPRESS || temp.type === VALUE || temp.type === SCOPED) {
535
+ var prev = temp.prev;
447
536
  if (!prev) break;
448
- if (prev.type !== STAMP || prev.text !== ',') break;
537
+ if (prev.type === STRAP && prev.text === "as") {
538
+ temp = prev.prev;
539
+ continue;
540
+ }
541
+ if (prev.type !== STAMP || prev.text !== ',' && (prev.text !== "*" || !prev.prev || !~[STRAP, STAMP].indexOf(prev.prev.type))) {
542
+ temp = prev;
543
+ break;
544
+ }
449
545
  temp = prev.prev;
450
546
  if (!temp) break;
451
547
  }
452
- if (temp.type !== STRAP || temp.text !== 'import') {
548
+ if (!temp || temp.type !== STRAP || !/^(im|ex)port$/.test(temp.text)) {
453
549
  type = EXPRESS;
454
550
  }
455
551
  }
@@ -458,9 +554,9 @@ class Javascript {
458
554
  type = EXPRESS;
459
555
  break;
460
556
  }
461
- if (~[EXPRESS, VALUE].indexOf(last.type)) {
462
- last.type = PROPERTY;
463
- last.queue = queue;
557
+ if (~[PROPERTY, EXPRESS, VALUE].indexOf(last.type)
558
+ || last.type === STAMP && last.text === "*" && last.prev && ~[STRAP, STAMP].indexOf(last.prev.type)) {
559
+ Object.defineProperty(last, 'queue', { value: queue });
464
560
  } else {
465
561
  type = EXPRESS;
466
562
  }
@@ -570,6 +666,9 @@ class Javascript {
570
666
  if (prev.type === PROPERTY && /^(get|set|async|static)$/.test(prev.text)) {
571
667
  return true;
572
668
  }
669
+ if (queue.prev && queue.prev.type === STRAP && queue.prev.text === 'export') {
670
+ if (prev.type === STRAP && prev.text === "as") return true;
671
+ }
573
672
  return false;
574
673
  };
575
674
 
@@ -671,7 +770,9 @@ class Javascript {
671
770
  }
672
771
  if (this.space_reg.test(m)) {
673
772
  if (/[\r\n\u2028\u2029]/.test(m)) {
674
- m = m.replace(/^[^\r\n\u2028\u2029]+/, '').replace(/\r\n|\r|\n/g, "\r\n");
773
+ colstart = match.index + m.length - 1;
774
+ m = m.replace(/^[^\r\n\u2028\u2029]+/, '').replace(/\r\n|\r|\n|\u2028|\u2029/g, "\r\n");
775
+ row += m.replace(/[^\r\n]+/, '').length >> 1;
675
776
  save(SPACE);
676
777
  }
677
778
  lasttype = SPACE;
@@ -727,7 +828,7 @@ class Javascript {
727
828
  else scope.isObject = !/^(;|\+\+|\-\-|=>)$/.test(last.text);
728
829
  }
729
830
  else if (last.type === STRAP) {
730
- if (queue[queue.length - 1].type === SPACE && last.text === 'return');
831
+ if (queue[queue.length - 1].type === SPACE && /^(return|export)$/.test(last.text));
731
832
  else scope.isObject = queue.inExpress;
732
833
  }
733
834
  }
@@ -79,7 +79,7 @@ Object.assign(encode62, {
79
79
  for (var cx = 0, dx = data.length; cx < dx; cx++) {
80
80
  if (result[cx] < 128) result[cx] = result[cx] ^ sign[cx % sign.length];
81
81
  else if (result[cx] < 192) {
82
- var c = c << 8 | sign[(delta += 6) / 8 | 0];
82
+ var c = c << 8 | sign[(delta += 6) / 8 % sign.length | 0];
83
83
  result[cx] = result[cx] ^ (c >> 8 - delta % 8 & 0x3f);
84
84
  }
85
85
  }
@@ -1,4 +1,4 @@
1
- function main(title, { fields, load, remove }, edit_ref) {
1
+ function main(title, { fields, options: options0, load, remove }, edit_ref) {
2
2
  prepare(edit_ref);
3
3
  var page = document.createElement("div");
4
4
  var edit = function (o) {
@@ -11,6 +11,40 @@ function main(title, { fields, load, remove }, edit_ref) {
11
11
  })
12
12
  };
13
13
  page.innerHTML = template;
14
+ var options = [
15
+ {
16
+ name: "修改",
17
+ do(o) {
18
+ edit(o);
19
+ },
20
+ },
21
+ {
22
+ type: "danger",
23
+ name(o) {
24
+ return this.confirm === o ? "确认删除" : "删除";
25
+ },
26
+ type(o) {
27
+ return this.confirm === o ? "dark" : "danger";
28
+ },
29
+ confirm: false,
30
+ timer: 0,
31
+ async do(o) {
32
+ if (this.confirm !== o) {
33
+ this.confirm = o;
34
+ clearTimeout(this.timer);
35
+ var that = this;
36
+ this.timer = setTimeout(function () {
37
+ that.confirm = null;
38
+ render.refresh();
39
+ }, 2000);
40
+ return;
41
+ }
42
+ await remove(o);
43
+ page.$scope.load();
44
+ }
45
+ }
46
+ ];
47
+ if (options0) options = options.concat(options0);
14
48
  renderWithDefaults(page, {
15
49
  title,
16
50
  load() {
@@ -18,39 +52,7 @@ function main(title, { fields, load, remove }, edit_ref) {
18
52
  },
19
53
  fields: fields.concat({
20
54
  name: "操作",
21
- options: [
22
- {
23
- name: "修改",
24
- do(o) {
25
- edit(o);
26
- },
27
- },
28
- {
29
- type: "danger",
30
- name(o) {
31
- return this.confirm === o ? "确认删除" : "删除";
32
- },
33
- type(o) {
34
- return this.confirm === o ? "dark" : "danger";
35
- },
36
- confirm: false,
37
- timer: 0,
38
- async do(o) {
39
- if (this.confirm !== o) {
40
- this.confirm = o;
41
- clearTimeout(this.timer);
42
- var that = this;
43
- this.timer = setTimeout(function () {
44
- that.confirm = null;
45
- render.refresh();
46
- }, 2000);
47
- return;
48
- }
49
- await remove(o);
50
- page.$scope.load();
51
- }
52
- }
53
- ]
55
+ options
54
56
  }),
55
57
  data: [],
56
58
  add() {
@@ -10,7 +10,9 @@ btn {
10
10
  table {
11
11
 
12
12
  td {
13
- >span {
13
+
14
+ >span,
15
+ >model {
14
16
  white-space: normal;
15
17
  word-break: break-all;
16
18
  overflow: hidden;
@@ -7,6 +7,9 @@
7
7
  top: 0;
8
8
  height: auto;
9
9
  }
10
+ &+.titlebar>back{
11
+ height: 44px;
12
+ }
10
13
 
11
14
  >png {
12
15
  width: 100%;
@@ -0,0 +1,13 @@
1
+ function main(title, type, params) {
2
+ return frame$edit(title, {
3
+ submit(a, fields) {
4
+ a = submit(fields, a);
5
+ return data.from("edit", {
6
+ type,
7
+ key: encode62.timeencode(a.key),
8
+ value: encode62.timeencode(JSON.stringify(a)),
9
+ }).loading_promise;
10
+ },
11
+
12
+ }, params);
13
+ }
@@ -0,0 +1,13 @@
1
+
2
+ function main(title, type, fields, edit_ref, options) {
3
+ return frame$list(title, {
4
+ load() {
5
+ return data.from("list", { type }, a => JSAM.parse(encode62.timedecode(a)));
6
+ },
7
+ remove(o) {
8
+ return data.from("edit", { type, key: encode62.timeencode(o.key), value: encode62.timeencode("") }).loading_promise;
9
+ },
10
+ fields,
11
+ options,
12
+ }, edit_ref);
13
+ }
@@ -0,0 +1,16 @@
1
+ .grid() {
2
+ @mask-color1 : rgba(255, 255, 255, .6);
3
+ @mask-color2 : rgba(0, 0, 0, 0);
4
+ @mask-color3 : rgba(0, 0, 0, .1);
5
+ background-image:
6
+ linear-gradient(45deg, @mask-color1, 25%, @mask-color1, 25%, @mask-color2, 75%, @mask-color1, 75%, @mask-color1),
7
+ linear-gradient(45deg, @mask-color1, 25%, @mask-color1, 25%, @mask-color2, 75%, @mask-color1, 75%, @mask-color1),
8
+ linear-gradient(45deg, @mask-color3, 25%, @mask-color3, 25%, @mask-color2, 75%, @mask-color3, 75%, @mask-color3),
9
+ linear-gradient(45deg, @mask-color3, 25%, @mask-color3, 25%, @mask-color2, 75%, @mask-color3, 75%, @mask-color3);
10
+ background-size: 20px 20px;
11
+ background-position: 0 0, 10px 10px, 10px 0, 0 10px;
12
+ background-repeat: repeat;
13
+ background-clip: border-box;
14
+ background-color: #fff;
15
+
16
+ }