efront 3.9.2 → 3.9.10

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.
@@ -8,3 +8,4 @@
8
8
  edit: options :::type-:key?:value
9
9
  params: options ::params-:key
10
10
  invoke: options ::invoke-:key?:params
11
+ version: options ::version
@@ -15,4 +15,9 @@
15
15
  <padding>
16
16
  退出登录 <btn @click="logout()">退出</btn>
17
17
  </padding>
18
+ </block>
19
+ <block>
20
+ <padding>
21
+ 服务器版本&nbsp;&nbsp;<span -text="String(version)"></span>
22
+ </padding>
18
23
  </block>
@@ -3,6 +3,7 @@ function main() {
3
3
  page.innerHTML = template;
4
4
  renderWithDefaults(page, {
5
5
  status: [],
6
+ version: data.from("version"),
6
7
  async run(id, target) {
7
8
  target.setAttribute('pending', '')
8
9
  try {
@@ -4,8 +4,10 @@
4
4
  <close @click="remove()"></close>
5
5
  </div>
6
6
  <div body>
7
- <div class="left">
7
+ <div class="top">
8
8
  <field -repeat="f in fields" -src="[f,data]"></field>
9
+ </div>
10
+ <div class="left">
9
11
  <pre -text="task.code"></pre>
10
12
  </div>
11
13
  <div class="right" :class="{error:error}">
@@ -2,22 +2,34 @@
2
2
  position: absolute;
3
3
  width: 800px;
4
4
  }
5
-
5
+ >[body]{
6
+ border-top: 50px solid transparent;
7
+ border-bottom: 50px solid transparent;
8
+ }
6
9
  >[body]>div {
7
10
  display: inline-block;
8
- width: 50%;
9
11
  vertical-align: top;
10
12
  overflow: auto;
11
13
  font-size: 12px;
12
- border-bottom: 50px solid transparent;
13
- padding: 0 10px;
14
+
15
+ &.top {
16
+ left: 0;
17
+ top: 0;
18
+ width: 100%;
19
+ }
20
+
21
+ &.left,
22
+ &.right {
23
+ height: 100%;
24
+ width: 50%;
25
+ }
14
26
 
15
27
  &.right {
16
28
  background: #000;
17
29
  color: #fff;
18
- height: 100%;
19
30
  }
20
- &.error{
31
+
32
+ &.error {
21
33
  color: #c26;
22
34
  }
23
35
  }
@@ -503,11 +503,19 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
503
503
  var promise = new Promise(function (ok) {
504
504
  _ok = ok;
505
505
  });
506
+ if (prebuilds.init) {
507
+ var prebuilds2 = Object.create(null);
508
+ for (var k in prebuilds) prebuilds2[k] = prebuilds[k];
509
+ prebuilds = prebuilds2;
510
+ delete prebuilds.popup;
511
+ delete prebuilds.action;
512
+ delete prebuilds.init;
513
+ }
506
514
  init(argName, function (res) {
507
515
  result = res;
508
516
  created = true;
509
517
  _ok(res);
510
- });
518
+ }, prebuilds);
511
519
  if (created) return result;
512
520
  return promise;
513
521
  });
@@ -22,6 +22,8 @@
22
22
  height: 100%;
23
23
  position: absolute;
24
24
  top: 0;
25
+ left: 0;
26
+ display: block;
25
27
  }
26
28
 
27
29
 
@@ -621,7 +621,7 @@ function responseCrash(e, data) {
621
621
  }
622
622
  error_report(data.error_message, e.status < 500 ? 'warn' : 'error');
623
623
  }
