You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
3.9 KiB
101 lines
3.9 KiB
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
var _comp = require("../../ui/src/comp");
|
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
var _ui = require("../../ui");
|
|
var _vn = require("../../ui/src/vn");
|
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); }
|
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : 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); }
|
|
var _default2 = exports.default = /* define-vxe-component start */(0, _comp.defineVxeComponent)({
|
|
name: 'VxeAlert',
|
|
props: {
|
|
title: {
|
|
type: [String, Number],
|
|
default: function _default() {
|
|
return (0, _ui.getConfig)().alert.title;
|
|
}
|
|
},
|
|
content: [String, Number],
|
|
status: String,
|
|
showIcon: Boolean,
|
|
showClose: Boolean,
|
|
icon: {
|
|
type: String,
|
|
default: function _default() {
|
|
return (0, _ui.getConfig)().alert.icon;
|
|
}
|
|
}
|
|
},
|
|
data: function data() {
|
|
var xID = _xeUtils.default.uniqueId();
|
|
var reactData = {};
|
|
return {
|
|
xID: xID,
|
|
reactData: reactData
|
|
};
|
|
},
|
|
methods: {
|
|
//
|
|
// Method
|
|
//
|
|
dispatchEvent: function dispatchEvent(type, params, evnt) {
|
|
var $xeAlert = this;
|
|
this.$emit(type, (0, _ui.createEvent)(evnt, {
|
|
$alert: $xeAlert
|
|
}, params));
|
|
},
|
|
closeEvent: function closeEvent(evnt) {
|
|
var $xeAlert = this;
|
|
$xeAlert.dispatchEvent('close', {}, evnt);
|
|
},
|
|
//
|
|
// Render
|
|
//
|
|
renderVN: function renderVN(h) {
|
|
var $xeAlert = this;
|
|
var props = $xeAlert;
|
|
var slots = $xeAlert.$scopedSlots;
|
|
var status = props.status,
|
|
content = props.content,
|
|
icon = props.icon,
|
|
title = props.title,
|
|
showIcon = props.showIcon,
|
|
showClose = props.showClose;
|
|
var defaultSlot = slots.default;
|
|
var titleSlot = slots.title;
|
|
var iconSlot = slots.icon;
|
|
return h('div', {
|
|
ref: 'refElem',
|
|
class: ['vxe-alert', _defineProperty({}, "theme--".concat(status), status)]
|
|
}, [iconSlot || showIcon && status || icon ? h('div', {
|
|
class: 'vxe-alert--icon'
|
|
}, iconSlot ? (0, _vn.getSlotVNs)(iconSlot({})) : [h('i', {
|
|
class: icon || (0, _ui.getIcon)()["ALERT_".concat(status === null || status === void 0 ? void 0 : status.toUpperCase())]
|
|
})]) : (0, _ui.renderEmptyElement)($xeAlert), h('div', {
|
|
class: 'vxe-alert--body'
|
|
}, [titleSlot || title ? h('div', {
|
|
class: 'vxe-alert--title'
|
|
}, titleSlot ? (0, _vn.getSlotVNs)(titleSlot({})) : _xeUtils.default.toValueString(title)) : (0, _ui.renderEmptyElement)($xeAlert), h('div', {
|
|
class: 'vxe-alert--content'
|
|
}, defaultSlot ? (0, _vn.getSlotVNs)(defaultSlot({})) : _xeUtils.default.toValueString(content))]), showClose ? h('div', {
|
|
class: 'vxe-alert--close-btn',
|
|
on: {
|
|
click: $xeAlert.closeEvent
|
|
}
|
|
}, [h('i', {
|
|
class: (0, _ui.getIcon)().ALERT_CLOSE
|
|
})]) : (0, _ui.renderEmptyElement)($xeAlert)]);
|
|
}
|
|
},
|
|
render: function render(h) {
|
|
return this.renderVN(h);
|
|
}
|
|
});
|
|
/* define-vxe-component end */
|