pome-ui 2.0.0-preview3 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pome-ui",
3
- "version": "2.0.0-preview3",
3
+ "version": "2.0.0-preview5",
4
4
  "description": "Front-end MVC library",
5
5
  "main": "pome-ui.js",
6
6
  "bin": {
@@ -90,9 +90,8 @@
90
90
  return result;
91
91
  }
92
92
 
93
- function SetOptions(options) {
93
+ function UseConfig(options) {
94
94
  _combineObject(options, _options);
95
- console.log(_options);
96
95
  }
97
96
 
98
97
  function _toUrlString(params, questionMark = true, ignore = null) {
@@ -317,7 +316,7 @@
317
316
  exports.put = put;
318
317
  exports.patch = patch;
319
318
  exports.delete = _delete;
320
- exports.setOptions = SetOptions;
319
+ exports.useConfig = UseConfig;
321
320
 
322
321
  return exports;
323
322
 
@@ -1 +1 @@
1
- (function(e){if(typeof e!="undefined"&&e.get){return e}function n(e,n){if(!e){return}var t=Object.getOwnPropertyNames(e);for(var r=0;r<t.length;++r){n[t[r]]=e[t[r]]}}var f={isPagedResult(e){if(e.totalRecords==undefined||e.totalPages===undefined||e.currentPage===undefined||e.pageSize===undefined)return false;else return true},beforeSend:function(e){},onError:function(e,n){return Promise.resolve(e)},onSucceeded:function(e,n){return Promise.resolve(e)},baseUrl:null,batch:null,batchInterval:null,batchTimeout:10};var t=[];var r=function(e){var n=[];for(var t=0;t<e.length;++t){n.push(e[t])}return n};if(f.batch){setInterval(function(){if(!t.length){return}f.batch(t,h,f);t=[]},f.batchInterval||50)}function o(e){var n=JSON.stringify(e);return JSON.parse(n)}function a(e){var n=[];if(!e||typeof e!=="object")return n;for(var t in e){if(e[t])n.push(t)}return n}var u={};var i={};var s={};function c(e,n=null){n=n||"1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";var t="";for(var r=e;r>0;--r){t+=n[Math.floor(Math.random()*n.length)]}return t}function l(e){n(e,f);console.log(f)}function d(e,n=true,t=null){var r=Object.keys(e).sort();if(!r.length)return"";var o=n?"?":"";for(var a=0;a<r.length;a++){if(t){if(t.some(e=>e==r[a])){continue}}o+=r[a]+"="+encodeURI(e[r[a]])+"&"}return o.substr(0,o.length-1)}function p(e){e=e.substr(e.indexOf("?")+1);var n=e.split("&");var t={};for(var r=0;r<n.length;r++){var o=n[r].split("=");t[o[0]]=decodeURI(o[1])}return t}function v(e,n,t){var r=o(n);if(t&&r.page)delete r.page;return e+d(r)}function g(e){return f.isPagedResult(e)}function h(n){var t=new XMLHttpRequest;t.open(n.type,n.url);t.setRequestHeader("Content-Type",n.contentType);if(n.beforeSend){n.beforeSend(t)}if(typeof n.data!=="string"){if(n.contentType.toLocaleLowerCase()=="application/json"){n.data=JSON.stringify(n.data)}else if(n.contentType.toLocaleLowerCase()=="application/octet-stream"){}else{n.data=d(n.data,false)}}t.send(n.data);t.onreadystatechange=function(){if(t.readyState==4){var e=n.dataType=="json"?JSON.parse(t.responseText):t.responseText;if(t.status>=200&&t.status<300){n.success(e,t)}else{n.error(e,t)}}};return t}function b(e){if(e.indexOf("//")>=0){return e}else if(f.baseUrl){return f.baseUrl+e}else{return e}}function y(o,a,u,e,i){e=e||"json";i=i||"application/json";u=a=="GET"?null:u;o=b(o);if(!f.batch||e!="json"||i!="application/json"){var n=this;return new Promise(function(n,t){var r=h({url:o,type:a,dataType:e,contentType:i||"application/json",data:a=="GET"?null:u,success:function(e){f.onSucceeded(e,r).then(function(e){n(e)})},error:function(e){return f.onError(e,r).then(function(e){t(e)})},beforeSend:function(e){f.beforeSend(e)}})})}else{return new Promise(function(e,n){t.push({resolve:e,reject:n,request:{requestId:c(32),url:o,method:a,body:u?JSON.stringify(u):null,contentType:"application/json",timeout:f.batchTimeout}})})}}function m(e,n,t,r){var o=Object.getOwnPropertyNames(n||{});if(o.length){if(e.indexOf("?")>=0){e+="&"}else{e+="?"}}for(var a=0;a<o.length;++a){var u=o[a];e+=encodeURIComponent(u)+"="+encodeURIComponent(n[u]||"")+"&"}if(o.length){e=e.substr(0,e.length-1)}return y(e,"GET",n,t,r)}function O(e,n,t,r){return y(e,"POST",n,t,r)}function T(e,n,t,r){return y(e,"PATCH",n,t,r)}function j(e,n,t,r){return y(e,"PUT",n,t,r)}function S(e,n,t){var r=Object.getOwnPropertyNames(n||{});if(r.length){if(e.indexOf("?")>=0){e+="&"}else{e+="?"}}for(var o=0;o<r.length;++o){var a=r[o];e+=encodeURIComponent(a)+"="+encodeURIComponent(n[a]||"")+"&"}if(r.length){e=e.substr(0,e.length-1)}return y(e,"DELETE",n,t)}function P(e,n){var t=a(n);var r=v(e,n,t.some(e=>e==="page"));if(u[r]){delete u[r]}}function w(e,n,t,r){var o;if(!i[e])i[e]=[];var a=g(t);if(!a){o=v(e,n);u[o]=t}else{o=v(e,n,true);if(!u[o])u[o]={isPaged:true};u[o][t.data.current]=t}if(!i[e].some(e=>e==o))i[e].push(o);if(r)s[o]=(new Date).getTime()+r}e.generateQueryStringFromObject=d;e.generateObjectFromQueryString=p;e.xhrRequest=h;e.request=y;e.get=m;e.post=O;e.put=j;e.patch=T;e.delete=S;e.setOptions=l;return e})(typeof exports==="object"&&typeof module!=="undefined"?exports:function(){window.cq={};return window.cq}());
1
+ (function(e){if(typeof e!="undefined"&&e.get){return e}function n(e,n){if(!e){return}var t=Object.getOwnPropertyNames(e);for(var r=0;r<t.length;++r){n[t[r]]=e[t[r]]}}var f={isPagedResult(e){if(e.totalRecords==undefined||e.totalPages===undefined||e.currentPage===undefined||e.pageSize===undefined)return false;else return true},beforeSend:function(e){},onError:function(e,n){return Promise.resolve(e)},onSucceeded:function(e,n){return Promise.resolve(e)},baseUrl:null,batch:null,batchInterval:null,batchTimeout:10};var t=[];var r=function(e){var n=[];for(var t=0;t<e.length;++t){n.push(e[t])}return n};if(f.batch){setInterval(function(){if(!t.length){return}f.batch(t,h,f);t=[]},f.batchInterval||50)}function o(e){var n=JSON.stringify(e);return JSON.parse(n)}function a(e){var n=[];if(!e||typeof e!=="object")return n;for(var t in e){if(e[t])n.push(t)}return n}var u={};var i={};var s={};function c(e,n=null){n=n||"1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";var t="";for(var r=e;r>0;--r){t+=n[Math.floor(Math.random()*n.length)]}return t}function l(e){n(e,f)}function d(e,n=true,t=null){var r=Object.keys(e).sort();if(!r.length)return"";var o=n?"?":"";for(var a=0;a<r.length;a++){if(t){if(t.some(e=>e==r[a])){continue}}o+=r[a]+"="+encodeURI(e[r[a]])+"&"}return o.substr(0,o.length-1)}function p(e){e=e.substr(e.indexOf("?")+1);var n=e.split("&");var t={};for(var r=0;r<n.length;r++){var o=n[r].split("=");t[o[0]]=decodeURI(o[1])}return t}function v(e,n,t){var r=o(n);if(t&&r.page)delete r.page;return e+d(r)}function g(e){return f.isPagedResult(e)}function h(n){var t=new XMLHttpRequest;t.open(n.type,n.url);t.setRequestHeader("Content-Type",n.contentType);if(n.beforeSend){n.beforeSend(t)}if(typeof n.data!=="string"){if(n.contentType.toLocaleLowerCase()=="application/json"){n.data=JSON.stringify(n.data)}else if(n.contentType.toLocaleLowerCase()=="application/octet-stream"){}else{n.data=d(n.data,false)}}t.send(n.data);t.onreadystatechange=function(){if(t.readyState==4){var e=n.dataType=="json"?JSON.parse(t.responseText):t.responseText;if(t.status>=200&&t.status<300){n.success(e,t)}else{n.error(e,t)}}};return t}function b(e){if(e.indexOf("//")>=0){return e}else if(f.baseUrl){return f.baseUrl+e}else{return e}}function y(o,a,u,e,i){e=e||"json";i=i||"application/json";u=a=="GET"?null:u;o=b(o);if(!f.batch||e!="json"||i!="application/json"){var n=this;return new Promise(function(n,t){var r=h({url:o,type:a,dataType:e,contentType:i||"application/json",data:a=="GET"?null:u,success:function(e){f.onSucceeded(e,r).then(function(e){n(e)})},error:function(e){return f.onError(e,r).then(function(e){t(e)})},beforeSend:function(e){f.beforeSend(e)}})})}else{return new Promise(function(e,n){t.push({resolve:e,reject:n,request:{requestId:c(32),url:o,method:a,body:u?JSON.stringify(u):null,contentType:"application/json",timeout:f.batchTimeout}})})}}function m(e,n,t,r){var o=Object.getOwnPropertyNames(n||{});if(o.length){if(e.indexOf("?")>=0){e+="&"}else{e+="?"}}for(var a=0;a<o.length;++a){var u=o[a];e+=encodeURIComponent(u)+"="+encodeURIComponent(n[u]||"")+"&"}if(o.length){e=e.substr(0,e.length-1)}return y(e,"GET",n,t,r)}function T(e,n,t,r){return y(e,"POST",n,t,r)}function O(e,n,t,r){return y(e,"PATCH",n,t,r)}function j(e,n,t,r){return y(e,"PUT",n,t,r)}function S(e,n,t){var r=Object.getOwnPropertyNames(n||{});if(r.length){if(e.indexOf("?")>=0){e+="&"}else{e+="?"}}for(var o=0;o<r.length;++o){var a=r[o];e+=encodeURIComponent(a)+"="+encodeURIComponent(n[a]||"")+"&"}if(r.length){e=e.substr(0,e.length-1)}return y(e,"DELETE",n,t)}function P(e,n){var t=a(n);var r=v(e,n,t.some(e=>e==="page"));if(u[r]){delete u[r]}}function w(e,n,t,r){var o;if(!i[e])i[e]=[];var a=g(t);if(!a){o=v(e,n);u[o]=t}else{o=v(e,n,true);if(!u[o])u[o]={isPaged:true};u[o][t.data.current]=t}if(!i[e].some(e=>e==o))i[e].push(o);if(r)s[o]=(new Date).getTime()+r}e.generateQueryStringFromObject=d;e.generateObjectFromQueryString=p;e.xhrRequest=h;e.request=y;e.get=m;e.post=T;e.put=j;e.patch=O;e.delete=S;e.useConfig=l;return e})(typeof exports==="object"&&typeof module!=="undefined"?exports:function(){window.cq={};return window.cq}());
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
  });
