efront 3.8.4 → 3.9.1

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.
@@ -6,3 +6,5 @@
6
6
  cluster: options ::cluster-:opt?:id
7
7
  list: options :::type
8
8
  edit: options :::type-:key?:value
9
+ params: options ::params-:key
10
+ invoke: options ::invoke-:key?:params
@@ -13,7 +13,8 @@ function main() {
13
13
  });
14
14
  renderWithDefaults(page, {
15
15
  fields, data: {
16
- host: location.host,
16
+ host: data.getInstance("base").host || location.host,
17
+
17
18
  }, pending: false
18
19
  });
19
20
  on("submit")(page, async function () {
@@ -24,14 +25,10 @@ function main() {
24
25
  try {
25
26
  var login = await data.getApi("login");
26
27
  login.base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";
27
- cross.addDirect(login.base);
28
+ data.setInstance("base", { base: login.base, host: parseURL(login.base).host });
28
29
  var info = await data.from(login, {
29
30
  a: encode62.timeencode(encode62.geta(password))
30
31
  }).loading_promise;
31
- var apimap = await data.getConfig();
32
- for (var k in apimap) {
33
- apimap[k].base = login.base;
34
- }
35
32
  info = encode62.timeupdate(info);
36
33
  data.setSource({ authorization: info });
37
34
  user.login({})
@@ -4,6 +4,13 @@ var token = data.getSource('authorization');
4
4
  if (token) {
5
5
  user.login({});
6
6
  }
7
+ data.bindInstance("base", async function (base) {
8
+ cross.addDirect(base.base);
9
+ var apimap = await data.getConfig();
10
+ for (var k in apimap) {
11
+ apimap[k].base = base.base;
12
+ }
13
+ });
7
14
  setInterval(function () {
8
15
  var auth = data.getSource('authorization');
9
16
  if (!auth) return;
@@ -0,0 +1,17 @@
1
+ <div head>
2
+ <span -text="task.name"></span>
3
+ (<span -text="task.key"></span>)
4
+ <close @click="remove()"></close>
5
+ </div>
6
+ <div body>
7
+ <div class="left">
8
+ <field -repeat="f in fields" -src="[f,data]"></field>
9
+ <pre -text="task.code"></pre>
10
+ </div>
11
+ <div class="right" :class="{error:error}">
12
+ <pre -text="output"></pre>
13
+ </div>
14
+ </div>
15
+ <div foot>
16
+ <btn @click="run">执行</btn>
17
+ </div>
@@ -0,0 +1,37 @@
1
+ function main(a) {
2
+ var page = view();
3
+ page.innerHTML = template;
4
+ drag.on(page.firstChild, page);
5
+ var fields = data.from("params", { key: a.key }, function (a) {
6
+ return a ? JSON.parse(encode62.timedecode(a)) : [];
7
+ });
8
+ var taskid = 0;
9
+ renderWithDefaults(page, {
10
+ remove() {
11
+ remove(page);
12
+ },
13
+ data: {},
14
+ fields: fields,
15
+ task: a,
16
+ output: '',
17
+ error: false,
18
+ async run() {
19
+ var id = ++taskid;
20
+ this.output = "正在执行..";
21
+ this.error = false;
22
+ var params = JSON.stringify(this.data);
23
+ try {
24
+ var res = await data.from("invoke", { key: a.key, params: encode62.timeencode(params) }, function (a) {
25
+ return a ? encode62.timedecode(a) : '完成!';
26
+ });
27
+ if (id !== taskid) return;
28
+ this.output = res;
29
+ } catch (e) {
30
+ this.output = String(e);
31
+ this.error = true;
32
+ }
33
+ }
34
+ });
35
+ resize.on(page);
36
+ return page;
37
+ }
@@ -0,0 +1,23 @@
1
+ & {
2
+ position: absolute;
3
+ width: 800px;
4
+ }
5
+
6
+ >[body]>div {
7
+ display: inline-block;
8
+ width: 50%;
9
+ vertical-align: top;
10
+ overflow: auto;
11
+ font-size: 12px;
12
+ border-bottom: 50px solid transparent;
13
+ padding: 0 10px;
14
+
15
+ &.right {
16
+ background: #000;
17
+ color: #fff;
18
+ height: 100%;
19
+ }
20
+ &.error{
21
+ color: #c26;
22
+ }
23
+ }
@@ -1,6 +1,14 @@
1
1
  plist.bind(null, '任务管理', "task", refilm`
2
2
  *任务ID/key 100
3
3
  *任务名/name 100
4
- *启用/status swap [关闭,开启]
4
+ *是否启用/status radio [不启用,启用]
5
5
  任务代码/code text
6
+ 执行/ - ${[{
7
+ when(o) {
8
+ return o.status === 1;
9
+ },
10
+ name: "执行", do(o) {
11
+ popup("/task/invoke", o);
12
+ }
13
+ }]}
6
14
  `, '/task/edit');
@@ -154,8 +154,8 @@ var readFile = function (names, then) {
154
154
  tryload();
155
155
 
156
156
  };
157
- var createFunction = function (name, body, args) {
158
- return window.eval(`[function/*${name}*/(${args || ''}){\r\n${body}\r\n}][0]`);
157
+ var createFunction = function (name, body, args, isAsync, isYield) {
158
+ return window.eval(`[${isAsync ? 'async ' : ''}function${isYield ? "*" : ""}/*${name}*/(${args || ''}){\r\n${body}\r\n}][0]`);
159
159
  };
160
160
 
161
161
  var FILE_NAME_REG = /^https?\:|\.(html?|css|asp|jsp|php)$/i;
@@ -269,13 +269,13 @@ var loadModule = function (name, then, prebuilds = {}) {
269
269
  flushTree(loadedModules, key);
270
270
  return;
271
271
  }
272
- var [argNames, body, args, required, strs] = getArgs(data);
272
+ var [argNames, body, args, required, strs, isAsync, isYield] = getArgs(data);
273
273
  if (isProduction) {
274
274
  strs = strs.map ? strs.map(toRem) : strs;
275
275
  } else {
276
276
  body = toRem(body);
277
277
  }
278
- var mod = createFunction(name, body, argNames);
278
+ var mod = createFunction(name, body, argNames, isAsync, isYield);
279
279
  if (!mod) console.log(name, mod);
280
280
  mod.args = args;
281
281
  mod.argNames = argNames;
@@ -399,8 +399,10 @@ var getArgs = function (text) {
399
399
  } else {
400
400
  functionBody = text;
401
401
  }
402
+ var [, isAsync, isYield] = /^(@?)(\*?)/.exec(functionBody);
403
+ if (isAsync || isYield) functionBody = functionBody.slice(+!!isAsync + +!!isYield);
402
404
  functionBody = functionBody.replace(/^(?:\s*(["'])user? strict\1;?[\r\n]*)*/i, "\"use strict\";\r\n");
403
- return [argNames || [], functionBody, args || [], required || '', strs || []];
405
+ return [argNames || [], functionBody, args || [], required || '', strs || [], !!isAsync, !!isYield];
404
406
  };
405
407
  var get_relatives = function (name, required, prefix = "") {
406
408
  var required_base = name.replace(/[^\/\$]+$/, "");
@@ -505,7 +507,7 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
505
507
  result = res;
506
508
  created = true;
507
509
  _ok(res);
508
- }, prebuilds);
510
+ });
509
511
  if (created) return result;
510
512
  return promise;
511
513
  });
@@ -320,7 +320,7 @@ function parse(piece) {
320
320
  name = name.slice(0, commaindex);
321
321
  }
322
322
  }
323
- [name, key] = scanSlant(name, '/');
323
+ [name, key] = scanSlant(name, '/', 0, name.length + 1);
324
324
  if (key === undefined && !/^(title|label|headline)$/i.test(type)) key = name;
325
325
  }
326
326
  if (/^[a-z\d]+\/?\d+$/i.test(type)) {
@@ -0,0 +1,101 @@
1
+ function createSeek(express) {
2
+ var dist;
3
+ express.forEach(function (search) {
4
+ if (dist) {
5
+ if (/[\=]/.test(dist)) dist = `(${dist})`;
6
+ dist = `${dist}!==void 0&&${dist}!==null?${dist}${search}:''`
7
+ } else {
8
+ dist = search;
9
+ }
10
+ });
11
+ return dist;
12
+ }
13
+ function main(express) {
14
+ if (!/\?\s*\.(?=[^\d])/.test(express)) return express;
15
+ var reg = /\\[\s\S]|\?\s*(\.(?!\d))|[\:\,\+\=\-\!%\^\|\/\&\*\!\;\?\>\<~\{\}\[\]\(\)'"`\s]/g;
16
+ var cache = [], queue = [];
17
+ var exp = [];
18
+ var instr = false;
19
+ var lastIndex = 0;
20
+ var add_exp = function (s) {
21
+ if (!exp.length) exp.push(s);
22
+ else {
23
+ var e = exp[exp.length - 1];
24
+ if (!/[\.]\s*$/.test(e) && !/^\s*[\.'"`\[\(]/.test(s)) {
25
+ queue.push(createSeek(exp));
26
+ exp.splice(0, exp.length, '');
27
+ e = '';
28
+ }
29
+ if (/\.$/.test(e) && /^[\[\("'`]/.test(s)) {
30
+ e = e.replace(/\.$/, '');
31
+ }
32
+ e += s;
33
+ exp[exp.length - 1] = e;
34
+ }
35
+ };
36
+ var push_quote = function (m) {
37
+ add_exp(m);
38
+ cache.push(queue, exp);
39
+ queue = [];
40
+ exp = [];
41
+ };
42
+ var pop_quote = function (m) {
43
+ add_punc('');
44
+ exp = cache.pop();
45
+ var e = queue.join("") + m;
46
+ exp[exp.length - 1] += e;
47
+ queue = cache.pop();
48
+ };
49
+ var add_punc = function (m) {
50
+ if (exp.length) {
51
+ var temp = createSeek(exp);
52
+ queue.push(exp.length > 1 ? `(${temp})` : temp, m);
53
+ exp = [];
54
+ } else if (queue.length) {
55
+ queue[queue.length - 1] += m;
56
+ } else {
57
+ queue.push(m);
58
+ }
59
+ };
60
+
61
+ do {
62
+ var match = reg.exec(express);
63
+ if (!match) break;
64
+ var index = match.index;
65
+ var m = match[0];
66
+ var isstr = false;
67
+ if (/['"`\/]/.test(m)) {
68
+ if (instr === m) instr = false;
69
+ else if (!instr) instr = m;
70
+ }
71
+ if (instr) {
72
+ continue;
73
+ }
74
+ if (/['"`\/\s]/.test(m)) {
75
+ isstr = true;
76
+ index++;
77
+ }
78
+
79
+ var str = express.slice(lastIndex, index);
80
+ if (str) {
81
+ add_exp(str);
82
+ }
83
+ lastIndex = match.index + m.length;
84
+ if (match[1]) {
85
+ exp.push(match[1]);
86
+ }
87
+ else if (/[\[\{\(]/.test(m)) {
88
+ push_quote(m);
89
+ }
90
+ else if (/[\]\}\)]/.test(m)) {
91
+ pop_quote(m);
92
+ }
93
+ else if (!isstr) {
94
+ add_punc(m);
95
+ }
96
+ } while (true);
97
+ var s = express.slice(lastIndex);
98
+ if (s) add_exp(s);
99
+ add_punc('');
100
+ return queue.join("");
101
+ }
@@ -112,7 +112,8 @@ var skipAssignment = function (o) {
112
112
  };
113
113
  var createScoped = function (parsed) {
114
114
  var used = Object.create(null); var vars = Object.create(null), lets = vars;
115
- var scoped = [];
115
+ var scoped = [], funcbody = scoped;
116
+ scoped.isfunc = true;
116
117
  var run = function (o, id) {
117
118
  loop: while (o) {
118
119
  var isCatch = false;
@@ -120,6 +121,7 @@ var createScoped = function (parsed) {
120
121
  var isScope = false;
121
122
  var isArrow = false;
122
123
  var isDeclare = false;
124
+ var isYield = false;
123
125
  switch (o.type) {
124
126
  case QUOTED:
125
127
  if (o.length) {
@@ -145,6 +147,7 @@ var createScoped = function (parsed) {
145
147
  if (/^\.\.\./.test(u)) u = u.slice(3);
146
148
  var u = u.replace(/^([^\.\[]*)[\s\S]*$/, '$1');
147
149
  if (!u) break;
150
+ if (u === 'yield') funcbody.yield = false;
148
151
  if (o.next && o.next.type === STAMP && o.next.text === "=>") {
149
152
  isScope = true;
150
153
  isArrow = true;
@@ -164,6 +167,24 @@ var createScoped = function (parsed) {
164
167
  case STRAP:
165
168
  var s = o.text;
166
169
  switch (s) {
170
+ case "await":
171
+ funcbody.async = funcbody.await = true;
172
+ break;
173
+ case "yield":
174
+ if (!funcbody.yield) {
175
+ var next = o.next;
176
+ if (next) {
177
+
178
+ if (next.type === STAMP && !/[~!,;:]+$/.test(next.text)
179
+ || next.type === STRAP && /in|of|as|from|instanceof/.test(next.text)
180
+ || next.type === EXPRESS && /^\./.test(next.text)
181
+ ) {
182
+ funcbody.yield = false;
183
+ }
184
+ }
185
+ saveTo(used, 'yield', o);
186
+ }
187
+ break;
167
188
  case "as":
168
189
  case "from":
169
190
  break;
@@ -186,7 +207,10 @@ var createScoped = function (parsed) {
186
207
  continue loop;
187
208
  case "function":
188
209
  isFunction = true;
189
- if (o.next.type === STAMP) o = o.next;
210
+ if (o.next.type === STAMP) {
211
+ isYield = true;
212
+ o = o.next;
213
+ }
190
214
  case "catch":
191
215
  isCatch = true;
192
216
  case "class":
@@ -209,11 +233,18 @@ var createScoped = function (parsed) {
209
233
  break;
210
234
  case SCOPED:
211
235
  if (o.entry === "(") {
212
- if (o.next && o.next.type === STAMP && o.next.text === "=>"
213
- || o.prev && (o.prev.type === PROPERTY || o.prev.isprop)) {
236
+ if (o.next && o.next.type === STAMP && o.next.text === "=>") {
214
237
  isArrow = true;
215
238
  isScope = true;
216
239
  }
240
+ else if (o.prev && (o.prev.type === PROPERTY || o.prev.isprop)) {
241
+ isFunction = true;
242
+ isScope = true;
243
+ var pp = o.prev.prev;
244
+ if (pp && pp.type === STAMP && pp.isprop) {
245
+ isYield = true;
246
+ }
247
+ }
217
248
  else {
218
249
  run(o.first);
219
250
  }
@@ -241,8 +272,13 @@ var createScoped = function (parsed) {
241
272
  scoped.used = used;
242
273
  scoped.vars = vars;
243
274
  lets = vars;
244
- if (isFunction) vars.this = true, vars.arguments = true;
275
+ if (isFunction) {
276
+ vars.this = true, vars.arguments = true;
277
+ scoped.yield = isYield;
278
+ }
279
+ scoped.isfunc = true;
245
280
  isFunction = true;
281
+ funcbody = scoped;
246
282
  } else {
247
283
  vars = _vars;
248
284
  scoped.lets = lets;
@@ -335,6 +371,10 @@ var createScoped = function (parsed) {
335
371
  delete vars.this;
336
372
  delete vars.arguments;
337
373
  }
374
+ if (_scoped.isfunc && !funcbody.yield) {
375
+ if (used.yield) _scoped.yield = false;
376
+ funcbody = _scoped;
377
+ }
338
378
  used = _used;
339
379
  lets = _lets;
340
380
  vars = _vars;
@@ -354,6 +394,12 @@ var createScoped = function (parsed) {
354
394
  if (!/^(true|false|null|this|arguments)$/.test(u)) envs[u] = true;
355
395
  }
356
396
  }
397
+ if (vars.yield) scoped.yield = false;
398
+ if (scoped.yield !== false && envs.yield) {
399
+ scoped.yield = true;
400
+ delete envs.yield;
401
+ delete used.yield;
402
+ }
357
403
  scoped.envs = envs;
358
404
  return scoped;
359
405
  };
@@ -365,6 +365,15 @@ class Program extends Array {
365
365
  get used() {
366
366
  return this.scoped.used;
367
367
  }
368
+ get yield() {
369
+ return this.scoped.yield;
370
+ }
371
+ get async() {
372
+ return this.scoped.async;
373
+ }
374
+ get await() {
375
+ return this.scoped.await;
376
+ }
368
377
  get scoped() {
369
378
  if (this._scoped) return this._scoped;
370
379
  return this._scoped = createScoped(this);
@@ -804,7 +813,14 @@ class Javascript {
804
813
  if (m === 'yield') {
805
814
  var temp = queue;
806
815
  var type = STRAP;
807
- while (temp) {
816
+ var last = queue.lastUncomment;
817
+ if (queue.entry === '[' || queue.isClass || queue.isObject || last && (last.type === STAMP && (
818
+ queue[queue.length - 1].type !== SPACE && /^(\+\+|\-\-)$/.test(last.text)
819
+ || !/^(>>>?=|<<=|[^><!=]=|[,;])/.test(last.text)
820
+ ) || last.type === STRAP)) {
821
+ type = EXPRESS;
822
+ }
823
+ if (type === STRAP) while (temp) {
808
824
  if (temp.entry != "{" || !temp.prev || temp.prev.type !== SCOPED || temp.prev.entry !== '(') {
809
825
  temp = temp.queue;
810
826
  continue;
@@ -43,7 +43,7 @@ Object.assign(encode62, {
43
43
  var time_rest = time_stamp % time_delta;
44
44
  var time_rest_str = time_rest.toString(36);
45
45
  var time_delta_str = time_delta.toString(36);
46
- string = encodeURIComponent(string).replace(/\./g, '..').replace(/%/g, '.');
46
+ string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
47
47
  return this.encode62(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
48
48
  },
49
49
  timeupdate(string) {
@@ -2,7 +2,7 @@
2
2
  <span v-text="origin?'修改':'添加'"></span><span -text="title"></span>
3
3
  </div>
4
4
  <div body>
5
- <field v-if="!f.readonly||!!data[f.key]" -repeat="f in fields" ng-src="[f,data]"></field>
5
+ <field v-if="!f.hidden" -repeat="f in fields" ng-src="[f,data]"></field>
6
6
  </div>
7
7
  <div foot>
8
8
  <btn @click="remove()" class="white">取消</btn>
@@ -1,5 +1,5 @@
1
1
  & {
2
- width: 180px;
2
+ width: 160px;
3
3
  height: 20px;
4
4
  display: inline-block;
5
5
  text-align: center;
@@ -2,7 +2,8 @@ function main(element = document.createElement("div")) {
2
2
  element.innerHTML = colorpicker;
3
3
  var saved_value;
4
4
  var selector = element.firstChild;
5
- select(selector, colorpad(), false, 'y');
5
+ var pad = colorpad();
6
+ select(selector, pad, false, 'y');
6
7
  render(element, {
7
8
  a: button,
8
9
  colorlabel,
@@ -25,6 +26,7 @@ function main(element = document.createElement("div")) {
25
26
  element.setValue = function (value) {
26
27
  element.value = value;
27
28
  cast(selector, value);
29
+ pad.setValue(value);
28
30
  };
29
31
  return element;
30
32
  }
@@ -73,7 +73,7 @@ const formulaters = {
73
73
  }
74
74
  };
75
75
 
76
- function getErrorMessage(error) {
76
+ function getErrorMessage(error = this) {
77
77
  if (!isObject(error)) return String(error);
78
78
  if (error instanceof Error) return String(error);
79
79
  var words = "reason,message,desc,descption,msg,err,error,data".split(',');
@@ -550,7 +550,7 @@ var privates = {
550
550
  }).error(xhr => {
551
551
  try {
552
552
  var e = getErrorMessage(parseData(xhr.response || xhr.responseText || xhr.statusText || xhr.status));
553
- oh({ status: xhr.status, error: e })
553
+ oh({ status: xhr.status, error: e, toString: getErrorMessage })
554
554
  } catch (error) {
555
555
  oh(error);
556
556
  }
@@ -33,7 +33,7 @@ var encode62 = {
33
33
  var time_rest = time_stamp % time_delta;
34
34
  var time_rest_str = time_rest.toString(36);
35
35
  var time_delta_str = time_delta.toString(36);
36
- string = encodeURIComponent(string).replace(/\./g, '..').replace(/%/g, '.');
36
+ string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
37
37
  return this.encode(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
38
38
  },
39
39
  timeupdate(string) {
@@ -0,0 +1,9 @@
1
+ var hasOwnProperty = {}.hasOwnProperty;
2
+ function getName(o) {
3
+ if (hasOwnProperty.call(o, 'toString')) return o.toString();
4
+ if ("name" in o) return o.name;
5
+ if ("label" in o) return o.label;
6
+ if ("value" in o) return o.value;
7
+ if (hasOwnProperty.call(o, 'valueOf')) return o.valueOf();
8
+ return o;
9
+ }
@@ -1,4 +1,11 @@
1
- function getValue() {
2
- if (isFunction(this.getValue)) return this.getValue();
3
- return this.value;
1
+ var hasOwnProperty = {}.hasOwnProperty;
2
+ function getValue(o = this) {
3
+ if (!o) return o;
4
+ if (isFunction(o.getValue)) return o.getValue();
5
+ if (hasOwnProperty.call(o, 'valueOf')) return o.valueOf();
6
+ if ("key" in o) return o.key;
7
+ if ("value" in o) return o.value;
8
+ if (hasOwnProperty.call(o, 'toString')) return o.toString();
9
+ if (!isEmpty(o.id)) return o.id;
10
+ return o;
4
11
  }
@@ -12,6 +12,7 @@ var rebuildOptions = function () {
12
12
  var new_options = seek(data, options_from);
13
13
  if (new_options !== options) {
14
14
  field.options = new_options;
15
+ delete field.optionsMap;
15
16
  render.refresh();
16
17
  }
17
18
  };
@@ -198,7 +199,22 @@ function main(elem) {
198
199
  elem.innerHTML = '<span ng-bind=get()></span>';
199
200
  render(elem, {
200
201
  get() {
201
- return seek(data, field.key);
202
+ var value = seek(data, field.key);
203
+ if (field.options) {
204
+ if (!field.optionsMap) {
205
+ var map = Object.create(null);
206
+ for (var o of field.options) {
207
+ var v = getValue(o);
208
+ map[v] = o;
209
+ }
210
+ field.optionsMap = map;
211
+ }
212
+ var map = field.optionsMap;
213
+ if (value in map) {
214
+ value = getName(map[value]);
215
+ }
216
+ }
217
+ return value;
202
218
  }
203
219
  });
204
220
  }
@@ -0,0 +1 @@
1
+ zimoli.prepare;
@@ -18,18 +18,18 @@ function main(elem = document.createElement("radio-group")) {
18
18
  options,
19
19
  select(a) {
20
20
  this.options.active = a;
21
- elem.value = a.key;
21
+ elem.value = getValue(a);
22
22
  dispatch(elem, 'change');
23
23
  }
24
24
  });
25
- if (elem.value) {
25
+ if (!isEmpty(elem.value)) {
26
26
  elem.setValue(elem.value);
27
27
  }
28
28
  });
29
29
  elem.setValue = function (key) {
30
30
  var { options } = this.$scope;
31
31
  if (!(options instanceof Array)) return;
32
- var index = options.map(a => a.key).indexOf(key);
32
+ var index = options.map(a => getValue(a)).indexOf(key);
33
33
  options.active = options[index];
34
34
  };
35
35
  return elem;
@@ -56,20 +56,7 @@ var createGetter = function (search, isprop = true) {
56
56
  var [withContext, searchContext] = search;
57
57
  if (!searchContext) return function () { };
58
58
  var ret = /\;/.test(searchContext) ? "" : "return ";
59
- if (/\?\s*\.(?=[^\d])/.test(searchContext)) {
60
- searchContext = searchContext.replace(variableReg, function (context) {
61
- var dist;
62
- context.split(/\?\s*\.(?=[^\d])/).forEach(function (search) {
63
- if (dist) {
64
- if (/[\=]/.test(dist)) dist = `(${dist})`;
65
- dist = `${dist}!==void 0&&${dist}!==null?${dist}.${search}:''`
66
- } else {
67
- dist = search;
68
- }
69
- });
70
- return dist.length > 1 ? `(${dist})` : context;
71
- });
72
- }
59
+ searchContext = renderExpress(searchContext);
73
60
  if (isprop) {
74
61
  return new Function('event', `${withContext}with(this.$scope){${ret}${searchContext}}`);
75
62
  }
@@ -94,7 +81,7 @@ var parseRepeat = function (expression) {
94
81
  var res = reg.exec(expression);
95
82
  if (!res) return res;
96
83
  var [_, i, k, r, s, t] = res;
97
- var keyName, itemName, indexName, trackBy = t, srcName = s;
84
+ var keyName, itemName, indexName, trackBy = t, srcName = renderExpress(s);
98
85
  switch (r) {
99
86
  case "in":
100
87
  if (i) itemName = i;
@@ -289,6 +276,7 @@ var parseIfWithRepeat = function (ifExpression, repeatExpression) {
289
276
  if (reg.lastIndex < savedIndex) break;
290
277
  run();
291
278
  }
279
+ if (savedIndex < ifExpression.length) rest.push(ifExpression.slice(savedIndex))
292
280
  var beforeRepeat = [], afterRepeat = [];
293
281
  rest.forEach(function (result) {
294
282
  var match = false;
@@ -9,7 +9,7 @@
9
9
  <tr>
10
10
  <td -repeat="f in fields">
11
11
  <model -if="f.key" :field=f :data=d readonly ></model>
12
- <a on-click="o.do(d)" -if="!f.key&&f.options" _type="o.type instanceof Function?o.type(d):o.type"
12
+ <a on-click="o.do(d)" -if="!f.key&&f.options&&(!o.when||o.when(d))" _type="o.type instanceof Function?o.type(d):o.type"
13
13
  -repeat="o in f.options">
14
14
  <span -text="o.name instanceof Function?o.name(d):o.name"></span>
15
15
  </a>