624
-
624
+ var getData = function () { return this.data };
625
625
  var data = {
626
626
  decodeStructure,
627
627
  encodeStructure,
@@ -898,12 +898,11 @@ var data = {
898
898
  getInstance(instanceId, onlyFromLocalStorage = false) {
899
899
  if (!instanceDataMap[instanceId]) {
900
900
  var data = getItem(instanceId, onlyFromLocalStorage);
901
- if (isObject(data) || isEmpty(data)) {
902
- data = extend(new LoadingArray, data);
903
- data.is_loading = false;
904
- data.is_loaded = true;
905
- }
906
- instanceDataMap[instanceId] = data;
901
+ var instance = new LoadingArray;
902
+ this.rebuildInstance(instance, data);
903
+ instance.is_loading = false;
904
+ instance.is_loaded = true;
905
+ instanceDataMap[instanceId] = instance;
907
906
  }
908
907
  return instanceDataMap[instanceId];
909
908
 
@@ -947,7 +946,7 @@ var data = {
947
946
  */
948
947
  setInstance(instanceId, data, rememberWithStorage = 0) {
949
948
  const instance = this.getInstance(instanceId);
950
- if (isObject(data) && isObject(instance)) {
949
+ if (isObject(instance)) {
951
950
  this.rebuildInstance(instance, data);
952
951
  } else {
953
952
  instanceDataMap[instanceId] = data;
@@ -1005,7 +1004,8 @@ var data = {
1005
1004
  },
1006
1005
  rebuildInstance(instance, data, old = instance) {
1007
1006
  if (instance === data) return;
1008
- if (!isObject(instance) || !isObject(data)) throw new Error("只支持object类型的数据!");
1007
+ if (!isObject(instance)) throw new Error("只支持object类型的数据!");
1008
+ if (!isObject(data)) data = { data }, data.toString = data.valueOf = getData;
1009
1009
  if (instance instanceof Array) instance.splice(0, instance.length);
1010
1010
  var sample = new LoadingArray;
1011
1011
  Object.keys(old).forEach(function (k) {
@@ -185,32 +185,8 @@ var loading_tree = {};
185
185
  var getpgpath = function (pagepath) {
186
186
  return /^[@#!]/.test(pagepath) ? pagepath.slice(1) : pagepath;
187
187
  };
188
- function prepare(pgpath, ok) {
188
+ function createState(pgpath) {
189
189
  var pgpath = getpgpath(pgpath);
190
- if (page_generators[pgpath]) {
191
- if (isFunction(ok)) {
192
- var res = page_generators[pgpath];
193
- if (!res.roles) {
194
- ok(res);
195
- } else {
196
- prepare(user.loginPath, _ => {
197
- ok(res);
198
- });
199
- }
200
- }
201
- return;
202
- }
203
- if (loading_tree[pgpath]) {
204
- if (isFunction(ok)) {
205
- loading_tree[pgpath].push(ok);
206
- }
207
- return;
208
- }
209
- loading_tree[pgpath] = [];
210
- if (isFunction(ok)) {
211
- loading_tree[pgpath].push(ok);
212
- }
213
-
214
190
  var _zimoli_state_key = _zimoli_state_prefix + pgpath;
215
191
  var state = function state(condition, setAsAdditional = condition !== null) {
216
192
  var state_string = hostoryStorage.getItem(_zimoli_state_key);
@@ -242,6 +218,34 @@ function prepare(pgpath, ok) {
242
218
  }
243
219
  return state_object;
244
220
  };
221
+ return state;
222
+ }
223
+ function prepare(pgpath, ok) {
224
+ var pgpath = getpgpath(pgpath);
225
+ if (page_generators[pgpath]) {
226
+ if (isFunction(ok)) {
227
+ var res = page_generators[pgpath];
228
+ if (!res.roles) {
229
+ ok(res);
230
+ } else {
231
+ prepare(user.loginPath, _ => {
232
+ ok(res);
233
+ });
234
+ }
235
+ }
236
+ return;
237
+ }
238
+ if (loading_tree[pgpath]) {
239
+ if (isFunction(ok)) {
240
+ loading_tree[pgpath].push(ok);
241
+ }
242
+ return;
243
+ }
244
+ loading_tree[pgpath] = [];
245
+ if (isFunction(ok)) {
246
+ loading_tree[pgpath].push(ok);
247
+ }
248
+ var state = createState(pgpath);
245
249
  state.state = state;
246
250
  var _with_elements = [];
247
251
  state.with = function (element) {
@@ -299,6 +303,7 @@ function prepare(pgpath, ok) {
299
303
  return Promise.resolve(res);
300
304
  };
301
305
  });
306
+
302
307
  var prepares = [];
303
308
  state.prepare = state.go.prepare = function (urls) {
304
309
  prepares.push.apply(prepares, [].concat(urls).map(state.path));
@@ -352,8 +357,8 @@ function prepare(pgpath, ok) {
352
357
  delete loading_tree[pgpath];
353
358
  };
354
359
  return init(pgpath, function (pg) {
355
-
356
360
  if (!pg) return;
361
+ extendIfNeeded(pg, state);
357
362
  if (roles) return prepare(user.loginPath, () => emit(pg));
358
363
  emit(pg);
359
364
  }, state);
@@ -654,4 +659,5 @@ zimoli.clearHistory = function () {
654
659
  zimoli.getCurrentHistory = function () {
655
660
  return history[current_history];
656
661
  };
657
- zimoli.inithash = locationInitHash;
662
+ zimoli.inithash = locationInitHash;
663
+ zimoli.createState = createState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.9.2",
3
+ "version": "3.9.10",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {