vuejs 1.0.25 → 1.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/vuejs/version.rb +1 -1
- data/vendor/assets/javascripts/vue-resource.js +1136 -1422
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68fd7b450826fa3f0fcb277942086fb1f8aa67e1
|
4
|
+
data.tar.gz: 720b4b56d10b9dc7baa772a835e8b6941bea379d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da22388175330dda8df7daceab3561d0d34e8774cb9e3622a993ba57a32332bea77302fff2dc5dffc8319d92e90690b33c2f59f689d3f9272bf5b31f317f064c
|
7
|
+
data.tar.gz: 421c595d297b717a6d891134214ea1f831b27aa9bbb9ef8b7d11277b9e4a317459b5cb1b660fa89b6e7e5c1db208a66ebfee2e28e4b76ecf22f0103ba638b69b
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Vuejs ships with the latest [Vue.js + router + resource](http://vuejs.org/) and integrate with Rails' asset pipeline. Vue.js is created by Evan You.
|
4
4
|
|
5
|
-
The current version is Vue.js (v1.0.24) + vue-router (v0.7.13) + vue-resource (v0.7.
|
5
|
+
The current version is Vue.js (v1.0.24) + vue-router (v0.7.13) + vue-resource (v0.7.4)
|
6
6
|
|
7
7
|
> Reactive Components for Modern Web Interfaces
|
8
8
|
|
data/lib/vuejs/version.rb
CHANGED
@@ -1,1668 +1,1382 @@
|
|
1
|
-
|
2
|
-
* vue-resource v0.7.
|
1
|
+
/*!
|
2
|
+
* vue-resource v0.7.4
|
3
3
|
* https://github.com/vuejs/vue-resource
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
6
6
|
|
7
|
-
(function
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
else if(typeof exports === 'object')
|
13
|
-
exports["VueResource"] = factory();
|
14
|
-
else
|
15
|
-
root["VueResource"] = factory();
|
16
|
-
})(this, function() {
|
17
|
-
return /******/ (function(modules) { // webpackBootstrap
|
18
|
-
/******/ // The module cache
|
19
|
-
/******/ var installedModules = {};
|
20
|
-
|
21
|
-
/******/ // The require function
|
22
|
-
/******/ function __webpack_require__(moduleId) {
|
23
|
-
|
24
|
-
/******/ // Check if module is in cache
|
25
|
-
/******/ if(installedModules[moduleId])
|
26
|
-
/******/ return installedModules[moduleId].exports;
|
27
|
-
|
28
|
-
/******/ // Create a new module (and put it into the cache)
|
29
|
-
/******/ var module = installedModules[moduleId] = {
|
30
|
-
/******/ exports: {},
|
31
|
-
/******/ id: moduleId,
|
32
|
-
/******/ loaded: false
|
33
|
-
/******/ };
|
34
|
-
|
35
|
-
/******/ // Execute the module function
|
36
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
37
|
-
|
38
|
-
/******/ // Flag the module as loaded
|
39
|
-
/******/ module.loaded = true;
|
40
|
-
|
41
|
-
/******/ // Return the exports of the module
|
42
|
-
/******/ return module.exports;
|
43
|
-
/******/ }
|
44
|
-
|
45
|
-
|
46
|
-
/******/ // expose the modules object (__webpack_modules__)
|
47
|
-
/******/ __webpack_require__.m = modules;
|
48
|
-
|
49
|
-
/******/ // expose the module cache
|
50
|
-
/******/ __webpack_require__.c = installedModules;
|
51
|
-
|
52
|
-
/******/ // __webpack_public_path__
|
53
|
-
/******/ __webpack_require__.p = "";
|
54
|
-
|
55
|
-
/******/ // Load entry module and return exports
|
56
|
-
/******/ return __webpack_require__(0);
|
57
|
-
/******/ })
|
58
|
-
/************************************************************************/
|
59
|
-
/******/ ([
|
60
|
-
/* 0 */
|
61
|
-
/***/ function(module, exports, __webpack_require__) {
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Install plugin.
|
65
|
-
*/
|
66
|
-
|
67
|
-
function plugin(Vue) {
|
68
|
-
|
69
|
-
if (plugin.installed) {
|
70
|
-
return;
|
71
|
-
}
|
72
|
-
|
73
|
-
var _ = __webpack_require__(1);
|
74
|
-
|
75
|
-
_.config = Vue.config;
|
76
|
-
_.warning = Vue.util.warn;
|
77
|
-
_.nextTick = Vue.util.nextTick;
|
7
|
+
(function (global, factory) {
|
8
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
9
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
10
|
+
(global.VueResource = factory());
|
11
|
+
}(this, function () { 'use strict';
|
78
12
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
13
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
14
|
+
return typeof obj;
|
15
|
+
} : function (obj) {
|
16
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
17
|
+
};
|
83
18
|
|
84
|
-
|
19
|
+
/**
|
20
|
+
* Utility functions.
|
21
|
+
*/
|
85
22
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
23
|
+
var util = {};
|
24
|
+
var config = {};
|
25
|
+
var array = [];
|
26
|
+
var console = window.console;
|
27
|
+
function Util (Vue) {
|
28
|
+
util = Vue.util;
|
29
|
+
config = Vue.config;
|
30
|
+
}
|
91
31
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
32
|
+
var isArray = Array.isArray;
|
33
|
+
|
34
|
+
function warn(msg) {
|
35
|
+
if (console && util.warn && (!config.silent || config.debug)) {
|
36
|
+
console.warn('[VueResource warn]: ' + msg);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
function error(msg) {
|
41
|
+
if (console) {
|
42
|
+
console.error(msg);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
function nextTick(cb, ctx) {
|
47
|
+
return util.nextTick(cb, ctx);
|
48
|
+
}
|
49
|
+
|
50
|
+
function trim(str) {
|
51
|
+
return str.replace(/^\s*|\s*$/g, '');
|
52
|
+
}
|
53
|
+
|
54
|
+
function toLower(str) {
|
55
|
+
return str ? str.toLowerCase() : '';
|
56
|
+
}
|
57
|
+
|
58
|
+
function isString(val) {
|
59
|
+
return typeof val === 'string';
|
60
|
+
}
|
61
|
+
|
62
|
+
function isFunction(val) {
|
63
|
+
return typeof val === 'function';
|
64
|
+
}
|
65
|
+
|
66
|
+
function isObject(obj) {
|
67
|
+
return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
|
68
|
+
}
|
69
|
+
|
70
|
+
function isPlainObject(obj) {
|
71
|
+
return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
|
72
|
+
}
|
113
73
|
|
114
|
-
|
115
|
-
}
|
74
|
+
function options(fn, obj, opts) {
|
116
75
|
|
117
|
-
|
118
|
-
window.Vue.use(plugin);
|
119
|
-
}
|
76
|
+
opts = opts || {};
|
120
77
|
|
121
|
-
|
78
|
+
if (isFunction(opts)) {
|
79
|
+
opts = opts.call(obj);
|
80
|
+
}
|
122
81
|
|
123
|
-
|
124
|
-
|
125
|
-
/***/ function(module, exports) {
|
82
|
+
return merge(fn.bind({ $vm: obj, $options: opts }), fn, { $options: opts });
|
83
|
+
}
|
126
84
|
|
127
|
-
|
85
|
+
function each(obj, iterator) {
|
128
86
|
|
129
|
-
|
130
|
-
* Utility functions.
|
131
|
-
*/
|
87
|
+
var i, key;
|
132
88
|
|
133
|
-
|
134
|
-
|
135
|
-
|
89
|
+
if (typeof obj.length == 'number') {
|
90
|
+
for (i = 0; i < obj.length; i++) {
|
91
|
+
iterator.call(obj[i], obj[i], i);
|
92
|
+
}
|
93
|
+
} else if (isObject(obj)) {
|
94
|
+
for (key in obj) {
|
95
|
+
if (obj.hasOwnProperty(key)) {
|
96
|
+
iterator.call(obj[key], obj[key], key);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
136
100
|
|
137
|
-
|
138
|
-
|
139
|
-
console.warn('[VueResource warn]: ' + msg);
|
140
|
-
}
|
141
|
-
};
|
101
|
+
return obj;
|
102
|
+
}
|
142
103
|
|
143
|
-
|
144
|
-
if (console) {
|
145
|
-
console.error(msg);
|
146
|
-
}
|
147
|
-
};
|
104
|
+
function extend(target) {
|
148
105
|
|
149
|
-
|
150
|
-
return str.replace(/^\s*|\s*$/g, '');
|
151
|
-
};
|
152
|
-
|
153
|
-
_.toLower = function (str) {
|
154
|
-
return str ? str.toLowerCase() : '';
|
155
|
-
};
|
156
|
-
|
157
|
-
_.isArray = Array.isArray;
|
106
|
+
var args = array.slice.call(arguments, 1);
|
158
107
|
|
159
|
-
|
160
|
-
|
161
|
-
|
108
|
+
args.forEach(function (arg) {
|
109
|
+
_merge(target, arg);
|
110
|
+
});
|
162
111
|
|
163
|
-
|
164
|
-
|
165
|
-
};
|
112
|
+
return target;
|
113
|
+
}
|
166
114
|
|
167
|
-
|
168
|
-
return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
|
169
|
-
};
|
115
|
+
function merge(target) {
|
170
116
|
|
171
|
-
|
172
|
-
return _.isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
|
173
|
-
};
|
117
|
+
var args = array.slice.call(arguments, 1);
|
174
118
|
|
175
|
-
|
119
|
+
args.forEach(function (arg) {
|
120
|
+
_merge(target, arg, true);
|
121
|
+
});
|
176
122
|
|
177
|
-
|
123
|
+
return target;
|
124
|
+
}
|
178
125
|
|
179
|
-
|
180
|
-
|
181
|
-
|
126
|
+
function _merge(target, source, deep) {
|
127
|
+
for (var key in source) {
|
128
|
+
if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
|
129
|
+
if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
|
130
|
+
target[key] = {};
|
131
|
+
}
|
132
|
+
if (isArray(source[key]) && !isArray(target[key])) {
|
133
|
+
target[key] = [];
|
134
|
+
}
|
135
|
+
_merge(target[key], source[key], deep);
|
136
|
+
} else if (source[key] !== undefined) {
|
137
|
+
target[key] = source[key];
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
182
141
|
|
183
|
-
|
184
|
-
};
|
142
|
+
function root (options, next) {
|
185
143
|
|
186
|
-
|
144
|
+
var url = next(options);
|
187
145
|
|
188
|
-
|
146
|
+
if (isString(options.root) && !url.match(/^(https?:)?\//)) {
|
147
|
+
url = options.root + '/' + url;
|
148
|
+
}
|
189
149
|
|
190
|
-
|
191
|
-
|
192
|
-
iterator.call(obj[i], obj[i], i);
|
193
|
-
}
|
194
|
-
} else if (_.isObject(obj)) {
|
195
|
-
for (key in obj) {
|
196
|
-
if (obj.hasOwnProperty(key)) {
|
197
|
-
iterator.call(obj[key], obj[key], key);
|
198
|
-
}
|
199
|
-
}
|
200
|
-
}
|
150
|
+
return url;
|
151
|
+
}
|
201
152
|
|
202
|
-
|
203
|
-
};
|
153
|
+
function query (options, next) {
|
204
154
|
|
205
|
-
|
155
|
+
var urlParams = Object.keys(Url.options.params),
|
156
|
+
query = {},
|
157
|
+
url = next(options);
|
206
158
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
159
|
+
each(options.params, function (value, key) {
|
160
|
+
if (urlParams.indexOf(key) === -1) {
|
161
|
+
query[key] = value;
|
162
|
+
}
|
163
|
+
});
|
212
164
|
|
213
|
-
|
214
|
-
};
|
165
|
+
query = Url.params(query);
|
215
166
|
|
216
|
-
|
167
|
+
if (query) {
|
168
|
+
url += (url.indexOf('?') == -1 ? '?' : '&') + query;
|
169
|
+
}
|
217
170
|
|
218
|
-
|
171
|
+
return url;
|
172
|
+
}
|
219
173
|
|
220
|
-
|
221
|
-
merge(target, arg);
|
222
|
-
});
|
174
|
+
function legacy (options, next) {
|
223
175
|
|
224
|
-
|
225
|
-
|
176
|
+
var variables = [],
|
177
|
+
url = next(options);
|
226
178
|
|
227
|
-
|
179
|
+
url = url.replace(/(\/?):([a-z]\w*)/gi, function (match, slash, name) {
|
228
180
|
|
229
|
-
|
181
|
+
warn('The `:' + name + '` parameter syntax has been deprecated. Use the `{' + name + '}` syntax instead.');
|
230
182
|
|
231
|
-
|
232
|
-
|
233
|
-
|
183
|
+
if (options.params[name]) {
|
184
|
+
variables.push(name);
|
185
|
+
return slash + encodeUriSegment(options.params[name]);
|
186
|
+
}
|
234
187
|
|
235
|
-
|
236
|
-
|
188
|
+
return '';
|
189
|
+
});
|
237
190
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
if (_.isPlainObject(source[key]) && !_.isPlainObject(target[key])) {
|
242
|
-
target[key] = {};
|
243
|
-
}
|
244
|
-
if (_.isArray(source[key]) && !_.isArray(target[key])) {
|
245
|
-
target[key] = [];
|
246
|
-
}
|
247
|
-
merge(target[key], source[key], deep);
|
248
|
-
} else if (source[key] !== undefined) {
|
249
|
-
target[key] = source[key];
|
250
|
-
}
|
251
|
-
}
|
252
|
-
}
|
191
|
+
variables.forEach(function (key) {
|
192
|
+
delete options.params[key];
|
193
|
+
});
|
253
194
|
|
254
|
-
|
255
|
-
|
256
|
-
/***/ function(module, exports, __webpack_require__) {
|
195
|
+
return url;
|
196
|
+
}
|
257
197
|
|
258
|
-
|
259
|
-
* Service for URL templating.
|
260
|
-
*/
|
198
|
+
function encodeUriSegment(value) {
|
261
199
|
|
262
|
-
|
263
|
-
|
264
|
-
var el = document.createElement('a');
|
200
|
+
return encodeUriQuery(value, true).replace(/%26/gi, '&').replace(/%3D/gi, '=').replace(/%2B/gi, '+');
|
201
|
+
}
|
265
202
|
|
266
|
-
|
203
|
+
function encodeUriQuery(value, spaces) {
|
267
204
|
|
268
|
-
|
269
|
-
|
205
|
+
return encodeURIComponent(value).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, spaces ? '%20' : '+');
|
206
|
+
}
|
270
207
|
|
271
|
-
|
272
|
-
|
273
|
-
|
208
|
+
/**
|
209
|
+
* URL Template v2.0.6 (https://github.com/bramstein/url-template)
|
210
|
+
*/
|
211
|
+
|
212
|
+
function expand(url, params, variables) {
|
213
|
+
|
214
|
+
var tmpl = parse(url),
|
215
|
+
expanded = tmpl.expand(params);
|
216
|
+
|
217
|
+
if (variables) {
|
218
|
+
variables.push.apply(variables, tmpl.vars);
|
219
|
+
}
|
220
|
+
|
221
|
+
return expanded;
|
222
|
+
}
|
223
|
+
|
224
|
+
function parse(template) {
|
225
|
+
|
226
|
+
var operators = ['+', '#', '.', '/', ';', '?', '&'],
|
227
|
+
variables = [];
|
228
|
+
|
229
|
+
return {
|
230
|
+
vars: variables,
|
231
|
+
expand: function expand(context) {
|
232
|
+
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
|
233
|
+
if (expression) {
|
234
|
+
|
235
|
+
var operator = null,
|
236
|
+
values = [];
|
237
|
+
|
238
|
+
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
239
|
+
operator = expression.charAt(0);
|
240
|
+
expression = expression.substr(1);
|
241
|
+
}
|
242
|
+
|
243
|
+
expression.split(/,/g).forEach(function (variable) {
|
244
|
+
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
245
|
+
values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
246
|
+
variables.push(tmp[1]);
|
247
|
+
});
|
248
|
+
|
249
|
+
if (operator && operator !== '+') {
|
250
|
+
|
251
|
+
var separator = ',';
|
252
|
+
|
253
|
+
if (operator === '?') {
|
254
|
+
separator = '&';
|
255
|
+
} else if (operator !== '#') {
|
256
|
+
separator = operator;
|
257
|
+
}
|
258
|
+
|
259
|
+
return (values.length !== 0 ? operator : '') + values.join(separator);
|
260
|
+
} else {
|
261
|
+
return values.join(',');
|
262
|
+
}
|
263
|
+
} else {
|
264
|
+
return encodeReserved(literal);
|
265
|
+
}
|
266
|
+
});
|
267
|
+
}
|
268
|
+
};
|
269
|
+
}
|
270
|
+
|
271
|
+
function getValues(context, operator, key, modifier) {
|
272
|
+
|
273
|
+
var value = context[key],
|
274
|
+
result = [];
|
275
|
+
|
276
|
+
if (isDefined(value) && value !== '') {
|
277
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
278
|
+
value = value.toString();
|
279
|
+
|
280
|
+
if (modifier && modifier !== '*') {
|
281
|
+
value = value.substring(0, parseInt(modifier, 10));
|
282
|
+
}
|
283
|
+
|
284
|
+
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
|
285
|
+
} else {
|
286
|
+
if (modifier === '*') {
|
287
|
+
if (Array.isArray(value)) {
|
288
|
+
value.filter(isDefined).forEach(function (value) {
|
289
|
+
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
|
290
|
+
});
|
291
|
+
} else {
|
292
|
+
Object.keys(value).forEach(function (k) {
|
293
|
+
if (isDefined(value[k])) {
|
294
|
+
result.push(encodeValue(operator, value[k], k));
|
295
|
+
}
|
296
|
+
});
|
297
|
+
}
|
298
|
+
} else {
|
299
|
+
var tmp = [];
|
300
|
+
|
301
|
+
if (Array.isArray(value)) {
|
302
|
+
value.filter(isDefined).forEach(function (value) {
|
303
|
+
tmp.push(encodeValue(operator, value));
|
304
|
+
});
|
305
|
+
} else {
|
306
|
+
Object.keys(value).forEach(function (k) {
|
307
|
+
if (isDefined(value[k])) {
|
308
|
+
tmp.push(encodeURIComponent(k));
|
309
|
+
tmp.push(encodeValue(operator, value[k].toString()));
|
310
|
+
}
|
311
|
+
});
|
312
|
+
}
|
313
|
+
|
314
|
+
if (isKeyOperator(operator)) {
|
315
|
+
result.push(encodeURIComponent(key) + '=' + tmp.join(','));
|
316
|
+
} else if (tmp.length !== 0) {
|
317
|
+
result.push(tmp.join(','));
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
321
|
+
} else {
|
322
|
+
if (operator === ';') {
|
323
|
+
result.push(encodeURIComponent(key));
|
324
|
+
} else if (value === '' && (operator === '&' || operator === '?')) {
|
325
|
+
result.push(encodeURIComponent(key) + '=');
|
326
|
+
} else if (value === '') {
|
327
|
+
result.push('');
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
return result;
|
332
|
+
}
|
333
|
+
|
334
|
+
function isDefined(value) {
|
335
|
+
return value !== undefined && value !== null;
|
336
|
+
}
|
337
|
+
|
338
|
+
function isKeyOperator(operator) {
|
339
|
+
return operator === ';' || operator === '&' || operator === '?';
|
340
|
+
}
|
341
|
+
|
342
|
+
function encodeValue(operator, value, key) {
|
343
|
+
|
344
|
+
value = operator === '+' || operator === '#' ? encodeReserved(value) : encodeURIComponent(value);
|
345
|
+
|
346
|
+
if (key) {
|
347
|
+
return encodeURIComponent(key) + '=' + value;
|
348
|
+
} else {
|
349
|
+
return value;
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
function encodeReserved(str) {
|
354
|
+
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
|
355
|
+
if (!/%[0-9A-Fa-f]/.test(part)) {
|
356
|
+
part = encodeURI(part);
|
357
|
+
}
|
358
|
+
return part;
|
359
|
+
}).join('');
|
360
|
+
}
|
361
|
+
|
362
|
+
function template (options) {
|
363
|
+
|
364
|
+
var variables = [],
|
365
|
+
url = expand(options.url, options.params, variables);
|
366
|
+
|
367
|
+
variables.forEach(function (key) {
|
368
|
+
delete options.params[key];
|
369
|
+
});
|
370
|
+
|
371
|
+
return url;
|
372
|
+
}
|
373
|
+
|
374
|
+
/**
|
375
|
+
* Service for URL templating.
|
376
|
+
*/
|
377
|
+
|
378
|
+
var ie = document.documentMode;
|
379
|
+
var el = document.createElement('a');
|
380
|
+
|
381
|
+
function Url(url, params) {
|
382
|
+
|
383
|
+
var self = this || {},
|
384
|
+
options = url,
|
385
|
+
transform;
|
386
|
+
|
387
|
+
if (isString(url)) {
|
388
|
+
options = { url: url, params: params };
|
389
|
+
}
|
390
|
+
|
391
|
+
options = merge({}, Url.options, self.$options, options);
|
392
|
+
|
393
|
+
Url.transforms.forEach(function (handler) {
|
394
|
+
transform = factory(handler, transform, self.$vm);
|
395
|
+
});
|
396
|
+
|
397
|
+
return transform(options);
|
398
|
+
}
|
399
|
+
|
400
|
+
/**
|
401
|
+
* Url options.
|
402
|
+
*/
|
403
|
+
|
404
|
+
Url.options = {
|
405
|
+
url: '',
|
406
|
+
root: null,
|
407
|
+
params: {}
|
408
|
+
};
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Url transforms.
|
412
|
+
*/
|
413
|
+
|
414
|
+
Url.transforms = [template, legacy, query, root];
|
415
|
+
|
416
|
+
/**
|
417
|
+
* Encodes a Url parameter string.
|
418
|
+
*
|
419
|
+
* @param {Object} obj
|
420
|
+
*/
|
274
421
|
|
275
|
-
|
422
|
+
Url.params = function (obj) {
|
276
423
|
|
277
|
-
|
278
|
-
|
279
|
-
}, this);
|
424
|
+
var params = [],
|
425
|
+
escape = encodeURIComponent;
|
280
426
|
|
281
|
-
|
282
|
-
};
|
427
|
+
params.add = function (key, value) {
|
283
428
|
|
284
|
-
|
285
|
-
|
286
|
-
|
429
|
+
if (isFunction(value)) {
|
430
|
+
value = value();
|
431
|
+
}
|
287
432
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
params: {}
|
292
|
-
};
|
433
|
+
if (value === null) {
|
434
|
+
value = '';
|
435
|
+
}
|
293
436
|
|
294
|
-
|
295
|
-
|
296
|
-
|
437
|
+
this.push(escape(key) + '=' + escape(value));
|
438
|
+
};
|
439
|
+
|
440
|
+
serialize(params, obj);
|
297
441
|
|
298
|
-
|
442
|
+
return params.join('&').replace(/%20/g, '+');
|
443
|
+
};
|
444
|
+
|
445
|
+
/**
|
446
|
+
* Parse a URL and return its components.
|
447
|
+
*
|
448
|
+
* @param {String} url
|
449
|
+
*/
|
450
|
+
|
451
|
+
Url.parse = function (url) {
|
452
|
+
|
453
|
+
if (ie) {
|
454
|
+
el.href = url;
|
455
|
+
url = el.href;
|
456
|
+
}
|
457
|
+
|
458
|
+
el.href = url;
|
459
|
+
|
460
|
+
return {
|
461
|
+
href: el.href,
|
462
|
+
protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
|
463
|
+
port: el.port,
|
464
|
+
host: el.host,
|
465
|
+
hostname: el.hostname,
|
466
|
+
pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
|
467
|
+
search: el.search ? el.search.replace(/^\?/, '') : '',
|
468
|
+
hash: el.hash ? el.hash.replace(/^#/, '') : ''
|
469
|
+
};
|
470
|
+
};
|
471
|
+
|
472
|
+
function factory(handler, next, vm) {
|
473
|
+
return function (options) {
|
474
|
+
return handler.call(vm, options, next);
|
475
|
+
};
|
476
|
+
}
|
477
|
+
|
478
|
+
function serialize(params, obj, scope) {
|
479
|
+
|
480
|
+
var array = isArray(obj),
|
481
|
+
plain = isPlainObject(obj),
|
482
|
+
hash;
|
483
|
+
|
484
|
+
each(obj, function (value, key) {
|
485
|
+
|
486
|
+
hash = isObject(value) || isArray(value);
|
487
|
+
|
488
|
+
if (scope) {
|
489
|
+
key = scope + '[' + (plain || hash ? key : '') + ']';
|
490
|
+
}
|
491
|
+
|
492
|
+
if (!scope && array) {
|
493
|
+
params.add(value.name, value.value);
|
494
|
+
} else if (hash) {
|
495
|
+
serialize(params, value, key);
|
496
|
+
} else {
|
497
|
+
params.add(key, value);
|
498
|
+
}
|
499
|
+
});
|
500
|
+
}
|
501
|
+
|
502
|
+
/**
|
503
|
+
* Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
|
504
|
+
*/
|
505
|
+
|
506
|
+
var RESOLVED = 0;
|
507
|
+
var REJECTED = 1;
|
508
|
+
var PENDING = 2;
|
509
|
+
|
510
|
+
function Promise$2(executor) {
|
511
|
+
|
512
|
+
this.state = PENDING;
|
513
|
+
this.value = undefined;
|
514
|
+
this.deferred = [];
|
515
|
+
|
516
|
+
var promise = this;
|
517
|
+
|
518
|
+
try {
|
519
|
+
executor(function (x) {
|
520
|
+
promise.resolve(x);
|
521
|
+
}, function (r) {
|
522
|
+
promise.reject(r);
|
523
|
+
});
|
524
|
+
} catch (e) {
|
525
|
+
promise.reject(e);
|
526
|
+
}
|
527
|
+
}
|
528
|
+
|
529
|
+
Promise$2.reject = function (r) {
|
530
|
+
return new Promise$2(function (resolve, reject) {
|
531
|
+
reject(r);
|
532
|
+
});
|
533
|
+
};
|
534
|
+
|
535
|
+
Promise$2.resolve = function (x) {
|
536
|
+
return new Promise$2(function (resolve, reject) {
|
537
|
+
resolve(x);
|
538
|
+
});
|
539
|
+
};
|
540
|
+
|
541
|
+
Promise$2.all = function all(iterable) {
|
542
|
+
return new Promise$2(function (resolve, reject) {
|
543
|
+
var count = 0,
|
544
|
+
result = [];
|
545
|
+
|
546
|
+
if (iterable.length === 0) {
|
547
|
+
resolve(result);
|
548
|
+
}
|
549
|
+
|
550
|
+
function resolver(i) {
|
551
|
+
return function (x) {
|
552
|
+
result[i] = x;
|
553
|
+
count += 1;
|
554
|
+
|
555
|
+
if (count === iterable.length) {
|
556
|
+
resolve(result);
|
557
|
+
}
|
558
|
+
};
|
559
|
+
}
|
560
|
+
|
561
|
+
for (var i = 0; i < iterable.length; i += 1) {
|
562
|
+
Promise$2.resolve(iterable[i]).then(resolver(i), reject);
|
563
|
+
}
|
564
|
+
});
|
565
|
+
};
|
566
|
+
|
567
|
+
Promise$2.race = function race(iterable) {
|
568
|
+
return new Promise$2(function (resolve, reject) {
|
569
|
+
for (var i = 0; i < iterable.length; i += 1) {
|
570
|
+
Promise$2.resolve(iterable[i]).then(resolve, reject);
|
571
|
+
}
|
572
|
+
});
|
573
|
+
};
|
574
|
+
|
575
|
+
var p$1 = Promise$2.prototype;
|
576
|
+
|
577
|
+
p$1.resolve = function resolve(x) {
|
578
|
+
var promise = this;
|
579
|
+
|
580
|
+
if (promise.state === PENDING) {
|
581
|
+
if (x === promise) {
|
582
|
+
throw new TypeError('Promise settled with itself.');
|
583
|
+
}
|
584
|
+
|
585
|
+
var called = false;
|
586
|
+
|
587
|
+
try {
|
588
|
+
var then = x && x['then'];
|
589
|
+
|
590
|
+
if (x !== null && (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && typeof then === 'function') {
|
591
|
+
then.call(x, function (x) {
|
592
|
+
if (!called) {
|
593
|
+
promise.resolve(x);
|
594
|
+
}
|
595
|
+
called = true;
|
596
|
+
}, function (r) {
|
597
|
+
if (!called) {
|
598
|
+
promise.reject(r);
|
599
|
+
}
|
600
|
+
called = true;
|
601
|
+
});
|
602
|
+
return;
|
603
|
+
}
|
604
|
+
} catch (e) {
|
605
|
+
if (!called) {
|
606
|
+
promise.reject(e);
|
607
|
+
}
|
608
|
+
return;
|
609
|
+
}
|
610
|
+
|
611
|
+
promise.state = RESOLVED;
|
612
|
+
promise.value = x;
|
613
|
+
promise.notify();
|
614
|
+
}
|
615
|
+
};
|
616
|
+
|
617
|
+
p$1.reject = function reject(reason) {
|
618
|
+
var promise = this;
|
619
|
+
|
620
|
+
if (promise.state === PENDING) {
|
621
|
+
if (reason === promise) {
|
622
|
+
throw new TypeError('Promise settled with itself.');
|
623
|
+
}
|
624
|
+
|
625
|
+
promise.state = REJECTED;
|
626
|
+
promise.value = reason;
|
627
|
+
promise.notify();
|
628
|
+
}
|
629
|
+
};
|
630
|
+
|
631
|
+
p$1.notify = function notify() {
|
632
|
+
var promise = this;
|
633
|
+
|
634
|
+
nextTick(function () {
|
635
|
+
if (promise.state !== PENDING) {
|
636
|
+
while (promise.deferred.length) {
|
637
|
+
var deferred = promise.deferred.shift(),
|
638
|
+
onResolved = deferred[0],
|
639
|
+
onRejected = deferred[1],
|
640
|
+
resolve = deferred[2],
|
641
|
+
reject = deferred[3];
|
642
|
+
|
643
|
+
try {
|
644
|
+
if (promise.state === RESOLVED) {
|
645
|
+
if (typeof onResolved === 'function') {
|
646
|
+
resolve(onResolved.call(undefined, promise.value));
|
647
|
+
} else {
|
648
|
+
resolve(promise.value);
|
649
|
+
}
|
650
|
+
} else if (promise.state === REJECTED) {
|
651
|
+
if (typeof onRejected === 'function') {
|
652
|
+
resolve(onRejected.call(undefined, promise.value));
|
653
|
+
} else {
|
654
|
+
reject(promise.value);
|
655
|
+
}
|
656
|
+
}
|
657
|
+
} catch (e) {
|
658
|
+
reject(e);
|
659
|
+
}
|
660
|
+
}
|
661
|
+
}
|
662
|
+
});
|
663
|
+
};
|
664
|
+
|
665
|
+
p$1.then = function then(onResolved, onRejected) {
|
666
|
+
var promise = this;
|
667
|
+
|
668
|
+
return new Promise$2(function (resolve, reject) {
|
669
|
+
promise.deferred.push([onResolved, onRejected, resolve, reject]);
|
670
|
+
promise.notify();
|
671
|
+
});
|
672
|
+
};
|
673
|
+
|
674
|
+
p$1.catch = function (onRejected) {
|
675
|
+
return this.then(undefined, onRejected);
|
676
|
+
};
|
677
|
+
|
678
|
+
var PromiseObj = window.Promise || Promise$2;
|
679
|
+
|
680
|
+
function Promise$1(executor, context) {
|
681
|
+
|
682
|
+
if (executor instanceof PromiseObj) {
|
683
|
+
this.promise = executor;
|
684
|
+
} else {
|
685
|
+
this.promise = new PromiseObj(executor.bind(context));
|
686
|
+
}
|
687
|
+
|
688
|
+
this.context = context;
|
689
|
+
}
|
690
|
+
|
691
|
+
Promise$1.all = function (iterable, context) {
|
692
|
+
return new Promise$1(PromiseObj.all(iterable), context);
|
693
|
+
};
|
694
|
+
|
695
|
+
Promise$1.resolve = function (value, context) {
|
696
|
+
return new Promise$1(PromiseObj.resolve(value), context);
|
697
|
+
};
|
698
|
+
|
699
|
+
Promise$1.reject = function (reason, context) {
|
700
|
+
return new Promise$1(PromiseObj.reject(reason), context);
|
701
|
+
};
|
702
|
+
|
703
|
+
Promise$1.race = function (iterable, context) {
|
704
|
+
return new Promise$1(PromiseObj.race(iterable), context);
|
705
|
+
};
|
706
|
+
|
707
|
+
var p = Promise$1.prototype;
|
299
708
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
*/
|
709
|
+
p.bind = function (context) {
|
710
|
+
this.context = context;
|
711
|
+
return this;
|
712
|
+
};
|
305
713
|
|
306
|
-
|
714
|
+
p.then = function (fulfilled, rejected) {
|
307
715
|
|
308
|
-
|
309
|
-
|
716
|
+
if (fulfilled && fulfilled.bind && this.context) {
|
717
|
+
fulfilled = fulfilled.bind(this.context);
|
718
|
+
}
|
310
719
|
|
311
|
-
|
720
|
+
if (rejected && rejected.bind && this.context) {
|
721
|
+
rejected = rejected.bind(this.context);
|
722
|
+
}
|
312
723
|
|
313
|
-
|
314
|
-
value = value();
|
315
|
-
}
|
724
|
+
this.promise = this.promise.then(fulfilled, rejected);
|
316
725
|
|
317
|
-
|
318
|
-
|
319
|
-
}
|
726
|
+
return this;
|
727
|
+
};
|
320
728
|
|
321
|
-
|
322
|
-
};
|
729
|
+
p.catch = function (rejected) {
|
323
730
|
|
324
|
-
|
731
|
+
if (rejected && rejected.bind && this.context) {
|
732
|
+
rejected = rejected.bind(this.context);
|
733
|
+
}
|
325
734
|
|
326
|
-
|
327
|
-
};
|
735
|
+
this.promise = this.promise.catch(rejected);
|
328
736
|
|
329
|
-
|
330
|
-
|
331
|
-
*
|
332
|
-
* @param {String} url
|
333
|
-
*/
|
737
|
+
return this;
|
738
|
+
};
|
334
739
|
|
335
|
-
|
740
|
+
p.finally = function (callback) {
|
336
741
|
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
742
|
+
return this.then(function (value) {
|
743
|
+
callback.call(this);
|
744
|
+
return value;
|
745
|
+
}, function (reason) {
|
746
|
+
callback.call(this);
|
747
|
+
return PromiseObj.reject(reason);
|
748
|
+
});
|
749
|
+
};
|
341
750
|
|
342
|
-
|
751
|
+
p.success = function (callback) {
|
343
752
|
|
344
|
-
|
345
|
-
href: el.href,
|
346
|
-
protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
|
347
|
-
port: el.port,
|
348
|
-
host: el.host,
|
349
|
-
hostname: el.hostname,
|
350
|
-
pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
|
351
|
-
search: el.search ? el.search.replace(/^\?/, '') : '',
|
352
|
-
hash: el.hash ? el.hash.replace(/^#/, '') : ''
|
353
|
-
};
|
354
|
-
};
|
753
|
+
warn('The `success` method has been deprecated. Use the `then` method instead.');
|
355
754
|
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
}
|
755
|
+
return this.then(function (response) {
|
756
|
+
return callback.call(this, response.data, response.status, response) || response;
|
757
|
+
});
|
758
|
+
};
|
361
759
|
|
362
|
-
|
760
|
+
p.error = function (callback) {
|
363
761
|
|
364
|
-
|
365
|
-
plain = _.isPlainObject(obj),
|
366
|
-
hash;
|
762
|
+
warn('The `error` method has been deprecated. Use the `catch` method instead.');
|
367
763
|
|
368
|
-
|
764
|
+
return this.catch(function (response) {
|
765
|
+
return callback.call(this, response.data, response.status, response) || response;
|
766
|
+
});
|
767
|
+
};
|
369
768
|
|
370
|
-
|
769
|
+
p.always = function (callback) {
|
371
770
|
|
372
|
-
|
373
|
-
key = scope + '[' + (plain || hash ? key : '') + ']';
|
374
|
-
}
|
771
|
+
warn('The `always` method has been deprecated. Use the `finally` method instead.');
|
375
772
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
serialize(params, value, key);
|
380
|
-
} else {
|
381
|
-
params.add(key, value);
|
382
|
-
}
|
383
|
-
});
|
384
|
-
}
|
773
|
+
var cb = function cb(response) {
|
774
|
+
return callback.call(this, response.data, response.status, response) || response;
|
775
|
+
};
|
385
776
|
|
386
|
-
|
777
|
+
return this.then(cb, cb);
|
778
|
+
};
|
387
779
|
|
388
|
-
|
389
|
-
|
390
|
-
/***/ function(module, exports, __webpack_require__) {
|
780
|
+
function xdrClient (request) {
|
781
|
+
return new Promise$1(function (resolve) {
|
391
782
|
|
392
|
-
|
393
|
-
|
394
|
-
|
783
|
+
var xdr = new XDomainRequest(),
|
784
|
+
response = { request: request },
|
785
|
+
handler;
|
395
786
|
|
396
|
-
|
787
|
+
request.cancel = function () {
|
788
|
+
xdr.abort();
|
789
|
+
};
|
397
790
|
|
398
|
-
|
791
|
+
xdr.open(request.method, Url(request), true);
|
399
792
|
|
400
|
-
|
401
|
-
url = UrlTemplate.expand(options.url, options.params, variables);
|
402
|
-
|
403
|
-
variables.forEach(function (key) {
|
404
|
-
delete options.params[key];
|
405
|
-
});
|
406
|
-
|
407
|
-
return url;
|
408
|
-
};
|
409
|
-
|
410
|
-
/***/ },
|
411
|
-
/* 4 */
|
412
|
-
/***/ function(module, exports) {
|
413
|
-
|
414
|
-
/**
|
415
|
-
* URL Template v2.0.6 (https://github.com/bramstein/url-template)
|
416
|
-
*/
|
417
|
-
|
418
|
-
exports.expand = function (url, params, variables) {
|
419
|
-
|
420
|
-
var tmpl = this.parse(url),
|
421
|
-
expanded = tmpl.expand(params);
|
422
|
-
|
423
|
-
if (variables) {
|
424
|
-
variables.push.apply(variables, tmpl.vars);
|
425
|
-
}
|
426
|
-
|
427
|
-
return expanded;
|
428
|
-
};
|
429
|
-
|
430
|
-
exports.parse = function (template) {
|
431
|
-
|
432
|
-
var operators = ['+', '#', '.', '/', ';', '?', '&'],
|
433
|
-
variables = [];
|
434
|
-
|
435
|
-
return {
|
436
|
-
vars: variables,
|
437
|
-
expand: function expand(context) {
|
438
|
-
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
|
439
|
-
if (expression) {
|
440
|
-
|
441
|
-
var operator = null,
|
442
|
-
values = [];
|
443
|
-
|
444
|
-
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
445
|
-
operator = expression.charAt(0);
|
446
|
-
expression = expression.substr(1);
|
447
|
-
}
|
448
|
-
|
449
|
-
expression.split(/,/g).forEach(function (variable) {
|
450
|
-
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
451
|
-
values.push.apply(values, exports.getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
452
|
-
variables.push(tmp[1]);
|
453
|
-
});
|
454
|
-
|
455
|
-
if (operator && operator !== '+') {
|
456
|
-
|
457
|
-
var separator = ',';
|
458
|
-
|
459
|
-
if (operator === '?') {
|
460
|
-
separator = '&';
|
461
|
-
} else if (operator !== '#') {
|
462
|
-
separator = operator;
|
463
|
-
}
|
464
|
-
|
465
|
-
return (values.length !== 0 ? operator : '') + values.join(separator);
|
466
|
-
} else {
|
467
|
-
return values.join(',');
|
468
|
-
}
|
469
|
-
} else {
|
470
|
-
return exports.encodeReserved(literal);
|
471
|
-
}
|
472
|
-
});
|
473
|
-
}
|
474
|
-
};
|
475
|
-
};
|
476
|
-
|
477
|
-
exports.getValues = function (context, operator, key, modifier) {
|
478
|
-
|
479
|
-
var value = context[key],
|
480
|
-
result = [];
|
481
|
-
|
482
|
-
if (this.isDefined(value) && value !== '') {
|
483
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
484
|
-
value = value.toString();
|
485
|
-
|
486
|
-
if (modifier && modifier !== '*') {
|
487
|
-
value = value.substring(0, parseInt(modifier, 10));
|
488
|
-
}
|
489
|
-
|
490
|
-
result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));
|
491
|
-
} else {
|
492
|
-
if (modifier === '*') {
|
493
|
-
if (Array.isArray(value)) {
|
494
|
-
value.filter(this.isDefined).forEach(function (value) {
|
495
|
-
result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));
|
496
|
-
}, this);
|
497
|
-
} else {
|
498
|
-
Object.keys(value).forEach(function (k) {
|
499
|
-
if (this.isDefined(value[k])) {
|
500
|
-
result.push(this.encodeValue(operator, value[k], k));
|
501
|
-
}
|
502
|
-
}, this);
|
503
|
-
}
|
504
|
-
} else {
|
505
|
-
var tmp = [];
|
506
|
-
|
507
|
-
if (Array.isArray(value)) {
|
508
|
-
value.filter(this.isDefined).forEach(function (value) {
|
509
|
-
tmp.push(this.encodeValue(operator, value));
|
510
|
-
}, this);
|
511
|
-
} else {
|
512
|
-
Object.keys(value).forEach(function (k) {
|
513
|
-
if (this.isDefined(value[k])) {
|
514
|
-
tmp.push(encodeURIComponent(k));
|
515
|
-
tmp.push(this.encodeValue(operator, value[k].toString()));
|
516
|
-
}
|
517
|
-
}, this);
|
518
|
-
}
|
519
|
-
|
520
|
-
if (this.isKeyOperator(operator)) {
|
521
|
-
result.push(encodeURIComponent(key) + '=' + tmp.join(','));
|
522
|
-
} else if (tmp.length !== 0) {
|
523
|
-
result.push(tmp.join(','));
|
524
|
-
}
|
525
|
-
}
|
526
|
-
}
|
527
|
-
} else {
|
528
|
-
if (operator === ';') {
|
529
|
-
result.push(encodeURIComponent(key));
|
530
|
-
} else if (value === '' && (operator === '&' || operator === '?')) {
|
531
|
-
result.push(encodeURIComponent(key) + '=');
|
532
|
-
} else if (value === '') {
|
533
|
-
result.push('');
|
534
|
-
}
|
535
|
-
}
|
536
|
-
|
537
|
-
return result;
|
538
|
-
};
|
539
|
-
|
540
|
-
exports.isDefined = function (value) {
|
541
|
-
return value !== undefined && value !== null;
|
542
|
-
};
|
543
|
-
|
544
|
-
exports.isKeyOperator = function (operator) {
|
545
|
-
return operator === ';' || operator === '&' || operator === '?';
|
546
|
-
};
|
547
|
-
|
548
|
-
exports.encodeValue = function (operator, value, key) {
|
549
|
-
|
550
|
-
value = operator === '+' || operator === '#' ? this.encodeReserved(value) : encodeURIComponent(value);
|
551
|
-
|
552
|
-
if (key) {
|
553
|
-
return encodeURIComponent(key) + '=' + value;
|
554
|
-
} else {
|
555
|
-
return value;
|
556
|
-
}
|
557
|
-
};
|
558
|
-
|
559
|
-
exports.encodeReserved = function (str) {
|
560
|
-
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
|
561
|
-
if (!/%[0-9A-Fa-f]/.test(part)) {
|
562
|
-
part = encodeURI(part);
|
563
|
-
}
|
564
|
-
return part;
|
565
|
-
}).join('');
|
566
|
-
};
|
567
|
-
|
568
|
-
/***/ },
|
569
|
-
/* 5 */
|
570
|
-
/***/ function(module, exports, __webpack_require__) {
|
571
|
-
|
572
|
-
/**
|
573
|
-
* Legacy Transform.
|
574
|
-
*/
|
575
|
-
|
576
|
-
var _ = __webpack_require__(1);
|
577
|
-
|
578
|
-
module.exports = function (options, next) {
|
579
|
-
|
580
|
-
var variables = [],
|
581
|
-
url = next(options);
|
582
|
-
|
583
|
-
url = url.replace(/(\/?):([a-z]\w*)/gi, function (match, slash, name) {
|
584
|
-
|
585
|
-
_.warn('The `:' + name + '` parameter syntax has been deprecated. Use the `{' + name + '}` syntax instead.');
|
586
|
-
|
587
|
-
if (options.params[name]) {
|
588
|
-
variables.push(name);
|
589
|
-
return slash + encodeUriSegment(options.params[name]);
|
590
|
-
}
|
591
|
-
|
592
|
-
return '';
|
593
|
-
});
|
594
|
-
|
595
|
-
variables.forEach(function (key) {
|
596
|
-
delete options.params[key];
|
597
|
-
});
|
598
|
-
|
599
|
-
return url;
|
600
|
-
};
|
793
|
+
handler = function handler(event) {
|
601
794
|
|
602
|
-
|
795
|
+
response.data = xdr.responseText;
|
796
|
+
response.status = xdr.status;
|
797
|
+
response.statusText = xdr.statusText || '';
|
603
798
|
|
604
|
-
|
605
|
-
|
799
|
+
resolve(response);
|
800
|
+
};
|
606
801
|
|
607
|
-
|
802
|
+
xdr.timeout = 0;
|
803
|
+
xdr.onload = handler;
|
804
|
+
xdr.onabort = handler;
|
805
|
+
xdr.onerror = handler;
|
806
|
+
xdr.ontimeout = function () {};
|
807
|
+
xdr.onprogress = function () {};
|
608
808
|
|
609
|
-
|
610
|
-
|
809
|
+
xdr.send(request.data);
|
810
|
+
});
|
811
|
+
}
|
611
812
|
|
612
|
-
|
613
|
-
|
614
|
-
/***/ function(module, exports, __webpack_require__) {
|
813
|
+
var originUrl = Url.parse(location.href);
|
814
|
+
var supportCors = 'withCredentials' in new XMLHttpRequest();
|
615
815
|
|
616
|
-
|
617
|
-
|
618
|
-
*/
|
816
|
+
var exports$1 = {
|
817
|
+
request: function request(_request) {
|
619
818
|
|
620
|
-
|
819
|
+
if (_request.crossOrigin === null) {
|
820
|
+
_request.crossOrigin = crossOrigin(_request);
|
821
|
+
}
|
621
822
|
|
622
|
-
|
823
|
+
if (_request.crossOrigin) {
|
623
824
|
|
624
|
-
|
625
|
-
|
626
|
-
|
825
|
+
if (!supportCors) {
|
826
|
+
_request.client = xdrClient;
|
827
|
+
}
|
627
828
|
|
628
|
-
|
629
|
-
|
630
|
-
query[key] = value;
|
631
|
-
}
|
632
|
-
});
|
829
|
+
_request.emulateHTTP = false;
|
830
|
+
}
|
633
831
|
|
634
|
-
|
832
|
+
return _request;
|
833
|
+
}
|
834
|
+
};
|
635
835
|
|
636
|
-
|
637
|
-
url += (url.indexOf('?') == -1 ? '?' : '&') + query;
|
638
|
-
}
|
836
|
+
function crossOrigin(request) {
|
639
837
|
|
640
|
-
|
641
|
-
};
|
838
|
+
var requestUrl = Url.parse(Url(request));
|
642
839
|
|
643
|
-
|
644
|
-
|
645
|
-
/***/ function(module, exports, __webpack_require__) {
|
840
|
+
return requestUrl.protocol !== originUrl.protocol || requestUrl.host !== originUrl.host;
|
841
|
+
}
|
646
842
|
|
647
|
-
|
648
|
-
|
649
|
-
*/
|
843
|
+
var exports$2 = {
|
844
|
+
request: function request(_request) {
|
650
845
|
|
651
|
-
|
846
|
+
if (_request.emulateJSON && isPlainObject(_request.data)) {
|
847
|
+
_request.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
848
|
+
_request.data = Url.params(_request.data);
|
849
|
+
}
|
652
850
|
|
653
|
-
|
851
|
+
if (isObject(_request.data) && /FormData/i.test(_request.data.toString())) {
|
852
|
+
delete _request.headers['Content-Type'];
|
853
|
+
}
|
654
854
|
|
655
|
-
|
855
|
+
if (isPlainObject(_request.data)) {
|
856
|
+
_request.data = JSON.stringify(_request.data);
|
857
|
+
}
|
656
858
|
|
657
|
-
|
658
|
-
|
659
|
-
|
859
|
+
return _request;
|
860
|
+
},
|
861
|
+
response: function response(_response) {
|
660
862
|
|
661
|
-
|
662
|
-
|
863
|
+
try {
|
864
|
+
_response.data = JSON.parse(_response.data);
|
865
|
+
} catch (e) {}
|
663
866
|
|
664
|
-
|
665
|
-
|
666
|
-
|
867
|
+
return _response;
|
868
|
+
}
|
869
|
+
};
|
667
870
|
|
668
|
-
|
669
|
-
|
670
|
-
*/
|
871
|
+
function jsonpClient (request) {
|
872
|
+
return new Promise$1(function (resolve) {
|
671
873
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
var jsonType = { 'Content-Type': 'application/json' };
|
874
|
+
var callback = '_jsonp' + Math.random().toString(36).substr(2),
|
875
|
+
response = { request: request, data: null },
|
876
|
+
handler,
|
877
|
+
script;
|
677
878
|
|
678
|
-
|
679
|
-
|
879
|
+
request.params[request.jsonp] = callback;
|
880
|
+
request.cancel = function () {
|
881
|
+
handler({ type: 'cancel' });
|
882
|
+
};
|
680
883
|
|
681
|
-
|
682
|
-
|
683
|
-
|
884
|
+
script = document.createElement('script');
|
885
|
+
script.src = Url(request);
|
886
|
+
script.type = 'text/javascript';
|
887
|
+
script.async = true;
|
684
888
|
|
685
|
-
|
686
|
-
|
687
|
-
|
889
|
+
window[callback] = function (data) {
|
890
|
+
response.data = data;
|
891
|
+
};
|
688
892
|
|
689
|
-
|
690
|
-
request = _.merge({}, Http.options, this.$options, options);
|
691
|
-
promise = client(request).bind(this.$vm).then(function (response) {
|
893
|
+
handler = function handler(event) {
|
692
894
|
|
693
|
-
|
694
|
-
|
895
|
+
if (event.type === 'load' && response.data !== null) {
|
896
|
+
response.status = 200;
|
897
|
+
} else if (event.type === 'error') {
|
898
|
+
response.status = 404;
|
899
|
+
} else {
|
900
|
+
response.status = 0;
|
901
|
+
}
|
695
902
|
|
696
|
-
|
697
|
-
_.error(response);
|
698
|
-
}
|
903
|
+
resolve(response);
|
699
904
|
|
700
|
-
|
701
|
-
|
905
|
+
delete window[callback];
|
906
|
+
document.body.removeChild(script);
|
907
|
+
};
|
702
908
|
|
703
|
-
|
704
|
-
|
705
|
-
}
|
909
|
+
script.onload = handler;
|
910
|
+
script.onerror = handler;
|
706
911
|
|
707
|
-
|
708
|
-
|
709
|
-
|
912
|
+
document.body.appendChild(script);
|
913
|
+
});
|
914
|
+
}
|
710
915
|
|
711
|
-
|
712
|
-
|
916
|
+
var exports$3 = {
|
917
|
+
request: function request(_request) {
|
713
918
|
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
params: {},
|
718
|
-
headers: {},
|
719
|
-
xhr: null,
|
720
|
-
upload: null,
|
721
|
-
jsonp: 'callback',
|
722
|
-
beforeSend: null,
|
723
|
-
crossOrigin: null,
|
724
|
-
emulateHTTP: false,
|
725
|
-
emulateJSON: false,
|
726
|
-
timeout: 0
|
727
|
-
};
|
919
|
+
if (_request.method == 'JSONP') {
|
920
|
+
_request.client = jsonpClient;
|
921
|
+
}
|
728
922
|
|
729
|
-
|
923
|
+
return _request;
|
924
|
+
}
|
925
|
+
};
|
730
926
|
|
731
|
-
|
732
|
-
|
733
|
-
post: jsonType,
|
734
|
-
patch: jsonType,
|
735
|
-
delete: jsonType,
|
736
|
-
common: { 'Accept': 'application/json, text/plain, */*' },
|
737
|
-
custom: { 'X-Requested-With': 'XMLHttpRequest' }
|
738
|
-
};
|
927
|
+
var exports$4 = {
|
928
|
+
request: function request(_request) {
|
739
929
|
|
740
|
-
|
930
|
+
if (isFunction(_request.beforeSend)) {
|
931
|
+
_request.beforeSend.call(this, _request);
|
932
|
+
}
|
741
933
|
|
742
|
-
|
934
|
+
return _request;
|
935
|
+
}
|
936
|
+
};
|
743
937
|
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
data = undefined;
|
748
|
-
}
|
938
|
+
/**
|
939
|
+
* HTTP method override Interceptor.
|
940
|
+
*/
|
749
941
|
|
750
|
-
|
751
|
-
|
752
|
-
success = undefined;
|
753
|
-
}
|
942
|
+
var exports$5 = {
|
943
|
+
request: function request(_request) {
|
754
944
|
|
755
|
-
|
756
|
-
|
757
|
-
|
945
|
+
if (_request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(_request.method)) {
|
946
|
+
_request.headers['X-HTTP-Method-Override'] = _request.method;
|
947
|
+
_request.method = 'POST';
|
948
|
+
}
|
758
949
|
|
759
|
-
|
950
|
+
return _request;
|
951
|
+
}
|
952
|
+
};
|
760
953
|
|
761
|
-
|
762
|
-
|
763
|
-
/***/ function(module, exports, __webpack_require__) {
|
954
|
+
var exports$6 = {
|
955
|
+
request: function request(_request) {
|
764
956
|
|
765
|
-
|
766
|
-
|
767
|
-
*/
|
957
|
+
_request.method = _request.method.toUpperCase();
|
958
|
+
_request.headers = extend({}, Http.headers.common, !_request.crossOrigin ? Http.headers.custom : {}, Http.headers[_request.method.toLowerCase()], _request.headers);
|
768
959
|
|
769
|
-
|
770
|
-
|
771
|
-
|
960
|
+
if (isPlainObject(_request.data) && /^(GET|JSONP)$/i.test(_request.method)) {
|
961
|
+
extend(_request.params, _request.data);
|
962
|
+
delete _request.data;
|
963
|
+
}
|
772
964
|
|
773
|
-
|
965
|
+
return _request;
|
966
|
+
}
|
967
|
+
};
|
774
968
|
|
775
|
-
|
969
|
+
/**
|
970
|
+
* Timeout Interceptor.
|
971
|
+
*/
|
776
972
|
|
777
|
-
|
973
|
+
var exports$7 = function exports() {
|
778
974
|
|
779
|
-
|
975
|
+
var timeout;
|
780
976
|
|
781
|
-
|
977
|
+
return {
|
978
|
+
request: function request(_request) {
|
782
979
|
|
783
|
-
|
980
|
+
if (_request.timeout) {
|
981
|
+
timeout = setTimeout(function () {
|
982
|
+
_request.cancel();
|
983
|
+
}, _request.timeout);
|
984
|
+
}
|
784
985
|
|
785
|
-
|
786
|
-
|
787
|
-
|
986
|
+
return _request;
|
987
|
+
},
|
988
|
+
response: function response(_response) {
|
788
989
|
|
789
|
-
|
790
|
-
};
|
791
|
-
}
|
990
|
+
clearTimeout(timeout);
|
792
991
|
|
793
|
-
|
992
|
+
return _response;
|
993
|
+
}
|
994
|
+
};
|
995
|
+
};
|
794
996
|
|
795
|
-
|
796
|
-
});
|
797
|
-
};
|
997
|
+
function interceptor (handler, vm) {
|
798
998
|
|
799
|
-
|
999
|
+
return function (client) {
|
800
1000
|
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
i;
|
1001
|
+
if (isFunction(handler)) {
|
1002
|
+
handler = handler.call(vm, Promise$1);
|
1003
|
+
}
|
805
1004
|
|
806
|
-
|
807
|
-
_.each(str.split('\n'), function (row) {
|
1005
|
+
return function (request) {
|
808
1006
|
|
809
|
-
|
810
|
-
|
811
|
-
|
1007
|
+
if (isFunction(handler.request)) {
|
1008
|
+
request = handler.request.call(vm, request);
|
1009
|
+
}
|
812
1010
|
|
813
|
-
|
1011
|
+
return when(request, function (request) {
|
1012
|
+
return when(client(request), function (response) {
|
814
1013
|
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
headers[name] = [headers[name], value];
|
819
|
-
}
|
820
|
-
} else {
|
1014
|
+
if (isFunction(handler.response)) {
|
1015
|
+
response = handler.response.call(vm, response);
|
1016
|
+
}
|
821
1017
|
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
1018
|
+
return response;
|
1019
|
+
});
|
1020
|
+
});
|
1021
|
+
};
|
1022
|
+
};
|
1023
|
+
}
|
826
1024
|
|
827
|
-
|
828
|
-
}
|
1025
|
+
function when(value, fulfilled, rejected) {
|
829
1026
|
|
830
|
-
|
831
|
-
/* 10 */
|
832
|
-
/***/ function(module, exports, __webpack_require__) {
|
1027
|
+
var promise = Promise$1.resolve(value);
|
833
1028
|
|
834
|
-
|
835
|
-
|
836
|
-
|
1029
|
+
if (arguments.length < 2) {
|
1030
|
+
return promise;
|
1031
|
+
}
|
837
1032
|
|
838
|
-
|
839
|
-
|
1033
|
+
return promise.then(fulfilled, rejected);
|
1034
|
+
}
|
840
1035
|
|
841
|
-
|
1036
|
+
function xhrClient (request) {
|
1037
|
+
return new Promise$1(function (resolve) {
|
842
1038
|
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
this.promise = new PromiseObj(executor.bind(context));
|
847
|
-
}
|
1039
|
+
var xhr = new XMLHttpRequest(),
|
1040
|
+
response = { request: request },
|
1041
|
+
handler;
|
848
1042
|
|
849
|
-
|
850
|
-
|
1043
|
+
request.cancel = function () {
|
1044
|
+
xhr.abort();
|
1045
|
+
};
|
851
1046
|
|
852
|
-
|
853
|
-
return new Promise(PromiseObj.all(iterable), context);
|
854
|
-
};
|
1047
|
+
xhr.open(request.method, Url(request), true);
|
855
1048
|
|
856
|
-
|
857
|
-
return new Promise(PromiseObj.resolve(value), context);
|
858
|
-
};
|
1049
|
+
handler = function handler(event) {
|
859
1050
|
|
860
|
-
|
861
|
-
|
862
|
-
|
1051
|
+
response.data = 'response' in xhr ? xhr.response : xhr.responseText;
|
1052
|
+
response.status = xhr.status === 1223 ? 204 : xhr.status; // IE9 status bug
|
1053
|
+
response.statusText = trim(xhr.statusText || '');
|
1054
|
+
response.headers = xhr.getAllResponseHeaders();
|
863
1055
|
|
864
|
-
|
865
|
-
|
866
|
-
};
|
1056
|
+
resolve(response);
|
1057
|
+
};
|
867
1058
|
|
868
|
-
|
1059
|
+
xhr.timeout = 0;
|
1060
|
+
xhr.onload = handler;
|
1061
|
+
xhr.onabort = handler;
|
1062
|
+
xhr.onerror = handler;
|
1063
|
+
xhr.ontimeout = function () {};
|
1064
|
+
xhr.onprogress = function () {};
|
869
1065
|
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
};
|
1066
|
+
if (isPlainObject(request.xhr)) {
|
1067
|
+
extend(xhr, request.xhr);
|
1068
|
+
}
|
874
1069
|
|
875
|
-
|
1070
|
+
if (isPlainObject(request.upload)) {
|
1071
|
+
extend(xhr.upload, request.upload);
|
1072
|
+
}
|
876
1073
|
|
877
|
-
|
878
|
-
|
879
|
-
|
1074
|
+
each(request.headers || {}, function (value, header) {
|
1075
|
+
xhr.setRequestHeader(header, value);
|
1076
|
+
});
|
880
1077
|
|
881
|
-
|
882
|
-
|
883
|
-
|
1078
|
+
xhr.send(request.data);
|
1079
|
+
});
|
1080
|
+
}
|
884
1081
|
|
885
|
-
|
1082
|
+
function Client (request) {
|
886
1083
|
|
887
|
-
|
888
|
-
};
|
1084
|
+
var response = (request.client || xhrClient)(request);
|
889
1085
|
|
890
|
-
|
1086
|
+
return Promise$1.resolve(response).then(function (response) {
|
891
1087
|
|
892
|
-
|
893
|
-
rejected = rejected.bind(this.context);
|
894
|
-
}
|
1088
|
+
if (response.headers) {
|
895
1089
|
|
896
|
-
|
1090
|
+
var headers = parseHeaders(response.headers);
|
897
1091
|
|
898
|
-
|
899
|
-
};
|
1092
|
+
response.headers = function (name) {
|
900
1093
|
|
901
|
-
|
1094
|
+
if (name) {
|
1095
|
+
return headers[toLower(name)];
|
1096
|
+
}
|
902
1097
|
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
}, function (reason) {
|
907
|
-
callback.call(this);
|
908
|
-
return PromiseObj.reject(reason);
|
909
|
-
});
|
910
|
-
};
|
1098
|
+
return headers;
|
1099
|
+
};
|
1100
|
+
}
|
911
1101
|
|
912
|
-
|
1102
|
+
response.ok = response.status >= 200 && response.status < 300;
|
913
1103
|
|
914
|
-
|
1104
|
+
return response;
|
1105
|
+
});
|
1106
|
+
}
|
915
1107
|
|
916
|
-
|
917
|
-
return callback.call(this, response.data, response.status, response) || response;
|
918
|
-
});
|
919
|
-
};
|
1108
|
+
function parseHeaders(str) {
|
920
1109
|
|
921
|
-
|
1110
|
+
var headers = {},
|
1111
|
+
value,
|
1112
|
+
name,
|
1113
|
+
i;
|
922
1114
|
|
923
|
-
|
1115
|
+
if (isString(str)) {
|
1116
|
+
each(str.split('\n'), function (row) {
|
924
1117
|
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
};
|
1118
|
+
i = row.indexOf(':');
|
1119
|
+
name = trim(toLower(row.slice(0, i)));
|
1120
|
+
value = trim(row.slice(i + 1));
|
929
1121
|
|
930
|
-
|
1122
|
+
if (headers[name]) {
|
931
1123
|
|
932
|
-
|
1124
|
+
if (isArray(headers[name])) {
|
1125
|
+
headers[name].push(value);
|
1126
|
+
} else {
|
1127
|
+
headers[name] = [headers[name], value];
|
1128
|
+
}
|
1129
|
+
} else {
|
933
1130
|
|
934
|
-
|
935
|
-
|
936
|
-
|
1131
|
+
headers[name] = value;
|
1132
|
+
}
|
1133
|
+
});
|
1134
|
+
}
|
937
1135
|
|
938
|
-
|
939
|
-
|
1136
|
+
return headers;
|
1137
|
+
}
|
940
1138
|
|
941
|
-
|
1139
|
+
/**
|
1140
|
+
* Service for sending network requests.
|
1141
|
+
*/
|
942
1142
|
|
943
|
-
|
944
|
-
/* 11 */
|
945
|
-
/***/ function(module, exports, __webpack_require__) {
|
1143
|
+
var jsonType = { 'Content-Type': 'application/json' };
|
946
1144
|
|
947
|
-
|
1145
|
+
function Http(url, options) {
|
948
1146
|
|
949
|
-
|
950
|
-
|
951
|
-
|
1147
|
+
var self = this || {},
|
1148
|
+
client = Client,
|
1149
|
+
request,
|
1150
|
+
promise;
|
952
1151
|
|
953
|
-
|
1152
|
+
Http.interceptors.forEach(function (handler) {
|
1153
|
+
client = interceptor(handler, self.$vm)(client);
|
1154
|
+
});
|
954
1155
|
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
function Promise(executor) {
|
960
|
-
|
961
|
-
this.state = PENDING;
|
962
|
-
this.value = undefined;
|
963
|
-
this.deferred = [];
|
964
|
-
|
965
|
-
var promise = this;
|
966
|
-
|
967
|
-
try {
|
968
|
-
executor(function (x) {
|
969
|
-
promise.resolve(x);
|
970
|
-
}, function (r) {
|
971
|
-
promise.reject(r);
|
972
|
-
});
|
973
|
-
} catch (e) {
|
974
|
-
promise.reject(e);
|
975
|
-
}
|
976
|
-
}
|
977
|
-
|
978
|
-
Promise.reject = function (r) {
|
979
|
-
return new Promise(function (resolve, reject) {
|
980
|
-
reject(r);
|
981
|
-
});
|
982
|
-
};
|
983
|
-
|
984
|
-
Promise.resolve = function (x) {
|
985
|
-
return new Promise(function (resolve, reject) {
|
986
|
-
resolve(x);
|
987
|
-
});
|
988
|
-
};
|
989
|
-
|
990
|
-
Promise.all = function all(iterable) {
|
991
|
-
return new Promise(function (resolve, reject) {
|
992
|
-
var count = 0,
|
993
|
-
result = [];
|
994
|
-
|
995
|
-
if (iterable.length === 0) {
|
996
|
-
resolve(result);
|
997
|
-
}
|
998
|
-
|
999
|
-
function resolver(i) {
|
1000
|
-
return function (x) {
|
1001
|
-
result[i] = x;
|
1002
|
-
count += 1;
|
1003
|
-
|
1004
|
-
if (count === iterable.length) {
|
1005
|
-
resolve(result);
|
1006
|
-
}
|
1007
|
-
};
|
1008
|
-
}
|
1009
|
-
|
1010
|
-
for (var i = 0; i < iterable.length; i += 1) {
|
1011
|
-
Promise.resolve(iterable[i]).then(resolver(i), reject);
|
1012
|
-
}
|
1013
|
-
});
|
1014
|
-
};
|
1015
|
-
|
1016
|
-
Promise.race = function race(iterable) {
|
1017
|
-
return new Promise(function (resolve, reject) {
|
1018
|
-
for (var i = 0; i < iterable.length; i += 1) {
|
1019
|
-
Promise.resolve(iterable[i]).then(resolve, reject);
|
1020
|
-
}
|
1021
|
-
});
|
1022
|
-
};
|
1023
|
-
|
1024
|
-
var p = Promise.prototype;
|
1025
|
-
|
1026
|
-
p.resolve = function resolve(x) {
|
1027
|
-
var promise = this;
|
1028
|
-
|
1029
|
-
if (promise.state === PENDING) {
|
1030
|
-
if (x === promise) {
|
1031
|
-
throw new TypeError('Promise settled with itself.');
|
1032
|
-
}
|
1033
|
-
|
1034
|
-
var called = false;
|
1035
|
-
|
1036
|
-
try {
|
1037
|
-
var then = x && x['then'];
|
1038
|
-
|
1039
|
-
if (x !== null && (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && typeof then === 'function') {
|
1040
|
-
then.call(x, function (x) {
|
1041
|
-
if (!called) {
|
1042
|
-
promise.resolve(x);
|
1043
|
-
}
|
1044
|
-
called = true;
|
1045
|
-
}, function (r) {
|
1046
|
-
if (!called) {
|
1047
|
-
promise.reject(r);
|
1048
|
-
}
|
1049
|
-
called = true;
|
1050
|
-
});
|
1051
|
-
return;
|
1052
|
-
}
|
1053
|
-
} catch (e) {
|
1054
|
-
if (!called) {
|
1055
|
-
promise.reject(e);
|
1056
|
-
}
|
1057
|
-
return;
|
1058
|
-
}
|
1059
|
-
|
1060
|
-
promise.state = RESOLVED;
|
1061
|
-
promise.value = x;
|
1062
|
-
promise.notify();
|
1063
|
-
}
|
1064
|
-
};
|
1065
|
-
|
1066
|
-
p.reject = function reject(reason) {
|
1067
|
-
var promise = this;
|
1068
|
-
|
1069
|
-
if (promise.state === PENDING) {
|
1070
|
-
if (reason === promise) {
|
1071
|
-
throw new TypeError('Promise settled with itself.');
|
1072
|
-
}
|
1073
|
-
|
1074
|
-
promise.state = REJECTED;
|
1075
|
-
promise.value = reason;
|
1076
|
-
promise.notify();
|
1077
|
-
}
|
1078
|
-
};
|
1079
|
-
|
1080
|
-
p.notify = function notify() {
|
1081
|
-
var promise = this;
|
1082
|
-
|
1083
|
-
_.nextTick(function () {
|
1084
|
-
if (promise.state !== PENDING) {
|
1085
|
-
while (promise.deferred.length) {
|
1086
|
-
var deferred = promise.deferred.shift(),
|
1087
|
-
onResolved = deferred[0],
|
1088
|
-
onRejected = deferred[1],
|
1089
|
-
resolve = deferred[2],
|
1090
|
-
reject = deferred[3];
|
1091
|
-
|
1092
|
-
try {
|
1093
|
-
if (promise.state === RESOLVED) {
|
1094
|
-
if (typeof onResolved === 'function') {
|
1095
|
-
resolve(onResolved.call(undefined, promise.value));
|
1096
|
-
} else {
|
1097
|
-
resolve(promise.value);
|
1098
|
-
}
|
1099
|
-
} else if (promise.state === REJECTED) {
|
1100
|
-
if (typeof onRejected === 'function') {
|
1101
|
-
resolve(onRejected.call(undefined, promise.value));
|
1102
|
-
} else {
|
1103
|
-
reject(promise.value);
|
1104
|
-
}
|
1105
|
-
}
|
1106
|
-
} catch (e) {
|
1107
|
-
reject(e);
|
1108
|
-
}
|
1109
|
-
}
|
1110
|
-
}
|
1111
|
-
});
|
1112
|
-
};
|
1113
|
-
|
1114
|
-
p.then = function then(onResolved, onRejected) {
|
1115
|
-
var promise = this;
|
1116
|
-
|
1117
|
-
return new Promise(function (resolve, reject) {
|
1118
|
-
promise.deferred.push([onResolved, onRejected, resolve, reject]);
|
1119
|
-
promise.notify();
|
1120
|
-
});
|
1121
|
-
};
|
1122
|
-
|
1123
|
-
p.catch = function (onRejected) {
|
1124
|
-
return this.then(undefined, onRejected);
|
1125
|
-
};
|
1126
|
-
|
1127
|
-
module.exports = Promise;
|
1128
|
-
|
1129
|
-
/***/ },
|
1130
|
-
/* 12 */
|
1131
|
-
/***/ function(module, exports, __webpack_require__) {
|
1132
|
-
|
1133
|
-
/**
|
1134
|
-
* XMLHttp client.
|
1135
|
-
*/
|
1136
|
-
|
1137
|
-
var _ = __webpack_require__(1);
|
1138
|
-
var Promise = __webpack_require__(10);
|
1139
|
-
|
1140
|
-
module.exports = function (request) {
|
1141
|
-
return new Promise(function (resolve) {
|
1142
|
-
|
1143
|
-
var xhr = new XMLHttpRequest(),
|
1144
|
-
response = { request: request },
|
1145
|
-
handler;
|
1146
|
-
|
1147
|
-
request.cancel = function () {
|
1148
|
-
xhr.abort();
|
1149
|
-
};
|
1150
|
-
|
1151
|
-
xhr.open(request.method, _.url(request), true);
|
1152
|
-
|
1153
|
-
handler = function handler(event) {
|
1154
|
-
|
1155
|
-
response.data = xhr.responseText;
|
1156
|
-
response.status = xhr.status;
|
1157
|
-
response.statusText = xhr.statusText;
|
1158
|
-
response.headers = xhr.getAllResponseHeaders();
|
1156
|
+
options = isObject(url) ? url : extend({ url: url }, options);
|
1157
|
+
request = merge({}, Http.options, self.$options, options);
|
1158
|
+
promise = client(request).bind(self.$vm).then(function (response) {
|
1159
1159
|
|
1160
|
-
|
1161
|
-
|
1160
|
+
return response.ok ? response : Promise$1.reject(response);
|
1161
|
+
}, function (response) {
|
1162
1162
|
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
xhr.onerror = handler;
|
1167
|
-
xhr.ontimeout = function () {};
|
1168
|
-
xhr.onprogress = function () {};
|
1163
|
+
if (response instanceof Error) {
|
1164
|
+
error(response);
|
1165
|
+
}
|
1169
1166
|
|
1170
|
-
|
1171
|
-
|
1172
|
-
}
|
1167
|
+
return Promise$1.reject(response);
|
1168
|
+
});
|
1173
1169
|
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1170
|
+
if (request.success) {
|
1171
|
+
promise.success(request.success);
|
1172
|
+
}
|
1177
1173
|
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1174
|
+
if (request.error) {
|
1175
|
+
promise.error(request.error);
|
1176
|
+
}
|
1181
1177
|
|
1182
|
-
|
1183
|
-
|
1184
|
-
};
|
1178
|
+
return promise;
|
1179
|
+
}
|
1185
1180
|
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1181
|
+
Http.options = {
|
1182
|
+
method: 'get',
|
1183
|
+
data: '',
|
1184
|
+
params: {},
|
1185
|
+
headers: {},
|
1186
|
+
xhr: null,
|
1187
|
+
upload: null,
|
1188
|
+
jsonp: 'callback',
|
1189
|
+
beforeSend: null,
|
1190
|
+
crossOrigin: null,
|
1191
|
+
emulateHTTP: false,
|
1192
|
+
emulateJSON: false,
|
1193
|
+
timeout: 0
|
1194
|
+
};
|
1189
1195
|
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1196
|
+
Http.headers = {
|
1197
|
+
put: jsonType,
|
1198
|
+
post: jsonType,
|
1199
|
+
patch: jsonType,
|
1200
|
+
delete: jsonType,
|
1201
|
+
common: { 'Accept': 'application/json, text/plain, */*' },
|
1202
|
+
custom: { 'X-Requested-With': 'XMLHttpRequest' }
|
1203
|
+
};
|
1193
1204
|
|
1194
|
-
|
1195
|
-
var Promise = __webpack_require__(10);
|
1205
|
+
Http.interceptors = [exports$4, exports$7, exports$3, exports$5, exports$2, exports$6, exports$1];
|
1196
1206
|
|
1197
|
-
|
1207
|
+
['get', 'put', 'post', 'patch', 'delete', 'jsonp'].forEach(function (method) {
|
1198
1208
|
|
1199
|
-
|
1209
|
+
Http[method] = function (url, data, success, options) {
|
1200
1210
|
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1211
|
+
if (isFunction(data)) {
|
1212
|
+
options = success;
|
1213
|
+
success = data;
|
1214
|
+
data = undefined;
|
1215
|
+
}
|
1204
1216
|
|
1205
|
-
|
1217
|
+
if (isObject(success)) {
|
1218
|
+
options = success;
|
1219
|
+
success = undefined;
|
1220
|
+
}
|
1206
1221
|
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1222
|
+
return this(url, extend({ method: method, data: data, success: success }, options));
|
1223
|
+
};
|
1224
|
+
});
|
1210
1225
|
|
1211
|
-
|
1212
|
-
return when(client(request), function (response) {
|
1226
|
+
function Resource(url, params, actions, options) {
|
1213
1227
|
|
1214
|
-
|
1215
|
-
|
1216
|
-
}
|
1228
|
+
var self = this || {},
|
1229
|
+
resource = {};
|
1217
1230
|
|
1218
|
-
|
1219
|
-
});
|
1220
|
-
});
|
1221
|
-
};
|
1222
|
-
};
|
1223
|
-
};
|
1231
|
+
actions = extend({}, Resource.actions, actions);
|
1224
1232
|
|
1225
|
-
|
1233
|
+
each(actions, function (action, name) {
|
1226
1234
|
|
1227
|
-
|
1235
|
+
action = merge({ url: url, params: params || {} }, options, action);
|
1228
1236
|
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1237
|
+
resource[name] = function () {
|
1238
|
+
return (self.$http || Http)(opts(action, arguments));
|
1239
|
+
};
|
1240
|
+
});
|
1232
1241
|
|
1233
|
-
|
1234
|
-
|
1242
|
+
return resource;
|
1243
|
+
}
|
1235
1244
|
|
1236
|
-
|
1237
|
-
/* 14 */
|
1238
|
-
/***/ function(module, exports, __webpack_require__) {
|
1245
|
+
function opts(action, args) {
|
1239
1246
|
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1247
|
+
var options = extend({}, action),
|
1248
|
+
params = {},
|
1249
|
+
data,
|
1250
|
+
success,
|
1251
|
+
error;
|
1243
1252
|
|
1244
|
-
|
1253
|
+
switch (args.length) {
|
1245
1254
|
|
1246
|
-
|
1255
|
+
case 4:
|
1247
1256
|
|
1248
|
-
|
1257
|
+
error = args[3];
|
1258
|
+
success = args[2];
|
1249
1259
|
|
1250
|
-
|
1251
|
-
|
1252
|
-
}
|
1260
|
+
case 3:
|
1261
|
+
case 2:
|
1253
1262
|
|
1254
|
-
|
1255
|
-
}
|
1263
|
+
if (isFunction(args[1])) {
|
1256
1264
|
|
1257
|
-
|
1265
|
+
if (isFunction(args[0])) {
|
1258
1266
|
|
1259
|
-
|
1260
|
-
|
1261
|
-
/***/ function(module, exports) {
|
1267
|
+
success = args[0];
|
1268
|
+
error = args[1];
|
1262
1269
|
|
1263
|
-
|
1264
|
-
|
1265
|
-
*/
|
1270
|
+
break;
|
1271
|
+
}
|
1266
1272
|
|
1267
|
-
|
1273
|
+
success = args[1];
|
1274
|
+
error = args[2];
|
1275
|
+
} else {
|
1268
1276
|
|
1269
|
-
|
1277
|
+
params = args[0];
|
1278
|
+
data = args[1];
|
1279
|
+
success = args[2];
|
1270
1280
|
|
1271
|
-
|
1281
|
+
break;
|
1282
|
+
}
|
1272
1283
|
|
1273
|
-
|
1284
|
+
case 1:
|
1274
1285
|
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1286
|
+
if (isFunction(args[0])) {
|
1287
|
+
success = args[0];
|
1288
|
+
} else if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
|
1289
|
+
data = args[0];
|
1290
|
+
} else {
|
1291
|
+
params = args[0];
|
1292
|
+
}
|
1280
1293
|
|
1281
|
-
|
1282
|
-
},
|
1294
|
+
break;
|
1283
1295
|
|
1284
|
-
|
1296
|
+
case 0:
|
1285
1297
|
|
1286
|
-
|
1298
|
+
break;
|
1287
1299
|
|
1288
|
-
|
1289
|
-
}
|
1300
|
+
default:
|
1290
1301
|
|
1291
|
-
|
1292
|
-
|
1302
|
+
throw 'Expected up to 4 arguments [params, data, success, error], got ' + args.length + ' arguments';
|
1303
|
+
}
|
1293
1304
|
|
1294
|
-
|
1295
|
-
|
1296
|
-
/***/ function(module, exports, __webpack_require__) {
|
1305
|
+
options.data = data;
|
1306
|
+
options.params = extend({}, options.params, params);
|
1297
1307
|
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1308
|
+
if (success) {
|
1309
|
+
options.success = success;
|
1310
|
+
}
|
1301
1311
|
|
1302
|
-
|
1312
|
+
if (error) {
|
1313
|
+
options.error = error;
|
1314
|
+
}
|
1303
1315
|
|
1304
|
-
|
1316
|
+
return options;
|
1317
|
+
}
|
1305
1318
|
|
1306
|
-
|
1319
|
+
Resource.actions = {
|
1307
1320
|
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1321
|
+
get: { method: 'GET' },
|
1322
|
+
save: { method: 'POST' },
|
1323
|
+
query: { method: 'GET' },
|
1324
|
+
update: { method: 'PUT' },
|
1325
|
+
remove: { method: 'DELETE' },
|
1326
|
+
delete: { method: 'DELETE' }
|
1311
1327
|
|
1312
|
-
|
1313
|
-
}
|
1328
|
+
};
|
1314
1329
|
|
1315
|
-
|
1330
|
+
function plugin(Vue) {
|
1316
1331
|
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1332
|
+
if (plugin.installed) {
|
1333
|
+
return;
|
1334
|
+
}
|
1320
1335
|
|
1321
|
-
|
1322
|
-
* JSONP client.
|
1323
|
-
*/
|
1336
|
+
Util(Vue);
|
1324
1337
|
|
1325
|
-
|
1326
|
-
|
1338
|
+
Vue.url = Url;
|
1339
|
+
Vue.http = Http;
|
1340
|
+
Vue.resource = Resource;
|
1341
|
+
Vue.Promise = Promise$1;
|
1327
1342
|
|
1328
|
-
|
1329
|
-
return new Promise(function (resolve) {
|
1343
|
+
Object.defineProperties(Vue.prototype, {
|
1330
1344
|
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1345
|
+
$url: {
|
1346
|
+
get: function get() {
|
1347
|
+
return options(Vue.url, this, this.$options.url);
|
1348
|
+
}
|
1349
|
+
},
|
1335
1350
|
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1351
|
+
$http: {
|
1352
|
+
get: function get() {
|
1353
|
+
return options(Vue.http, this, this.$options.http);
|
1354
|
+
}
|
1355
|
+
},
|
1340
1356
|
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1357
|
+
$resource: {
|
1358
|
+
get: function get() {
|
1359
|
+
return Vue.resource.bind(this);
|
1360
|
+
}
|
1361
|
+
},
|
1345
1362
|
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1363
|
+
$promise: {
|
1364
|
+
get: function get() {
|
1365
|
+
var _this = this;
|
1349
1366
|
|
1350
|
-
|
1367
|
+
return function (executor) {
|
1368
|
+
return new Vue.Promise(executor, _this);
|
1369
|
+
};
|
1370
|
+
}
|
1371
|
+
}
|
1351
1372
|
|
1352
|
-
|
1353
|
-
|
1354
|
-
} else if (event.type === 'error') {
|
1355
|
-
response.status = 404;
|
1356
|
-
} else {
|
1357
|
-
response.status = 0;
|
1358
|
-
}
|
1373
|
+
});
|
1374
|
+
}
|
1359
1375
|
|
1360
|
-
|
1376
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
1377
|
+
window.Vue.use(plugin);
|
1378
|
+
}
|
1361
1379
|
|
1362
|
-
|
1363
|
-
document.body.removeChild(script);
|
1364
|
-
};
|
1380
|
+
return plugin;
|
1365
1381
|
|
1366
|
-
|
1367
|
-
script.onerror = handler;
|
1368
|
-
|
1369
|
-
document.body.appendChild(script);
|
1370
|
-
});
|
1371
|
-
};
|
1372
|
-
|
1373
|
-
/***/ },
|
1374
|
-
/* 18 */
|
1375
|
-
/***/ function(module, exports) {
|
1376
|
-
|
1377
|
-
/**
|
1378
|
-
* HTTP method override Interceptor.
|
1379
|
-
*/
|
1380
|
-
|
1381
|
-
module.exports = {
|
1382
|
-
|
1383
|
-
request: function request(_request) {
|
1384
|
-
|
1385
|
-
if (_request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(_request.method)) {
|
1386
|
-
_request.headers['X-HTTP-Method-Override'] = _request.method;
|
1387
|
-
_request.method = 'POST';
|
1388
|
-
}
|
1389
|
-
|
1390
|
-
return _request;
|
1391
|
-
}
|
1392
|
-
|
1393
|
-
};
|
1394
|
-
|
1395
|
-
/***/ },
|
1396
|
-
/* 19 */
|
1397
|
-
/***/ function(module, exports, __webpack_require__) {
|
1398
|
-
|
1399
|
-
/**
|
1400
|
-
* Mime Interceptor.
|
1401
|
-
*/
|
1402
|
-
|
1403
|
-
var _ = __webpack_require__(1);
|
1404
|
-
|
1405
|
-
module.exports = {
|
1406
|
-
|
1407
|
-
request: function request(_request) {
|
1408
|
-
|
1409
|
-
if (_request.emulateJSON && _.isPlainObject(_request.data)) {
|
1410
|
-
_request.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
1411
|
-
_request.data = _.url.params(_request.data);
|
1412
|
-
}
|
1413
|
-
|
1414
|
-
if (_.isObject(_request.data) && /FormData/i.test(_request.data.toString())) {
|
1415
|
-
delete _request.headers['Content-Type'];
|
1416
|
-
}
|
1417
|
-
|
1418
|
-
if (_.isPlainObject(_request.data)) {
|
1419
|
-
_request.data = JSON.stringify(_request.data);
|
1420
|
-
}
|
1421
|
-
|
1422
|
-
return _request;
|
1423
|
-
},
|
1424
|
-
|
1425
|
-
response: function response(_response) {
|
1426
|
-
|
1427
|
-
try {
|
1428
|
-
_response.data = JSON.parse(_response.data);
|
1429
|
-
} catch (e) {}
|
1430
|
-
|
1431
|
-
return _response;
|
1432
|
-
}
|
1433
|
-
|
1434
|
-
};
|
1435
|
-
|
1436
|
-
/***/ },
|
1437
|
-
/* 20 */
|
1438
|
-
/***/ function(module, exports, __webpack_require__) {
|
1439
|
-
|
1440
|
-
/**
|
1441
|
-
* Header Interceptor.
|
1442
|
-
*/
|
1443
|
-
|
1444
|
-
var _ = __webpack_require__(1);
|
1445
|
-
|
1446
|
-
module.exports = {
|
1447
|
-
|
1448
|
-
request: function request(_request) {
|
1449
|
-
|
1450
|
-
_request.method = _request.method.toUpperCase();
|
1451
|
-
_request.headers = _.extend({}, _.http.headers.common, !_request.crossOrigin ? _.http.headers.custom : {}, _.http.headers[_request.method.toLowerCase()], _request.headers);
|
1452
|
-
|
1453
|
-
if (_.isPlainObject(_request.data) && /^(GET|JSONP)$/i.test(_request.method)) {
|
1454
|
-
_.extend(_request.params, _request.data);
|
1455
|
-
delete _request.data;
|
1456
|
-
}
|
1457
|
-
|
1458
|
-
return _request;
|
1459
|
-
}
|
1460
|
-
|
1461
|
-
};
|
1462
|
-
|
1463
|
-
/***/ },
|
1464
|
-
/* 21 */
|
1465
|
-
/***/ function(module, exports, __webpack_require__) {
|
1466
|
-
|
1467
|
-
/**
|
1468
|
-
* CORS Interceptor.
|
1469
|
-
*/
|
1470
|
-
|
1471
|
-
var _ = __webpack_require__(1);
|
1472
|
-
var xdrClient = __webpack_require__(22);
|
1473
|
-
var xhrCors = 'withCredentials' in new XMLHttpRequest();
|
1474
|
-
var originUrl = _.url.parse(location.href);
|
1475
|
-
|
1476
|
-
module.exports = {
|
1477
|
-
|
1478
|
-
request: function request(_request) {
|
1479
|
-
|
1480
|
-
if (_request.crossOrigin === null) {
|
1481
|
-
_request.crossOrigin = crossOrigin(_request);
|
1482
|
-
}
|
1483
|
-
|
1484
|
-
if (_request.crossOrigin) {
|
1485
|
-
|
1486
|
-
if (!xhrCors) {
|
1487
|
-
_request.client = xdrClient;
|
1488
|
-
}
|
1489
|
-
|
1490
|
-
_request.emulateHTTP = false;
|
1491
|
-
}
|
1492
|
-
|
1493
|
-
return _request;
|
1494
|
-
}
|
1495
|
-
|
1496
|
-
};
|
1497
|
-
|
1498
|
-
function crossOrigin(request) {
|
1499
|
-
|
1500
|
-
var requestUrl = _.url.parse(_.url(request));
|
1501
|
-
|
1502
|
-
return requestUrl.protocol !== originUrl.protocol || requestUrl.host !== originUrl.host;
|
1503
|
-
}
|
1504
|
-
|
1505
|
-
/***/ },
|
1506
|
-
/* 22 */
|
1507
|
-
/***/ function(module, exports, __webpack_require__) {
|
1508
|
-
|
1509
|
-
/**
|
1510
|
-
* XDomain client (Internet Explorer).
|
1511
|
-
*/
|
1512
|
-
|
1513
|
-
var _ = __webpack_require__(1);
|
1514
|
-
var Promise = __webpack_require__(10);
|
1515
|
-
|
1516
|
-
module.exports = function (request) {
|
1517
|
-
return new Promise(function (resolve) {
|
1518
|
-
|
1519
|
-
var xdr = new XDomainRequest(),
|
1520
|
-
response = { request: request },
|
1521
|
-
handler;
|
1522
|
-
|
1523
|
-
request.cancel = function () {
|
1524
|
-
xdr.abort();
|
1525
|
-
};
|
1526
|
-
|
1527
|
-
xdr.open(request.method, _.url(request), true);
|
1528
|
-
|
1529
|
-
handler = function handler(event) {
|
1530
|
-
|
1531
|
-
response.data = xdr.responseText;
|
1532
|
-
response.status = xdr.status;
|
1533
|
-
response.statusText = xdr.statusText;
|
1534
|
-
|
1535
|
-
resolve(response);
|
1536
|
-
};
|
1537
|
-
|
1538
|
-
xdr.timeout = 0;
|
1539
|
-
xdr.onload = handler;
|
1540
|
-
xdr.onabort = handler;
|
1541
|
-
xdr.onerror = handler;
|
1542
|
-
xdr.ontimeout = function () {};
|
1543
|
-
xdr.onprogress = function () {};
|
1544
|
-
|
1545
|
-
xdr.send(request.data);
|
1546
|
-
});
|
1547
|
-
};
|
1548
|
-
|
1549
|
-
/***/ },
|
1550
|
-
/* 23 */
|
1551
|
-
/***/ function(module, exports, __webpack_require__) {
|
1552
|
-
|
1553
|
-
/**
|
1554
|
-
* Service for interacting with RESTful services.
|
1555
|
-
*/
|
1556
|
-
|
1557
|
-
var _ = __webpack_require__(1);
|
1558
|
-
|
1559
|
-
function Resource(url, params, actions, options) {
|
1560
|
-
|
1561
|
-
var self = this,
|
1562
|
-
resource = {};
|
1563
|
-
|
1564
|
-
actions = _.extend({}, Resource.actions, actions);
|
1565
|
-
|
1566
|
-
_.each(actions, function (action, name) {
|
1567
|
-
|
1568
|
-
action = _.merge({ url: url, params: params || {} }, options, action);
|
1569
|
-
|
1570
|
-
resource[name] = function () {
|
1571
|
-
return (self.$http || _.http)(opts(action, arguments));
|
1572
|
-
};
|
1573
|
-
});
|
1574
|
-
|
1575
|
-
return resource;
|
1576
|
-
}
|
1577
|
-
|
1578
|
-
function opts(action, args) {
|
1579
|
-
|
1580
|
-
var options = _.extend({}, action),
|
1581
|
-
params = {},
|
1582
|
-
data,
|
1583
|
-
success,
|
1584
|
-
error;
|
1585
|
-
|
1586
|
-
switch (args.length) {
|
1587
|
-
|
1588
|
-
case 4:
|
1589
|
-
|
1590
|
-
error = args[3];
|
1591
|
-
success = args[2];
|
1592
|
-
|
1593
|
-
case 3:
|
1594
|
-
case 2:
|
1595
|
-
|
1596
|
-
if (_.isFunction(args[1])) {
|
1597
|
-
|
1598
|
-
if (_.isFunction(args[0])) {
|
1599
|
-
|
1600
|
-
success = args[0];
|
1601
|
-
error = args[1];
|
1602
|
-
|
1603
|
-
break;
|
1604
|
-
}
|
1605
|
-
|
1606
|
-
success = args[1];
|
1607
|
-
error = args[2];
|
1608
|
-
} else {
|
1609
|
-
|
1610
|
-
params = args[0];
|
1611
|
-
data = args[1];
|
1612
|
-
success = args[2];
|
1613
|
-
|
1614
|
-
break;
|
1615
|
-
}
|
1616
|
-
|
1617
|
-
case 1:
|
1618
|
-
|
1619
|
-
if (_.isFunction(args[0])) {
|
1620
|
-
success = args[0];
|
1621
|
-
} else if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
|
1622
|
-
data = args[0];
|
1623
|
-
} else {
|
1624
|
-
params = args[0];
|
1625
|
-
}
|
1626
|
-
|
1627
|
-
break;
|
1628
|
-
|
1629
|
-
case 0:
|
1630
|
-
|
1631
|
-
break;
|
1632
|
-
|
1633
|
-
default:
|
1634
|
-
|
1635
|
-
throw 'Expected up to 4 arguments [params, data, success, error], got ' + args.length + ' arguments';
|
1636
|
-
}
|
1637
|
-
|
1638
|
-
options.data = data;
|
1639
|
-
options.params = _.extend({}, options.params, params);
|
1640
|
-
|
1641
|
-
if (success) {
|
1642
|
-
options.success = success;
|
1643
|
-
}
|
1644
|
-
|
1645
|
-
if (error) {
|
1646
|
-
options.error = error;
|
1647
|
-
}
|
1648
|
-
|
1649
|
-
return options;
|
1650
|
-
}
|
1651
|
-
|
1652
|
-
Resource.actions = {
|
1653
|
-
|
1654
|
-
get: { method: 'GET' },
|
1655
|
-
save: { method: 'POST' },
|
1656
|
-
query: { method: 'GET' },
|
1657
|
-
update: { method: 'PUT' },
|
1658
|
-
remove: { method: 'DELETE' },
|
1659
|
-
delete: { method: 'DELETE' }
|
1660
|
-
|
1661
|
-
};
|
1662
|
-
|
1663
|
-
module.exports = _.resource = Resource;
|
1664
|
-
|
1665
|
-
/***/ }
|
1666
|
-
/******/ ])
|
1667
|
-
});
|
1668
|
-
;
|
1382
|
+
}));
|