pome-ui 2.0.0-preview2 → 2.0.0-preview4
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-cache-query.js +2 -5
- package/pome-cache-query.min.js +1 -1
- package/pome-ui.dev.js +65 -33
- package/pome-ui.dev.min.js +1 -1
- package/pome-ui.js +65 -34
- package/pome-ui.min.js +1 -1
package/package.json
CHANGED
package/pome-cache-query.js
CHANGED
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
batchInterval: null,
|
|
41
41
|
batchTimeout: 10
|
|
42
42
|
};
|
|
43
|
-
_combineObject(window.CQOptions || {}, _options);
|
|
44
43
|
|
|
45
44
|
var _batchRequests = [];
|
|
46
45
|
|
|
@@ -81,8 +80,6 @@
|
|
|
81
80
|
var __cache = {};
|
|
82
81
|
var __cacheDictionary = {};
|
|
83
82
|
var __cacheExpire = {};
|
|
84
|
-
var __cacheFilters = {};
|
|
85
|
-
var __cacheSubscribe = {};
|
|
86
83
|
|
|
87
84
|
function randomString(length, chars = null) {
|
|
88
85
|
chars = chars || '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';
|
|
@@ -93,7 +90,7 @@
|
|
|
93
90
|
return result;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
function
|
|
93
|
+
function UseConfig(options) {
|
|
97
94
|
_combineObject(options, _options);
|
|
98
95
|
}
|
|
99
96
|
|
|
@@ -319,7 +316,7 @@
|
|
|
319
316
|
exports.put = put;
|
|
320
317
|
exports.patch = patch;
|
|
321
318
|
exports.delete = _delete;
|
|
322
|
-
exports.
|
|
319
|
+
exports.useConfig = UseConfig;
|
|
323
320
|
|
|
324
321
|
return exports;
|
|
325
322
|
|
package/pome-cache-query.min.js
CHANGED
|
@@ -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};
|
|
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
|
@@ -4585,6 +4585,7 @@ var Vue = (function (exports) {
|
|
|
4585
4585
|
$unmounted: i => i.$unmounted,
|
|
4586
4586
|
$mounted: i => i.$mounted,
|
|
4587
4587
|
$layout: i => i.$layout,
|
|
4588
|
+
$app: i => i.$app,
|
|
4588
4589
|
$view: i => i.$view
|
|
4589
4590
|
|
|
4590
4591
|
});
|
|
@@ -15942,7 +15943,9 @@ var Vue = (function (exports) {
|
|
|
15942
15943
|
// Copyright (c) Yuko(Yisheng) Zheng. All rights reserved.
|
|
15943
15944
|
// Licensed under the GPL v3. See LICENSE in the project root for license information.
|
|
15944
15945
|
|
|
15945
|
-
|
|
15946
|
+
window.Vue = Vue;
|
|
15947
|
+
|
|
15948
|
+
function build(options, exports) {
|
|
15946
15949
|
if (typeof exports == 'undefined') {
|
|
15947
15950
|
exports = {};
|
|
15948
15951
|
}
|
|
@@ -15957,6 +15960,17 @@ function buildPomeloUI(options, exports) {
|
|
|
15957
15960
|
httpGet: function (url) {
|
|
15958
15961
|
return fetch(url);
|
|
15959
15962
|
},
|
|
15963
|
+
httpGetSync: function (url) {
|
|
15964
|
+
if (useRelativePath) {
|
|
15965
|
+
if (url.length && url[0] == '/') {
|
|
15966
|
+
url = url.substr(1);
|
|
15967
|
+
}
|
|
15968
|
+
}
|
|
15969
|
+
var xhr = new XMLHttpRequest();
|
|
15970
|
+
xhr.open('get', url, false);
|
|
15971
|
+
xhr.send();
|
|
15972
|
+
return xhr.responseText;
|
|
15973
|
+
},
|
|
15960
15974
|
onNotFound: function (url, options) {
|
|
15961
15975
|
if (url.indexOf('/404') == 0) {
|
|
15962
15976
|
throw 'No not-found template found';
|
|
@@ -15981,9 +15995,6 @@ function buildPomeloUI(options, exports) {
|
|
|
15981
15995
|
},
|
|
15982
15996
|
resetDataWhenReuseContainerActiveView(viewName) {
|
|
15983
15997
|
return true;
|
|
15984
|
-
},
|
|
15985
|
-
getRoutePath() {
|
|
15986
|
-
return '/shared/_routes.json';
|
|
15987
15998
|
}
|
|
15988
15999
|
};
|
|
15989
16000
|
|
|
@@ -16054,18 +16065,17 @@ function buildPomeloUI(options, exports) {
|
|
|
16054
16065
|
function root() {
|
|
16055
16066
|
return _root;
|
|
16056
16067
|
};
|
|
16057
|
-
window._rules = {};
|
|
16058
|
-
// Fetch route rules
|
|
16059
|
-
var _loadRoutePromise = _httpGet(_options.getRoutePath()).then(function (rules) {
|
|
16060
|
-
var rules = JSON.parse(rules);
|
|
16061
|
-
if (!window._rules) {
|
|
16062
|
-
window._rules = {};
|
|
16063
|
-
}
|
|
16064
|
-
_combineObject(rules, window._rules);
|
|
16065
|
-
}).catch(err => {
|
|
16066
|
-
console.error('No route provided. Please prepare /shared/_routes.json file and try again.');
|
|
16067
|
-
});
|
|
16068
16068
|
|
|
16069
|
+
exports._rules = [];
|
|
16070
|
+
|
|
16071
|
+
function useRoutes(url) {
|
|
16072
|
+
var rules = _options.httpGetSync(url);
|
|
16073
|
+
rules = JSON.parse(rules);
|
|
16074
|
+
if (!exports._rules) {
|
|
16075
|
+
exports._rules = {};
|
|
16076
|
+
}
|
|
16077
|
+
_combineObject(rules, exports._rules);
|
|
16078
|
+
}
|
|
16069
16079
|
|
|
16070
16080
|
// Internal
|
|
16071
16081
|
function _combineObject(src, dest) {
|
|
@@ -16173,6 +16183,7 @@ function buildPomeloUI(options, exports) {
|
|
|
16173
16183
|
instance.$parent = parent || exports.root();
|
|
16174
16184
|
instance.$root = exports.root() || parent;
|
|
16175
16185
|
instance.$view = url;
|
|
16186
|
+
instance.$app = exports;
|
|
16176
16187
|
instance.$data = component.data || function () { return {}; };
|
|
16177
16188
|
instance.$created = component.created || function () { };
|
|
16178
16189
|
instance.$mounted = component.mounted || function () { };
|
|
@@ -16185,7 +16196,7 @@ function buildPomeloUI(options, exports) {
|
|
|
16185
16196
|
return {};
|
|
16186
16197
|
};
|
|
16187
16198
|
component.data = function () {
|
|
16188
|
-
var data = originalDataFunc();
|
|
16199
|
+
var data = originalDataFunc.call(this, exports);
|
|
16189
16200
|
_combineObject(params, data);
|
|
16190
16201
|
_parseQueryString(data);
|
|
16191
16202
|
return data;
|
|
@@ -16391,6 +16402,7 @@ function buildPomeloUI(options, exports) {
|
|
|
16391
16402
|
instance.$parent = parent || exports.root();
|
|
16392
16403
|
instance.$root = exports.root() || parent;
|
|
16393
16404
|
instance.$onUpdating = options.onUpdating;
|
|
16405
|
+
instance.$app = exports;
|
|
16394
16406
|
if (layout) {
|
|
16395
16407
|
instance.$layout = layout;
|
|
16396
16408
|
instance.$view = layout;
|
|
@@ -16447,22 +16459,19 @@ function buildPomeloUI(options, exports) {
|
|
|
16447
16459
|
UpdateLayout();
|
|
16448
16460
|
};
|
|
16449
16461
|
|
|
16450
|
-
|
|
16451
|
-
return UpdateLayout();
|
|
16452
|
-
});
|
|
16453
|
-
|
|
16462
|
+
return UpdateLayout();
|
|
16454
16463
|
}
|
|
16455
16464
|
|
|
16456
|
-
function
|
|
16465
|
+
function UseConfig(options) {
|
|
16457
16466
|
_combineObject(options, _options);
|
|
16458
16467
|
}
|
|
16459
16468
|
|
|
16460
|
-
function
|
|
16461
|
-
if (!
|
|
16462
|
-
|
|
16469
|
+
function MapRoute(rule, view) {
|
|
16470
|
+
if (!exports._rules) {
|
|
16471
|
+
exports._rules = {};
|
|
16463
16472
|
}
|
|
16464
16473
|
|
|
16465
|
-
|
|
16474
|
+
exports._rules[rule] = view;
|
|
16466
16475
|
}
|
|
16467
16476
|
|
|
16468
16477
|
function ForceUpdate(proxy = exports.root()) {
|
|
@@ -16533,11 +16542,11 @@ function buildPomeloUI(options, exports) {
|
|
|
16533
16542
|
return cnt;
|
|
16534
16543
|
}
|
|
16535
16544
|
|
|
16536
|
-
var keys = Object.getOwnPropertyNames(
|
|
16545
|
+
var keys = Object.getOwnPropertyNames(exports._rules);
|
|
16537
16546
|
for (var i = 0; i < keys.length; ++i) {
|
|
16538
16547
|
var rule = keys[i];
|
|
16539
16548
|
var isHash = rule[0] == '#';
|
|
16540
|
-
var view =
|
|
16549
|
+
var view = exports._rules[keys[i]];
|
|
16541
16550
|
var matches = matchAll(rule);
|
|
16542
16551
|
var params = [];
|
|
16543
16552
|
var patterns = [];
|
|
@@ -16902,9 +16911,16 @@ function buildPomeloUI(options, exports) {
|
|
|
16902
16911
|
};
|
|
16903
16912
|
}
|
|
16904
16913
|
|
|
16914
|
+
var setupFunc = options.setup || function (props, context) { };
|
|
16915
|
+
options.setup = function (props, context) {
|
|
16916
|
+
setupFunc(props, context);
|
|
16917
|
+
var instance = Vue.getCurrentInstance();
|
|
16918
|
+
instance.$app = exports;
|
|
16919
|
+
}
|
|
16920
|
+
|
|
16905
16921
|
var dataFunc = options.data;
|
|
16906
16922
|
options.data = function () {
|
|
16907
|
-
var data = dataFunc.call(this);
|
|
16923
|
+
var data = dataFunc.call(this, exports);
|
|
16908
16924
|
_combineObject(params, data);
|
|
16909
16925
|
_parseQueryString(data);
|
|
16910
16926
|
return data;
|
|
@@ -16978,7 +16994,7 @@ function buildPomeloUI(options, exports) {
|
|
|
16978
16994
|
}
|
|
16979
16995
|
var dataFunc = _opt.data;
|
|
16980
16996
|
_opt.data = function () {
|
|
16981
|
-
var data = dataFunc.call(this);
|
|
16997
|
+
var data = dataFunc.call(this, exports);
|
|
16982
16998
|
_combineObject(params, data);
|
|
16983
16999
|
_parseQueryString(data);
|
|
16984
17000
|
return data;
|
|
@@ -16986,7 +17002,7 @@ function buildPomeloUI(options, exports) {
|
|
|
16986
17002
|
hookMountedAndUnmounted(_opt, viewName);
|
|
16987
17003
|
return _resolveModules(_opt.modules, viewName).then(function () {
|
|
16988
17004
|
PageNext(_opt);
|
|
16989
|
-
return Promise.resolve();
|
|
17005
|
+
return Promise.resolve();P
|
|
16990
17006
|
});
|
|
16991
17007
|
});
|
|
16992
17008
|
}
|
|
@@ -17120,6 +17136,21 @@ function buildPomeloUI(options, exports) {
|
|
|
17120
17136
|
if (!_opt.template) {
|
|
17121
17137
|
_opt.template = _html;
|
|
17122
17138
|
}
|
|
17139
|
+
if (!_opt.setup) {
|
|
17140
|
+
_opt.setup = function () { };
|
|
17141
|
+
}
|
|
17142
|
+
var originSetup = _opt.setup;
|
|
17143
|
+
_opt.setup = function (props, context) {
|
|
17144
|
+
originSetup(props, context);
|
|
17145
|
+
var instance = Vue.getCurrentInstance();
|
|
17146
|
+
instance.$app = exports;
|
|
17147
|
+
}
|
|
17148
|
+
var originData = _opt.data || function () {
|
|
17149
|
+
return {};
|
|
17150
|
+
};
|
|
17151
|
+
_opt.data = function () {
|
|
17152
|
+
return originData.call(this, exports);
|
|
17153
|
+
};
|
|
17123
17154
|
return _resolveModules(_opt.modules, c);
|
|
17124
17155
|
}).then(function () {
|
|
17125
17156
|
ret.push({ name: _name, options: _opt });
|
|
@@ -17140,16 +17171,17 @@ function buildPomeloUI(options, exports) {
|
|
|
17140
17171
|
}
|
|
17141
17172
|
|
|
17142
17173
|
exports.root = root;
|
|
17143
|
-
exports.
|
|
17144
|
-
exports.
|
|
17174
|
+
exports.useConfig = UseConfig;
|
|
17175
|
+
exports.mapRoute = MapRoute;
|
|
17145
17176
|
exports.matchRoute = MatchRoute;
|
|
17146
17177
|
exports.updateLayout = UpdateLayout;
|
|
17147
17178
|
exports.redirect = Redirect;
|
|
17148
17179
|
exports.loadScript = LoadScript;
|
|
17149
17180
|
exports.forceUpdate = ForceUpdate;
|
|
17150
17181
|
exports.mount = mount;
|
|
17182
|
+
exports.useRoutes = useRoutes;
|
|
17151
17183
|
|
|
17152
17184
|
return exports;
|
|
17153
17185
|
};
|
|
17154
17186
|
|
|
17155
|
-
exports.
|
|
17187
|
+
exports.build = build;
|