UNPKG

vxe-table-select-area

Version:

一个基于 vxe-table 的可区域选中复制、粘贴的组件

135 lines (134 loc) 5.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _utils = require("../../tools/utils"); var _conf = _interopRequireDefault(require("../../v-x-e-table/src/conf")); var _size = _interopRequireDefault(require("../../mixins/size")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } var _default2 = { name: 'VxeRadio', mixins: [_size["default"]], props: { value: [String, Number, Boolean], label: [String, Number, Boolean], title: [String, Number], content: [String, Number], disabled: Boolean, name: String, strict: { type: Boolean, "default": function _default() { return _conf["default"].radio.strict; } }, size: { type: String, "default": function _default() { return _conf["default"].radio.size || _conf["default"].size; } } }, inject: { $xeradiogroup: { "default": null }, $xeform: { "default": null }, $xeformiteminfo: { "default": null } }, computed: { isDisabled: function isDisabled() { var $xeradiogroup = this.$xeradiogroup; return this.disabled || $xeradiogroup && $xeradiogroup.disabled; }, isStrict: function isStrict() { var $xeradiogroup = this.$xeradiogroup; return $xeradiogroup ? $xeradiogroup.strict : this.strict; }, isChecked: function isChecked() { return this.$xeradiogroup ? this.$xeradiogroup.value === this.label : this.value === this.label; } }, render: function render(h) { var _ref; var $scopedSlots = this.$scopedSlots, $xeradiogroup = this.$xeradiogroup, isDisabled = this.isDisabled, isChecked = this.isChecked, title = this.title, vSize = this.vSize, name = this.name, content = this.content; var attrs = {}; if (title) { attrs.title = title; } return h('label', { "class": ['vxe-radio', (_ref = {}, _defineProperty(_ref, "size--".concat(vSize), vSize), _defineProperty(_ref, 'is--checked', isChecked), _defineProperty(_ref, 'is--disabled', isDisabled), _ref)], attrs: attrs }, [h('input', { "class": 'vxe-radio--input', attrs: { type: 'radio', name: $xeradiogroup ? $xeradiogroup.name : name, disabled: isDisabled }, domProps: { checked: isChecked }, on: { change: this.changeEvent, click: this.clickEvent } }), h('span', { "class": ['vxe-radio--icon', isChecked ? 'vxe-icon-radio-checked' : 'vxe-icon-radio-unchecked'] }), h('span', { "class": 'vxe-radio--label' }, $scopedSlots["default"] ? $scopedSlots["default"].call(this, {}) : [(0, _utils.getFuncText)(content)])]); }, methods: { handleValue: function handleValue(label, evnt) { var $xeradiogroup = this.$xeradiogroup; var params = { label: label, $event: evnt }; if ($xeradiogroup) { $xeradiogroup.handleChecked(params, evnt); } else { this.$emit('input', label); this.$emit('change', params); // 自动更新校验状态 if (this.$xeform && this.$xeformiteminfo) { this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, label); } } }, changeEvent: function changeEvent(evnt) { var isDisabled = this.isDisabled; if (!isDisabled) { this.handleValue(this.label, evnt); } }, clickEvent: function clickEvent(evnt) { var $xeradiogroup = this.$xeradiogroup, isDisabled = this.isDisabled, isStrict = this.isStrict; if (!isDisabled && !isStrict) { if (this.label === ($xeradiogroup ? $xeradiogroup.value : this.value)) { this.handleValue(null, evnt); } } } } }; exports["default"] = _default2;