@@ -15945,7 +15946,7 @@ var Vue = (function (exports) {
15945
15946
 
15946
15947
  window.Vue = Vue;
15947
15948
 
15948
- function buildPomeloUI(options, exports) {
15949
+ function build(options, exports) {
15949
15950
  if (typeof exports == 'undefined') {
15950
15951
  exports = {};
15951
15952
  }
@@ -15960,6 +15961,17 @@ function buildPomeloUI(options, exports) {
15960
15961
  httpGet: function (url) {
15961
15962
  return fetch(url);
15962
15963
  },
15964
+ httpGetSync: function (url) {
15965
+ if (useRelativePath) {
15966
+ if (url.length && url[0] == '/') {
15967
+ url = url.substr(1);
15968
+ }
15969
+ }
15970
+ var xhr = new XMLHttpRequest();
15971
+ xhr.open('get', url, false);
15972
+ xhr.send();
15973
+ return xhr.responseText;
15974
+ },
15963
15975
  onNotFound: function (url, options) {
15964
15976
  if (url.indexOf('/404') == 0) {
15965
15977
  throw 'No not-found template found';
@@ -15984,9 +15996,6 @@ function buildPomeloUI(options, exports) {
15984
15996
  },
15985
15997
  resetDataWhenReuseContainerActiveView(viewName) {
15986
15998
  return true;
15987
- },
15988
- getRoutePath() {
15989
- return '/shared/_routes.json';
15990
15999
  }
15991
16000
  };
15992
16001
 
@@ -16057,18 +16066,17 @@ function buildPomeloUI(options, exports) {
16057
16066
  function root() {
16058
16067
  return _root;
16059
16068
  };
16060
- window._rules = {};
16061
- // Fetch route rules
16062
- var _loadRoutePromise = _httpGet(_options.getRoutePath()).then(function (rules) {
16063
- var rules = JSON.parse(rules);
16064
- if (!window._rules) {
16065
- window._rules = {};
16066
- }
16067
- _combineObject(rules, window._rules);
16068
- }).catch(err => {
16069
- console.error('No route provided. Please prepare /shared/_routes.json file and try again.');
16070
- });
16071
16069
 
16070
+ exports._rules = [];
16071
+
16072
+ function useRoutes(url) {
16073
+ var rules = _options.httpGetSync(url);
16074
+ rules = JSON.parse(rules);
16075
+ if (!exports._rules) {
16076
+ exports._rules = {};
16077
+ }
16078
+ _combineObject(rules, exports._rules);
16079
+ }
16072
16080
 
16073
16081
  // Internal
16074
16082
  function _combineObject(src, dest) {
@@ -16162,6 +16170,7 @@ function buildPomeloUI(options, exports) {
16162
16170
  if (!component.template) {
16163
16171
  component.template = template;
16164
16172
  }
16173
+ _patchComponent(url, component);
16165
16174
  return Promise.resolve(component);
16166
16175
  });
16167
16176
  })
@@ -16402,6 +16411,7 @@ function buildPomeloUI(options, exports) {
16402
16411
  }
16403
16412
  _attachContainer(instance);
16404
16413
  };
16414
+
16405
16415
  return _resolveModules(options.modules, layout).then(function () {
16406
16416
  return _loadComponents(options.components || [], layout).then(function (components) {
16407
16417
  var app = Vue.createApp(options || {});
@@ -16452,22 +16462,19 @@ function buildPomeloUI(options, exports) {
16452
16462
  UpdateLayout();
16453
16463
  };
16454
16464
 
16455
- _loadRoutePromise.then(function () {
16456
- return UpdateLayout();
16457
- });
16458
-
16465
+ return UpdateLayout();
16459
16466
  }
16460
16467
 
16461
- function SetOptions(options) {
16468
+ function UseConfig(options) {
16462
16469
  _combineObject(options, _options);
16463
16470
  }
16464
16471
 
16465
- function Route(rule, view) {
16466
- if (!window._rules) {
16467
- window._rules = {};
16472
+ function MapRoute(rule, view) {
16473
+ if (!exports._rules) {
16474
+ exports._rules = {};
16468
16475
  }
16469
16476
 
16470
- window._rules[rule] = view;
16477
+ exports._rules[rule] = view;
16471
16478
  }
16472
16479
 
16473
16480
  function ForceUpdate(proxy = exports.root()) {
@@ -16538,11 +16545,11 @@ function buildPomeloUI(options, exports) {
16538
16545
  return cnt;
16539
16546
  }
16540
16547
 
16541
- var keys = Object.getOwnPropertyNames(window._rules);
16548
+ var keys = Object.getOwnPropertyNames(exports._rules);
16542
16549
  for (var i = 0; i < keys.length; ++i) {
16543
16550
  var rule = keys[i];
16544
16551
  var isHash = rule[0] == '#';
16545
- var view = window._rules[keys[i]];
16552
+ var view = exports._rules[keys[i]];
16546
16553
  var matches = matchAll(rule);
16547
16554
  var params = [];
16548
16555
  var patterns = [];
@@ -16885,14 +16892,9 @@ function buildPomeloUI(options, exports) {
16885
16892
 
16886
16893
  if (layout) {
16887
16894
  var layoutName = layout + (mobile ? '.m' : '');
16895
+ var _layoutHtml;
16888
16896
  return _httpGet(layoutName + '.html').then(function (layoutHtml) {
16889
- var htmlBeginTagIndex = layoutHtml.indexOf('<html');
16890
- var htmlBeginTagIndex2 = layoutHtml.indexOf('>', htmlBeginTagIndex);
16891
- layoutHtml = layoutHtml.substr(htmlBeginTagIndex2 + 1);
16892
- var htmlEndTagIndex = layoutHtml.lastIndexOf('</html>');
16893
- layoutHtml = layoutHtml.substr(0, htmlEndTagIndex);
16894
- document.querySelector('html').innerHTML = layoutHtml;
16895
-
16897
+ _layoutHtml = layoutHtml;
16896
16898
  return _httpGet(layout + ".js");
16897
16899
  }).then(function (js) {
16898
16900
  var _opt = null;
@@ -16914,6 +16916,15 @@ function buildPomeloUI(options, exports) {
16914
16916
  instance.$app = exports;
16915
16917
  }
16916
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;
16917
16928
  var dataFunc = options.data;
16918
16929
  options.data = function () {
16919
16930
  var data = dataFunc.call(this, exports);
@@ -16925,8 +16936,9 @@ function buildPomeloUI(options, exports) {
16925
16936
  var ticks = new Date().getTime();
16926
16937
  var appId = 'pomelo-' + ticks;
16927
16938
  var containerId = 'container-' + ticks;
16928
- document.querySelector('body').innerHTML = '<div id="' + appId + '">' + document.querySelector('body').innerHTML.replace('<render-body></render-body>', '<div id="' + containerId + '"></div>') + '</div>'
16929
-
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;
16930
16942
  // Hook mounted
16931
16943
  if (!options.mounted) {
16932
16944
  options.mounted = function () { };
@@ -16996,6 +17008,7 @@ function buildPomeloUI(options, exports) {
16996
17008
  return data;
16997
17009
  }
16998
17010
  hookMountedAndUnmounted(_opt, viewName);
17011
+ _patchComponent(viewName, _opt);
16999
17012
  return _resolveModules(_opt.modules, viewName).then(function () {
17000
17013
  PageNext(_opt);
17001
17014
  return Promise.resolve();P
@@ -17141,6 +17154,9 @@ function buildPomeloUI(options, exports) {
17141
17154
  var instance = Vue.getCurrentInstance();
17142
17155
  instance.$app = exports;
17143
17156
  }
17157
+
17158
+ _patchComponent(c, _opt);
17159
+
17144
17160
  var originData = _opt.data || function () {
17145
17161
  return {};
17146
17162
  };
@@ -17166,17 +17182,259 @@ function buildPomeloUI(options, exports) {
17166
17182
  });
17167
17183
  }
17168
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
+
17169
17425
  exports.root = root;
17170
- exports.setOptions = SetOptions;
17171
- exports.route = Route;
17426
+ exports.useConfig = UseConfig;
17427
+ exports.mapRoute = MapRoute;
17172
17428
  exports.matchRoute = MatchRoute;
17173
17429
  exports.updateLayout = UpdateLayout;
17174
17430
  exports.redirect = Redirect;
17175
17431
  exports.loadScript = LoadScript;
17176
17432
  exports.forceUpdate = ForceUpdate;
17177
17433
  exports.mount = mount;
17434
+ exports.useRoutes = useRoutes;
17435
+ exports.useAddin = UseAddin;
17178
17436
 
17179
17437
  return exports;
17180
17438
  };
17181
17439
 
17182
- exports.buildPomeloUI = buildPomeloUI;
17440
+ exports.build = build;