pome-ui 2.0.0-preview4 → 2.0.0-preview5
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 +262 -9
- package/pome-ui.dev.min.js +1 -1
- package/pome-ui.js +262 -10
- 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
|
});
|
|
@@ -16169,6 +16170,7 @@ function build(options, exports) {
|
|
|
16169
16170
|
if (!component.template) {
|
|
16170
16171
|
component.template = template;
|
|
16171
16172
|
}
|
|
16173
|
+
_patchComponent(url, component);
|
|
16172
16174
|
return Promise.resolve(component);
|
|
16173
16175
|
});
|
|
16174
16176
|
})
|
|
@@ -16409,6 +16411,7 @@ function build(options, exports) {
|
|
|
16409
16411
|
}
|
|
16410
16412
|
_attachContainer(instance);
|
|
16411
16413
|
};
|
|
16414
|
+
|
|
16412
16415
|
return _resolveModules(options.modules, layout).then(function () {
|
|
16413
16416
|
return _loadComponents(options.components || [], layout).then(function (components) {
|
|
16414
16417
|
var app = Vue.createApp(options || {});
|
|
@@ -16889,14 +16892,9 @@ function build(options, exports) {
|
|
|
16889
16892
|
|
|
16890
16893
|
if (layout) {
|
|
16891
16894
|
var layoutName = layout + (mobile ? '.m' : '');
|
|
16895
|
+
var _layoutHtml;
|
|
16892
16896
|
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
|
-
|
|
16897
|
+
_layoutHtml = layoutHtml;
|
|
16900
16898
|
return _httpGet(layout + ".js");
|
|
16901
16899
|
}).then(function (js) {
|
|
16902
16900
|
var _opt = null;
|
|
@@ -16918,6 +16916,15 @@ function build(options, exports) {
|
|
|
16918
16916
|
instance.$app = exports;
|
|
16919
16917
|
}
|
|
16920
16918
|
|
|
16919
|
+
_opt.template = _layoutHtml;
|
|
16920
|
+
_patchComponent(layout, _opt);
|
|
16921
|
+
_layoutHtml = _opt.template;
|
|
16922
|
+
var htmlBeginTagIndex = _layoutHtml.indexOf('<html');
|
|
16923
|
+
var htmlBeginTagIndex2 = _layoutHtml.indexOf('>', htmlBeginTagIndex);
|
|
16924
|
+
_layoutHtml = _layoutHtml.substr(htmlBeginTagIndex2 + 1);
|
|
16925
|
+
var htmlEndTagIndex = _layoutHtml.lastIndexOf('</html>');
|
|
16926
|
+
_layoutHtml = _layoutHtml.substr(0, htmlEndTagIndex);
|
|
16927
|
+
document.querySelector('html').innerHTML = _layoutHtml;
|
|
16921
16928
|
var dataFunc = options.data;
|
|
16922
16929
|
options.data = function () {
|
|
16923
16930
|
var data = dataFunc.call(this, exports);
|
|
@@ -16929,8 +16936,9 @@ function build(options, exports) {
|
|
|
16929
16936
|
var ticks = new Date().getTime();
|
|
16930
16937
|
var appId = 'pomelo-' + ticks;
|
|
16931
16938
|
var containerId = 'container-' + ticks;
|
|
16932
|
-
|
|
16933
|
-
|
|
16939
|
+
var body = document.querySelector('body').innerHTML.replace('<render-body></render-body>', '<div id="' + containerId + '"></div>');
|
|
16940
|
+
document.querySelector('body').innerHTML = '<div id="' + appId + '">' + body + '</div>';
|
|
16941
|
+
options.template = null;
|
|
16934
16942
|
// Hook mounted
|
|
16935
16943
|
if (!options.mounted) {
|
|
16936
16944
|
options.mounted = function () { };
|
|
@@ -17000,6 +17008,7 @@ function build(options, exports) {
|
|
|
17000
17008
|
return data;
|
|
17001
17009
|
}
|
|
17002
17010
|
hookMountedAndUnmounted(_opt, viewName);
|
|
17011
|
+
_patchComponent(viewName, _opt);
|
|
17003
17012
|
return _resolveModules(_opt.modules, viewName).then(function () {
|
|
17004
17013
|
PageNext(_opt);
|
|
17005
17014
|
return Promise.resolve();P
|
|
@@ -17145,6 +17154,9 @@ function build(options, exports) {
|
|
|
17145
17154
|
var instance = Vue.getCurrentInstance();
|
|
17146
17155
|
instance.$app = exports;
|
|
17147
17156
|
}
|
|
17157
|
+
|
|
17158
|
+
_patchComponent(c, _opt);
|
|
17159
|
+
|
|
17148
17160
|
var originData = _opt.data || function () {
|
|
17149
17161
|
return {};
|
|
17150
17162
|
};
|
|
@@ -17170,6 +17182,246 @@ function build(options, exports) {
|
|
|
17170
17182
|
});
|
|
17171
17183
|
}
|
|
17172
17184
|
|
|
17185
|
+
exports._addins = [];
|
|
17186
|
+
|
|
17187
|
+
function _patchComponent(view, opt) {
|
|
17188
|
+
var prepared = false;
|
|
17189
|
+
for (var i = 0; i < exports._addins.length; ++i) {
|
|
17190
|
+
var v = exports._addins[i].view;
|
|
17191
|
+
var addin = exports._addins[i].opt;
|
|
17192
|
+
if (v != '*' && view != v) {
|
|
17193
|
+
continue;
|
|
17194
|
+
}
|
|
17195
|
+
|
|
17196
|
+
// Prepare
|
|
17197
|
+
if (!prepared) {
|
|
17198
|
+
prepared = true;
|
|
17199
|
+
if (!opt.data) {
|
|
17200
|
+
opt.data = function () {
|
|
17201
|
+
return {};
|
|
17202
|
+
};
|
|
17203
|
+
}
|
|
17204
|
+
|
|
17205
|
+
if (!opt.style) {
|
|
17206
|
+
opt.style = [];
|
|
17207
|
+
}
|
|
17208
|
+
|
|
17209
|
+
if (!opt.style instanceof Array) {
|
|
17210
|
+
if (opt.style instanceof String) {
|
|
17211
|
+
opt.style = [opt.style];
|
|
17212
|
+
} else {
|
|
17213
|
+
opt.style = ['@(css)'];
|
|
17214
|
+
}
|
|
17215
|
+
}
|
|
17216
|
+
|
|
17217
|
+
if (!opt.components) {
|
|
17218
|
+
opt.components = [];
|
|
17219
|
+
}
|
|
17220
|
+
|
|
17221
|
+
if (!opt.created) {
|
|
17222
|
+
opt.created = function () { };
|
|
17223
|
+
}
|
|
17224
|
+
|
|
17225
|
+
if (!opt.mounted) {
|
|
17226
|
+
opt.mounted = function () { };
|
|
17227
|
+
}
|
|
17228
|
+
|
|
17229
|
+
if (!opt.unmounted) {
|
|
17230
|
+
opt.unmounted = function () { };
|
|
17231
|
+
}
|
|
17232
|
+
|
|
17233
|
+
if (!opt.destroyed) {
|
|
17234
|
+
opt.destroyed = function () { };
|
|
17235
|
+
}
|
|
17236
|
+
|
|
17237
|
+
if (!opt.watch) {
|
|
17238
|
+
opt.watch = {};
|
|
17239
|
+
}
|
|
17240
|
+
|
|
17241
|
+
if (!opt.computed) {
|
|
17242
|
+
opt.computed = {};
|
|
17243
|
+
}
|
|
17244
|
+
}
|
|
17245
|
+
|
|
17246
|
+
if (addin.style) {
|
|
17247
|
+
if (addin.style instanceof Boolean) {
|
|
17248
|
+
addin.style = [ '@(css)' ];
|
|
17249
|
+
}
|
|
17250
|
+
|
|
17251
|
+
if (addin.style instanceof String) {
|
|
17252
|
+
addin.style = [addin.style];
|
|
17253
|
+
}
|
|
17254
|
+
|
|
17255
|
+
addin.style.forEach(function (s) {
|
|
17256
|
+
if (!opt.style.some(x => x == s)) {
|
|
17257
|
+
opt.push(s);
|
|
17258
|
+
}
|
|
17259
|
+
});
|
|
17260
|
+
}
|
|
17261
|
+
|
|
17262
|
+
if (addin.components) {
|
|
17263
|
+
addin.components.forEach(function (c) {
|
|
17264
|
+
if (!opt.components.some(x => x == c)) {
|
|
17265
|
+
opt.components.push(c);
|
|
17266
|
+
}
|
|
17267
|
+
});
|
|
17268
|
+
}
|
|
17269
|
+
|
|
17270
|
+
if (addin.layout) {
|
|
17271
|
+
opt.layout = addin.layout;
|
|
17272
|
+
}
|
|
17273
|
+
|
|
17274
|
+
if (addin.props) {
|
|
17275
|
+
if (!opt.props) {
|
|
17276
|
+
opt.props = [];
|
|
17277
|
+
}
|
|
17278
|
+
|
|
17279
|
+
addin.props.forEach(function (p) {
|
|
17280
|
+
if (!opt.props.some(x => x == p)) {
|
|
17281
|
+
opt.props.push(p);
|
|
17282
|
+
}
|
|
17283
|
+
});
|
|
17284
|
+
}
|
|
17285
|
+
|
|
17286
|
+
if (addin.watch) {
|
|
17287
|
+
var properties = Object.getOwnPropertyNames(addin.watch);
|
|
17288
|
+
properties.forEach(function (key) {
|
|
17289
|
+
opt.watch[key] = addin.watch[key];
|
|
17290
|
+
});
|
|
17291
|
+
}
|
|
17292
|
+
|
|
17293
|
+
if (addin.computed) {
|
|
17294
|
+
var properties = Object.getOwnPropertyNames(addin.computed);
|
|
17295
|
+
properties.forEach(function (key) {
|
|
17296
|
+
opt.computed[key] = addin.computed[key];
|
|
17297
|
+
});
|
|
17298
|
+
}
|
|
17299
|
+
|
|
17300
|
+
if (addin.methods) {
|
|
17301
|
+
var setup = opt.setup || function (props, context) {
|
|
17302
|
+
};
|
|
17303
|
+
|
|
17304
|
+
opt.setup = function (props, context) {
|
|
17305
|
+
setup(props, context);
|
|
17306
|
+
var methods = {};
|
|
17307
|
+
var originMethods = Object.getOwnPropertyNames(opt.methods);
|
|
17308
|
+
originMethods.forEach(function (m) {
|
|
17309
|
+
methods[m] = opt.methods[m];
|
|
17310
|
+
});
|
|
17311
|
+
var instance = Vue.getCurrentInstance();
|
|
17312
|
+
instance.$baseMethods = methods;
|
|
17313
|
+
};
|
|
17314
|
+
|
|
17315
|
+
var addinMethods = Object.getOwnPropertyNames(addin.methods);
|
|
17316
|
+
addinMethods.forEach(function (m) {
|
|
17317
|
+
opt.methods[m] = addin.methods[m];
|
|
17318
|
+
});
|
|
17319
|
+
}
|
|
17320
|
+
|
|
17321
|
+
if (addin.created) {
|
|
17322
|
+
var func = opt.created;
|
|
17323
|
+
opt.created = async function () {
|
|
17324
|
+
var p1 = func.call(this);
|
|
17325
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17326
|
+
p1 = Promise.resolve();
|
|
17327
|
+
}
|
|
17328
|
+
|
|
17329
|
+
return p1.then(function () {
|
|
17330
|
+
var p2 = addin.created.call(this);
|
|
17331
|
+
if (!p2 instanceof Promise) {
|
|
17332
|
+
p2 = Promise.resolve();
|
|
17333
|
+
}
|
|
17334
|
+
return p2;
|
|
17335
|
+
});
|
|
17336
|
+
};
|
|
17337
|
+
}
|
|
17338
|
+
|
|
17339
|
+
if (addin.mounted) {
|
|
17340
|
+
var func = opt.mounted;
|
|
17341
|
+
opt.mounted = async function () {
|
|
17342
|
+
var p1 = func.call(this);
|
|
17343
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17344
|
+
p1 = Promise.resolve();
|
|
17345
|
+
}
|
|
17346
|
+
|
|
17347
|
+
return p1.then(function () {
|
|
17348
|
+
var p2 = addin.mounted.call(this);
|
|
17349
|
+
if (!p2 instanceof Promise) {
|
|
17350
|
+
p2 = Promise.resolve();
|
|
17351
|
+
}
|
|
17352
|
+
return p2;
|
|
17353
|
+
});
|
|
17354
|
+
};
|
|
17355
|
+
}
|
|
17356
|
+
|
|
17357
|
+
if (addin.unmounted) {
|
|
17358
|
+
var func = opt.unmounted;
|
|
17359
|
+
opt.unmounted = async function () {
|
|
17360
|
+
var p1 = func.call(this);
|
|
17361
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17362
|
+
p1 = Promise.resolve();
|
|
17363
|
+
}
|
|
17364
|
+
|
|
17365
|
+
return p1.then(function () {
|
|
17366
|
+
var p2 = addin.unmounted.call(this);
|
|
17367
|
+
if (!p2 instanceof Promise) {
|
|
17368
|
+
p2 = Promise.resolve();
|
|
17369
|
+
}
|
|
17370
|
+
return p2;
|
|
17371
|
+
});
|
|
17372
|
+
};
|
|
17373
|
+
}
|
|
17374
|
+
|
|
17375
|
+
if (addin.destroyed) {
|
|
17376
|
+
var func = opt.destroyed;
|
|
17377
|
+
opt.destroyed = async function () {
|
|
17378
|
+
var p1 = func.call(this);
|
|
17379
|
+
if (!p1 || !p1 instanceof Promise) {
|
|
17380
|
+
p1 = Promise.resolve();
|
|
17381
|
+
}
|
|
17382
|
+
|
|
17383
|
+
return p1.then(function () {
|
|
17384
|
+
var p2 = addin.destroyed.call(this);
|
|
17385
|
+
if (!p2 instanceof Promise) {
|
|
17386
|
+
p2 = Promise.resolve();
|
|
17387
|
+
}
|
|
17388
|
+
return p2;
|
|
17389
|
+
});
|
|
17390
|
+
};
|
|
17391
|
+
}
|
|
17392
|
+
|
|
17393
|
+
if (addin.template) {
|
|
17394
|
+
if (addin.template instanceof Function) {
|
|
17395
|
+
if (opt.template) {
|
|
17396
|
+
if (opt.template.indexOf('<html') >= 0) {
|
|
17397
|
+
var template = new DOMParser().parseFromString(opt.template, 'text/html');
|
|
17398
|
+
addin.template(template);
|
|
17399
|
+
opt.template = new XMLSerializer().serializeToString(template);
|
|
17400
|
+
} else {
|
|
17401
|
+
opt.template = `<pome-ui-template>${opt.template}</pome-ui-template>`
|
|
17402
|
+
var template = new DOMParser().parseFromString(opt.template, 'text/html');
|
|
17403
|
+
addin.template(template);
|
|
17404
|
+
opt.template = new XMLSerializer().serializeToString(template);
|
|
17405
|
+
opt.template = opt.template.substr(opt.template.indexOf('<pome-ui-template>') + '<pome-ui-template>'.length);
|
|
17406
|
+
opt.template = opt.template.substr(0, opt.template.indexOf('</pome-ui-template>'));
|
|
17407
|
+
}
|
|
17408
|
+
}
|
|
17409
|
+
} else {
|
|
17410
|
+
opt.template = addin.template;
|
|
17411
|
+
}
|
|
17412
|
+
}
|
|
17413
|
+
}
|
|
17414
|
+
}
|
|
17415
|
+
|
|
17416
|
+
function UseAddin(addinUrl) {
|
|
17417
|
+
var Addin = function (view, opt) {
|
|
17418
|
+
exports._addins.push({view, opt});
|
|
17419
|
+
};
|
|
17420
|
+
|
|
17421
|
+
var js = _options.httpGetSync(addinUrl);
|
|
17422
|
+
eval(js);
|
|
17423
|
+
}
|
|
17424
|
+
|
|
17173
17425
|
exports.root = root;
|
|
17174
17426
|
exports.useConfig = UseConfig;
|
|
17175
17427
|
exports.mapRoute = MapRoute;
|
|
@@ -17180,6 +17432,7 @@ function build(options, exports) {
|
|
|
17180
17432
|
exports.forceUpdate = ForceUpdate;
|
|
17181
17433
|
exports.mount = mount;
|
|
17182
17434
|
exports.useRoutes = useRoutes;
|
|
17435
|
+
exports.useAddin = UseAddin;
|
|
17183
17436
|
|
|
17184
17437
|
return exports;
|
|
17185
17438
|
};
|