UNPKG

dm-vue3-ui

Version:

This Components Library will help get you started developing in Vue 3.

1,514 lines (1,501 loc) 1.86 MB
var __defProp = Object.defineProperty; var __defNormalProp = (obj, key2, value2) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key2] = value2; var __publicField = (obj, key2, value2) => { __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value2); return value2; }; import * as vue from "vue"; import { useSlots, reactive, computed, defineComponent, ref, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withKeys, withModifiers, withCtx, createElementBlock, createCommentVNode, renderSlot, unref, nextTick, pushScopeId, popScopeId, createElementVNode, Fragment, isVNode as isVNode$1, Comment, Text, getCurrentInstance, onMounted, onUpdated, onUnmounted, watch, inject, createVNode, provide, Transition, Teleport, TransitionGroup, render, h as h$1, watchEffect, withDirectives, resolveDirective, onBeforeUnmount, cloneVNode, toRef, vShow, onBeforeMount, createTextVNode, isRef, toRefs, shallowRef, toRaw, useAttrs, onBeforeUpdate, getCurrentScope, onScopeDispose, camelize as camelize$1, effectScope, renderList, toDisplayString as toDisplayString$1, resolveComponent, useCssVars, normalizeStyle, mergeProps, createSlots } from "vue"; import dayjs from "dayjs"; import { DownOutlined as DownOutlined$3, ClockCircleOutlined as ClockCircleOutlined$3, CloseCircleOutlined as CloseCircleOutlined$3, SearchOutlined as SearchOutlined$3, DeleteOutlined, LeftOutlined, CloseCircleFilled as CloseCircleFilled$3 } from "@ant-design/icons-vue"; import { useVModel } from "@vueuse/core"; const SEARCH_TEMPLATE_KEY = "di-alert-search-template"; const addTemplate = (moduleKey, value2) => { const templateInfo = store(SEARCH_TEMPLATE_KEY) && JSON.parse(store(SEARCH_TEMPLATE_KEY)) || {}; const currentModuleInfo = templateInfo[moduleKey] || []; const index2 = currentModuleInfo.findIndex((v2) => v2.name === value2.name); index2 === -1 || currentModuleInfo.splice(index2, 1); currentModuleInfo.push(value2); templateInfo[moduleKey] = currentModuleInfo; store(SEARCH_TEMPLATE_KEY, JSON.stringify(templateInfo)); }; const getTemplatesByModuleKey = (moduleKey) => { const templateInfo = store(SEARCH_TEMPLATE_KEY) && JSON.parse(store(SEARCH_TEMPLATE_KEY)) || {}; const currentModuleTemplates = templateInfo[moduleKey] || []; return currentModuleTemplates; }; const deleteTemplate1 = (moduleKey, templateName) => { const templateInfo = store(SEARCH_TEMPLATE_KEY) && JSON.parse(store(SEARCH_TEMPLATE_KEY)) || {}; const currentModuleInfo = templateInfo[moduleKey] || []; const index2 = currentModuleInfo.findIndex((v2) => v2.name === templateName); index2 === -1 || currentModuleInfo.splice(index2, 1); templateInfo[moduleKey] = currentModuleInfo; store(SEARCH_TEMPLATE_KEY, JSON.stringify(templateInfo)); }; const validateRangeDateValue = (value2) => { if (Array.isArray(value2) && value2.length === 2) { return value2.every((v2) => v2 && dayjs(v2).isValid()); } else { return false; } }; function store(key2, value2) { function _parse(a2) { try { return JSON.parse(a2); } catch (b2) { return a2; } } if (typeof window !== "undefined" && (window == null ? void 0 : window.localStorage)) { try { if (void 0 === value2) { value2 = localStorage.getItem(key2); return value2 && _parse(value2); } else { localStorage.setItem(key2, JSON.stringify(value2)); } } catch (e2) { console.log("not support localstorage"); } } } function useSlotsExist(slotsName = "default") { const slots = useSlots(); const checkSlotsExist = (slotsName2) => { var _a; const slotsContent = (_a = slots[slotsName2]) == null ? void 0 : _a.call(slots); const checkExist = (slotContent) => { if (typeof slotContent.children === "string") { if (slotContent.children === "v-if") { return false; } return slotContent.children.trim() !== ""; } else { if (slotContent.children === null) { if (slotContent.type === "img" || typeof slotContent.type !== "string") { return true; } } else { return Boolean(slotContent.children); } } }; if (slotsContent && (slotsContent == null ? void 0 : slotsContent.length)) { const result = slotsContent.some((slotContent) => { return checkExist(slotContent); }); return result; } return false; }; if (Array.isArray(slotsName)) { const slotsExist = reactive({}); slotsName.forEach((item) => { const exist = computed(() => checkSlotsExist(item)); slotsExist[item] = exist; }); return slotsExist; } else { return computed(() => checkSlotsExist(slotsName)); } } const _ThemeManager = class _ThemeManager { constructor() { __publicField(this, "currentTheme"); __publicField(this, "originalTheme"); __publicField(this, "themeConfigs", { default: { primaryColor: "#7858fc", borderRadius: "4px", borderColor: "rgba(147, 154, 189, 0.5)" }, blue: { primaryColor: "#2468f2", borderRadius: "4px", borderColor: "rgba(147, 154, 189, 0.5)" } }); this.originalTheme = this.themeConfigs.default; this.currentTheme = { ...this.originalTheme }; } static getInstance() { if (!_ThemeManager.instance) { _ThemeManager.instance = new _ThemeManager(); } return _ThemeManager.instance; } /** * 应用主题配置 * @param theme 主题配置 */ applyTheme(theme) { this.currentTheme = { ...this.currentTheme, ...theme }; this.updateCSSVariables(); this.updateAntdThemeVariables(); this.injectDynamicStyles(); } /** * 根据主题类型应用主题 * @param themeType 主题类型 */ applyThemeByType(themeType) { const themeConfig = this.themeConfigs[themeType]; if (themeConfig) { this.applyTheme(themeConfig); } return themeConfig; } /** * 获取所有可用主题选项 */ getThemeOptions() { return [ { value: "default", name: "默认", color: this.themeConfigs.default.primaryColor, config: this.themeConfigs.default }, { value: "blue", name: "蓝色", color: this.themeConfigs.blue.primaryColor, config: this.themeConfigs.blue } ]; } /** * 重置为原始主题 */ resetTheme() { this.currentTheme = { ...this.originalTheme }; this.applyTheme(this.currentTheme); } /** * 初始化主题 - 从localStorage读取保存的主题色 */ initializeTheme() { const savedTheme = localStorage.getItem("platform_config"); if (savedTheme) { try { const config = JSON.parse(savedTheme); if (config.themeColor) { this.applyTheme({ primaryColor: config.themeColor }); } } catch (error) { console.warn("Failed to parse saved theme config:", error); } } } /** * 获取当前主题配置 */ getCurrentTheme() { return { ...this.currentTheme }; } /** * 更新CSS变量 */ updateCSSVariables() { const root2 = document.documentElement; const { primaryColor: primaryColor2, borderRadius, borderColor } = this.currentTheme; root2.style.setProperty("--primary-color", primaryColor2); root2.style.setProperty("--primary-color-hover", this.adjustColorBrightness(primaryColor2, 20)); root2.style.setProperty("--primary-color-active", this.adjustColorBrightness(primaryColor2, -20)); root2.style.setProperty("--primary-color-fade", this.hexToRgba(primaryColor2, 0.08)); if (borderRadius) { root2.style.setProperty("--border-radius-base", borderRadius); } if (borderColor) { root2.style.setProperty("--border-color-base", borderColor); } } /** * 更新Ant Design主题变量 */ updateAntdThemeVariables() { const root2 = document.documentElement; const { primaryColor: primaryColor2 } = this.currentTheme; root2.style.setProperty("--ant-primary-color", primaryColor2); root2.style.setProperty( "--ant-primary-color-hover", this.adjustColorBrightness(primaryColor2, 20) ); root2.style.setProperty( "--ant-primary-color-active", this.adjustColorBrightness(primaryColor2, -20) ); for (let i2 = 1; i2 <= 10; i2++) { const lightness = i2 === 6 ? 0 : (6 - i2) * 10; const color = this.adjustColorBrightness(primaryColor2, lightness); root2.style.setProperty(`--ant-primary-${i2}`, color); } root2.style.setProperty("--ant-primary-color-deprecated-bg", this.hexToRgba(primaryColor2, 0.1)); root2.style.setProperty( "--ant-primary-color-deprecated-border", this.hexToRgba(primaryColor2, 0.4) ); } /** * 注入动态样式 */ injectDynamicStyles() { const existingStyle = document.getElementById("dynamic-theme-styles"); if (existingStyle) { existingStyle.remove(); } const style = document.createElement("style"); style.id = "dynamic-theme-styles"; const { primaryColor: primaryColor2 } = this.currentTheme; const dynamicStyles = ` /* 兼容vite.config中customTheme的样式覆盖 */ /* 按钮样式 */ .dm-ui-btn, .ant-btn { &:hover, &:focus { border-color: ${primaryColor2} !important; color: ${primaryColor2} !important; } } .dm-ui-btn-primary, .ant-btn-primary { color: #fff !important; background-color: ${primaryColor2} !important; border-color: ${primaryColor2} !important; } .dm-ui-btn-primary:hover, .ant-btn-primary:hover { color: #fff !important; background-color: ${this.adjustColorBrightness(primaryColor2, 20)} !important; border-color: ${this.adjustColorBrightness(primaryColor2, 20)} !important; } .dm-ui-btn-primary:active, .dm-ui-btn-primary:focus, .ant-btn-primary:active, .ant-btn-primary:focus { color: #fff !important; background-color: ${this.adjustColorBrightness(primaryColor2, -20)} !important; border-color: ${this.adjustColorBrightness(primaryColor2, -20)} !important; } /* 链接样式 */ .dm-ui-btn-link, .ant-btn-link { color: ${primaryColor2} !important; } .dm-ui-btn-link:hover, .ant-btn-link:hover { color: ${this.adjustColorBrightness(primaryColor2, 20)} !important; } /* 输入框焦点样式 */ .dm-ui-input:hover, .dm-ui-input:focus, .dm-ui-input-focused, .dm-ui-input-number:hover, .ant-input:hover, .ant-input:focus, .ant-input-focused { border-color: ${primaryColor2} !important; box-shadow: 0 0 0 2px ${this.hexToRgba(primaryColor2, 0.2)} !important; } /* 选择器样式 */ .dm-ui-select-focused .dm-ui-select-selector, .ant-select-focused .ant-select-selector { border-color: ${primaryColor2} !important; box-shadow: 0 0 0 2px ${this.hexToRgba(primaryColor2, 0.2)} !important; } .dm-ui-select:not(.dm-ui-select-disabled):hover .dm-ui-select-selector, .ant-select:not(.ant-select-disabled):hover .ant-select-selector { border-color: ${this.adjustColorBrightness(primaryColor2, 20)} !important; } .dm-ui-select-item-option-selected:not(.dm-ui-select-item-option-disabled), .ant-select-item-option-selected:not(.ant-select-item-option-disabled) { color: #fff !important; background-color:${this.adjustColorBrightness(primaryColor2, 20)} !important; } /* 复选框样式 */ .dm-ui-checkbox-checked .dm-ui-checkbox-inner, .ant-checkbox-checked .ant-checkbox-inner { background-color: ${primaryColor2} !important; border-color: ${primaryColor2} !important; } .dm-ui-checkbox:hover, .ant-checkbox:hover { border-color: ${this.adjustColorBrightness(primaryColor2, 20)} !important; } /* 单选框样式 */ .dm-ui-radio-checked .dm-ui-radio-inner, .ant-radio-checked .ant-radio-inner { border-color: ${primaryColor2} !important; } .dm-ui-radio-checked .dm-ui-radio-inner::after, .ant-radio-checked .ant-radio-inner::after { background-color: ${primaryColor2} !important; } .dm-ui-radio-button-wrapper-checked, .dm-ui-radio-button-wrapper:hover { background: ${primaryColor2} !important; border-color: ${primaryColor2} !important; color: #fff !important; } /* 开关样式 */ .dm-ui-switch-checked, .ant-switch-checked { background-color: ${primaryColor2} !important; } .dm-ui-picker:hover, .dm-ui-picker-focused, .dm-ui-picker-cell-in-view.dm-ui-picker-cell-today .dm-ui-picker-cell-inner::before { border-color: ${primaryColor2} !important; box-shadow: 0 0 0 2px ${this.hexToRgba(primaryColor2, 0.2)} !important; } .dm-ui-picker-cell-in-view.dm-ui-picker-cell-in-range::before, .dm-ui-picker-time-panel-cell-selected .dm-ui-picker-time-panel-cell-inner { background: ${this.hexToRgba(primaryColor2, 0.1)} !important; } .dm-ui-picker-cell-range-start, .dm-ui-picker-cell-range-end { .dm-ui-picker-cell-inner { background: ${primaryColor2} !important; } } /* 标签页样式 */ .dm-ui-tabs-tab-active, .dm-ui-tabs-tab:active, .ant-tabs-tab-active, .ant-tabs-tab:active { color: ${primaryColor2} !important; } .dm-ui-tabs-tab:hover, .ant-tabs-tab:hover { color: ${this.adjustColorBrightness(primaryColor2, 20)} !important; } .dm-ui-tabs-ink-bar, .ant-tabs-ink-bar { background-color: ${primaryColor2} !important; } /* 菜单样式 */ .dm-ui-menu-item-selected, .dm-ui-menu-item:active, .ant-menu-item-selected, .ant-menu-item:active, { background-color: ${this.hexToRgba(primaryColor2, 0.1)} !important; color: ${primaryColor2} !important; } .dm-ui-menu-item:hover, .ant-menu-item:hover { color: ${primaryColor2} !important; } /* 分页器样式 */ .dm-ui-pagination-item-active, .ant-pagination-item-active { background-color: ${primaryColor2} !important; border-color: ${primaryColor2} !important; } .dm-ui-pagination-item-active a, .ant-pagination-item-active a { color: #fff !important; } /* 滑块样式 */ .dm-ui-slider-track, .ant-slider-track { background-color: ${primaryColor2} !important; } .dm-ui-slider-handle, .ant-slider-handle { border-color: ${primaryColor2} !important; } /* 日期选择器预设样式 */ .dm-ui-tag { &:hover, &.active-tag { background-color: ${this.adjustColorBrightness(primaryColor2, 20)} !important; color: #fff !important; } } `; style.textContent = dynamicStyles; document.head.appendChild(style); } /** * 调整颜色亮度 */ adjustColorBrightness(color, amount) { const usePound = color[0] === "#"; const col = usePound ? color.slice(1) : color; const num = parseInt(col, 16); let r2 = (num >> 16) + amount; let g2 = (num >> 8 & 255) + amount; let b2 = (num & 255) + amount; r2 = r2 > 255 ? 255 : r2 < 0 ? 0 : r2; g2 = g2 > 255 ? 255 : g2 < 0 ? 0 : g2; b2 = b2 > 255 ? 255 : b2 < 0 ? 0 : b2; return (usePound ? "#" : "") + (r2 << 16 | g2 << 8 | b2).toString(16).padStart(6, "0"); } /** * 十六进制颜色转RGBA */ hexToRgba(hex, alpha) { const r2 = parseInt(hex.slice(1, 3), 16); const g2 = parseInt(hex.slice(3, 5), 16); const b2 = parseInt(hex.slice(5, 7), 16); return `rgba(${r2}, ${g2}, ${b2}, ${alpha})`; } }; __publicField(_ThemeManager, "instance"); let ThemeManager = _ThemeManager; const themeManager = ThemeManager.getInstance(); const _withScopeId = (n2) => (pushScopeId("data-v-f3049a46"), n2 = n2(), popScopeId(), n2); const _hoisted_1$j = { key: 0, class: "btn-loading" }; const _hoisted_2$e = { key: 0, class: "m-static-circle" }; const _hoisted_3$a = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("svg", { class: "circle", width: "1em", height: "1em", fill: "currentColor", viewBox: "0 0 100 100" }, [ /* @__PURE__ */ createElementVNode("path", { d: "M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90", "stroke-linecap": "round", class: "path", "fill-opacity": "0" }) ], -1)); const _hoisted_4$9 = [ _hoisted_3$a ]; const _hoisted_5$6 = { key: 1, class: "m-dynamic-circle" }; const _hoisted_6$3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("svg", { class: "circle", viewBox: "0 0 50 50", width: "1em", height: "1em", fill: "currentColor" }, [ /* @__PURE__ */ createElementVNode("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none" }) ], -1)); const _hoisted_7$3 = [ _hoisted_6$3 ]; const _hoisted_8$3 = { key: 1, class: "btn-icon" }; const _hoisted_9$3 = { key: 2, class: "btn-content" }; const primaryColor = "#1677ff"; const dangerColor = "#ff4d4f"; const _sfc_main$n = /* @__PURE__ */ defineComponent({ ...{ name: "dm-button" }, __name: "index", props: { type: { default: "default" }, shape: { default: "default" }, icon: { default: void 0 }, size: { default: "middle" }, ghost: { type: Boolean, default: false }, customClass: { default: void 0 }, href: { default: void 0 }, target: { default: "_self" }, keyboard: { type: Boolean, default: true }, disabled: { type: Boolean, default: false }, loading: { type: Boolean, default: false }, loadingType: { default: "dynamic" }, block: { type: Boolean, default: false } }, emits: ["click"], setup(__props, { emit: __emit2 }) { const props3 = __props; const wave = ref(false); const emit = __emit2; const slotsExist = useSlotsExist(["icon", "default"]); const showIcon = computed(() => { return slotsExist.icon || props3.icon; }); const showIconOnly = computed(() => { return showIcon.value && !slotsExist.default; }); const platformConfig = store("platformConfig") || {}; const themeType = (platformConfig == null ? void 0 : platformConfig.themeColor) || "default"; themeManager.initializeTheme(); themeManager.applyThemeByType(themeType); function onClick2(e2) { if (props3.disabled || props3.loading) { return; } if (wave.value) { wave.value = false; nextTick(() => { wave.value = true; }); } else { wave.value = true; } emit("click", e2); } function onKeyboard(e2) { onClick2(e2); } function onWaveEnd() { wave.value = false; } computed(() => { switch (props3.type) { case "primary": return primaryColor; case "danger": return dangerColor; default: return primaryColor; } }); return (_ctx, _cache) => { return openBlock(), createBlock(resolveDynamicComponent(_ctx.href ? "a" : "div"), { tabindex: "0", class: normalizeClass(["dm-button", [ `btn-${_ctx.type} btn-${_ctx.size}`, { [`loading-${_ctx.size}`]: !_ctx.href && _ctx.loading, "btn-icon-only": showIconOnly.value, "btn-circle": _ctx.shape === "circle", "btn-round": _ctx.shape === "round", "btn-loading-blur": !_ctx.href && _ctx.loading, "btn-ghost": _ctx.ghost, "btn-block": _ctx.block, "btn-disabled": _ctx.disabled }, _ctx.customClass ]]), href: _ctx.href, target: _ctx.target, onClick: _cache[0] || (_cache[0] = ($event) => onClick2($event)), onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.keyboard ? onKeyboard($event) : void 0, ["prevent"]), ["enter"])) }, { default: withCtx(() => [ _ctx.loading || !showIcon.value ? (openBlock(), createElementBlock("div", _hoisted_1$j, [ !_ctx.href && _ctx.loadingType === "static" ? (openBlock(), createElementBlock("div", _hoisted_2$e, _hoisted_4$9)) : createCommentVNode("", true), !_ctx.href && _ctx.loadingType === "dynamic" ? (openBlock(), createElementBlock("div", _hoisted_5$6, _hoisted_7$3)) : createCommentVNode("", true) ])) : createCommentVNode("", true), !_ctx.loading && showIcon.value ? (openBlock(), createElementBlock("span", _hoisted_8$3, [ renderSlot(_ctx.$slots, "icon", {}, () => [ _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : createCommentVNode("", true) ], true) ])) : createCommentVNode("", true), unref(slotsExist).default ? (openBlock(), createElementBlock("span", _hoisted_9$3, [ renderSlot(_ctx.$slots, "default", {}, void 0, true) ])) : createCommentVNode("", true), !_ctx.disabled ? (openBlock(), createElementBlock("div", { key: 3, class: normalizeClass(["button-wave", { "wave-active": wave.value }]), onAnimationend: onWaveEnd }, null, 34)) : createCommentVNode("", true) ]), _: 3 }, 40, ["class", "href", "target"]); }; } }); const index_vue_vue_type_style_index_0_scoped_f3049a46_lang = ""; const _export_sfc = (sfc, props3) => { const target = sfc.__vccOpts || sfc; for (const [key2, val] of props3) { target[key2] = val; } return target; }; const Button$1 = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-f3049a46"]]); Button$1.install = (app) => { app.component(Button$1.name, Button$1); }; function _typeof$2(o2) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) { return typeof o3; } : function(o3) { return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3; }, _typeof$2(o2); } function toPrimitive(t2, r2) { if ("object" != _typeof$2(t2) || !t2) return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { var i2 = e2.call(t2, r2 || "default"); if ("object" != _typeof$2(i2)) return i2; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r2 ? String : Number)(t2); } function toPropertyKey(t2) { var i2 = toPrimitive(t2, "string"); return "symbol" == _typeof$2(i2) ? i2 : i2 + ""; } function _defineProperty$q(obj, key2, value2) { key2 = toPropertyKey(key2); if (key2 in obj) { Object.defineProperty(obj, key2, { value: value2, enumerable: true, configurable: true, writable: true }); } else { obj[key2] = value2; } return obj; } function ownKeys$1(e2, r2) { var t2 = Object.keys(e2); if (Object.getOwnPropertySymbols) { var o2 = Object.getOwnPropertySymbols(e2); r2 && (o2 = o2.filter(function(r3) { return Object.getOwnPropertyDescriptor(e2, r3).enumerable; })), t2.push.apply(t2, o2); } return t2; } function _objectSpread2$1(e2) { for (var r2 = 1; r2 < arguments.length; r2++) { var t2 = null != arguments[r2] ? arguments[r2] : {}; r2 % 2 ? ownKeys$1(Object(t2), true).forEach(function(r3) { _defineProperty$q(e2, r3, t2[r3]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1(Object(t2)).forEach(function(r3) { Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3)); }); } return e2; } function _extends() { _extends = Object.assign ? Object.assign.bind() : function(target) { for (var i2 = 1; i2 < arguments.length; i2++) { var source = arguments[i2]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; } } } return target; }; return _extends.apply(this, arguments); } var isFunction$2 = function isFunction(val) { return typeof val === "function"; }; var isArray$3 = Array.isArray; var isString$3 = function isString(val) { return typeof val === "string"; }; var isObject$3 = function isObject(val) { return val !== null && _typeof$2(val) === "object"; }; var onRE = /^on[^a-z]/; var isOn = function isOn2(key2) { return onRE.test(key2); }; var cacheStringFunction = function cacheStringFunction2(fn) { var cache2 = /* @__PURE__ */ Object.create(null); return function(str) { var hit = cache2[str]; return hit || (cache2[str] = fn(str)); }; }; var camelizeRE = /-(\w)/g; var camelize = cacheStringFunction(function(str) { return str.replace(camelizeRE, function(_2, c2) { return c2 ? c2.toUpperCase() : ""; }); }); var hyphenateRE = /\B([A-Z])/g; var hyphenate = cacheStringFunction(function(str) { return str.replace(hyphenateRE, "-$1").toLowerCase(); }); var hasOwnProperty$d = Object.prototype.hasOwnProperty; var hasOwn$1 = function hasOwn(val, key2) { return hasOwnProperty$d.call(val, key2); }; function resolvePropValue(options, props3, key2, value2) { var opt = options[key2]; if (opt != null) { var hasDefault = hasOwn$1(opt, "default"); if (hasDefault && value2 === void 0) { var defaultValue = opt.default; value2 = opt.type !== Function && isFunction$2(defaultValue) ? defaultValue() : defaultValue; } if (opt.type === Boolean) { if (!hasOwn$1(props3, key2) && !hasDefault) { value2 = false; } else if (value2 === "") { value2 = true; } } } return value2; } function getDataAndAriaProps(props3) { return Object.keys(props3).reduce(function(memo, key2) { if (key2.substr(0, 5) === "data-" || key2.substr(0, 5) === "aria-") { memo[key2] = props3[key2]; } return memo; }, {}); } function toPx(val) { if (typeof val === "number") return "".concat(val, "px"); return val; } function renderHelper(v2) { var props3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; var defaultV = arguments.length > 2 ? arguments[2] : void 0; if (typeof v2 === "function") { return v2(props3); } return v2 !== null && v2 !== void 0 ? v2 : defaultV; } function classNames() { var classes = []; for (var i2 = 0; i2 < arguments.length; i2++) { var value2 = i2 < 0 || arguments.length <= i2 ? void 0 : arguments[i2]; if (!value2) continue; if (isString$3(value2)) { classes.push(value2); } else if (isArray$3(value2)) { for (var _i = 0; _i < value2.length; _i++) { var inner = classNames(value2[_i]); if (inner) { classes.push(inner); } } } else if (isObject$3(value2)) { for (var name in value2) { if (value2[name]) { classes.push(name); } } } } return classes.join(" "); } var MapShim = function() { if (typeof Map !== "undefined") { return Map; } function getIndex(arr, key2) { var result = -1; arr.some(function(entry, index2) { if (entry[0] === key2) { result = index2; return true; } return false; }); return result; } return ( /** @class */ function() { function class_1() { this.__entries__ = []; } Object.defineProperty(class_1.prototype, "size", { /** * @returns {boolean} */ get: function() { return this.__entries__.length; }, enumerable: true, configurable: true }); class_1.prototype.get = function(key2) { var index2 = getIndex(this.__entries__, key2); var entry = this.__entries__[index2]; return entry && entry[1]; }; class_1.prototype.set = function(key2, value2) { var index2 = getIndex(this.__entries__, key2); if (~index2) { this.__entries__[index2][1] = value2; } else { this.__entries__.push([key2, value2]); } }; class_1.prototype.delete = function(key2) { var entries = this.__entries__; var index2 = getIndex(entries, key2); if (~index2) { entries.splice(index2, 1); } }; class_1.prototype.has = function(key2) { return !!~getIndex(this.__entries__, key2); }; class_1.prototype.clear = function() { this.__entries__.splice(0); }; class_1.prototype.forEach = function(callback, ctx) { if (ctx === void 0) { ctx = null; } for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { var entry = _a[_i]; callback.call(ctx, entry[1], entry[0]); } }; return class_1; }() ); }(); var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document; var global$1 = function() { if (typeof global !== "undefined" && global.Math === Math) { return global; } if (typeof self !== "undefined" && self.Math === Math) { return self; } if (typeof window !== "undefined" && window.Math === Math) { return window; } return Function("return this")(); }(); var requestAnimationFrame$1 = function() { if (typeof requestAnimationFrame === "function") { return requestAnimationFrame.bind(global$1); } return function(callback) { return setTimeout(function() { return callback(Date.now()); }, 1e3 / 60); }; }(); var trailingTimeout = 2; function throttle(callback, delay) { var leadingCall = false, trailingCall = false, lastCallTime = 0; function resolvePending() { if (leadingCall) { leadingCall = false; callback(); } if (trailingCall) { proxy(); } } function timeoutCallback() { requestAnimationFrame$1(resolvePending); } function proxy() { var timeStamp = Date.now(); if (leadingCall) { if (timeStamp - lastCallTime < trailingTimeout) { return; } trailingCall = true; } else { leadingCall = true; trailingCall = false; setTimeout(timeoutCallback, delay); } lastCallTime = timeStamp; } return proxy; } var REFRESH_DELAY = 20; var transitionKeys = ["top", "right", "bottom", "left", "width", "height", "size", "weight"]; var mutationObserverSupported = typeof MutationObserver !== "undefined"; var ResizeObserverController = ( /** @class */ function() { function ResizeObserverController2() { this.connected_ = false; this.mutationEventsAdded_ = false; this.mutationsObserver_ = null; this.observers_ = []; this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY); } ResizeObserverController2.prototype.addObserver = function(observer) { if (!~this.observers_.indexOf(observer)) { this.observers_.push(observer); } if (!this.connected_) { this.connect_(); } }; ResizeObserverController2.prototype.removeObserver = function(observer) { var observers2 = this.observers_; var index2 = observers2.indexOf(observer); if (~index2) { observers2.splice(index2, 1); } if (!observers2.length && this.connected_) { this.disconnect_(); } }; ResizeObserverController2.prototype.refresh = function() { var changesDetected = this.updateObservers_(); if (changesDetected) { this.refresh(); } }; ResizeObserverController2.prototype.updateObservers_ = function() { var activeObservers = this.observers_.filter(function(observer) { return observer.gatherActive(), observer.hasActive(); }); activeObservers.forEach(function(observer) { return observer.broadcastActive(); }); return activeObservers.length > 0; }; ResizeObserverController2.prototype.connect_ = function() { if (!isBrowser || this.connected_) { return; } document.addEventListener("transitionend", this.onTransitionEnd_); window.addEventListener("resize", this.refresh); if (mutationObserverSupported) { this.mutationsObserver_ = new MutationObserver(this.refresh); this.mutationsObserver_.observe(document, { attributes: true, childList: true, characterData: true, subtree: true }); } else { document.addEventListener("DOMSubtreeModified", this.refresh); this.mutationEventsAdded_ = true; } this.connected_ = true; }; ResizeObserverController2.prototype.disconnect_ = function() { if (!isBrowser || !this.connected_) { return; } document.removeEventListener("transitionend", this.onTransitionEnd_); window.removeEventListener("resize", this.refresh); if (this.mutationsObserver_) { this.mutationsObserver_.disconnect(); } if (this.mutationEventsAdded_) { document.removeEventListener("DOMSubtreeModified", this.refresh); } this.mutationsObserver_ = null; this.mutationEventsAdded_ = false; this.connected_ = false; }; ResizeObserverController2.prototype.onTransitionEnd_ = function(_a) { var _b = _a.propertyName, propertyName = _b === void 0 ? "" : _b; var isReflowProperty = transitionKeys.some(function(key2) { return !!~propertyName.indexOf(key2); }); if (isReflowProperty) { this.refresh(); } }; ResizeObserverController2.getInstance = function() { if (!this.instance_) { this.instance_ = new ResizeObserverController2(); } return this.instance_; }; ResizeObserverController2.instance_ = null; return ResizeObserverController2; }() ); var defineConfigurable = function(target, props3) { for (var _i = 0, _a = Object.keys(props3); _i < _a.length; _i++) { var key2 = _a[_i]; Object.defineProperty(target, key2, { value: props3[key2], enumerable: false, writable: false, configurable: true }); } return target; }; var getWindowOf = function(target) { var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; return ownerGlobal || global$1; }; var emptyRect = createRectInit(0, 0, 0, 0); function toFloat(value2) { return parseFloat(value2) || 0; } function getBordersSize(styles2) { var positions = []; for (var _i = 1; _i < arguments.length; _i++) { positions[_i - 1] = arguments[_i]; } return positions.reduce(function(size, position) { var value2 = styles2["border-" + position + "-width"]; return size + toFloat(value2); }, 0); } function getPaddings(styles2) { var positions = ["top", "right", "bottom", "left"]; var paddings = {}; for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { var position = positions_1[_i]; var value2 = styles2["padding-" + position]; paddings[position] = toFloat(value2); } return paddings; } function getSVGContentRect(target) { var bbox = target.getBBox(); return createRectInit(0, 0, bbox.width, bbox.height); } function getHTMLElementContentRect(target) { var clientWidth = target.clientWidth, clientHeight = target.clientHeight; if (!clientWidth && !clientHeight) { return emptyRect; } var styles2 = getWindowOf(target).getComputedStyle(target); var paddings = getPaddings(styles2); var horizPad = paddings.left + paddings.right; var vertPad = paddings.top + paddings.bottom; var width = toFloat(styles2.width), height = toFloat(styles2.height); if (styles2.boxSizing === "border-box") { if (Math.round(width + horizPad) !== clientWidth) { width -= getBordersSize(styles2, "left", "right") + horizPad; } if (Math.round(height + vertPad) !== clientHeight) { height -= getBordersSize(styles2, "top", "bottom") + vertPad; } } if (!isDocumentElement(target)) { var vertScrollbar = Math.round(width + horizPad) - clientWidth; var horizScrollbar = Math.round(height + vertPad) - clientHeight; if (Math.abs(vertScrollbar) !== 1) { width -= vertScrollbar; } if (Math.abs(horizScrollbar) !== 1) { height -= horizScrollbar; } } return createRectInit(paddings.left, paddings.top, width, height); } var isSVGGraphicsElement = function() { if (typeof SVGGraphicsElement !== "undefined") { return function(target) { return target instanceof getWindowOf(target).SVGGraphicsElement; }; } return function(target) { return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === "function"; }; }(); function isDocumentElement(target) { return target === getWindowOf(target).document.documentElement; } function getContentRect(target) { if (!isBrowser) { return emptyRect; } if (isSVGGraphicsElement(target)) { return getSVGContentRect(target); } return getHTMLElementContentRect(target); } function createReadOnlyRect(_a) { var x2 = _a.x, y2 = _a.y, width = _a.width, height = _a.height; var Constr = typeof DOMRectReadOnly !== "undefined" ? DOMRectReadOnly : Object; var rect = Object.create(Constr.prototype); defineConfigurable(rect, { x: x2, y: y2, width, height, top: y2, right: x2 + width, bottom: height + y2, left: x2 }); return rect; } function createRectInit(x2, y2, width, height) { return { x: x2, y: y2, width, height }; } var ResizeObservation = ( /** @class */ function() { function ResizeObservation2(target) { this.broadcastWidth = 0; this.broadcastHeight = 0; this.contentRect_ = createRectInit(0, 0, 0, 0); this.target = target; } ResizeObservation2.prototype.isActive = function() { var rect = getContentRect(this.target); this.contentRect_ = rect; return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight; }; ResizeObservation2.prototype.broadcastRect = function() { var rect = this.contentRect_; this.broadcastWidth = rect.width; this.broadcastHeight = rect.height; return rect; }; return ResizeObservation2; }() ); var ResizeObserverEntry = ( /** @class */ function() { function ResizeObserverEntry2(target, rectInit) { var contentRect = createReadOnlyRect(rectInit); defineConfigurable(this, { target, contentRect }); } return ResizeObserverEntry2; }() ); var ResizeObserverSPI = ( /** @class */ function() { function ResizeObserverSPI2(callback, controller, callbackCtx) { this.activeObservations_ = []; this.observations_ = new MapShim(); if (typeof callback !== "function") { throw new TypeError("The callback provided as parameter 1 is not a function."); } this.callback_ = callback; this.controller_ = controller; this.callbackCtx_ = callbackCtx; } ResizeObserverSPI2.prototype.observe = function(target) { if (!arguments.length) { throw new TypeError("1 argument required, but only 0 present."); } if (typeof Element === "undefined" || !(Element instanceof Object)) { return; } if (!(target instanceof getWindowOf(target).Element)) { throw new TypeError('parameter 1 is not of type "Element".'); } var observations = this.observations_; if (observations.has(target)) { return; } observations.set(target, new ResizeObservation(target)); this.controller_.addObserver(this); this.controller_.refresh(); }; ResizeObserverSPI2.prototype.unobserve = function(target) { if (!arguments.length) { throw new TypeError("1 argument required, but only 0 present."); } if (typeof Element === "undefined" || !(Element instanceof Object)) { return; } if (!(target instanceof getWindowOf(target).Element)) { throw new TypeError('parameter 1 is not of type "Element".'); } var observations = this.observations_; if (!observations.has(target)) { return; } observations.delete(target); if (!observations.size) { this.controller_.removeObserver(this); } }; ResizeObserverSPI2.prototype.disconnect = function() { this.clearActive(); this.observations_.clear(); this.controller_.removeObserver(this); }; ResizeObserverSPI2.prototype.gatherActive = function() { var _this = this; this.clearActive(); this.observations_.forEach(function(observation) { if (observation.isActive()) { _this.activeObservations_.push(observation); } }); }; ResizeObserverSPI2.prototype.broadcastActive = function() { if (!this.hasActive()) { return; } var ctx = this.callbackCtx_; var entries = this.activeObservations_.map(function(observation) { return new ResizeObserverEntry(observation.target, observation.broadcastRect()); }); this.callback_.call(ctx, entries, ctx); this.clearActive(); }; ResizeObserverSPI2.prototype.clearActive = function() { this.activeObservations_.splice(0); }; ResizeObserverSPI2.prototype.hasActive = function() { return this.activeObservations_.length > 0; }; return ResizeObserverSPI2; }() ); var observers = typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : new MapShim(); var ResizeObserver$2 = ( /** @class */ function() { function ResizeObserver2(callback) { if (!(this instanceof ResizeObserver2)) { throw new TypeError("Cannot call a class as a function."); } if (!arguments.length) { throw new TypeError("1 argument required, but only 0 present."); } var controller = ResizeObserverController.getInstance(); var observer = new ResizeObserverSPI(callback, controller, this); observers.set(this, observer); } return ResizeObserver2; }() ); [ "observe", "unobserve", "disconnect" ].forEach(function(method) { ResizeObserver$2.prototype[method] = function() { var _a; return (_a = observers.get(this))[method].apply(_a, arguments); }; }); var index$2 = function() { if (typeof global$1.ResizeObserver !== "undefined") { return global$1.ResizeObserver; } return ResizeObserver$2; }(); function _arrayWithHoles$2(arr) { if (Array.isArray(arr)) return arr; } function _iterableToArrayLimit$2(r2, l2) { var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"]; if (null != t2) { var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false; try { if (i2 = (t2 = t2.call(r2)).next, 0 === l2) { if (Object(t2) !== t2) return; f2 = false; } else for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true) ; } catch (r3) { o2 = true, n2 = r3; } finally { try { if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2)) return; } finally { if (o2) throw n2; } } return a2; } } function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) arr2[i2] = arr[i2]; return arr2; } function _unsupportedIterableToArray$2(o2, minLen) { if (!o2) return; if (typeof o2 === "string") return _arrayLikeToArray$2(o2, minLen); var n2 = Object.prototype.toString.call(o2).slice(8, -1); if (n2 === "Object" && o2.constructor) n2 = o2.constructor.name; if (n2 === "Map" || n2 === "Set") return Array.from(o2); if (n2 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n2)) return _arrayLikeToArray$2(o2, minLen); } function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _slicedToArray$2(arr, i2) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i2) || _unsupportedIterableToArray$2(arr, i2) || _nonIterableRest$2(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$2(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread(); } var freeGlobal = typeof global == "object" && global && global.Object === Object && global; const freeGlobal$1 = freeGlobal; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = freeGlobal$1 || freeSelf || Function("return this")(); const root$1 = root; var Symbol$1 = root$1.Symbol; const Symbol$2 = Symbol$1; var objectProto$d = Object.prototype; var hasOwnProperty$c = objectProto$d.hasOwnProperty; var nativeObjectToString$1 = objectProto$d.toString; var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0; function getRawTag(value2) { var isOwn = hasOwnProperty$c.call(value2, symToStringTag$1), tag = value2[symToStringTag$1]; try { value2[symToStringTag$1] = void 0; var unmasked = true; } catch (e2) { } var result = nativeObjectToString$1.call(value2); if (unmasked) { if (isOwn) { value2[symToStringTag$1] = tag; } else { delete value2[symToStringTag$1]; } } return result; } var objectProto$c = Object.prototype; var nativeObjectToString = objectProto$c.toString; function objectToString$1(value2) { return nativeObjectToString.call(value2); } var nullTag = "[object Null]", undefinedTag = "[object Undefined]"; var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0; function baseGetTag(value2) { if (value2 == null) { return value2 === void 0 ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value2) ? getRawTag(value2) : objectToString$1(value2); } function overArg(func, transform2) { return function(arg) { return func(transform2(arg)); }; } var getPrototype = overArg(Object.getPrototypeOf, Object); const getPrototype$1 = getPrototype; function isObjectLike(value2) { return value2 != null && typeof value2 == "object"; } var objectTag$3 = "[object Object]"; var funcProto$2 = Function.prototype, objectProto$b = Object.prototype; var funcToString$2 = funcProto$2.toString; var hasOwnProperty$b = objectProto$b.hasOwnProperty; var objectCtorString = funcToString$2.call(Object); function isPlainObject$1(value2) { if (!isObjectLike(value2) || baseGetTag(value2) != objectTag$3) { return false; } var proto = getPrototype$1(value2); if (proto === null) { return true; } var Ctor = hasOwnProperty$b.call(proto, "constructor") && proto.constructor; return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$2.call(Ctor) == objectCtorString; } var isValid$1 = function isValid(value2) { return value2 !== void 0 && value2 !== null && value2 !== ""; }; const isValid$2 = isValid$1; var initDefaultProps = function initDefaultProps2(types, defaultProps) { var propTypes = _objectSpread2$1({}, types); Object.keys(defaultProps).forEach(function(k2) { var prop = propTypes[k2]; if (prop) { if (prop.type || prop.default) { prop.default = defaultProps[k2]; } else if (prop.def) { prop.def(defaultProps[k2]); } else { propTypes[k2] = { type: prop, default: defaultProps[k2] }; } } else { throw new Error("not have ".concat(k2, " prop")); } }); return propTypes; }; const initDefaultProps$1 = initDefaultProps; var splitAttrs = function splitAttrs2(attrs) { var allAttrs = Object.keys(attrs); var eventAttrs = {}; var onEvents = {}; var extraAttrs = {}; for (var i2 = 0, l2 = allAttrs.length; i2 < l2; i2++) { var key2 = allAttrs[i2]; if (isOn(key2)) { eventAttrs[key2[2].toLowerCase() + key2.slice(3)] = attrs[key2]; onEvents[key2] = attrs[key2]; } else { extraAttrs[key2] = attrs[key2]; } } return { onEvents, events: eventAttrs, extraAttrs }; }; var parseStyleText = function parseStyleText2() { var cssText = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ""; var camel = arguments.length > 1 ? arguments[1] : void 0; var res = {}; var listDelimiter = /;(?![^(]*\))/g; var propertyDelimiter = /:(.+)/; if (_typeof$2(cssText) === "object") return cssText; cssText.split(listDelimiter).forEach(function(item) { if (item) { var tmp = item.split(propertyDelimiter); if (tmp.length > 1) { var k2 = camel ? camelize(tmp[0].trim()) : tmp[0].trim(); res[k2] = tmp[1].trim(); } } }); return res; }; var hasProp = function hasProp2(instance, prop) { return instance[prop] !== void 0; }; var flattenChildren = function flattenChildren2() { var children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var filterEmpty2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; var temp = Array.isArray(children) ? children : [children]; var res = []; temp.forEach(function(child) { if (Array.isArray(child)) { re