qm-bus
Version:
千米公有云业务组件库
138 lines (96 loc) • 5.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _DataViewStore3 = require('qm-ux/lib/DataViewStore');
var _DataViewStore4 = _interopRequireDefault(_DataViewStore3);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _categoryActor = require('./actor/category-actor');
var _categoryActor2 = _interopRequireDefault(_categoryActor);
var _galleryActor = require('./actor/gallery-actor');
var _galleryActor2 = _interopRequireDefault(_galleryActor);
var _uploadActor = require('./actor/upload-actor');
var _uploadActor2 = _interopRequireDefault(_uploadActor);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var AppStore = function (_DataViewStore) {
_inherits(AppStore, _DataViewStore);
_createClass(AppStore, [{
key: 'bindActor',
value: function bindActor() {
var actors = _get(AppStore.prototype.__proto__ || Object.getPrototypeOf(AppStore.prototype), 'bindActor', this).call(this);
actors = actors.concat([new _categoryActor2.default(), new _galleryActor2.default(), new _uploadActor2.default()]);
return actors;
}
}]);
function AppStore(props) {
_classCallCheck(this, AppStore);
var _this = _possibleConstructorReturn(this, (AppStore.__proto__ || Object.getPrototypeOf(AppStore)).call(this, props));
_this.switchview = function (value) {
return _this.dispatch('gallery:view', value);
};
_this.uploadSwitch = function (value) {
_this.dispatch('upload:switch', value);
};
_this.initCategory = function (value) {
_this.dispatch('initCategory', value);
};
_this.initLeaves = function (value) {
_this.dispatch('initLeaves', value);
};
_this.expand = function (expandedKeys) {
_this.dispatch('cate:expand', expandedKeys);
};
_this.onFormReset = function (group) {
_this.dispatch('form:reset', group);
_this.dispatch('gallery:searchKey', '');
};
_this.onSearch = function (value) {
_this.dispatch('gallery:searchKey', value);
};
_this.addNetImage = function (value) {
_this.dispatch('upload:addNetImage', value);
};
_this.removeNetImage = function (value) {
_this.dispatch('upload:removeNetImage', value);
};
_this.addImage = function (value) {
_this.dispatch('upload:addImage', value);
};
_this.removeImage = function (value) {
_this.dispatch('upload:removeImage', value);
};
_this.addVideo = function (value) {
_this.dispatch('upload:addVideo', value);
};
_this.removeVideo = function (value) {
_this.dispatch('upload:removeVideo', value);
};
_this.uploadClearAll = function () {
_this.dispatch('upload:clearAll');
};
_this.setLinkAddress = function (value) {
_this.dispatch('upload:setLinkAddress', value);
};
_this.set = function (_ref) {
var limit = _ref.limit,
scope = _ref.scope,
fileType = _ref.fileType;
_this.batchDispatch([['gallery:update:limit', limit], ['gallery:update:scope', scope], ['gallery:update:fileType', fileType]]);
};
_this.onRefresh = function () {
_this.batchDispatch([['page:update', { pageCurrent: 1 }], ['net:loading', true], 'form:syncSnap']);
_this.fetchData();
};
return _this;
}
/**
* 切换视图
*/
return AppStore;
}(_DataViewStore4.default);
exports.default = AppStore;