Browse Source

Merge pull request #675 in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '8c5885703154381039de1b97c899f8f20579eb3b':
  build
  文件上传控件 multiple: true 时候选择多个文件会重复请求.
es6
Dailer 6 years ago
parent
commit
c047d51aa0
  1. 44
      dist/base.js
  2. 44
      dist/bundle.js
  3. 6
      dist/bundle.min.js
  4. 44
      dist/fineui.js
  5. 6
      dist/fineui.min.js
  6. 6
      src/base/single/input/file.js

44
dist/base.js vendored

@ -9196,15 +9196,15 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
return; return;
} }
for (var for (var
xhr = new XMLHttpRequest, xhr = new XMLHttpRequest,
upload = xhr.upload || { upload = xhr.upload || {
addEventListener: function (event, callback) { addEventListener: function (event, callback) {
this["on" + event] = callback; this["on" + event] = callback;
} }
}, },
i = 0; i = 0;
i < length; i < length;
i++ i++
) { ) {
upload.addEventListener( upload.addEventListener(
split[i].substring(2), split[i].substring(2),
@ -9259,7 +9259,9 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) { switch (xhr.readyState) {
case 2: case 2:
case 3: case 3:
if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;} if (rpe.total <= rpe.loaded) {
rpe.loaded = rpe.total;
}
upload.onprogress(rpe); upload.onprogress(rpe);
break; break;
case 4: case 4:
@ -9325,8 +9327,12 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = { rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () { loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total) {++rpe.loaded;} if (rpe.loaded < rpe.total) {
if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});} ++rpe.loaded;
}
if (isFunction(handler.onprogress)) {
handler.onprogress(rpe, {});
}
}, 100) }, 100)
}, },
onload = function () { onload = function () {
@ -9350,9 +9356,13 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO); handler.attach_array.push(attachO);
} }
} catch (e) { } catch (e) {
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || _global.event);} if (isFunction(handler.onerror)) {
handler.onerror(rpe, event || _global.event);
}
}
if (isFunction(handler.onload)) {
handler.onload(rpe, {responseText: responseText});
} }
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
}, },
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_"); target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ... try { // IE < 8 does not accept enctype attribute ...
@ -9594,11 +9604,11 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
} else { } else {
wrap.files.unshift(item); wrap.files.unshift(item);
// BI.Msg.toast(value); // BI.Msg.toast(value);
self.fireEvent(BI.File.EVENT_CHANGE, {
file: item
});
} }
} }
self.fireEvent(BI.File.EVENT_CHANGE, {
files: wrap.files
});
input.value = ""; input.value = "";
wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input); wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input);
wrap.dom.input = input; wrap.dom.input = input;

44
dist/bundle.js vendored

@ -44559,15 +44559,15 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
return; return;
} }
for (var for (var
xhr = new XMLHttpRequest, xhr = new XMLHttpRequest,
upload = xhr.upload || { upload = xhr.upload || {
addEventListener: function (event, callback) { addEventListener: function (event, callback) {
this["on" + event] = callback; this["on" + event] = callback;
} }
}, },
i = 0; i = 0;
i < length; i < length;
i++ i++
) { ) {
upload.addEventListener( upload.addEventListener(
split[i].substring(2), split[i].substring(2),
@ -44622,7 +44622,9 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) { switch (xhr.readyState) {
case 2: case 2:
case 3: case 3:
if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;} if (rpe.total <= rpe.loaded) {
rpe.loaded = rpe.total;
}
upload.onprogress(rpe); upload.onprogress(rpe);
break; break;
case 4: case 4:
@ -44688,8 +44690,12 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = { rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () { loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total) {++rpe.loaded;} if (rpe.loaded < rpe.total) {
if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});} ++rpe.loaded;
}
if (isFunction(handler.onprogress)) {
handler.onprogress(rpe, {});
}
}, 100) }, 100)
}, },
onload = function () { onload = function () {
@ -44713,9 +44719,13 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO); handler.attach_array.push(attachO);
} }
} catch (e) { } catch (e) {
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || _global.event);} if (isFunction(handler.onerror)) {
handler.onerror(rpe, event || _global.event);
}
}
if (isFunction(handler.onload)) {
handler.onload(rpe, {responseText: responseText});
} }
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
}, },
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_"); target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ... try { // IE < 8 does not accept enctype attribute ...
@ -44957,11 +44967,11 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
} else { } else {
wrap.files.unshift(item); wrap.files.unshift(item);
// BI.Msg.toast(value); // BI.Msg.toast(value);
self.fireEvent(BI.File.EVENT_CHANGE, {
file: item
});
} }
} }
self.fireEvent(BI.File.EVENT_CHANGE, {
files: wrap.files
});
input.value = ""; input.value = "";
wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input); wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input);
wrap.dom.input = input; wrap.dom.input = input;

