choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
77 lines (62 loc) • 1.74 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _mobx = require("mobx");
var KeyGen =
/*#__PURE__*/
_regenerator["default"].mark(function _callee(id) {
return _regenerator["default"].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 = _mobx.observable.array();
var removeInstance = (0, _mobx.action)(function (instance) {
var index = containerInstances.indexOf(instance);
if (index > -1) {
containerInstances.splice(index, 1);
}
});
var addInstance = (0, _mobx.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
};
var _default = ModalManager;
exports["default"] = _default;
//# sourceMappingURL=index.js.map