@difizen/mana-core
Version:
87 lines (83 loc) • 5.65 kB
JavaScript
;
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DefaultToolbarItem = void 0;
var _manaCommon = require("@difizen/mana-common");
var _manaObservable = require("@difizen/mana-observable");
var _manaSyringe = require("@difizen/mana-syringe");
var _toolbarProtocol = require("./toolbar-protocol");
var _dec, _dec2, _dec3, _dec4, _dec5, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(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.defineProperty(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 and runs after the decorators transform.'); }
var DefaultToolbarItem = exports.DefaultToolbarItem = (_dec = (0, _manaSyringe.transient)(), _dec2 = (0, _manaObservable.prop)(), _dec3 = (0, _manaObservable.prop)(), _dec4 = (0, _manaObservable.prop)(), _dec5 = (0, _manaObservable.prop)(), _dec(_class = (_class2 = /*#__PURE__*/function () {
/**
* Optional label for the item.
*/
/**
* Optional tooltip for the item.
*/
/**
* Optional icon for the item.
*/
function DefaultToolbarItem(item) {
_classCallCheck(this, DefaultToolbarItem);
_initializerDefineProperty(this, "extra", _descriptor, this);
_initializerDefineProperty(this, "showLabelInline", _descriptor2, this);
_initializerDefineProperty(this, "order", _descriptor3, this);
_initializerDefineProperty(this, "group", _descriptor4, this);
this.disposedEventEmitter = new _manaCommon.Emitter();
this.onDisposed = this.disposedEventEmitter.event;
this.item = item;
this.source = item;
this.id = item.id;
this.command = item.command;
this.extra = item.extra;
this.order = item.order;
this.label = item.label;
this.tooltip = item.tooltip;
this.icon = item.icon;
this.meta = item.meta;
this.group = item.group;
this.showLabelInline = item.showLabelInline;
this.isActive = item.isActive;
this.isEnabled = item.isEnabled;
this.isVisible = item.isVisible;
this.execute = item.execute;
}
DefaultToolbarItem = (0, _manaSyringe.inject)(_toolbarProtocol.ToolbarNode)(DefaultToolbarItem, undefined, 0) || DefaultToolbarItem;
_createClass(DefaultToolbarItem, [{
key: "dispose",
value: function dispose() {
this.disposedEventEmitter.fire();
}
}]);
return DefaultToolbarItem;
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "extra", [_dec2], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "showLabelInline", [_dec3], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "order", [_dec4], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "group", [_dec5], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
})), _class2)) || _class);