choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
65 lines (55 loc) • 1.47 kB
JavaScript
import _regeneratorRuntime from "@babel/runtime/regenerator";
import { action, observable } from 'mobx';
var KeyGen =
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee(id) {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!true) {
_context.next = 6;
break;
}
_context.next = 3;
return "modal-".concat(id);
case 3:
id += 1;
_context.next = 0;
break;
case 6:
case "end":
return _context.stop();
}
}
}, _callee);
})(1);
var containerInstances = observable.array();
var removeInstance = action(function (instance) {
var index = containerInstances.indexOf(instance);
if (index > -1) {
containerInstances.splice(index, 1);
}
});
var addInstance = action(function (instance) {
removeInstance(instance);
containerInstances.unshift(instance);
});
function getKey() {
return KeyGen.next().value;
}
function clear(closeByLocationChange) {
containerInstances.forEach(function (instance) {
instance.clear(closeByLocationChange);
});
}
var ModalManager = {
addInstance: addInstance,
removeInstance: removeInstance,
getKey: getKey,
mousePositionEventBound: new WeakSet(),
containerInstances: containerInstances,
clear: clear
};
export default ModalManager;
//# sourceMappingURL=index.js.map