pome-ui 2.0.0-preview4 → 2.0.0-preview6
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/package.json +1 -1
- package/pome-ui.dev.js +280 -11
- package/pome-ui.dev.min.js +1 -1
- package/pome-ui.js +280 -12
- package/pome-ui.min.js +1 -1
package/package.json
CHANGED
package/pome-ui.dev.js
CHANGED
|
@@ -4586,6 +4586,7 @@ var Vue = (function (exports) {
|
|
|
4586
4586
|
$mounted: i => i.$mounted,
|
|
4587
4587
|
$layout: i => i.$layout,
|
|
4588
4588
|
$app: i => i.$app,
|
|
4589
|
+
$baseMethods: i => i.$baseMethods,
|
|
4589
4590
|
$view: i => i.$view
|
|
4590
4591
|
|
|
4591
4592
|
});
|
|
@@ -16089,12 +16090,28 @@ function build(options, exports) {
|
|
|
16089
16090
|
}
|
|
16090
16091
|
};
|
|
16091
16092
|
|
|
16093
|
+
function _getQueryString() {
|
|
16094
|
+
var ret = window.location.search;
|
|
16095
|
+
|
|
16096
|
+
if (window.location.hash.indexOf('?') > 0) {
|
|
16097
|
+
var hashSearch = window.location.hash.substr(window.location.hash.indexOf('?'));
|
|
16098
|
+
if (ret) {
|
|
16099
|
+
ret += '&' + hashSearch.substr(1);
|
|
16100
|
+
} else {
|
|
16101
|
+
ret = hashSearch;
|
|
16102
|
+
}
|
|
16103
|
+
}
|
|
16104
|
+
|
|
16105
|
+
return ret;
|
|
16106
|
+
}
|
|
16107
|
+
|
|
16092
16108
|
function _parseQueryString(dest) {
|
|
16093
|
-
|
|
16109
|
+
var qs = _getQueryString();
|
|
16110
|
+
if (!qs) {
|
|
16094
16111
|
return;
|
|
16095
16112
|
}
|
|
16096
16113
|
|
|
16097
|
-
var str =
|
|
16114
|
+
var str = qs;
|
|
16098
16115
|
if (str[0] == '?') {
|
|
16099
16116
|
str = str.substr(1);
|
|
16100
16117
|
}
|
|
@@ -16169,6 +16186,7 @@ function build(options, exports) {
|
|
|
16169
16186
|
if (!component.template) {
|
|
16170
16187
|
component.template = template;
|
|
16171
16188
|
}
|
|
16189
|
+
_patchComponent(url, component);
|
|
16172
16190
|
return Promise.resolve(component);
|
|
16173
16191
|
});
|
|
16174
16192
|
})
|
|
@@ -16409,6 +16427,7 @@ function build(options, exports) {
|
|
|
16409
16427
|
}
|
|
16410
16428
|
_attachContainer(instance);
|
|
16411
16429
|
};
|
|
16430
|
+
|
|
16412
16431
|
return _resolveModules(options.modules, layout).then(function () {
|
|
16413
16432
|
return _loadComponents(options.components || [], layout).then(function (components) {
|
|
16414
16433
|
var app = Vue.createApp(options || {});
|
|
@@ -16889,14 +16908,9 @@ function build(options, exports) {
|
|
|
16889
16908
|
|
|
16890
16909
|
if (layout) {
|
|
16891
16910
|
var layoutName = layout + (mobile ? '.m' : '');
|
|
16911
|
+
var _layoutHtml;
|
|
16892
16912
|
return _httpGet(layoutName + '.html').then(function (layoutHtml) {
|
|
16893
|
-
|
|
16894
|
-
var htmlBeginTagIndex2 = layoutHtml.indexOf('>', htmlBeginTagIndex);
|
|
16895
|
-
layoutHtml = layoutHtml.substr(htmlBeginTagIndex2 + 1);
|
|
16896
|
-
var htmlEndTagIndex = layoutHtml.lastIndexOf('</html>');
|
|
16897
|
-
layoutHtml = layoutHtml.substr(0, htmlEndTagIndex);
|
|
16898
|
-
document.querySelector('html').innerHTML = layoutHtml;
|
|
16899
|
-
|
|
16913
|
+
_layoutHtml = layoutHtml;
|
|
16900
16914
|
return _httpGet(layout + ".js");
|
|
16901
16915
|
}).then(function (js) {
|
|
16902
16916
|
var _opt = null;
|
|
@@ -16918,6 +16932,15 @@ function build(options, exports) {
|
|
|
16918
16932
|
instance.$app = exports;
|
|
16919
16933
|
}
|
|
16920
16934
|
|
|
16935
|
+
_opt.template = _layoutHtml;
|
|
16936
|
+
_patchComponent(layout, _opt);
|
|
16937
|
+
_layoutHtml = _opt.template;
|
|
16938
|
+
var htmlBeginTagIndex = _layoutHtml.indexOf('<html');
|
|
16939
|
+
var htmlBeginTagIndex2 = _layoutHtml.indexOf('>', htmlBeginTagIndex);
|
|
16940
|
+
_layoutHtml = _layoutHtml.substr(htmlBeginTagIndex2 + 1);
|
|
16941
|
+
var htmlEndTagIndex = _layoutHtml.lastIndexOf('</html>');
|
|
16942
|
+
_layoutHtml = _layoutHtml.substr(0, htmlEndTagIndex);
|
|
16943
|
+
document.querySelector('html').innerHTML = _layoutHtml;
|
|
16921
16944
|
var dataFunc = options.data;
|
|
16922
16945
|
options.data = function () {
|
|
16923
16946
|
var data = dataFunc.call(this, exports);
|
|
@@ -16929,8 +16952,9 @@ function build(options, exports) {
|
|
|
16929
16952
|
var ticks = new Date().getTime();
|
|
16930
16953
|
var appId = 'pomelo-' + ticks;
|
|
16931
16954
|
var containerId = 'container-' + ticks;
|
|
16932
|
-
|
|
16933
|
-
|
|
16955
|
+
var body = document.querySelector('body').innerHTML.replace('<render-body></render-body>', '<div id="' + containerId + '"></div>');
|
|
16956
|
+
document.querySelector('body').innerHTML = '<div id="' + appId + '">' + body + '</div>';
|
|
16957
|
+
options.template = null;
|
|
16934
16958
|
// Hook mounted
|
|
16935
16959
|
if (!options.mounted) {
|
|
16936
16960
|
options.mounted = function () { };
|
|
@@ -17000,6 +17024,7 @@ function build(options, exports) {
|
|
|
17000
17024
|
return data;
|
|
17001
17025
|
}
|
|
17002
17026
|
hookMountedAndUnmounted(_opt, viewName);
|
|
17027
|
+
_patchComponent(viewName, _opt);
|
|
17003
17028
|
return _resolveModules(_opt.modules, viewName).then(function () {
|
|
17004
17029
|
PageNext(_opt);
|
|
17005
17030
|
return Promise.resolve();P
|
|
@@ -17145,6 +17170,9 @@ function build(options, exports) {
|
|
|
17145
17170
|
var instance = Vue.getCurrentInstance();
|
|
17146
17171
|
instance.$app = exports;
|
|
17147
17172
|
}
|
|
17173
|
+
|
|
17174
|
+
_patchComponent(c, _opt);
|
|
17175
|
+
|
|
17148
17176
|
var originData = _opt.data || function () {
|
|
17149
17177
|
return {};
|
|
17150
17178
|
};
|
|
@@ -17170,6 +17198,246 @@ function build(options, exports) {
|
|
|
17170
17198
|
});
|
|
17171
17199
|
}
|
|
17172
17200
|
|
|
17201
|
+
exports._addins = [];
|
|
17202
|
+
|
|
17203
|
+
function _patchComponent(view, opt) {
|
|
17204
|
+
var prepared = false;
|
|
17205
|
+
for (var i = 0; i < exports._addins.length; ++i) {
|
|
17206
|
+
var v = exports._addins[i].view;
|
|
17207
|
+
var addin = exports._addins[i].opt;
|
|
17208
|
+
if (v != '*' && view != v) {
|
|
17209
|
+
continue;
|
|
17210
|
+
}
|
|
17211
|
+
|
|
17212
|
+
// Prepare
|
|
17213
|
+
if (!prepared) {
|
|
17214
|
+
prepared = true;
|
|
17215
|
+
if (!opt.data) {
|
|
17216
|
+
opt.data = function () {
|
|
17217
|
+
return {};
|
|
17218
|
+
};
|
|
17219
|
+
}
|
|
17220
|
+
|
|
17221
|
+
if (!opt.style) {
|
|
17222
|
+
opt.style = [];
|
|
17223
|
+
}
|
|
17224
|
+
|
|
17225
|
+
if (!opt.style instanceof Array) {
|
|
17226
|
+
if (opt.style instanceof String) {
|
|
17227
|
+
opt.style = [opt.style];
|
|
17228
|
+
} else {
|
|
17229
|
+
opt.style = ['@(css)'];
|
|
17230
|
+
}
|
|
17231
|
+
}
|
|
17232
|
+
|
|
17233
|
+
if (!opt.components) {
|
|
17234
|
+
opt.components = [];
|
|
17235
|
+
}
|
|
17236
|
+
|
|
17237
|
+
if (!opt.created) {
|
|
17238
|
+
opt.created = function () { };
|
|
17239
|
+
}
|
|
17240
|
+
|
|
17241
|
+
if (!opt.mounted) {
|
|
17242
|
+
opt.mounted = function () { };
|
|
17243
|
+
}
|
|
17244
|
+
|
|
17245
|
+
if (!opt.unmounted) {
|
|
17246
|
+
opt.unmounted = function () { };
|
|
17247
|
+
}
|
|
17248
|
+
|
|
17249
|
+
if (!opt.destroyed) {
|
|
17250
|
+
opt.destroyed = function () { };
|
|
17251
|
+
}
|
|
17252
|
+
|
|
17253
|
+
if (!opt.watch) {
|
|
17254
|
+
opt.watch = {};
|
|
17255
|
+
}
|
|
17256
|
+
|
|
17257
|
+
if (!opt.computed) {
|
|
17258
|
+
opt.computed = {};
|
|
17259
|
+
}
|
|
17260
|
+
}
|
|
17261
|
+
|
|
17262
|
+
if (addin.style) {
|
|
17263
|
+
if (addin.style instanceof Boolean) {
|
|
17264
|
+
addin.style = [ '@(css)' ];
|
|
17265
|
+
}
|
|
17266
|
+
|
|
17267
|
+
if (addin.style instanceof String) {
|
|
17268
|
+
addin.style = [addin.style];
|
|
17269
|
+
}
|
|
17270
|
+
|
|
17271
|
+
addin.style.forEach(function (s) {
|
|
17272
|
+
if (!opt.style.some(x => x == s)) {
|
|
17273
|
+
opt.push(s);
|
|
17274
|
+
}
|
|
17275
|
+
});
|
|
17276
|
+
}
|
|
17277
|
+
|
|
17278
|
+
if (addin.components) {
|
|
17279
|
+
addin.components.forEach(function (c) {
|
|
17280
|
+
if (!opt.components.some(x => x == c)) {
|
|
17281
|
+
opt.components.push(c);
|
|
17282
|
+
}
|
|
17283
|
+
});
|
|
17284
|
+
}
|
|
17285
|
+
|
|
17286
|
+
if (addin.layout) {
|
|
17287
|
+
opt.layout = addin.layout;
|
|
17288
|
+
}
|
|
17289
|
+
|
|
17290
|
+
if (addin.props) {
|
|
17291
|
+
if (!opt.props) {
|
|
17292
|
+
opt.props = [];
|
|
17293
|
+
}
|
|
17294
|
+
|
|
17295
|
+
addin.props.forEach(function (p) {
|
|
17296
|
+
if (!opt.props.some(x => x == p)) {
|
|
17297
|
+
opt.props.push(p);
|
|
17298
|
+
}
|
|
17299
|
+
});
|
|
17300
|
+
}
|
|
17301
|
+
|
|
17302
|
+
if (addin.watch) {
|
|
17303
|
+
var properties = Object.getOwnPropertyNames(addin.watch);
|
|
17304
|
+
properties.forEach(function (key) {
|
|
17305
|
+
opt.watch[key] = addin.watch[key];
|
|
17306
|
+
});
|
|
17307
|
+
}
|
|
17308
|
+
|
|
17309
|
+
if (addin.computed) {
|
|
17310
|
+
var properties = Object.getOwnPropertyNames(addin.computed);
|
|
17311
|
+
properties.forEach(function (key) {
|
|
17312
|
+
opt.computed[key] = addin.computed[key];
|
|
17313
|
+
});
|
|
17314
|
+
}
|
|
17315
|
+
|
|
17316
|
+
if (addin.methods) {
|
|
17317
|
+
var setup = opt.setup || function (props, context) {
|
|
17318
|
+
};
|
|
17319
|
+
|
|
17320
|
+
opt.setup = function (props, context) {
|
|
17321
|
+
setup(props, context);
|
|
17322
|
+
var methods = {};
|
|
17323
|
+
var originMethods = Object.getOwnPropertyNames(opt.methods);
|
|
17324
|
+
originMethods.forEach(function (m) {
|
|
17325
|
+
methods[m] = opt.methods[m];
|
|
17326
|
+
});
|
|
17327
|
+
var instance = Vue.getCurrentInstance();
|
|
17328
|
+
instance.$baseMethods = methods;
|
|
17329
|
+
};
|
|
17330
|
+
|
|
17331
|
+
var addinMethods = Object.getOwnPropertyNames(addin.methods);
|
|
17332
|
+
addinMethods.forEach(function (m) {
|
|
17333
|
+
opt.methods[m] = addin.methods[m];
|
|
17334
|
+
});
|
|
17335
|
+
}
|
|
17336
|
+
|
|
17337
|
+
if (addin.created) {
|
|
17338
|
+
var func = opt.created;
|
|
17339
|
+
opt.created = async function () {
|
|
17340
|
+
var p1 = func.call(this);
|
|
17341
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17342
|
+
p1 = Promise.resolve();
|
|
17343
|
+
}
|
|
17344
|
+
|
|
17345
|
+
return p1.then(function () {
|
|
17346
|
+
var p2 = addin.created.call(this);
|
|
17347
|
+
if (!p2 instanceof Promise) {
|
|
17348
|
+
p2 = Promise.resolve();
|
|
17349
|
+
}
|
|
17350
|
+
return p2;
|
|
17351
|
+
});
|
|
17352
|
+
};
|
|
17353
|
+
}
|
|
17354
|
+
|
|
17355
|
+
if (addin.mounted) {
|
|
17356
|
+
var func = opt.mounted;
|
|
17357
|
+
opt.mounted = async function () {
|
|
17358
|
+
var p1 = func.call(this);
|
|
17359
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17360
|
+
p1 = Promise.resolve();
|
|
17361
|
+
}
|
|
17362
|
+
|
|
17363
|
+
return p1.then(function () {
|
|
17364
|
+
var p2 = addin.mounted.call(this);
|
|
17365
|
+
if (!p2 instanceof Promise) {
|
|
17366
|
+
p2 = Promise.resolve();
|
|
17367
|
+
}
|
|
17368
|
+
return p2;
|
|
17369
|
+
});
|
|
17370
|
+
};
|
|
17371
|
+
}
|
|
17372
|
+
|
|
17373
|
+
if (addin.unmounted) {
|
|
17374
|
+
var func = opt.unmounted;
|
|
17375
|
+
opt.unmounted = async function () {
|
|
17376
|
+
var p1 = func.call(this);
|
|
17377
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17378
|
+
p1 = Promise.resolve();
|
|
17379
|
+
}
|
|
17380
|
+
|
|
17381
|
+
return p1.then(function () {
|
|
17382
|
+
var p2 = addin.unmounted.call(this);
|
|
17383
|
+
if (!p2 instanceof Promise) {
|
|
17384
|
+
p2 = Promise.resolve();
|
|
17385
|
+
}
|
|
17386
|
+
return p2;
|
|
17387
|
+
});
|
|
17388
|
+
};
|
|
17389
|
+
}
|
|
17390
|
+
|
|
17391
|
+
if (addin.destroyed) {
|
|
17392
|
+
var func = opt.destroyed;
|
|
17393
|
+
opt.destroyed = async function () {
|
|
17394
|
+
var p1 = func.call(this);
|
|
17395
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17396
|
+
p1 = Promise.resolve();
|
|
17397
|
+
}
|
|
17398
|
+
|
|
17399
|
+
return p1.then(function () {
|
|
17400
|
+
var p2 = addin.destroyed.call(this);
|
|
17401
|
+
if (!p2 instanceof Promise) {
|
|
17402
|
+
p2 = Promise.resolve();
|
|
17403
|
+
}
|
|
17404
|
+
return p2;
|
|
17405
|
+
});
|
|
17406
|
+
};
|
|
17407
|
+
}
|
|
17408
|
+
|
|
17409
|
+
if (addin.template) {
|
|
17410
|
+
if (addin.template instanceof Function) {
|
|
17411
|
+
if (opt.template) {
|
|
17412
|
+
if (opt.template.indexOf('<html') >= 0) {
|
|
17413
|
+
var template = new DOMParser().parseFromString(opt.template, 'text/html');
|
|
17414
|
+
addin.template(template);
|
|
17415
|
+
opt.template = new XMLSerializer().serializeToString(template);
|
|
17416
|
+
} else {
|
|
17417
|
+
opt.template = `<pome-ui-template>${opt.template}</pome-ui-template>`
|
|
17418
|
+
var template = new DOMParser().parseFromString(opt.template, 'text/html');
|
|
17419
|
+
addin.template(template);
|
|
17420
|
+
opt.template = new XMLSerializer().serializeToString(template);
|
|
17421
|
+
opt.template = opt.template.substr(opt.template.indexOf('<pome-ui-template>') + '<pome-ui-template>'.length);
|
|
17422
|
+
opt.template = opt.template.substr(0, opt.template.indexOf('</pome-ui-template>'));
|
|
17423
|
+
}
|
|
17424
|
+
}
|
|
17425
|
+
} else {
|
|
17426
|
+
opt.template = addin.template;
|
|
17427
|
+
}
|
|
17428
|
+
}
|
|
17429
|
+
}
|
|
17430
|
+
}
|
|
17431
|
+
|
|
17432
|
+
function UseAddin(addinUrl) {
|
|
17433
|
+
var Addin = function (view, opt) {
|
|
17434
|
+
exports._addins.push({view, opt});
|
|
17435
|
+
};
|
|
17436
|
+
|
|
17437
|
+
var js = _options.httpGetSync(addinUrl);
|
|
17438
|
+
eval(js);
|
|
17439
|
+
}
|
|
17440
|
+
|
|
17173
17441
|
exports.root = root;
|
|
17174
17442
|
exports.useConfig = UseConfig;
|
|
17175
17443
|
exports.mapRoute = MapRoute;
|
|
@@ -17180,6 +17448,7 @@ function build(options, exports) {
|
|
|
17180
17448
|
exports.forceUpdate = ForceUpdate;
|
|
17181
17449
|
exports.mount = mount;
|
|
17182
17450
|
exports.useRoutes = useRoutes;
|
|
17451
|
+
exports.useAddin = UseAddin;
|
|
17183
17452
|
|
|
17184
17453
|
return exports;
|
|
17185
17454
|
};
|