lin-view-ui
Version:
vue components library
415 lines (380 loc) • 11.5 kB
JavaScript
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var fails$2 = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
var fails$1 = fails$2;
// Detect IE8's incomplete defineProperty implementation
var descriptors = !fails$1(function () {
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
var objectDefineProperty = {};
var check = function (it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global$2 =
// eslint-disable-next-line es/no-global-this -- safe
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
// eslint-disable-next-line no-restricted-globals -- safe
check(typeof self == 'object' && self) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
// eslint-disable-next-line no-new-func -- fallback
(function () { return this; })() || Function('return this')();
var isObject$3 = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
var global$1 = global$2;
var isObject$2 = isObject$3;
var document = global$1.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject$2(document) && isObject$2(document.createElement);
var documentCreateElement = function (it) {
return EXISTS ? document.createElement(it) : {};
};
var DESCRIPTORS$2 = descriptors;
var fails = fails$2;
var createElement = documentCreateElement;
// Thank's IE8 for his funny defineProperty
var ie8DomDefine = !DESCRIPTORS$2 && !fails(function () {
// eslint-disable-next-line es/no-object-defineproperty -- requied for testing
return Object.defineProperty(createElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
var isObject$1 = isObject$3;
var anObject$1 = function (it) {
if (!isObject$1(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
var isObject = isObject$3;
// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var toPrimitive$1 = function (input, PREFERRED_STRING) {
if (!isObject(input)) return input;
var fn, val;
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
throw TypeError("Can't convert object to primitive value");
};
var DESCRIPTORS$1 = descriptors;
var IE8_DOM_DEFINE = ie8DomDefine;
var anObject = anObject$1;
var toPrimitive = toPrimitive$1;
// eslint-disable-next-line es/no-object-defineproperty -- safe
var $defineProperty = Object.defineProperty;
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
objectDefineProperty.f = DESCRIPTORS$1 ? $defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return $defineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var DESCRIPTORS = descriptors;
var defineProperty = objectDefineProperty.f;
var FunctionPrototype = Function.prototype;
var FunctionPrototypeToString = FunctionPrototype.toString;
var nameRE = /^\s*function ([^ (]*)/;
var NAME = 'name';
// Function instances `.name` property
// https://tc39.es/ecma262/#sec-function-instances-name
if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
defineProperty(FunctionPrototype, NAME, {
configurable: true,
get: function () {
try {
return FunctionPrototypeToString.call(this).match(nameRE)[1];
} catch (error) {
return '';
}
}
});
}
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script = {
name: "LinAlert",
props: {
// 标题
title: {
type: String,
default: ""
},
// 辅助性文字
description: {
type: String,
default: ""
},
// 图标
icon: {
type: String,
default: ""
},
// 是否可关闭
closable: {
type: Boolean,
default: false
},
// 类型
type: {
type: String,
default: "success",
options: ["success", "warning", "info", "danger"]
},
// 主题
effect: {
type: String,
default: "light",
options: ["light", "dark"]
},
// 文字是否居中
center: {
type: Boolean,
default: false
}
},
data: function data() {
return {
// 是否显示
show: true
};
},
methods: {
onCloseClick: function onCloseClick() {
this.show = false;
},
afterLeave: function afterLeave() {
this.$emit("close");
}
}
};
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
if (typeof shadowMode !== 'boolean') {
createInjectorSSR = createInjector;
createInjector = shadowMode;
shadowMode = false;
}
// Vue.extend constructor export interop.
const options = typeof script === 'function' ? script.options : script;
// render functions
if (template && template.render) {
options.render = template.render;
options.staticRenderFns = template.staticRenderFns;
options._compiled = true;
// functional template
if (isFunctionalTemplate) {
options.functional = true;
}
}
// scopedId
if (scopeId) {
options._scopeId = scopeId;
}
let hook;
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__;
}
// inject component styles
if (style) {
style.call(this, createInjectorSSR(context));
}
// register component module identifier for async chunk inference
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook;
}
else if (style) {
hook = shadowMode
? function (context) {
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
}
: function (context) {
style.call(this, createInjector(context));
};
}
if (hook) {
if (options.functional) {
// register for functional component in vue file
const originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
}
else {
// inject component registration as beforeCreate hook
const existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return script;
}
/* script */
const __vue_script__ = script;
/* template */
var __vue_render__ = function() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c(
"transition",
{
attrs: { name: "lin-alert-fade" },
on: { "after-leave": _vm.afterLeave }
},
[
_vm.show
? _c(
"div",
{
class: [
"lin-alert",
"lin-alert-" + _vm.type,
"lin-alert-" + _vm.effect,
{ "lin-alert-center": _vm.center }
]
},
[
_vm._t("icon", function() {
return [
_vm.icon
? _c("i", { class: ["lin-alert-icon", _vm.icon] })
: _vm._e()
]
}),
_vm._v(" "),
_c(
"div",
{ staticClass: "lin-alert-content" },
[
_vm._t("title", function() {
return [
_c("span", { staticClass: "lin-alert-title" }, [
_vm._v(_vm._s(_vm.title))
])
]
}),
_vm._v(" "),
_vm._t("description", function() {
return [
_vm.description
? _c("span", { staticClass: "lin-alert-description" }, [
_vm._v(_vm._s(_vm.description))
])
: _vm._e()
]
})
],
2
),
_vm._v(" "),
_vm.closable
? _c(
"span",
{
staticClass: "lin-alert-close",
on: { click: _vm.onCloseClick }
},
[
_vm._t("close", function() {
return [_c("i", { staticClass: "lin-icon-close" })]
})
],
2
)
: _vm._e()
],
2
)
: _vm._e()
]
)
};
var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = undefined;
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__ = /*#__PURE__*/normalizeComponent(
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
__vue_inject_styles__,
__vue_script__,
__vue_scope_id__,
__vue_is_functional_template__,
__vue_module_identifier__,
false,
undefined,
undefined,
undefined
);
__vue_component__.install = function (Vue) {
return Vue.component(__vue_component__.name, __vue_component__);
};
export default __vue_component__;