vuejs-rails 2.4.2 → 2.5.13
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.
- checksums.yaml +4 -4
- data/Readme.md +9 -4
- data/lib/vuejs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/dist/vue-resource.js +36 -35
- data/vendor/assets/javascripts/dist/vue-resource.min.js +2 -2
- data/vendor/assets/javascripts/dist/vue-router.js +167 -49
- data/vendor/assets/javascripts/dist/vue-router.min.js +2 -2
- data/vendor/assets/javascripts/dist/vue.js +2058 -1338
- data/vendor/assets/javascripts/dist/vue.min.js +2 -2
- data/vendor/assets/javascripts/dist/vuex.js +207 -78
- data/vendor/assets/javascripts/dist/vuex.min.js +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ba4601640ccf8428ed23848a2c0c20f8c2aa9c1
|
4
|
+
data.tar.gz: 894044aa622474cd28e527e237eb4846a98d4b01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52372922fd57637134a29c1883e589264554da4338d8c7925561981303a272b27a0072172c17e1f404c9cdd9473bf7c2562409eb80fcbda12caa79598d6707ee
|
7
|
+
data.tar.gz: b1c6f755eefd67cdec90efa26116f3065ed773c8d89fb3fa04c1670287f8eec150204e09db4651577c0719092eaddb83d811c38c69b15edcd53927c70ff86f67
|
data/Readme.md
CHANGED
@@ -9,10 +9,15 @@ Rails 3.1+ asset-pipeline gem to provide Vue.js
|
|
9
9
|
|
10
10
|
### Package Versions
|
11
11
|
|
12
|
-
- vue v2.
|
13
|
-
- vue-router
|
14
|
-
- vue-resource v1.3.
|
15
|
-
- vuex
|
12
|
+
- vue v2.5.13
|
13
|
+
- vue-router v3.0.1
|
14
|
+
- vue-resource v1.3.5
|
15
|
+
- vuex v3.0.1
|
16
|
+
|
17
|
+
### Compatibility
|
18
|
+
|
19
|
+
- vue-router v3.0.0 has breaking changes for TypeScript: https://github.com/vuejs/vue-router/releases/tag/v3.0.0
|
20
|
+
- vuex v3.0.0 has breaking changes for TypeScript: https://github.com/vuejs/vuex/releases/tag/v3.0.0
|
16
21
|
|
17
22
|
### Setup
|
18
23
|
|
data/lib/vuejs-rails/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* vue-resource v1.3.
|
2
|
+
* vue-resource v1.3.5
|
3
3
|
* https://github.com/pagekit/vue-resource
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
@@ -276,13 +276,13 @@ var ntick;
|
|
276
276
|
|
277
277
|
var inBrowser = typeof window !== 'undefined';
|
278
278
|
|
279
|
-
|
279
|
+
function Util (ref) {
|
280
280
|
var config = ref.config;
|
281
281
|
var nextTick = ref.nextTick;
|
282
282
|
|
283
283
|
ntick = nextTick;
|
284
284
|
debug = config.debug || !config.silent;
|
285
|
-
}
|
285
|
+
}
|
286
286
|
|
287
287
|
function warn(msg) {
|
288
288
|
if (typeof console !== 'undefined' && debug) {
|
@@ -455,7 +455,7 @@ function _merge(target, source, deep) {
|
|
455
455
|
* Root Prefix Transform.
|
456
456
|
*/
|
457
457
|
|
458
|
-
|
458
|
+
function root (options$$1, next) {
|
459
459
|
|
460
460
|
var url = next(options$$1);
|
461
461
|
|
@@ -464,13 +464,13 @@ var root = function (options$$1, next) {
|
|
464
464
|
}
|
465
465
|
|
466
466
|
return url;
|
467
|
-
}
|
467
|
+
}
|
468
468
|
|
469
469
|
/**
|
470
470
|
* Query Parameter Transform.
|
471
471
|
*/
|
472
472
|
|
473
|
-
|
473
|
+
function query (options$$1, next) {
|
474
474
|
|
475
475
|
var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1);
|
476
476
|
|
@@ -487,7 +487,7 @@ var query = function (options$$1, next) {
|
|
487
487
|
}
|
488
488
|
|
489
489
|
return url;
|
490
|
-
}
|
490
|
+
}
|
491
491
|
|
492
492
|
/**
|
493
493
|
* URL Template v2.0.6 (https://github.com/bramstein/url-template)
|
@@ -644,7 +644,7 @@ function encodeReserved(str) {
|
|
644
644
|
* URL Template (RFC 6570) Transform.
|
645
645
|
*/
|
646
646
|
|
647
|
-
|
647
|
+
function template (options) {
|
648
648
|
|
649
649
|
var variables = [], url = expand(options.url, options.params, variables);
|
650
650
|
|
@@ -653,7 +653,7 @@ var template = function (options) {
|
|
653
653
|
});
|
654
654
|
|
655
655
|
return url;
|
656
|
-
}
|
656
|
+
}
|
657
657
|
|
658
658
|
/**
|
659
659
|
* Service for URL templating.
|
@@ -790,7 +790,7 @@ function serialize(params, obj, scope) {
|
|
790
790
|
* XDomain client (Internet Explorer).
|
791
791
|
*/
|
792
792
|
|
793
|
-
|
793
|
+
function xdrClient (request) {
|
794
794
|
return new PromiseObj(function (resolve) {
|
795
795
|
|
796
796
|
var xdr = new XDomainRequest(), handler = function (ref) {
|
@@ -823,7 +823,7 @@ var xdrClient = function (request) {
|
|
823
823
|
xdr.onprogress = function () {};
|
824
824
|
xdr.send(request.getBody());
|
825
825
|
});
|
826
|
-
}
|
826
|
+
}
|
827
827
|
|
828
828
|
/**
|
829
829
|
* CORS Interceptor.
|
@@ -831,7 +831,7 @@ var xdrClient = function (request) {
|
|
831
831
|
|
832
832
|
var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
|
833
833
|
|
834
|
-
|
834
|
+
function cors (request, next) {
|
835
835
|
|
836
836
|
if (inBrowser) {
|
837
837
|
|
@@ -850,13 +850,13 @@ var cors = function (request, next) {
|
|
850
850
|
}
|
851
851
|
|
852
852
|
next();
|
853
|
-
}
|
853
|
+
}
|
854
854
|
|
855
855
|
/**
|
856
856
|
* Form data Interceptor.
|
857
857
|
*/
|
858
858
|
|
859
|
-
|
859
|
+
function form (request, next) {
|
860
860
|
|
861
861
|
if (isFormData(request.body)) {
|
862
862
|
|
@@ -869,13 +869,13 @@ var form = function (request, next) {
|
|
869
869
|
}
|
870
870
|
|
871
871
|
next();
|
872
|
-
}
|
872
|
+
}
|
873
873
|
|
874
874
|
/**
|
875
875
|
* JSON Interceptor.
|
876
876
|
*/
|
877
877
|
|
878
|
-
|
878
|
+
function json (request, next) {
|
879
879
|
|
880
880
|
var type = request.headers.get('Content-Type') || '';
|
881
881
|
|
@@ -906,20 +906,21 @@ var json = function (request, next) {
|
|
906
906
|
}) : response;
|
907
907
|
|
908
908
|
});
|
909
|
-
}
|
909
|
+
}
|
910
910
|
|
911
911
|
function isJson(str) {
|
912
912
|
|
913
|
-
var start = str.match(/^\[
|
913
|
+
var start = str.match(/^\s*(\[|\{)/);
|
914
|
+
var end = {'[': /]\s*$/, '{': /}\s*$/};
|
914
915
|
|
915
|
-
return start && end[start[
|
916
|
+
return start && end[start[1]].test(str);
|
916
917
|
}
|
917
918
|
|
918
919
|
/**
|
919
920
|
* JSONP client (Browser).
|
920
921
|
*/
|
921
922
|
|
922
|
-
|
923
|
+
function jsonpClient (request) {
|
923
924
|
return new PromiseObj(function (resolve) {
|
924
925
|
|
925
926
|
var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script;
|
@@ -967,39 +968,39 @@ var jsonpClient = function (request) {
|
|
967
968
|
|
968
969
|
document.body.appendChild(script);
|
969
970
|
});
|
970
|
-
}
|
971
|
+
}
|
971
972
|
|
972
973
|
/**
|
973
974
|
* JSONP Interceptor.
|
974
975
|
*/
|
975
976
|
|
976
|
-
|
977
|
+
function jsonp (request, next) {
|
977
978
|
|
978
979
|
if (request.method == 'JSONP') {
|
979
980
|
request.client = jsonpClient;
|
980
981
|
}
|
981
982
|
|
982
983
|
next();
|
983
|
-
}
|
984
|
+
}
|
984
985
|
|
985
986
|
/**
|
986
987
|
* Before Interceptor.
|
987
988
|
*/
|
988
989
|
|
989
|
-
|
990
|
+
function before (request, next) {
|
990
991
|
|
991
992
|
if (isFunction(request.before)) {
|
992
993
|
request.before.call(this, request);
|
993
994
|
}
|
994
995
|
|
995
996
|
next();
|
996
|
-
}
|
997
|
+
}
|
997
998
|
|
998
999
|
/**
|
999
1000
|
* HTTP method override Interceptor.
|
1000
1001
|
*/
|
1001
1002
|
|
1002
|
-
|
1003
|
+
function method (request, next) {
|
1003
1004
|
|
1004
1005
|
if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
|
1005
1006
|
request.headers.set('X-HTTP-Method-Override', request.method);
|
@@ -1007,13 +1008,13 @@ var method = function (request, next) {
|
|
1007
1008
|
}
|
1008
1009
|
|
1009
1010
|
next();
|
1010
|
-
}
|
1011
|
+
}
|
1011
1012
|
|
1012
1013
|
/**
|
1013
1014
|
* Header Interceptor.
|
1014
1015
|
*/
|
1015
1016
|
|
1016
|
-
|
1017
|
+
function header (request, next) {
|
1017
1018
|
|
1018
1019
|
var headers = assign({}, Http.headers.common,
|
1019
1020
|
!request.crossOrigin ? Http.headers.custom : {},
|
@@ -1027,13 +1028,13 @@ var header = function (request, next) {
|
|
1027
1028
|
});
|
1028
1029
|
|
1029
1030
|
next();
|
1030
|
-
}
|
1031
|
+
}
|
1031
1032
|
|
1032
1033
|
/**
|
1033
1034
|
* XMLHttp client (Browser).
|
1034
1035
|
*/
|
1035
1036
|
|
1036
|
-
|
1037
|
+
function xhrClient (request) {
|
1037
1038
|
return new PromiseObj(function (resolve) {
|
1038
1039
|
|
1039
1040
|
var xhr = new XMLHttpRequest(), handler = function (event) {
|
@@ -1090,13 +1091,13 @@ var xhrClient = function (request) {
|
|
1090
1091
|
xhr.ontimeout = handler;
|
1091
1092
|
xhr.send(request.getBody());
|
1092
1093
|
});
|
1093
|
-
}
|
1094
|
+
}
|
1094
1095
|
|
1095
1096
|
/**
|
1096
1097
|
* Http client (Node).
|
1097
1098
|
*/
|
1098
1099
|
|
1099
|
-
|
1100
|
+
function nodeClient (request) {
|
1100
1101
|
|
1101
1102
|
var client = require('got');
|
1102
1103
|
|
@@ -1127,13 +1128,13 @@ var nodeClient = function (request) {
|
|
1127
1128
|
|
1128
1129
|
}, function (error$$1) { return handler(error$$1.response); });
|
1129
1130
|
});
|
1130
|
-
}
|
1131
|
+
}
|
1131
1132
|
|
1132
1133
|
/**
|
1133
1134
|
* Base client.
|
1134
1135
|
*/
|
1135
1136
|
|
1136
|
-
|
1137
|
+
function Client (context) {
|
1137
1138
|
|
1138
1139
|
var reqHandlers = [sendRequest], resHandlers = [], handler;
|
1139
1140
|
|
@@ -1188,7 +1189,7 @@ var Client = function (context) {
|
|
1188
1189
|
};
|
1189
1190
|
|
1190
1191
|
return Client;
|
1191
|
-
}
|
1192
|
+
}
|
1192
1193
|
|
1193
1194
|
function sendRequest(request, resolve) {
|
1194
1195
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
|
-
* vue-resource v1.3.
|
2
|
+
* vue-resource v1.3.5
|
3
3
|
* https://github.com/pagekit/vue-resource
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
6
6
|
|
7
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function t(t){this.state=J,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function e(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function n(t){"undefined"!=typeof console&&_&&console.warn("[VueResource warn]: "+t)}function o(t){"undefined"!=typeof console&&console.error(t)}function r(t,e){return F(t,e)}function i(t){return t?t.replace(/^\s*|\s*$/g,""):""}function u(t,e){return t&&void 0===e?t.replace(/\s+$/,""):t&&e?t.replace(new RegExp("["+e+"]+$"),""):t}function s(t){return t?t.toLowerCase():""}function a(t){return t?t.toUpperCase():""}function c(t){return"string"==typeof t}function f(t){return"function"==typeof t}function p(t){return null!==t&&"object"==typeof t}function h(t){return p(t)&&Object.getPrototypeOf(t)==Object.prototype}function d(t){return"undefined"!=typeof Blob&&t instanceof Blob}function l(t){return"undefined"!=typeof FormData&&t instanceof FormData}function m(t,n,o){var r=e.resolve(t);return arguments.length<2?r:r.then(n,o)}function y(t,e,n){return n=n||{},f(n)&&(n=n.call(e)),b(t.bind({$vm:e,$options:n}),t,{$options:n})}function v(t,e){var n,o;if(Q(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(p(t))for(o in t)G.call(t,o)&&e.call(t[o],t[o],o);return t}function b(t){return V.call(arguments,1).forEach(function(e){T(t,e,!0)}),t}function g(t){return V.call(arguments,1).forEach(function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])}),t}function w(t){return V.call(arguments,1).forEach(function(e){T(t,e)}),t}function T(t,e,n){for(var o in e)n&&(h(e[o])||Q(e[o]))?(h(e[o])&&!h(t[o])&&(t[o]={}),Q(e[o])&&!Q(t[o])&&(t[o]=[]),T(t[o],e[o],n)):void 0!==e[o]&&(t[o]=e[o])}function x(t,e,n){var o=j(t),r=o.expand(e);return n&&n.push.apply(n,o.vars),r}function j(t){var e=["+","#",".","/",";","?","&"],n=[];return{vars:n,expand:function(o){return t.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(t,r,i){if(r){var u=null,s=[];if(-1!==e.indexOf(r.charAt(0))&&(u=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(t){var e=/([^:\*]*)(?::(\d+)|(\*))?/.exec(t);s.push.apply(s,E(o,u,e[1],e[2]||e[3])),n.push(e[1])}),u&&"+"!==u){var a=",";return"?"===u?a="&":"#"!==u&&(a=u),(0!==s.length?u:"")+s.join(a)}return s.join(",")}return $(i)})}}}function E(t,e,n,o){var r=t[n],i=[];if(O(r)&&""!==r)if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)r=r.toString(),o&&"*"!==o&&(r=r.substring(0,parseInt(o,10))),i.push(C(e,r,P(e)?n:null));else if("*"===o)Array.isArray(r)?r.filter(O).forEach(function(t){i.push(C(e,t,P(e)?n:null))}):Object.keys(r).forEach(function(t){O(r[t])&&i.push(C(e,r[t],t))});else{var u=[];Array.isArray(r)?r.filter(O).forEach(function(t){u.push(C(e,t))}):Object.keys(r).forEach(function(t){O(r[t])&&(u.push(encodeURIComponent(t)),u.push(C(e,r[t].toString())))}),P(e)?i.push(encodeURIComponent(n)+"="+u.join(",")):0!==u.length&&i.push(u.join(","))}else";"===e?i.push(encodeURIComponent(n)):""!==r||"&"!==e&&"?"!==e?""===r&&i.push(""):i.push(encodeURIComponent(n)+"=");return i}function O(t){return void 0!==t&&null!==t}function P(t){return";"===t||"&"===t||"?"===t}function C(t,e,n){return e="+"===t||"#"===t?$(e):encodeURIComponent(e),n?encodeURIComponent(n)+"="+e:e}function $(t){return t.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t)),t}).join("")}function U(t,e){var n,o=this||{},r=t;return c(t)&&(r={url:t,params:e}),r=b({},U.options,o.$options,r),U.transforms.forEach(function(t){c(t)&&(t=U.transform[t]),f(t)&&(n=R(t,n,o.$vm))}),n(r)}function R(t,e,n){return function(o){return t.call(n,o,e)}}function A(t,e,n){var o,r=Q(e),i=h(e);v(e,function(e,u){o=p(e)||Q(e),n&&(u=n+"["+(i||o?u:"")+"]"),!n&&r?t.add(e.name,e.value):o?A(t,e,u):t.add(u,e)})}function S(t){var e=t.match(/^\[|^\{(?!\{)/),n={"[":/]$/,"{":/}$/};return e&&n[e[0]].test(t)}function k(t,e){e((t.client||(z?ht:dt))(t))}function I(t,e){return Object.keys(t).reduce(function(t,n){return s(e)===s(n)?n:t},null)}function q(t){if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return i(t)}function H(t){return new e(function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}})}function L(t){return 0===t.type.indexOf("text")||-1!==t.type.indexOf("json")}function B(t){var n=this||{},r=lt(n.$vm);return g(t||{},n.$options,B.options),B.interceptors.forEach(function(t){c(t)&&(t=B.interceptor[t]),f(t)&&r.use(t)}),r(new vt(t)).then(function(t){return t.ok?t:e.reject(t)},function(t){return t instanceof Error&&o(t),e.reject(t)})}function M(t,e,n,o){var r=this||{},i={};return n=Y({},M.actions,n),v(n,function(n,u){n=b({url:t,params:Y({},e)},o,n),i[u]=function(){return(r.$http||B)(N(n,arguments))}}),i}function N(t,e){var n,o=Y({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(o.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return o.body=n,o.params=Y({},o.params,r),o}function D(t){D.installed||(K(t),t.url=U,t.http=B,t.resource=M,t.Promise=e,Object.defineProperties(t.prototype,{$url:{get:function(){return y(t.url,this,this.$options.url)}},$http:{get:function(){return y(t.http,this,this.$options.http)}},$resource:{get:function(){return t.resource.bind(this)}},$promise:{get:function(){var e=this;return function(n){return new t.Promise(n,e)}}}}))}var J=2;t.reject=function(e){return new t(function(t,n){n(e)})},t.resolve=function(e){return new t(function(t,n){t(e)})},t.all=function(e){return new t(function(n,o){var r=0,i=[];0===e.length&&n(i);for(var u=0;u<e.length;u+=1)t.resolve(e[u]).then(function(t){return function(o){i[t]=o,(r+=1)===e.length&&n(i)}}(u),o)})},t.race=function(e){return new t(function(n,o){for(var r=0;r<e.length;r+=1)t.resolve(e[r]).then(n,o)})};var W=t.prototype;W.resolve=function(t){var e=this;if(e.state===J){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(t){return void(n||e.reject(t))}e.state=0,e.value=t,e.notify()}},W.reject=function(t){var e=this;if(e.state===J){if(t===e)throw new TypeError("Promise settled with itself.");e.state=1,e.value=t,e.notify()}},W.notify=function(){var t=this;r(function(){if(t.state!==J)for(;t.deferred.length;){var e=t.deferred.shift(),n=e[0],o=e[1],r=e[2],i=e[3];try{0===t.state?r("function"==typeof n?n.call(void 0,t.value):t.value):1===t.state&&("function"==typeof o?r(o.call(void 0,t.value)):i(t.value))}catch(t){i(t)}}})},W.then=function(e,n){var o=this;return new t(function(t,r){o.deferred.push([e,n,t,r]),o.notify()})},W.catch=function(t){return this.then(void 0,t)},"undefined"==typeof Promise&&(window.Promise=t),e.all=function(t,n){return new e(Promise.all(t),n)},e.resolve=function(t,n){return new e(Promise.resolve(t),n)},e.reject=function(t,n){return new e(Promise.reject(t),n)},e.race=function(t,n){return new e(Promise.race(t),n)};var X=e.prototype;X.bind=function(t){return this.context=t,this},X.then=function(t,n){return t&&t.bind&&this.context&&(t=t.bind(this.context)),n&&n.bind&&this.context&&(n=n.bind(this.context)),new e(this.promise.then(t,n),this.context)},X.catch=function(t){return t&&t.bind&&this.context&&(t=t.bind(this.context)),new e(this.promise.catch(t),this.context)},X.finally=function(t){return this.then(function(e){return t.call(this),e},function(e){return t.call(this),Promise.reject(e)})};var F,G={}.hasOwnProperty,V=[].slice,_=!1,z="undefined"!=typeof window,K=function(t){var e=t.config,n=t.nextTick;F=n,_=e.debug||!e.silent},Q=Array.isArray,Y=Object.assign||w,Z=function(t,e){var n=e(t);return c(t.root)&&!/^(https?:)?\//.test(n)&&(n=u(t.root,"/")+"/"+n),n},tt=function(t,e){var n=Object.keys(U.options.params),o={},r=e(t);return v(t.params,function(t,e){-1===n.indexOf(e)&&(o[e]=t)}),(o=U.params(o))&&(r+=(-1==r.indexOf("?")?"?":"&")+o),r},et=function(t){var e=[],n=x(t.url,t.params,e);return e.forEach(function(e){delete t.params[e]}),n};U.options={url:"",root:null,params:{}},U.transform={template:et,query:tt,root:Z},U.transforms=["template","query","root"],U.params=function(t){var e=[],n=encodeURIComponent;return e.add=function(t,e){f(e)&&(e=e()),null===e&&(e=""),this.push(n(t)+"="+n(e))},A(e,t),e.join("&").replace(/%20/g,"+")},U.parse=function(t){var e=document.createElement("a");return document.documentMode&&(e.href=t,t=e.href),e.href=t,{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",port:e.port,host:e.host,hostname:e.hostname,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):""}};var nt=function(t){return new e(function(e){var n=new XDomainRequest,o=function(o){var r=o.type,i=0;"load"===r?i=200:"error"===r&&(i=500),e(t.respondWith(n.responseText,{status:i}))};t.abort=function(){return n.abort()},n.open(t.method,t.getUrl()),t.timeout&&(n.timeout=t.timeout),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){},n.send(t.getBody())})},ot=z&&"withCredentials"in new XMLHttpRequest,rt=function(t,e){if(z){var n=U.parse(location.href),o=U.parse(t.getUrl());o.protocol===n.protocol&&o.host===n.host||(t.crossOrigin=!0,t.emulateHTTP=!1,ot||(t.client=nt))}e()},it=function(t,e){l(t.body)?t.headers.delete("Content-Type"):p(t.body)&&t.emulateJSON&&(t.body=U.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded")),e()},ut=function(t,e){var n=t.headers.get("Content-Type")||"";p(t.body)&&0===n.indexOf("application/json")&&(t.body=JSON.stringify(t.body)),e(function(t){return t.bodyText?m(t.text(),function(e){if(0===(n=t.headers.get("Content-Type")||"").indexOf("application/json")||S(e))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t}):t})},st=function(t){return new e(function(e){var n,o,r=t.jsonp||"callback",i=t.jsonpCallback||"_jsonp"+Math.random().toString(36).substr(2),u=null;n=function(n){var r=n.type,s=0;"load"===r&&null!==u?s=200:"error"===r&&(s=500),s&&window[i]&&(delete window[i],document.body.removeChild(o)),e(t.respondWith(u,{status:s}))},window[i]=function(t){u=JSON.stringify(t)},t.abort=function(){n({type:"abort"})},t.params[r]=i,t.timeout&&setTimeout(t.abort,t.timeout),(o=document.createElement("script")).src=t.getUrl(),o.type="text/javascript",o.async=!0,o.onload=n,o.onerror=n,document.body.appendChild(o)})},at=function(t,e){"JSONP"==t.method&&(t.client=st),e()},ct=function(t,e){f(t.before)&&t.before.call(this,t),e()},ft=function(t,e){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST"),e()},pt=function(t,e){v(Y({},B.headers.common,t.crossOrigin?{}:B.headers.custom,B.headers[s(t.method)]),function(e,n){t.headers.has(n)||t.headers.set(n,e)}),e()},ht=function(t){return new e(function(e){var n=new XMLHttpRequest,o=function(o){var r=t.respondWith("response"in n?n.response:n.responseText,{status:1223===n.status?204:n.status,statusText:1223===n.status?"No Content":i(n.statusText)});v(i(n.getAllResponseHeaders()).split("\n"),function(t){r.headers.append(t.slice(0,t.indexOf(":")),t.slice(t.indexOf(":")+1))}),e(r)};t.abort=function(){return n.abort()},t.progress&&("GET"===t.method?n.addEventListener("progress",t.progress):/^(POST|PUT)$/i.test(t.method)&&n.upload.addEventListener("progress",t.progress)),n.open(t.method,t.getUrl(),!0),t.timeout&&(n.timeout=t.timeout),t.responseType&&"responseType"in n&&(n.responseType=t.responseType),(t.withCredentials||t.credentials)&&(n.withCredentials=!0),t.crossOrigin||t.headers.set("X-Requested-With","XMLHttpRequest"),t.headers.forEach(function(t,e){n.setRequestHeader(e,t)}),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.send(t.getBody())})},dt=function(t){var n=require("got");return new e(function(e){var o,r=t.getUrl(),u=t.getBody(),s=t.method,a={};t.headers.forEach(function(t,e){a[e]=t}),n(r,{body:u,method:s,headers:a}).then(o=function(n){var o=t.respondWith(n.body,{status:n.statusCode,statusText:i(n.statusMessage)});v(n.headers,function(t,e){o.headers.set(e,t)}),e(o)},function(t){return o(t.response)})})},lt=function(t){function o(o){return new e(function(e,s){function a(){f(r=i.pop())?r.call(t,o,c):(n("Invalid interceptor of type "+typeof r+", must be a function"),c())}function c(n){if(f(n))u.unshift(n);else if(p(n))return u.forEach(function(e){n=m(n,function(n){return e.call(t,n)||n},s)}),void m(n,e,s);a()}a()},t)}var r,i=[k],u=[];return p(t)||(t=null),o.use=function(t){i.push(t)},o},mt=function(t){var e=this;this.map={},v(t,function(t,n){return e.append(n,t)})};mt.prototype.has=function(t){return null!==I(this.map,t)},mt.prototype.get=function(t){var e=this.map[I(this.map,t)];return e?e.join():null},mt.prototype.getAll=function(t){return this.map[I(this.map,t)]||[]},mt.prototype.set=function(t,e){this.map[q(I(this.map,t)||t)]=[i(e)]},mt.prototype.append=function(t,e){var n=this.map[I(this.map,t)];n?n.push(i(e)):this.set(t,e)},mt.prototype.delete=function(t){delete this.map[I(this.map,t)]},mt.prototype.deleteAll=function(){this.map={}},mt.prototype.forEach=function(t,e){var n=this;v(this.map,function(o,r){v(o,function(o){return t.call(e,o,r,n)})})};var yt=function(t,e){var n=e.url,o=e.headers,r=e.status,i=e.statusText;this.url=n,this.ok=r>=200&&r<300,this.status=r||0,this.statusText=i||"",this.headers=new mt(o),this.body=t,c(t)?this.bodyText=t:d(t)&&(this.bodyBlob=t,L(t)&&(this.bodyText=H(t)))};yt.prototype.blob=function(){return m(this.bodyBlob)},yt.prototype.text=function(){return m(this.bodyText)},yt.prototype.json=function(){return m(this.text(),function(t){return JSON.parse(t)})},Object.defineProperty(yt.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var vt=function(t){this.body=null,this.params={},Y(this,t,{method:a(t.method||"GET")}),this.headers instanceof mt||(this.headers=new mt(this.headers))};vt.prototype.getUrl=function(){return U(this)},vt.prototype.getBody=function(){return this.body},vt.prototype.respondWith=function(t,e){return new yt(t,Y(e||{},{url:this.getUrl()}))};var bt={Accept:"application/json, text/plain, */*"},gt={"Content-Type":"application/json;charset=utf-8"};return B.options={},B.headers={put:gt,post:gt,patch:gt,delete:gt,common:bt,custom:{}},B.interceptor={before:ct,method:ft,jsonp:at,json:ut,form:it,header:pt,cors:rt},B.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach(function(t){B[t]=function(e,n){return this(Y(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){B[t]=function(e,n,o){return this(Y(o||{},{url:e,method:t,body:n}))}}),M.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(D),D});
|
7
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueResource=e()}(this,function(){"use strict";function t(t){this.state=$,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function e(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function n(t){return t?t.replace(/^\s*|\s*$/g,""):""}function o(t){return t?t.toLowerCase():""}function r(t){return"string"==typeof t}function i(t){return"function"==typeof t}function s(t){return null!==t&&"object"==typeof t}function u(t){return s(t)&&Object.getPrototypeOf(t)==Object.prototype}function a(t,n,o){var r=e.resolve(t);return arguments.length<2?r:r.then(n,o)}function c(t,e,n){return n=n||{},i(n)&&(n=n.call(e)),p(t.bind({$vm:e,$options:n}),t,{$options:n})}function f(t,e){var n,o;if(H(t))for(n=0;n<t.length;n++)e.call(t[n],t[n],n);else if(s(t))for(o in t)S.call(t,o)&&e.call(t[o],t[o],o);return t}function p(t){return k.call(arguments,1).forEach(function(e){h(t,e,!0)}),t}function h(t,e,n){for(var o in e)n&&(u(e[o])||H(e[o]))?(u(e[o])&&!u(t[o])&&(t[o]={}),H(e[o])&&!H(t[o])&&(t[o]=[]),h(t[o],e[o],n)):void 0!==e[o]&&(t[o]=e[o])}function d(t,e,n){var o=function(t){var e=["+","#",".","/",";","?","&"],n=[];return{vars:n,expand:function(o){return t.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g,function(t,r,i){if(r){var s=null,u=[];if(-1!==e.indexOf(r.charAt(0))&&(s=r.charAt(0),r=r.substr(1)),r.split(/,/g).forEach(function(t){var e=/([^:\*]*)(?::(\d+)|(\*))?/.exec(t);u.push.apply(u,function(t,e,n,o){var r=t[n],i=[];if(l(r)&&""!==r)if("string"==typeof r||"number"==typeof r||"boolean"==typeof r)r=r.toString(),o&&"*"!==o&&(r=r.substring(0,parseInt(o,10))),i.push(y(e,r,m(e)?n:null));else if("*"===o)Array.isArray(r)?r.filter(l).forEach(function(t){i.push(y(e,t,m(e)?n:null))}):Object.keys(r).forEach(function(t){l(r[t])&&i.push(y(e,r[t],t))});else{var s=[];Array.isArray(r)?r.filter(l).forEach(function(t){s.push(y(e,t))}):Object.keys(r).forEach(function(t){l(r[t])&&(s.push(encodeURIComponent(t)),s.push(y(e,r[t].toString())))}),m(e)?i.push(encodeURIComponent(n)+"="+s.join(",")):0!==s.length&&i.push(s.join(","))}else";"===e?i.push(encodeURIComponent(n)):""!==r||"&"!==e&&"?"!==e?""===r&&i.push(""):i.push(encodeURIComponent(n)+"=");return i}(o,s,e[1],e[2]||e[3])),n.push(e[1])}),s&&"+"!==s){var a=",";return"?"===s?a="&":"#"!==s&&(a=s),(0!==u.length?s:"")+u.join(a)}return u.join(",")}return v(i)})}}}(t),r=o.expand(e);return n&&n.push.apply(n,o.vars),r}function l(t){return void 0!==t&&null!==t}function m(t){return";"===t||"&"===t||"?"===t}function y(t,e,n){return e="+"===t||"#"===t?v(e):encodeURIComponent(e),n?encodeURIComponent(n)+"="+e:e}function v(t){return t.split(/(%[0-9A-Fa-f]{2})/g).map(function(t){return/%[0-9A-Fa-f]/.test(t)||(t=encodeURI(t)),t}).join("")}function b(t,e){var n,o=this||{},s=t;return r(t)&&(s={url:t,params:e}),s=p({},b.options,o.$options,s),b.transforms.forEach(function(t){r(t)&&(t=b.transform[t]),i(t)&&(n=function(t,e,n){return function(o){return t.call(n,o,e)}}(t,n,o.$vm))}),n(s)}function g(t,e,n){var o,r=H(e),i=u(e);f(e,function(e,u){o=s(e)||H(e),n&&(u=n+"["+(i||o?u:"")+"]"),!n&&r?t.add(e.name,e.value):o?g(t,e,u):t.add(u,e)})}function w(t){return new e(function(e){var n=new XDomainRequest,o=function(o){var r=o.type,i=0;"load"===r?i=200:"error"===r&&(i=500),e(t.respondWith(n.responseText,{status:i}))};t.abort=function(){return n.abort()},n.open(t.method,t.getUrl()),t.timeout&&(n.timeout=t.timeout),n.onload=o,n.onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){},n.send(t.getBody())})}function T(t){return new e(function(e){var n,o,r=t.jsonp||"callback",i=t.jsonpCallback||"_jsonp"+Math.random().toString(36).substr(2),s=null;n=function(n){var r=n.type,u=0;"load"===r&&null!==s?u=200:"error"===r&&(u=500),u&&window[i]&&(delete window[i],document.body.removeChild(o)),e(t.respondWith(s,{status:u}))},window[i]=function(t){s=JSON.stringify(t)},t.abort=function(){n({type:"abort"})},t.params[r]=i,t.timeout&&setTimeout(t.abort,t.timeout),(o=document.createElement("script")).src=t.getUrl(),o.type="text/javascript",o.async=!0,o.onload=n,o.onerror=n,document.body.appendChild(o)})}function x(t){function n(n){return new e(function(e,c){function f(){i(o=r.pop())?o.call(t,n,p):(!function(t){"undefined"!=typeof console&&I&&console.warn("[VueResource warn]: "+t)}("Invalid interceptor of type "+typeof o+", must be a function"),p())}function p(n){if(i(n))u.unshift(n);else if(s(n))return u.forEach(function(e){n=a(n,function(n){return e.call(t,n)||n},c)}),void a(n,e,c);f()}f()},t)}var o,r=[j],u=[];return s(t)||(t=null),n.use=function(t){r.push(t)},n}function j(t,o){o((t.client||(q?function(t){return new e(function(e){var o=new XMLHttpRequest,r=function(r){var i=t.respondWith("response"in o?o.response:o.responseText,{status:1223===o.status?204:o.status,statusText:1223===o.status?"No Content":n(o.statusText)});f(n(o.getAllResponseHeaders()).split("\n"),function(t){i.headers.append(t.slice(0,t.indexOf(":")),t.slice(t.indexOf(":")+1))}),e(i)};t.abort=function(){return o.abort()},t.progress&&("GET"===t.method?o.addEventListener("progress",t.progress):/^(POST|PUT)$/i.test(t.method)&&o.upload.addEventListener("progress",t.progress)),o.open(t.method,t.getUrl(),!0),t.timeout&&(o.timeout=t.timeout),t.responseType&&"responseType"in o&&(o.responseType=t.responseType),(t.withCredentials||t.credentials)&&(o.withCredentials=!0),t.crossOrigin||t.headers.set("X-Requested-With","XMLHttpRequest"),t.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.onload=r,o.onabort=r,o.onerror=r,o.ontimeout=r,o.send(t.getBody())})}:function(t){var o=require("got");return new e(function(e){var r,i=t.getUrl(),s=t.getBody(),u=t.method,a={};t.headers.forEach(function(t,e){a[e]=t}),o(i,{body:s,method:u,headers:a}).then(r=function(o){var r=t.respondWith(o.body,{status:o.statusCode,statusText:n(o.statusMessage)});f(o.headers,function(t,e){r.headers.set(e,t)}),e(r)},function(t){return r(t.response)})})}))(t))}function E(t,e){return Object.keys(t).reduce(function(t,n){return o(e)===o(n)?n:t},null)}function O(t){var n=this||{},o=x(n.$vm);return function(t){k.call(arguments,1).forEach(function(e){for(var n in e)void 0===t[n]&&(t[n]=e[n])})}(t||{},n.$options,O.options),O.interceptors.forEach(function(t){r(t)&&(t=O.interceptor[t]),i(t)&&o.use(t)}),o(new D(t)).then(function(t){return t.ok?t:e.reject(t)},function(t){return t instanceof Error&&function(t){"undefined"!=typeof console&&console.error(t)}(t),e.reject(t)})}function P(t,e,n,o){var r=this||{},i={};return n=L({},P.actions,n),f(n,function(n,s){n=p({url:t,params:L({},e)},o,n),i[s]=function(){return(r.$http||O)(function(t,e){var n,o=L({},t),r={};switch(e.length){case 2:r=e[0],n=e[1];break;case 1:/^(POST|PUT|PATCH)$/i.test(o.method)?n=e[0]:r=e[0];break;case 0:break;default:throw"Expected up to 2 arguments [params, body], got "+e.length+" arguments"}return o.body=n,o.params=L({},o.params,r),o}(n,arguments))}}),i}function C(t){C.installed||(!function(t){var e=t.config,n=t.nextTick;A=n,I=e.debug||!e.silent}(t),t.url=b,t.http=O,t.resource=P,t.Promise=e,Object.defineProperties(t.prototype,{$url:{get:function(){return c(t.url,this,this.$options.url)}},$http:{get:function(){return c(t.http,this,this.$options.http)}},$resource:{get:function(){return t.resource.bind(this)}},$promise:{get:function(){var e=this;return function(n){return new t.Promise(n,e)}}}}))}var $=2;t.reject=function(e){return new t(function(t,n){n(e)})},t.resolve=function(e){return new t(function(t,n){t(e)})},t.all=function(e){return new t(function(n,o){function r(t){return function(o){s[t]=o,(i+=1)===e.length&&n(s)}}var i=0,s=[];0===e.length&&n(s);for(var u=0;u<e.length;u+=1)t.resolve(e[u]).then(r(u),o)})},t.race=function(e){return new t(function(n,o){for(var r=0;r<e.length;r+=1)t.resolve(e[r]).then(n,o)})};var U=t.prototype;U.resolve=function(t){var e=this;if(e.state===$){if(t===e)throw new TypeError("Promise settled with itself.");var n=!1;try{var o=t&&t.then;if(null!==t&&"object"==typeof t&&"function"==typeof o)return void o.call(t,function(t){n||e.resolve(t),n=!0},function(t){n||e.reject(t),n=!0})}catch(t){return void(n||e.reject(t))}e.state=0,e.value=t,e.notify()}},U.reject=function(t){if(this.state===$){if(t===this)throw new TypeError("Promise settled with itself.");this.state=1,this.value=t,this.notify()}},U.notify=function(){var t=this;!function(t,e){A(t,e)}(function(){if(t.state!==$)for(;t.deferred.length;){var e=t.deferred.shift(),n=e[0],o=e[1],r=e[2],i=e[3];try{0===t.state?r("function"==typeof n?n.call(void 0,t.value):t.value):1===t.state&&("function"==typeof o?r(o.call(void 0,t.value)):i(t.value))}catch(t){i(t)}}})},U.then=function(e,n){var o=this;return new t(function(t,r){o.deferred.push([e,n,t,r]),o.notify()})},U.catch=function(t){return this.then(void 0,t)},"undefined"==typeof Promise&&(window.Promise=t),e.all=function(t,n){return new e(Promise.all(t),n)},e.resolve=function(t,n){return new e(Promise.resolve(t),n)},e.reject=function(t,n){return new e(Promise.reject(t),n)},e.race=function(t,n){return new e(Promise.race(t),n)};var R=e.prototype;R.bind=function(t){return this.context=t,this},R.then=function(t,n){return t&&t.bind&&this.context&&(t=t.bind(this.context)),n&&n.bind&&this.context&&(n=n.bind(this.context)),new e(this.promise.then(t,n),this.context)},R.catch=function(t){return t&&t.bind&&this.context&&(t=t.bind(this.context)),new e(this.promise.catch(t),this.context)},R.finally=function(t){return this.then(function(e){return t.call(this),e},function(e){return t.call(this),Promise.reject(e)})};var A,S={}.hasOwnProperty,k=[].slice,I=!1,q="undefined"!=typeof window,H=Array.isArray,L=Object.assign||function(t){return k.call(arguments,1).forEach(function(e){h(t,e)}),t};b.options={url:"",root:null,params:{}},b.transform={template:function(t){var e=[],n=d(t.url,t.params,e);return e.forEach(function(e){delete t.params[e]}),n},query:function(t,e){var n=Object.keys(b.options.params),o={},r=e(t);return f(t.params,function(t,e){-1===n.indexOf(e)&&(o[e]=t)}),(o=b.params(o))&&(r+=(-1==r.indexOf("?")?"?":"&")+o),r},root:function(t,e){var n=e(t);return r(t.root)&&!/^(https?:)?\//.test(n)&&(n=function(t,e){return t&&void 0===e?t.replace(/\s+$/,""):t&&e?t.replace(new RegExp("["+e+"]+$"),""):t}(t.root,"/")+"/"+n),n}},b.transforms=["template","query","root"],b.params=function(t){var e=[],n=encodeURIComponent;return e.add=function(t,e){i(e)&&(e=e()),null===e&&(e=""),this.push(n(t)+"="+n(e))},g(e,t),e.join("&").replace(/%20/g,"+")},b.parse=function(t){var e=document.createElement("a");return document.documentMode&&(e.href=t,t=e.href),e.href=t,{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",port:e.port,host:e.host,hostname:e.hostname,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):""}};var B=q&&"withCredentials"in new XMLHttpRequest,M=function(t){var e=this;this.map={},f(t,function(t,n){return e.append(n,t)})};M.prototype.has=function(t){return null!==E(this.map,t)},M.prototype.get=function(t){var e=this.map[E(this.map,t)];return e?e.join():null},M.prototype.getAll=function(t){return this.map[E(this.map,t)]||[]},M.prototype.set=function(t,e){this.map[function(t){if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return n(t)}(E(this.map,t)||t)]=[n(e)]},M.prototype.append=function(t,e){var o=this.map[E(this.map,t)];o?o.push(n(e)):this.set(t,e)},M.prototype.delete=function(t){delete this.map[E(this.map,t)]},M.prototype.deleteAll=function(){this.map={}},M.prototype.forEach=function(t,e){var n=this;f(this.map,function(o,r){f(o,function(o){return t.call(e,o,r,n)})})};var N=function(t,n){var o=n.url,i=n.headers,s=n.status,u=n.statusText;this.url=o,this.ok=s>=200&&s<300,this.status=s||0,this.statusText=u||"",this.headers=new M(i),this.body=t,r(t)?this.bodyText=t:function(t){return"undefined"!=typeof Blob&&t instanceof Blob}(t)&&(this.bodyBlob=t,function(t){return 0===t.type.indexOf("text")||-1!==t.type.indexOf("json")}(t)&&(this.bodyText=function(t){return new e(function(e){var n=new FileReader;n.readAsText(t),n.onload=function(){e(n.result)}})}(t)))};N.prototype.blob=function(){return a(this.bodyBlob)},N.prototype.text=function(){return a(this.bodyText)},N.prototype.json=function(){return a(this.text(),function(t){return JSON.parse(t)})},Object.defineProperty(N.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var D=function(t){this.body=null,this.params={},L(this,t,{method:function(t){return t?t.toUpperCase():""}(t.method||"GET")}),this.headers instanceof M||(this.headers=new M(this.headers))};D.prototype.getUrl=function(){return b(this)},D.prototype.getBody=function(){return this.body},D.prototype.respondWith=function(t,e){return new N(t,L(e||{},{url:this.getUrl()}))};var J={"Content-Type":"application/json;charset=utf-8"};return O.options={},O.headers={put:J,post:J,patch:J,delete:J,common:{Accept:"application/json, text/plain, */*"},custom:{}},O.interceptor={before:function(t,e){i(t.before)&&t.before.call(this,t),e()},method:function(t,e){t.emulateHTTP&&/^(PUT|PATCH|DELETE)$/i.test(t.method)&&(t.headers.set("X-HTTP-Method-Override",t.method),t.method="POST"),e()},jsonp:function(t,e){"JSONP"==t.method&&(t.client=T),e()},json:function(t,e){var n=t.headers.get("Content-Type")||"";s(t.body)&&0===n.indexOf("application/json")&&(t.body=JSON.stringify(t.body)),e(function(t){return t.bodyText?a(t.text(),function(e){if(0===(n=t.headers.get("Content-Type")||"").indexOf("application/json")||function(t){var e=t.match(/^\s*(\[|\{)/);return e&&{"[":/]\s*$/,"{":/}\s*$/}[e[1]].test(t)}(e))try{t.body=JSON.parse(e)}catch(e){t.body=null}else t.body=e;return t}):t})},form:function(t,e){!function(t){return"undefined"!=typeof FormData&&t instanceof FormData}(t.body)?s(t.body)&&t.emulateJSON&&(t.body=b.params(t.body),t.headers.set("Content-Type","application/x-www-form-urlencoded")):t.headers.delete("Content-Type"),e()},header:function(t,e){f(L({},O.headers.common,t.crossOrigin?{}:O.headers.custom,O.headers[o(t.method)]),function(e,n){t.headers.has(n)||t.headers.set(n,e)}),e()},cors:function(t,e){if(q){var n=b.parse(location.href),o=b.parse(t.getUrl());o.protocol===n.protocol&&o.host===n.host||(t.crossOrigin=!0,t.emulateHTTP=!1,B||(t.client=w))}e()}},O.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach(function(t){O[t]=function(e,n){return this(L(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){O[t]=function(e,n,o){return this(L(o||{},{url:e,method:t,body:n}))}}),P.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(C),C});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* vue-router
|
2
|
+
* vue-router v3.0.1
|
3
3
|
* (c) 2017 Evan You
|
4
4
|
* @license MIT
|
5
5
|
*/
|
@@ -93,14 +93,26 @@ var View = {
|
|
93
93
|
}
|
94
94
|
}
|
95
95
|
|
96
|
-
// also
|
96
|
+
// also register instance in prepatch hook
|
97
97
|
// in case the same component instance is reused across different routes
|
98
98
|
;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
|
99
99
|
matched.instances[name] = vnode.componentInstance;
|
100
100
|
};
|
101
101
|
|
102
102
|
// resolve props
|
103
|
-
data.props = resolveProps(route, matched.props && matched.props[name]);
|
103
|
+
var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
|
104
|
+
if (propsToPass) {
|
105
|
+
// clone to prevent mutation
|
106
|
+
propsToPass = data.props = extend({}, propsToPass);
|
107
|
+
// pass non-declared props as attrs
|
108
|
+
var attrs = data.attrs = data.attrs || {};
|
109
|
+
for (var key in propsToPass) {
|
110
|
+
if (!component.props || !(key in component.props)) {
|
111
|
+
attrs[key] = propsToPass[key];
|
112
|
+
delete propsToPass[key];
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
104
116
|
|
105
117
|
return h(component, data, children)
|
106
118
|
}
|
@@ -127,6 +139,13 @@ function resolveProps (route, config) {
|
|
127
139
|
}
|
128
140
|
}
|
129
141
|
|
142
|
+
function extend (to, from) {
|
143
|
+
for (var key in from) {
|
144
|
+
to[key] = from[key];
|
145
|
+
}
|
146
|
+
return to
|
147
|
+
}
|
148
|
+
|
130
149
|
/* */
|
131
150
|
|
132
151
|
var encodeReserveRE = /[!'()*]/g;
|
@@ -158,8 +177,7 @@ function resolveQuery (
|
|
158
177
|
parsedQuery = {};
|
159
178
|
}
|
160
179
|
for (var key in extraQuery) {
|
161
|
-
|
162
|
-
parsedQuery[key] = Array.isArray(val) ? val.slice() : val;
|
180
|
+
parsedQuery[key] = extraQuery[key];
|
163
181
|
}
|
164
182
|
return parsedQuery
|
165
183
|
}
|
@@ -236,12 +254,18 @@ function createRoute (
|
|
236
254
|
router
|
237
255
|
) {
|
238
256
|
var stringifyQuery$$1 = router && router.options.stringifyQuery;
|
257
|
+
|
258
|
+
var query = location.query || {};
|
259
|
+
try {
|
260
|
+
query = clone(query);
|
261
|
+
} catch (e) {}
|
262
|
+
|
239
263
|
var route = {
|
240
264
|
name: location.name || (record && record.name),
|
241
265
|
meta: (record && record.meta) || {},
|
242
266
|
path: location.path || '/',
|
243
267
|
hash: location.hash || '',
|
244
|
-
query:
|
268
|
+
query: query,
|
245
269
|
params: location.params || {},
|
246
270
|
fullPath: getFullPath(location, stringifyQuery$$1),
|
247
271
|
matched: record ? formatMatch(record) : []
|
@@ -252,6 +276,20 @@ function createRoute (
|
|
252
276
|
return Object.freeze(route)
|
253
277
|
}
|
254
278
|
|
279
|
+
function clone (value) {
|
280
|
+
if (Array.isArray(value)) {
|
281
|
+
return value.map(clone)
|
282
|
+
} else if (value && typeof value === 'object') {
|
283
|
+
var res = {};
|
284
|
+
for (var key in value) {
|
285
|
+
res[key] = clone(value[key]);
|
286
|
+
}
|
287
|
+
return res
|
288
|
+
} else {
|
289
|
+
return value
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
255
293
|
// the starting route that represents the initial state
|
256
294
|
var START = createRoute(null, {
|
257
295
|
path: '/'
|
@@ -305,6 +343,8 @@ function isObjectEqual (a, b) {
|
|
305
343
|
if ( a === void 0 ) a = {};
|
306
344
|
if ( b === void 0 ) b = {};
|
307
345
|
|
346
|
+
// handle null value #1566
|
347
|
+
if (!a || !b) { return a === b }
|
308
348
|
var aKeys = Object.keys(a);
|
309
349
|
var bKeys = Object.keys(b);
|
310
350
|
if (aKeys.length !== bKeys.length) {
|
@@ -484,7 +524,7 @@ function findAnchor (children) {
|
|
484
524
|
var _Vue;
|
485
525
|
|
486
526
|
function install (Vue) {
|
487
|
-
if (install.installed) { return }
|
527
|
+
if (install.installed && _Vue === Vue) { return }
|
488
528
|
install.installed = true;
|
489
529
|
|
490
530
|
_Vue = Vue;
|
@@ -606,14 +646,14 @@ function cleanPath (path) {
|
|
606
646
|
return path.replace(/\/\//g, '/')
|
607
647
|
}
|
608
648
|
|
609
|
-
var
|
649
|
+
var isarray = Array.isArray || function (arr) {
|
610
650
|
return Object.prototype.toString.call(arr) == '[object Array]';
|
611
651
|
};
|
612
652
|
|
613
653
|
/**
|
614
654
|
* Expose `pathToRegexp`.
|
615
655
|
*/
|
616
|
-
var
|
656
|
+
var pathToRegexp_1 = pathToRegexp;
|
617
657
|
var parse_1 = parse;
|
618
658
|
var compile_1 = compile;
|
619
659
|
var tokensToFunction_1 = tokensToFunction;
|
@@ -790,7 +830,7 @@ function tokensToFunction (tokens) {
|
|
790
830
|
}
|
791
831
|
}
|
792
832
|
|
793
|
-
if (
|
833
|
+
if (isarray(value)) {
|
794
834
|
if (!token.repeat) {
|
795
835
|
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
|
796
836
|
}
|
@@ -941,7 +981,7 @@ function stringToRegexp (path, keys, options) {
|
|
941
981
|
* @return {!RegExp}
|
942
982
|
*/
|
943
983
|
function tokensToRegExp (tokens, keys, options) {
|
944
|
-
if (!
|
984
|
+
if (!isarray(keys)) {
|
945
985
|
options = /** @type {!Object} */ (keys || options);
|
946
986
|
keys = [];
|
947
987
|
}
|
@@ -1017,7 +1057,7 @@ function tokensToRegExp (tokens, keys, options) {
|
|
1017
1057
|
* @return {!RegExp}
|
1018
1058
|
*/
|
1019
1059
|
function pathToRegexp (path, keys, options) {
|
1020
|
-
if (!
|
1060
|
+
if (!isarray(keys)) {
|
1021
1061
|
options = /** @type {!Object} */ (keys || options);
|
1022
1062
|
keys = [];
|
1023
1063
|
}
|
@@ -1028,20 +1068,21 @@ function pathToRegexp (path, keys, options) {
|
|
1028
1068
|
return regexpToRegexp(path, /** @type {!Array} */ (keys))
|
1029
1069
|
}
|
1030
1070
|
|
1031
|
-
if (
|
1071
|
+
if (isarray(path)) {
|
1032
1072
|
return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
|
1033
1073
|
}
|
1034
1074
|
|
1035
1075
|
return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
|
1036
1076
|
}
|
1037
1077
|
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1078
|
+
pathToRegexp_1.parse = parse_1;
|
1079
|
+
pathToRegexp_1.compile = compile_1;
|
1080
|
+
pathToRegexp_1.tokensToFunction = tokensToFunction_1;
|
1081
|
+
pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
|
1042
1082
|
|
1043
1083
|
/* */
|
1044
1084
|
|
1085
|
+
// $flow-disable-line
|
1045
1086
|
var regexpCompileCache = Object.create(null);
|
1046
1087
|
|
1047
1088
|
function fillParams (
|
@@ -1052,7 +1093,7 @@ function fillParams (
|
|
1052
1093
|
try {
|
1053
1094
|
var filler =
|
1054
1095
|
regexpCompileCache[path] ||
|
1055
|
-
(regexpCompileCache[path] =
|
1096
|
+
(regexpCompileCache[path] = pathToRegexp_1.compile(path));
|
1056
1097
|
return filler(params || {}, { pretty: true })
|
1057
1098
|
} catch (e) {
|
1058
1099
|
{
|
@@ -1072,7 +1113,9 @@ function createRouteMap (
|
|
1072
1113
|
) {
|
1073
1114
|
// the path list is used to control path matching priority
|
1074
1115
|
var pathList = oldPathList || [];
|
1116
|
+
// $flow-disable-line
|
1075
1117
|
var pathMap = oldPathMap || Object.create(null);
|
1118
|
+
// $flow-disable-line
|
1076
1119
|
var nameMap = oldNameMap || Object.create(null);
|
1077
1120
|
|
1078
1121
|
routes.forEach(function (route) {
|
@@ -1114,8 +1157,12 @@ function addRouteRecord (
|
|
1114
1157
|
);
|
1115
1158
|
}
|
1116
1159
|
|
1117
|
-
var normalizedPath = normalizePath(path, parent);
|
1118
1160
|
var pathToRegexpOptions = route.pathToRegexpOptions || {};
|
1161
|
+
var normalizedPath = normalizePath(
|
1162
|
+
path,
|
1163
|
+
parent,
|
1164
|
+
pathToRegexpOptions.strict
|
1165
|
+
);
|
1119
1166
|
|
1120
1167
|
if (typeof route.caseSensitive === 'boolean') {
|
1121
1168
|
pathToRegexpOptions.sensitive = route.caseSensitive;
|
@@ -1203,9 +1250,9 @@ function addRouteRecord (
|
|
1203
1250
|
}
|
1204
1251
|
|
1205
1252
|
function compileRouteRegex (path, pathToRegexpOptions) {
|
1206
|
-
var regex =
|
1253
|
+
var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
|
1207
1254
|
{
|
1208
|
-
var keys =
|
1255
|
+
var keys = Object.create(null);
|
1209
1256
|
regex.keys.forEach(function (key) {
|
1210
1257
|
warn(!keys[key.name], ("Duplicate param keys in route with path: \"" + path + "\""));
|
1211
1258
|
keys[key.name] = true;
|
@@ -1214,8 +1261,8 @@ function compileRouteRegex (path, pathToRegexpOptions) {
|
|
1214
1261
|
return regex
|
1215
1262
|
}
|
1216
1263
|
|
1217
|
-
function normalizePath (path, parent) {
|
1218
|
-
path = path.replace(/\/$/, '');
|
1264
|
+
function normalizePath (path, parent, strict) {
|
1265
|
+
if (!strict) { path = path.replace(/\/$/, ''); }
|
1219
1266
|
if (path[0] === '/') { return path }
|
1220
1267
|
if (parent == null) { return path }
|
1221
1268
|
return cleanPath(((parent.path) + "/" + path))
|
@@ -1487,6 +1534,8 @@ function resolveRecordPath (path, record) {
|
|
1487
1534
|
var positionStore = Object.create(null);
|
1488
1535
|
|
1489
1536
|
function setupScroll () {
|
1537
|
+
// Fix for #1585 for Firefox
|
1538
|
+
window.history.replaceState({ key: getStateKey() }, '');
|
1490
1539
|
window.addEventListener('popstate', function (e) {
|
1491
1540
|
saveScrollPosition();
|
1492
1541
|
if (e.state && e.state.key) {
|
@@ -1518,25 +1567,21 @@ function handleScroll (
|
|
1518
1567
|
router.app.$nextTick(function () {
|
1519
1568
|
var position = getScrollPosition();
|
1520
1569
|
var shouldScroll = behavior(to, from, isPop ? position : null);
|
1570
|
+
|
1521
1571
|
if (!shouldScroll) {
|
1522
1572
|
return
|
1523
1573
|
}
|
1524
|
-
var isObject = typeof shouldScroll === 'object';
|
1525
|
-
if (isObject && typeof shouldScroll.selector === 'string') {
|
1526
|
-
var el = document.querySelector(shouldScroll.selector);
|
1527
|
-
if (el) {
|
1528
|
-
var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
|
1529
|
-
offset = normalizeOffset(offset);
|
1530
|
-
position = getElementPosition(el, offset);
|
1531
|
-
} else if (isValidPosition(shouldScroll)) {
|
1532
|
-
position = normalizePosition(shouldScroll);
|
1533
|
-
}
|
1534
|
-
} else if (isObject && isValidPosition(shouldScroll)) {
|
1535
|
-
position = normalizePosition(shouldScroll);
|
1536
|
-
}
|
1537
1574
|
|
1538
|
-
if (
|
1539
|
-
|
1575
|
+
if (typeof shouldScroll.then === 'function') {
|
1576
|
+
shouldScroll.then(function (shouldScroll) {
|
1577
|
+
scrollToPosition((shouldScroll), position);
|
1578
|
+
}).catch(function (err) {
|
1579
|
+
{
|
1580
|
+
assert(false, err.toString());
|
1581
|
+
}
|
1582
|
+
});
|
1583
|
+
} else {
|
1584
|
+
scrollToPosition(shouldScroll, position);
|
1540
1585
|
}
|
1541
1586
|
});
|
1542
1587
|
}
|
@@ -1590,6 +1635,26 @@ function isNumber (v) {
|
|
1590
1635
|
return typeof v === 'number'
|
1591
1636
|
}
|
1592
1637
|
|
1638
|
+
function scrollToPosition (shouldScroll, position) {
|
1639
|
+
var isObject = typeof shouldScroll === 'object';
|
1640
|
+
if (isObject && typeof shouldScroll.selector === 'string') {
|
1641
|
+
var el = document.querySelector(shouldScroll.selector);
|
1642
|
+
if (el) {
|
1643
|
+
var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
|
1644
|
+
offset = normalizeOffset(offset);
|
1645
|
+
position = getElementPosition(el, offset);
|
1646
|
+
} else if (isValidPosition(shouldScroll)) {
|
1647
|
+
position = normalizePosition(shouldScroll);
|
1648
|
+
}
|
1649
|
+
} else if (isObject && isValidPosition(shouldScroll)) {
|
1650
|
+
position = normalizePosition(shouldScroll);
|
1651
|
+
}
|
1652
|
+
|
1653
|
+
if (position) {
|
1654
|
+
window.scrollTo(position.x, position.y);
|
1655
|
+
}
|
1656
|
+
}
|
1657
|
+
|
1593
1658
|
/* */
|
1594
1659
|
|
1595
1660
|
var supportsPushState = inBrowser && (function () {
|
@@ -1685,7 +1750,7 @@ function resolveAsyncComponents (matched) {
|
|
1685
1750
|
pending++;
|
1686
1751
|
|
1687
1752
|
var resolve = once(function (resolvedDef) {
|
1688
|
-
if (resolvedDef
|
1753
|
+
if (isESModule(resolvedDef)) {
|
1689
1754
|
resolvedDef = resolvedDef.default;
|
1690
1755
|
}
|
1691
1756
|
// save resolved on async factory in case it's used elsewhere
|
@@ -1751,6 +1816,14 @@ function flatten (arr) {
|
|
1751
1816
|
return Array.prototype.concat.apply([], arr)
|
1752
1817
|
}
|
1753
1818
|
|
1819
|
+
var hasSymbol =
|
1820
|
+
typeof Symbol === 'function' &&
|
1821
|
+
typeof Symbol.toStringTag === 'symbol';
|
1822
|
+
|
1823
|
+
function isESModule (obj) {
|
1824
|
+
return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
|
1825
|
+
}
|
1826
|
+
|
1754
1827
|
// in Webpack 2, require.ensure now also returns a Promise
|
1755
1828
|
// so the resolve/reject functions may get called an extra time
|
1756
1829
|
// if the user uses an arrow function shorthand that happens to
|
@@ -2079,9 +2152,18 @@ var HTML5History = (function (History$$1) {
|
|
2079
2152
|
setupScroll();
|
2080
2153
|
}
|
2081
2154
|
|
2155
|
+
var initLocation = getLocation(this.base);
|
2082
2156
|
window.addEventListener('popstate', function (e) {
|
2083
2157
|
var current = this$1.current;
|
2084
|
-
|
2158
|
+
|
2159
|
+
// Avoiding first `popstate` event dispatched in some browsers but first
|
2160
|
+
// history route not updated since async guard at the same time.
|
2161
|
+
var location = getLocation(this$1.base);
|
2162
|
+
if (this$1.current === START && location === initLocation) {
|
2163
|
+
return
|
2164
|
+
}
|
2165
|
+
|
2166
|
+
this$1.transitionTo(location, function (route) {
|
2085
2167
|
if (expectScroll) {
|
2086
2168
|
handleScroll(router, route, current, true);
|
2087
2169
|
}
|
@@ -2165,26 +2247,50 @@ var HashHistory = (function (History$$1) {
|
|
2165
2247
|
HashHistory.prototype.setupListeners = function setupListeners () {
|
2166
2248
|
var this$1 = this;
|
2167
2249
|
|
2168
|
-
|
2250
|
+
var router = this.router;
|
2251
|
+
var expectScroll = router.options.scrollBehavior;
|
2252
|
+
var supportsScroll = supportsPushState && expectScroll;
|
2253
|
+
|
2254
|
+
if (supportsScroll) {
|
2255
|
+
setupScroll();
|
2256
|
+
}
|
2257
|
+
|
2258
|
+
window.addEventListener(supportsPushState ? 'popstate' : 'hashchange', function () {
|
2259
|
+
var current = this$1.current;
|
2169
2260
|
if (!ensureSlash()) {
|
2170
2261
|
return
|
2171
2262
|
}
|
2172
2263
|
this$1.transitionTo(getHash(), function (route) {
|
2173
|
-
|
2264
|
+
if (supportsScroll) {
|
2265
|
+
handleScroll(this$1.router, route, current, true);
|
2266
|
+
}
|
2267
|
+
if (!supportsPushState) {
|
2268
|
+
replaceHash(route.fullPath);
|
2269
|
+
}
|
2174
2270
|
});
|
2175
2271
|
});
|
2176
2272
|
};
|
2177
2273
|
|
2178
2274
|
HashHistory.prototype.push = function push (location, onComplete, onAbort) {
|
2275
|
+
var this$1 = this;
|
2276
|
+
|
2277
|
+
var ref = this;
|
2278
|
+
var fromRoute = ref.current;
|
2179
2279
|
this.transitionTo(location, function (route) {
|
2180
2280
|
pushHash(route.fullPath);
|
2281
|
+
handleScroll(this$1.router, route, fromRoute, false);
|
2181
2282
|
onComplete && onComplete(route);
|
2182
2283
|
}, onAbort);
|
2183
2284
|
};
|
2184
2285
|
|
2185
2286
|
HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
|
2287
|
+
var this$1 = this;
|
2288
|
+
|
2289
|
+
var ref = this;
|
2290
|
+
var fromRoute = ref.current;
|
2186
2291
|
this.transitionTo(location, function (route) {
|
2187
2292
|
replaceHash(route.fullPath);
|
2293
|
+
handleScroll(this$1.router, route, fromRoute, false);
|
2188
2294
|
onComplete && onComplete(route);
|
2189
2295
|
}, onAbort);
|
2190
2296
|
};
|
@@ -2234,15 +2340,27 @@ function getHash () {
|
|
2234
2340
|
return index === -1 ? '' : href.slice(index + 1)
|
2235
2341
|
}
|
2236
2342
|
|
2343
|
+
function getUrl (path) {
|
2344
|
+
var href = window.location.href;
|
2345
|
+
var i = href.indexOf('#');
|
2346
|
+
var base = i >= 0 ? href.slice(0, i) : href;
|
2347
|
+
return (base + "#" + path)
|
2348
|
+
}
|
2349
|
+
|
2237
2350
|
function pushHash (path) {
|
2238
|
-
|
2351
|
+
if (supportsPushState) {
|
2352
|
+
pushState(getUrl(path));
|
2353
|
+
} else {
|
2354
|
+
window.location.hash = path;
|
2355
|
+
}
|
2239
2356
|
}
|
2240
2357
|
|
2241
2358
|
function replaceHash (path) {
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2359
|
+
if (supportsPushState) {
|
2360
|
+
replaceState(getUrl(path));
|
2361
|
+
} else {
|
2362
|
+
window.location.replace(getUrl(path));
|
2363
|
+
}
|
2246
2364
|
}
|
2247
2365
|
|
2248
2366
|
/* */
|
@@ -2344,7 +2462,7 @@ var VueRouter = function VueRouter (options) {
|
|
2344
2462
|
}
|
2345
2463
|
};
|
2346
2464
|
|
2347
|
-
var prototypeAccessors = { currentRoute: {} };
|
2465
|
+
var prototypeAccessors = { currentRoute: { configurable: true } };
|
2348
2466
|
|
2349
2467
|
VueRouter.prototype.match = function match (
|
2350
2468
|
raw,
|
@@ -2502,7 +2620,7 @@ function createHref (base, fullPath, mode) {
|
|
2502
2620
|
}
|
2503
2621
|
|
2504
2622
|
VueRouter.install = install;
|
2505
|
-
VueRouter.version = '
|
2623
|
+
VueRouter.version = '3.0.1';
|
2506
2624
|
|
2507
2625
|
if (inBrowser && window.Vue) {
|
2508
2626
|
window.Vue.use(VueRouter);
|