Browse Source

Up Assets events list

pull/4080/head
Artur Arseniev 5 years ago
parent
commit
86d65a3618
  1. 25
      src/asset_manager/index.js

25
src/asset_manager/index.js

@ -63,6 +63,11 @@ export const evRemoveBefore = `${evRemove}:before`;
export const evCustom = `${evPfx}custom`; export const evCustom = `${evPfx}custom`;
export const evOpen = `${evPfx}open`; export const evOpen = `${evPfx}open`;
export const evClose = `${evPfx}close`; export const evClose = `${evPfx}close`;
export const evUpload = `${evPfx}upload`;
export const evUploadStart = `${evUpload}:start`;
export const evUploadEnd = `${evUpload}:end`;
export const evUploadError = `${evUpload}:error`;
export const evUploadRes = `${evUpload}:response`;
export default () => { export default () => {
let c = {}; let c = {};
@ -89,7 +94,11 @@ export default () => {
removeBefore: evRemoveBefore, removeBefore: evRemoveBefore,
custom: evCustom, custom: evCustom,
open: evOpen, open: evOpen,
close: evClose close: evClose,
uploadStart: evUploadStart,
uploadEnd: evUploadEnd,
uploadError: evUploadError,
uploadResponse: evUploadRes,
}, },
init(config = {}) { init(config = {}) {
@ -121,7 +130,7 @@ export default () => {
this.getAll().trigger(ev, ...data); this.getAll().trigger(ev, ...data);
}, },
__onAllEvent: debounce(function() { __onAllEvent: debounce(function () {
this.__trgCustom(); this.__trgCustom();
}), }),
@ -148,7 +157,7 @@ export default () => {
isFunction(bhv.select) && bhv.select(res, complete); isFunction(bhv.select) && bhv.select(res, complete);
}, },
// extra // extra
options: bhv.options || {} options: bhv.options || {},
}; };
}, },
@ -177,7 +186,7 @@ export default () => {
cmd.run(assetCmd, { cmd.run(assetCmd, {
types: ['image'], types: ['image'],
select: () => {}, select: () => {},
...options ...options,
}); });
}, },
@ -355,14 +364,14 @@ export default () => {
collection: assetsVis, // Collection visible in asset manager collection: assetsVis, // Collection visible in asset manager
globalCollection: assets, globalCollection: assets,
config: c, config: c,
module: this module: this,
}; };
fu = new FileUpload(obj); fu = new FileUpload(obj);
obj.fu = fu; obj.fu = fu;
const el = am && am.el; const el = am && am.el;
am = new AssetsView({ am = new AssetsView({
el, el,
...obj ...obj,
}); });
am.render(); am.render();
} }
@ -469,7 +478,7 @@ export default () => {
__behaviour(opts = {}) { __behaviour(opts = {}) {
return (this._bhv = { return (this._bhv = {
...(this._bhv || {}), ...(this._bhv || {}),
...opts ...opts,
}); });
}, },
@ -487,6 +496,6 @@ export default () => {
[assets, am, fu].forEach(i => (i = null)); [assets, am, fu].forEach(i => (i = null));
this._bhv = {}; this._bhv = {};
c = {}; c = {};
} },
}; };
}; };

Loading…
Cancel
Save