efront 3.9.2 → 3.9.4
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.
- package/coms/zimoli/zimoli.js +33 -27
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -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
|
|
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;
|