@v2coding/ui 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v2coding-ui.esm.js +123 -5
- package/dist/v2coding-ui.min.js +2 -2
- package/dist/v2coding-ui.ssr.js +126 -8
- package/package.json +1 -1
package/dist/v2coding-ui.esm.js
CHANGED
|
@@ -128,6 +128,90 @@ const DefaultSetting = {
|
|
|
128
128
|
};
|
|
129
129
|
var DefaultSetting$1 = DefaultSetting;
|
|
130
130
|
|
|
131
|
+
const defaultOptions = {
|
|
132
|
+
timeout: 30000,
|
|
133
|
+
jsonpCallback: 'callback',
|
|
134
|
+
jsonpCallbackFunction: null
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
function generateCallbackFunction() {
|
|
138
|
+
return `jsonp_${Date.now()}_${Math.ceil(Math.random() * 100000)}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function clearFunction(functionName) {
|
|
142
|
+
// IE8 throws an exception when you try to delete a property on window
|
|
143
|
+
// http://stackoverflow.com/a/1824228/751089
|
|
144
|
+
try {
|
|
145
|
+
delete window[functionName];
|
|
146
|
+
} catch (e) {
|
|
147
|
+
window[functionName] = undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function removeScript(scriptId) {
|
|
152
|
+
const script = document.getElementById(scriptId);
|
|
153
|
+
|
|
154
|
+
if (script) {
|
|
155
|
+
document.getElementsByTagName('head')[0].removeChild(script);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function jsonp(_url) {
|
|
160
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
161
|
+
// to avoid param reassign
|
|
162
|
+
let url = _url;
|
|
163
|
+
const timeout = options.timeout || defaultOptions.timeout;
|
|
164
|
+
const jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
|
|
165
|
+
let timeoutId;
|
|
166
|
+
return new Promise((resolve, reject) => {
|
|
167
|
+
const callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
|
|
168
|
+
const scriptId = `${jsonpCallback}_${callbackFunction}`;
|
|
169
|
+
|
|
170
|
+
window[callbackFunction] = response => {
|
|
171
|
+
resolve({
|
|
172
|
+
ok: true,
|
|
173
|
+
// keep consistent with fetch API
|
|
174
|
+
json: () => Promise.resolve(response)
|
|
175
|
+
});
|
|
176
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
177
|
+
removeScript(scriptId);
|
|
178
|
+
clearFunction(callbackFunction);
|
|
179
|
+
}; // Check if the user set their own params, and if not add a ? to start a list of params
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
url += url.indexOf('?') === -1 ? '?' : '&';
|
|
183
|
+
const jsonpScript = document.createElement('script');
|
|
184
|
+
jsonpScript.src = `${url}${jsonpCallback}=${callbackFunction}`;
|
|
185
|
+
|
|
186
|
+
if (options.nonce) {
|
|
187
|
+
jsonpScript.nonce = options.nonce;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (options.referrerPolicy) {
|
|
191
|
+
jsonpScript.referrerPolicy = options.referrerPolicy;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
jsonpScript.id = scriptId;
|
|
195
|
+
document.head.appendChild(jsonpScript);
|
|
196
|
+
timeoutId = setTimeout(() => {
|
|
197
|
+
reject(new Error(`JSONP request to ${_url} timed out`));
|
|
198
|
+
clearFunction(callbackFunction);
|
|
199
|
+
removeScript(scriptId);
|
|
200
|
+
|
|
201
|
+
window[callbackFunction] = () => {
|
|
202
|
+
clearFunction(callbackFunction);
|
|
203
|
+
};
|
|
204
|
+
}, timeout); // Caught if got 404/500
|
|
205
|
+
|
|
206
|
+
jsonpScript.onerror = () => {
|
|
207
|
+
reject(new Error(`JSONP request to ${_url} failed`));
|
|
208
|
+
clearFunction(callbackFunction);
|
|
209
|
+
removeScript(scriptId);
|
|
210
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
131
215
|
const downloadFile = (data, filename, mime) => {
|
|
132
216
|
const blob = new Blob([data], {
|
|
133
217
|
type: mime || data.type || 'application/octet-stream'
|
|
@@ -268,6 +352,7 @@ const init$2 = function (Vue) {
|
|
|
268
352
|
instance.interceptors.response.use(onResponseSuccess, onResponseError);
|
|
269
353
|
downloadInstance.interceptors.request.use(onRequestSuccess);
|
|
270
354
|
downloadInstance.interceptors.response.use(onResponseSuccess, onResponseError);
|
|
355
|
+
instance.jsonp = jsonp;
|
|
271
356
|
instance.download = initDownload(downloadInstance);
|
|
272
357
|
instance.downloadServer = downloadInstance;
|
|
273
358
|
Vue.prototype.$axios = instance;
|
|
@@ -7830,6 +7915,8 @@ var FormDialog = __vue_component__$f;
|
|
|
7830
7915
|
//
|
|
7831
7916
|
//
|
|
7832
7917
|
//
|
|
7918
|
+
//
|
|
7919
|
+
//
|
|
7833
7920
|
var script$e = {
|
|
7834
7921
|
name: 'ui-drawer',
|
|
7835
7922
|
inheritAttrs: false,
|
|
@@ -7842,6 +7929,14 @@ var script$e = {
|
|
|
7842
7929
|
},
|
|
7843
7930
|
customClass: {
|
|
7844
7931
|
type: String
|
|
7932
|
+
},
|
|
7933
|
+
wrapperClosable: {
|
|
7934
|
+
type: Boolean,
|
|
7935
|
+
default: false
|
|
7936
|
+
},
|
|
7937
|
+
closeOnPressEscape: {
|
|
7938
|
+
type: Boolean,
|
|
7939
|
+
default: false
|
|
7845
7940
|
}
|
|
7846
7941
|
},
|
|
7847
7942
|
computed: {
|
|
@@ -7884,7 +7979,9 @@ var __vue_render__$d = function () {
|
|
|
7884
7979
|
attrs: {
|
|
7885
7980
|
"size": _vm.width,
|
|
7886
7981
|
"visible": _vm.realVisible,
|
|
7887
|
-
"custom-class": _vm.realCustomClass
|
|
7982
|
+
"custom-class": _vm.realCustomClass,
|
|
7983
|
+
"wrapper-closable": _vm.wrapperClosable,
|
|
7984
|
+
"close-on-press-escape": _vm.closeOnPressEscape
|
|
7888
7985
|
},
|
|
7889
7986
|
on: {
|
|
7890
7987
|
"update:visible": _vm.onUpdateVisible
|
|
@@ -7897,7 +7994,7 @@ var __vue_staticRenderFns__$d = [];
|
|
|
7897
7994
|
|
|
7898
7995
|
const __vue_inject_styles__$e = function (inject) {
|
|
7899
7996
|
if (!inject) return;
|
|
7900
|
-
inject("data-v-
|
|
7997
|
+
inject("data-v-0affe6b4_0", {
|
|
7901
7998
|
source: ".ui-drawer .el-drawer__header{margin:0;padding:14px 16px;height:50px;border-bottom:1px solid #e8eaec;display:flex;flex-direction:row;align-items:center}.ui-drawer .el-drawer__header>span:first-child{color:#17233d}.ui-drawer .el-drawer__body{height:calc(100% - 51px);display:flex;flex-direction:column}",
|
|
7902
7999
|
map: undefined,
|
|
7903
8000
|
media: undefined
|
|
@@ -11003,6 +11100,22 @@ var Drag = {
|
|
|
11003
11100
|
|
|
11004
11101
|
};
|
|
11005
11102
|
|
|
11103
|
+
//
|
|
11104
|
+
//
|
|
11105
|
+
//
|
|
11106
|
+
//
|
|
11107
|
+
//
|
|
11108
|
+
//
|
|
11109
|
+
//
|
|
11110
|
+
//
|
|
11111
|
+
//
|
|
11112
|
+
//
|
|
11113
|
+
//
|
|
11114
|
+
//
|
|
11115
|
+
//
|
|
11116
|
+
//
|
|
11117
|
+
//
|
|
11118
|
+
//
|
|
11006
11119
|
//
|
|
11007
11120
|
//
|
|
11008
11121
|
//
|
|
@@ -11036,6 +11149,10 @@ var script$6 = {
|
|
|
11036
11149
|
type: Boolean,
|
|
11037
11150
|
default: false
|
|
11038
11151
|
},
|
|
11152
|
+
closeOnPressEscape: {
|
|
11153
|
+
type: Boolean,
|
|
11154
|
+
default: false
|
|
11155
|
+
},
|
|
11039
11156
|
destroyOnClose: {
|
|
11040
11157
|
type: Boolean,
|
|
11041
11158
|
default: true
|
|
@@ -11140,6 +11257,7 @@ var __vue_render__$6 = function () {
|
|
|
11140
11257
|
"visible": _vm.visible,
|
|
11141
11258
|
"width": _vm.width,
|
|
11142
11259
|
"close-on-click-modal": _vm.closeOnClickModal,
|
|
11260
|
+
"close-on-press-escape": _vm.closeOnPressEscape,
|
|
11143
11261
|
"destroy-on-close": _vm.destroyOnClose,
|
|
11144
11262
|
"show-close": false
|
|
11145
11263
|
},
|
|
@@ -11188,8 +11306,8 @@ var __vue_staticRenderFns__$6 = [];
|
|
|
11188
11306
|
|
|
11189
11307
|
const __vue_inject_styles__$6 = function (inject) {
|
|
11190
11308
|
if (!inject) return;
|
|
11191
|
-
inject("data-v-
|
|
11192
|
-
source: ".ui-dialog[data-v-
|
|
11309
|
+
inject("data-v-9674bbd8_0", {
|
|
11310
|
+
source: ".ui-dialog[data-v-9674bbd8] .el-dialog{margin-bottom:0}.ui-dialog[data-v-9674bbd8] .el-dialog .title{position:relative;line-height:28px;padding:12px 48px 12px 24px;word-break:keep-all;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-bottom:1px solid #e8e8e8;color:#202124;font-weight:500;font-size:16px}.ui-dialog[data-v-9674bbd8] .el-dialog .title .close{position:absolute;right:0;top:0;bottom:0;width:53px;height:53px;display:inline-block;text-align:center;cursor:pointer;transition:all .3s;user-select:none}.ui-dialog[data-v-9674bbd8] .el-dialog .title .close:hover{color:var(--color-primary)}.ui-dialog[data-v-9674bbd8] .el-dialog .title .close>i{font-size:20px;line-height:53px}[data-v-9674bbd8] .el-form .ui-form-fieldset:first-child{margin-top:0}[data-v-9674bbd8] .el-form .ui-form-fieldset:last-child{margin-bottom:0}[data-v-9674bbd8] .el-dialog__header{padding:0;user-select:none}[data-v-9674bbd8] .el-dialog__body{padding-bottom:20px}[data-v-9674bbd8] .el-dialog__footer{padding:10px 20px;border-top:1px solid #dcdfe6}.el-dialog__footer .el-button[data-v-9674bbd8]{border-radius:2px}@keyframes rotate-data-v-9674bbd8{from{transform:rotate(0)}to{transform:rotate(360deg)}}",
|
|
11193
11311
|
map: undefined,
|
|
11194
11312
|
media: undefined
|
|
11195
11313
|
});
|
|
@@ -11197,7 +11315,7 @@ const __vue_inject_styles__$6 = function (inject) {
|
|
|
11197
11315
|
/* scoped */
|
|
11198
11316
|
|
|
11199
11317
|
|
|
11200
|
-
const __vue_scope_id__$6 = "data-v-
|
|
11318
|
+
const __vue_scope_id__$6 = "data-v-9674bbd8";
|
|
11201
11319
|
/* module identifier */
|
|
11202
11320
|
|
|
11203
11321
|
const __vue_module_identifier__$6 = undefined;
|