UNPKG

tplus-pos

Version:

pos module

204 lines (156 loc) • 7.13 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty = require('babel-runtime/core-js/object/define-property'); var _defineProperty2 = _interopRequireDefault(_defineProperty); var _getOwnPropertyDescriptor = require('babel-runtime/core-js/object/get-own-property-descriptor'); var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor); var _promise = require('babel-runtime/core-js/promise'); var _promise2 = _interopRequireDefault(_promise); var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); var _createClass2 = require('babel-runtime/helpers/createClass'); var _createClass3 = _interopRequireDefault(_createClass2); var _inherits2 = require('babel-runtime/helpers/inherits'); var _inherits3 = _interopRequireDefault(_inherits2); var _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7; var _mobx = require('mobx'); var _mutantsAppfx = require('mutants-appfx'); var _tplusComponentsTouch = require('tplus-components-touch'); var _cloneDeep = require('lodash/cloneDeep'); var _cloneDeep2 = _interopRequireDefault(_cloneDeep); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _initDefineProp(target, property, descriptor, context) { if (!descriptor) return; (0, _defineProperty2.default)(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); } function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object['ke' + 'ys'](descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object['define' + 'Property'](target, property, desc); desc = null; } return desc; } function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } var Memo = (_class = function (_ViewBase) { (0, _inherits3.default)(Memo, _ViewBase); (0, _createClass3.default)(Memo, [{ key: 'type', get: function get() { return 'Memo'; } }]); function Memo(store, name) { (0, _classCallCheck3.default)(this, Memo); var _this = (0, _possibleConstructorReturn3.default)(this, (Memo.__proto__ || (0, _getPrototypeOf2.default)(Memo)).call(this, store, name)); _initDefineProp(_this, 'visible', _descriptor, _this); _initDefineProp(_this, 'title', _descriptor2, _this); _initDefineProp(_this, 'head', _descriptor3, _this); _initDefineProp(_this, 'body', _descriptor4, _this); _initDefineProp(_this, 'cancelEnable', _descriptor5, _this); _initDefineProp(_this, 'ok', _descriptor6, _this); _initDefineProp(_this, 'cancel', _descriptor7, _this); return _this; } (0, _createClass3.default)(Memo, [{ key: 'init', value: function init(initData) { var _this2 = this; initData = (0, _cloneDeep2.default)(initData); this.title = initData.title; this.head = initData.data.head; this.body = initData.data.body; this.cancelEnable = initData.cancelEnable; this.show(); return new _promise2.default(function (resolve, reject) { _this2.output = resolve; }); } }, { key: 'show', value: function show() { this.visible = true; } }, { key: 'hide', value: function hide() { this.visible = false; } }, { key: 'changeValue', value: function changeValue(el, value) { el.Value = value; } }], [{ key: 'fromJS', value: function fromJS(store) { return new Memo(store, 'Memo'); } }]); return Memo; }(_mutantsAppfx.ViewBase), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'visible', [_mobx.observable], { enumerable: true, initializer: function initializer() { return false; } }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'title', [_mobx.observable], { enumerable: true, initializer: null }), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, 'head', [_mobx.observable], { enumerable: true, initializer: null }), _descriptor4 = _applyDecoratedDescriptor(_class.prototype, 'body', [_mobx.observable], { enumerable: true, initializer: null }), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, 'cancelEnable', [_mobx.observable], { enumerable: true, initializer: null }), _applyDecoratedDescriptor(_class.prototype, 'init', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'init'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'show', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'show'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'hide', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'hide'), _class.prototype), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, 'ok', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this3 = this; return function () { _this3.hide(); _this3.output(_this3.body); }; } }), _descriptor7 = _applyDecoratedDescriptor(_class.prototype, 'cancel', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this4 = this; return function () { _this4.hide(); _this4.output(); }; } }), _applyDecoratedDescriptor(_class.prototype, 'changeValue', [_mobx.action], (0, _getOwnPropertyDescriptor2.default)(_class.prototype, 'changeValue'), _class.prototype)), _class); exports.default = Memo; //# sourceMappingURL=Memo.js.map