6
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

44
dist/fineui.js vendored

@ -44801,15 +44801,15 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
return; return;
} }
for (var for (var
xhr = new XMLHttpRequest, xhr = new XMLHttpRequest,
upload = xhr.upload || { upload = xhr.upload || {
addEventListener: function (event, callback) { addEventListener: function (event, callback) {
this["on" + event] = callback; this["on" + event] = callback;
} }
}, },
i = 0; i = 0;
i < length; i < length;
i++ i++
) { ) {
upload.addEventListener( upload.addEventListener(
split[i].substring(2), split[i].substring(2),
@ -44864,7 +44864,9 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
switch (xhr.readyState) { switch (xhr.readyState) {
case 2: case 2:
case 3: case 3:
if (rpe.total <= rpe.loaded) {rpe.loaded = rpe.total;} if (rpe.total <= rpe.loaded) {
rpe.loaded = rpe.total;
}
upload.onprogress(rpe); upload.onprogress(rpe);
break; break;
case 4: case 4:
@ -44930,8 +44932,12 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"), var url = handler.url.concat(-1 === handler.url.indexOf("?") ? "?" : "&", "AjaxUploadFrame=true"),
rpe = { rpe = {
loaded: 1, total: 100, simulation: true, interval: setInterval(function () { loaded: 1, total: 100, simulation: true, interval: setInterval(function () {
if (rpe.loaded < rpe.total) {++rpe.loaded;} if (rpe.loaded < rpe.total) {
if (isFunction(handler.onprogress)) {handler.onprogress(rpe, {});} ++rpe.loaded;
}
if (isFunction(handler.onprogress)) {
handler.onprogress(rpe, {});
}
}, 100) }, 100)
}, },
onload = function () { onload = function () {
@ -44955,9 +44961,13 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
handler.attach_array.push(attachO); handler.attach_array.push(attachO);
} }
} catch (e) { } catch (e) {
if (isFunction(handler.onerror)) {handler.onerror(rpe, event || _global.event);} if (isFunction(handler.onerror)) {
handler.onerror(rpe, event || _global.event);
}
}
if (isFunction(handler.onload)) {
handler.onload(rpe, {responseText: responseText});
} }
if (isFunction(handler.onload)) {handler.onload(rpe, {responseText: responseText});}
}, },
target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_"); target = ["AjaxUpload", (new Date).getTime(), String(Math.random()).substring(2)].join("_");
try { // IE < 8 does not accept enctype attribute ... try { // IE < 8 does not accept enctype attribute ...
@ -45199,11 +45209,11 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
} else { } else {
wrap.files.unshift(item); wrap.files.unshift(item);
// BI.Msg.toast(value); // BI.Msg.toast(value);
self.fireEvent(BI.File.EVENT_CHANGE, {
file: item
});
} }
} }
self.fireEvent(BI.File.EVENT_CHANGE, {
files: wrap.files
});
input.value = ""; input.value = "";
wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input); wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input);
wrap.dom.input = input; wrap.dom.input = input;

6
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

6
src/base/single/input/file.js

@ -508,11 +508,11 @@
} else { } else {
wrap.files.unshift(item); wrap.files.unshift(item);
// BI.Msg.toast(value); // BI.Msg.toast(value);
self.fireEvent(BI.File.EVENT_CHANGE, {
file: item
});
} }
} }
self.fireEvent(BI.File.EVENT_CHANGE, {
files: wrap.files
});
input.value = ""; input.value = "";
wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input); wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input);
wrap.dom.input = input; wrap.dom.input = input;

Loading…
Cancel
Save