UNPKG

tplus-pos

Version:

pos module

224 lines (171 loc) • 7.84 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 _regenerator = require('babel-runtime/regenerator'); var _regenerator2 = _interopRequireDefault(_regenerator); var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator'); var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2); 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; 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 Weigh = (_class = function (_ViewBase) { (0, _inherits3.default)(Weigh, _ViewBase); (0, _createClass3.default)(Weigh, [{ key: 'type', get: function get() { return 'Weigh'; } }]); function Weigh(store, name) { (0, _classCallCheck3.default)(this, Weigh); var _this = (0, _possibleConstructorReturn3.default)(this, (Weigh.__proto__ || (0, _getPrototypeOf2.default)(Weigh)).call(this, store, name)); _initDefineProp(_this, 'visible', _descriptor, _this); _initDefineProp(_this, 'title', _descriptor2, _this); _initDefineProp(_this, 'body', _descriptor3, _this); _initDefineProp(_this, 'cancelEnable', _descriptor4, _this); _initDefineProp(_this, 'ok', _descriptor5, _this); _initDefineProp(_this, 'cancel', _descriptor6, _this); return _this; } (0, _createClass3.default)(Weigh, [{ key: 'init', value: function () { var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(_ref2) { var _this2 = this; var title = _ref2.title, data = _ref2.data, autoCancel = _ref2.autoCancel; return _regenerator2.default.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return (0, _mobx.runInAction)(function () { _this2.title = title; _this2.body = data; _this2.show(); }); case 2: if (!isNaN(autoCancel)) { setTimeout(function () { _this2.hide(); }, Number(autoCancel)); } case 3: case 'end': return _context.stop(); } } }, _callee, this); })); function init(_x) { return _ref.apply(this, arguments); } return init; }() }, { key: 'show', value: function show() { this.visible = true; } }, { key: 'hide', value: function hide() { this.visible = false; } }], [{ key: 'fromJS', value: function fromJS(store) { return new Weigh(store, 'Weigh'); } }]); return Weigh; }(_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, 'body', [_mobx.observable], { enumerable: true, initializer: null }), _descriptor4 = _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), _descriptor5 = _applyDecoratedDescriptor(_class.prototype, 'ok', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this3 = this; return function () { _this3.hide(); _this3.output(_this3.body); }; } }), _descriptor6 = _applyDecoratedDescriptor(_class.prototype, 'cancel', [_mobx.action], { enumerable: true, initializer: function initializer() { var _this4 = this; return function () { _this4.hide(); _this4.output(); }; } })), _class); exports.default = Weigh; //# sourceMappingURL=Weigh.js.map