import { inject, ref, h, getCurrentInstance, nextTick, reactive, defineComponent, createVNode, computed, shallowRef, provide, cloneVNode, createElementBlock, toRef, isRef, watch, Transition, withDirectives, vShow, watchEffect, Fragment, toValue, hasInjectionContext, unref, getCurrentScope, onScopeDispose, Teleport, isVNode, Text as Text$1, toRaw, Comment as Comment$1, TransitionGroup, toRefs, createTextVNode, render, useAttrs, withModifiers, resolveDirective, onMounted, defineAsyncComponent, shallowReactive, Suspense, useSSRContext, createApp, triggerRef, mergeProps, withCtx, onErrorCaptured, onServerPrefetch, resolveDynamicComponent, effectScope, isReadonly, isShallow, isReactive } from 'vue';
import { k as createError$1, h as hasProtocol, o as isScriptProtocol, j as joinURL, q as withQuery, s as sanitizeStatusCode, r as getContext, $ as $fetch$1, t as baseURL$1, v as createHooks, x as executeAsync, y as toRouteMatcher, z as createRouter$1, d as defu } from '../_/nitro.mjs';
import { defineStore, createPinia, setActivePinia, shouldHydrate } from 'pinia';
import { createClient } from '@supabase/supabase-js';
import _extends from '@babel/runtime/helpers/esm/extends';
import _objectSpread$W from '@babel/runtime/helpers/esm/objectSpread2';
import { generate as generate$1, blue as blue$1, presetPrimaryColors, gold } from '@ant-design/colors';
import { TinyColor } from '@ctrl/tinycolor';
import { serialize, compile, stringify } from 'stylis';
import { createTypes } from 'vue-types';
import { get as get$1, cloneDeep as cloneDeep$1, isEmpty as isEmpty$1 } from 'lodash-es';
import axios from 'axios';
import { ExclamationCircleOutlined as ExclamationCircleOutlined$2, ReloadOutlined } from '@ant-design/icons-vue';
import ResizeObserver$2 from 'resize-observer-polyfill';
import { alignElement, alignPoint } from 'dom-align';
import uniq from 'lodash-es/uniq.js';
import pick from 'lodash-es/pick.js';
import isPlainObject from 'lodash-es/isPlainObject.js';
import debounce$1 from 'lodash-es/debounce.js';
import cloneDeep from 'lodash-es/cloneDeep.js';
import RawAsyncValidator from 'async-validator';
import find from 'lodash-es/find.js';
import isEqual$2 from 'lodash-es/isEqual.js';
import compute from 'compute-scroll-into-view';
import intersection from 'lodash-es/intersection.js';
import omit$1 from 'lodash-es/omit.js';
import isNumber from 'lodash-es/isNumber.js';
import { debounce } from 'throttle-debounce';
import fromPairs from 'lodash-es/fromPairs.js';
import partition from 'lodash-es/partition.js';
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderSuspense, ssrRenderVNode } from 'vue/server-renderer';
import { u as useHead$1, h as headSymbol } from '../routes/renderer.mjs';
/* eslint-disable */
// Inspired by https://github.com/garycourt/murmurhash-js
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
function murmur2(str) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
// const m = 0x5bd1e995;
// const r = 24;
// Initialize the hash
var h = 0; // Mix 4 bytes at a time into the hash
var k,
i = 0,
len = str.length;
for (; len >= 4; ++i, len -= 4) {
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
k =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
k ^=
/* k >>> r: */
k >>> 24;
h =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Handle the last few bytes of the input array
switch (len) {
case 3:
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
case 2:
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
case 1:
h ^= str.charCodeAt(i) & 0xff;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Do a few final mixes of the hash to ensure the last few
// bytes are well-incorporated.
h ^= h >>> 13;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
return ((h ^ h >>> 15) >>> 0).toString(36);
}
var unitlessKeys = {
animationIterationCount: 1,
aspectRatio: 1,
borderImageOutset: 1,
borderImageSlice: 1,
borderImageWidth: 1,
boxFlex: 1,
boxFlexGroup: 1,
boxOrdinalGroup: 1,
columnCount: 1,
columns: 1,
flex: 1,
flexGrow: 1,
flexPositive: 1,
flexShrink: 1,
flexNegative: 1,
flexOrder: 1,
gridRow: 1,
gridRowEnd: 1,
gridRowSpan: 1,
gridRowStart: 1,
gridColumn: 1,
gridColumnEnd: 1,
gridColumnSpan: 1,
gridColumnStart: 1,
msGridRow: 1,
msGridRowSpan: 1,
msGridColumn: 1,
msGridColumnSpan: 1,
fontWeight: 1,
lineHeight: 1,
opacity: 1,
order: 1,
orphans: 1,
tabSize: 1,
widows: 1,
zIndex: 1,
zoom: 1,
WebkitLineClamp: 1,
// SVG-related properties
fillOpacity: 1,
floodOpacity: 1,
stopOpacity: 1,
strokeDasharray: 1,
strokeDashoffset: 1,
strokeMiterlimit: 1,
strokeOpacity: 1,
strokeWidth: 1
};
// This icon file is generated automatically.
var CheckCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "check-circle", "theme": "outlined" };
var contextKey$1 = Symbol('iconContext');
var useInjectIconContext = function useInjectIconContext() {
return inject(contextKey$1, {
prefixCls: ref('anticon'),
rootClassName: ref(''),
csp: ref()
});
};
function _objectSpread$V(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$V(target, key, source[key]); }); } return target; }
function _defineProperty$V(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function warning$2(valid, message) {
}
function isIconDefinition(target) {
return typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function');
}
function generate(node, key, rootProps) {
if (!rootProps) {
return h(node.tag, _objectSpread$V({
key: key
}, node.attrs), (node.children || []).map(function (child, index) {
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
}));
}
return h(node.tag, _objectSpread$V({
key: key
}, rootProps, node.attrs), (node.children || []).map(function (child, index) {
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
}));
}
function getSecondaryColor(primaryColor) {
// choose the second color
return generate$1(primaryColor)[0];
}
function normalizeTwoToneColors(twoToneColor) {
if (!twoToneColor) {
return [];
}
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
} // These props make sure that the SVG behaviours like general text.
var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
var useInsertStyles = function useInsertStyles() {
var _useInjectIconContext = useInjectIconContext(),
prefixCls = _useInjectIconContext.prefixCls;
_useInjectIconContext.csp;
getCurrentInstance();
var mergedStyleStr = iconStyles;
if (prefixCls) {
mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls.value);
}
nextTick(function () {
{
return;
}
});
};
var _excluded$1 = ["icon", "primaryColor", "secondaryColor"];
function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _objectSpread$U(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$U(target, key, source[key]); }); } return target; }
function _defineProperty$U(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var twoToneColorPalette = reactive({
primaryColor: '#333',
secondaryColor: '#E6E6E6',
calculated: false
});
function setTwoToneColors(_ref) {
var primaryColor = _ref.primaryColor,
secondaryColor = _ref.secondaryColor;
twoToneColorPalette.primaryColor = primaryColor;
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
twoToneColorPalette.calculated = !!secondaryColor;
}
function getTwoToneColors() {
return _objectSpread$U({}, twoToneColorPalette);
}
var IconBase = function IconBase(props, context) {
var _props$context$attrs = _objectSpread$U({}, props, context.attrs),
icon = _props$context$attrs.icon,
primaryColor = _props$context$attrs.primaryColor,
secondaryColor = _props$context$attrs.secondaryColor,
restProps = _objectWithoutProperties$1(_props$context$attrs, _excluded$1);
var colors = twoToneColorPalette;
if (primaryColor) {
colors = {
primaryColor: primaryColor,
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
};
}
warning$2(isIconDefinition(icon));
if (!isIconDefinition(icon)) {
return null;
}
var target = icon;
if (target && typeof target.icon === 'function') {
target = _objectSpread$U({}, target, {
icon: target.icon(colors.primaryColor, colors.secondaryColor)
});
}
return generate(target.icon, "svg-".concat(target.name), _objectSpread$U({}, restProps, {
'data-icon': target.name,
width: '1em',
height: '1em',
fill: 'currentColor',
'aria-hidden': 'true'
})); // },
};
IconBase.props = {
icon: Object,
primaryColor: String,
secondaryColor: String,
focusable: String
};
IconBase.inheritAttrs = false;
IconBase.displayName = 'IconBase';
IconBase.getTwoToneColors = getTwoToneColors;
IconBase.setTwoToneColors = setTwoToneColors;
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
function _nonIterableRest$1() { 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 _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit$1(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
function setTwoToneColor(twoToneColor) {
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
_normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
primaryColor = _normalizeTwoToneColo2[0],
secondaryColor = _normalizeTwoToneColo2[1];
return IconBase.setTwoToneColors({
primaryColor: primaryColor,
secondaryColor: secondaryColor
});
}
function getTwoToneColor() {
var colors = IconBase.getTwoToneColors();
if (!colors.calculated) {
return colors.primaryColor;
}
return [colors.primaryColor, colors.secondaryColor];
}
var InsertStyles = defineComponent({
name: 'InsertStyles',
setup: function setup() {
useInsertStyles();
return function () {
return null;
};
}
});
var _excluded = ["class", "icon", "spin", "rotate", "tabindex", "twoToneColor", "onClick"];
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { 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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _objectSpread$T(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$T(target, key, source[key]); }); } return target; }
function _defineProperty$T(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
setTwoToneColor(blue$1.primary);
var Icon = function Icon(props, context) {
var _classObj;
var _props$context$attrs = _objectSpread$T({}, props, context.attrs),
cls = _props$context$attrs["class"],
icon = _props$context$attrs.icon,
spin = _props$context$attrs.spin,
rotate = _props$context$attrs.rotate,
tabindex = _props$context$attrs.tabindex,
twoToneColor = _props$context$attrs.twoToneColor,
onClick = _props$context$attrs.onClick,
restProps = _objectWithoutProperties(_props$context$attrs, _excluded);
var _useInjectIconContext = useInjectIconContext(),
prefixCls = _useInjectIconContext.prefixCls,
rootClassName = _useInjectIconContext.rootClassName;
var classObj = (_classObj = {}, _defineProperty$T(_classObj, rootClassName.value, !!rootClassName.value), _defineProperty$T(_classObj, prefixCls.value, true), _defineProperty$T(_classObj, "".concat(prefixCls.value, "-").concat(icon.name), Boolean(icon.name)), _defineProperty$T(_classObj, "".concat(prefixCls.value, "-spin"), !!spin || icon.name === 'loading'), _classObj);
var iconTabIndex = tabindex;
if (iconTabIndex === undefined && onClick) {
iconTabIndex = -1;
}
var svgStyle = rotate ? {
msTransform: "rotate(".concat(rotate, "deg)"),
transform: "rotate(".concat(rotate, "deg)")
} : undefined;
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
primaryColor = _normalizeTwoToneColo2[0],
secondaryColor = _normalizeTwoToneColo2[1];
return createVNode("span", _objectSpread$T({
"role": "img",
"aria-label": icon.name
}, restProps, {
"onClick": onClick,
"class": [classObj, cls],
"tabindex": iconTabIndex
}), [createVNode(IconBase, {
"icon": icon,
"primaryColor": primaryColor,
"secondaryColor": secondaryColor,
"style": svgStyle
}, null), createVNode(InsertStyles, null, null)]);
};
Icon.props = {
spin: Boolean,
rotate: Number,
icon: Object,
twoToneColor: [String, Array]
};
Icon.displayName = 'AntdIcon';
Icon.inheritAttrs = false;
Icon.getTwoToneColor = getTwoToneColor;
Icon.setTwoToneColor = setTwoToneColor;
function _objectSpread$S(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$S(target, key, source[key]); }); } return target; }
function _defineProperty$S(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CheckCircleOutlined = function CheckCircleOutlined(props, context) {
var p = _objectSpread$S({}, props, context.attrs);
return createVNode(Icon, _objectSpread$S({}, p, {
"icon": CheckCircleOutlined$1
}), null);
};
CheckCircleOutlined.displayName = 'CheckCircleOutlined';
CheckCircleOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var InfoCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" };
function _objectSpread$R(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$R(target, key, source[key]); }); } return target; }
function _defineProperty$R(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var InfoCircleOutlined = function InfoCircleOutlined(props, context) {
var p = _objectSpread$R({}, props, context.attrs);
return createVNode(Icon, _objectSpread$R({}, p, {
"icon": InfoCircleOutlined$1
}), null);
};
InfoCircleOutlined.displayName = 'InfoCircleOutlined';
InfoCircleOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var CloseCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" } }] }, "name": "close-circle", "theme": "outlined" };
function _objectSpread$Q(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$Q(target, key, source[key]); }); } return target; }
function _defineProperty$Q(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CloseCircleOutlined = function CloseCircleOutlined(props, context) {
var p = _objectSpread$Q({}, props, context.attrs);
return createVNode(Icon, _objectSpread$Q({}, p, {
"icon": CloseCircleOutlined$1
}), null);
};
CloseCircleOutlined.displayName = 'CloseCircleOutlined';
CloseCircleOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var ExclamationCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" };
function _objectSpread$P(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$P(target, key, source[key]); }); } return target; }
function _defineProperty$P(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ExclamationCircleOutlined = function ExclamationCircleOutlined(props, context) {
var p = _objectSpread$P({}, props, context.attrs);
return createVNode(Icon, _objectSpread$P({}, p, {
"icon": ExclamationCircleOutlined$1
}), null);
};
ExclamationCircleOutlined.displayName = 'ExclamationCircleOutlined';
ExclamationCircleOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var CloseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
function _objectSpread$O(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$O(target, key, source[key]); }); } return target; }
function _defineProperty$O(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CloseOutlined = function CloseOutlined(props, context) {
var p = _objectSpread$O({}, props, context.attrs);
return createVNode(Icon, _objectSpread$O({}, p, {
"icon": CloseOutlined$1
}), null);
};
CloseOutlined.displayName = 'CloseOutlined';
CloseOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var LoadingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
function _objectSpread$N(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$N(target, key, source[key]); }); } return target; }
function _defineProperty$N(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var LoadingOutlined = function LoadingOutlined(props, context) {
var p = _objectSpread$N({}, props, context.attrs);
return createVNode(Icon, _objectSpread$N({}, p, {
"icon": LoadingOutlined$1
}), null);
};
LoadingOutlined.displayName = 'LoadingOutlined';
LoadingOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var ExclamationCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "exclamation-circle", "theme": "filled" };
function _objectSpread$M(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$M(target, key, source[key]); }); } return target; }
function _defineProperty$M(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ExclamationCircleFilled = function ExclamationCircleFilled(props, context) {
var p = _objectSpread$M({}, props, context.attrs);
return createVNode(Icon, _objectSpread$M({}, p, {
"icon": ExclamationCircleFilled$1
}), null);
};
ExclamationCircleFilled.displayName = 'ExclamationCircleFilled';
ExclamationCircleFilled.inheritAttrs = false;
// This icon file is generated automatically.
var CloseCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" } }] }, "name": "close-circle", "theme": "filled" };
function _objectSpread$L(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$L(target, key, source[key]); }); } return target; }
function _defineProperty$L(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CloseCircleFilled = function CloseCircleFilled(props, context) {
var p = _objectSpread$L({}, props, context.attrs);
return createVNode(Icon, _objectSpread$L({}, p, {
"icon": CloseCircleFilled$1
}), null);
};
CloseCircleFilled.displayName = 'CloseCircleFilled';
CloseCircleFilled.inheritAttrs = false;
// This icon file is generated automatically.
var CheckCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" };
function _objectSpread$K(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$K(target, key, source[key]); }); } return target; }
function _defineProperty$K(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CheckCircleFilled = function CheckCircleFilled(props, context) {
var p = _objectSpread$K({}, props, context.attrs);
return createVNode(Icon, _objectSpread$K({}, p, {
"icon": CheckCircleFilled$1
}), null);
};
CheckCircleFilled.displayName = 'CheckCircleFilled';
CheckCircleFilled.inheritAttrs = false;
// This icon file is generated automatically.
var InfoCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "info-circle", "theme": "filled" };
function _objectSpread$J(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$J(target, key, source[key]); }); } return target; }
function _defineProperty$J(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var InfoCircleFilled = function InfoCircleFilled(props, context) {
var p = _objectSpread$J({}, props, context.attrs);
return createVNode(Icon, _objectSpread$J({}, p, {
"icon": InfoCircleFilled$1
}), null);
};
InfoCircleFilled.displayName = 'InfoCircleFilled';
InfoCircleFilled.inheritAttrs = false;
var SECONDS_A_MINUTE = 60;
var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
var SECONDS_A_DAY = SECONDS_A_HOUR * 24;
var SECONDS_A_WEEK = SECONDS_A_DAY * 7;
var MILLISECONDS_A_SECOND = 1e3;
var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales
var MS = 'millisecond';
var S = 'second';
var MIN = 'minute';
var H = 'hour';
var D = 'day';
var W = 'week';
var M = 'month';
var Q = 'quarter';
var Y = 'year';
var DATE = 'date';
var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';
var INVALID_DATE_STRING = 'Invalid Date'; // regex
var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
// English [en]
// We don't need weekdaysShort, weekdaysMin, monthsShort in en.js locale
const en = {
name: 'en',
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
ordinal: function ordinal(n) {
var s = ['th', 'st', 'nd', 'rd'];
var v = n % 100;
return "[" + n + (s[(v - 20) % 10] || s[v] || s[0]) + "]";
}
};
var padStart = function padStart(string, length, pad) {
var s = String(string);
if (!s || s.length >= length) return string;
return "" + Array(length + 1 - s.length).join(pad) + string;
};
var padZoneStr = function padZoneStr(instance) {
var negMinutes = -instance.utcOffset();
var minutes = Math.abs(negMinutes);
var hourOffset = Math.floor(minutes / 60);
var minuteOffset = minutes % 60;
return "" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + ":" + padStart(minuteOffset, 2, '0');
};
var monthDiff = function monthDiff(a, b) {
// function from moment.js in order to keep the same result
if (a.date() < b.date()) return -monthDiff(b, a);
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());
var anchor = a.clone().add(wholeMonthDiff, M);
var c = b - anchor < 0;
var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), M);
return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);
};
var absFloor = function absFloor(n) {
return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
};
var prettyUnit = function prettyUnit(u) {
var special = {
M: M,
y: Y,
w: W,
d: D,
D: DATE,
h: H,
m: MIN,
s: S,
ms: MS,
Q: Q
};
return special[u] || String(u || '').toLowerCase().replace(/s$/, '');
};
var isUndefined = function isUndefined(s) {
return s === undefined;
};
const U = {
s: padStart,
z: padZoneStr,
m: monthDiff,
a: absFloor,
p: prettyUnit,
u: isUndefined
};
var L = 'en'; // global locale
var Ls = {}; // global loaded locale
Ls[L] = en;
var IS_DAYJS = '$isDayjsObject'; // eslint-disable-next-line no-use-before-define
var isDayjs = function isDayjs(d) {
return d instanceof Dayjs || !!(d && d[IS_DAYJS]);
};
var parseLocale$1 = function parseLocale(preset, object, isLocal) {
var l;
if (!preset) return L;
if (typeof preset === 'string') {
var presetLower = preset.toLowerCase();
if (Ls[presetLower]) {
l = presetLower;
}
if (object) {
Ls[presetLower] = object;
l = presetLower;
}
var presetSplit = preset.split('-');
if (!l && presetSplit.length > 1) {
return parseLocale(presetSplit[0]);
}
} else {
var name = preset.name;
Ls[name] = preset;
l = name;
}
if (!isLocal && l) L = l;
return l || !isLocal && L;
};
var dayjs = function dayjs(date, c) {
if (isDayjs(date)) {
return date.clone();
} // eslint-disable-next-line no-nested-ternary
var cfg = typeof c === 'object' ? c : {};
cfg.date = date;
cfg.args = arguments; // eslint-disable-line prefer-rest-params
return new Dayjs(cfg); // eslint-disable-line no-use-before-define
};
var wrapper = function wrapper(date, instance) {
return dayjs(date, {
locale: instance.$L,
utc: instance.$u,
x: instance.$x,
$offset: instance.$offset // todo: refactor; do not use this.$offset in you code
});
};
var Utils = U; // for plugin use
Utils.l = parseLocale$1;
Utils.i = isDayjs;
Utils.w = wrapper;
var parseDate = function parseDate(cfg) {
var date = cfg.date,
utc = cfg.utc;
if (date === null) return new Date(NaN); // null is invalid
if (Utils.u(date)) return new Date(); // today
if (date instanceof Date) return new Date(date);
if (typeof date === 'string' && !/Z$/i.test(date)) {
var d = date.match(REGEX_PARSE);
if (d) {
var m = d[2] - 1 || 0;
var ms = (d[7] || '0').substring(0, 3);
if (utc) {
return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));
}
return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
}
}
return new Date(date); // everything else
};
var Dayjs = /*#__PURE__*/function () {
function Dayjs(cfg) {
this.$L = parseLocale$1(cfg.locale, null, true);
this.parse(cfg); // for plugin
this.$x = this.$x || cfg.x || {};
this[IS_DAYJS] = true;
}
var _proto = Dayjs.prototype;
_proto.parse = function parse(cfg) {
this.$d = parseDate(cfg);
this.init();
};
_proto.init = function init() {
var $d = this.$d;
this.$y = $d.getFullYear();
this.$M = $d.getMonth();
this.$D = $d.getDate();
this.$W = $d.getDay();
this.$H = $d.getHours();
this.$m = $d.getMinutes();
this.$s = $d.getSeconds();
this.$ms = $d.getMilliseconds();
} // eslint-disable-next-line class-methods-use-this
;
_proto.$utils = function $utils() {
return Utils;
};
_proto.isValid = function isValid() {
return !(this.$d.toString() === INVALID_DATE_STRING);
};
_proto.isSame = function isSame(that, units) {
var other = dayjs(that);
return this.startOf(units) <= other && other <= this.endOf(units);
};
_proto.isAfter = function isAfter(that, units) {
return dayjs(that) < this.startOf(units);
};
_proto.isBefore = function isBefore(that, units) {
return this.endOf(units) < dayjs(that);
};
_proto.$g = function $g(input, get, set) {
if (Utils.u(input)) return this[get];
return this.set(set, input);
};
_proto.unix = function unix() {
return Math.floor(this.valueOf() / 1000);
};
_proto.valueOf = function valueOf() {
// timezone(hour) * 60 * 60 * 1000 => ms
return this.$d.getTime();
};
_proto.startOf = function startOf(units, _startOf) {
var _this = this;
// startOf -> endOf
var isStartOf = !Utils.u(_startOf) ? _startOf : true;
var unit = Utils.p(units);
var instanceFactory = function instanceFactory(d, m) {
var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this);
return isStartOf ? ins : ins.endOf(D);
};
var instanceFactorySet = function instanceFactorySet(method, slice) {
var argumentStart = [0, 0, 0, 0];
var argumentEnd = [23, 59, 59, 999];
return Utils.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread
_this.toDate('s'), (isStartOf ? argumentStart : argumentEnd).slice(slice)), _this);
};
var $W = this.$W,
$M = this.$M,
$D = this.$D;
var utcPad = "set" + (this.$u ? 'UTC' : '');
switch (unit) {
case Y:
return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);
case M:
return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);
case W:
{
var weekStart = this.$locale().weekStart || 0;
var gap = ($W < weekStart ? $W + 7 : $W) - weekStart;
return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);
}
case D:
case DATE:
return instanceFactorySet(utcPad + "Hours", 0);
case H:
return instanceFactorySet(utcPad + "Minutes", 1);
case MIN:
return instanceFactorySet(utcPad + "Seconds", 2);
case S:
return instanceFactorySet(utcPad + "Milliseconds", 3);
default:
return this.clone();
}
};
_proto.endOf = function endOf(arg) {
return this.startOf(arg, false);
};
_proto.$set = function $set(units, _int) {
var _C$D$C$DATE$C$M$C$Y$C;
// private set
var unit = Utils.p(units);
var utcPad = "set" + (this.$u ? 'UTC' : '');
var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[D] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[DATE] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[M] = utcPad + "Month", _C$D$C$DATE$C$M$C$Y$C[Y] = utcPad + "FullYear", _C$D$C$DATE$C$M$C$Y$C[H] = utcPad + "Hours", _C$D$C$DATE$C$M$C$Y$C[MIN] = utcPad + "Minutes", _C$D$C$DATE$C$M$C$Y$C[S] = utcPad + "Seconds", _C$D$C$DATE$C$M$C$Y$C[MS] = utcPad + "Milliseconds", _C$D$C$DATE$C$M$C$Y$C)[unit];
var arg = unit === D ? this.$D + (_int - this.$W) : _int;
if (unit === M || unit === Y) {
// clone is for badMutable plugin
var date = this.clone().set(DATE, 1);
date.$d[name](arg);
date.init();
this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d;
} else if (name) this.$d[name](arg);
this.init();
return this;
};
_proto.set = function set(string, _int2) {
return this.clone().$set(string, _int2);
};
_proto.get = function get(unit) {
return this[Utils.p(unit)]();
};
_proto.add = function add(number, units) {
var _this2 = this,
_C$MIN$C$H$C$S$unit;
number = Number(number); // eslint-disable-line no-param-reassign
var unit = Utils.p(units);
var instanceFactorySet = function instanceFactorySet(n) {
var d = dayjs(_this2);
return Utils.w(d.date(d.date() + Math.round(n * number)), _this2);
};
if (unit === M) {
return this.set(M, this.$M + number);
}
if (unit === Y) {
return this.set(Y, this.$y + number);
}
if (unit === D) {
return instanceFactorySet(1);
}
if (unit === W) {
return instanceFactorySet(7);
}
var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[MIN] = MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[H] = MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[S] = MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1; // ms
var nextTimeStamp = this.$d.getTime() + number * step;
return Utils.w(nextTimeStamp, this);
};
_proto.subtract = function subtract(number, string) {
return this.add(number * -1, string);
};
_proto.format = function format(formatStr) {
var _this3 = this;
var locale = this.$locale();
if (!this.isValid()) return locale.invalidDate || INVALID_DATE_STRING;
var str = formatStr || FORMAT_DEFAULT;
var zoneStr = Utils.z(this);
var $H = this.$H,
$m = this.$m,
$M = this.$M;
var weekdays = locale.weekdays,
months = locale.months,
meridiem = locale.meridiem;
var getShort = function getShort(arr, index, full, length) {
return arr && (arr[index] || arr(_this3, str)) || full[index].slice(0, length);
};
var get$H = function get$H(num) {
return Utils.s($H % 12 || 12, num, '0');
};
var meridiemFunc = meridiem || function (hour, minute, isLowercase) {
var m = hour < 12 ? 'AM' : 'PM';
return isLowercase ? m.toLowerCase() : m;
};
var matches = function matches(match) {
switch (match) {
case 'YY':
return String(_this3.$y).slice(-2);
case 'YYYY':
return Utils.s(_this3.$y, 4, '0');
case 'M':
return $M + 1;
case 'MM':
return Utils.s($M + 1, 2, '0');
case 'MMM':
return getShort(locale.monthsShort, $M, months, 3);
case 'MMMM':
return getShort(months, $M);
case 'D':
return _this3.$D;
case 'DD':
return Utils.s(_this3.$D, 2, '0');
case 'd':
return String(_this3.$W);
case 'dd':
return getShort(locale.weekdaysMin, _this3.$W, weekdays, 2);
case 'ddd':
return getShort(locale.weekdaysShort, _this3.$W, weekdays, 3);
case 'dddd':
return weekdays[_this3.$W];
case 'H':
return String($H);
case 'HH':
return Utils.s($H, 2, '0');
case 'h':
return get$H(1);
case 'hh':
return get$H(2);
case 'a':
return meridiemFunc($H, $m, true);
case 'A':
return meridiemFunc($H, $m, false);
case 'm':
return String($m);
case 'mm':
return Utils.s($m, 2, '0');
case 's':
return String(_this3.$s);
case 'ss':
return Utils.s(_this3.$s, 2, '0');
case 'SSS':
return Utils.s(_this3.$ms, 3, '0');
case 'Z':
return zoneStr;
}
return null;
};
return str.replace(REGEX_FORMAT, function (match, $1) {
return $1 || matches(match) || zoneStr.replace(':', '');
}); // 'ZZ'
};
_proto.utcOffset = function utcOffset() {
// Because a bug at FF24, we're rounding the timezone offset around 15 minutes
// https://github.com/moment/moment/pull/1871
return -Math.round(this.$d.getTimezoneOffset() / 15) * 15;
};
_proto.diff = function diff(input, units, _float) {
var _this4 = this;
var unit = Utils.p(units);
var that = dayjs(input);
var zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE;
var diff = this - that;
var getMonth = function getMonth() {
return Utils.m(_this4, that);
};
var result;
switch (unit) {
case Y:
result = getMonth() / 12;
break;
case M:
result = getMonth();
break;
case Q:
result = getMonth() / 3;
break;
case W:
result = (diff - zoneDelta) / MILLISECONDS_A_WEEK;
break;
case D:
result = (diff - zoneDelta) / MILLISECONDS_A_DAY;
break;
case H:
result = diff / MILLISECONDS_A_HOUR;
break;
case MIN:
result = diff / MILLISECONDS_A_MINUTE;
break;
case S:
result = diff / MILLISECONDS_A_SECOND;
break;
default:
result = diff; // milliseconds
break;
}
return _float ? result : Utils.a(result);
};
_proto.daysInMonth = function daysInMonth() {
return this.endOf(M).$D;
};
_proto.$locale = function $locale() {
// get locale object
return Ls[this.$L];
};
_proto.locale = function locale(preset, object) {
if (!preset) return this.$L;
var that = this.clone();
var nextLocaleName = parseLocale$1(preset, object, true);
if (nextLocaleName) that.$L = nextLocaleName;
return that;
};
_proto.clone = function clone() {
return Utils.w(this.$d, this);
};
_proto.toDate = function toDate() {
return new Date(this.valueOf());
};
_proto.toJSON = function toJSON() {
return this.isValid() ? this.toISOString() : null;
};
_proto.toISOString = function toISOString() {
// ie 8 return
// new Dayjs(this.valueOf() + this.$d.getTimezoneOffset() * 60000)
// .format('YYYY-MM-DDTHH:mm:ss.SSS[Z]')
return this.$d.toISOString();
};
_proto.toString = function toString() {
return this.$d.toUTCString();
};
return Dayjs;
}();
var proto = Dayjs.prototype;
dayjs.prototype = proto;
[['$ms', MS], ['$s', S], ['$m', MIN], ['$H', H], ['$W', D], ['$M', M], ['$y', Y], ['$D', DATE]].forEach(function (g) {
proto[g[1]] = function (input) {
return this.$g(input, g[0], g[1]);
};
});
dayjs.extend = function (plugin, option) {
if (!plugin.$i) {
// install plugin only once
plugin(option, Dayjs, dayjs);
plugin.$i = true;
}
return dayjs;
};
dayjs.locale = parseLocale$1;
dayjs.isDayjs = isDayjs;
dayjs.unix = function (timestamp) {
return dayjs(timestamp * 1e3);
};
dayjs.en = Ls[L];
dayjs.Ls = Ls;
dayjs.p = {};
const updateLocale = (function (option, Dayjs, dayjs) {
dayjs.updateLocale = function (locale, customConfig) {
var localeList = dayjs.Ls;
var localeConfig = localeList[locale];
if (!localeConfig) return;
var customConfigKeys = customConfig ? Object.keys(customConfig) : [];
customConfigKeys.forEach(function (c) {
localeConfig[c] = customConfig[c];
});
return localeConfig; // eslint-disable-line consistent-return
};
});
const relativeTime = (function (o, c, d) {
o = o || {};
var proto = c.prototype;
var relObj = {
future: 'in %s',
past: '%s ago',
s: 'a few seconds',
m: 'a minute',
mm: '%d minutes',
h: 'an hour',
hh: '%d hours',
d: 'a day',
dd: '%d days',
M: 'a month',
MM: '%d months',
y: 'a year',
yy: '%d years'
};
d.en.relativeTime = relObj;
proto.fromToBase = function (input, withoutSuffix, instance, isFrom, postFormat) {
var loc = instance.$locale().relativeTime || relObj;
var T = o.thresholds || [{
l: 's',
r: 44,
d: S
}, {
l: 'm',
r: 89
}, {
l: 'mm',
r: 44,
d: MIN
}, {
l: 'h',
r: 89
}, {
l: 'hh',
r: 21,
d: H
}, {
l: 'd',
r: 35
}, {
l: 'dd',
r: 25,
d: D
}, {
l: 'M',
r: 45
}, {
l: 'MM',
r: 10,
d: M
}, {
l: 'y',
r: 17
}, {
l: 'yy',
d: Y
}];
var Tl = T.length;
var result;
var out;
var isFuture;
for (var i = 0; i < Tl; i += 1) {
var t = T[i];
if (t.d) {
result = isFrom ? d(input).diff(instance, t.d, true) : instance.diff(input, t.d, true);
}
var abs = (o.rounding || Math.round)(Math.abs(result));
isFuture = result > 0;
if (abs <= t.r || !t.r) {
if (abs <= 1 && i > 0) t = T[i - 1]; // 1 minutes -> a minute, 0 seconds -> 0 second
var format = loc[t.l];
if (postFormat) {
abs = postFormat("" + abs);
}
if (typeof format === 'string') {
out = format.replace('%d', abs);
} else {
out = format(abs, withoutSuffix, t.l, isFuture);
}
break;
}
}
if (withoutSuffix) return out;
var pastOrFuture = isFuture ? loc.future : loc.past;
if (typeof pastOrFuture === 'function') {
return pastOrFuture(out);
}
return pastOrFuture.replace('%s', out);
};
function fromTo(input, withoutSuffix, instance, isFrom) {
return proto.fromToBase(input, withoutSuffix, instance, isFrom);
}
proto.to = function (input, withoutSuffix) {
return fromTo(input, withoutSuffix, this, true);
};
proto.from = function (input, withoutSuffix) {
return fromTo(input, withoutSuffix, this);
};
var makeNow = function makeNow(thisDay) {
return thisDay.$u ? d.utc() : d();
};
proto.toNow = function (withoutSuffix) {
return this.to(makeNow(this), withoutSuffix);
};
proto.fromNow = function (withoutSuffix) {
return this.from(makeNow(this), withoutSuffix);
};
});
var REGEX_VALID_OFFSET_FORMAT = /[+-]\d\d(?::?\d\d)?/g;
var REGEX_OFFSET_HOURS_MINUTES_FORMAT = /([+-]|\d\d)/g;
function offsetFromString$1(value) {
if (value === void 0) {
value = '';
}
var offset = value.match(REGEX_VALID_OFFSET_FORMAT);
if (!offset) {
return null;
}
var _ref = ("" + offset[0]).match(REGEX_OFFSET_HOURS_MINUTES_FORMAT) || ['-', 0, 0],
indicator = _ref[0],
hoursOffset = _ref[1],
minutesOffset = _ref[2];
var totalOffsetInMinutes = +hoursOffset * 60 + +minutesOffset;
if (totalOffsetInMinutes === 0) {
return 0;
}
return indicator === '+' ? totalOffsetInMinutes : -totalOffsetInMinutes;
}
const utc = (function (option, Dayjs, dayjs) {
var proto = Dayjs.prototype;
dayjs.utc = function (date) {
var cfg = {
date: date,
utc: true,
args: arguments
}; // eslint-disable-line prefer-rest-params
return new Dayjs(cfg); // eslint-disable-line no-use-before-define
};
proto.utc = function (keepLocalTime) {
var ins = dayjs(this.toDate(), {
locale: this.$L,
utc: true
});
if (keepLocalTime) {
return ins.add(this.utcOffset(), MIN);
}
return ins;
};
proto.local = function () {
return dayjs(this.toDate(), {
locale: this.$L,
utc: false
});
};
var oldParse = proto.parse;
proto.parse = function (cfg) {
if (cfg.utc) {
this.$u = true;
}
if (!this.$utils().u(cfg.$offset)) {
this.$offset = cfg.$offset;
}
oldParse.call(this, cfg);
};
var oldInit = proto.init;
proto.init = function () {
if (this.$u) {
var $d = this.$d;
this.$y = $d.getUTCFullYear();
this.$M = $d.getUTCMonth();
this.$D = $d.getUTCDate();
this.$W = $d.getUTCDay();
this.$H = $d.getUTCHours();
this.$m = $d.getUTCMinutes();
this.$s = $d.getUTCSeconds();
this.$ms = $d.getUTCMilliseconds();
} else {
oldInit.call(this);
}
};
var oldUtcOffset = proto.utcOffset;
proto.utcOffset = function (input, keepLocalTime) {
var _this$$utils = this.$utils(),
u = _this$$utils.u;
if (u(input)) {
if (this.$u) {
return 0;
}
if (!u(this.$offset)) {
return this.$offset;
}
return oldUtcOffset.call(this);
}
if (typeof input === 'string') {
input = offsetFromString$1(input);
if (input === null) {
return this;
}
}
var offset = Math.abs(input) <= 16 ? input * 60 : input;
var ins = this;
if (keepLocalTime) {
ins.$offset = offset;
ins.$u = input === 0;
return ins;
}
if (input !== 0) {
var localTimezoneOffset = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
ins = this.local().add(offset + localTimezoneOffset, MIN);
ins.$offset = offset;
ins.$x.$localOffset = localTimezoneOffset;
} else {
ins = this.utc();
}
return ins;
};
var oldFormat = proto.format;
var UTC_FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ss[Z]';
proto.format = function (formatStr) {
var str = formatStr || (this.$u ? UTC_FORMAT_DEFAULT : '');
return oldFormat.call(this, str);
};
proto.valueOf = function () {
var addedOffset = !this.$utils().u(this.$offset) ? this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset()) : 0;
return this.$d.valueOf() - addedOffset * MILLISECONDS_A_MINUTE;
};
proto.isUTC = function () {
return !!this.$u;
};
proto.toISOString = function () {
return this.toDate().toISOString();
};
proto.toString = function () {
return this.toDate().toUTCString();
};
var oldToDate = proto.toDate;
proto.toDate = function (type) {
if (type === 's' && this.$offset) {
return dayjs(this.format('YYYY-MM-DD HH:mm:ss:SSS')).toDate();
}
return oldToDate.call(this);
};
var oldDiff = proto.diff;
proto.diff = function (input, units, _float) {
if (input && this.$u === input.$u) {
return oldDiff.call(this, input, units, _float);
}
var localThis = this.local();
var localInput = dayjs(input).local();
return oldDiff.call(localThis, localInput, units, _float);
};
});
// This icon file is generated automatically.
var DownOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, "name": "down", "theme": "outlined" };
function _objectSpread$I(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$I(target, key, source[key]); }); } return target; }
function _defineProperty$I(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DownOutlined = function DownOutlined(props, context) {
var p = _objectSpread$I({}, props, context.attrs);
return createVNode(Icon, _objectSpread$I({}, p, {
"icon": DownOutlined$1
}), null);
};
DownOutlined.displayName = 'DownOutlined';
DownOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var CheckOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" } }] }, "name": "check", "theme": "outlined" };
function _objectSpread$H(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$H(target, key, source[key]); }); } return target; }
function _defineProperty$H(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CheckOutlined = function CheckOutlined(props, context) {
var p = _objectSpread$H({}, props, context.attrs);
return createVNode(Icon, _objectSpread$H({}, p, {
"icon": CheckOutlined$1
}), null);
};
CheckOutlined.displayName = 'CheckOutlined';
CheckOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var SearchOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
function _objectSpread$G(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$G(target, key, source[key]); }); } return target; }
function _defineProperty$G(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SearchOutlined = function SearchOutlined(props, context) {
var p = _objectSpread$G({}, props, context.attrs);
return createVNode(Icon, _objectSpread$G({}, p, {
"icon": SearchOutlined$1
}), null);
};
SearchOutlined.displayName = 'SearchOutlined';
SearchOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var EllipsisOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "ellipsis", "theme": "outlined" };
function _objectSpread$F(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$F(target, key, source[key]); }); } return target; }
function _defineProperty$F(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var EllipsisOutlined = function EllipsisOutlined(props, context) {
var p = _objectSpread$F({}, props, context.attrs);
return createVNode(Icon, _objectSpread$F({}, p, {
"icon": EllipsisOutlined$1
}), null);
};
EllipsisOutlined.displayName = 'EllipsisOutlined';
EllipsisOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var RightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
function _objectSpread$E(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$E(target, key, source[key]); }); } return target; }
function _defineProperty$E(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var RightOutlined = function RightOutlined(props, context) {
var p = _objectSpread$E({}, props, context.attrs);
return createVNode(Icon, _objectSpread$E({}, p, {
"icon": RightOutlined$1
}), null);
};
RightOutlined.displayName = 'RightOutlined';
RightOutlined.inheritAttrs = false;
const weekday = (function (o, c) {
var proto = c.prototype;
proto.weekday = function (input) {
var weekStart = this.$locale().weekStart || 0;
var $W = this.$W;
var weekday = ($W < weekStart ? $W + 7 : $W) - weekStart;
if (this.$utils().u(input)) {
return weekday;
}
return this.subtract(weekday, 'day').add(input, 'day');
};
});
// eslint-disable-next-line import/prefer-default-export
var t = function t(format) {
return format.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function (_, a, b) {
return a || b.slice(1);
});
};
var englishFormats = {
LTS: 'h:mm:ss A',
LT: 'h:mm A',
L: 'MM/DD/YYYY',
LL: 'MMMM D, YYYY',
LLL: 'MMMM D, YYYY h:mm A',
LLLL: 'dddd, MMMM D, YYYY h:mm A'
};
var u = function u(formatStr, formats) {
return formatStr.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function (_, a, b) {
var B = b && b.toUpperCase();
return a || formats[b] || englishFormats[b] || t(formats[B]);
});
};
const localeData = (function (o, c, dayjs) {
// locale needed later
var proto = c.prototype;
var getLocalePart = function getLocalePart(part) {
return part && (part.indexOf ? part : part.s);
};
var getShort = function getShort(ins, target, full, num, localeOrder) {
var locale = ins.name ? ins : ins.$locale();
var targetLocale = getLocalePart(locale[target]);
var fullLocale = getLocalePart(locale[full]);
var result = targetLocale || fullLocale.map(function (f) {
return f.slice(0, num);
});
if (!localeOrder) return result;
var weekStart = locale.weekStart;
return result.map(function (_, index) {
return result[(index + (weekStart || 0)) % 7];
});
};
var getDayjsLocaleObject = function getDayjsLocaleObject() {
return dayjs.Ls[dayjs.locale()];
};
var getLongDateFormat = function getLongDateFormat(l, format) {
return l.formats[format] || t(l.formats[format.toUpperCase()]);
};
var localeData = function localeData() {
var _this = this;
return {
months: function months(instance) {
return instance ? instance.format('MMMM') : getShort(_this, 'months');
},
monthsShort: function monthsShort(instance) {
return instance ? instance.format('MMM') : getShort(_this, 'monthsShort', 'months', 3);
},
firstDayOfWeek: function firstDayOfWeek() {
return _this.$locale().weekStart || 0;
},
weekdays: function weekdays(instance) {
return instance ? instance.format('dddd') : getShort(_this, 'weekdays');
},
weekdaysMin: function weekdaysMin(instance) {
return instance ? instance.format('dd') : getShort(_this, 'weekdaysMin', 'weekdays', 2);
},
weekdaysShort: function weekdaysShort(instance) {
return instance ? instance.format('ddd') : getShort(_this, 'weekdaysShort', 'weekdays', 3);
},
longDateFormat: function longDateFormat(format) {
return getLongDateFormat(_this.$locale(), format);
},
meridiem: this.$locale().meridiem,
ordinal: this.$locale().ordinal
};
};
proto.localeData = function () {
return localeData.bind(this)();
};
dayjs.localeData = function () {
var localeObject = getDayjsLocaleObject();
return {
firstDayOfWeek: function firstDayOfWeek() {
return localeObject.weekStart || 0;
},
weekdays: function weekdays() {
return dayjs.weekdays();
},
weekdaysShort: function weekdaysShort() {
return dayjs.weekdaysShort();
},
weekdaysMin: function weekdaysMin() {
return dayjs.weekdaysMin();
},
months: function months() {
return dayjs.months();
},
monthsShort: function monthsShort() {
return dayjs.monthsShort();
},
longDateFormat: function longDateFormat(format) {
return getLongDateFormat(localeObject, format);
},
meridiem: localeObject.meridiem,
ordinal: localeObject.ordinal
};
};
dayjs.months = function () {
return getShort(getDayjsLocaleObject(), 'months');
};
dayjs.monthsShort = function () {
return getShort(getDayjsLocaleObject(), 'monthsShort', 'months', 3);
};
dayjs.weekdays = function (localeOrder) {
return getShort(getDayjsLocaleObject(), 'weekdays', null, null, localeOrder);
};
dayjs.weekdaysShort = function (localeOrder) {
return getShort(getDayjsLocaleObject(), 'weekdaysShort', 'weekdays', 3, localeOrder);
};
dayjs.weekdaysMin = function (localeOrder) {
return getShort(getDayjsLocaleObject(), 'weekdaysMin', 'weekdays', 2, localeOrder);
};
});
const weekOfYear = (function (o, c, d) {
var proto = c.prototype;
proto.week = function (week) {
if (week === void 0) {
week = null;
}
if (week !== null) {
return this.add((week - this.week()) * 7, D);
}
var yearStart = this.$locale().yearStart || 1;
if (this.month() === 11 && this.date() > 25) {
// d(this) is for badMutable
var nextYearStartDay = d(this).startOf(Y).add(1, Y).date(yearStart);
var thisEndOfWeek = d(this).endOf(W);
if (nextYearStartDay.isBefore(thisEndOfWeek)) {
return 1;
}
}
var yearStartDay = d(this).startOf(Y).date(yearStart);
var yearStartWeek = yearStartDay.startOf(W).subtract(1, MS);
var diffInWeek = this.diff(yearStartWeek, W, true);
if (diffInWeek < 0) {
return d(this).startOf('week').week();
}
return Math.ceil(diffInWeek);
};
proto.weeks = function (week) {
if (week === void 0) {
week = null;
}
return this.week(week);
};
});
const weekYear = (function (o, c) {
var proto = c.prototype;
proto.weekYear = function () {
var month = this.month();
var weekOfYear = this.week();
var year = this.year();
if (weekOfYear === 1 && month === 11) {
return year + 1;
}
if (month === 0 && weekOfYear >= 52) {
return year - 1;
}
return year;
};
});
const quarterOfYear = (function (o, c) {
var proto = c.prototype;
proto.quarter = function (quarter) {
if (!this.$utils().u(quarter)) {
return this.month(this.month() % 3 + (quarter - 1) * 3);
}
return Math.ceil((this.month() + 1) / 3);
};
var oldAdd = proto.add;
proto.add = function (number, units) {
number = Number(number); // eslint-disable-line no-param-reassign
var unit = this.$utils().p(units);
if (unit === Q) {
return this.add(number * 3, M);
}
return oldAdd.bind(this)(number, units);
};
var oldStartOf = proto.startOf;
proto.startOf = function (units, startOf) {
var utils = this.$utils();
var isStartOf = !utils.u(startOf) ? startOf : true;
var unit = utils.p(units);
if (unit === Q) {
var quarter = this.quarter() - 1;
return isStartOf ? this.month(quarter * 3).startOf(M).startOf(D) : this.month(quarter * 3 + 2).endOf(M).endOf(D);
}
return oldStartOf.bind(this)(units, startOf);
};
});
const advancedFormat = (function (o, c) {
// locale needed later
var proto = c.prototype;
var oldFormat = proto.format;
proto.format = function (formatStr) {
var _this = this;
var locale = this.$locale();
if (!this.isValid()) {
return oldFormat.bind(this)(formatStr);
}
var utils = this.$utils();
var str = formatStr || FORMAT_DEFAULT;
var result = str.replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function (match) {
switch (match) {
case 'Q':
return Math.ceil((_this.$M + 1) / 3);
case 'Do':
return locale.ordinal(_this.$D);
case 'gggg':
return _this.weekYear();
case 'GGGG':
return _this.isoWeekYear();
case 'wo':
return locale.ordinal(_this.week(), 'W');
// W for week
case 'w':
case 'ww':
return utils.s(_this.week(), match === 'w' ? 1 : 2, '0');
case 'W':
case 'WW':
return utils.s(_this.isoWeek(), match === 'W' ? 1 : 2, '0');
case 'k':
case 'kk':
return utils.s(String(_this.$H === 0 ? 24 : _this.$H), match === 'k' ? 1 : 2, '0');
case 'X':
return Math.floor(_this.$d.getTime() / 1000);
case 'x':
return _this.$d.getTime();
case 'z':
return "[" + _this.offsetName() + "]";
case 'zzz':
return "[" + _this.offsetName('long') + "]";
default:
return match;
}
});
return oldFormat.bind(this)(result);
};
});
var formattingTokens = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g;
var match1 = /\d/; // 0 - 9
var match2 = /\d\d/; // 00 - 99
var match3 = /\d{3}/; // 000 - 999
var match4 = /\d{4}/; // 0000 - 9999
var match1to2 = /\d\d?/; // 0 - 99
var matchSigned = /[+-]?\d+/; // -inf - inf
var matchOffset = /[+-]\d\d:?(\d\d)?|Z/; // +00:00 -00:00 +0000 or -0000 +00 or Z
var matchWord = /\d*[^-_:/,()\s\d]+/; // Word
var locale$4 = {};
var parseTwoDigitYear = function parseTwoDigitYear(input) {
input = +input;
return input + (input > 68 ? 1900 : 2000);
};
function offsetFromString(string) {
if (!string) return 0;
if (string === 'Z') return 0;
var parts = string.match(/([+-]|\d\d)/g);
var minutes = +(parts[1] * 60) + (+parts[2] || 0);
return minutes === 0 ? 0 : parts[0] === '+' ? -minutes : minutes; // eslint-disable-line no-nested-ternary
}
var addInput = function addInput(property) {
return function (input) {
this[property] = +input;
};
};
var zoneExpressions = [matchOffset, function (input) {
var zone = this.zone || (this.zone = {});
zone.offset = offsetFromString(input);
}];
var getLocalePart = function getLocalePart(name) {
var part = locale$4[name];
return part && (part.indexOf ? part : part.s.concat(part.f));
};
var meridiemMatch = function meridiemMatch(input, isLowerCase) {
var isAfternoon;
var _locale = locale$4,
meridiem = _locale.meridiem;
if (!meridiem) {
isAfternoon = input === (isLowerCase ? 'pm' : 'PM');
} else {
for (var i = 1; i <= 24; i += 1) {
// todo: fix input === meridiem(i, 0, isLowerCase)
if (input.indexOf(meridiem(i, 0, isLowerCase)) > -1) {
isAfternoon = i > 12;
break;
}
}
}
return isAfternoon;
};
var expressions = {
A: [matchWord, function (input) {
this.afternoon = meridiemMatch(input, false);
}],
a: [matchWord, function (input) {
this.afternoon = meridiemMatch(input, true);
}],
Q: [match1, function (input) {
this.month = (input - 1) * 3 + 1;
}],
S: [match1, function (input) {
this.milliseconds = +input * 100;
}],
SS: [match2, function (input) {
this.milliseconds = +input * 10;
}],
SSS: [match3, function (input) {
this.milliseconds = +input;
}],
s: [match1to2, addInput('seconds')],
ss: [match1to2, addInput('seconds')],
m: [match1to2, addInput('minutes')],
mm: [match1to2, addInput('minutes')],
H: [match1to2, addInput('hours')],
h: [match1to2, addInput('hours')],
HH: [match1to2, addInput('hours')],
hh: [match1to2, addInput('hours')],
D: [match1to2, addInput('day')],
DD: [match2, addInput('day')],
Do: [matchWord, function (input) {
var _locale2 = locale$4,
ordinal = _locale2.ordinal;
var _input$match = input.match(/\d+/);
this.day = _input$match[0];
if (!ordinal) return;
for (var i = 1; i <= 31; i += 1) {
if (ordinal(i).replace(/\[|\]/g, '') === input) {
this.day = i;
}
}
}],
w: [match1to2, addInput('week')],
ww: [match2, addInput('week')],
M: [match1to2, addInput('month')],
MM: [match2, addInput('month')],
MMM: [matchWord, function (input) {
var months = getLocalePart('months');
var monthsShort = getLocalePart('monthsShort');
var matchIndex = (monthsShort || months.map(function (_) {
return _.slice(0, 3);
})).indexOf(input) + 1;
if (matchIndex < 1) {
throw new Error();
}
this.month = matchIndex % 12 || matchIndex;
}],
MMMM: [matchWord, function (input) {
var months = getLocalePart('months');
var matchIndex = months.indexOf(input) + 1;
if (matchIndex < 1) {
throw new Error();
}
this.month = matchIndex % 12 || matchIndex;
}],
Y: [matchSigned, addInput('year')],
YY: [match2, function (input) {
this.year = parseTwoDigitYear(input);
}],
YYYY: [match4, addInput('year')],
Z: zoneExpressions,
ZZ: zoneExpressions
};
function correctHours(time) {
var afternoon = time.afternoon;
if (afternoon !== undefined) {
var hours = time.hours;
if (afternoon) {
if (hours < 12) {
time.hours += 12;
}
} else if (hours === 12) {
time.hours = 0;
}
delete time.afternoon;
}
}
function makeParser(format) {
format = u(format, locale$4 && locale$4.formats);
var array = format.match(formattingTokens);
var length = array.length;
for (var i = 0; i < length; i += 1) {
var token = array[i];
var parseTo = expressions[token];
var regex = parseTo && parseTo[0];
var parser = parseTo && parseTo[1];
if (parser) {
array[i] = {
regex: regex,
parser: parser
};
} else {
array[i] = token.replace(/^\[|\]$/g, '');
}
}
return function (input) {
var time = {};
for (var _i = 0, start = 0; _i < length; _i += 1) {
var _token = array[_i];
if (typeof _token === 'string') {
start += _token.length;
} else {
var _regex = _token.regex,
_parser = _token.parser;
var part = input.slice(start);
var match = _regex.exec(part);
var value = match[0];
_parser.call(time, value);
input = input.replace(value, '');
}
}
correctHours(time);
return time;
};
}
var parseFormattedInput = function parseFormattedInput(input, format, utc, dayjs) {
try {
if (['x', 'X'].indexOf(format) > -1) return new Date((format === 'X' ? 1000 : 1) * input);
var parser = makeParser(format);
var _parser2 = parser(input),
year = _parser2.year,
month = _parser2.month,
day = _parser2.day,
hours = _parser2.hours,
minutes = _parser2.minutes,
seconds = _parser2.seconds,
milliseconds = _parser2.milliseconds,
zone = _parser2.zone,
week = _parser2.week;
var now = new Date();
var d = day || (!year && !month ? now.getDate() : 1);
var y = year || now.getFullYear();
var M = 0;
if (!(year && !month)) {
M = month > 0 ? month - 1 : now.getMonth();
}
var h = hours || 0;
var m = minutes || 0;
var s = seconds || 0;
var ms = milliseconds || 0;
if (zone) {
return new Date(Date.UTC(y, M, d, h, m, s, ms + zone.offset * 60 * 1000));
}
if (utc) {
return new Date(Date.UTC(y, M, d, h, m, s, ms));
}
var newDate;
newDate = new Date(y, M, d, h, m, s, ms);
if (week) {
newDate = dayjs(newDate).week(week).toDate();
}
return newDate;
} catch (e) {
return new Date(''); // Invalid Date
}
};
const customParseFormat = (function (o, C, d) {
d.p.customParseFormat = true;
if (o && o.parseTwoDigitYear) {
parseTwoDigitYear = o.parseTwoDigitYear;
}
var proto = C.prototype;
var oldParse = proto.parse;
proto.parse = function (cfg) {
var date = cfg.date,
utc = cfg.utc,
args = cfg.args;
this.$u = utc;
var format = args[1];
if (typeof format === 'string') {
var isStrictWithoutLocale = args[2] === true;
var isStrictWithLocale = args[3] === true;
var isStrict = isStrictWithoutLocale || isStrictWithLocale;
var pl = args[2];
if (isStrictWithLocale) {
pl = args[2];
}
locale$4 = this.$locale();
if (!isStrictWithoutLocale && pl) {
locale$4 = d.Ls[pl];
}
this.$d = parseFormattedInput(date, format, utc, d);
this.init();
if (pl && pl !== true) this.$L = this.locale(pl).$L; // use != to treat
// input number 1410715640579 and format string '1410715640579' equal
// eslint-disable-next-line eqeqeq
if (isStrict && date != this.format(format)) {
this.$d = new Date('');
} // reset global locale to make parallel unit test
locale$4 = {};
} else if (format instanceof Array) {
var len = format.length;
for (var i = 1; i <= len; i += 1) {
args[1] = format[i - 1];
var result = d.apply(this, args);
if (result.isValid()) {
this.$d = result.$d;
this.$L = result.$L;
this.init();
break;
}
if (i === len) this.$d = new Date('');
}
} else {
oldParse.call(this, cfg);
}
};
});
// This icon file is generated automatically.
var PlusOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
function _objectSpread$D(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$D(target, key, source[key]); }); } return target; }
function _defineProperty$D(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var PlusOutlined = function PlusOutlined(props, context) {
var p = _objectSpread$D({}, props, context.attrs);
return createVNode(Icon, _objectSpread$D({}, p, {
"icon": PlusOutlined$1
}), null);
};
PlusOutlined.displayName = 'PlusOutlined';
PlusOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var LeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" };
function _objectSpread$C(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$C(target, key, source[key]); }); } return target; }
function _defineProperty$C(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var LeftOutlined = function LeftOutlined(props, context) {
var p = _objectSpread$C({}, props, context.attrs);
return createVNode(Icon, _objectSpread$C({}, p, {
"icon": LeftOutlined$1
}), null);
};
LeftOutlined.displayName = 'LeftOutlined';
LeftOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var QuestionCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "question-circle", "theme": "outlined" };
function _objectSpread$B(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$B(target, key, source[key]); }); } return target; }
function _defineProperty$B(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var QuestionCircleOutlined = function QuestionCircleOutlined(props, context) {
var p = _objectSpread$B({}, props, context.attrs);
return createVNode(Icon, _objectSpread$B({}, p, {
"icon": QuestionCircleOutlined$1
}), null);
};
QuestionCircleOutlined.displayName = 'QuestionCircleOutlined';
QuestionCircleOutlined.inheritAttrs = false;
function isOptionsObject(options) {
return options === Object(options) && Object.keys(options).length !== 0;
}
function defaultBehavior(actions, behavior) {
if (behavior === void 0) {
behavior = 'auto';
}
var canSmoothScroll = ('scrollBehavior' in document.body.style);
actions.forEach(function (_ref) {
var el = _ref.el,
top = _ref.top,
left = _ref.left;
if (el.scroll && canSmoothScroll) {
el.scroll({
top: top,
left: left,
behavior: behavior
});
} else {
el.scrollTop = top;
el.scrollLeft = left;
}
});
}
function getOptions(options) {
if (options === false) {
return {
block: 'end',
inline: 'nearest'
};
}
if (isOptionsObject(options)) {
return options;
}
return {
block: 'start',
inline: 'nearest'
};
}
function scrollIntoView(target, options) {
var isTargetAttached = target.isConnected || target.ownerDocument.documentElement.contains(target);
if (isOptionsObject(options) && typeof options.behavior === 'function') {
return options.behavior(isTargetAttached ? compute(target, options) : []);
}
if (!isTargetAttached) {
return;
}
var computeOptions = getOptions(options);
return defaultBehavior(compute(target, computeOptions), computeOptions.behavior);
}
// This icon file is generated automatically.
var CalendarOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" } }] }, "name": "calendar", "theme": "outlined" };
function _objectSpread$A(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$A(target, key, source[key]); }); } return target; }
function _defineProperty$A(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CalendarOutlined = function CalendarOutlined(props, context) {
var p = _objectSpread$A({}, props, context.attrs);
return createVNode(Icon, _objectSpread$A({}, p, {
"icon": CalendarOutlined$1
}), null);
};
CalendarOutlined.displayName = 'CalendarOutlined';
CalendarOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var ClockCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" } }] }, "name": "clock-circle", "theme": "outlined" };
function _objectSpread$z(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$z(target, key, source[key]); }); } return target; }
function _defineProperty$z(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ClockCircleOutlined = function ClockCircleOutlined(props, context) {
var p = _objectSpread$z({}, props, context.attrs);
return createVNode(Icon, _objectSpread$z({}, p, {
"icon": ClockCircleOutlined$1
}), null);
};
ClockCircleOutlined.displayName = 'ClockCircleOutlined';
ClockCircleOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var SwapRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M873.1 596.2l-164-208A32 32 0 00684 376h-64.8c-6.7 0-10.4 7.7-6.3 13l144.3 183H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h695.9c26.8 0 41.7-30.8 25.2-51.8z" } }] }, "name": "swap-right", "theme": "outlined" };
function _objectSpread$y(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$y(target, key, source[key]); }); } return target; }
function _defineProperty$y(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SwapRightOutlined = function SwapRightOutlined(props, context) {
var p = _objectSpread$y({}, props, context.attrs);
return createVNode(Icon, _objectSpread$y({}, p, {
"icon": SwapRightOutlined$1
}), null);
};
SwapRightOutlined.displayName = 'SwapRightOutlined';
SwapRightOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var FileTextOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" } }] }, "name": "file-text", "theme": "outlined" };
function _objectSpread$x(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$x(target, key, source[key]); }); } return target; }
function _defineProperty$x(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var FileTextOutlined = function FileTextOutlined(props, context) {
var p = _objectSpread$x({}, props, context.attrs);
return createVNode(Icon, _objectSpread$x({}, p, {
"icon": FileTextOutlined$1
}), null);
};
FileTextOutlined.displayName = 'FileTextOutlined';
FileTextOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var VerticalAlignTopOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z" } }] }, "name": "vertical-align-top", "theme": "outlined" };
function _objectSpread$w(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$w(target, key, source[key]); }); } return target; }
function _defineProperty$w(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var VerticalAlignTopOutlined = function VerticalAlignTopOutlined(props, context) {
var p = _objectSpread$w({}, props, context.attrs);
return createVNode(Icon, _objectSpread$w({}, p, {
"icon": VerticalAlignTopOutlined$1
}), null);
};
VerticalAlignTopOutlined.displayName = 'VerticalAlignTopOutlined';
VerticalAlignTopOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var EyeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
function _objectSpread$v(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$v(target, key, source[key]); }); } return target; }
function _defineProperty$v(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var EyeOutlined = function EyeOutlined(props, context) {
var p = _objectSpread$v({}, props, context.attrs);
return createVNode(Icon, _objectSpread$v({}, p, {
"icon": EyeOutlined$1
}), null);
};
EyeOutlined.displayName = 'EyeOutlined';
EyeOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var EyeInvisibleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" } }, { "tag": "path", "attrs": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" } }] }, "name": "eye-invisible", "theme": "outlined" };
function _objectSpread$u(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$u(target, key, source[key]); }); } return target; }
function _defineProperty$u(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var EyeInvisibleOutlined = function EyeInvisibleOutlined(props, context) {
var p = _objectSpread$u({}, props, context.attrs);
return createVNode(Icon, _objectSpread$u({}, p, {
"icon": EyeInvisibleOutlined$1
}), null);
};
EyeInvisibleOutlined.displayName = 'EyeInvisibleOutlined';
EyeInvisibleOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var RotateLeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z" } }, { "tag": "path", "attrs": { "d": "M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z" } }] }, "name": "rotate-left", "theme": "outlined" };
function _objectSpread$t(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$t(target, key, source[key]); }); } return target; }
function _defineProperty$t(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var RotateLeftOutlined = function RotateLeftOutlined(props, context) {
var p = _objectSpread$t({}, props, context.attrs);
return createVNode(Icon, _objectSpread$t({}, p, {
"icon": RotateLeftOutlined$1
}), null);
};
RotateLeftOutlined.displayName = 'RotateLeftOutlined';
RotateLeftOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var RotateRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z" } }, { "tag": "path", "attrs": { "d": "M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z" } }] }, "name": "rotate-right", "theme": "outlined" };
function _objectSpread$s(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$s(target, key, source[key]); }); } return target; }
function _defineProperty$s(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var RotateRightOutlined = function RotateRightOutlined(props, context) {
var p = _objectSpread$s({}, props, context.attrs);
return createVNode(Icon, _objectSpread$s({}, p, {
"icon": RotateRightOutlined$1
}), null);
};
RotateRightOutlined.displayName = 'RotateRightOutlined';
RotateRightOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var ZoomInOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-in", "theme": "outlined" };
function _objectSpread$r(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$r(target, key, source[key]); }); } return target; }
function _defineProperty$r(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ZoomInOutlined = function ZoomInOutlined(props, context) {
var p = _objectSpread$r({}, props, context.attrs);
return createVNode(Icon, _objectSpread$r({}, p, {
"icon": ZoomInOutlined$1
}), null);
};
ZoomInOutlined.displayName = 'ZoomInOutlined';
ZoomInOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var ZoomOutOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-out", "theme": "outlined" };
function _objectSpread$q(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$q(target, key, source[key]); }); } return target; }
function _defineProperty$q(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ZoomOutOutlined = function ZoomOutOutlined(props, context) {
var p = _objectSpread$q({}, props, context.attrs);
return createVNode(Icon, _objectSpread$q({}, p, {
"icon": ZoomOutOutlined$1
}), null);
};
ZoomOutOutlined.displayName = 'ZoomOutOutlined';
ZoomOutOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var SwapOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "swap", "theme": "outlined" };
function _objectSpread$p(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$p(target, key, source[key]); }); } return target; }
function _defineProperty$p(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SwapOutlined = function SwapOutlined(props, context) {
var p = _objectSpread$p({}, props, context.attrs);
return createVNode(Icon, _objectSpread$p({}, p, {
"icon": SwapOutlined$1
}), null);
};
SwapOutlined.displayName = 'SwapOutlined';
SwapOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var UpOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, "name": "up", "theme": "outlined" };
function _objectSpread$o(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$o(target, key, source[key]); }); } return target; }
function _defineProperty$o(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var UpOutlined = function UpOutlined(props, context) {
var p = _objectSpread$o({}, props, context.attrs);
return createVNode(Icon, _objectSpread$o({}, p, {
"icon": UpOutlined$1
}), null);
};
UpOutlined.displayName = 'UpOutlined';
UpOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var BarsOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "bars", "theme": "outlined" };
function _objectSpread$n(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$n(target, key, source[key]); }); } return target; }
function _defineProperty$n(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var BarsOutlined = function BarsOutlined(props, context) {
var p = _objectSpread$n({}, props, context.attrs);
return createVNode(Icon, _objectSpread$n({}, p, {
"icon": BarsOutlined$1
}), null);
};
BarsOutlined.displayName = 'BarsOutlined';
BarsOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var DoubleLeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 000 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z" } }] }, "name": "double-left", "theme": "outlined" };
function _objectSpread$m(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$m(target, key, source[key]); }); } return target; }
function _defineProperty$m(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DoubleLeftOutlined = function DoubleLeftOutlined(props, context) {
var p = _objectSpread$m({}, props, context.attrs);
return createVNode(Icon, _objectSpread$m({}, p, {
"icon": DoubleLeftOutlined$1
}), null);
};
DoubleLeftOutlined.displayName = 'DoubleLeftOutlined';
DoubleLeftOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var DoubleRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 00188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 00492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" } }] }, "name": "double-right", "theme": "outlined" };
function _objectSpread$l(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$l(target, key, source[key]); }); } return target; }
function _defineProperty$l(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DoubleRightOutlined = function DoubleRightOutlined(props, context) {
var p = _objectSpread$l({}, props, context.attrs);
return createVNode(Icon, _objectSpread$l({}, p, {
"icon": DoubleRightOutlined$1
}), null);
};
DoubleRightOutlined.displayName = 'DoubleRightOutlined';
DoubleRightOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var ArrowLeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "arrow-left", "theme": "outlined" };
function _objectSpread$k(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$k(target, key, source[key]); }); } return target; }
function _defineProperty$k(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ArrowLeftOutlined = function ArrowLeftOutlined(props, context) {
var p = _objectSpread$k({}, props, context.attrs);
return createVNode(Icon, _objectSpread$k({}, p, {
"icon": ArrowLeftOutlined$1
}), null);
};
ArrowLeftOutlined.displayName = 'ArrowLeftOutlined';
ArrowLeftOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var ArrowRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z" } }] }, "name": "arrow-right", "theme": "outlined" };
function _objectSpread$j(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$j(target, key, source[key]); }); } return target; }
function _defineProperty$j(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ArrowRightOutlined = function ArrowRightOutlined(props, context) {
var p = _objectSpread$j({}, props, context.attrs);
return createVNode(Icon, _objectSpread$j({}, p, {
"icon": ArrowRightOutlined$1
}), null);
};
ArrowRightOutlined.displayName = 'ArrowRightOutlined';
ArrowRightOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var StarFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" } }] }, "name": "star", "theme": "filled" };
function _objectSpread$i(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$i(target, key, source[key]); }); } return target; }
function _defineProperty$i(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var StarFilled = function StarFilled(props, context) {
var p = _objectSpread$i({}, props, context.attrs);
return createVNode(Icon, _objectSpread$i({}, p, {
"icon": StarFilled$1
}), null);
};
StarFilled.displayName = 'StarFilled';
StarFilled.inheritAttrs = false;
// This icon file is generated automatically.
var WarningFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, "name": "warning", "theme": "filled" };
function _objectSpread$h(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$h(target, key, source[key]); }); } return target; }
function _defineProperty$h(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var WarningFilled = function WarningFilled(props, context) {
var p = _objectSpread$h({}, props, context.attrs);
return createVNode(Icon, _objectSpread$h({}, p, {
"icon": WarningFilled$1
}), null);
};
WarningFilled.displayName = 'WarningFilled';
WarningFilled.inheritAttrs = false;
// This icon file is generated automatically.
var CaretDownOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "outlined" };
function _objectSpread$g(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$g(target, key, source[key]); }); } return target; }
function _defineProperty$g(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CaretDownOutlined = function CaretDownOutlined(props, context) {
var p = _objectSpread$g({}, props, context.attrs);
return createVNode(Icon, _objectSpread$g({}, p, {
"icon": CaretDownOutlined$1
}), null);
};
CaretDownOutlined.displayName = 'CaretDownOutlined';
CaretDownOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var CaretUpOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" } }] }, "name": "caret-up", "theme": "outlined" };
function _objectSpread$f(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$f(target, key, source[key]); }); } return target; }
function _defineProperty$f(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CaretUpOutlined = function CaretUpOutlined(props, context) {
var p = _objectSpread$f({}, props, context.attrs);
return createVNode(Icon, _objectSpread$f({}, p, {
"icon": CaretUpOutlined$1
}), null);
};
CaretUpOutlined.displayName = 'CaretUpOutlined';
CaretUpOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var FilterFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z" } }] }, "name": "filter", "theme": "filled" };
function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$e(target, key, source[key]); }); } return target; }
function _defineProperty$e(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var FilterFilled = function FilterFilled(props, context) {
var p = _objectSpread$e({}, props, context.attrs);
return createVNode(Icon, _objectSpread$e({}, p, {
"icon": FilterFilled$1
}), null);
};
FilterFilled.displayName = 'FilterFilled';
FilterFilled.inheritAttrs = false;
// This icon file is generated automatically.
var FileOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" } }] }, "name": "file", "theme": "outlined" };
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$d(target, key, source[key]); }); } return target; }
function _defineProperty$d(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var FileOutlined = function FileOutlined(props, context) {
var p = _objectSpread$d({}, props, context.attrs);
return createVNode(Icon, _objectSpread$d({}, p, {
"icon": FileOutlined$1
}), null);
};
FileOutlined.displayName = 'FileOutlined';
FileOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var MinusSquareOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "minus-square", "theme": "outlined" };
function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$c(target, key, source[key]); }); } return target; }
function _defineProperty$c(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var MinusSquareOutlined = function MinusSquareOutlined(props, context) {
var p = _objectSpread$c({}, props, context.attrs);
return createVNode(Icon, _objectSpread$c({}, p, {
"icon": MinusSquareOutlined$1
}), null);
};
MinusSquareOutlined.displayName = 'MinusSquareOutlined';
MinusSquareOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var PlusSquareOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "plus-square", "theme": "outlined" };
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$b(target, key, source[key]); }); } return target; }
function _defineProperty$b(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var PlusSquareOutlined = function PlusSquareOutlined(props, context) {
var p = _objectSpread$b({}, props, context.attrs);
return createVNode(Icon, _objectSpread$b({}, p, {
"icon": PlusSquareOutlined$1
}), null);
};
PlusSquareOutlined.displayName = 'PlusSquareOutlined';
PlusSquareOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var CaretDownFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "filled" };
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$a(target, key, source[key]); }); } return target; }
function _defineProperty$a(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CaretDownFilled = function CaretDownFilled(props, context) {
var p = _objectSpread$a({}, props, context.attrs);
return createVNode(Icon, _objectSpread$a({}, p, {
"icon": CaretDownFilled$1
}), null);
};
CaretDownFilled.displayName = 'CaretDownFilled';
CaretDownFilled.inheritAttrs = false;
// This icon file is generated automatically.
var FolderOpenOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" } }] }, "name": "folder-open", "theme": "outlined" };
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$9(target, key, source[key]); }); } return target; }
function _defineProperty$9(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var FolderOpenOutlined = function FolderOpenOutlined(props, context) {
var p = _objectSpread$9({}, props, context.attrs);
return createVNode(Icon, _objectSpread$9({}, p, {
"icon": FolderOpenOutlined$1
}), null);
};
FolderOpenOutlined.displayName = 'FolderOpenOutlined';
FolderOpenOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var FolderOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" } }] }, "name": "folder", "theme": "outlined" };
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$8(target, key, source[key]); }); } return target; }
function _defineProperty$8(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var FolderOutlined = function FolderOutlined(props, context) {
var p = _objectSpread$8({}, props, context.attrs);
return createVNode(Icon, _objectSpread$8({}, p, {
"icon": FolderOutlined$1
}), null);
};
FolderOutlined.displayName = 'FolderOutlined';
FolderOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var DeleteOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$7(target, key, source[key]); }); } return target; }
function _defineProperty$7(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DeleteOutlined = function DeleteOutlined(props, context) {
var p = _objectSpread$7({}, props, context.attrs);
return createVNode(Icon, _objectSpread$7({}, p, {
"icon": DeleteOutlined$1
}), null);
};
DeleteOutlined.displayName = 'DeleteOutlined';
DeleteOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var EnterOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z" } }] }, "name": "enter", "theme": "outlined" };
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$6(target, key, source[key]); }); } return target; }
function _defineProperty$6(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var EnterOutlined = function EnterOutlined(props, context) {
var p = _objectSpread$6({}, props, context.attrs);
return createVNode(Icon, _objectSpread$6({}, p, {
"icon": EnterOutlined$1
}), null);
};
EnterOutlined.displayName = 'EnterOutlined';
EnterOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var CopyOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" } }] }, "name": "copy", "theme": "outlined" };
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$5(target, key, source[key]); }); } return target; }
function _defineProperty$5(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CopyOutlined = function CopyOutlined(props, context) {
var p = _objectSpread$5({}, props, context.attrs);
return createVNode(Icon, _objectSpread$5({}, p, {
"icon": CopyOutlined$1
}), null);
};
CopyOutlined.displayName = 'CopyOutlined';
CopyOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var EditOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" } }] }, "name": "edit", "theme": "outlined" };
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$4(target, key, source[key]); }); } return target; }
function _defineProperty$4(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var EditOutlined = function EditOutlined(props, context) {
var p = _objectSpread$4({}, props, context.attrs);
return createVNode(Icon, _objectSpread$4({}, p, {
"icon": EditOutlined$1
}), null);
};
EditOutlined.displayName = 'EditOutlined';
EditOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var PaperClipOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z" } }] }, "name": "paper-clip", "theme": "outlined" };
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$3(target, key, source[key]); }); } return target; }
function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var PaperClipOutlined = function PaperClipOutlined(props, context) {
var p = _objectSpread$3({}, props, context.attrs);
return createVNode(Icon, _objectSpread$3({}, p, {
"icon": PaperClipOutlined$1
}), null);
};
PaperClipOutlined.displayName = 'PaperClipOutlined';
PaperClipOutlined.inheritAttrs = false;
// This icon file is generated automatically.
var PictureTwoTone$1 = { "icon": function render(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z", "fill": primaryColor } }, { "tag": "path", "attrs": { "d": "M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M276 368a28 28 0 1056 0 28 28 0 10-56 0z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z", "fill": primaryColor } }] }; }, "name": "picture", "theme": "twotone" };
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } return target; }
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var PictureTwoTone = function PictureTwoTone(props, context) {
var p = _objectSpread$2({}, props, context.attrs);
return createVNode(Icon, _objectSpread$2({}, p, {
"icon": PictureTwoTone$1
}), null);
};
PictureTwoTone.displayName = 'PictureTwoTone';
PictureTwoTone.inheritAttrs = false;
// This icon file is generated automatically.
var FileTwoTone$1 = { "icon": function render(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M534 352V136H232v752h560V394H576a42 42 0 01-42-42z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z", "fill": primaryColor } }] }; }, "name": "file", "theme": "twotone" };
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } return target; }
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var FileTwoTone = function FileTwoTone(props, context) {
var p = _objectSpread$1({}, props, context.attrs);
return createVNode(Icon, _objectSpread$1({}, p, {
"icon": FileTwoTone$1
}), null);
};
FileTwoTone.displayName = 'FileTwoTone';
FileTwoTone.inheritAttrs = false;
// This icon file is generated automatically.
var DownloadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var DownloadOutlined = function DownloadOutlined(props, context) {
var p = _objectSpread({}, props, context.attrs);
return createVNode(Icon, _objectSpread({}, p, {
"icon": DownloadOutlined$1
}), null);
};
DownloadOutlined.displayName = 'DownloadOutlined';
DownloadOutlined.inheritAttrs = false;
if (!globalThis.$fetch) {
globalThis.$fetch = $fetch$1.create({
baseURL: baseURL$1()
});
}
if (!("global" in globalThis)) {
globalThis.global = globalThis;
}
const appLayoutTransition = false;
const nuxtLinkDefaults = { "componentName": "NuxtLink" };
const asyncDataDefaults = { "deep": false };
const appId = "nuxt-app";
function getNuxtAppCtx(id = appId) {
return getContext(id, {
asyncContext: false
});
}
const NuxtPluginIndicator = "__nuxt_plugin";
function createNuxtApp(options) {
let hydratingCount = 0;
const nuxtApp = {
_id: options.id || appId || "nuxt-app",
_scope: effectScope(),
provide: void 0,
versions: {
get nuxt() {
return "4.0.3";
},
get vue() {
return nuxtApp.vueApp.version;
}
},
payload: shallowReactive({
...options.ssrContext?.payload || {},
data: shallowReactive({}),
state: reactive({}),
once: /* @__PURE__ */ new Set(),
_errors: shallowReactive({})
}),
static: {
data: {}
},
runWithContext(fn) {
if (nuxtApp._scope.active && !getCurrentScope()) {
return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn));
}
return callWithNuxt(nuxtApp, fn);
},
isHydrating: false,
deferHydration() {
if (!nuxtApp.isHydrating) {
return () => {
};
}
hydratingCount++;
let called = false;
return () => {
if (called) {
return;
}
called = true;
hydratingCount--;
if (hydratingCount === 0) {
nuxtApp.isHydrating = false;
return nuxtApp.callHook("app:suspense:resolve");
}
};
},
_asyncDataPromises: {},
_asyncData: shallowReactive({}),
_payloadRevivers: {},
...options
};
{
nuxtApp.payload.serverRendered = true;
}
if (nuxtApp.ssrContext) {
nuxtApp.payload.path = nuxtApp.ssrContext.url;
nuxtApp.ssrContext.nuxt = nuxtApp;
nuxtApp.ssrContext.payload = nuxtApp.payload;
nuxtApp.ssrContext.config = {
public: nuxtApp.ssrContext.runtimeConfig.public,
app: nuxtApp.ssrContext.runtimeConfig.app
};
}
nuxtApp.hooks = createHooks();
nuxtApp.hook = nuxtApp.hooks.hook;
{
const contextCaller = async function(hooks, args) {
for (const hook of hooks) {
await nuxtApp.runWithContext(() => hook(...args));
}
};
nuxtApp.hooks.callHook = (name, ...args) => nuxtApp.hooks.callHookWith(contextCaller, name, ...args);
}
nuxtApp.callHook = nuxtApp.hooks.callHook;
nuxtApp.provide = (name, value) => {
const $name = "$" + name;
defineGetter(nuxtApp, $name, value);
defineGetter(nuxtApp.vueApp.config.globalProperties, $name, value);
};
defineGetter(nuxtApp.vueApp, "$nuxt", nuxtApp);
defineGetter(nuxtApp.vueApp.config.globalProperties, "$nuxt", nuxtApp);
const runtimeConfig = options.ssrContext.runtimeConfig;
nuxtApp.provide("config", runtimeConfig);
return nuxtApp;
}
function registerPluginHooks(nuxtApp, plugin2) {
if (plugin2.hooks) {
nuxtApp.hooks.addHooks(plugin2.hooks);
}
}
async function applyPlugin(nuxtApp, plugin2) {
if (typeof plugin2 === "function") {
const { provide: provide2 } = await nuxtApp.runWithContext(() => plugin2(nuxtApp)) || {};
if (provide2 && typeof provide2 === "object") {
for (const key2 in provide2) {
nuxtApp.provide(key2, provide2[key2]);
}
}
}
}
async function applyPlugins(nuxtApp, plugins2) {
const resolvedPlugins = /* @__PURE__ */ new Set();
const unresolvedPlugins = [];
const parallels = [];
let error = void 0;
let promiseDepth = 0;
async function executePlugin(plugin2) {
const unresolvedPluginsForThisPlugin = plugin2.dependsOn?.filter((name) => plugins2.some((p) => p._name === name) && !resolvedPlugins.has(name)) ?? [];
if (unresolvedPluginsForThisPlugin.length > 0) {
unresolvedPlugins.push([new Set(unresolvedPluginsForThisPlugin), plugin2]);
} else {
const promise = applyPlugin(nuxtApp, plugin2).then(async () => {
if (plugin2._name) {
resolvedPlugins.add(plugin2._name);
await Promise.all(unresolvedPlugins.map(async ([dependsOn, unexecutedPlugin]) => {
if (dependsOn.has(plugin2._name)) {
dependsOn.delete(plugin2._name);
if (dependsOn.size === 0) {
promiseDepth++;
await executePlugin(unexecutedPlugin);
}
}
}));
}
}).catch((e) => {
if (!plugin2.parallel && !nuxtApp.payload.error) {
throw e;
}
error ||= e;
});
if (plugin2.parallel) {
parallels.push(promise);
} else {
await promise;
}
}
}
for (const plugin2 of plugins2) {
if (nuxtApp.ssrContext?.islandContext && plugin2.env?.islands === false) {
continue;
}
registerPluginHooks(nuxtApp, plugin2);
}
for (const plugin2 of plugins2) {
if (nuxtApp.ssrContext?.islandContext && plugin2.env?.islands === false) {
continue;
}
await executePlugin(plugin2);
}
await Promise.all(parallels);
if (promiseDepth) {
for (let i = 0; i < promiseDepth; i++) {
await Promise.all(parallels);
}
}
if (error) {
throw nuxtApp.payload.error || error;
}
}
// @__NO_SIDE_EFFECTS__
function defineNuxtPlugin(plugin2) {
if (typeof plugin2 === "function") {
return plugin2;
}
const _name = plugin2._name || plugin2.name;
delete plugin2.name;
return Object.assign(plugin2.setup || (() => {
}), plugin2, { [NuxtPluginIndicator]: true, _name });
}
const definePayloadPlugin = defineNuxtPlugin;
function callWithNuxt(nuxt, setup, args) {
const fn = () => setup();
const nuxtAppCtx = getNuxtAppCtx(nuxt._id);
{
return nuxt.vueApp.runWithContext(() => nuxtAppCtx.callAsync(nuxt, fn));
}
}
function tryUseNuxtApp(id) {
let nuxtAppInstance;
if (hasInjectionContext()) {
nuxtAppInstance = getCurrentInstance()?.appContext.app.$nuxt;
}
nuxtAppInstance ||= getNuxtAppCtx(id).tryUse();
return nuxtAppInstance || null;
}
function useNuxtApp(id) {
const nuxtAppInstance = tryUseNuxtApp(id);
if (!nuxtAppInstance) {
{
throw new Error("[nuxt] instance unavailable");
}
}
return nuxtAppInstance;
}
// @__NO_SIDE_EFFECTS__
function useRuntimeConfig(_event) {
return useNuxtApp().$config;
}
function defineGetter(obj, key2, val) {
Object.defineProperty(obj, key2, { get: () => val });
}
const LayoutMetaSymbol = Symbol("layout-meta");
const PageRouteSymbol = Symbol("route");
const useRouter$1 = () => {
return useNuxtApp()?.$router;
};
const useRoute$1 = () => {
if (hasInjectionContext()) {
return inject(PageRouteSymbol, useNuxtApp()._route);
}
return useNuxtApp()._route;
};
// @__NO_SIDE_EFFECTS__
function defineNuxtRouteMiddleware(middleware) {
return middleware;
}
const isProcessingMiddleware = () => {
try {
if (useNuxtApp()._processingMiddleware) {
return true;
}
} catch {
return false;
}
return false;
};
const URL_QUOTE_RE = /"/g;
const navigateTo = (to, options) => {
to ||= "/";
const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter$1().resolve(to).href;
const isExternalHost = hasProtocol(toPath, { acceptRelative: true });
const isExternal = options?.external || isExternalHost;
if (isExternal) {
if (!options?.external) {
throw new Error("Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.");
}
const { protocol } = new URL(toPath, "http://localhost");
if (protocol && isScriptProtocol(protocol)) {
throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`);
}
}
const inMiddleware = isProcessingMiddleware();
const router = useRouter$1();
const nuxtApp = useNuxtApp();
{
if (nuxtApp.ssrContext) {
const fullPath = typeof to === "string" || isExternal ? toPath : router.resolve(to).fullPath || "/";
const location2 = isExternal ? toPath : joinURL((/* @__PURE__ */ useRuntimeConfig()).app.baseURL, fullPath);
const redirect = async function(response) {
await nuxtApp.callHook("app:redirected");
const encodedLoc = location2.replace(URL_QUOTE_RE, "%22");
const encodedHeader = encodeURL(location2, isExternalHost);
nuxtApp.ssrContext._renderResponse = {
statusCode: sanitizeStatusCode(options?.redirectCode || 302, 302),
body: `
`,
headers: { location: encodedHeader }
};
return response;
};
if (!isExternal && inMiddleware) {
router.afterEach((final) => final.fullPath === fullPath ? redirect(false) : void 0);
return to;
}
return redirect(!inMiddleware ? void 0 : (
/* abort route navigation */
false
));
}
}
if (isExternal) {
nuxtApp._scope.stop();
if (options?.replace) {
(void 0).replace(toPath);
} else {
(void 0).href = toPath;
}
if (inMiddleware) {
if (!nuxtApp.isHydrating) {
return false;
}
return new Promise(() => {
});
}
return Promise.resolve();
}
return options?.replace ? router.replace(to) : router.push(to);
};
function resolveRouteObject(to) {
return withQuery(to.path || "", to.query || {}) + (to.hash || "");
}
function encodeURL(location2, isExternalHost = false) {
const url = new URL(location2, "http://localhost");
if (!isExternalHost) {
return url.pathname + url.search + url.hash;
}
if (location2.startsWith("//")) {
return url.toString().replace(url.protocol, "");
}
return url.toString();
}
const NUXT_ERROR_SIGNATURE = "__nuxt_error";
const useError = () => toRef(useNuxtApp().payload, "error");
const showError = (error) => {
const nuxtError = createError(error);
try {
const nuxtApp = useNuxtApp();
const error2 = useError();
if (false) ;
error2.value ||= nuxtError;
} catch {
throw nuxtError;
}
return nuxtError;
};
const isNuxtError = (error) => !!error && typeof error === "object" && NUXT_ERROR_SIGNATURE in error;
const createError = (error) => {
const nuxtError = createError$1(error);
Object.defineProperty(nuxtError, NUXT_ERROR_SIGNATURE, {
value: true,
configurable: false,
writable: false
});
return nuxtError;
};
function injectHead(nuxtApp) {
const nuxt = nuxtApp || useNuxtApp();
return nuxt.ssrContext?.head || nuxt.runWithContext(() => {
if (hasInjectionContext()) {
const head = inject(headSymbol);
if (!head) {
throw new Error("[nuxt] [unhead] Missing Unhead instance.");
}
return head;
}
});
}
function useHead(input, options = {}) {
const head = injectHead(options.nuxt);
return useHead$1(input, { head, ...options });
}
async function getRouteRules(arg) {
const path2 = typeof arg === "string" ? arg : arg.path;
{
useNuxtApp().ssrContext._preloadManifest = true;
const _routeRulesMatcher = toRouteMatcher(
createRouter$1({ routes: (/* @__PURE__ */ useRuntimeConfig()).nitro.routeRules })
);
return defu({}, ..._routeRulesMatcher.matchAll(path2).reverse());
}
}
function definePayloadReducer(name, reduce) {
{
useNuxtApp().ssrContext._payloadReducers[name] = reduce;
}
}
const payloadPlugin = definePayloadPlugin(() => {
definePayloadReducer(
"skipHydrate",
// We need to return something truthy to be treated as a match
(data) => !shouldHydrate(data) && 1
);
});
const unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:head",
enforce: "pre",
setup(nuxtApp) {
const head = nuxtApp.ssrContext.head;
nuxtApp.vueApp.use(head);
}
});
function isRouteComponent(component) {
return typeof component === "object" || "displayName" in component || "props" in component || "__vccOpts" in component;
}
function isESModule(obj) {
return obj.__esModule || obj[Symbol.toStringTag] === "Module" || // support CF with dynamic imports that do not
// add the Module string tag
obj.default && isRouteComponent(obj.default);
}
const assign$1 = Object.assign;
function applyToParams(fn, params) {
const newParams = {};
for (const key2 in params) {
const value = params[key2];
newParams[key2] = isArray$1(value) ? value.map(fn) : fn(value);
}
return newParams;
}
const noop$f = () => {
};
const isArray$1 = Array.isArray;
const HASH_RE = /#/g;
const AMPERSAND_RE = /&/g;
const SLASH_RE = /\//g;
const EQUAL_RE = /=/g;
const IM_RE = /\?/g;
const PLUS_RE = /\+/g;
const ENC_BRACKET_OPEN_RE = /%5B/g;
const ENC_BRACKET_CLOSE_RE = /%5D/g;
const ENC_CARET_RE = /%5E/g;
const ENC_BACKTICK_RE = /%60/g;
const ENC_CURLY_OPEN_RE = /%7B/g;
const ENC_PIPE_RE = /%7C/g;
const ENC_CURLY_CLOSE_RE = /%7D/g;
const ENC_SPACE_RE = /%20/g;
function commonEncode(text) {
return encodeURI("" + text).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
}
function encodeHash(text) {
return commonEncode(text).replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
}
function encodeQueryValue(text) {
return commonEncode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
}
function encodeQueryKey(text) {
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
}
function encodePath(text) {
return commonEncode(text).replace(HASH_RE, "%23").replace(IM_RE, "%3F");
}
function encodeParam(text) {
return text == null ? "" : encodePath(text).replace(SLASH_RE, "%2F");
}
function decode(text) {
try {
return decodeURIComponent("" + text);
} catch (err) {
}
return "" + text;
}
const TRAILING_SLASH_RE = /\/$/;
const removeTrailingSlash = (path2) => path2.replace(TRAILING_SLASH_RE, "");
function parseURL(parseQuery2, location2, currentLocation = "/") {
let path2, query = {}, searchString = "", hash2 = "";
const hashPos = location2.indexOf("#");
let searchPos = location2.indexOf("?");
if (hashPos < searchPos && hashPos >= 0) {
searchPos = -1;
}
if (searchPos > -1) {
path2 = location2.slice(0, searchPos);
searchString = location2.slice(searchPos + 1, hashPos > -1 ? hashPos : location2.length);
query = parseQuery2(searchString);
}
if (hashPos > -1) {
path2 = path2 || location2.slice(0, hashPos);
hash2 = location2.slice(hashPos, location2.length);
}
path2 = resolveRelativePath(path2 != null ? path2 : location2, currentLocation);
return {
fullPath: path2 + (searchString && "?") + searchString + hash2,
path: path2,
query,
hash: decode(hash2)
};
}
function stringifyURL(stringifyQuery2, location2) {
const query = location2.query ? stringifyQuery2(location2.query) : "";
return location2.path + (query && "?") + query + (location2.hash || "");
}
function isSameRouteLocation(stringifyQuery2, a, b) {
const aLastIndex = a.matched.length - 1;
const bLastIndex = b.matched.length - 1;
return aLastIndex > -1 && aLastIndex === bLastIndex && isSameRouteRecord(a.matched[aLastIndex], b.matched[bLastIndex]) && isSameRouteLocationParams(a.params, b.params) && stringifyQuery2(a.query) === stringifyQuery2(b.query) && a.hash === b.hash;
}
function isSameRouteRecord(a, b) {
return (a.aliasOf || a) === (b.aliasOf || b);
}
function isSameRouteLocationParams(a, b) {
if (Object.keys(a).length !== Object.keys(b).length)
return false;
for (const key2 in a) {
if (!isSameRouteLocationParamsValue(a[key2], b[key2]))
return false;
}
return true;
}
function isSameRouteLocationParamsValue(a, b) {
return isArray$1(a) ? isEquivalentArray(a, b) : isArray$1(b) ? isEquivalentArray(b, a) : a === b;
}
function isEquivalentArray(a, b) {
return isArray$1(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
}
function resolveRelativePath(to, from) {
if (to.startsWith("/"))
return to;
if (!to)
return from;
const fromSegments = from.split("/");
const toSegments = to.split("/");
const lastToSegment = toSegments[toSegments.length - 1];
if (lastToSegment === ".." || lastToSegment === ".") {
toSegments.push("");
}
let position = fromSegments.length - 1;
let toPosition;
let segment;
for (toPosition = 0; toPosition < toSegments.length; toPosition++) {
segment = toSegments[toPosition];
if (segment === ".")
continue;
if (segment === "..") {
if (position > 1)
position--;
} else
break;
}
return fromSegments.slice(0, position).join("/") + "/" + toSegments.slice(toPosition).join("/");
}
const START_LOCATION_NORMALIZED = {
path: "/",
// TODO: could we use a symbol in the future?
name: void 0,
params: {},
query: {},
hash: "",
fullPath: "/",
matched: [],
meta: {},
redirectedFrom: void 0
};
var NavigationType;
(function(NavigationType2) {
NavigationType2["pop"] = "pop";
NavigationType2["push"] = "push";
})(NavigationType || (NavigationType = {}));
var NavigationDirection;
(function(NavigationDirection2) {
NavigationDirection2["back"] = "back";
NavigationDirection2["forward"] = "forward";
NavigationDirection2["unknown"] = "";
})(NavigationDirection || (NavigationDirection = {}));
const START = "";
function normalizeBase(base) {
if (!base) {
{
base = "/";
}
}
if (base[0] !== "/" && base[0] !== "#")
base = "/" + base;
return removeTrailingSlash(base);
}
const BEFORE_HASH_RE = /^[^#]+#/;
function createHref(base, location2) {
return base.replace(BEFORE_HASH_RE, "#") + location2;
}
function createMemoryHistory(base = "") {
let listeners = [];
let queue = [[START, {}]];
let position = 0;
base = normalizeBase(base);
function setLocation(location2, state = {}) {
position++;
if (position !== queue.length) {
queue.splice(position);
}
queue.push([location2, state]);
}
function triggerListeners(to, from, { direction, delta }) {
const info = {
direction,
delta,
type: NavigationType.pop
};
for (const callback of listeners) {
callback(to, from, info);
}
}
const routerHistory = {
// rewritten by Object.defineProperty
location: START,
// rewritten by Object.defineProperty
state: {},
base,
createHref: createHref.bind(null, base),
replace(to, state) {
queue.splice(position--, 1);
setLocation(to, state);
},
push(to, state) {
setLocation(to, state);
},
listen(callback) {
listeners.push(callback);
return () => {
const index2 = listeners.indexOf(callback);
if (index2 > -1)
listeners.splice(index2, 1);
};
},
destroy() {
listeners = [];
queue = [[START, {}]];
position = 0;
},
go(delta, shouldTrigger = true) {
const from = this.location;
const direction = (
// we are considering delta === 0 going forward, but in abstract mode
// using 0 for the delta doesn't make sense like it does in html5 where
// it reloads the page
delta < 0 ? NavigationDirection.back : NavigationDirection.forward
);
position = Math.max(0, Math.min(position + delta, queue.length - 1));
if (shouldTrigger) {
triggerListeners(this.location, from, {
direction,
delta
});
}
}
};
Object.defineProperty(routerHistory, "location", {
enumerable: true,
get: () => queue[position][0]
});
Object.defineProperty(routerHistory, "state", {
enumerable: true,
get: () => queue[position][1]
});
return routerHistory;
}
function isRouteLocation(route) {
return typeof route === "string" || route && typeof route === "object";
}
function isRouteName(name) {
return typeof name === "string" || typeof name === "symbol";
}
const NavigationFailureSymbol = Symbol("");
var NavigationFailureType;
(function(NavigationFailureType2) {
NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
})(NavigationFailureType || (NavigationFailureType = {}));
function createRouterError(type, params) {
{
return assign$1(new Error(), {
type,
[NavigationFailureSymbol]: true
}, params);
}
}
function isNavigationFailure(error, type) {
return error instanceof Error && NavigationFailureSymbol in error && (type == null || !!(error.type & type));
}
const BASE_PARAM_PATTERN = "[^/]+?";
const BASE_PATH_PARSER_OPTIONS = {
sensitive: false,
strict: false,
start: true,
end: true
};
const REGEX_CHARS_RE = /[.+*?^${}()[\]/\\]/g;
function tokensToParser(segments, extraOptions) {
const options = assign$1({}, BASE_PATH_PARSER_OPTIONS, extraOptions);
const score = [];
let pattern = options.start ? "^" : "";
const keys = [];
for (const segment of segments) {
const segmentScores = segment.length ? [] : [
90
/* PathScore.Root */
];
if (options.strict && !segment.length)
pattern += "/";
for (let tokenIndex = 0; tokenIndex < segment.length; tokenIndex++) {
const token = segment[tokenIndex];
let subSegmentScore = 40 + (options.sensitive ? 0.25 : 0);
if (token.type === 0) {
if (!tokenIndex)
pattern += "/";
pattern += token.value.replace(REGEX_CHARS_RE, "\\$&");
subSegmentScore += 40;
} else if (token.type === 1) {
const { value, repeatable, optional, regexp } = token;
keys.push({
name: value,
repeatable,
optional
});
const re2 = regexp ? regexp : BASE_PARAM_PATTERN;
if (re2 !== BASE_PARAM_PATTERN) {
subSegmentScore += 10;
try {
new RegExp(`(${re2})`);
} catch (err) {
throw new Error(`Invalid custom RegExp for param "${value}" (${re2}): ` + err.message);
}
}
let subPattern = repeatable ? `((?:${re2})(?:/(?:${re2}))*)` : `(${re2})`;
if (!tokenIndex)
subPattern = // avoid an optional / if there are more segments e.g. /:p?-static
// or /:p?-:p2
optional && segment.length < 2 ? `(?:/${subPattern})` : "/" + subPattern;
if (optional)
subPattern += "?";
pattern += subPattern;
subSegmentScore += 20;
if (optional)
subSegmentScore += -8;
if (repeatable)
subSegmentScore += -20;
if (re2 === ".*")
subSegmentScore += -50;
}
segmentScores.push(subSegmentScore);
}
score.push(segmentScores);
}
if (options.strict && options.end) {
const i = score.length - 1;
score[i][score[i].length - 1] += 0.7000000000000001;
}
if (!options.strict)
pattern += "/?";
if (options.end)
pattern += "$";
else if (options.strict && !pattern.endsWith("/"))
pattern += "(?:/|$)";
const re = new RegExp(pattern, options.sensitive ? "" : "i");
function parse(path2) {
const match2 = path2.match(re);
const params = {};
if (!match2)
return null;
for (let i = 1; i < match2.length; i++) {
const value = match2[i] || "";
const key2 = keys[i - 1];
params[key2.name] = value && key2.repeatable ? value.split("/") : value;
}
return params;
}
function stringify2(params) {
let path2 = "";
let avoidDuplicatedSlash = false;
for (const segment of segments) {
if (!avoidDuplicatedSlash || !path2.endsWith("/"))
path2 += "/";
avoidDuplicatedSlash = false;
for (const token of segment) {
if (token.type === 0) {
path2 += token.value;
} else if (token.type === 1) {
const { value, repeatable, optional } = token;
const param = value in params ? params[value] : "";
if (isArray$1(param) && !repeatable) {
throw new Error(`Provided param "${value}" is an array but it is not repeatable (* or + modifiers)`);
}
const text = isArray$1(param) ? param.join("/") : param;
if (!text) {
if (optional) {
if (segment.length < 2) {
if (path2.endsWith("/"))
path2 = path2.slice(0, -1);
else
avoidDuplicatedSlash = true;
}
} else
throw new Error(`Missing required param "${value}"`);
}
path2 += text;
}
}
}
return path2 || "/";
}
return {
re,
score,
keys,
parse,
stringify: stringify2
};
}
function compareScoreArray(a, b) {
let i = 0;
while (i < a.length && i < b.length) {
const diff = b[i] - a[i];
if (diff)
return diff;
i++;
}
if (a.length < b.length) {
return a.length === 1 && a[0] === 40 + 40 ? -1 : 1;
} else if (a.length > b.length) {
return b.length === 1 && b[0] === 40 + 40 ? 1 : -1;
}
return 0;
}
function comparePathParserScore(a, b) {
let i = 0;
const aScore = a.score;
const bScore = b.score;
while (i < aScore.length && i < bScore.length) {
const comp = compareScoreArray(aScore[i], bScore[i]);
if (comp)
return comp;
i++;
}
if (Math.abs(bScore.length - aScore.length) === 1) {
if (isLastScoreNegative(aScore))
return 1;
if (isLastScoreNegative(bScore))
return -1;
}
return bScore.length - aScore.length;
}
function isLastScoreNegative(score) {
const last = score[score.length - 1];
return score.length > 0 && last[last.length - 1] < 0;
}
const ROOT_TOKEN = {
type: 0,
value: ""
};
const VALID_PARAM_RE = /[a-zA-Z0-9_]/;
function tokenizePath(path2) {
if (!path2)
return [[]];
if (path2 === "/")
return [[ROOT_TOKEN]];
if (!path2.startsWith("/")) {
throw new Error(`Invalid path "${path2}"`);
}
function crash(message) {
throw new Error(`ERR (${state})/"${buffer}": ${message}`);
}
let state = 0;
let previousState = state;
const tokens = [];
let segment;
function finalizeSegment() {
if (segment)
tokens.push(segment);
segment = [];
}
let i = 0;
let char;
let buffer = "";
let customRe = "";
function consumeBuffer() {
if (!buffer)
return;
if (state === 0) {
segment.push({
type: 0,
value: buffer
});
} else if (state === 1 || state === 2 || state === 3) {
if (segment.length > 1 && (char === "*" || char === "+"))
crash(`A repeatable param (${buffer}) must be alone in its segment. eg: '/:ids+.`);
segment.push({
type: 1,
value: buffer,
regexp: customRe,
repeatable: char === "*" || char === "+",
optional: char === "*" || char === "?"
});
} else {
crash("Invalid state to consume buffer");
}
buffer = "";
}
function addCharToBuffer() {
buffer += char;
}
while (i < path2.length) {
char = path2[i++];
if (char === "\\" && state !== 2) {
previousState = state;
state = 4;
continue;
}
switch (state) {
case 0:
if (char === "/") {
if (buffer) {
consumeBuffer();
}
finalizeSegment();
} else if (char === ":") {
consumeBuffer();
state = 1;
} else {
addCharToBuffer();
}
break;
case 4:
addCharToBuffer();
state = previousState;
break;
case 1:
if (char === "(") {
state = 2;
} else if (VALID_PARAM_RE.test(char)) {
addCharToBuffer();
} else {
consumeBuffer();
state = 0;
if (char !== "*" && char !== "?" && char !== "+")
i--;
}
break;
case 2:
if (char === ")") {
if (customRe[customRe.length - 1] == "\\")
customRe = customRe.slice(0, -1) + char;
else
state = 3;
} else {
customRe += char;
}
break;
case 3:
consumeBuffer();
state = 0;
if (char !== "*" && char !== "?" && char !== "+")
i--;
customRe = "";
break;
default:
crash("Unknown state");
break;
}
}
if (state === 2)
crash(`Unfinished custom RegExp for param "${buffer}"`);
consumeBuffer();
finalizeSegment();
return tokens;
}
function createRouteRecordMatcher(record, parent, options) {
const parser = tokensToParser(tokenizePath(record.path), options);
const matcher = assign$1(parser, {
record,
parent,
// these needs to be populated by the parent
children: [],
alias: []
});
if (parent) {
if (!matcher.record.aliasOf === !parent.record.aliasOf)
parent.children.push(matcher);
}
return matcher;
}
function createRouterMatcher(routes, globalOptions) {
const matchers = [];
const matcherMap = /* @__PURE__ */ new Map();
globalOptions = mergeOptions({ strict: false, end: true, sensitive: false }, globalOptions);
function getRecordMatcher(name) {
return matcherMap.get(name);
}
function addRoute(record, parent, originalRecord) {
const isRootAdd = !originalRecord;
const mainNormalizedRecord = normalizeRouteRecord(record);
mainNormalizedRecord.aliasOf = originalRecord && originalRecord.record;
const options = mergeOptions(globalOptions, record);
const normalizedRecords = [mainNormalizedRecord];
if ("alias" in record) {
const aliases = typeof record.alias === "string" ? [record.alias] : record.alias;
for (const alias of aliases) {
normalizedRecords.push(
// we need to normalize again to ensure the `mods` property
// being non enumerable
normalizeRouteRecord(assign$1({}, mainNormalizedRecord, {
// this allows us to hold a copy of the `components` option
// so that async components cache is hold on the original record
components: originalRecord ? originalRecord.record.components : mainNormalizedRecord.components,
path: alias,
// we might be the child of an alias
aliasOf: originalRecord ? originalRecord.record : mainNormalizedRecord
// the aliases are always of the same kind as the original since they
// are defined on the same record
}))
);
}
}
let matcher;
let originalMatcher;
for (const normalizedRecord of normalizedRecords) {
const { path: path2 } = normalizedRecord;
if (parent && path2[0] !== "/") {
const parentPath = parent.record.path;
const connectingSlash = parentPath[parentPath.length - 1] === "/" ? "" : "/";
normalizedRecord.path = parent.record.path + (path2 && connectingSlash + path2);
}
matcher = createRouteRecordMatcher(normalizedRecord, parent, options);
if (originalRecord) {
originalRecord.alias.push(matcher);
} else {
originalMatcher = originalMatcher || matcher;
if (originalMatcher !== matcher)
originalMatcher.alias.push(matcher);
if (isRootAdd && record.name && !isAliasRecord(matcher)) {
removeRoute(record.name);
}
}
if (isMatchable(matcher)) {
insertMatcher(matcher);
}
if (mainNormalizedRecord.children) {
const children = mainNormalizedRecord.children;
for (let i = 0; i < children.length; i++) {
addRoute(children[i], matcher, originalRecord && originalRecord.children[i]);
}
}
originalRecord = originalRecord || matcher;
}
return originalMatcher ? () => {
removeRoute(originalMatcher);
} : noop$f;
}
function removeRoute(matcherRef) {
if (isRouteName(matcherRef)) {
const matcher = matcherMap.get(matcherRef);
if (matcher) {
matcherMap.delete(matcherRef);
matchers.splice(matchers.indexOf(matcher), 1);
matcher.children.forEach(removeRoute);
matcher.alias.forEach(removeRoute);
}
} else {
const index2 = matchers.indexOf(matcherRef);
if (index2 > -1) {
matchers.splice(index2, 1);
if (matcherRef.record.name)
matcherMap.delete(matcherRef.record.name);
matcherRef.children.forEach(removeRoute);
matcherRef.alias.forEach(removeRoute);
}
}
}
function getRoutes() {
return matchers;
}
function insertMatcher(matcher) {
const index2 = findInsertionIndex(matcher, matchers);
matchers.splice(index2, 0, matcher);
if (matcher.record.name && !isAliasRecord(matcher))
matcherMap.set(matcher.record.name, matcher);
}
function resolve(location2, currentLocation) {
let matcher;
let params = {};
let path2;
let name;
if ("name" in location2 && location2.name) {
matcher = matcherMap.get(location2.name);
if (!matcher)
throw createRouterError(1, {
location: location2
});
name = matcher.record.name;
params = assign$1(
// paramsFromLocation is a new object
paramsFromLocation(
currentLocation.params,
// only keep params that exist in the resolved location
// only keep optional params coming from a parent record
matcher.keys.filter((k) => !k.optional).concat(matcher.parent ? matcher.parent.keys.filter((k) => k.optional) : []).map((k) => k.name)
),
// discard any existing params in the current location that do not exist here
// #1497 this ensures better active/exact matching
location2.params && paramsFromLocation(location2.params, matcher.keys.map((k) => k.name))
);
path2 = matcher.stringify(params);
} else if (location2.path != null) {
path2 = location2.path;
matcher = matchers.find((m) => m.re.test(path2));
if (matcher) {
params = matcher.parse(path2);
name = matcher.record.name;
}
} else {
matcher = currentLocation.name ? matcherMap.get(currentLocation.name) : matchers.find((m) => m.re.test(currentLocation.path));
if (!matcher)
throw createRouterError(1, {
location: location2,
currentLocation
});
name = matcher.record.name;
params = assign$1({}, currentLocation.params, location2.params);
path2 = matcher.stringify(params);
}
const matched = [];
let parentMatcher = matcher;
while (parentMatcher) {
matched.unshift(parentMatcher.record);
parentMatcher = parentMatcher.parent;
}
return {
name,
path: path2,
params,
matched,
meta: mergeMetaFields(matched)
};
}
routes.forEach((route) => addRoute(route));
function clearRoutes() {
matchers.length = 0;
matcherMap.clear();
}
return {
addRoute,
resolve,
removeRoute,
clearRoutes,
getRoutes,
getRecordMatcher
};
}
function paramsFromLocation(params, keys) {
const newParams = {};
for (const key2 of keys) {
if (key2 in params)
newParams[key2] = params[key2];
}
return newParams;
}
function normalizeRouteRecord(record) {
const normalized = {
path: record.path,
redirect: record.redirect,
name: record.name,
meta: record.meta || {},
aliasOf: record.aliasOf,
beforeEnter: record.beforeEnter,
props: normalizeRecordProps(record),
children: record.children || [],
instances: {},
leaveGuards: /* @__PURE__ */ new Set(),
updateGuards: /* @__PURE__ */ new Set(),
enterCallbacks: {},
// must be declared afterwards
// mods: {},
components: "components" in record ? record.components || null : record.component && { default: record.component }
};
Object.defineProperty(normalized, "mods", {
value: {}
});
return normalized;
}
function normalizeRecordProps(record) {
const propsObject = {};
const props2 = record.props || false;
if ("component" in record) {
propsObject.default = props2;
} else {
for (const name in record.components)
propsObject[name] = typeof props2 === "object" ? props2[name] : props2;
}
return propsObject;
}
function isAliasRecord(record) {
while (record) {
if (record.record.aliasOf)
return true;
record = record.parent;
}
return false;
}
function mergeMetaFields(matched) {
return matched.reduce((meta, record) => assign$1(meta, record.meta), {});
}
function mergeOptions(defaults, partialOptions) {
const options = {};
for (const key2 in defaults) {
options[key2] = key2 in partialOptions ? partialOptions[key2] : defaults[key2];
}
return options;
}
function findInsertionIndex(matcher, matchers) {
let lower2 = 0;
let upper = matchers.length;
while (lower2 !== upper) {
const mid = lower2 + upper >> 1;
const sortOrder = comparePathParserScore(matcher, matchers[mid]);
if (sortOrder < 0) {
upper = mid;
} else {
lower2 = mid + 1;
}
}
const insertionAncestor = getInsertionAncestor(matcher);
if (insertionAncestor) {
upper = matchers.lastIndexOf(insertionAncestor, upper - 1);
}
return upper;
}
function getInsertionAncestor(matcher) {
let ancestor = matcher;
while (ancestor = ancestor.parent) {
if (isMatchable(ancestor) && comparePathParserScore(matcher, ancestor) === 0) {
return ancestor;
}
}
return;
}
function isMatchable({ record }) {
return !!(record.name || record.components && Object.keys(record.components).length || record.redirect);
}
function parseQuery(search) {
const query = {};
if (search === "" || search === "?")
return query;
const hasLeadingIM = search[0] === "?";
const searchParams = (hasLeadingIM ? search.slice(1) : search).split("&");
for (let i = 0; i < searchParams.length; ++i) {
const searchParam = searchParams[i].replace(PLUS_RE, " ");
const eqPos = searchParam.indexOf("=");
const key2 = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
if (key2 in query) {
let currentValue = query[key2];
if (!isArray$1(currentValue)) {
currentValue = query[key2] = [currentValue];
}
currentValue.push(value);
} else {
query[key2] = value;
}
}
return query;
}
function stringifyQuery(query) {
let search = "";
for (let key2 in query) {
const value = query[key2];
key2 = encodeQueryKey(key2);
if (value == null) {
if (value !== void 0) {
search += (search.length ? "&" : "") + key2;
}
continue;
}
const values = isArray$1(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)];
values.forEach((value2) => {
if (value2 !== void 0) {
search += (search.length ? "&" : "") + key2;
if (value2 != null)
search += "=" + value2;
}
});
}
return search;
}
function normalizeQuery(query) {
const normalizedQuery = {};
for (const key2 in query) {
const value = query[key2];
if (value !== void 0) {
normalizedQuery[key2] = isArray$1(value) ? value.map((v) => v == null ? null : "" + v) : value == null ? value : "" + value;
}
}
return normalizedQuery;
}
const matchedRouteKey = Symbol("");
const viewDepthKey = Symbol("");
const routerKey = Symbol("");
const routeLocationKey = Symbol("");
const routerViewLocationKey = Symbol("");
function useCallbacks() {
let handlers = [];
function add(handler2) {
handlers.push(handler2);
return () => {
const i = handlers.indexOf(handler2);
if (i > -1)
handlers.splice(i, 1);
};
}
function reset() {
handlers = [];
}
return {
add,
list: () => handlers.slice(),
reset
};
}
function guardToPromiseFn(guard, to, from, record, name, runWithContext = (fn) => fn()) {
const enterCallbackArray = record && // name is defined if record is because of the function overload
(record.enterCallbacks[name] = record.enterCallbacks[name] || []);
return () => new Promise((resolve, reject) => {
const next = (valid) => {
if (valid === false) {
reject(createRouterError(4, {
from,
to
}));
} else if (valid instanceof Error) {
reject(valid);
} else if (isRouteLocation(valid)) {
reject(createRouterError(2, {
from: to,
to: valid
}));
} else {
if (enterCallbackArray && // since enterCallbackArray is truthy, both record and name also are
record.enterCallbacks[name] === enterCallbackArray && typeof valid === "function") {
enterCallbackArray.push(valid);
}
resolve();
}
};
const guardReturn = runWithContext(() => guard.call(record && record.instances[name], to, from, next));
let guardCall = Promise.resolve(guardReturn);
if (guard.length < 3)
guardCall = guardCall.then(next);
guardCall.catch((err) => reject(err));
});
}
function extractComponentsGuards(matched, guardType, to, from, runWithContext = (fn) => fn()) {
const guards = [];
for (const record of matched) {
for (const name in record.components) {
let rawComponent = record.components[name];
if (guardType !== "beforeRouteEnter" && !record.instances[name])
continue;
if (isRouteComponent(rawComponent)) {
const options = rawComponent.__vccOpts || rawComponent;
const guard = options[guardType];
guard && guards.push(guardToPromiseFn(guard, to, from, record, name, runWithContext));
} else {
let componentPromise = rawComponent();
guards.push(() => componentPromise.then((resolved) => {
if (!resolved)
throw new Error(`Couldn't resolve component "${name}" at "${record.path}"`);
const resolvedComponent = isESModule(resolved) ? resolved.default : resolved;
record.mods[name] = resolved;
record.components[name] = resolvedComponent;
const options = resolvedComponent.__vccOpts || resolvedComponent;
const guard = options[guardType];
return guard && guardToPromiseFn(guard, to, from, record, name, runWithContext)();
}));
}
}
}
return guards;
}
function useLink(props2) {
const router = inject(routerKey);
const currentRoute = inject(routeLocationKey);
const route = computed(() => {
const to = unref(props2.to);
return router.resolve(to);
});
const activeRecordIndex = computed(() => {
const { matched } = route.value;
const { length } = matched;
const routeMatched = matched[length - 1];
const currentMatched = currentRoute.matched;
if (!routeMatched || !currentMatched.length)
return -1;
const index2 = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
if (index2 > -1)
return index2;
const parentRecordPath = getOriginalPath(matched[length - 2]);
return (
// we are dealing with nested routes
length > 1 && // if the parent and matched route have the same path, this link is
// referring to the empty child. Or we currently are on a different
// child of the same parent
getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index2
);
});
const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
function navigate(e = {}) {
if (guardEvent(e)) {
const p = router[unref(props2.replace) ? "replace" : "push"](
unref(props2.to)
// avoid uncaught errors are they are logged anyway
).catch(noop$f);
if (props2.viewTransition && false) ;
return p;
}
return Promise.resolve();
}
return {
route,
href: computed(() => route.value.href),
isActive,
isExactActive,
navigate
};
}
function preferSingleVNode(vnodes) {
return vnodes.length === 1 ? vnodes[0] : vnodes;
}
const RouterLinkImpl = /* @__PURE__ */ defineComponent({
name: "RouterLink",
compatConfig: { MODE: 3 },
props: {
to: {
type: [String, Object],
required: true
},
replace: Boolean,
activeClass: String,
// inactiveClass: String,
exactActiveClass: String,
custom: Boolean,
ariaCurrentValue: {
type: String,
default: "page"
},
viewTransition: Boolean
},
useLink,
setup(props2, { slots }) {
const link = reactive(useLink(props2));
const { options } = inject(routerKey);
const elClass = computed(() => ({
[getLinkClass(props2.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
// [getLinkClass(
// props.inactiveClass,
// options.linkInactiveClass,
// 'router-link-inactive'
// )]: !link.isExactActive,
[getLinkClass(props2.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
}));
return () => {
const children = slots.default && preferSingleVNode(slots.default(link));
return props2.custom ? children : h("a", {
"aria-current": link.isExactActive ? props2.ariaCurrentValue : null,
href: link.href,
// this would override user added attrs but Vue will still add
// the listener, so we end up triggering both
onClick: link.navigate,
class: elClass.value
}, children);
};
}
});
const RouterLink = RouterLinkImpl;
function guardEvent(e) {
if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
return;
if (e.defaultPrevented)
return;
if (e.button !== void 0 && e.button !== 0)
return;
if (e.currentTarget && e.currentTarget.getAttribute) {
const target = e.currentTarget.getAttribute("target");
if (/\b_blank\b/i.test(target))
return;
}
if (e.preventDefault)
e.preventDefault();
return true;
}
function includesParams(outer, inner) {
for (const key2 in inner) {
const innerValue = inner[key2];
const outerValue = outer[key2];
if (typeof innerValue === "string") {
if (innerValue !== outerValue)
return false;
} else {
if (!isArray$1(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
return false;
}
}
return true;
}
function getOriginalPath(record) {
return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
}
const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
const RouterViewImpl = /* @__PURE__ */ defineComponent({
name: "RouterView",
// #674 we manually inherit them
inheritAttrs: false,
props: {
name: {
type: String,
default: "default"
},
route: Object
},
// Better compat for @vue/compat users
// https://github.com/vuejs/router/issues/1315
compatConfig: { MODE: 3 },
setup(props2, { attrs, slots }) {
const injectedRoute = inject(routerViewLocationKey);
const routeToDisplay = computed(() => props2.route || injectedRoute.value);
const injectedDepth = inject(viewDepthKey, 0);
const depth = computed(() => {
let initialDepth = unref(injectedDepth);
const { matched } = routeToDisplay.value;
let matchedRoute;
while ((matchedRoute = matched[initialDepth]) && !matchedRoute.components) {
initialDepth++;
}
return initialDepth;
});
const matchedRouteRef = computed(() => routeToDisplay.value.matched[depth.value]);
provide(viewDepthKey, computed(() => depth.value + 1));
provide(matchedRouteKey, matchedRouteRef);
provide(routerViewLocationKey, routeToDisplay);
const viewRef = ref();
watch(() => [viewRef.value, matchedRouteRef.value, props2.name], ([instance, to, name], [oldInstance, from, oldName]) => {
if (to) {
to.instances[name] = instance;
if (from && from !== to && instance && instance === oldInstance) {
if (!to.leaveGuards.size) {
to.leaveGuards = from.leaveGuards;
}
if (!to.updateGuards.size) {
to.updateGuards = from.updateGuards;
}
}
}
if (instance && to && // if there is no instance but to and from are the same this might be
// the first visit
(!from || !isSameRouteRecord(to, from) || !oldInstance)) {
(to.enterCallbacks[name] || []).forEach((callback) => callback(instance));
}
}, { flush: "post" });
return () => {
const route = routeToDisplay.value;
const currentName = props2.name;
const matchedRoute = matchedRouteRef.value;
const ViewComponent = matchedRoute && matchedRoute.components[currentName];
if (!ViewComponent) {
return normalizeSlot$1(slots.default, { Component: ViewComponent, route });
}
const routePropsOption = matchedRoute.props[currentName];
const routeProps = routePropsOption ? routePropsOption === true ? route.params : typeof routePropsOption === "function" ? routePropsOption(route) : routePropsOption : null;
const onVnodeUnmounted = (vnode) => {
if (vnode.component.isUnmounted) {
matchedRoute.instances[currentName] = null;
}
};
const component = h(ViewComponent, assign$1({}, routeProps, attrs, {
onVnodeUnmounted,
ref: viewRef
}));
return (
// pass the vnode to the slot as a prop.
// h and both accept vnodes
normalizeSlot$1(slots.default, { Component: component, route }) || component
);
};
}
});
function normalizeSlot$1(slot, data) {
if (!slot)
return null;
const slotContent = slot(data);
return slotContent.length === 1 ? slotContent[0] : slotContent;
}
const RouterView = RouterViewImpl;
function createRouter(options) {
const matcher = createRouterMatcher(options.routes, options);
const parseQuery$1 = options.parseQuery || parseQuery;
const stringifyQuery$1 = options.stringifyQuery || stringifyQuery;
const routerHistory = options.history;
const beforeGuards = useCallbacks();
const beforeResolveGuards = useCallbacks();
const afterGuards = useCallbacks();
const currentRoute = shallowRef(START_LOCATION_NORMALIZED);
let pendingLocation = START_LOCATION_NORMALIZED;
const normalizeParams = applyToParams.bind(null, (paramValue) => "" + paramValue);
const encodeParams = applyToParams.bind(null, encodeParam);
const decodeParams = (
// @ts-expect-error: intentionally avoid the type check
applyToParams.bind(null, decode)
);
function addRoute(parentOrRoute, route) {
let parent;
let record;
if (isRouteName(parentOrRoute)) {
parent = matcher.getRecordMatcher(parentOrRoute);
record = route;
} else {
record = parentOrRoute;
}
return matcher.addRoute(record, parent);
}
function removeRoute(name) {
const recordMatcher = matcher.getRecordMatcher(name);
if (recordMatcher) {
matcher.removeRoute(recordMatcher);
}
}
function getRoutes() {
return matcher.getRoutes().map((routeMatcher) => routeMatcher.record);
}
function hasRoute(name) {
return !!matcher.getRecordMatcher(name);
}
function resolve(rawLocation, currentLocation) {
currentLocation = assign$1({}, currentLocation || currentRoute.value);
if (typeof rawLocation === "string") {
const locationNormalized = parseURL(parseQuery$1, rawLocation, currentLocation.path);
const matchedRoute2 = matcher.resolve({ path: locationNormalized.path }, currentLocation);
const href2 = routerHistory.createHref(locationNormalized.fullPath);
return assign$1(locationNormalized, matchedRoute2, {
params: decodeParams(matchedRoute2.params),
hash: decode(locationNormalized.hash),
redirectedFrom: void 0,
href: href2
});
}
let matcherLocation;
if (rawLocation.path != null) {
matcherLocation = assign$1({}, rawLocation, {
path: parseURL(parseQuery$1, rawLocation.path, currentLocation.path).path
});
} else {
const targetParams = assign$1({}, rawLocation.params);
for (const key2 in targetParams) {
if (targetParams[key2] == null) {
delete targetParams[key2];
}
}
matcherLocation = assign$1({}, rawLocation, {
params: encodeParams(targetParams)
});
currentLocation.params = encodeParams(currentLocation.params);
}
const matchedRoute = matcher.resolve(matcherLocation, currentLocation);
const hash2 = rawLocation.hash || "";
matchedRoute.params = normalizeParams(decodeParams(matchedRoute.params));
const fullPath = stringifyURL(stringifyQuery$1, assign$1({}, rawLocation, {
hash: encodeHash(hash2),
path: matchedRoute.path
}));
const href = routerHistory.createHref(fullPath);
return assign$1({
fullPath,
// keep the hash encoded so fullPath is effectively path + encodedQuery +
// hash
hash: hash2,
query: (
// if the user is using a custom query lib like qs, we might have
// nested objects, so we keep the query as is, meaning it can contain
// numbers at `$route.query`, but at the point, the user will have to
// use their own type anyway.
// https://github.com/vuejs/router/issues/328#issuecomment-649481567
stringifyQuery$1 === stringifyQuery ? normalizeQuery(rawLocation.query) : rawLocation.query || {}
)
}, matchedRoute, {
redirectedFrom: void 0,
href
});
}
function locationAsObject(to) {
return typeof to === "string" ? parseURL(parseQuery$1, to, currentRoute.value.path) : assign$1({}, to);
}
function checkCanceledNavigation(to, from) {
if (pendingLocation !== to) {
return createRouterError(8, {
from,
to
});
}
}
function push(to) {
return pushWithRedirect(to);
}
function replace(to) {
return push(assign$1(locationAsObject(to), { replace: true }));
}
function handleRedirectRecord(to) {
const lastMatched = to.matched[to.matched.length - 1];
if (lastMatched && lastMatched.redirect) {
const { redirect } = lastMatched;
let newTargetLocation = typeof redirect === "function" ? redirect(to) : redirect;
if (typeof newTargetLocation === "string") {
newTargetLocation = newTargetLocation.includes("?") || newTargetLocation.includes("#") ? newTargetLocation = locationAsObject(newTargetLocation) : (
// force empty params
{ path: newTargetLocation }
);
newTargetLocation.params = {};
}
return assign$1({
query: to.query,
hash: to.hash,
// avoid transferring params if the redirect has a path
params: newTargetLocation.path != null ? {} : to.params
}, newTargetLocation);
}
}
function pushWithRedirect(to, redirectedFrom) {
const targetLocation = pendingLocation = resolve(to);
const from = currentRoute.value;
const data = to.state;
const force = to.force;
const replace2 = to.replace === true;
const shouldRedirect = handleRedirectRecord(targetLocation);
if (shouldRedirect)
return pushWithRedirect(
assign$1(locationAsObject(shouldRedirect), {
state: typeof shouldRedirect === "object" ? assign$1({}, data, shouldRedirect.state) : data,
force,
replace: replace2
}),
// keep original redirectedFrom if it exists
redirectedFrom || targetLocation
);
const toLocation = targetLocation;
toLocation.redirectedFrom = redirectedFrom;
let failure;
if (!force && isSameRouteLocation(stringifyQuery$1, from, targetLocation)) {
failure = createRouterError(16, { to: toLocation, from });
handleScroll();
}
return (failure ? Promise.resolve(failure) : navigate(toLocation, from)).catch((error) => isNavigationFailure(error) ? (
// navigation redirects still mark the router as ready
isNavigationFailure(
error,
2
/* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
) ? error : markAsReady(error)
) : (
// reject any unknown error
triggerError(error, toLocation, from)
)).then((failure2) => {
if (failure2) {
if (isNavigationFailure(
failure2,
2
/* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
)) {
return pushWithRedirect(
// keep options
assign$1({
// preserve an existing replacement but allow the redirect to override it
replace: replace2
}, locationAsObject(failure2.to), {
state: typeof failure2.to === "object" ? assign$1({}, data, failure2.to.state) : data,
force
}),
// preserve the original redirectedFrom if any
redirectedFrom || toLocation
);
}
} else {
failure2 = finalizeNavigation(toLocation, from, true, replace2, data);
}
triggerAfterEach(toLocation, from, failure2);
return failure2;
});
}
function checkCanceledNavigationAndReject(to, from) {
const error = checkCanceledNavigation(to, from);
return error ? Promise.reject(error) : Promise.resolve();
}
function runWithContext(fn) {
const app = installedApps.values().next().value;
return app && typeof app.runWithContext === "function" ? app.runWithContext(fn) : fn();
}
function navigate(to, from) {
let guards;
const [leavingRecords, updatingRecords, enteringRecords] = extractChangingRecords(to, from);
guards = extractComponentsGuards(leavingRecords.reverse(), "beforeRouteLeave", to, from);
for (const record of leavingRecords) {
record.leaveGuards.forEach((guard) => {
guards.push(guardToPromiseFn(guard, to, from));
});
}
const canceledNavigationCheck = checkCanceledNavigationAndReject.bind(null, to, from);
guards.push(canceledNavigationCheck);
return runGuardQueue(guards).then(() => {
guards = [];
for (const guard of beforeGuards.list()) {
guards.push(guardToPromiseFn(guard, to, from));
}
guards.push(canceledNavigationCheck);
return runGuardQueue(guards);
}).then(() => {
guards = extractComponentsGuards(updatingRecords, "beforeRouteUpdate", to, from);
for (const record of updatingRecords) {
record.updateGuards.forEach((guard) => {
guards.push(guardToPromiseFn(guard, to, from));
});
}
guards.push(canceledNavigationCheck);
return runGuardQueue(guards);
}).then(() => {
guards = [];
for (const record of enteringRecords) {
if (record.beforeEnter) {
if (isArray$1(record.beforeEnter)) {
for (const beforeEnter of record.beforeEnter)
guards.push(guardToPromiseFn(beforeEnter, to, from));
} else {
guards.push(guardToPromiseFn(record.beforeEnter, to, from));
}
}
}
guards.push(canceledNavigationCheck);
return runGuardQueue(guards);
}).then(() => {
to.matched.forEach((record) => record.enterCallbacks = {});
guards = extractComponentsGuards(enteringRecords, "beforeRouteEnter", to, from, runWithContext);
guards.push(canceledNavigationCheck);
return runGuardQueue(guards);
}).then(() => {
guards = [];
for (const guard of beforeResolveGuards.list()) {
guards.push(guardToPromiseFn(guard, to, from));
}
guards.push(canceledNavigationCheck);
return runGuardQueue(guards);
}).catch((err) => isNavigationFailure(
err,
8
/* ErrorTypes.NAVIGATION_CANCELLED */
) ? err : Promise.reject(err));
}
function triggerAfterEach(to, from, failure) {
afterGuards.list().forEach((guard) => runWithContext(() => guard(to, from, failure)));
}
function finalizeNavigation(toLocation, from, isPush, replace2, data) {
const error = checkCanceledNavigation(toLocation, from);
if (error)
return error;
const isFirstNavigation = from === START_LOCATION_NORMALIZED;
const state = {};
if (isPush) {
if (replace2 || isFirstNavigation)
routerHistory.replace(toLocation.fullPath, assign$1({
scroll: isFirstNavigation && state && state.scroll
}, data));
else
routerHistory.push(toLocation.fullPath, data);
}
currentRoute.value = toLocation;
handleScroll();
markAsReady();
}
let removeHistoryListener;
function setupListeners() {
if (removeHistoryListener)
return;
removeHistoryListener = routerHistory.listen((to, _from, info) => {
if (!router.listening)
return;
const toLocation = resolve(to);
const shouldRedirect = handleRedirectRecord(toLocation);
if (shouldRedirect) {
pushWithRedirect(assign$1(shouldRedirect, { replace: true, force: true }), toLocation).catch(noop$f);
return;
}
pendingLocation = toLocation;
const from = currentRoute.value;
navigate(toLocation, from).catch((error) => {
if (isNavigationFailure(
error,
4 | 8
/* ErrorTypes.NAVIGATION_CANCELLED */
)) {
return error;
}
if (isNavigationFailure(
error,
2
/* ErrorTypes.NAVIGATION_GUARD_REDIRECT */
)) {
pushWithRedirect(
assign$1(locationAsObject(error.to), {
force: true
}),
toLocation
// avoid an uncaught rejection, let push call triggerError
).then((failure) => {
if (isNavigationFailure(
failure,
4 | 16
/* ErrorTypes.NAVIGATION_DUPLICATED */
) && !info.delta && info.type === NavigationType.pop) {
routerHistory.go(-1, false);
}
}).catch(noop$f);
return Promise.reject();
}
if (info.delta) {
routerHistory.go(-info.delta, false);
}
return triggerError(error, toLocation, from);
}).then((failure) => {
failure = failure || finalizeNavigation(
// after navigation, all matched components are resolved
toLocation,
from,
false
);
if (failure) {
if (info.delta && // a new navigation has been triggered, so we do not want to revert, that will change the current history
// entry while a different route is displayed
!isNavigationFailure(
failure,
8
/* ErrorTypes.NAVIGATION_CANCELLED */
)) {
routerHistory.go(-info.delta, false);
} else if (info.type === NavigationType.pop && isNavigationFailure(
failure,
4 | 16
/* ErrorTypes.NAVIGATION_DUPLICATED */
)) {
routerHistory.go(-1, false);
}
}
triggerAfterEach(toLocation, from, failure);
}).catch(noop$f);
});
}
let readyHandlers = useCallbacks();
let errorListeners = useCallbacks();
let ready;
function triggerError(error, to, from) {
markAsReady(error);
const list = errorListeners.list();
if (list.length) {
list.forEach((handler2) => handler2(error, to, from));
} else {
console.error(error);
}
return Promise.reject(error);
}
function isReady() {
if (ready && currentRoute.value !== START_LOCATION_NORMALIZED)
return Promise.resolve();
return new Promise((resolve2, reject) => {
readyHandlers.add([resolve2, reject]);
});
}
function markAsReady(err) {
if (!ready) {
ready = !err;
setupListeners();
readyHandlers.list().forEach(([resolve2, reject]) => err ? reject(err) : resolve2());
readyHandlers.reset();
}
return err;
}
function handleScroll(to, from, isPush, isFirstNavigation) {
const { scrollBehavior } = options;
return Promise.resolve();
}
const go = (delta) => routerHistory.go(delta);
const installedApps = /* @__PURE__ */ new Set();
const router = {
currentRoute,
listening: true,
addRoute,
removeRoute,
clearRoutes: matcher.clearRoutes,
hasRoute,
getRoutes,
resolve,
options,
push,
replace,
go,
back: () => go(-1),
forward: () => go(1),
beforeEach: beforeGuards.add,
beforeResolve: beforeResolveGuards.add,
afterEach: afterGuards.add,
onError: errorListeners.add,
isReady,
install(app) {
const router2 = this;
app.component("RouterLink", RouterLink);
app.component("RouterView", RouterView);
app.config.globalProperties.$router = router2;
Object.defineProperty(app.config.globalProperties, "$route", {
enumerable: true,
get: () => unref(currentRoute)
});
const reactiveRoute = {};
for (const key2 in START_LOCATION_NORMALIZED) {
Object.defineProperty(reactiveRoute, key2, {
get: () => currentRoute.value[key2],
enumerable: true
});
}
app.provide(routerKey, router2);
app.provide(routeLocationKey, shallowReactive(reactiveRoute));
app.provide(routerViewLocationKey, currentRoute);
const unmountApp = app.unmount;
installedApps.add(app);
app.unmount = function() {
installedApps.delete(app);
if (installedApps.size < 1) {
pendingLocation = START_LOCATION_NORMALIZED;
removeHistoryListener && removeHistoryListener();
removeHistoryListener = null;
currentRoute.value = START_LOCATION_NORMALIZED;
ready = false;
}
unmountApp();
};
}
};
function runGuardQueue(guards) {
return guards.reduce((promise, guard) => promise.then(() => runWithContext(guard)), Promise.resolve());
}
return router;
}
function extractChangingRecords(to, from) {
const leavingRecords = [];
const updatingRecords = [];
const enteringRecords = [];
const len = Math.max(from.matched.length, to.matched.length);
for (let i = 0; i < len; i++) {
const recordFrom = from.matched[i];
if (recordFrom) {
if (to.matched.find((record) => isSameRouteRecord(record, recordFrom)))
updatingRecords.push(recordFrom);
else
leavingRecords.push(recordFrom);
}
const recordTo = to.matched[i];
if (recordTo) {
if (!from.matched.find((record) => isSameRouteRecord(record, recordTo))) {
enteringRecords.push(recordTo);
}
}
}
return [leavingRecords, updatingRecords, enteringRecords];
}
function useRouter() {
return inject(routerKey);
}
function useRoute(_name) {
return inject(routeLocationKey);
}
function toArray$9(value) {
return Array.isArray(value) ? value : [value];
}
const __nuxt_page_meta$F = {
redirect: { name: "auth-login" },
showMobileNavigationMenu: false
};
const __nuxt_page_meta$E = null;
const __nuxt_page_meta$D = {
ssr: false
};
const __nuxt_page_meta$C = {
ssr: false
};
const __nuxt_page_meta$B = {
ssr: false
};
const __nuxt_page_meta$A = {
ssr: false
};
const __nuxt_page_meta$z = {
ssr: false
};
const __nuxt_page_meta$y = {
ssr: false,
showMobileNavigationMenu: false
};
const __nuxt_page_meta$x = {
ssr: false
};
const __nuxt_page_meta$w = {
ssr: false
};
const __nuxt_page_meta$v = {
ssr: false
};
const __nuxt_page_meta$u = {
ssr: false
};
const __nuxt_page_meta$t = {
ssr: false
};
const __nuxt_page_meta$s = {
ssr: false
};
const __nuxt_page_meta$r = {
ssr: false,
showMobileNavigationMenu: false
};
const __nuxt_page_meta$q = {
ssr: false
};
const __nuxt_page_meta$p = {
redirect: { name: "add-story-inputStory" },
showMobileNavigationMenu: false
};
const __nuxt_page_meta$o = {
ssr: false
};
const __nuxt_page_meta$n = {
ssr: false
};
const __nuxt_page_meta$m = {
ssr: false
};
const __nuxt_page_meta$l = {
redirect: { name: "add-product-inputProduct" },
showMobileNavigationMenu: false
};
const __nuxt_page_meta$k = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$j = {
ssr: false
};
const __nuxt_page_meta$i = {
ssr: false
};
const __nuxt_page_meta$h = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$g = {
ssr: false
};
const __nuxt_page_meta$f = {
ssr: false
};
const __nuxt_page_meta$e = {
ssr: false
};
const __nuxt_page_meta$d = {
ssr: false
};
const __nuxt_page_meta$c = {
ssr: false
};
const __nuxt_page_meta$b = {
// redirect: {name: 'edit-story-id-inputStory'},
showMobileNavigationMenu: false
};
const __nuxt_page_meta$a = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$9 = {
ssr: false,
showMobileNavigationMenu: false
};
const __nuxt_page_meta$8 = {
redirect: { name: "add-product-excel-inputProduct" },
showMobileNavigationMenu: false,
ssr: false
};
const __nuxt_page_meta$7 = {
// redirect: {name: 'edit-product-id-inputProduct'},
showMobileNavigationMenu: false
};
const __nuxt_page_meta$6 = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$5 = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$4 = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$3 = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$2 = {
showMobileNavigationMenu: false
};
const __nuxt_page_meta$1 = {
ssr: false,
showMobileNavigationMenu: false
};
const __nuxt_page_meta = {
ssr: false,
showMobileNavigationMenu: false
};
const _routes = [
{
name: "auth",
path: "/auth",
meta: __nuxt_page_meta$F || {},
redirect: { "name": "auth-login" },
component: () => import('./auth-B4j-BX7I.mjs'),
children: [
{
name: "auth-login",
path: "login",
component: () => import('./index-D_oF5uBy.mjs')
},
{
name: "auth-forget",
path: "forget",
component: () => import('./index-EmQy7euW.mjs')
},
{
name: "auth-register",
path: "register",
component: () => import('./index-B4QceWQt.mjs')
}
]
},
{
name: "index",
path: "/",
redirect: { "name": "home" },
component: () => import('./index-B5IlPLbl.mjs')
},
{
name: __nuxt_page_meta$E?.name,
path: "/posts",
component: () => import('./posts-CMSR4RP8.mjs'),
children: [
{
name: "posts",
path: "",
component: () => import('./index-B2Z4CG8V.mjs')
}
]
},
{
name: "user-add",
path: "/user/add",
meta: __nuxt_page_meta$D || {},
component: () => import('./add-CvoXN-Yw.mjs')
},
{
name: "add",
path: "/add",
meta: __nuxt_page_meta$C || {},
component: () => import('./index-K_g7qaqV.mjs')
},
{
name: "cart-id",
path: "/cart/:id()",
meta: __nuxt_page_meta$B || {},
component: () => import('./_id_-8fKZljyM.mjs')
},
{
name: "fav",
path: "/fav",
meta: __nuxt_page_meta$A || {},
component: () => import('./index-Bht40o0J.mjs')
},
{
name: "cart",
path: "/cart",
meta: __nuxt_page_meta$z || {},
component: () => import('./index-BAn97myh.mjs')
},
{
name: "edit",
path: "/edit",
meta: __nuxt_page_meta$y || {},
component: () => import('./index-CR4yXz8J.mjs')
},
{
name: "home",
path: "/home",
component: () => import('./index-Cj_DJbKd.mjs')
},
{
name: "user",
path: "/user",
component: () => import('./index-C0oRlG6V.mjs')
},
{
name: "saved-posts",
path: "/saved/posts",
meta: __nuxt_page_meta$x || {},
component: () => import('./posts-BCvouWxo.mjs')
},
{
name: "user-brands",
path: "/user/brands",
meta: __nuxt_page_meta$w || {},
component: () => import('./brands-CLFJptAk.mjs')
},
{
name: "message-list",
path: "/message/list",
component: () => import('./list-gzNcFovX.mjs')
},
{
name: "search",
path: "/search",
component: () => import('./index-gQTbjVxv.mjs')
},
{
name: "user-address",
path: "/user/address",
meta: __nuxt_page_meta$v || {},
component: () => import('./address-DU8l8qHx.mjs')
},
{
name: "user-message",
path: "/user/message",
meta: __nuxt_page_meta$u || {},
component: () => import('./message-BEdOURS3.mjs')
},
{
name: "user-profile",
path: "/user/profile",
meta: __nuxt_page_meta$t || {},
component: () => import('./profile-CI93yvLo.mjs')
},
{
name: "user-setting",
path: "/user/setting",
meta: __nuxt_page_meta$s || {},
component: () => import('./setting-DhO3XUyj.mjs')
},
{
name: "message",
path: "/message",
meta: __nuxt_page_meta$r || {},
component: () => import('./index-DZDiaqXs.mjs')
},
{
name: "user-managers",
path: "/user/managers",
meta: __nuxt_page_meta$q || {},
component: () => import('./managers-CsbPbBV3.mjs')
},
{
name: "user-edit-id",
path: "/user/edit/:id()",
component: () => import('./_id_-D9ubmBMQ.mjs')
},
{
name: "add-story",
path: "/add/story",
meta: __nuxt_page_meta$p || {},
redirect: { "name": "add-story-inputStory" },
component: () => import('./index-FZA5LjRS.mjs')
},
{
name: "user-attributes",
path: "/user/attributes",
meta: __nuxt_page_meta$o || {},
component: () => import('./attributes-CDr2HvG6.mjs')
},
{
name: "user-categories",
path: "/user/categories",
meta: __nuxt_page_meta$n || {},
component: () => import('./categories-BbbUO7eZ.mjs')
},
{
name: "user-edit",
path: "/user/edit",
component: () => import('./index-s5RKds2g.mjs')
},
{
name: "user-order-id",
path: "/user/order/:id()",
component: () => import('./_id_-CjGI2ICL.mjs')
},
{
name: "highlight-create",
path: "/highlight/create",
meta: __nuxt_page_meta$m || {},
component: () => import('./create-DuvpGprX.mjs')
},
{
name: "user_detail-id",
path: "/user_detail/:id()",
component: () => import('./_id_-CoZlxEqF.mjs')
},
{
name: "add-product",
path: "/add/product",
meta: __nuxt_page_meta$l || {},
redirect: { "name": "add-product-inputProduct" },
component: () => import('./index-DYsR3AxR.mjs')
},
{
name: "search-main",
path: "/search/main",
component: () => import('./index-DqEAn4Lx.mjs')
},
{
name: "add-story-infStory",
path: "/add/story/infStory",
meta: __nuxt_page_meta$k || {},
component: () => import('./infStory-BTh9mkgt.mjs')
},
{
name: "user-store_request",
path: "/user/store_request",
meta: __nuxt_page_meta$j || {},
component: () => import('./store_request-D-RncGYz.mjs')
},
{
name: "highlight-edit-id",
path: "/highlight/edit/:id()",
meta: __nuxt_page_meta$i || {},
component: () => import('./_id_-CMFcG2Xu.mjs')
},
{
name: "product_detail-id",
path: "/product_detail/:id()",
component: () => import('./_id_-CUp2Fz4a.mjs')
},
{
name: "add-story-inputStory",
path: "/add/story/inputStory",
meta: __nuxt_page_meta$h || {},
component: () => import('./inputStory-B3EGsETS.mjs')
},
{
name: "user-statistics_list",
path: "/user/statistics_list",
meta: __nuxt_page_meta$c || {},
component: () => import('./statistics_list-BlDgAMHK.mjs'),
children: [
{
name: "user-statistics_list-saved",
path: "saved",
meta: __nuxt_page_meta$g || {},
component: () => import('./saved-CmoUAWaj.mjs')
},
{
name: "user-statistics_list-orders",
path: "orders",
meta: __nuxt_page_meta$f || {},
component: () => import('./orders-HqkKeTeA.mjs')
},
{
name: "user-statistics_list-customers",
path: "customers",
meta: __nuxt_page_meta$e || {},
component: () => import('./customers-CpUE9bCj.mjs')
},
{
name: "user-statistics_list-storeOrders",
path: "storeOrders",
meta: __nuxt_page_meta$d || {},
component: () => import('./storeOrders-CS4lv8TL.mjs')
}
]
},
{
name: "edit-story-id",
path: "/edit/story/:id()",
meta: __nuxt_page_meta$b || {},
component: () => import('./index-BAjVIrUm.mjs')
},
{
name: "add-product-infProduct",
path: "/add/product/infProduct",
meta: __nuxt_page_meta$a || {},
component: () => import('./infProduct-CpQB6uZ2.mjs')
},
{
name: "message-detail_message",
path: "/message/detail_message",
meta: __nuxt_page_meta$9 || {},
component: () => import('./detail_message-BogTW_1D.mjs')
},
{
name: "add-product-excel",
path: "/add/product/excel",
meta: __nuxt_page_meta$8 || {},
redirect: { "name": "add-product-excel-inputProduct" },
component: () => import('./index-BoIg7ftg.mjs')
},
{
name: "edit-product-id",
path: "/edit/product/:id()",
meta: __nuxt_page_meta$7 || {},
component: () => import('./index-Bt06nYMV.mjs')
},
{
name: "add-product-inputProduct",
path: "/add/product/inputProduct",
meta: __nuxt_page_meta$6 || {},
component: () => import('./inputProduct-siUP6G1s.mjs')
},
{
name: "edit-story-id-infStory",
path: "/edit/story/:id()/infStory",
meta: __nuxt_page_meta$5 || {},
component: () => import('./infStory-DS1jPRgt.mjs')
},
{
name: "edit-story-id-inputStory",
path: "/edit/story/:id()/inputStory",
meta: __nuxt_page_meta$4 || {},
component: () => import('./inputStory-yy_4iR5l.mjs')
},
{
name: "edit-product-id-infProduct",
path: "/edit/product/:id()/infProduct",
meta: __nuxt_page_meta$3 || {},
component: () => import('./infProduct-B2bxAk3H.mjs')
},
{
name: "edit-product-id-inputProduct",
path: "/edit/product/:id()/inputProduct",
meta: __nuxt_page_meta$2 || {},
component: () => import('./inputProduct-DdWR7Ynb.mjs')
},
{
name: "add-product-excel-infProductExcel",
path: "/add/product/excel/infProductExcel",
meta: __nuxt_page_meta$1 || {},
component: () => import('./infProductExcel-BPnUJMBz.mjs')
},
{
name: "add-product-excel-inputProductExcel",
path: "/add/product/excel/inputProductExcel",
meta: __nuxt_page_meta || {},
component: () => import('./inputProductExcel-kUHgZPTx.mjs')
}
];
const _wrapInTransition = (props2, children) => {
return { default: () => children.default?.() };
};
const ROUTE_KEY_PARENTHESES_RE = /(:\w+)\([^)]+\)/g;
const ROUTE_KEY_SYMBOLS_RE = /(:\w+)[?+*]/g;
const ROUTE_KEY_NORMAL_RE = /:\w+/g;
function generateRouteKey(route) {
const source = route?.meta.key ?? route.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r) => route.params[r.slice(1)]?.toString() || "");
return typeof source === "function" ? source(route) : source;
}
function isChangingPage(to, from) {
if (to === from || from === START_LOCATION_NORMALIZED) {
return false;
}
if (generateRouteKey(to) !== generateRouteKey(from)) {
return true;
}
const areComponentsSame = to.matched.every(
(comp, index2) => comp.components && comp.components.default === from.matched[index2]?.components?.default
);
if (areComponentsSame) {
return false;
}
return true;
}
const routerOptions0 = {
scrollBehavior(to, from, savedPosition) {
const nuxtApp = useNuxtApp();
const hashScrollBehaviour = useRouter$1().options?.scrollBehaviorType ?? "auto";
if (to.path === from.path) {
if (from.hash && !to.hash) {
return { left: 0, top: 0 };
}
if (to.hash) {
return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior: hashScrollBehaviour };
}
return false;
}
const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from) : to.meta.scrollToTop;
if (routeAllowsScrollToTop === false) {
return false;
}
const hookToWait = nuxtApp._runningTransition ? "page:transition:finish" : "page:loading:end";
return new Promise((resolve) => {
if (from === START_LOCATION_NORMALIZED) {
resolve(_calculatePosition(to, from, savedPosition, hashScrollBehaviour));
return;
}
nuxtApp.hooks.hookOnce(hookToWait, () => {
requestAnimationFrame(() => resolve(_calculatePosition(to, from, savedPosition, hashScrollBehaviour)));
});
});
}
};
function _getHashElementScrollMarginTop(selector) {
try {
const elem = (void 0).querySelector(selector);
if (elem) {
return (Number.parseFloat(getComputedStyle(elem).scrollMarginTop) || 0) + (Number.parseFloat(getComputedStyle((void 0).documentElement).scrollPaddingTop) || 0);
}
} catch {
}
return 0;
}
function _calculatePosition(to, from, savedPosition, defaultHashScrollBehaviour) {
if (savedPosition) {
return savedPosition;
}
const isPageNavigation = isChangingPage(to, from);
if (to.hash) {
return {
el: to.hash,
top: _getHashElementScrollMarginTop(to.hash),
behavior: isPageNavigation ? defaultHashScrollBehaviour : "instant"
};
}
return {
left: 0,
top: 0
};
}
const configRouterOptions = {
hashMode: false,
scrollBehaviorType: "auto"
};
const routerOptions = {
...configRouterOptions,
...routerOptions0
};
const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to, from) => {
let __temp, __restore;
if (!to.meta?.validate) {
return;
}
const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp);
if (result === true) {
return;
}
const error = createError({
fatal: false,
statusCode: result && result.statusCode || 404,
statusMessage: result && result.statusMessage || `Page Not Found: ${to.fullPath}`,
data: {
path: to.fullPath
}
});
return error;
});
function tryOnScopeDispose$1(fn) {
if (getCurrentScope()) {
onScopeDispose(fn);
return true;
}
return false;
}
const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
var _a;
const key2 = args[0];
const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
if (instance == null && !hasInjectionContext())
throw new Error("injectLocal must be called in setup");
if (instance && localProvidedStateMap.has(instance) && key2 in localProvidedStateMap.get(instance))
return localProvidedStateMap.get(instance)[key2];
return inject(...args);
};
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
const notNullish = (val) => val != null;
const toString$1 = Object.prototype.toString;
const isObject$3 = (val) => toString$1.call(val) === "[object Object]";
const noop$e = () => {
};
function createFilterWrapper(filter, fn) {
function wrapper(...args) {
return new Promise((resolve, reject) => {
Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
});
}
return wrapper;
}
const bypassFilter = (invoke2) => {
return invoke2();
};
function debounceFilter(ms, options = {}) {
let timer;
let maxTimer;
let lastRejector = noop$e;
const _clearTimeout = (timer2) => {
clearTimeout(timer2);
lastRejector();
lastRejector = noop$e;
};
let lastInvoker;
const filter = (invoke2) => {
const duration = toValue(ms);
const maxDuration = toValue(options.maxWait);
if (timer)
_clearTimeout(timer);
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
if (maxTimer) {
_clearTimeout(maxTimer);
maxTimer = void 0;
}
return Promise.resolve(invoke2());
}
return new Promise((resolve, reject) => {
lastRejector = options.rejectOnCancel ? reject : resolve;
lastInvoker = invoke2;
if (maxDuration && !maxTimer) {
maxTimer = setTimeout(() => {
if (timer)
_clearTimeout(timer);
maxTimer = void 0;
resolve(lastInvoker());
}, maxDuration);
}
timer = setTimeout(() => {
if (maxTimer)
_clearTimeout(maxTimer);
maxTimer = void 0;
resolve(invoke2());
}, duration);
});
};
return filter;
}
function increaseWithUnit(target, delta) {
var _a;
if (typeof target === "number")
return target + delta;
const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ? void 0 : _a[0]) || "";
const unit = target.slice(value.length);
const result = Number.parseFloat(value) + delta;
if (Number.isNaN(result))
return target;
return result + unit;
}
function pxValue(px) {
return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
}
function toArray$8(value) {
return Array.isArray(value) ? value : [value];
}
function getLifeCycleTarget(target) {
return getCurrentInstance();
}
function watchWithFilter(source, cb, options = {}) {
const {
eventFilter = bypassFilter,
...watchOptions
} = options;
return watch(
source,
createFilterWrapper(
eventFilter,
cb
),
watchOptions
);
}
function tryOnMounted$1(fn, sync = true, target) {
const instance = getLifeCycleTarget();
if (instance)
;
else if (sync)
fn();
else
nextTick(fn);
}
function tryOnUnmounted(fn, target) {
getLifeCycleTarget();
}
function watchDebounced(source, cb, options = {}) {
const {
debounce: debounce2 = 0,
maxWait = void 0,
...watchOptions
} = options;
return watchWithFilter(
source,
cb,
{
...watchOptions,
eventFilter: debounceFilter(debounce2, { maxWait })
}
);
}
function watchImmediate(source, cb, options) {
return watch(
source,
cb,
{
...options,
immediate: true
}
);
}
const defaultWindow$1 = void 0;
function unrefElement$1(elRef) {
var _a;
const plain = toValue(elRef);
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
}
function useEventListener(...args) {
const cleanups = [];
const cleanup2 = () => {
cleanups.forEach((fn) => fn());
cleanups.length = 0;
};
const register = (el, event, listener, options) => {
el.addEventListener(event, listener, options);
return () => el.removeEventListener(event, listener, options);
};
const firstParamTargets = computed(() => {
const test = toArray$8(toValue(args[0])).filter((e) => e != null);
return test.every((e) => typeof e !== "string") ? test : void 0;
});
const stopWatch = watchImmediate(
() => {
var _a, _b;
return [
(_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement$1(e))) != null ? _b : [defaultWindow$1].filter((e) => e != null),
toArray$8(toValue(firstParamTargets.value ? args[1] : args[0])),
toArray$8(unref(firstParamTargets.value ? args[2] : args[1])),
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
toValue(firstParamTargets.value ? args[3] : args[2])
];
},
([raw_targets, raw_events, raw_listeners, raw_options]) => {
cleanup2();
if (!(raw_targets == null ? void 0 : raw_targets.length) || !(raw_events == null ? void 0 : raw_events.length) || !(raw_listeners == null ? void 0 : raw_listeners.length))
return;
const optionsClone = isObject$3(raw_options) ? { ...raw_options } : raw_options;
cleanups.push(
...raw_targets.flatMap(
(el) => raw_events.flatMap(
(event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))
)
)
);
},
{ flush: "post" }
);
const stop = () => {
stopWatch();
cleanup2();
};
tryOnScopeDispose$1(cleanup2);
return stop;
}
// @__NO_SIDE_EFFECTS__
function useMounted() {
const isMounted = shallowRef(false);
getCurrentInstance();
return isMounted;
}
// @__NO_SIDE_EFFECTS__
function useSupported$1(callback) {
const isMounted = /* @__PURE__ */ useMounted();
return computed(() => {
isMounted.value;
return Boolean(callback());
});
}
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
// @__NO_SIDE_EFFECTS__
function useSSRWidth() {
const ssrWidth = hasInjectionContext() ? /* @__PURE__ */ injectLocal(ssrWidthSymbol, null) : null;
return typeof ssrWidth === "number" ? ssrWidth : void 0;
}
function useMediaQuery(query, options = {}) {
const { window: window2 = defaultWindow$1, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
const isSupported = /* @__PURE__ */ useSupported$1(() => window2 && "matchMedia" in window2 && typeof window2.matchMedia === "function");
const ssrSupport = shallowRef(typeof ssrWidth === "number");
const mediaQuery = shallowRef();
const matches = shallowRef(false);
const handler2 = (event) => {
matches.value = event.matches;
};
watchEffect(() => {
if (ssrSupport.value) {
ssrSupport.value = !isSupported.value;
const queryStrings = toValue(query).split(",");
matches.value = queryStrings.some((queryString) => {
const not = queryString.includes("not all");
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
let res = Boolean(minWidth || maxWidth);
if (minWidth && res) {
res = ssrWidth >= pxValue(minWidth[1]);
}
if (maxWidth && res) {
res = ssrWidth <= pxValue(maxWidth[1]);
}
return not ? !res : res;
});
return;
}
if (!isSupported.value)
return;
mediaQuery.value = window2.matchMedia(toValue(query));
matches.value = mediaQuery.value.matches;
});
useEventListener(mediaQuery, "change", handler2, { passive: true });
return computed(() => matches.value);
}
const breakpointsTailwind = {
"sm": 640,
"md": 768,
"lg": 1024,
"xl": 1280,
"2xl": 1536
};
// @__NO_SIDE_EFFECTS__
function useBreakpoints(breakpoints, options = {}) {
function getValue2(k, delta) {
let v = toValue(breakpoints[toValue(k)]);
if (delta != null)
v = increaseWithUnit(v, delta);
if (typeof v === "number")
v = `${v}px`;
return v;
}
const { window: window2 = defaultWindow$1, strategy = "min-width", ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
const ssrSupport = typeof ssrWidth === "number";
const mounted = ssrSupport ? shallowRef(false) : { value: true };
if (ssrSupport) {
tryOnMounted$1(() => mounted.value = !!window2);
}
function match2(query, size) {
if (!mounted.value && ssrSupport) {
return query === "min" ? ssrWidth >= pxValue(size) : ssrWidth <= pxValue(size);
}
if (!window2)
return false;
return window2.matchMedia(`(${query}-width: ${size})`).matches;
}
const greaterOrEqual = (k) => {
return useMediaQuery(() => `(min-width: ${getValue2(k)})`, options);
};
const smallerOrEqual = (k) => {
return useMediaQuery(() => `(max-width: ${getValue2(k)})`, options);
};
const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k) => {
Object.defineProperty(shortcuts, k, {
get: () => strategy === "min-width" ? greaterOrEqual(k) : smallerOrEqual(k),
enumerable: true,
configurable: true
});
return shortcuts;
}, {});
function current() {
const points = Object.keys(breakpoints).map((k) => [k, shortcutMethods[k], pxValue(getValue2(k))]).sort((a, b) => a[2] - b[2]);
return computed(() => points.filter(([, v]) => v.value).map(([k]) => k));
}
return Object.assign(shortcutMethods, {
greaterOrEqual,
smallerOrEqual,
greater(k) {
return useMediaQuery(() => `(min-width: ${getValue2(k, 0.1)})`, options);
},
smaller(k) {
return useMediaQuery(() => `(max-width: ${getValue2(k, -0.1)})`, options);
},
between(a, b) {
return useMediaQuery(() => `(min-width: ${getValue2(a)}) and (max-width: ${getValue2(b, -0.1)})`, options);
},
isGreater(k) {
return match2("min", getValue2(k, 0.1));
},
isGreaterOrEqual(k) {
return match2("min", getValue2(k));
},
isSmaller(k) {
return match2("max", getValue2(k, -0.1));
},
isSmallerOrEqual(k) {
return match2("max", getValue2(k));
},
isInBetween(a, b) {
return match2("min", getValue2(a)) && match2("max", getValue2(b, -0.1));
},
current,
active() {
const bps = current();
return computed(() => bps.value.length === 0 ? "" : bps.value.at(strategy === "min-width" ? -1 : 0));
}
});
}
// @__NO_SIDE_EFFECTS__
function usePreferredDark(options) {
return useMediaQuery("(prefers-color-scheme: dark)", options);
}
function useResizeObserver$1(target, callback, options = {}) {
const { window: window2 = defaultWindow$1, ...observerOptions } = options;
let observer;
const isSupported = /* @__PURE__ */ useSupported$1(() => window2 && "ResizeObserver" in window2);
const cleanup2 = () => {
if (observer) {
observer.disconnect();
observer = void 0;
}
};
const targets = computed(() => {
const _targets = toValue(target);
return Array.isArray(_targets) ? _targets.map((el) => unrefElement$1(el)) : [unrefElement$1(_targets)];
});
const stopWatch = watch(
targets,
(els) => {
cleanup2();
if (isSupported.value && window2) {
observer = new ResizeObserver(callback);
for (const _el of els) {
if (_el)
observer.observe(_el, observerOptions);
}
}
},
{ immediate: true, flush: "post" }
);
const stop = () => {
cleanup2();
stopWatch();
};
tryOnScopeDispose$1(stop);
return {
isSupported,
stop
};
}
function useElementSize$1(target, initialSize = { width: 0, height: 0 }, options = {}) {
const { window: window2 = defaultWindow$1, box: box2 = "content-box" } = options;
const isSVG = computed(() => {
var _a, _b;
return (_b = (_a = unrefElement$1(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
});
const width = shallowRef(initialSize.width);
const height = shallowRef(initialSize.height);
const { stop: stop1 } = useResizeObserver$1(
target,
([entry2]) => {
const boxSize = box2 === "border-box" ? entry2.borderBoxSize : box2 === "content-box" ? entry2.contentBoxSize : entry2.devicePixelContentBoxSize;
if (window2 && isSVG.value) {
const $elem = unrefElement$1(target);
if ($elem) {
const rect = $elem.getBoundingClientRect();
width.value = rect.width;
height.value = rect.height;
}
} else {
if (boxSize) {
const formatBoxSize = toArray$8(boxSize);
width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
} else {
width.value = entry2.contentRect.width;
height.value = entry2.contentRect.height;
}
}
},
options
);
tryOnMounted$1(() => {
const ele = unrefElement$1(target);
if (ele) {
width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
}
});
const stop2 = watch(
() => unrefElement$1(target),
(ele) => {
width.value = ele ? initialSize.width : 0;
height.value = ele ? initialSize.height : 0;
}
);
function stop() {
stop1();
stop2();
}
return {
width,
height,
stop
};
}
function useIntersectionObserver(target, callback, options = {}) {
const {
root,
rootMargin = "0px",
threshold = 0,
window: window2 = defaultWindow$1,
immediate = true
} = options;
const isSupported = /* @__PURE__ */ useSupported$1(() => window2 && "IntersectionObserver" in window2);
const targets = computed(() => {
const _target = toValue(target);
return toArray$8(_target).map(unrefElement$1).filter(notNullish);
});
let cleanup2 = noop$e;
const isActive = shallowRef(immediate);
const stopWatch = isSupported.value ? watch(
() => [targets.value, unrefElement$1(root), isActive.value],
([targets2, root2]) => {
cleanup2();
if (!isActive.value)
return;
if (!targets2.length)
return;
const observer = new IntersectionObserver(
callback,
{
root: unrefElement$1(root2),
rootMargin,
threshold
}
);
targets2.forEach((el) => el && observer.observe(el));
cleanup2 = () => {
observer.disconnect();
cleanup2 = noop$e;
};
},
{ immediate, flush: "post" }
) : noop$e;
const stop = () => {
cleanup2();
stopWatch();
isActive.value = false;
};
tryOnScopeDispose$1(stop);
return {
isSupported,
isActive,
pause() {
cleanup2();
isActive.value = false;
},
resume() {
isActive.value = true;
},
stop
};
}
function useSwipe(target, options = {}) {
const {
threshold = 50,
onSwipe,
onSwipeEnd,
onSwipeStart,
passive = true
} = options;
const coordsStart = reactive({ x: 0, y: 0 });
const coordsEnd = reactive({ x: 0, y: 0 });
const diffX = computed(() => coordsStart.x - coordsEnd.x);
const diffY = computed(() => coordsStart.y - coordsEnd.y);
const { max, abs } = Math;
const isThresholdExceeded = computed(() => max(abs(diffX.value), abs(diffY.value)) >= threshold);
const isSwiping = shallowRef(false);
const direction = computed(() => {
if (!isThresholdExceeded.value)
return "none";
if (abs(diffX.value) > abs(diffY.value)) {
return diffX.value > 0 ? "left" : "right";
} else {
return diffY.value > 0 ? "up" : "down";
}
});
const getTouchEventCoords = (e) => [e.touches[0].clientX, e.touches[0].clientY];
const updateCoordsStart = (x, y) => {
coordsStart.x = x;
coordsStart.y = y;
};
const updateCoordsEnd = (x, y) => {
coordsEnd.x = x;
coordsEnd.y = y;
};
const listenerOptions = { passive, capture: !passive };
const onTouchEnd = (e) => {
if (isSwiping.value)
onSwipeEnd == null ? void 0 : onSwipeEnd(e, direction.value);
isSwiping.value = false;
};
const stops = [
useEventListener(target, "touchstart", (e) => {
if (e.touches.length !== 1)
return;
const [x, y] = getTouchEventCoords(e);
updateCoordsStart(x, y);
updateCoordsEnd(x, y);
onSwipeStart == null ? void 0 : onSwipeStart(e);
}, listenerOptions),
useEventListener(target, "touchmove", (e) => {
if (e.touches.length !== 1)
return;
const [x, y] = getTouchEventCoords(e);
updateCoordsEnd(x, y);
if (listenerOptions.capture && !listenerOptions.passive && Math.abs(diffX.value) > Math.abs(diffY.value))
e.preventDefault();
if (!isSwiping.value && isThresholdExceeded.value)
isSwiping.value = true;
if (isSwiping.value)
onSwipe == null ? void 0 : onSwipe(e);
}, listenerOptions),
useEventListener(target, ["touchend", "touchcancel"], onTouchEnd, listenerOptions)
];
const stop = () => stops.forEach((s) => s());
return {
isSwiping,
direction,
coordsStart,
coordsEnd,
lengthX: diffX,
lengthY: diffY,
stop,
// TODO: Remove in the next major version
isPassiveEventSupported: true
};
}
// @__NO_SIDE_EFFECTS__
function useWindowSize(options = {}) {
const {
window: window2 = defaultWindow$1,
initialWidth = Number.POSITIVE_INFINITY,
initialHeight = Number.POSITIVE_INFINITY,
listenOrientation = true,
includeScrollbar = true,
type = "inner"
} = options;
const width = shallowRef(initialWidth);
const height = shallowRef(initialHeight);
const update = () => {
if (window2) {
if (type === "outer") {
width.value = window2.outerWidth;
height.value = window2.outerHeight;
} else if (type === "visual" && window2.visualViewport) {
const { width: visualViewportWidth, height: visualViewportHeight, scale } = window2.visualViewport;
width.value = Math.round(visualViewportWidth * scale);
height.value = Math.round(visualViewportHeight * scale);
} else if (includeScrollbar) {
width.value = window2.innerWidth;
height.value = window2.innerHeight;
} else {
width.value = window2.document.documentElement.clientWidth;
height.value = window2.document.documentElement.clientHeight;
}
}
};
update();
tryOnMounted$1(update);
const listenerOptions = { passive: true };
useEventListener("resize", update, listenerOptions);
if (window2 && type === "visual" && window2.visualViewport) {
useEventListener(window2.visualViewport, "resize", update, listenerOptions);
}
if (listenOrientation) {
const matches = useMediaQuery("(orientation: portrait)");
watch(matches, () => update());
}
return { width, height };
}
const appName = ref({
fa: "منتیفای",
en: "Montify"
});
const moduleProject = () => {
const domain = (void 0).location.origin;
switch (domain) {
case "https://app.newinsta.ir/":
return "test";
case "https://app.limansilver.ir/":
return "liman";
default:
return "montify";
}
};
const projectName = () => {
const domain = () => {
if (process) return process.env.VITE_DOMAIN;
else return "notLoad";
};
switch (domain) {
case "https://app.newinsta.ir/":
appName.value.en = "Montify";
appName.value.fa = "منتیفای";
return "Montify";
case "https://app.limansilver.ir/":
appName.value.en = "Liman";
appName.value.fa = "لیمان";
return "Liman";
default:
appName.value.en = "Montify";
appName.value.fa = "منتیفای";
return "Montify";
}
};
const reactiveProjectName = computed(() => projectName());
const baseURL = "https://node.newinsta.ir";
const tokenName = "auth-token";
const isFunction = (val) => typeof val === "function";
const isArray = Array.isArray;
const isString$1 = (val) => typeof val === "string";
const isObject$2 = (val) => val !== null && typeof val === "object";
const onRE = /^on[^a-z]/;
const isOn = (key2) => onRE.test(key2);
const cacheStringFunction = (fn) => {
const cache = /* @__PURE__ */ Object.create(null);
return (str) => {
const hit = cache[str];
return hit || (cache[str] = fn(str));
};
};
const camelizeRE = /-(\w)/g;
const camelize = cacheStringFunction((str) => {
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
});
const hyphenateRE = /\B([A-Z])/g;
const hyphenate = cacheStringFunction((str) => {
return str.replace(hyphenateRE, "-$1").toLowerCase();
});
const capitalize = cacheStringFunction((str) => {
return str.charAt(0).toUpperCase() + str.slice(1);
});
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwn = (val, key2) => hasOwnProperty.call(val, key2);
function resolvePropValue(options, props2, key2, value) {
const opt = options[key2];
if (opt != null) {
const hasDefault = hasOwn(opt, "default");
if (hasDefault && value === void 0) {
const defaultValue = opt.default;
value = opt.type !== Function && isFunction(defaultValue) ? defaultValue() : defaultValue;
}
if (opt.type === Boolean) {
if (!hasOwn(props2, key2) && !hasDefault) {
value = false;
} else if (value === "") {
value = true;
}
}
}
return value;
}
function getDataAndAriaProps(props2) {
return Object.keys(props2).reduce((memo, key2) => {
if (key2.startsWith("data-") || key2.startsWith("aria-")) {
memo[key2] = props2[key2];
}
return memo;
}, {});
}
function toPx(val) {
if (typeof val === "number") return `${val}px`;
return val;
}
function renderHelper(v) {
let props2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let defaultV = arguments.length > 2 ? arguments[2] : void 0;
if (typeof v === "function") {
return v(props2);
}
return v !== null && v !== void 0 ? v : defaultV;
}
function wrapPromiseFn(openFn) {
let closeFn;
const closePromise = new Promise((resolve) => {
closeFn = openFn(() => {
resolve(true);
});
});
const result = () => {
closeFn === null || closeFn === void 0 ? void 0 : closeFn();
};
result.then = (filled, rejected) => closePromise.then(filled, rejected);
result.promise = closePromise;
return result;
}
function classNames() {
const classes = [];
for (let i = 0; i < arguments.length; i++) {
const value = i < 0 || arguments.length <= i ? void 0 : arguments[i];
if (!value) continue;
if (isString$1(value)) {
classes.push(value);
} else if (isArray(value)) {
for (let i2 = 0; i2 < value.length; i2++) {
const inner = classNames(value[i2]);
if (inner) {
classes.push(inner);
}
}
} else if (isObject$2(value)) {
for (const name in value) {
if (value[name]) {
classes.push(name);
}
}
}
}
return classes.join(" ");
}
const isValid$2 = (value) => {
return value !== void 0 && value !== null && value !== "";
};
const initDefaultProps = (types, defaultProps2) => {
const propTypes2 = _extends({}, types);
Object.keys(defaultProps2).forEach((k) => {
const prop = propTypes2[k];
if (prop) {
if (prop.type || prop.default) {
prop.default = defaultProps2[k];
} else if (prop.def) {
prop.def(defaultProps2[k]);
} else {
propTypes2[k] = {
type: prop,
default: defaultProps2[k]
};
}
} else {
throw new Error(`not have ${k} prop`);
}
});
return propTypes2;
};
const splitAttrs = (attrs) => {
const allAttrs = Object.keys(attrs);
const eventAttrs = {};
const onEvents = {};
const extraAttrs = {};
for (let i = 0, l = allAttrs.length; i < l; i++) {
const key2 = allAttrs[i];
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
};
};
const parseStyleText = function() {
let cssText = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
let camel = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const res = {};
const listDelimiter = /;(?![^(]*\))/g;
const propertyDelimiter = /:(.+)/;
if (typeof cssText === "object") return cssText;
cssText.split(listDelimiter).forEach(function(item) {
if (item) {
const tmp = item.split(propertyDelimiter);
if (tmp.length > 1) {
const k = camel ? camelize(tmp[0].trim()) : tmp[0].trim();
res[k] = tmp[1].trim();
}
}
});
return res;
};
const hasProp = (instance, prop) => {
return instance[prop] !== void 0;
};
const skipFlattenKey = Symbol("skipFlatten");
const flattenChildren = function() {
let children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
let filterEmpty2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
const temp = Array.isArray(children) ? children : [children];
const res = [];
temp.forEach((child) => {
if (Array.isArray(child)) {
res.push(...flattenChildren(child, filterEmpty2));
} else if (child && child.type === Fragment) {
if (child.key === skipFlattenKey) {
res.push(child);
} else {
res.push(...flattenChildren(child.children, filterEmpty2));
}
} else if (child && isVNode(child)) {
if (filterEmpty2 && !isEmptyElement(child)) {
res.push(child);
} else if (!filterEmpty2) {
res.push(child);
}
} else if (isValid$2(child)) {
res.push(child);
}
});
return res;
};
const getSlot = function(self) {
let name = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
if (isVNode(self)) {
if (self.type === Fragment) {
return name === "default" ? flattenChildren(self.children) : [];
} else if (self.children && self.children[name]) {
return flattenChildren(self.children[name](options));
} else {
return [];
}
} else {
const res = self.$slots[name] && self.$slots[name](options);
return flattenChildren(res);
}
};
const findDOMNode = (instance) => {
var _a;
let node = ((_a = instance === null || instance === void 0 ? void 0 : instance.vnode) === null || _a === void 0 ? void 0 : _a.el) || instance && (instance.$el || instance);
while (node && !node.tagName) {
node = node.nextSibling;
}
return node;
};
const getOptionProps = (instance) => {
const res = {};
if (instance.$ && instance.$.vnode) {
const props2 = instance.$.vnode.props || {};
Object.keys(instance.$props).forEach((k) => {
const v = instance.$props[k];
const hyphenateKey = hyphenate(k);
if (v !== void 0 || hyphenateKey in props2) {
res[k] = v;
}
});
} else if (isVNode(instance) && typeof instance.type === "object") {
const originProps = instance.props || {};
const props2 = {};
Object.keys(originProps).forEach((key2) => {
props2[camelize(key2)] = originProps[key2];
});
const options = instance.type.props || {};
Object.keys(options).forEach((k) => {
const v = resolvePropValue(options, props2, k, props2[k]);
if (v !== void 0 || k in props2) {
res[k] = v;
}
});
}
return res;
};
const getComponent = function(instance) {
let prop = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "default";
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : instance;
let execute = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
let com = void 0;
if (instance.$) {
const temp = instance[prop];
if (temp !== void 0) {
return typeof temp === "function" && execute ? temp(options) : temp;
} else {
com = instance.$slots[prop];
com = execute && com ? com(options) : com;
}
} else if (isVNode(instance)) {
const temp = instance.props && instance.props[prop];
if (temp !== void 0 && instance.props !== null) {
return typeof temp === "function" && execute ? temp(options) : temp;
} else if (instance.type === Fragment) {
com = instance.children;
} else if (instance.children && instance.children[prop]) {
com = instance.children[prop];
com = execute && com ? com(options) : com;
}
}
if (Array.isArray(com)) {
com = flattenChildren(com);
com = com.length === 1 ? com[0] : com;
com = com.length === 0 ? void 0 : com;
}
return com;
};
function getEvents() {
let ele = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
let on = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
let props2 = {};
if (ele.$) {
props2 = _extends(_extends({}, props2), ele.$attrs);
} else {
props2 = _extends(_extends({}, props2), ele.props);
}
return splitAttrs(props2)[on ? "onEvents" : "events"];
}
function getClass(ele) {
const props2 = (isVNode(ele) ? ele.props : ele.$attrs) || {};
const tempCls = props2.class || {};
let cls = {};
if (typeof tempCls === "string") {
tempCls.split(" ").forEach((c) => {
cls[c.trim()] = true;
});
} else if (Array.isArray(tempCls)) {
classNames(tempCls).split(" ").forEach((c) => {
cls[c.trim()] = true;
});
} else {
cls = _extends(_extends({}, cls), tempCls);
}
return cls;
}
function getStyle$3(ele, camel) {
const props2 = (isVNode(ele) ? ele.props : ele.$attrs) || {};
let style = props2.style || {};
if (typeof style === "string") {
style = parseStyleText(style, camel);
}
return style;
}
function isFragment(c) {
return c.length === 1 && c[0].type === Fragment;
}
function isEmptyContent(c) {
return c === void 0 || c === null || c === "" || Array.isArray(c) && c.length === 0;
}
function isEmptyElement(c) {
return c && (c.type === Comment$1 || c.type === Fragment && c.children.length === 0 || c.type === Text$1 && c.children.trim() === "");
}
function isStringElement(c) {
return c && c.type === Text$1;
}
function filterEmpty() {
let children = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
const res = [];
children.forEach((child) => {
if (Array.isArray(child)) {
res.push(...child);
} else if ((child === null || child === void 0 ? void 0 : child.type) === Fragment) {
res.push(...filterEmpty(child.children));
} else {
res.push(child);
}
});
return res.filter((c) => !isEmptyElement(c));
}
function filterEmptyWithUndefined(children) {
if (children) {
const coms = filterEmpty(children);
return coms.length ? coms : void 0;
} else {
return children;
}
}
function isValidElement(element) {
if (Array.isArray(element) && element.length === 1) {
element = element[0];
}
return element && element.__v_isVNode && typeof element.type !== "symbol";
}
function getPropsSlot(slots, props2) {
let prop = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "default";
var _a, _b;
return (_a = props2[prop]) !== null && _a !== void 0 ? _a : (_b = slots[prop]) === null || _b === void 0 ? void 0 : _b.call(slots);
}
const ResizeObserver$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ResizeObserver",
props: {
disabled: Boolean,
onResize: Function
},
emits: ["resize"],
setup(props2, _ref) {
let {
slots
} = _ref;
const state = reactive({
width: 0,
height: 0,
offsetHeight: 0,
offsetWidth: 0
});
let currentElement = null;
let resizeObserver = null;
const destroyObserver = () => {
if (resizeObserver) {
resizeObserver.disconnect();
resizeObserver = null;
}
};
const onResize = (entries) => {
const {
onResize: onResize2
} = props2;
const target = entries[0].target;
const {
width,
height
} = target.getBoundingClientRect();
const {
offsetWidth,
offsetHeight
} = target;
const fixedWidth = Math.floor(width);
const fixedHeight = Math.floor(height);
if (state.width !== fixedWidth || state.height !== fixedHeight || state.offsetWidth !== offsetWidth || state.offsetHeight !== offsetHeight) {
const size = {
width: fixedWidth,
height: fixedHeight,
offsetWidth,
offsetHeight
};
_extends(state, size);
if (onResize2) {
Promise.resolve().then(() => {
onResize2(_extends(_extends({}, size), {
offsetWidth,
offsetHeight
}), target);
});
}
}
};
const instance = getCurrentInstance();
const registerObserver = () => {
const {
disabled
} = props2;
if (disabled) {
destroyObserver();
return;
}
const element = findDOMNode(instance);
const elementChanged = element !== currentElement;
if (elementChanged) {
destroyObserver();
currentElement = element;
}
if (!resizeObserver && element) {
resizeObserver = new ResizeObserver$2(onResize);
resizeObserver.observe(element);
}
};
watch(() => props2.disabled, () => {
registerObserver();
}, {
flush: "post"
});
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)[0];
};
}
});
let raf = (callback) => setTimeout(callback, 16);
let caf = (num) => clearTimeout(num);
let rafUUID = 0;
const rafIds = /* @__PURE__ */ new Map();
function cleanup(id) {
rafIds.delete(id);
}
function wrapperRaf(callback) {
let times = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
rafUUID += 1;
const id = rafUUID;
function callRef(leftTimes) {
if (leftTimes === 0) {
cleanup(id);
callback();
} else {
const realId = raf(() => {
callRef(leftTimes - 1);
});
rafIds.set(id, realId);
}
}
callRef(times);
return id;
}
wrapperRaf.cancel = (id) => {
const realId = rafIds.get(id);
cleanup(realId);
return caf(realId);
};
function throttleByAnimationFrame(fn) {
let requestId;
const later = (args) => () => {
requestId = null;
fn(...args);
};
const throttled = function() {
if (requestId == null) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
requestId = wrapperRaf(later(args));
}
};
throttled.cancel = () => {
wrapperRaf.cancel(requestId);
requestId = null;
};
return throttled;
}
const tuple$1 = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args;
};
const tupleNum = function() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return args;
};
const withInstall = (comp) => {
const c = comp;
c.install = function(app) {
app.component(c.displayName || c.name, comp);
};
return comp;
};
function eventType() {
return {
type: [Function, Array]
};
}
function objectType(defaultVal) {
return {
type: Object,
default: defaultVal
};
}
function booleanType(defaultVal) {
return {
type: Boolean,
default: defaultVal
};
}
function functionType(defaultVal) {
return {
type: Function,
default: defaultVal
};
}
function anyType(defaultVal, required) {
const type = {
validator: () => true,
default: defaultVal
};
return type;
}
function vNodeType() {
return {
validator: () => true
};
}
function arrayType(defaultVal) {
return {
type: Array,
default: defaultVal
};
}
function stringType(defaultVal) {
return {
type: String,
default: defaultVal
};
}
function someType(types, defaultVal) {
return types ? {
type: types,
default: defaultVal
} : anyType(defaultVal);
}
let supportsPassive = false;
try {
const opts = Object.defineProperty({}, "passive", {
get() {
supportsPassive = true;
}
});
(void 0).addEventListener("testPassive", null, opts);
(void 0).removeEventListener("testPassive", null, opts);
} catch (e) {
}
function addEventListenerWrap(target, eventType2, cb, option) {
if (target && target.addEventListener) {
let opt = option;
if (opt === void 0 && supportsPassive && (eventType2 === "touchstart" || eventType2 === "touchmove" || eventType2 === "wheel")) {
opt = {
passive: false
};
}
target.addEventListener(eventType2, cb, opt);
}
return {
remove: () => {
if (target && target.removeEventListener) {
target.removeEventListener(eventType2, cb);
}
}
};
}
function getTargetRect(target) {
return target !== void 0 ? target.getBoundingClientRect() : {
top: 0,
bottom: (void 0).innerHeight
};
}
function getFixedTop(placeholderRect, targetRect, offsetTop) {
if (offsetTop !== void 0 && targetRect.top > placeholderRect.top - offsetTop) {
return `${offsetTop + targetRect.top}px`;
}
return void 0;
}
function getFixedBottom(placeholderRect, targetRect, offsetBottom) {
if (offsetBottom !== void 0 && targetRect.bottom < placeholderRect.bottom + offsetBottom) {
const targetBottomOffset = (void 0).innerHeight - targetRect.bottom;
return `${offsetBottom + targetBottomOffset}px`;
}
return void 0;
}
const TRIGGER_EVENTS = ["resize", "scroll", "touchstart", "touchmove", "touchend", "pageshow", "load"];
let observerEntities = [];
function addObserveTarget(target, affix) {
if (!target) return;
let entity = observerEntities.find((item) => item.target === target);
if (entity) {
entity.affixList.push(affix);
} else {
entity = {
target,
affixList: [affix],
eventHandlers: {}
};
observerEntities.push(entity);
TRIGGER_EVENTS.forEach((eventName) => {
entity.eventHandlers[eventName] = addEventListenerWrap(target, eventName, () => {
entity.affixList.forEach((targetAffix) => {
const {
lazyUpdatePosition
} = targetAffix.exposed;
lazyUpdatePosition();
}, (eventName === "touchstart" || eventName === "touchmove") && supportsPassive ? {
passive: true
} : false);
});
});
}
}
function removeObserveTarget(affix) {
const observerEntity = observerEntities.find((oriObserverEntity) => {
const hasAffix = oriObserverEntity.affixList.some((item) => item === affix);
if (hasAffix) {
oriObserverEntity.affixList = oriObserverEntity.affixList.filter((item) => item !== affix);
}
return hasAffix;
});
if (observerEntity && observerEntity.affixList.length === 0) {
observerEntities = observerEntities.filter((item) => item !== observerEntity);
TRIGGER_EVENTS.forEach((eventName) => {
const handler2 = observerEntity.eventHandlers[eventName];
if (handler2 && handler2.remove) {
handler2.remove();
}
});
}
}
const defaultIconPrefixCls = "anticon";
const GlobalFormContextKey = Symbol("GlobalFormContextKey");
const useProvideGlobalForm = (state) => {
provide(GlobalFormContextKey, state);
};
const useInjectGlobalForm = () => {
return inject(GlobalFormContextKey, {
validateMessages: computed(() => void 0)
});
};
const configProviderProps = () => ({
iconPrefixCls: String,
getTargetContainer: {
type: Function
},
getPopupContainer: {
type: Function
},
prefixCls: String,
getPrefixCls: {
type: Function
},
renderEmpty: {
type: Function
},
transformCellText: {
type: Function
},
csp: objectType(),
input: objectType(),
autoInsertSpaceInButton: {
type: Boolean,
default: void 0
},
locale: objectType(),
pageHeader: objectType(),
componentSize: {
type: String
},
componentDisabled: {
type: Boolean,
default: void 0
},
direction: {
type: String,
default: "ltr"
},
space: objectType(),
virtual: {
type: Boolean,
default: void 0
},
dropdownMatchSelectWidth: {
type: [Number, Boolean],
default: true
},
form: objectType(),
pagination: objectType(),
theme: objectType(),
select: objectType(),
wave: objectType()
});
const configProviderKey = Symbol("configProvider");
const defaultConfigProvider = {
getPrefixCls: (suffixCls, customizePrefixCls) => {
if (customizePrefixCls) return customizePrefixCls;
return suffixCls ? `ant-${suffixCls}` : "ant";
},
iconPrefixCls: computed(() => defaultIconPrefixCls),
getPopupContainer: computed(() => () => (void 0).body),
direction: computed(() => "ltr")
};
const useConfigContextInject = () => {
return inject(configProviderKey, defaultConfigProvider);
};
const useConfigContextProvider = (props2) => {
return provide(configProviderKey, props2);
};
const DisabledContextKey = Symbol("DisabledContextKey");
const useInjectDisabled = () => {
return inject(DisabledContextKey, ref(void 0));
};
const useProviderDisabled = (disabled) => {
const parentDisabled = useInjectDisabled();
provide(DisabledContextKey, computed(() => {
var _a;
return (_a = disabled.value) !== null && _a !== void 0 ? _a : parentDisabled.value;
}));
return disabled;
};
const enUS = {
// Options.jsx
items_per_page: "/ page",
jump_to: "Go to",
jump_to_confirm: "confirm",
page: "",
// Pagination.jsx
prev_page: "Previous Page",
next_page: "Next Page",
prev_5: "Previous 5 Pages",
next_5: "Next 5 Pages",
prev_3: "Previous 3 Pages",
next_3: "Next 3 Pages"
};
const locale$3 = {
locale: "en_US",
today: "Today",
now: "Now",
backToToday: "Back to today",
ok: "Ok",
clear: "Clear",
month: "Month",
year: "Year",
timeSelect: "select time",
dateSelect: "select date",
weekSelect: "Choose a week",
monthSelect: "Choose a month",
yearSelect: "Choose a year",
decadeSelect: "Choose a decade",
yearFormat: "YYYY",
dateFormat: "M/D/YYYY",
dayFormat: "D",
dateTimeFormat: "M/D/YYYY HH:mm:ss",
monthBeforeYear: true,
previousMonth: "Previous month (PageUp)",
nextMonth: "Next month (PageDown)",
previousYear: "Last year (Control + left)",
nextYear: "Next year (Control + right)",
previousDecade: "Last decade",
nextDecade: "Next decade",
previousCentury: "Last century",
nextCentury: "Next century"
};
const locale$2 = {
placeholder: "Select time",
rangePlaceholder: ["Start time", "End time"]
};
const locale$1 = {
lang: _extends({
placeholder: "Select date",
yearPlaceholder: "Select year",
quarterPlaceholder: "Select quarter",
monthPlaceholder: "Select month",
weekPlaceholder: "Select week",
rangePlaceholder: ["Start date", "End date"],
rangeYearPlaceholder: ["Start year", "End year"],
rangeQuarterPlaceholder: ["Start quarter", "End quarter"],
rangeMonthPlaceholder: ["Start month", "End month"],
rangeWeekPlaceholder: ["Start week", "End week"]
}, locale$3),
timePickerLocale: _extends({}, locale$2)
};
const typeTemplate$1 = "${label} is not a valid ${type}";
const localeValues = {
locale: "en",
Pagination: enUS,
DatePicker: locale$1,
TimePicker: locale$2,
Calendar: locale$1,
global: {
placeholder: "Please select"
},
Table: {
filterTitle: "Filter menu",
filterConfirm: "OK",
filterReset: "Reset",
filterEmptyText: "No filters",
filterCheckall: "Select all items",
filterSearchPlaceholder: "Search in filters",
emptyText: "No data",
selectAll: "Select current page",
selectInvert: "Invert current page",
selectNone: "Clear all data",
selectionAll: "Select all data",
sortTitle: "Sort",
expand: "Expand row",
collapse: "Collapse row",
triggerDesc: "Click to sort descending",
triggerAsc: "Click to sort ascending",
cancelSort: "Click to cancel sorting"
},
Tour: {
Next: "Next",
Previous: "Previous",
Finish: "Finish"
},
Modal: {
okText: "OK",
cancelText: "Cancel",
justOkText: "OK"
},
Popconfirm: {
okText: "OK",
cancelText: "Cancel"
},
Transfer: {
titles: ["", ""],
searchPlaceholder: "Search here",
itemUnit: "item",
itemsUnit: "items",
remove: "Remove",
selectCurrent: "Select current page",
removeCurrent: "Remove current page",
selectAll: "Select all data",
removeAll: "Remove all data",
selectInvert: "Invert current page"
},
Upload: {
uploading: "Uploading...",
removeFile: "Remove file",
uploadError: "Upload error",
previewFile: "Preview file",
downloadFile: "Download file"
},
Empty: {
description: "No data"
},
Icon: {
icon: "icon"
},
Text: {
edit: "Edit",
copy: "Copy",
copied: "Copied",
expand: "Expand"
},
PageHeader: {
back: "Back"
},
Form: {
optional: "(optional)",
defaultValidateMessages: {
default: "Field validation error for ${label}",
required: "Please enter ${label}",
enum: "${label} must be one of [${enum}]",
whitespace: "${label} cannot be a blank character",
date: {
format: "${label} date format is invalid",
parse: "${label} cannot be converted to a date",
invalid: "${label} is an invalid date"
},
types: {
string: typeTemplate$1,
method: typeTemplate$1,
array: typeTemplate$1,
object: typeTemplate$1,
number: typeTemplate$1,
date: typeTemplate$1,
boolean: typeTemplate$1,
integer: typeTemplate$1,
float: typeTemplate$1,
regexp: typeTemplate$1,
email: typeTemplate$1,
url: typeTemplate$1,
hex: typeTemplate$1
},
string: {
len: "${label} must be ${len} characters",
min: "${label} must be at least ${min} characters",
max: "${label} must be up to ${max} characters",
range: "${label} must be between ${min}-${max} characters"
},
number: {
len: "${label} must be equal to ${len}",
min: "${label} must be minimum ${min}",
max: "${label} must be maximum ${max}",
range: "${label} must be between ${min}-${max}"
},
array: {
len: "Must be ${len} ${label}",
min: "At least ${min} ${label}",
max: "At most ${max} ${label}",
range: "The amount of ${label} must be between ${min}-${max}"
},
pattern: {
mismatch: "${label} does not match the pattern ${pattern}"
}
}
},
Image: {
preview: "Preview"
},
QRCode: {
expired: "QR code expired",
refresh: "Refresh",
scanned: "Scanned"
}
};
const LocaleReceiver = defineComponent({
compatConfig: {
MODE: 3
},
name: "LocaleReceiver",
props: {
componentName: String,
defaultLocale: {
type: [Object, Function]
},
children: {
type: Function
}
},
setup(props2, _ref) {
let {
slots
} = _ref;
const localeData2 = inject("localeData", {});
const locale2 = computed(() => {
const {
componentName = "global",
defaultLocale
} = props2;
const locale3 = defaultLocale || localeValues[componentName || "global"];
const {
antLocale
} = localeData2;
const localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
return _extends(_extends({}, typeof locale3 === "function" ? locale3() : locale3), localeFromContext || {});
});
const localeCode = computed(() => {
const {
antLocale
} = localeData2;
const localeCode2 = antLocale && antLocale.locale;
if (antLocale && antLocale.exist && !localeCode2) {
return localeValues.locale;
}
return localeCode2;
});
return () => {
const children = props2.children || slots.default;
const {
antLocale
} = localeData2;
return children === null || children === void 0 ? void 0 : children(locale2.value, localeCode.value, antLocale);
};
}
});
function useLocaleReceiver(componentName, defaultLocale, propsLocale) {
const localeData2 = inject("localeData", {});
const componentLocale = computed(() => {
const {
antLocale
} = localeData2;
const locale2 = unref(defaultLocale) || localeValues[componentName || "global"];
const localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
return _extends(_extends(_extends({}, typeof locale2 === "function" ? locale2() : locale2), localeFromContext || {}), unref(propsLocale) || {});
});
return [componentLocale];
}
const SPLIT = "%";
class Entity {
constructor(instanceId) {
this.cache = /* @__PURE__ */ new Map();
this.instanceId = instanceId;
}
get(keys) {
return this.cache.get(Array.isArray(keys) ? keys.join(SPLIT) : keys) || null;
}
update(keys, valueFn) {
const path2 = Array.isArray(keys) ? keys.join(SPLIT) : keys;
const prevValue = this.cache.get(path2);
const nextValue = valueFn(prevValue);
if (nextValue === null) {
this.cache.delete(path2);
} else {
this.cache.set(path2, nextValue);
}
}
}
function createCache() {
const cssinjsInstanceId = Math.random().toString(12).slice(2);
return new Entity(cssinjsInstanceId);
}
const StyleContextKey = Symbol("StyleContextKey");
const getCache = () => {
var _a, _b, _c;
const instance = getCurrentInstance();
let cache;
if (instance && instance.appContext) {
const globalCache = (_c = (_b = (_a = instance.appContext) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.globalProperties) === null || _c === void 0 ? void 0 : _c.__ANTDV_CSSINJS_CACHE__;
if (globalCache) {
cache = globalCache;
} else {
cache = createCache();
if (instance.appContext.config.globalProperties) {
instance.appContext.config.globalProperties.__ANTDV_CSSINJS_CACHE__ = cache;
}
}
} else {
cache = createCache();
}
return cache;
};
const defaultStyleContext = {
cache: createCache(),
defaultCache: true,
hashPriority: "low"
};
const useStyleInject = () => {
const cache = getCache();
return inject(StyleContextKey, shallowRef(_extends(_extends({}, defaultStyleContext), {
cache
})));
};
const useStyleProvider = (props2) => {
const parentContext = useStyleInject();
const context2 = shallowRef(_extends(_extends({}, defaultStyleContext), {
cache: createCache()
}));
watch([() => unref(props2), parentContext], () => {
const mergedContext = _extends({}, parentContext.value);
const propsValue = unref(props2);
Object.keys(propsValue).forEach((key2) => {
const value = propsValue[key2];
if (propsValue[key2] !== void 0) {
mergedContext[key2] = value;
}
});
const {
cache
} = propsValue;
mergedContext.cache = mergedContext.cache || createCache();
mergedContext.defaultCache = !cache && parentContext.value.defaultCache;
context2.value = mergedContext;
}, {
immediate: true
});
provide(StyleContextKey, context2);
return context2;
};
const styleProviderProps = () => ({
autoClear: booleanType(),
/** @private Test only. Not work in production. */
mock: stringType(),
/**
* Only set when you need ssr to extract style on you own.
* If not provided, it will auto create on the end of Provider in server side.
*/
cache: objectType(),
/** Tell children that this context is default generated context */
defaultCache: booleanType(),
/** Use `:where` selector to reduce hashId css selector priority */
hashPriority: stringType(),
/** Tell cssinjs where to inject style in */
container: someType(),
/** Component wil render inline `` for fallback in SSR. Not recommend. */
ssrInline: booleanType(),
/** Transform css before inject in document. Please note that `transformers` do not support dynamic update */
transformers: arrayType(),
/**
* Linters to lint css before inject in document.
* Styles will be linted after transforming.
* Please note that `linters` do not support dynamic update.
*/
linters: arrayType()
});
const StyleProvider = withInstall(defineComponent({
name: "AStyleProvider",
inheritAttrs: false,
props: styleProviderProps(),
setup(props2, _ref) {
let {
slots
} = _ref;
useStyleProvider(props2);
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
}));
function useClientCache(prefix, keyPath, cacheFn, onCacheRemove) {
const styleContext = useStyleInject();
const fullPathStr = shallowRef("");
const res = shallowRef();
watchEffect(() => {
fullPathStr.value = [prefix, ...keyPath.value].join("%");
});
const clearCache = (pathStr) => {
styleContext.value.cache.update(pathStr, (prevCache) => {
const [times = 0, cache] = prevCache || [];
const nextCount = times - 1;
if (nextCount === 0) {
onCacheRemove === null || onCacheRemove === void 0 ? void 0 : onCacheRemove(cache, false);
return null;
}
return [times - 1, cache];
});
};
watch(fullPathStr, (newStr, oldStr) => {
if (oldStr) clearCache(oldStr);
styleContext.value.cache.update(newStr, (prevCache) => {
const [times = 0, cache] = prevCache || [];
let tmpCache = cache;
const mergedCache = tmpCache || cacheFn();
return [times + 1, mergedCache];
});
res.value = styleContext.value.cache.get(fullPathStr.value)[1];
}, {
immediate: true
});
return res;
}
function canUseDom() {
return false;
}
function contains(root, n) {
if (!root) {
return false;
}
if (root.contains) {
return root.contains(n);
}
return false;
}
function sameDerivativeOption(left, right) {
if (left.length !== right.length) {
return false;
}
for (let i = 0; i < left.length; i++) {
if (left[i] !== right[i]) {
return false;
}
}
return true;
}
class ThemeCache {
constructor() {
this.cache = /* @__PURE__ */ new Map();
this.keys = [];
this.cacheCallTimes = 0;
}
size() {
return this.keys.length;
}
internalGet(derivativeOption) {
let updateCallTimes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
let cache = {
map: this.cache
};
derivativeOption.forEach((derivative2) => {
var _a;
if (!cache) {
cache = void 0;
} else {
cache = (_a = cache === null || cache === void 0 ? void 0 : cache.map) === null || _a === void 0 ? void 0 : _a.get(derivative2);
}
});
if ((cache === null || cache === void 0 ? void 0 : cache.value) && updateCallTimes) {
cache.value[1] = this.cacheCallTimes++;
}
return cache === null || cache === void 0 ? void 0 : cache.value;
}
get(derivativeOption) {
var _a;
return (_a = this.internalGet(derivativeOption, true)) === null || _a === void 0 ? void 0 : _a[0];
}
has(derivativeOption) {
return !!this.internalGet(derivativeOption);
}
set(derivativeOption, value) {
if (!this.has(derivativeOption)) {
if (this.size() + 1 > ThemeCache.MAX_CACHE_SIZE + ThemeCache.MAX_CACHE_OFFSET) {
const [targetKey] = this.keys.reduce((result, key2) => {
const [, callTimes] = result;
if (this.internalGet(key2)[1] < callTimes) {
return [key2, this.internalGet(key2)[1]];
}
return result;
}, [this.keys[0], this.cacheCallTimes]);
this.delete(targetKey);
}
this.keys.push(derivativeOption);
}
let cache = this.cache;
derivativeOption.forEach((derivative2, index2) => {
if (index2 === derivativeOption.length - 1) {
cache.set(derivative2, {
value: [value, this.cacheCallTimes++]
});
} else {
const cacheValue = cache.get(derivative2);
if (!cacheValue) {
cache.set(derivative2, {
map: /* @__PURE__ */ new Map()
});
} else if (!cacheValue.map) {
cacheValue.map = /* @__PURE__ */ new Map();
}
cache = cache.get(derivative2).map;
}
});
}
deleteByPath(currentCache, derivatives) {
var _a;
const cache = currentCache.get(derivatives[0]);
if (derivatives.length === 1) {
if (!cache.map) {
currentCache.delete(derivatives[0]);
} else {
currentCache.set(derivatives[0], {
map: cache.map
});
}
return (_a = cache.value) === null || _a === void 0 ? void 0 : _a[0];
}
const result = this.deleteByPath(cache.map, derivatives.slice(1));
if ((!cache.map || cache.map.size === 0) && !cache.value) {
currentCache.delete(derivatives[0]);
}
return result;
}
delete(derivativeOption) {
if (this.has(derivativeOption)) {
this.keys = this.keys.filter((item) => !sameDerivativeOption(item, derivativeOption));
return this.deleteByPath(this.cache, derivativeOption);
}
return void 0;
}
}
ThemeCache.MAX_CACHE_SIZE = 20;
ThemeCache.MAX_CACHE_OFFSET = 5;
let warned = {};
function warning$1(valid, message) {
}
function note(valid, message) {
}
function call(method, valid, message) {
if (!valid && !warned[message]) {
method(false, message);
warned[message] = true;
}
}
function warningOnce(valid, message) {
call(warning$1, valid, message);
}
function noteOnce(valid, message) {
call(note, valid, message);
}
function noop$d() {
}
let warning = noop$d;
let uuid$3 = 0;
class Theme {
constructor(derivatives) {
this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
this.id = uuid$3;
if (derivatives.length === 0) {
warning(derivatives.length > 0);
}
uuid$3 += 1;
}
getDerivativeToken(token) {
return this.derivatives.reduce((result, derivative2) => derivative2(token, result), void 0);
}
}
const cacheThemes = new ThemeCache();
function createTheme(derivatives) {
const derivativeArr = Array.isArray(derivatives) ? derivatives : [derivatives];
if (!cacheThemes.has(derivativeArr)) {
cacheThemes.set(derivativeArr, new Theme(derivativeArr));
}
return cacheThemes.get(derivativeArr);
}
const flattenTokenCache = /* @__PURE__ */ new WeakMap();
function flattenToken(token) {
let str = flattenTokenCache.get(token) || "";
if (!str) {
Object.keys(token).forEach((key2) => {
const value = token[key2];
str += key2;
if (value instanceof Theme) {
str += value.id;
} else if (value && typeof value === "object") {
str += flattenToken(value);
} else {
str += value;
}
});
flattenTokenCache.set(token, str);
}
return str;
}
function token2key(token, salt) {
return murmur2(`${salt}_${flattenToken(token)}`);
}
function supportSelector(styleStr, handleElement, supportCheck) {
return false;
}
let canLayer = void 0;
function supportLayer() {
if (canLayer === void 0) {
canLayer = supportSelector();
}
return canLayer;
}
const EMPTY_OVERRIDE = {};
const hashPrefix = "css";
const tokenKeys = /* @__PURE__ */ new Map();
function recordCleanToken(tokenKey) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) + 1);
}
const TOKEN_THRESHOLD = 0;
function cleanTokenStyle(tokenKey, instanceId) {
tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) - 1);
const tokenKeyList = Array.from(tokenKeys.keys());
const cleanableKeyList = tokenKeyList.filter((key2) => {
const count = tokenKeys.get(key2) || 0;
return count <= 0;
});
if (tokenKeyList.length - cleanableKeyList.length > TOKEN_THRESHOLD) {
cleanableKeyList.forEach((key2) => {
tokenKeys.delete(key2);
});
}
}
const getComputedToken = (originToken, overrideToken, theme, format2) => {
const derivativeToken = theme.getDerivativeToken(originToken);
let mergedDerivativeToken = _extends(_extends({}, derivativeToken), overrideToken);
if (format2) {
mergedDerivativeToken = format2(mergedDerivativeToken);
}
return mergedDerivativeToken;
};
function useCacheToken(theme, tokens) {
let option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ref({});
const style = useStyleInject();
const mergedToken = computed(() => _extends({}, ...tokens.value));
const tokenStr = computed(() => flattenToken(mergedToken.value));
const overrideTokenStr = computed(() => flattenToken(option.value.override || EMPTY_OVERRIDE));
const cachedToken = useClientCache("token", computed(() => [option.value.salt || "", theme.value.id, tokenStr.value, overrideTokenStr.value]), () => {
const {
salt = "",
override = EMPTY_OVERRIDE,
formatToken: formatToken2,
getComputedToken: compute
} = option.value;
const mergedDerivativeToken = compute ? compute(mergedToken.value, override, theme.value) : getComputedToken(mergedToken.value, override, theme.value, formatToken2);
const tokenKey = token2key(mergedDerivativeToken, salt);
mergedDerivativeToken._tokenKey = tokenKey;
recordCleanToken(tokenKey);
const hashId = `${hashPrefix}-${murmur2(tokenKey)}`;
mergedDerivativeToken._hashId = hashId;
return [mergedDerivativeToken, hashId];
}, (cache) => {
var _a;
cleanTokenStyle(cache[0]._tokenKey, (_a = style.value) === null || _a === void 0 ? void 0 : _a.cache.instanceId);
});
return cachedToken;
}
let cachePathMap;
function prepare() {
if (!cachePathMap) {
cachePathMap = {};
}
}
function existPath(path2) {
prepare();
return !!cachePathMap[path2];
}
function getStyleAndHash(path2) {
const hash2 = cachePathMap[path2];
let styleStr = null;
return [styleStr, hash2];
}
const isClientSide = canUseDom();
const SKIP_CHECK = "_skip_check_";
const MULTI_VALUE = "_multi_value_";
function normalizeStyle(styleStr) {
const serialized = serialize(compile(styleStr), stringify);
return serialized.replace(/\{%%%\:[^;];}/g, ";");
}
function isCompoundCSSProperty(value) {
return typeof value === "object" && value && (SKIP_CHECK in value || MULTI_VALUE in value);
}
function injectSelectorHash(key2, hashId, hashPriority) {
if (!hashId) {
return key2;
}
const hashClassName = `.${hashId}`;
const hashSelector = hashPriority === "low" ? `:where(${hashClassName})` : hashClassName;
const keys = key2.split(",").map((k) => {
var _a;
const fullPath = k.trim().split(/\s+/);
let firstPath = fullPath[0] || "";
const htmlElement = ((_a = firstPath.match(/^\w+/)) === null || _a === void 0 ? void 0 : _a[0]) || "";
firstPath = `${htmlElement}${hashSelector}${firstPath.slice(htmlElement.length)}`;
return [firstPath, ...fullPath.slice(1)].join(" ");
});
return keys.join(",");
}
const parseStyle = function(interpolation) {
let config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let {
root,
injectHash,
parentSelectors
} = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
root: true,
parentSelectors: []
};
const {
hashId,
layer,
path: path2,
hashPriority,
transformers = [],
linters = []
} = config;
let styleStr = "";
let effectStyle = {};
function parseKeyframes(keyframes) {
const animationName = keyframes.getName(hashId);
if (!effectStyle[animationName]) {
const [parsedStr] = parseStyle(keyframes.style, config, {
root: false,
parentSelectors
});
effectStyle[animationName] = `@keyframes ${keyframes.getName(hashId)}${parsedStr}`;
}
}
function flattenList(list) {
let fullList = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
list.forEach((item) => {
if (Array.isArray(item)) {
flattenList(item, fullList);
} else if (item) {
fullList.push(item);
}
});
return fullList;
}
const flattenStyleList = flattenList(Array.isArray(interpolation) ? interpolation : [interpolation]);
flattenStyleList.forEach((originStyle) => {
const style = typeof originStyle === "string" && !root ? {} : originStyle;
if (typeof style === "string") {
styleStr += `${style}
`;
} else if (style._keyframe) {
parseKeyframes(style);
} else {
const mergedStyle = transformers.reduce((prev, trans) => {
var _a;
return ((_a = trans === null || trans === void 0 ? void 0 : trans.visit) === null || _a === void 0 ? void 0 : _a.call(trans, prev)) || prev;
}, style);
Object.keys(mergedStyle).forEach((key2) => {
var _a;
const value = mergedStyle[key2];
if (typeof value === "object" && value && (key2 !== "animationName" || !value._keyframe) && !isCompoundCSSProperty(value)) {
let subInjectHash = false;
let mergedKey = key2.trim();
let nextRoot = false;
if ((root || injectHash) && hashId) {
if (mergedKey.startsWith("@")) {
subInjectHash = true;
} else {
mergedKey = injectSelectorHash(key2, hashId, hashPriority);
}
} else if (root && !hashId && (mergedKey === "&" || mergedKey === "")) {
mergedKey = "";
nextRoot = true;
}
const [parsedStr, childEffectStyle] = parseStyle(value, config, {
root: nextRoot,
injectHash: subInjectHash,
parentSelectors: [...parentSelectors, mergedKey]
});
effectStyle = _extends(_extends({}, effectStyle), childEffectStyle);
styleStr += `${mergedKey}${parsedStr}`;
} else {
let appendStyle = function(cssKey, cssValue) {
const styleName = cssKey.replace(/[A-Z]/g, (match2) => `-${match2.toLowerCase()}`);
let formatValue2 = cssValue;
if (!unitlessKeys[cssKey] && typeof formatValue2 === "number" && formatValue2 !== 0) {
formatValue2 = `${formatValue2}px`;
}
if (cssKey === "animationName" && (cssValue === null || cssValue === void 0 ? void 0 : cssValue._keyframe)) {
parseKeyframes(cssValue);
formatValue2 = cssValue.getName(hashId);
}
styleStr += `${styleName}:${formatValue2};`;
};
const actualValue = (_a = value === null || value === void 0 ? void 0 : value.value) !== null && _a !== void 0 ? _a : value;
if (typeof value === "object" && (value === null || value === void 0 ? void 0 : value[MULTI_VALUE]) && Array.isArray(actualValue)) {
actualValue.forEach((item) => {
appendStyle(key2, item);
});
} else {
appendStyle(key2, actualValue);
}
}
});
}
});
if (!root) {
styleStr = `{${styleStr}}`;
} else if (layer && supportLayer()) {
const layerCells = layer.split(",");
const layerName = layerCells[layerCells.length - 1].trim();
styleStr = `@layer ${layerName} {${styleStr}}`;
if (layerCells.length > 1) {
styleStr = `@layer ${layer}{%%%:%}${styleStr}`;
}
}
return [styleStr, effectStyle];
};
function uniqueHash(path2, styleStr) {
return murmur2(`${path2.join("%")}${styleStr}`);
}
function useStyleRegister(info, styleFn) {
const styleContext = useStyleInject();
const tokenKey = computed(() => info.value.token._tokenKey);
const fullPath = computed(() => [tokenKey.value, ...info.value.path]);
useClientCache(
"style",
fullPath,
// Create cache if needed
() => {
const {
path: path2,
hashId,
layer,
nonce,
clientOnly,
order = 0
} = info.value;
const cachePath = fullPath.value.join("|");
if (existPath(cachePath)) {
const [inlineCacheStyleStr, styleHash] = getStyleAndHash(cachePath);
if (inlineCacheStyleStr) {
return [inlineCacheStyleStr, tokenKey.value, styleHash, {}, clientOnly, order];
}
}
const styleObj = styleFn();
const {
hashPriority,
container,
transformers,
linters,
cache
} = styleContext.value;
const [parsedStyle, effectStyle] = parseStyle(styleObj, {
hashId,
hashPriority,
layer,
path: path2.join("-"),
transformers,
linters
});
const styleStr = normalizeStyle(parsedStyle);
const styleId = uniqueHash(fullPath.value, styleStr);
return [styleStr, tokenKey.value, styleId, effectStyle, clientOnly, order];
},
// Remove cache if no need
(_ref, fromHMR) => {
let [, , styleId] = _ref;
if ((fromHMR || styleContext.value.autoClear) && isClientSide) ;
}
);
return (node) => {
return node;
};
}
class Keyframe {
constructor(name, style) {
this._keyframe = true;
this.name = name;
this.style = style;
}
getName() {
let hashId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
return hashId ? `${hashId}-${this.name}` : this.name;
}
}
const cssinjs = {
// cssinjs
StyleProvider
};
const version = "4.2.6";
const PresetColors = ["blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
const genControlHeight = (token) => {
const {
controlHeight
} = token;
return {
controlHeightSM: controlHeight * 0.75,
controlHeightXS: controlHeight * 0.5,
controlHeightLG: controlHeight * 1.25
};
};
function genSizeMapToken(token) {
const {
sizeUnit,
sizeStep
} = token;
return {
sizeXXL: sizeUnit * (sizeStep + 8),
sizeXL: sizeUnit * (sizeStep + 4),
sizeLG: sizeUnit * (sizeStep + 2),
sizeMD: sizeUnit * (sizeStep + 1),
sizeMS: sizeUnit * sizeStep,
size: sizeUnit * sizeStep,
sizeSM: sizeUnit * (sizeStep - 1),
sizeXS: sizeUnit * (sizeStep - 2),
sizeXXS: sizeUnit * (sizeStep - 3)
// 4
};
}
const defaultPresetColors = {
blue: "#1677ff",
purple: "#722ED1",
cyan: "#13C2C2",
green: "#52C41A",
magenta: "#EB2F96",
pink: "#eb2f96",
red: "#F5222D",
orange: "#FA8C16",
yellow: "#FADB14",
volcano: "#FA541C",
geekblue: "#2F54EB",
gold: "#FAAD14",
lime: "#A0D911"
};
const seedToken = _extends(_extends({}, defaultPresetColors), {
// Color
colorPrimary: "#1677ff",
colorSuccess: "#52c41a",
colorWarning: "#faad14",
colorError: "#ff4d4f",
colorInfo: "#1677ff",
colorTextBase: "",
colorBgBase: "",
// Font
fontFamily: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji'`,
fontSize: 14,
// Line
lineWidth: 1,
lineType: "solid",
// Motion
motionUnit: 0.1,
motionBase: 0,
motionEaseOutCirc: "cubic-bezier(0.08, 0.82, 0.17, 1)",
motionEaseInOutCirc: "cubic-bezier(0.78, 0.14, 0.15, 0.86)",
motionEaseOut: "cubic-bezier(0.215, 0.61, 0.355, 1)",
motionEaseInOut: "cubic-bezier(0.645, 0.045, 0.355, 1)",
motionEaseOutBack: "cubic-bezier(0.12, 0.4, 0.29, 1.46)",
motionEaseInBack: "cubic-bezier(0.71, -0.46, 0.88, 0.6)",
motionEaseInQuint: "cubic-bezier(0.755, 0.05, 0.855, 0.06)",
motionEaseOutQuint: "cubic-bezier(0.23, 1, 0.32, 1)",
// Radius
borderRadius: 6,
// Size
sizeUnit: 4,
sizeStep: 4,
sizePopupArrow: 16,
// Control Base
controlHeight: 32,
// zIndex
zIndexBase: 0,
zIndexPopupBase: 1e3,
// Image
opacityImage: 1,
// Wireframe
wireframe: false
});
function genColorMapToken(seed2, _ref) {
let {
generateColorPalettes: generateColorPalettes2,
generateNeutralColorPalettes: generateNeutralColorPalettes2
} = _ref;
const {
colorSuccess: colorSuccessBase,
colorWarning: colorWarningBase,
colorError: colorErrorBase,
colorInfo: colorInfoBase,
colorPrimary: colorPrimaryBase,
colorBgBase,
colorTextBase
} = seed2;
const primaryColors = generateColorPalettes2(colorPrimaryBase);
const successColors = generateColorPalettes2(colorSuccessBase);
const warningColors = generateColorPalettes2(colorWarningBase);
const errorColors = generateColorPalettes2(colorErrorBase);
const infoColors = generateColorPalettes2(colorInfoBase);
const neutralColors = generateNeutralColorPalettes2(colorBgBase, colorTextBase);
return _extends(_extends({}, neutralColors), {
colorPrimaryBg: primaryColors[1],
colorPrimaryBgHover: primaryColors[2],
colorPrimaryBorder: primaryColors[3],
colorPrimaryBorderHover: primaryColors[4],
colorPrimaryHover: primaryColors[5],
colorPrimary: primaryColors[6],
colorPrimaryActive: primaryColors[7],
colorPrimaryTextHover: primaryColors[8],
colorPrimaryText: primaryColors[9],
colorPrimaryTextActive: primaryColors[10],
colorSuccessBg: successColors[1],
colorSuccessBgHover: successColors[2],
colorSuccessBorder: successColors[3],
colorSuccessBorderHover: successColors[4],
colorSuccessHover: successColors[4],
colorSuccess: successColors[6],
colorSuccessActive: successColors[7],
colorSuccessTextHover: successColors[8],
colorSuccessText: successColors[9],
colorSuccessTextActive: successColors[10],
colorErrorBg: errorColors[1],
colorErrorBgHover: errorColors[2],
colorErrorBorder: errorColors[3],
colorErrorBorderHover: errorColors[4],
colorErrorHover: errorColors[5],
colorError: errorColors[6],
colorErrorActive: errorColors[7],
colorErrorTextHover: errorColors[8],
colorErrorText: errorColors[9],
colorErrorTextActive: errorColors[10],
colorWarningBg: warningColors[1],
colorWarningBgHover: warningColors[2],
colorWarningBorder: warningColors[3],
colorWarningBorderHover: warningColors[4],
colorWarningHover: warningColors[4],
colorWarning: warningColors[6],
colorWarningActive: warningColors[7],
colorWarningTextHover: warningColors[8],
colorWarningText: warningColors[9],
colorWarningTextActive: warningColors[10],
colorInfoBg: infoColors[1],
colorInfoBgHover: infoColors[2],
colorInfoBorder: infoColors[3],
colorInfoBorderHover: infoColors[4],
colorInfoHover: infoColors[4],
colorInfo: infoColors[6],
colorInfoActive: infoColors[7],
colorInfoTextHover: infoColors[8],
colorInfoText: infoColors[9],
colorInfoTextActive: infoColors[10],
colorBgMask: new TinyColor("#000").setAlpha(0.45).toRgbString(),
colorWhite: "#fff"
});
}
const genRadius = (radiusBase) => {
let radiusLG = radiusBase;
let radiusSM = radiusBase;
let radiusXS = radiusBase;
let radiusOuter = radiusBase;
if (radiusBase < 6 && radiusBase >= 5) {
radiusLG = radiusBase + 1;
} else if (radiusBase < 16 && radiusBase >= 6) {
radiusLG = radiusBase + 2;
} else if (radiusBase >= 16) {
radiusLG = 16;
}
if (radiusBase < 7 && radiusBase >= 5) {
radiusSM = 4;
} else if (radiusBase < 8 && radiusBase >= 7) {
radiusSM = 5;
} else if (radiusBase < 14 && radiusBase >= 8) {
radiusSM = 6;
} else if (radiusBase < 16 && radiusBase >= 14) {
radiusSM = 7;
} else if (radiusBase >= 16) {
radiusSM = 8;
}
if (radiusBase < 6 && radiusBase >= 2) {
radiusXS = 1;
} else if (radiusBase >= 6) {
radiusXS = 2;
}
if (radiusBase > 4 && radiusBase < 8) {
radiusOuter = 4;
} else if (radiusBase >= 8) {
radiusOuter = 6;
}
return {
borderRadius: radiusBase > 16 ? 16 : radiusBase,
borderRadiusXS: radiusXS,
borderRadiusSM: radiusSM,
borderRadiusLG: radiusLG,
borderRadiusOuter: radiusOuter
};
};
function genCommonMapToken(token) {
const {
motionUnit,
motionBase,
borderRadius,
lineWidth
} = token;
return _extends({
// motion
motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
motionDurationMid: `${(motionBase + motionUnit * 2).toFixed(1)}s`,
motionDurationSlow: `${(motionBase + motionUnit * 3).toFixed(1)}s`,
// line
lineWidthBold: lineWidth + 1
}, genRadius(borderRadius));
}
const getAlphaColor$1 = (baseColor, alpha) => new TinyColor(baseColor).setAlpha(alpha).toRgbString();
const getSolidColor = (baseColor, brightness) => {
const instance = new TinyColor(baseColor);
return instance.darken(brightness).toHexString();
};
const generateColorPalettes = (baseColor) => {
const colors2 = generate$1(baseColor);
return {
1: colors2[0],
2: colors2[1],
3: colors2[2],
4: colors2[3],
5: colors2[4],
6: colors2[5],
7: colors2[6],
8: colors2[4],
9: colors2[5],
10: colors2[6]
// 8: colors[7],
// 9: colors[8],
// 10: colors[9],
};
};
const generateNeutralColorPalettes = (bgBaseColor, textBaseColor) => {
const colorBgBase = bgBaseColor || "#fff";
const colorTextBase = textBaseColor || "#000";
return {
colorBgBase,
colorTextBase,
colorText: getAlphaColor$1(colorTextBase, 0.88),
colorTextSecondary: getAlphaColor$1(colorTextBase, 0.65),
colorTextTertiary: getAlphaColor$1(colorTextBase, 0.45),
colorTextQuaternary: getAlphaColor$1(colorTextBase, 0.25),
colorFill: getAlphaColor$1(colorTextBase, 0.15),
colorFillSecondary: getAlphaColor$1(colorTextBase, 0.06),
colorFillTertiary: getAlphaColor$1(colorTextBase, 0.04),
colorFillQuaternary: getAlphaColor$1(colorTextBase, 0.02),
colorBgLayout: getSolidColor(colorBgBase, 4),
colorBgContainer: getSolidColor(colorBgBase, 0),
colorBgElevated: getSolidColor(colorBgBase, 0),
colorBgSpotlight: getAlphaColor$1(colorTextBase, 0.85),
colorBorder: getSolidColor(colorBgBase, 15),
colorBorderSecondary: getSolidColor(colorBgBase, 6)
};
};
function getFontSizes(base) {
const fontSizes = new Array(10).fill(null).map((_, index2) => {
const i = index2 - 1;
const baseSize = base * Math.pow(2.71828, i / 5);
const intSize = index2 > 1 ? Math.floor(baseSize) : Math.ceil(baseSize);
return Math.floor(intSize / 2) * 2;
});
fontSizes[1] = base;
return fontSizes.map((size) => {
const height = size + 8;
return {
size,
lineHeight: height / size
};
});
}
const genFontMapToken = (fontSize) => {
const fontSizePairs = getFontSizes(fontSize);
const fontSizes = fontSizePairs.map((pair) => pair.size);
const lineHeights = fontSizePairs.map((pair) => pair.lineHeight);
return {
fontSizeSM: fontSizes[0],
fontSize: fontSizes[1],
fontSizeLG: fontSizes[2],
fontSizeXL: fontSizes[3],
fontSizeHeading1: fontSizes[6],
fontSizeHeading2: fontSizes[5],
fontSizeHeading3: fontSizes[4],
fontSizeHeading4: fontSizes[3],
fontSizeHeading5: fontSizes[2],
lineHeight: lineHeights[1],
lineHeightLG: lineHeights[2],
lineHeightSM: lineHeights[0],
lineHeightHeading1: lineHeights[6],
lineHeightHeading2: lineHeights[5],
lineHeightHeading3: lineHeights[4],
lineHeightHeading4: lineHeights[3],
lineHeightHeading5: lineHeights[2]
};
};
function derivative(token) {
const colorPalettes = Object.keys(defaultPresetColors).map((colorKey) => {
const colors2 = generate$1(token[colorKey]);
return new Array(10).fill(1).reduce((prev, _, i) => {
prev[`${colorKey}-${i + 1}`] = colors2[i];
return prev;
}, {});
}).reduce((prev, cur) => {
prev = _extends(_extends({}, prev), cur);
return prev;
}, {});
return _extends(_extends(_extends(_extends(_extends(_extends(_extends({}, token), colorPalettes), genColorMapToken(token, {
generateColorPalettes,
generateNeutralColorPalettes
})), genFontMapToken(token.fontSize)), genSizeMapToken(token)), genControlHeight(token)), genCommonMapToken(token));
}
function isStableColor(color) {
return color >= 0 && color <= 255;
}
function getAlphaColor(frontColor, backgroundColor) {
const {
r: fR,
g: fG,
b: fB,
a: originAlpha
} = new TinyColor(frontColor).toRgb();
if (originAlpha < 1) {
return frontColor;
}
const {
r: bR,
g: bG,
b: bB
} = new TinyColor(backgroundColor).toRgb();
for (let fA = 0.01; fA <= 1; fA += 0.01) {
const r = Math.round((fR - bR * (1 - fA)) / fA);
const g = Math.round((fG - bG * (1 - fA)) / fA);
const b = Math.round((fB - bB * (1 - fA)) / fA);
if (isStableColor(r) && isStableColor(g) && isStableColor(b)) {
return new TinyColor({
r,
g,
b,
a: Math.round(fA * 100) / 100
}).toRgbString();
}
}
return new TinyColor({
r: fR,
g: fG,
b: fB,
a: 1
}).toRgbString();
}
var __rest$1h = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function formatToken(derivativeToken) {
const {
override
} = derivativeToken, restToken = __rest$1h(derivativeToken, ["override"]);
const overrideTokens = _extends({}, override);
Object.keys(seedToken).forEach((token) => {
delete overrideTokens[token];
});
const mergedToken = _extends(_extends({}, restToken), overrideTokens);
const screenXS = 480;
const screenSM = 576;
const screenMD = 768;
const screenLG = 992;
const screenXL = 1200;
const screenXXL = 1600;
const screenXXXL = 2e3;
const aliasToken = _extends(_extends(_extends({}, mergedToken), {
colorLink: mergedToken.colorInfoText,
colorLinkHover: mergedToken.colorInfoHover,
colorLinkActive: mergedToken.colorInfoActive,
// ============== Background ============== //
colorFillContent: mergedToken.colorFillSecondary,
colorFillContentHover: mergedToken.colorFill,
colorFillAlter: mergedToken.colorFillQuaternary,
colorBgContainerDisabled: mergedToken.colorFillTertiary,
// ============== Split ============== //
colorBorderBg: mergedToken.colorBgContainer,
colorSplit: getAlphaColor(mergedToken.colorBorderSecondary, mergedToken.colorBgContainer),
// ============== Text ============== //
colorTextPlaceholder: mergedToken.colorTextQuaternary,
colorTextDisabled: mergedToken.colorTextQuaternary,
colorTextHeading: mergedToken.colorText,
colorTextLabel: mergedToken.colorTextSecondary,
colorTextDescription: mergedToken.colorTextTertiary,
colorTextLightSolid: mergedToken.colorWhite,
colorHighlight: mergedToken.colorError,
colorBgTextHover: mergedToken.colorFillSecondary,
colorBgTextActive: mergedToken.colorFill,
colorIcon: mergedToken.colorTextTertiary,
colorIconHover: mergedToken.colorText,
colorErrorOutline: getAlphaColor(mergedToken.colorErrorBg, mergedToken.colorBgContainer),
colorWarningOutline: getAlphaColor(mergedToken.colorWarningBg, mergedToken.colorBgContainer),
// Font
fontSizeIcon: mergedToken.fontSizeSM,
// Control
lineWidth: mergedToken.lineWidth,
controlOutlineWidth: mergedToken.lineWidth * 2,
// Checkbox size and expand icon size
controlInteractiveSize: mergedToken.controlHeight / 2,
controlItemBgHover: mergedToken.colorFillTertiary,
controlItemBgActive: mergedToken.colorPrimaryBg,
controlItemBgActiveHover: mergedToken.colorPrimaryBgHover,
controlItemBgActiveDisabled: mergedToken.colorFill,
controlTmpOutline: mergedToken.colorFillQuaternary,
controlOutline: getAlphaColor(mergedToken.colorPrimaryBg, mergedToken.colorBgContainer),
lineType: mergedToken.lineType,
borderRadius: mergedToken.borderRadius,
borderRadiusXS: mergedToken.borderRadiusXS,
borderRadiusSM: mergedToken.borderRadiusSM,
borderRadiusLG: mergedToken.borderRadiusLG,
fontWeightStrong: 600,
opacityLoading: 0.65,
linkDecoration: "none",
linkHoverDecoration: "none",
linkFocusDecoration: "none",
controlPaddingHorizontal: 12,
controlPaddingHorizontalSM: 8,
paddingXXS: mergedToken.sizeXXS,
paddingXS: mergedToken.sizeXS,
paddingSM: mergedToken.sizeSM,
padding: mergedToken.size,
paddingMD: mergedToken.sizeMD,
paddingLG: mergedToken.sizeLG,
paddingXL: mergedToken.sizeXL,
paddingContentHorizontalLG: mergedToken.sizeLG,
paddingContentVerticalLG: mergedToken.sizeMS,
paddingContentHorizontal: mergedToken.sizeMS,
paddingContentVertical: mergedToken.sizeSM,
paddingContentHorizontalSM: mergedToken.size,
paddingContentVerticalSM: mergedToken.sizeXS,
marginXXS: mergedToken.sizeXXS,
marginXS: mergedToken.sizeXS,
marginSM: mergedToken.sizeSM,
margin: mergedToken.size,
marginMD: mergedToken.sizeMD,
marginLG: mergedToken.sizeLG,
marginXL: mergedToken.sizeXL,
marginXXL: mergedToken.sizeXXL,
boxShadow: `
0 1px 2px 0 rgba(0, 0, 0, 0.03),
0 1px 6px -1px rgba(0, 0, 0, 0.02),
0 2px 4px 0 rgba(0, 0, 0, 0.02)
`,
boxShadowSecondary: `
0 6px 16px 0 rgba(0, 0, 0, 0.08),
0 3px 6px -4px rgba(0, 0, 0, 0.12),
0 9px 28px 8px rgba(0, 0, 0, 0.05)
`,
boxShadowTertiary: `
0 1px 2px 0 rgba(0, 0, 0, 0.03),
0 1px 6px -1px rgba(0, 0, 0, 0.02),
0 2px 4px 0 rgba(0, 0, 0, 0.02)
`,
screenXS,
screenXSMin: screenXS,
screenXSMax: screenSM - 1,
screenSM,
screenSMMin: screenSM,
screenSMMax: screenMD - 1,
screenMD,
screenMDMin: screenMD,
screenMDMax: screenLG - 1,
screenLG,
screenLGMin: screenLG,
screenLGMax: screenXL - 1,
screenXL,
screenXLMin: screenXL,
screenXLMax: screenXXL - 1,
screenXXL,
screenXXLMin: screenXXL,
screenXXLMax: screenXXXL - 1,
screenXXXL,
screenXXXLMin: screenXXXL,
// FIXME: component box-shadow, should be removed
boxShadowPopoverArrow: "3px 3px 7px rgba(0, 0, 0, 0.1)",
boxShadowCard: `
0 1px 2px -2px ${new TinyColor("rgba(0, 0, 0, 0.16)").toRgbString()},
0 3px 6px 0 ${new TinyColor("rgba(0, 0, 0, 0.12)").toRgbString()},
0 5px 12px 4px ${new TinyColor("rgba(0, 0, 0, 0.09)").toRgbString()}
`,
boxShadowDrawerRight: `
-6px 0 16px 0 rgba(0, 0, 0, 0.08),
-3px 0 6px -4px rgba(0, 0, 0, 0.12),
-9px 0 28px 8px rgba(0, 0, 0, 0.05)
`,
boxShadowDrawerLeft: `
6px 0 16px 0 rgba(0, 0, 0, 0.08),
3px 0 6px -4px rgba(0, 0, 0, 0.12),
9px 0 28px 8px rgba(0, 0, 0, 0.05)
`,
boxShadowDrawerUp: `
0 6px 16px 0 rgba(0, 0, 0, 0.08),
0 3px 6px -4px rgba(0, 0, 0, 0.12),
0 9px 28px 8px rgba(0, 0, 0, 0.05)
`,
boxShadowDrawerDown: `
0 -6px 16px 0 rgba(0, 0, 0, 0.08),
0 -3px 6px -4px rgba(0, 0, 0, 0.12),
0 -9px 28px 8px rgba(0, 0, 0, 0.05)
`,
boxShadowTabsOverflowLeft: "inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",
boxShadowTabsOverflowRight: "inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",
boxShadowTabsOverflowTop: "inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",
boxShadowTabsOverflowBottom: "inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"
}), overrideTokens);
return aliasToken;
}
const operationUnit = (token) => ({
// FIXME: This use link but is a operation unit. Seems should be a colorPrimary.
// And Typography use this to generate link style which should not do this.
color: token.colorLink,
textDecoration: "none",
outline: "none",
cursor: "pointer",
transition: `color ${token.motionDurationSlow}`,
"&:focus, &:hover": {
color: token.colorLinkHover
},
"&:active": {
color: token.colorLinkActive
}
});
const roundedArrow = (width, innerRadius, outerRadius, bgColor, boxShadow) => {
const unitWidth = width / 2;
const ax = 0;
const ay = unitWidth;
const bx = outerRadius * 1 / Math.sqrt(2);
const by = unitWidth - outerRadius * (1 - 1 / Math.sqrt(2));
const cx = unitWidth - innerRadius * (1 / Math.sqrt(2));
const cy = outerRadius * (Math.sqrt(2) - 1) + innerRadius * (1 / Math.sqrt(2));
const dx = 2 * unitWidth - cx;
const dy = cy;
const ex = 2 * unitWidth - bx;
const ey = by;
const fx = 2 * unitWidth - ax;
const fy = ay;
const shadowWidth = unitWidth * Math.sqrt(2) + outerRadius * (Math.sqrt(2) - 2);
const polygonOffset = outerRadius * (Math.sqrt(2) - 1);
return {
pointerEvents: "none",
width,
height: width,
overflow: "hidden",
"&::after": {
content: '""',
position: "absolute",
width: shadowWidth,
height: shadowWidth,
bottom: 0,
insetInline: 0,
margin: "auto",
borderRadius: {
_skip_check_: true,
value: `0 0 ${innerRadius}px 0`
},
transform: "translateY(50%) rotate(-135deg)",
boxShadow,
zIndex: 0,
background: "transparent"
},
"&::before": {
position: "absolute",
bottom: 0,
insetInlineStart: 0,
width,
height: width / 2,
background: bgColor,
clipPath: {
_multi_value_: true,
value: [`polygon(${polygonOffset}px 100%, 50% ${polygonOffset}px, ${2 * unitWidth - polygonOffset}px 100%, ${polygonOffset}px 100%)`, `path('M ${ax} ${ay} A ${outerRadius} ${outerRadius} 0 0 0 ${bx} ${by} L ${cx} ${cy} A ${innerRadius} ${innerRadius} 0 0 1 ${dx} ${dy} L ${ex} ${ey} A ${outerRadius} ${outerRadius} 0 0 0 ${fx} ${fy} Z')`]
},
content: '""'
}
};
};
function genPresetColor(token, genCss) {
return PresetColors.reduce((prev, colorKey) => {
const lightColor = token[`${colorKey}-1`];
const lightBorderColor = token[`${colorKey}-3`];
const darkColor = token[`${colorKey}-6`];
const textColor = token[`${colorKey}-7`];
return _extends(_extends({}, prev), genCss(colorKey, {
lightColor,
lightBorderColor,
darkColor,
textColor
}));
}, {});
}
const textEllipsis = {
overflow: "hidden",
whiteSpace: "nowrap",
textOverflow: "ellipsis"
};
const resetComponent = (token) => ({
boxSizing: "border-box",
margin: 0,
padding: 0,
color: token.colorText,
fontSize: token.fontSize,
// font-variant: @font-variant-base;
lineHeight: token.lineHeight,
listStyle: "none",
// font-feature-settings: @font-feature-settings-base;
fontFamily: token.fontFamily
});
const resetIcon = () => ({
display: "inline-flex",
alignItems: "center",
color: "inherit",
fontStyle: "normal",
lineHeight: 0,
textAlign: "center",
textTransform: "none",
// for SVG icon, see https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4
verticalAlign: "-0.125em",
textRendering: "optimizeLegibility",
"-webkit-font-smoothing": "antialiased",
"-moz-osx-font-smoothing": "grayscale",
"> *": {
lineHeight: 1
},
svg: {
display: "inline-block"
}
});
const clearFix = () => ({
// https://github.com/ant-design/ant-design/issues/21301#issuecomment-583955229
"&::before": {
display: "table",
content: '""'
},
"&::after": {
// https://github.com/ant-design/ant-design/issues/21864
display: "table",
clear: "both",
content: '""'
}
});
const genLinkStyle = (token) => ({
a: {
color: token.colorLink,
textDecoration: token.linkDecoration,
backgroundColor: "transparent",
outline: "none",
cursor: "pointer",
transition: `color ${token.motionDurationSlow}`,
"-webkit-text-decoration-skip": "objects",
"&:hover": {
color: token.colorLinkHover
},
"&:active": {
color: token.colorLinkActive
},
[`&:active,
&:hover`]: {
textDecoration: token.linkHoverDecoration,
outline: 0
},
// https://github.com/ant-design/ant-design/issues/22503
"&:focus": {
textDecoration: token.linkFocusDecoration,
outline: 0
},
"&[disabled]": {
color: token.colorTextDisabled,
cursor: "not-allowed"
}
}
});
const genCommonStyle = (token, componentPrefixCls) => {
const {
fontFamily,
fontSize
} = token;
const rootPrefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
return {
[rootPrefixSelector]: {
fontFamily,
fontSize,
boxSizing: "border-box",
"&::before, &::after": {
boxSizing: "border-box"
},
[rootPrefixSelector]: {
boxSizing: "border-box",
"&::before, &::after": {
boxSizing: "border-box"
}
}
}
};
};
const genFocusOutline = (token) => ({
outline: `${token.lineWidthBold}px solid ${token.colorPrimaryBorder}`,
outlineOffset: 1,
transition: "outline-offset 0s, outline 0s"
});
const genFocusStyle = (token) => ({
"&:focus-visible": _extends({}, genFocusOutline(token))
});
function genComponentStyleHook(component, styleFn, getDefaultToken) {
return (_prefixCls) => {
const prefixCls = computed(() => _prefixCls === null || _prefixCls === void 0 ? void 0 : _prefixCls.value);
const [theme, token, hashId] = useToken();
const {
getPrefixCls,
iconPrefixCls
} = useConfigContextInject();
const rootPrefixCls = computed(() => getPrefixCls());
const sharedInfo = computed(() => {
return {
theme: theme.value,
token: token.value,
hashId: hashId.value,
path: ["Shared", rootPrefixCls.value]
};
});
useStyleRegister(sharedInfo, () => [{
// Link
"&": genLinkStyle(token.value)
}]);
const componentInfo = computed(() => {
return {
theme: theme.value,
token: token.value,
hashId: hashId.value,
path: [component, prefixCls.value, iconPrefixCls.value]
};
});
return [useStyleRegister(componentInfo, () => {
const {
token: proxyToken,
flush
} = statisticToken(token.value);
const defaultComponentToken = typeof getDefaultToken === "function" ? getDefaultToken(proxyToken) : getDefaultToken;
const mergedComponentToken = _extends(_extends({}, defaultComponentToken), token.value[component]);
const componentCls = `.${prefixCls.value}`;
const mergedToken = merge(proxyToken, {
componentCls,
prefixCls: prefixCls.value,
iconCls: `.${iconPrefixCls.value}`,
antCls: `.${rootPrefixCls.value}`
}, mergedComponentToken);
const styleInterpolation = styleFn(mergedToken, {
hashId: hashId.value,
prefixCls: prefixCls.value,
rootPrefixCls: rootPrefixCls.value,
iconPrefixCls: iconPrefixCls.value,
overrideComponentToken: token.value[component]
});
flush(component, mergedComponentToken);
return [genCommonStyle(token.value, prefixCls.value), styleInterpolation];
}), hashId];
};
}
const enableStatistic = typeof CSSINJS_STATISTIC !== "undefined";
let recording = true;
function merge() {
for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) {
objs[_key] = arguments[_key];
}
if (!enableStatistic) {
return _extends({}, ...objs);
}
recording = false;
const ret = {};
objs.forEach((obj) => {
const keys = Object.keys(obj);
keys.forEach((key2) => {
Object.defineProperty(ret, key2, {
configurable: true,
enumerable: true,
get: () => obj[key2]
});
});
});
recording = true;
return ret;
}
function noop$c() {
}
function statisticToken(token) {
let tokenKeys2;
let proxy = token;
let flush = noop$c;
if (enableStatistic) {
tokenKeys2 = /* @__PURE__ */ new Set();
proxy = new Proxy(token, {
get(obj, prop) {
if (recording) {
tokenKeys2.add(prop);
}
return obj[prop];
}
});
flush = (componentName, componentToken) => {
({
global: Array.from(tokenKeys2)});
};
}
return {
token: proxy,
keys: tokenKeys2,
flush
};
}
const defaultTheme = createTheme(derivative);
const defaultConfig = {
token: seedToken,
hashed: true
};
const DesignTokenContextKey = Symbol("DesignTokenContext");
const globalDesignTokenApi = shallowRef();
const useDesignTokenProvider = (value) => {
provide(DesignTokenContextKey, value);
watch(value, () => {
globalDesignTokenApi.value = unref(value);
triggerRef(globalDesignTokenApi);
}, {
immediate: true,
deep: true
});
};
const DesignTokenProvider = defineComponent({
props: {
value: objectType()
},
setup(props2, _ref) {
let {
slots
} = _ref;
useDesignTokenProvider(computed(() => props2.value));
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
function useToken() {
const designTokenContext = inject(DesignTokenContextKey, computed(() => globalDesignTokenApi.value || defaultConfig));
const salt = computed(() => `${version}-${designTokenContext.value.hashed || ""}`);
const mergedTheme = computed(() => designTokenContext.value.theme || defaultTheme);
const cacheToken = useCacheToken(mergedTheme, computed(() => [seedToken, designTokenContext.value.token]), computed(() => ({
salt: salt.value,
override: _extends({
override: designTokenContext.value.token
}, designTokenContext.value.components),
formatToken
})));
return [mergedTheme, computed(() => cacheToken.value[0]), computed(() => designTokenContext.value.hashed ? cacheToken.value[1] : "")];
}
const Empty$2 = defineComponent({
compatConfig: {
MODE: 3
},
setup() {
const [, token] = useToken();
const themeStyle = computed(() => {
const bgColor = new TinyColor(token.value.colorBgBase);
if (bgColor.toHsl().l < 0.5) {
return {
opacity: 0.65
};
}
return {};
});
return () => createVNode("svg", {
"style": themeStyle.value,
"width": "184",
"height": "152",
"viewBox": "0 0 184 152",
"xmlns": "http://www.w3.org/2000/svg"
}, [createVNode("g", {
"fill": "none",
"fill-rule": "evenodd"
}, [createVNode("g", {
"transform": "translate(24 31.67)"
}, [createVNode("ellipse", {
"fill-opacity": ".8",
"fill": "#F5F5F7",
"cx": "67.797",
"cy": "106.89",
"rx": "67.797",
"ry": "12.668"
}, null), createVNode("path", {
"d": "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",
"fill": "#AEB8C2"
}, null), createVNode("path", {
"d": "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",
"fill": "url(#linearGradient-1)",
"transform": "translate(13.56)"
}, null), createVNode("path", {
"d": "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",
"fill": "#F5F5F7"
}, null), createVNode("path", {
"d": "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",
"fill": "#DCE0E6"
}, null)]), createVNode("path", {
"d": "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",
"fill": "#DCE0E6"
}, null), createVNode("g", {
"transform": "translate(149.65 15.383)",
"fill": "#FFF"
}, [createVNode("ellipse", {
"cx": "20.654",
"cy": "3.167",
"rx": "2.849",
"ry": "2.815"
}, null), createVNode("path", {
"d": "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"
}, null)])])]);
}
});
Empty$2.PRESENTED_IMAGE_DEFAULT = true;
const Simple = defineComponent({
compatConfig: {
MODE: 3
},
setup() {
const [, token] = useToken();
const color = computed(() => {
const {
colorFill,
colorFillTertiary,
colorFillQuaternary,
colorBgContainer
} = token.value;
return {
borderColor: new TinyColor(colorFill).onBackground(colorBgContainer).toHexString(),
shadowColor: new TinyColor(colorFillTertiary).onBackground(colorBgContainer).toHexString(),
contentColor: new TinyColor(colorFillQuaternary).onBackground(colorBgContainer).toHexString()
};
});
return () => createVNode("svg", {
"width": "64",
"height": "41",
"viewBox": "0 0 64 41",
"xmlns": "http://www.w3.org/2000/svg"
}, [createVNode("g", {
"transform": "translate(0 1)",
"fill": "none",
"fill-rule": "evenodd"
}, [createVNode("ellipse", {
"fill": color.value.shadowColor,
"cx": "32",
"cy": "33",
"rx": "32",
"ry": "7"
}, null), createVNode("g", {
"fill-rule": "nonzero",
"stroke": color.value.borderColor
}, [createVNode("path", {
"d": "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"
}, null), createVNode("path", {
"d": "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",
"fill": color.value.contentColor
}, null)])])]);
}
});
Simple.PRESENTED_IMAGE_SIMPLE = true;
const genSharedEmptyStyle = (token) => {
const {
componentCls,
margin,
marginXS,
marginXL,
fontSize,
lineHeight
} = token;
return {
[componentCls]: {
marginInline: marginXS,
fontSize,
lineHeight,
textAlign: "center",
// 原来 &-image 没有父子结构,现在为了外层承担我们的hashId,改成父子结果
[`${componentCls}-image`]: {
height: token.emptyImgHeight,
marginBottom: marginXS,
opacity: token.opacityImage,
img: {
height: "100%"
},
svg: {
height: "100%",
margin: "auto"
}
},
// 原来 &-footer 没有父子结构,现在为了外层承担我们的hashId,改成父子结果
[`${componentCls}-footer`]: {
marginTop: margin
},
"&-normal": {
marginBlock: marginXL,
color: token.colorTextDisabled,
[`${componentCls}-image`]: {
height: token.emptyImgHeightMD
}
},
"&-small": {
marginBlock: marginXS,
color: token.colorTextDisabled,
[`${componentCls}-image`]: {
height: token.emptyImgHeightSM
}
}
}
};
};
const useStyle$Z = genComponentStyleHook("Empty", (token) => {
const {
componentCls,
controlHeightLG
} = token;
const emptyToken = merge(token, {
emptyImgCls: `${componentCls}-img`,
emptyImgHeight: controlHeightLG * 2.5,
emptyImgHeightMD: controlHeightLG,
emptyImgHeightSM: controlHeightLG * 0.875
});
return [genSharedEmptyStyle(emptyToken)];
});
var __rest$1g = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const emptyProps = () => ({
prefixCls: String,
imageStyle: objectType(),
image: anyType(),
description: anyType()
});
const Empty = defineComponent({
name: "AEmpty",
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: emptyProps(),
setup(props2, _ref) {
let {
slots = {},
attrs
} = _ref;
const {
direction,
prefixCls: prefixClsRef
} = useConfigInject("empty", props2);
const [wrapSSR, hashId] = useStyle$Z(prefixClsRef);
return () => {
var _a, _b;
const prefixCls = prefixClsRef.value;
const _c = _extends(_extends({}, props2), attrs), {
image: mergedImage = ((_a = slots.image) === null || _a === void 0 ? void 0 : _a.call(slots)) || h(Empty$2),
description = ((_b = slots.description) === null || _b === void 0 ? void 0 : _b.call(slots)) || void 0,
imageStyle,
class: className = ""
} = _c, restProps = __rest$1g(_c, ["image", "description", "imageStyle", "class"]);
const image = typeof mergedImage === "function" ? mergedImage() : mergedImage;
const isNormal = typeof image === "object" && "type" in image && image.type.PRESENTED_IMAGE_SIMPLE;
return wrapSSR(createVNode(LocaleReceiver, {
"componentName": "Empty",
"children": (locale2) => {
const des = typeof description !== "undefined" ? description : locale2.description;
const alt = typeof des === "string" ? des : "empty";
let imageNode = null;
if (typeof image === "string") {
imageNode = createVNode("img", {
"alt": alt,
"src": image
}, null);
} else {
imageNode = image;
}
return createVNode("div", _objectSpread$W({
"class": classNames(prefixCls, className, hashId.value, {
[`${prefixCls}-normal`]: isNormal,
[`${prefixCls}-rtl`]: direction.value === "rtl"
})
}, restProps), [createVNode("div", {
"class": `${prefixCls}-image`,
"style": imageStyle
}, [imageNode]), des && createVNode("p", {
"class": `${prefixCls}-description`
}, [des]), slots.default && createVNode("div", {
"class": `${prefixCls}-footer`
}, [filterEmpty(slots.default())])]);
}
}, null));
};
}
});
Empty.PRESENTED_IMAGE_DEFAULT = () => h(Empty$2);
Empty.PRESENTED_IMAGE_SIMPLE = () => h(Simple);
const Empty$1 = withInstall(Empty);
const DefaultRenderEmpty = (props2) => {
const {
prefixCls
} = useConfigInject("empty", props2);
const renderHtml = (componentName) => {
switch (componentName) {
case "Table":
case "List":
return createVNode(Empty$1, {
"image": Empty$1.PRESENTED_IMAGE_SIMPLE
}, null);
case "Select":
case "TreeSelect":
case "Cascader":
case "Transfer":
case "Mentions":
return createVNode(Empty$1, {
"image": Empty$1.PRESENTED_IMAGE_SIMPLE,
"class": `${prefixCls.value}-small`
}, null);
default:
return createVNode(Empty$1, null, null);
}
};
return renderHtml(props2.componentName);
};
function renderEmpty(componentName) {
return createVNode(DefaultRenderEmpty, {
"componentName": componentName
}, null);
}
const SizeContextKey = Symbol("SizeContextKey");
const useInjectSize = () => {
return inject(SizeContextKey, ref(void 0));
};
const useProviderSize = (size) => {
const parentSize = useInjectSize();
provide(SizeContextKey, computed(() => size.value || parentSize.value));
return size;
};
const useConfigInject = ((name, props2) => {
const sizeContext = useInjectSize();
const disabledContext = useInjectDisabled();
const configProvider = inject(configProviderKey, _extends(_extends({}, defaultConfigProvider), {
renderEmpty: (name2) => h(DefaultRenderEmpty, {
componentName: name2
})
}));
const prefixCls = computed(() => configProvider.getPrefixCls(name, props2.prefixCls));
const direction = computed(() => {
var _a, _b;
return (_a = props2.direction) !== null && _a !== void 0 ? _a : (_b = configProvider.direction) === null || _b === void 0 ? void 0 : _b.value;
});
const iconPrefixCls = computed(() => {
var _a;
return (_a = props2.iconPrefixCls) !== null && _a !== void 0 ? _a : configProvider.iconPrefixCls.value;
});
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
const autoInsertSpaceInButton = computed(() => {
var _a;
return (_a = configProvider.autoInsertSpaceInButton) === null || _a === void 0 ? void 0 : _a.value;
});
const renderEmpty2 = configProvider.renderEmpty;
const space = configProvider.space;
const pageHeader = configProvider.pageHeader;
const form = configProvider.form;
const getTargetContainer = computed(() => {
var _a, _b;
return (_a = props2.getTargetContainer) !== null && _a !== void 0 ? _a : (_b = configProvider.getTargetContainer) === null || _b === void 0 ? void 0 : _b.value;
});
const getPopupContainer = computed(() => {
var _a, _b, _c;
return (_b = (_a = props2.getContainer) !== null && _a !== void 0 ? _a : props2.getPopupContainer) !== null && _b !== void 0 ? _b : (_c = configProvider.getPopupContainer) === null || _c === void 0 ? void 0 : _c.value;
});
const dropdownMatchSelectWidth = computed(() => {
var _a, _b;
return (_a = props2.dropdownMatchSelectWidth) !== null && _a !== void 0 ? _a : (_b = configProvider.dropdownMatchSelectWidth) === null || _b === void 0 ? void 0 : _b.value;
});
const virtual = computed(() => {
var _a;
return (props2.virtual === void 0 ? ((_a = configProvider.virtual) === null || _a === void 0 ? void 0 : _a.value) !== false : props2.virtual !== false) && dropdownMatchSelectWidth.value !== false;
});
const size = computed(() => props2.size || sizeContext.value);
const autocomplete = computed(() => {
var _a, _b, _c;
return (_a = props2.autocomplete) !== null && _a !== void 0 ? _a : (_c = (_b = configProvider.input) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.autocomplete;
});
const disabled = computed(() => {
var _a;
return (_a = props2.disabled) !== null && _a !== void 0 ? _a : disabledContext.value;
});
const csp = computed(() => {
var _a;
return (_a = props2.csp) !== null && _a !== void 0 ? _a : configProvider.csp;
});
const wave = computed(() => {
var _a, _b;
return (_a = props2.wave) !== null && _a !== void 0 ? _a : (_b = configProvider.wave) === null || _b === void 0 ? void 0 : _b.value;
});
return {
configProvider,
prefixCls,
direction,
size,
getTargetContainer,
getPopupContainer,
space,
pageHeader,
form,
autoInsertSpaceInButton,
renderEmpty: renderEmpty2,
virtual,
dropdownMatchSelectWidth,
rootPrefixCls,
getPrefixCls: configProvider.getPrefixCls,
autocomplete,
csp,
iconPrefixCls,
disabled,
select: configProvider.select,
wave
};
});
function omit(obj, fields) {
const shallowCopy = _extends({}, obj);
for (let i = 0; i < fields.length; i += 1) {
const key2 = fields[i];
delete shallowCopy[key2];
}
return shallowCopy;
}
const genSharedAffixStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: {
position: "fixed",
zIndex: token.zIndexPopup
}
};
};
const useStyle$Y = genComponentStyleHook("Affix", (token) => {
const affixToken = merge(token, {
zIndexPopup: token.zIndexBase + 10
});
return [genSharedAffixStyle(affixToken)];
});
function getDefaultTarget() {
return null;
}
var AffixStatus;
(function(AffixStatus2) {
AffixStatus2[AffixStatus2["None"] = 0] = "None";
AffixStatus2[AffixStatus2["Prepare"] = 1] = "Prepare";
})(AffixStatus || (AffixStatus = {}));
const affixProps = () => ({
/**
* 距离窗口顶部达到指定偏移量后触发
*/
offsetTop: Number,
/** 距离窗口底部达到指定偏移量后触发 */
offsetBottom: Number,
/** 设置 Affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数 */
target: {
type: Function,
default: getDefaultTarget
},
prefixCls: String,
/** 固定状态改变时触发的回调函数 */
onChange: Function,
onTestUpdatePosition: Function
});
const Affix = defineComponent({
compatConfig: {
MODE: 3
},
name: "AAffix",
inheritAttrs: false,
props: affixProps(),
setup(props2, _ref) {
let {
slots,
emit,
expose,
attrs
} = _ref;
const placeholderNode = shallowRef();
const fixedNode = shallowRef();
const state = reactive({
affixStyle: void 0,
placeholderStyle: void 0,
status: AffixStatus.None,
lastAffix: false,
prevTarget: null,
timeout: null
});
const currentInstance = getCurrentInstance();
const offsetTop = computed(() => {
return props2.offsetBottom === void 0 && props2.offsetTop === void 0 ? 0 : props2.offsetTop;
});
const offsetBottom = computed(() => props2.offsetBottom);
const prepareMeasure = () => {
_extends(state, {
status: AffixStatus.Prepare,
affixStyle: void 0,
placeholderStyle: void 0
});
};
const updatePosition = throttleByAnimationFrame(() => {
prepareMeasure();
});
const lazyUpdatePosition = throttleByAnimationFrame(() => {
const {
target
} = props2;
const {
affixStyle
} = state;
if (target && affixStyle) {
const targetNode = target();
if (targetNode && placeholderNode.value) {
const targetRect = getTargetRect(targetNode);
const placeholderRect = getTargetRect(placeholderNode.value);
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop.value);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom.value);
if (fixedTop !== void 0 && affixStyle.top === fixedTop || fixedBottom !== void 0 && affixStyle.bottom === fixedBottom) {
return;
}
}
}
prepareMeasure();
});
expose({
updatePosition,
lazyUpdatePosition
});
watch(() => props2.target, (val) => {
const newTarget = (val === null || val === void 0 ? void 0 : val()) || null;
if (state.prevTarget !== newTarget) {
removeObserveTarget(currentInstance);
if (newTarget) {
addObserveTarget(newTarget, currentInstance);
updatePosition();
}
state.prevTarget = newTarget;
}
});
watch(() => [props2.offsetTop, props2.offsetBottom], updatePosition);
const {
prefixCls
} = useConfigInject("affix", props2);
const [wrapSSR, hashId] = useStyle$Y(prefixCls);
return () => {
var _a;
const {
affixStyle,
placeholderStyle,
status
} = state;
const className = classNames({
[prefixCls.value]: affixStyle,
[hashId.value]: true
});
const restProps = omit(props2, ["prefixCls", "offsetTop", "offsetBottom", "target", "onChange", "onTestUpdatePosition"]);
return wrapSSR(createVNode(ResizeObserver$1, {
"onResize": updatePosition
}, {
default: () => [createVNode("div", _objectSpread$W(_objectSpread$W(_objectSpread$W({}, restProps), attrs), {}, {
"ref": placeholderNode,
"data-measure-status": status
}), [affixStyle && createVNode("div", {
"style": placeholderStyle,
"aria-hidden": "true"
}, null), createVNode("div", {
"class": className,
"ref": fixedNode,
"style": affixStyle
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])])]
}));
};
}
});
const Affix$1 = withInstall(Affix);
function easeInOutCubic(t, b, c, d) {
const cc = c - b;
t /= d / 2;
if (t < 1) {
return cc / 2 * t * t * t + b;
}
return cc / 2 * ((t -= 2) * t * t + 2) + b;
}
function isWindow(obj) {
return obj !== null && obj !== void 0 && obj === obj.window;
}
function getScroll$2(target, top) {
{
return 0;
}
}
function scrollTo$1(y) {
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const {
getContainer: getContainer2 = () => void 0,
callback,
duration = 450
} = options;
const container = getContainer2();
const scrollTop = getScroll$2();
const startTime = Date.now();
const frameFunc = () => {
const timestamp = Date.now();
const time = timestamp - startTime;
const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
if (isWindow(container)) {
container.scrollTo((void 0).scrollX, nextScrollTop);
} else if (container instanceof Document) {
container.documentElement.scrollTop = nextScrollTop;
} else {
container.scrollTop = nextScrollTop;
}
if (time < duration) {
wrapperRaf(frameFunc);
} else if (typeof callback === "function") {
callback();
}
};
wrapperRaf(frameFunc);
}
function noop$b() {
}
const AnchorContextKey = Symbol("anchorContextKey");
const useProvideAnchor = (state) => {
provide(AnchorContextKey, state);
};
const useInjectAnchor = () => {
return inject(AnchorContextKey, {
registerLink: noop$b,
unregisterLink: noop$b,
scrollTo: noop$b,
activeLink: computed(() => ""),
handleClick: noop$b,
direction: computed(() => "vertical")
});
};
const genSharedAnchorStyle = (token) => {
const {
componentCls,
holderOffsetBlock,
motionDurationSlow,
lineWidthBold,
colorPrimary,
lineType,
colorSplit
} = token;
return {
[`${componentCls}-wrapper`]: {
marginBlockStart: -holderOffsetBlock,
paddingBlockStart: holderOffsetBlock,
// delete overflow: auto
// overflow: 'auto',
backgroundColor: "transparent",
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
paddingInlineStart: lineWidthBold,
[`${componentCls}-link`]: {
paddingBlock: token.anchorPaddingBlock,
paddingInline: `${token.anchorPaddingInline}px 0`,
"&-title": _extends(_extends({}, textEllipsis), {
position: "relative",
display: "block",
marginBlockEnd: token.anchorTitleBlock,
color: token.colorText,
transition: `all ${token.motionDurationSlow}`,
"&:only-child": {
marginBlockEnd: 0
}
}),
[`&-active > ${componentCls}-link-title`]: {
color: token.colorPrimary
},
// link link
[`${componentCls}-link`]: {
paddingBlock: token.anchorPaddingBlockSecondary
}
}
}),
[`&:not(${componentCls}-wrapper-horizontal)`]: {
[componentCls]: {
"&::before": {
position: "absolute",
left: {
_skip_check_: true,
value: 0
},
top: 0,
height: "100%",
borderInlineStart: `${lineWidthBold}px ${lineType} ${colorSplit}`,
content: '" "'
},
[`${componentCls}-ink`]: {
position: "absolute",
left: {
_skip_check_: true,
value: 0
},
display: "none",
transform: "translateY(-50%)",
transition: `top ${motionDurationSlow} ease-in-out`,
width: lineWidthBold,
backgroundColor: colorPrimary,
[`&${componentCls}-ink-visible`]: {
display: "inline-block"
}
}
}
},
[`${componentCls}-fixed ${componentCls}-ink ${componentCls}-ink`]: {
display: "none"
}
}
};
};
const genSharedAnchorHorizontalStyle = (token) => {
const {
componentCls,
motionDurationSlow,
lineWidthBold,
colorPrimary
} = token;
return {
[`${componentCls}-wrapper-horizontal`]: {
position: "relative",
"&::before": {
position: "absolute",
left: {
_skip_check_: true,
value: 0
},
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
borderBottom: `1px ${token.lineType} ${token.colorSplit}`,
content: '" "'
},
[componentCls]: {
overflowX: "scroll",
position: "relative",
display: "flex",
scrollbarWidth: "none",
"&::-webkit-scrollbar": {
display: "none"
/* Safari and Chrome */
},
[`${componentCls}-link:first-of-type`]: {
paddingInline: 0
},
[`${componentCls}-ink`]: {
position: "absolute",
bottom: 0,
transition: `left ${motionDurationSlow} ease-in-out, width ${motionDurationSlow} ease-in-out`,
height: lineWidthBold,
backgroundColor: colorPrimary
}
}
}
};
};
const useStyle$X = genComponentStyleHook("Anchor", (token) => {
const {
fontSize,
fontSizeLG,
padding,
paddingXXS
} = token;
const anchorToken = merge(token, {
holderOffsetBlock: paddingXXS,
anchorPaddingBlock: paddingXXS,
anchorPaddingBlockSecondary: paddingXXS / 2,
anchorPaddingInline: padding,
anchorTitleBlock: fontSize / 14 * 3,
anchorBallSize: fontSizeLG / 2
});
return [genSharedAnchorStyle(anchorToken), genSharedAnchorHorizontalStyle(anchorToken)];
});
const anchorLinkProps = () => ({
prefixCls: String,
href: String,
title: anyType(),
target: String,
/* private use */
customTitleProps: objectType()
});
const AnchorLink = defineComponent({
compatConfig: {
MODE: 3
},
name: "AAnchorLink",
inheritAttrs: false,
props: initDefaultProps(anchorLinkProps(), {
href: "#"
}),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
let mergedTitle = null;
const {
handleClick: contextHandleClick,
scrollTo: scrollTo2,
unregisterLink,
registerLink,
activeLink
} = useInjectAnchor();
const {
prefixCls
} = useConfigInject("anchor", props2);
const handleClick = (e) => {
const {
href
} = props2;
contextHandleClick(e, {
title: mergedTitle,
href
});
scrollTo2(href);
};
watch(() => props2.href, (val, oldVal) => {
nextTick(() => {
unregisterLink(oldVal);
registerLink(val);
});
});
return () => {
var _a;
const {
href,
target,
title = slots.title,
customTitleProps = {}
} = props2;
const pre = prefixCls.value;
mergedTitle = typeof title === "function" ? title(customTitleProps) : title;
const active = activeLink.value === href;
const wrapperClassName = classNames(`${pre}-link`, {
[`${pre}-link-active`]: active
}, attrs.class);
const titleClassName = classNames(`${pre}-link-title`, {
[`${pre}-link-title-active`]: active
});
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": wrapperClassName
}), [createVNode("a", {
"class": titleClassName,
"href": href,
"title": typeof mergedTitle === "string" ? mergedTitle : "",
"target": target,
"onClick": handleClick
}, [slots.customTitle ? slots.customTitle(customTitleProps) : mergedTitle]), (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
const PropTypes = createTypes({
func: void 0,
bool: void 0,
string: void 0,
number: void 0,
array: void 0,
object: void 0,
integer: void 0
});
PropTypes.extend([{
name: "looseBool",
getter: true,
type: Boolean,
default: void 0
}, {
name: "style",
getter: true,
type: [String, Object],
default: void 0
}, {
name: "VueNode",
getter: true,
type: null
}]);
function withUndefined(type) {
type.default = void 0;
return type;
}
const devWarning = ((valid, component, message) => {
warningOnce(valid, `[ant-design-vue: ${component}] ${message}`);
});
function getDefaultContainer() {
return void 0;
}
function getOffsetTop(element, container) {
if (!element.getClientRects().length) {
return 0;
}
const rect = element.getBoundingClientRect();
if (rect.width || rect.height) {
if (container === void 0) {
container = element.ownerDocument.documentElement;
return rect.top - container.clientTop;
}
return rect.top - container.getBoundingClientRect().top;
}
return rect.top;
}
const sharpMatcherRegx = /#([\S ]+)$/;
const anchorProps = () => ({
prefixCls: String,
offsetTop: Number,
bounds: Number,
affix: {
type: Boolean,
default: true
},
showInkInFixed: {
type: Boolean,
default: false
},
getContainer: Function,
wrapperClass: String,
wrapperStyle: {
type: Object,
default: void 0
},
getCurrentAnchor: Function,
targetOffset: Number,
items: arrayType(),
direction: PropTypes.oneOf(["vertical", "horizontal"]).def("vertical"),
onChange: Function,
onClick: Function
});
const Anchor = defineComponent({
compatConfig: {
MODE: 3
},
name: "AAnchor",
inheritAttrs: false,
props: anchorProps(),
setup(props2, _ref) {
let {
emit,
attrs,
slots,
expose
} = _ref;
const {
prefixCls,
getTargetContainer,
direction
} = useConfigInject("anchor", props2);
const anchorDirection = computed(() => {
var _a2;
return (_a2 = props2.direction) !== null && _a2 !== void 0 ? _a2 : "vertical";
});
const spanLinkNode = ref(null);
const anchorRef = ref();
const state = reactive({
links: [],
scrollContainer: null,
scrollEvent: null,
animating: false
});
const activeLink = ref(null);
const getContainer2 = computed(() => {
const {
getContainer: getContainer22
} = props2;
return getContainer22 || (getTargetContainer === null || getTargetContainer === void 0 ? void 0 : getTargetContainer.value) || getDefaultContainer;
});
const setCurrentActiveLink = (link) => {
const {
getCurrentAnchor: getCurrentAnchor2
} = props2;
if (activeLink.value === link) {
return;
}
activeLink.value = typeof getCurrentAnchor2 === "function" ? getCurrentAnchor2(link) : link;
emit("change", link);
};
const handleScrollTo = (link) => {
const {
offsetTop,
targetOffset: targetOffset2
} = props2;
setCurrentActiveLink(link);
const sharpLinkMatch = sharpMatcherRegx.exec(link);
if (!sharpLinkMatch) {
return;
}
const targetElement = (void 0).getElementById(sharpLinkMatch[1]);
if (!targetElement) {
return;
}
const container = getContainer2.value();
const scrollTop = getScroll$2();
const eleOffsetTop = getOffsetTop(targetElement, container);
let y = scrollTop + eleOffsetTop;
y -= targetOffset2 !== void 0 ? targetOffset2 : offsetTop || 0;
state.animating = true;
scrollTo$1(y, {
callback: () => {
state.animating = false;
},
getContainer: getContainer2.value
});
};
expose({
scrollTo: handleScrollTo
});
useProvideAnchor({
registerLink: (link) => {
if (!state.links.includes(link)) {
state.links.push(link);
}
},
unregisterLink: (link) => {
const index2 = state.links.indexOf(link);
if (index2 !== -1) {
state.links.splice(index2, 1);
}
},
activeLink,
scrollTo: handleScrollTo,
handleClick: (e, info) => {
emit("click", e, info);
},
direction: anchorDirection
});
const createNestedLink = (options) => Array.isArray(options) ? options.map((option) => {
const {
children,
key: key2,
href,
target,
class: cls,
style,
title
} = option;
return createVNode(AnchorLink, {
"key": key2,
"href": href,
"target": target,
"class": cls,
"style": style,
"title": title,
"customTitleProps": option
}, {
default: () => [anchorDirection.value === "vertical" ? createNestedLink(children) : null],
customTitle: slots.customTitle
});
}) : null;
const [wrapSSR, hashId] = useStyle$X(prefixCls);
return () => {
var _a2;
const {
offsetTop,
affix,
showInkInFixed
} = props2;
const pre = prefixCls.value;
const inkClass = classNames(`${pre}-ink`, {
[`${pre}-ink-visible`]: activeLink.value
});
const wrapperClass = classNames(hashId.value, props2.wrapperClass, `${pre}-wrapper`, {
[`${pre}-wrapper-horizontal`]: anchorDirection.value === "horizontal",
[`${pre}-rtl`]: direction.value === "rtl"
});
const anchorClass = classNames(pre, {
[`${pre}-fixed`]: !affix && !showInkInFixed
});
const wrapperStyle2 = _extends({
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : "100vh"
}, props2.wrapperStyle);
const anchorContent = createVNode("div", {
"class": wrapperClass,
"style": wrapperStyle2,
"ref": anchorRef
}, [createVNode("div", {
"class": anchorClass
}, [createVNode("span", {
"class": inkClass,
"ref": spanLinkNode
}, null), Array.isArray(props2.items) ? createNestedLink(props2.items) : (_a2 = slots.default) === null || _a2 === void 0 ? void 0 : _a2.call(slots)])]);
return wrapSSR(!affix ? anchorContent : createVNode(Affix$1, _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"offsetTop": offsetTop,
"target": getContainer2.value
}), {
default: () => [anchorContent]
}));
};
}
});
Anchor.Link = AnchorLink;
Anchor.install = function(app) {
app.component(Anchor.name, Anchor);
app.component(Anchor.Link.name, Anchor.Link);
return app;
};
function getKey$2(data, index2) {
const {
key: key2
} = data;
let value;
if ("value" in data) {
({
value
} = data);
}
if (key2 !== null && key2 !== void 0) {
return key2;
}
if (value !== void 0) {
return value;
}
return `rc-index-key-${index2}`;
}
function fillFieldNames$3(fieldNames, childrenAsData) {
const {
label,
value,
options
} = fieldNames || {};
return {
label: label || (childrenAsData ? "children" : "label"),
value: value || "value",
options: options || "options"
};
}
function flattenOptions(options) {
let {
fieldNames,
childrenAsData
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const flattenList = [];
const {
label: fieldLabel,
value: fieldValue,
options: fieldOptions
} = fillFieldNames$3(fieldNames, false);
function dig(list, isGroupOption) {
list.forEach((data) => {
const label = data[fieldLabel];
if (isGroupOption || !(fieldOptions in data)) {
const value = data[fieldValue];
flattenList.push({
key: getKey$2(data, flattenList.length),
groupOption: isGroupOption,
data,
label,
value
});
} else {
let grpLabel = label;
if (grpLabel === void 0 && childrenAsData) {
grpLabel = data.label;
}
flattenList.push({
key: getKey$2(data, flattenList.length),
group: true,
data,
label: grpLabel
});
dig(data[fieldOptions], true);
}
});
}
dig(options, false);
return flattenList;
}
function injectPropsWithOption(option) {
const newOption = _extends({}, option);
if (!("props" in newOption)) {
Object.defineProperty(newOption, "props", {
get() {
return newOption;
}
});
}
return newOption;
}
function getSeparatedContent(text, tokens) {
if (!tokens || !tokens.length) {
return null;
}
let match2 = false;
function separate(str, _ref) {
let [token, ...restTokens] = _ref;
if (!token) {
return [str];
}
const list2 = str.split(token);
match2 = match2 || list2.length > 1;
return list2.reduce((prevList, unitStr) => [...prevList, ...separate(unitStr, restTokens)], []).filter((unit) => unit);
}
const list = separate(text, tokens);
return match2 ? list : null;
}
function returnEmptyString() {
return "";
}
function returnDocument(element) {
if (element) {
return element.ownerDocument;
}
return (void 0).document;
}
function noop$a() {
}
const triggerProps = () => ({
action: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]).def([]),
showAction: PropTypes.any.def([]),
hideAction: PropTypes.any.def([]),
getPopupClassNameFromAlign: PropTypes.any.def(returnEmptyString),
onPopupVisibleChange: Function,
afterPopupVisibleChange: PropTypes.func.def(noop$a),
popup: PropTypes.any,
arrow: PropTypes.bool.def(true),
popupStyle: {
type: Object,
default: void 0
},
prefixCls: PropTypes.string.def("rc-trigger-popup"),
popupClassName: PropTypes.string.def(""),
popupPlacement: String,
builtinPlacements: PropTypes.object,
popupTransitionName: String,
popupAnimation: PropTypes.any,
mouseEnterDelay: PropTypes.number.def(0),
mouseLeaveDelay: PropTypes.number.def(0.1),
zIndex: Number,
focusDelay: PropTypes.number.def(0),
blurDelay: PropTypes.number.def(0.15),
getPopupContainer: Function,
getDocument: PropTypes.func.def(returnDocument),
forceRender: {
type: Boolean,
default: void 0
},
destroyPopupOnHide: {
type: Boolean,
default: false
},
mask: {
type: Boolean,
default: false
},
maskClosable: {
type: Boolean,
default: true
},
// onPopupAlign: PropTypes.func.def(noop),
popupAlign: PropTypes.object.def(() => ({})),
popupVisible: {
type: Boolean,
default: void 0
},
defaultPopupVisible: {
type: Boolean,
default: false
},
maskTransitionName: String,
maskAnimation: String,
stretch: String,
alignPoint: {
type: Boolean,
default: void 0
},
autoDestroy: {
type: Boolean,
default: false
},
mobile: Object,
getTriggerDOMNode: Function
});
const innerProps = {
visible: Boolean,
prefixCls: String,
zIndex: Number,
destroyPopupOnHide: Boolean,
forceRender: Boolean,
arrow: {
type: Boolean,
default: true
},
// Legacy Motion
animation: [String, Object],
transitionName: String,
// Measure
stretch: {
type: String
},
// Align
align: {
type: Object
},
point: {
type: Object
},
getRootDomNode: {
type: Function
},
getClassNameFromAlign: {
type: Function
},
onAlign: {
type: Function
},
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onMousedown: {
type: Function
},
onTouchstart: {
type: Function
}
};
const mobileProps = _extends(_extends({}, innerProps), {
mobile: {
type: Object
}
});
const popupProps = _extends(_extends({}, innerProps), {
mask: Boolean,
mobile: {
type: Object
},
maskAnimation: String,
maskTransitionName: String
});
function getMotion$1(_ref) {
let {
prefixCls,
animation,
transitionName: transitionName2
} = _ref;
if (animation) {
return {
name: `${prefixCls}-${animation}`
};
}
if (transitionName2) {
return {
name: transitionName2
};
}
return {};
}
function Mask$2(props2) {
const {
prefixCls,
visible,
zIndex,
mask,
maskAnimation,
maskTransitionName
} = props2;
if (!mask) {
return null;
}
let motion = {};
if (maskTransitionName || maskAnimation) {
motion = getMotion$1({
prefixCls,
transitionName: maskTransitionName,
animation: maskAnimation
});
}
return createVNode(Transition, _objectSpread$W({
"appear": true
}, motion), {
default: () => [withDirectives(createVNode("div", {
"style": {
zIndex
},
"class": `${prefixCls}-mask`
}, null), [[resolveDirective("if"), visible]])]
});
}
Mask$2.displayName = "Mask";
const MobilePopupInner = defineComponent({
compatConfig: {
MODE: 3
},
name: "MobilePopupInner",
inheritAttrs: false,
props: mobileProps,
emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"],
setup(props2, _ref) {
let {
expose,
slots
} = _ref;
const elementRef = ref();
expose({
forceAlign: () => {
},
getElement: () => elementRef.value
});
return () => {
var _a;
const {
zIndex,
visible,
prefixCls,
mobile: {
popupClassName,
popupStyle,
popupMotion = {},
popupRender
} = {}
} = props2;
const mergedStyle = _extends({
zIndex
}, popupStyle);
let childNode = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
if (childNode.length > 1) {
childNode = createVNode("div", {
"class": `${prefixCls}-content`
}, [childNode]);
}
if (popupRender) {
childNode = popupRender(childNode);
}
const mergedClassName = classNames(prefixCls, popupClassName);
return createVNode(Transition, _objectSpread$W({
"ref": elementRef
}, popupMotion), {
default: () => [visible ? createVNode("div", {
"class": mergedClassName,
"style": mergedStyle
}, [childNode]) : null]
});
};
}
});
const useVisibleStatus = ((visible, doMeasure) => {
const status = shallowRef(null);
const rafRef = shallowRef();
const destroyRef = shallowRef(false);
function setStatus(nextStatus) {
if (!destroyRef.value) {
status.value = nextStatus;
}
}
function cancelRaf() {
wrapperRaf.cancel(rafRef.value);
}
function goNextStatus(callback) {
cancelRaf();
rafRef.value = wrapperRaf(() => {
let newStatus = status.value;
switch (status.value) {
case "align":
newStatus = "motion";
break;
case "motion":
newStatus = "stable";
break;
}
setStatus(newStatus);
callback === null || callback === void 0 ? void 0 : callback();
});
}
watch(visible, () => {
setStatus("measure");
}, {
immediate: true,
flush: "post"
});
return [status, goNextStatus];
});
const useStretchStyle = ((stretch) => {
const targetSize = shallowRef({
width: 0,
height: 0
});
function measureStretch(element) {
targetSize.value = {
width: element.offsetWidth,
height: element.offsetHeight
};
}
const style = computed(() => {
const sizeStyle = {};
if (stretch.value) {
const {
width,
height
} = targetSize.value;
if (stretch.value.indexOf("height") !== -1 && height) {
sizeStyle.height = `${height}px`;
} else if (stretch.value.indexOf("minHeight") !== -1 && height) {
sizeStyle.minHeight = `${height}px`;
}
if (stretch.value.indexOf("width") !== -1 && width) {
sizeStyle.width = `${width}px`;
} else if (stretch.value.indexOf("minWidth") !== -1 && width) {
sizeStyle.minWidth = `${width}px`;
}
}
return sizeStyle;
});
return [style, measureStretch];
});
function cloneElement(vnode) {
let nodeProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let override = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
let mergeRef = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
let ele = vnode;
if (Array.isArray(vnode)) {
ele = filterEmpty(vnode)[0];
}
if (!ele) {
return null;
}
const node = cloneVNode(ele, nodeProps, mergeRef);
node.props = override ? _extends(_extends({}, node.props), nodeProps) : node.props;
warning(typeof node.props.class !== "object");
return node;
}
function cloneVNodes(vnodes) {
let nodeProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let override = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
return vnodes.map((vnode) => cloneElement(vnode, nodeProps, override));
}
function deepCloneElement(vnode) {
let nodeProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let override = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
let mergeRef = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
if (Array.isArray(vnode)) {
return vnode.map((item) => deepCloneElement(item, nodeProps, override, mergeRef));
} else {
if (!isVNode(vnode)) {
return vnode;
}
const cloned = cloneElement(vnode, nodeProps, override, mergeRef);
if (Array.isArray(cloned.children)) {
cloned.children = deepCloneElement(cloned.children);
}
return cloned;
}
}
function triggerVNodeUpdate(vm, attrs, dom) {
render(cloneVNode(vm, _extends({}, attrs)), dom);
}
const ensureValidVNode = (slot) => {
return (slot || []).some((child) => {
if (!isVNode(child)) return true;
if (child.type === Comment$1) return false;
if (child.type === Fragment && !ensureValidVNode(child.children)) return false;
return true;
}) ? slot : null;
};
function customRenderSlot(slots, name, props2, fallback) {
var _a;
const slot = (_a = slots[name]) === null || _a === void 0 ? void 0 : _a.call(slots, props2);
if (ensureValidVNode(slot)) {
return slot;
}
return fallback === null || fallback === void 0 ? void 0 : fallback();
}
const isVisible = ((element) => {
if (!element) {
return false;
}
if (element.offsetParent) {
return true;
}
if (element.getBBox) {
const box2 = element.getBBox();
if (box2.width || box2.height) {
return true;
}
}
if (element.getBoundingClientRect) {
const box2 = element.getBoundingClientRect();
if (box2.width || box2.height) {
return true;
}
}
return false;
});
function restoreFocus(activeElement, container) {
if (activeElement !== (void 0).activeElement && contains(container, activeElement) && typeof activeElement.focus === "function") {
activeElement.focus();
}
}
const useBuffer = ((callback, buffer) => {
let called = false;
let timeout = null;
function cancelTrigger() {
clearTimeout(timeout);
}
function trigger(force) {
if (!called || force === true) {
if (callback() === false) {
return;
}
called = true;
cancelTrigger();
timeout = setTimeout(() => {
called = false;
}, buffer.value);
} else {
cancelTrigger();
timeout = setTimeout(() => {
called = false;
trigger();
}, buffer.value);
}
}
return [trigger, () => {
called = false;
cancelTrigger();
}];
});
const alignProps = {
align: Object,
target: [Object, Function],
onAlign: Function,
monitorBufferTime: Number,
monitorWindowResize: Boolean,
disabled: Boolean
};
function getElement(func) {
if (typeof func !== "function") return null;
return func();
}
function getPoint(point) {
if (typeof point !== "object" || !point) return null;
return point;
}
const Align = defineComponent({
compatConfig: {
MODE: 3
},
name: "Align",
props: alignProps,
emits: ["align"],
setup(props2, _ref) {
let {
expose,
slots
} = _ref;
const cacheRef = ref({});
const nodeRef = ref();
const [forceAlign, cancelForceAlign] = useBuffer(() => {
const {
disabled: latestDisabled,
target: latestTarget,
align: latestAlign,
onAlign: latestOnAlign
} = props2;
if (!latestDisabled && latestTarget && nodeRef.value) {
const source = nodeRef.value;
let result;
const element = getElement(latestTarget);
const point = getPoint(latestTarget);
cacheRef.value.element = element;
cacheRef.value.point = point;
cacheRef.value.align = latestAlign;
const {
activeElement
} = void 0;
if (element && isVisible(element)) {
result = alignElement(source, element, latestAlign);
} else if (point) {
result = alignPoint(source, point, latestAlign);
}
restoreFocus(activeElement, source);
if (latestOnAlign && result) {
latestOnAlign(source, result);
}
return true;
}
return false;
}, computed(() => props2.monitorBufferTime));
ref({
cancel: () => {
}
});
ref({
cancel: () => {
}
});
watch(() => props2.disabled, (disabled) => {
if (!disabled) {
forceAlign();
} else {
cancelForceAlign();
}
}, {
immediate: true,
flush: "post"
});
const winResizeRef = ref(null);
watch(() => props2.monitorWindowResize, (monitorWindowResize) => {
if (monitorWindowResize) {
if (!winResizeRef.value) {
winResizeRef.value = addEventListenerWrap(void 0, "resize", forceAlign);
}
} else if (winResizeRef.value) {
winResizeRef.value.remove();
winResizeRef.value = null;
}
}, {
flush: "post"
});
expose({
forceAlign: () => forceAlign(true)
});
return () => {
const child = slots === null || slots === void 0 ? void 0 : slots.default();
if (child) {
return cloneElement(child[0], {
ref: nodeRef
}, true, true);
}
return null;
};
}
});
tuple$1("bottomLeft", "bottomRight", "topLeft", "topRight");
const getTransitionDirection = (placement) => {
if (placement !== void 0 && (placement === "topLeft" || placement === "topRight")) {
return `slide-down`;
}
return `slide-up`;
};
const getTransitionProps = function(transitionName2) {
let opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const transitionProps = transitionName2 ? _extends({
name: transitionName2,
appear: true,
// type: 'animation',
// appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
// appearActiveClass: `antdv-base-transtion`,
// appearToClass: `${transitionName}-appear ${transitionName}-appear-active`,
enterFromClass: `${transitionName2}-enter ${transitionName2}-enter-prepare ${transitionName2}-enter-start`,
enterActiveClass: `${transitionName2}-enter ${transitionName2}-enter-prepare`,
enterToClass: `${transitionName2}-enter ${transitionName2}-enter-active`,
leaveFromClass: ` ${transitionName2}-leave`,
leaveActiveClass: `${transitionName2}-leave ${transitionName2}-leave-active`,
leaveToClass: `${transitionName2}-leave ${transitionName2}-leave-active`
}, opt) : _extends({
css: false
}, opt);
return transitionProps;
};
const getTransitionGroupProps = function(transitionName2) {
let opt = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const transitionProps = transitionName2 ? _extends({
name: transitionName2,
appear: true,
// appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
appearActiveClass: `${transitionName2}`,
appearToClass: `${transitionName2}-appear ${transitionName2}-appear-active`,
enterFromClass: `${transitionName2}-appear ${transitionName2}-enter ${transitionName2}-appear-prepare ${transitionName2}-enter-prepare`,
enterActiveClass: `${transitionName2}`,
enterToClass: `${transitionName2}-enter ${transitionName2}-appear ${transitionName2}-appear-active ${transitionName2}-enter-active`,
leaveActiveClass: `${transitionName2} ${transitionName2}-leave`,
leaveToClass: `${transitionName2}-leave-active`
}, opt) : _extends({
css: false
}, opt);
return transitionProps;
};
const getTransitionName$1 = (rootPrefixCls, motion, transitionName2) => {
if (transitionName2 !== void 0) {
return transitionName2;
}
return `${rootPrefixCls}-${motion}`;
};
const PopupInner = defineComponent({
compatConfig: {
MODE: 3
},
name: "PopupInner",
inheritAttrs: false,
props: innerProps,
emits: ["mouseenter", "mouseleave", "mousedown", "touchstart", "align"],
setup(props2, _ref) {
let {
expose,
attrs,
slots
} = _ref;
const alignRef = shallowRef();
const elementRef = shallowRef();
const alignedClassName = shallowRef();
const [stretchStyle, measureStretchStyle] = useStretchStyle(toRef(props2, "stretch"));
const visible = shallowRef(false);
let timeoutId;
watch(() => props2.visible, (val) => {
clearTimeout(timeoutId);
if (val) {
timeoutId = setTimeout(() => {
visible.value = props2.visible;
});
} else {
visible.value = false;
}
}, {
immediate: true
});
const [status, goNextStatus] = useVisibleStatus(visible);
const prepareResolveRef = shallowRef();
const getAlignTarget = () => {
if (props2.point) {
return props2.point;
}
return props2.getRootDomNode;
};
const forceAlign = () => {
var _a;
(_a = alignRef.value) === null || _a === void 0 ? void 0 : _a.forceAlign();
};
const onInternalAlign = (popupDomNode, matchAlign) => {
var _a;
const nextAlignedClassName = props2.getClassNameFromAlign(matchAlign);
const preAlignedClassName = alignedClassName.value;
if (alignedClassName.value !== nextAlignedClassName) {
alignedClassName.value = nextAlignedClassName;
}
if (status.value === "align") {
if (preAlignedClassName !== nextAlignedClassName) {
Promise.resolve().then(() => {
forceAlign();
});
} else {
goNextStatus(() => {
var _a2;
(_a2 = prepareResolveRef.value) === null || _a2 === void 0 ? void 0 : _a2.call(prepareResolveRef);
});
}
(_a = props2.onAlign) === null || _a === void 0 ? void 0 : _a.call(props2, popupDomNode, matchAlign);
}
};
const motion = computed(() => {
const m = typeof props2.animation === "object" ? props2.animation : getMotion$1(props2);
["onAfterEnter", "onAfterLeave"].forEach((eventName) => {
const originFn = m[eventName];
m[eventName] = (node) => {
goNextStatus();
status.value = "stable";
originFn === null || originFn === void 0 ? void 0 : originFn(node);
};
});
return m;
});
const onShowPrepare = () => {
return new Promise((resolve) => {
prepareResolveRef.value = resolve;
});
};
watch([motion, status], () => {
if (!motion.value && status.value === "motion") {
goNextStatus();
}
}, {
immediate: true
});
expose({
forceAlign,
getElement: () => {
return elementRef.value.$el || elementRef.value;
}
});
const alignDisabled = computed(() => {
var _a;
if (((_a = props2.align) === null || _a === void 0 ? void 0 : _a.points) && (status.value === "align" || status.value === "stable")) {
return false;
}
return true;
});
return () => {
var _a;
const {
zIndex,
align,
prefixCls,
destroyPopupOnHide,
onMouseenter,
onMouseleave,
onTouchstart = () => {
},
onMousedown
} = props2;
const statusValue = status.value;
const mergedStyle = [_extends(_extends({}, stretchStyle.value), {
zIndex,
opacity: statusValue === "motion" || statusValue === "stable" || !visible.value ? null : 0,
// pointerEvents: statusValue === 'stable' ? null : 'none',
pointerEvents: !visible.value && statusValue !== "stable" ? "none" : null
}), attrs.style];
let childNode = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, {
visible: props2.visible
}));
if (childNode.length > 1) {
childNode = createVNode("div", {
"class": `${prefixCls}-content`
}, [childNode]);
}
const mergedClassName = classNames(prefixCls, attrs.class, alignedClassName.value, !props2.arrow && `${prefixCls}-arrow-hidden`);
const hasAnimate = visible.value || !props2.visible;
const transitionProps = hasAnimate ? getTransitionProps(motion.value.name, motion.value) : {};
return createVNode(Transition, _objectSpread$W(_objectSpread$W({
"ref": elementRef
}, transitionProps), {}, {
"onBeforeEnter": onShowPrepare
}), {
default: () => {
return !destroyPopupOnHide || props2.visible ? withDirectives(createVNode(Align, {
"target": getAlignTarget(),
"key": "popup",
"ref": alignRef,
"monitorWindowResize": true,
"disabled": alignDisabled.value,
"align": align,
"onAlign": onInternalAlign
}, {
default: () => createVNode("div", {
"class": mergedClassName,
"onMouseenter": onMouseenter,
"onMouseleave": onMouseleave,
"onMousedown": withModifiers(onMousedown, ["capture"]),
[supportsPassive ? "onTouchstartPassive" : "onTouchstart"]: withModifiers(onTouchstart, ["capture"]),
"style": mergedStyle
}, [childNode])
}), [[vShow, visible.value]]) : null;
}
});
};
}
});
const Popup = defineComponent({
compatConfig: {
MODE: 3
},
name: "Popup",
inheritAttrs: false,
props: popupProps,
setup(props2, _ref) {
let {
attrs,
slots,
expose
} = _ref;
const innerVisible = shallowRef(false);
const inMobile = shallowRef(false);
const popupRef = shallowRef();
const rootRef = shallowRef();
watch([() => props2.visible, () => props2.mobile], () => {
innerVisible.value = props2.visible;
if (props2.visible && props2.mobile) {
inMobile.value = true;
}
}, {
immediate: true,
flush: "post"
});
expose({
forceAlign: () => {
var _a;
(_a = popupRef.value) === null || _a === void 0 ? void 0 : _a.forceAlign();
},
getElement: () => {
var _a;
return (_a = popupRef.value) === null || _a === void 0 ? void 0 : _a.getElement();
}
});
return () => {
const cloneProps = _extends(_extends(_extends({}, props2), attrs), {
visible: innerVisible.value
});
const popupNode = inMobile.value ? createVNode(MobilePopupInner, _objectSpread$W(_objectSpread$W({}, cloneProps), {}, {
"mobile": props2.mobile,
"ref": popupRef
}), {
default: slots.default
}) : createVNode(PopupInner, _objectSpread$W(_objectSpread$W({}, cloneProps), {}, {
"ref": popupRef
}), {
default: slots.default
});
return createVNode("div", {
"ref": rootRef
}, [createVNode(Mask$2, cloneProps, null), popupNode]);
};
}
});
function isPointsEq(a1, a2, isAlignPoint) {
if (isAlignPoint) {
return a1[0] === a2[0];
}
return a1[0] === a2[0] && a1[1] === a2[1];
}
function getAlignFromPlacement(builtinPlacements, placementStr, align) {
const baseAlign = builtinPlacements[placementStr] || {};
return _extends(_extends({}, baseAlign), align);
}
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
const {
points
} = align;
const placements2 = Object.keys(builtinPlacements);
for (let i = 0; i < placements2.length; i += 1) {
const placement = placements2[i];
if (isPointsEq(builtinPlacements[placement].points, points, isAlignPoint)) {
return `${prefixCls}-placement-${placement}`;
}
}
return "";
}
const BaseMixin = {
methods: {
setState() {
let state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
let callback = arguments.length > 1 ? arguments[1] : void 0;
let newState = typeof state === "function" ? state(this.$data, this.$props) : state;
if (this.getDerivedStateFromProps) {
const s = this.getDerivedStateFromProps(getOptionProps(this), _extends(_extends({}, this.$data), newState));
if (s === null) {
return;
} else {
newState = _extends(_extends({}, newState), s || {});
}
}
_extends(this.$data, newState);
if (this._.isMounted) {
this.$forceUpdate();
}
nextTick(() => {
callback && callback();
});
},
__emit() {
const args = [].slice.call(arguments, 0);
let eventName = args[0];
eventName = `on${eventName[0].toUpperCase()}${eventName.substring(1)}`;
const event = this.$props[eventName] || this.$attrs[eventName];
if (args.length && event) {
if (Array.isArray(event)) {
for (let i = 0, l = event.length; i < l; i++) {
event[i](...args.slice(1));
}
} else {
event(...args.slice(1));
}
}
}
}
};
const PortalContextKey = Symbol("PortalContextKey");
const useProvidePortal = function(instance) {
let config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
inTriggerContext: true
};
provide(PortalContextKey, {
inTriggerContext: config.inTriggerContext,
shouldRender: computed(() => {
const {
sPopupVisible,
popupRef,
forceRender,
autoDestroy
} = instance || {};
let shouldRender = false;
if (sPopupVisible || popupRef || forceRender) {
shouldRender = true;
}
if (!sPopupVisible && autoDestroy) {
shouldRender = false;
}
return shouldRender;
})
});
};
const useInjectPortal = () => {
useProvidePortal({}, {
inTriggerContext: false
});
const portalContext = inject(PortalContextKey, {
shouldRender: computed(() => false),
inTriggerContext: false
});
return {
shouldRender: computed(() => portalContext.shouldRender.value || portalContext.inTriggerContext === false)
};
};
const Portal$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Portal",
inheritAttrs: false,
props: {
getContainer: PropTypes.func.isRequired,
didUpdate: Function
},
setup(props2, _ref) {
let {
slots
} = _ref;
let container;
const {
shouldRender
} = useInjectPortal();
const stopWatch = watch(shouldRender, () => {
if (shouldRender.value && !container) {
container = props2.getContainer();
}
if (container) {
stopWatch();
}
});
return () => {
var _a;
if (!shouldRender.value) return null;
{
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
}
};
}
});
function getScrollBarSize(fresh) {
{
return 0;
}
}
function useScrollLocker(lock) {
computed(() => !!lock && !!lock.value);
watchEffect((onClear) => {
{
return;
}
}, {
flush: "post"
});
}
let openCount = 0;
const Portal = defineComponent({
compatConfig: {
MODE: 3
},
name: "PortalWrapper",
inheritAttrs: false,
props: {
wrapperClassName: String,
forceRender: {
type: Boolean,
default: void 0
},
getContainer: PropTypes.any,
visible: {
type: Boolean,
default: void 0
},
autoLock: booleanType(),
didUpdate: Function
},
setup(props2, _ref) {
let {
slots
} = _ref;
shallowRef();
const componentRef = shallowRef();
shallowRef();
const triggerUpdate = shallowRef(1);
const getContainer2 = () => {
{
return null;
}
};
useScrollLocker(computed(() => {
return props2.autoLock && props2.visible && canUseDom();
}));
return () => {
const {
forceRender,
visible
} = props2;
let portal = null;
const childProps = {
getOpenCount: () => openCount,
getContainer: getContainer2
};
if (triggerUpdate.value && (forceRender || visible || componentRef.value)) {
portal = createVNode(Portal$1, {
"getContainer": getContainer2,
"ref": componentRef,
"didUpdate": props2.didUpdate
}, {
default: () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, childProps);
}
});
}
return portal;
};
}
});
const ALL_HANDLERS = ["onClick", "onMousedown", "onTouchstart", "onMouseenter", "onMouseleave", "onFocus", "onBlur", "onContextmenu"];
const Trigger = defineComponent({
compatConfig: {
MODE: 3
},
name: "Trigger",
mixins: [BaseMixin],
inheritAttrs: false,
props: triggerProps(),
setup(props2) {
const align = computed(() => {
const {
popupPlacement,
popupAlign,
builtinPlacements
} = props2;
if (popupPlacement && builtinPlacements) {
return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);
}
return popupAlign;
});
const popupRef = shallowRef(null);
const setPopupRef = (val) => {
popupRef.value = val;
};
return {
vcTriggerContext: inject("vcTriggerContext", {}),
popupRef,
setPopupRef,
triggerRef: shallowRef(null),
align,
focusTime: null,
clickOutsideHandler: null,
contextmenuOutsideHandler1: null,
contextmenuOutsideHandler2: null,
touchOutsideHandler: null,
attachId: null,
delayTimer: null,
hasPopupMouseDown: false,
preClickTime: null,
preTouchTime: null,
mouseDownTimeout: null,
childOriginEvents: {}
};
},
data() {
const props2 = this.$props;
let popupVisible;
if (this.popupVisible !== void 0) {
popupVisible = !!props2.popupVisible;
} else {
popupVisible = !!props2.defaultPopupVisible;
}
ALL_HANDLERS.forEach((h2) => {
this[`fire${h2}`] = (e) => {
this.fireEvents(h2, e);
};
});
return {
prevPopupVisible: popupVisible,
sPopupVisible: popupVisible,
point: null
};
},
watch: {
popupVisible(val) {
if (val !== void 0) {
this.prevPopupVisible = this.sPopupVisible;
this.sPopupVisible = val;
}
}
},
created() {
provide("vcTriggerContext", {
onPopupMouseDown: this.onPopupMouseDown,
onPopupMouseenter: this.onPopupMouseenter,
onPopupMouseleave: this.onPopupMouseleave
});
useProvidePortal(this);
},
deactivated() {
this.setPopupVisible(false);
},
mounted() {
this.$nextTick(() => {
this.updatedCal();
});
},
updated() {
this.$nextTick(() => {
this.updatedCal();
});
},
beforeUnmount() {
this.clearDelayTimer();
this.clearOutsideHandler();
clearTimeout(this.mouseDownTimeout);
wrapperRaf.cancel(this.attachId);
},
methods: {
updatedCal() {
const props2 = this.$props;
const state = this.$data;
if (state.sPopupVisible) {
let currentDocument;
if (!this.clickOutsideHandler && (this.isClickToHide() || this.isContextmenuToShow())) {
currentDocument = props2.getDocument(this.getRootDomNode());
this.clickOutsideHandler = addEventListenerWrap(currentDocument, "mousedown", this.onDocumentClick);
}
if (!this.touchOutsideHandler) {
currentDocument = currentDocument || props2.getDocument(this.getRootDomNode());
this.touchOutsideHandler = addEventListenerWrap(currentDocument, "touchstart", this.onDocumentClick, supportsPassive ? {
passive: false
} : false);
}
if (!this.contextmenuOutsideHandler1 && this.isContextmenuToShow()) {
currentDocument = currentDocument || props2.getDocument(this.getRootDomNode());
this.contextmenuOutsideHandler1 = addEventListenerWrap(currentDocument, "scroll", this.onContextmenuClose);
}
if (!this.contextmenuOutsideHandler2 && this.isContextmenuToShow()) {
this.contextmenuOutsideHandler2 = addEventListenerWrap(void 0, "blur", this.onContextmenuClose);
}
} else {
this.clearOutsideHandler();
}
},
onMouseenter(e) {
const {
mouseEnterDelay
} = this.$props;
this.fireEvents("onMouseenter", e);
this.delaySetPopupVisible(true, mouseEnterDelay, mouseEnterDelay ? null : e);
},
onMouseMove(e) {
this.fireEvents("onMousemove", e);
this.setPoint(e);
},
onMouseleave(e) {
this.fireEvents("onMouseleave", e);
this.delaySetPopupVisible(false, this.$props.mouseLeaveDelay);
},
onPopupMouseenter() {
const {
vcTriggerContext = {}
} = this;
if (vcTriggerContext.onPopupMouseenter) {
vcTriggerContext.onPopupMouseenter();
}
this.clearDelayTimer();
},
onPopupMouseleave(e) {
var _a;
if (e && e.relatedTarget && !e.relatedTarget.setTimeout && contains((_a = this.popupRef) === null || _a === void 0 ? void 0 : _a.getElement(), e.relatedTarget)) {
return;
}
if (this.isMouseLeaveToHide()) {
this.delaySetPopupVisible(false, this.$props.mouseLeaveDelay);
}
const {
vcTriggerContext = {}
} = this;
if (vcTriggerContext.onPopupMouseleave) {
vcTriggerContext.onPopupMouseleave(e);
}
},
onFocus(e) {
this.fireEvents("onFocus", e);
this.clearDelayTimer();
if (this.isFocusToShow()) {
this.focusTime = Date.now();
this.delaySetPopupVisible(true, this.$props.focusDelay);
}
},
onMousedown(e) {
this.fireEvents("onMousedown", e);
this.preClickTime = Date.now();
},
onTouchstart(e) {
this.fireEvents("onTouchstart", e);
this.preTouchTime = Date.now();
},
onBlur(e) {
if (!contains(e.target, e.relatedTarget || (void 0).activeElement)) {
this.fireEvents("onBlur", e);
this.clearDelayTimer();
if (this.isBlurToHide()) {
this.delaySetPopupVisible(false, this.$props.blurDelay);
}
}
},
onContextmenu(e) {
e.preventDefault();
this.fireEvents("onContextmenu", e);
this.setPopupVisible(true, e);
},
onContextmenuClose() {
if (this.isContextmenuToShow()) {
this.close();
}
},
onClick(event) {
this.fireEvents("onClick", event);
if (this.focusTime) {
let preTime;
if (this.preClickTime && this.preTouchTime) {
preTime = Math.min(this.preClickTime, this.preTouchTime);
} else if (this.preClickTime) {
preTime = this.preClickTime;
} else if (this.preTouchTime) {
preTime = this.preTouchTime;
}
if (Math.abs(preTime - this.focusTime) < 20) {
return;
}
this.focusTime = 0;
}
this.preClickTime = 0;
this.preTouchTime = 0;
if (this.isClickToShow() && (this.isClickToHide() || this.isBlurToHide()) && event && event.preventDefault) {
event.preventDefault();
}
if (event && event.domEvent) {
event.domEvent.preventDefault();
}
const nextVisible = !this.$data.sPopupVisible;
if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) {
this.setPopupVisible(!this.$data.sPopupVisible, event);
}
},
onPopupMouseDown() {
const {
vcTriggerContext = {}
} = this;
this.hasPopupMouseDown = true;
clearTimeout(this.mouseDownTimeout);
this.mouseDownTimeout = setTimeout(() => {
this.hasPopupMouseDown = false;
}, 0);
if (vcTriggerContext.onPopupMouseDown) {
vcTriggerContext.onPopupMouseDown(...arguments);
}
},
onDocumentClick(event) {
if (this.$props.mask && !this.$props.maskClosable) {
return;
}
const target = event.target;
const root = this.getRootDomNode();
const popupNode = this.getPopupDomNode();
if (
// mousedown on the target should also close popup when action is contextMenu.
// https://github.com/ant-design/ant-design/issues/29853
(!contains(root, target) || this.isContextMenuOnly()) && !contains(popupNode, target) && !this.hasPopupMouseDown
) {
this.delaySetPopupVisible(false, 0.1);
}
},
getPopupDomNode() {
var _a;
return ((_a = this.popupRef) === null || _a === void 0 ? void 0 : _a.getElement()) || null;
},
getRootDomNode() {
var _a, _b, _c, _d;
const {
getTriggerDOMNode
} = this.$props;
if (getTriggerDOMNode) {
const domNode = ((_b = (_a = this.triggerRef) === null || _a === void 0 ? void 0 : _a.$el) === null || _b === void 0 ? void 0 : _b.nodeName) === "#comment" ? null : findDOMNode(this.triggerRef);
return findDOMNode(getTriggerDOMNode(domNode));
}
try {
const domNode = ((_d = (_c = this.triggerRef) === null || _c === void 0 ? void 0 : _c.$el) === null || _d === void 0 ? void 0 : _d.nodeName) === "#comment" ? null : findDOMNode(this.triggerRef);
if (domNode) {
return domNode;
}
} catch (err) {
}
return findDOMNode(this);
},
handleGetPopupClassFromAlign(align) {
const className = [];
const props2 = this.$props;
const {
popupPlacement,
builtinPlacements,
prefixCls,
alignPoint: alignPoint2,
getPopupClassNameFromAlign
} = props2;
if (popupPlacement && builtinPlacements) {
className.push(getAlignPopupClassName(builtinPlacements, prefixCls, align, alignPoint2));
}
if (getPopupClassNameFromAlign) {
className.push(getPopupClassNameFromAlign(align));
}
return className.join(" ");
},
getPopupAlign() {
const props2 = this.$props;
const {
popupPlacement,
popupAlign,
builtinPlacements
} = props2;
if (popupPlacement && builtinPlacements) {
return getAlignFromPlacement(builtinPlacements, popupPlacement, popupAlign);
}
return popupAlign;
},
getComponent() {
const mouseProps = {};
if (this.isMouseEnterToShow()) {
mouseProps.onMouseenter = this.onPopupMouseenter;
}
if (this.isMouseLeaveToHide()) {
mouseProps.onMouseleave = this.onPopupMouseleave;
}
mouseProps.onMousedown = this.onPopupMouseDown;
mouseProps[supportsPassive ? "onTouchstartPassive" : "onTouchstart"] = this.onPopupMouseDown;
const {
handleGetPopupClassFromAlign,
getRootDomNode,
$attrs
} = this;
const {
prefixCls,
destroyPopupOnHide,
popupClassName,
popupAnimation,
popupTransitionName,
popupStyle,
mask,
maskAnimation,
maskTransitionName,
zIndex,
stretch,
alignPoint: alignPoint2,
mobile,
arrow,
forceRender
} = this.$props;
const {
sPopupVisible,
point
} = this.$data;
const popupProps2 = _extends(_extends({
prefixCls,
arrow,
destroyPopupOnHide,
visible: sPopupVisible,
point: alignPoint2 ? point : null,
align: this.align,
animation: popupAnimation,
getClassNameFromAlign: handleGetPopupClassFromAlign,
stretch,
getRootDomNode,
mask,
zIndex,
transitionName: popupTransitionName,
maskAnimation,
maskTransitionName,
class: popupClassName,
style: popupStyle,
onAlign: $attrs.onPopupAlign || noop$a
}, mouseProps), {
ref: this.setPopupRef,
mobile,
forceRender
});
return createVNode(Popup, popupProps2, {
default: this.$slots.popup || (() => getComponent(this, "popup"))
});
},
attachParent(popupContainer) {
wrapperRaf.cancel(this.attachId);
const {
getPopupContainer,
getDocument
} = this.$props;
const domNode = this.getRootDomNode();
let mountNode;
if (!getPopupContainer) {
mountNode = getDocument(this.getRootDomNode()).body;
} else if (domNode || getPopupContainer.length === 0) {
mountNode = getPopupContainer(domNode);
}
if (mountNode) {
mountNode.appendChild(popupContainer);
} else {
this.attachId = wrapperRaf(() => {
this.attachParent(popupContainer);
});
}
},
getContainer() {
const {
$props: props2
} = this;
const {
getDocument
} = props2;
const popupContainer = getDocument(this.getRootDomNode()).createElement("div");
popupContainer.style.position = "absolute";
popupContainer.style.top = "0";
popupContainer.style.left = "0";
popupContainer.style.width = "100%";
this.attachParent(popupContainer);
return popupContainer;
},
setPopupVisible(sPopupVisible, event) {
const {
alignPoint: alignPoint2,
sPopupVisible: prevPopupVisible,
onPopupVisibleChange
} = this;
this.clearDelayTimer();
if (prevPopupVisible !== sPopupVisible) {
if (!hasProp(this, "popupVisible")) {
this.setState({
sPopupVisible,
prevPopupVisible
});
}
onPopupVisibleChange && onPopupVisibleChange(sPopupVisible);
}
if (alignPoint2 && event && sPopupVisible) {
this.setPoint(event);
}
},
setPoint(point) {
const {
alignPoint: alignPoint2
} = this.$props;
if (!alignPoint2 || !point) return;
this.setState({
point: {
pageX: point.pageX,
pageY: point.pageY
}
});
},
handlePortalUpdate() {
if (this.prevPopupVisible !== this.sPopupVisible) {
this.afterPopupVisibleChange(this.sPopupVisible);
}
},
delaySetPopupVisible(visible, delayS, event) {
const delay = delayS * 1e3;
this.clearDelayTimer();
if (delay) {
const point = event ? {
pageX: event.pageX,
pageY: event.pageY
} : null;
this.delayTimer = setTimeout(() => {
this.setPopupVisible(visible, point);
this.clearDelayTimer();
}, delay);
} else {
this.setPopupVisible(visible, event);
}
},
clearDelayTimer() {
if (this.delayTimer) {
clearTimeout(this.delayTimer);
this.delayTimer = null;
}
},
clearOutsideHandler() {
if (this.clickOutsideHandler) {
this.clickOutsideHandler.remove();
this.clickOutsideHandler = null;
}
if (this.contextmenuOutsideHandler1) {
this.contextmenuOutsideHandler1.remove();
this.contextmenuOutsideHandler1 = null;
}
if (this.contextmenuOutsideHandler2) {
this.contextmenuOutsideHandler2.remove();
this.contextmenuOutsideHandler2 = null;
}
if (this.touchOutsideHandler) {
this.touchOutsideHandler.remove();
this.touchOutsideHandler = null;
}
},
createTwoChains(event) {
let fn = () => {
};
const events2 = getEvents(this);
if (this.childOriginEvents[event] && events2[event]) {
return this[`fire${event}`];
}
fn = this.childOriginEvents[event] || events2[event] || fn;
return fn;
},
isClickToShow() {
const {
action,
showAction
} = this.$props;
return action.indexOf("click") !== -1 || showAction.indexOf("click") !== -1;
},
isContextMenuOnly() {
const {
action
} = this.$props;
return action === "contextmenu" || action.length === 1 && action[0] === "contextmenu";
},
isContextmenuToShow() {
const {
action,
showAction
} = this.$props;
return action.indexOf("contextmenu") !== -1 || showAction.indexOf("contextmenu") !== -1;
},
isClickToHide() {
const {
action,
hideAction
} = this.$props;
return action.indexOf("click") !== -1 || hideAction.indexOf("click") !== -1;
},
isMouseEnterToShow() {
const {
action,
showAction
} = this.$props;
return action.indexOf("hover") !== -1 || showAction.indexOf("mouseenter") !== -1;
},
isMouseLeaveToHide() {
const {
action,
hideAction
} = this.$props;
return action.indexOf("hover") !== -1 || hideAction.indexOf("mouseleave") !== -1;
},
isFocusToShow() {
const {
action,
showAction
} = this.$props;
return action.indexOf("focus") !== -1 || showAction.indexOf("focus") !== -1;
},
isBlurToHide() {
const {
action,
hideAction
} = this.$props;
return action.indexOf("focus") !== -1 || hideAction.indexOf("blur") !== -1;
},
forcePopupAlign() {
var _a;
if (this.$data.sPopupVisible) {
(_a = this.popupRef) === null || _a === void 0 ? void 0 : _a.forceAlign();
}
},
fireEvents(type, e) {
if (this.childOriginEvents[type]) {
this.childOriginEvents[type](e);
}
const event = this.$props[type] || this.$attrs[type];
if (event) {
event(e);
}
},
close() {
this.setPopupVisible(false);
}
},
render() {
const {
$attrs
} = this;
const children = filterEmpty(getSlot(this));
const {
alignPoint: alignPoint2,
getPopupContainer
} = this.$props;
const child = children[0];
this.childOriginEvents = getEvents(child);
const newChildProps = {
key: "trigger"
};
if (this.isContextmenuToShow()) {
newChildProps.onContextmenu = this.onContextmenu;
} else {
newChildProps.onContextmenu = this.createTwoChains("onContextmenu");
}
if (this.isClickToHide() || this.isClickToShow()) {
newChildProps.onClick = this.onClick;
newChildProps.onMousedown = this.onMousedown;
newChildProps[supportsPassive ? "onTouchstartPassive" : "onTouchstart"] = this.onTouchstart;
} else {
newChildProps.onClick = this.createTwoChains("onClick");
newChildProps.onMousedown = this.createTwoChains("onMousedown");
newChildProps[supportsPassive ? "onTouchstartPassive" : "onTouchstart"] = this.createTwoChains("onTouchstart");
}
if (this.isMouseEnterToShow()) {
newChildProps.onMouseenter = this.onMouseenter;
if (alignPoint2) {
newChildProps.onMousemove = this.onMouseMove;
}
} else {
newChildProps.onMouseenter = this.createTwoChains("onMouseenter");
}
if (this.isMouseLeaveToHide()) {
newChildProps.onMouseleave = this.onMouseleave;
} else {
newChildProps.onMouseleave = this.createTwoChains("onMouseleave");
}
if (this.isFocusToShow() || this.isBlurToHide()) {
newChildProps.onFocus = this.onFocus;
newChildProps.onBlur = this.onBlur;
} else {
newChildProps.onFocus = this.createTwoChains("onFocus");
newChildProps.onBlur = (e) => {
if (e && (!e.relatedTarget || !contains(e.target, e.relatedTarget))) {
this.createTwoChains("onBlur")(e);
}
};
}
const childrenClassName = classNames(child && child.props && child.props.class, $attrs.class);
if (childrenClassName) {
newChildProps.class = childrenClassName;
}
const trigger = cloneElement(child, _extends(_extends({}, newChildProps), {
ref: "triggerRef"
}), true, true);
const portal = createVNode(Portal, {
"key": "portal",
"getContainer": getPopupContainer && (() => getPopupContainer(this.getRootDomNode())),
"didUpdate": this.handlePortalUpdate,
"visible": this.$data.sPopupVisible
}, {
default: this.getComponent
});
return createVNode(Fragment, null, [trigger, portal]);
}
});
var __rest$1f = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const getBuiltInPlacements = (dropdownMatchSelectWidth) => {
const adjustX = dropdownMatchSelectWidth === true ? 0 : 1;
return {
bottomLeft: {
points: ["tl", "bl"],
offset: [0, 4],
overflow: {
adjustX,
adjustY: 1
}
},
bottomRight: {
points: ["tr", "br"],
offset: [0, 4],
overflow: {
adjustX,
adjustY: 1
}
},
topLeft: {
points: ["bl", "tl"],
offset: [0, -4],
overflow: {
adjustX,
adjustY: 1
}
},
topRight: {
points: ["br", "tr"],
offset: [0, -4],
overflow: {
adjustX,
adjustY: 1
}
}
};
};
const SelectTrigger = defineComponent({
name: "SelectTrigger",
inheritAttrs: false,
props: {
dropdownAlign: Object,
visible: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
dropdownClassName: String,
dropdownStyle: PropTypes.object,
placement: String,
empty: {
type: Boolean,
default: void 0
},
prefixCls: String,
popupClassName: String,
animation: String,
transitionName: String,
getPopupContainer: Function,
dropdownRender: Function,
containerWidth: Number,
dropdownMatchSelectWidth: PropTypes.oneOfType([Number, Boolean]).def(true),
popupElement: PropTypes.any,
direction: String,
getTriggerDOMNode: Function,
onPopupVisibleChange: Function,
onPopupMouseEnter: Function,
onPopupFocusin: Function,
onPopupFocusout: Function
},
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
const builtInPlacements = computed(() => {
const {
dropdownMatchSelectWidth
} = props2;
return getBuiltInPlacements(dropdownMatchSelectWidth);
});
const popupRef = ref();
expose({
getPopupElement: () => {
return popupRef.value;
}
});
return () => {
const _a = _extends(_extends({}, props2), attrs), {
empty: empty2 = false
} = _a, restProps = __rest$1f(_a, ["empty"]);
const {
visible,
dropdownAlign,
prefixCls,
popupElement,
dropdownClassName,
dropdownStyle,
direction = "ltr",
placement,
dropdownMatchSelectWidth,
containerWidth,
dropdownRender,
animation,
transitionName: transitionName2,
getPopupContainer,
getTriggerDOMNode,
onPopupVisibleChange,
onPopupMouseEnter,
onPopupFocusin,
onPopupFocusout
} = restProps;
const dropdownPrefixCls = `${prefixCls}-dropdown`;
let popupNode = popupElement;
if (dropdownRender) {
popupNode = dropdownRender({
menuNode: popupElement,
props: props2
});
}
const mergedTransitionName = animation ? `${dropdownPrefixCls}-${animation}` : transitionName2;
const popupStyle = _extends({
minWidth: `${containerWidth}px`
}, dropdownStyle);
if (typeof dropdownMatchSelectWidth === "number") {
popupStyle.width = `${dropdownMatchSelectWidth}px`;
} else if (dropdownMatchSelectWidth) {
popupStyle.width = `${containerWidth}px`;
}
return createVNode(Trigger, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"showAction": onPopupVisibleChange ? ["click"] : [],
"hideAction": onPopupVisibleChange ? ["click"] : [],
"popupPlacement": placement || (direction === "rtl" ? "bottomRight" : "bottomLeft"),
"builtinPlacements": builtInPlacements.value,
"prefixCls": dropdownPrefixCls,
"popupTransitionName": mergedTransitionName,
"popupAlign": dropdownAlign,
"popupVisible": visible,
"getPopupContainer": getPopupContainer,
"popupClassName": classNames(dropdownClassName, {
[`${dropdownPrefixCls}-empty`]: empty2
}),
"popupStyle": popupStyle,
"getTriggerDOMNode": getTriggerDOMNode,
"onPopupVisibleChange": onPopupVisibleChange
}), {
default: slots.default,
popup: () => createVNode("div", {
"ref": popupRef,
"onMouseenter": onPopupMouseEnter,
"onFocusin": onPopupFocusin,
"onFocusout": onPopupFocusout
}, [popupNode])
});
};
}
});
const KeyCode = {
/**
* BACKSPACE
*/
BACKSPACE: 8,
/**
* TAB
*/
TAB: 9,
/**
* ENTER
*/
ENTER: 13,
/**
* SHIFT
*/
SHIFT: 16,
/**
* CTRL
*/
CTRL: 17,
/**
* ALT
*/
ALT: 18,
/**
* CAPS_LOCK
*/
CAPS_LOCK: 20,
/**
* ESC
*/
ESC: 27,
/**
* SPACE
*/
SPACE: 32,
/**
* PAGE_UP
*/
PAGE_UP: 33,
/**
* PAGE_DOWN
*/
PAGE_DOWN: 34,
/**
* END
*/
END: 35,
/**
* HOME
*/
HOME: 36,
/**
* LEFT
*/
LEFT: 37,
/**
* UP
*/
UP: 38,
/**
* RIGHT
*/
RIGHT: 39,
/**
* DOWN
*/
DOWN: 40,
/**
* N
*/
N: 78,
/**
* P
*/
P: 80,
/**
* META
*/
META: 91,
/**
* WIN_KEY_RIGHT
*/
WIN_KEY_RIGHT: 92,
/**
* CONTEXT_MENU
*/
CONTEXT_MENU: 93,
/**
* F1
*/
F1: 112,
/**
* F2
*/
F2: 113,
/**
* F3
*/
F3: 114,
/**
* F4
*/
F4: 115,
/**
* F5
*/
F5: 116,
/**
* F6
*/
F6: 117,
/**
* F7
*/
F7: 118,
/**
* F8
*/
F8: 119,
/**
* F9
*/
F9: 120,
/**
* F10
*/
F10: 121,
/**
* F11
*/
F11: 122,
/**
* F12
*/
F12: 123,
/**
* SEMICOLON
*/
SEMICOLON: 186,
/**
* EQUALS
*/
EQUALS: 187,
/**
* WIN_KEY
*/
WIN_KEY: 224
};
const TransBtn = (props2, _ref) => {
let {
slots
} = _ref;
var _a;
const {
class: className,
customizeIcon,
customizeIconProps,
onMousedown,
onClick
} = props2;
let icon;
if (typeof customizeIcon === "function") {
icon = customizeIcon(customizeIconProps);
} else {
icon = isVNode(customizeIcon) ? cloneVNode(customizeIcon) : customizeIcon;
}
return createVNode("span", {
"class": className,
"onMousedown": (event) => {
event.preventDefault();
if (onMousedown) {
onMousedown(event);
}
},
"style": {
userSelect: "none",
WebkitUserSelect: "none"
},
"unselectable": "on",
"onClick": onClick,
"aria-hidden": true
}, [icon !== void 0 ? icon : createVNode("span", {
"class": className.split(/\s+/).map((cls) => `${cls}-icon`)
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])]);
};
TransBtn.inheritAttrs = false;
TransBtn.displayName = "TransBtn";
TransBtn.props = {
class: String,
customizeIcon: PropTypes.any,
customizeIconProps: PropTypes.any,
onMousedown: Function,
onClick: Function
};
var __rest$1e = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const BaseInputInner = defineComponent({
compatConfig: {
MODE: 3
},
// inheritAttrs: false,
props: {
disabled: PropTypes.looseBool,
type: PropTypes.string,
value: PropTypes.any,
tag: {
type: String,
default: "input"
},
size: PropTypes.string,
onChange: Function,
onInput: Function,
onBlur: Function,
onFocus: Function,
onKeydown: Function,
onCompositionstart: Function,
onCompositionend: Function,
onKeyup: Function,
onPaste: Function,
onMousedown: Function
},
emits: ["change", "input", "blur", "keydown", "focus", "compositionstart", "compositionend", "keyup", "paste", "mousedown"],
setup(props2, _ref) {
let {
expose
} = _ref;
const inputRef = shallowRef(null);
const focus = () => {
if (inputRef.value) {
inputRef.value.focus();
}
};
const blur = () => {
if (inputRef.value) {
inputRef.value.blur();
}
};
const setSelectionRange = (start, end, direction) => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.setSelectionRange(start, end, direction);
};
const select = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.select();
};
expose({
focus,
blur,
input: inputRef,
setSelectionRange,
select,
getSelectionStart: () => {
var _a;
return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.selectionStart;
},
getSelectionEnd: () => {
var _a;
return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.selectionEnd;
},
getScrollTop: () => {
var _a;
return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.scrollTop;
}
});
return () => {
const {
tag: Tag2,
value
} = props2, restProps = __rest$1e(props2, ["tag", "value"]);
return createVNode(Tag2, _objectSpread$W(_objectSpread$W({}, restProps), {}, {
"ref": inputRef,
"value": value
}), null);
};
}
});
function getOffset$2(node) {
const box2 = node.getBoundingClientRect();
const docElem = (void 0).documentElement;
return {
left: box2.left + ((void 0).scrollX || docElem.scrollLeft) - (docElem.clientLeft || (void 0).body.clientLeft || 0),
top: box2.top + ((void 0).scrollY || docElem.scrollTop) - (docElem.clientTop || (void 0).body.clientTop || 0)
};
}
function styleToString(style) {
const styleNames = Array.prototype.slice.apply(style);
return styleNames.map((name) => `${name}: ${style.getPropertyValue(name)};`).join("");
}
function styleObjectToString(style) {
return Object.keys(style).reduce((acc, name) => {
const styleValue = style[name];
if (typeof styleValue === "undefined" || styleValue === null) {
return acc;
}
acc += `${name}: ${style[name]};`;
return acc;
}, "");
}
var __rest$1d = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const BaseInput$1 = defineComponent({
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: {
disabled: PropTypes.looseBool,
type: PropTypes.string,
value: PropTypes.any,
lazy: PropTypes.bool.def(true),
tag: {
type: String,
default: "input"
},
size: PropTypes.string,
style: PropTypes.oneOfType([String, Object]),
class: PropTypes.string
},
emits: ["change", "input", "blur", "keydown", "focus", "compositionstart", "compositionend", "keyup", "paste", "mousedown"],
setup(props2, _ref) {
let {
emit,
attrs,
expose
} = _ref;
const inputRef = shallowRef(null);
const renderValue = ref();
const isComposing = ref(false);
watch([() => props2.value, isComposing], () => {
if (isComposing.value) return;
renderValue.value = props2.value;
}, {
immediate: true
});
const handleChange = (e) => {
emit("change", e);
};
const onCompositionstart = (e) => {
isComposing.value = true;
e.target.composing = true;
emit("compositionstart", e);
};
const onCompositionend = (e) => {
isComposing.value = false;
e.target.composing = false;
emit("compositionend", e);
const event = (void 0).createEvent("HTMLEvents");
event.initEvent("input", true, true);
e.target.dispatchEvent(event);
handleChange(e);
};
const handleInput = (e) => {
if (isComposing.value && props2.lazy) {
renderValue.value = e.target.value;
return;
}
emit("input", e);
};
const handleBlur = (e) => {
emit("blur", e);
};
const handleFocus = (e) => {
emit("focus", e);
};
const focus = () => {
if (inputRef.value) {
inputRef.value.focus();
}
};
const blur = () => {
if (inputRef.value) {
inputRef.value.blur();
}
};
const handleKeyDown = (e) => {
emit("keydown", e);
};
const handleKeyUp = (e) => {
emit("keyup", e);
};
const setSelectionRange = (start, end, direction) => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.setSelectionRange(start, end, direction);
};
const select = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.select();
};
expose({
focus,
blur,
input: computed(() => {
var _a;
return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.input;
}),
setSelectionRange,
select,
getSelectionStart: () => {
var _a;
return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.getSelectionStart();
},
getSelectionEnd: () => {
var _a;
return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.getSelectionEnd();
},
getScrollTop: () => {
var _a;
return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.getScrollTop();
}
});
const handleMousedown = (e) => {
emit("mousedown", e);
};
const handlePaste = (e) => {
emit("paste", e);
};
const styleString = computed(() => {
return props2.style && typeof props2.style !== "string" ? styleObjectToString(props2.style) : props2.style;
});
return () => {
const {
style,
lazy
} = props2, restProps = __rest$1d(props2, ["style", "lazy"]);
return createVNode(BaseInputInner, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, restProps), attrs), {}, {
"style": styleString.value,
"onInput": handleInput,
"onChange": handleChange,
"onBlur": handleBlur,
"onFocus": handleFocus,
"ref": inputRef,
"value": renderValue.value,
"onCompositionstart": onCompositionstart,
"onCompositionend": onCompositionend,
"onKeyup": handleKeyUp,
"onKeydown": handleKeyDown,
"onPaste": handlePaste,
"onMousedown": handleMousedown
}), null);
};
}
});
const inputProps$2 = {
inputRef: PropTypes.any,
prefixCls: String,
id: String,
inputElement: PropTypes.VueNode,
disabled: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
autocomplete: String,
editable: {
type: Boolean,
default: void 0
},
activeDescendantId: String,
value: String,
open: {
type: Boolean,
default: void 0
},
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/** Pass accessibility props to input */
attrs: PropTypes.object,
onKeydown: {
type: Function
},
onMousedown: {
type: Function
},
onChange: {
type: Function
},
onPaste: {
type: Function
},
onCompositionstart: {
type: Function
},
onCompositionend: {
type: Function
},
onFocus: {
type: Function
},
onBlur: {
type: Function
}
};
const Input$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "SelectInput",
inheritAttrs: false,
props: inputProps$2,
setup(props2) {
let blurTimeout = null;
const VCSelectContainerEvent = inject("VCSelectContainerEvent");
return () => {
var _a;
const {
prefixCls,
id,
inputElement,
disabled,
tabindex,
autofocus,
autocomplete,
editable,
activeDescendantId,
value,
onKeydown,
onMousedown,
onChange,
onPaste,
onCompositionstart,
onCompositionend,
onFocus,
onBlur,
open: open2,
inputRef,
attrs
} = props2;
let inputNode = inputElement || createVNode(BaseInput$1, null, null);
const inputProps2 = inputNode.props || {};
const {
onKeydown: onOriginKeyDown,
onInput: onOriginInput,
onFocus: onOriginFocus,
onBlur: onOriginBlur,
onMousedown: onOriginMouseDown,
onCompositionstart: onOriginCompositionStart,
onCompositionend: onOriginCompositionEnd,
style
} = inputProps2;
inputNode = cloneElement(inputNode, _extends(_extends(_extends(_extends(_extends({
type: "search"
}, inputProps2), {
id,
ref: inputRef,
disabled,
tabindex,
lazy: false,
autocomplete: autocomplete || "off",
autofocus,
class: classNames(`${prefixCls}-selection-search-input`, (_a = inputNode === null || inputNode === void 0 ? void 0 : inputNode.props) === null || _a === void 0 ? void 0 : _a.class),
role: "combobox",
"aria-expanded": open2,
"aria-haspopup": "listbox",
"aria-owns": `${id}_list`,
"aria-autocomplete": "list",
"aria-controls": `${id}_list`,
"aria-activedescendant": activeDescendantId
}), attrs), {
value: editable ? value : "",
readonly: !editable,
unselectable: !editable ? "on" : null,
style: _extends(_extends({}, style), {
opacity: editable ? null : 0
}),
onKeydown: (event) => {
onKeydown(event);
if (onOriginKeyDown) {
onOriginKeyDown(event);
}
},
onMousedown: (event) => {
onMousedown(event);
if (onOriginMouseDown) {
onOriginMouseDown(event);
}
},
onInput: (event) => {
onChange(event);
if (onOriginInput) {
onOriginInput(event);
}
},
onCompositionstart(event) {
onCompositionstart(event);
if (onOriginCompositionStart) {
onOriginCompositionStart(event);
}
},
onCompositionend(event) {
onCompositionend(event);
if (onOriginCompositionEnd) {
onOriginCompositionEnd(event);
}
},
onPaste,
onFocus: function() {
clearTimeout(blurTimeout);
onOriginFocus && onOriginFocus(arguments.length <= 0 ? void 0 : arguments[0]);
onFocus && onFocus(arguments.length <= 0 ? void 0 : arguments[0]);
VCSelectContainerEvent === null || VCSelectContainerEvent === void 0 ? void 0 : VCSelectContainerEvent.focus(arguments.length <= 0 ? void 0 : arguments[0]);
},
onBlur: function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
blurTimeout = setTimeout(() => {
onOriginBlur && onOriginBlur(args[0]);
onBlur && onBlur(args[0]);
VCSelectContainerEvent === null || VCSelectContainerEvent === void 0 ? void 0 : VCSelectContainerEvent.blur(args[0]);
}, 100);
}
}), inputNode.type === "textarea" ? {} : {
type: "search"
}), true, true);
return inputNode;
};
}
});
const attributes = `accept acceptcharset accesskey action allowfullscreen allowtransparency
alt async autocomplete autofocus autoplay capture cellpadding cellspacing challenge
charset checked classid classname colspan cols content contenteditable contextmenu
controls coords crossorigin data datetime default defer dir disabled download draggable
enctype form formaction formenctype formmethod formnovalidate formtarget frameborder
headers height hidden high href hreflang htmlfor for httpequiv icon id inputmode integrity
is keyparams keytype kind label lang list loop low manifest marginheight marginwidth max maxlength media
mediagroup method min minlength multiple muted name novalidate nonce open
optimum pattern placeholder poster preload radiogroup readonly rel required
reversed role rowspan rows sandbox scope scoped scrolling seamless selected
shape size sizes span spellcheck src srcdoc srclang srcset start step style
summary tabindex target title type usemap value width wmode wrap`;
const eventsName = `onCopy onCut onPaste onCompositionend onCompositionstart onCompositionupdate onKeydown
onKeypress onKeyup onFocus onBlur onChange onInput onSubmit onClick onContextmenu onDoubleclick onDblclick
onDrag onDragend onDragenter onDragexit onDragleave onDragover onDragstart onDrop onMousedown
onMouseenter onMouseleave onMousemove onMouseout onMouseover onMouseup onSelect onTouchcancel
onTouchend onTouchmove onTouchstart onTouchstartPassive onTouchmovePassive onScroll onWheel onAbort onCanplay onCanplaythrough
onDurationchange onEmptied onEncrypted onEnded onError onLoadeddata onLoadedmetadata
onLoadstart onPause onPlay onPlaying onProgress onRatechange onSeeked onSeeking onStalled onSuspend onTimeupdate onVolumechange onWaiting onLoad onError`;
const propList = `${attributes} ${eventsName}`.split(/[\s\n]+/);
const ariaPrefix = "aria-";
const dataPrefix = "data-";
function match(key2, prefix) {
return key2.indexOf(prefix) === 0;
}
function pickAttrs(props2) {
let ariaOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
let mergedConfig;
if (ariaOnly === false) {
mergedConfig = {
aria: true,
data: true,
attr: true
};
} else if (ariaOnly === true) {
mergedConfig = {
aria: true
};
} else {
mergedConfig = _extends({}, ariaOnly);
}
const attrs = {};
Object.keys(props2).forEach((key2) => {
if (
// Aria
mergedConfig.aria && (key2 === "role" || match(key2, ariaPrefix)) || // Data
mergedConfig.data && match(key2, dataPrefix) || // Attr
mergedConfig.attr && (propList.includes(key2) || propList.includes(key2.toLowerCase()))
) {
attrs[key2] = props2[key2];
}
});
return attrs;
}
const OverflowContextProviderKey = Symbol("OverflowContextProviderKey");
const OverflowContextProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "OverflowContextProvider",
inheritAttrs: false,
props: {
value: {
type: Object
}
},
setup(props2, _ref) {
let {
slots
} = _ref;
provide(OverflowContextProviderKey, computed(() => props2.value));
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const useInjectOverflowContext = () => {
return inject(OverflowContextProviderKey, computed(() => null));
};
var __rest$1c = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const UNDEFINED = void 0;
const Item$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Item",
props: {
prefixCls: String,
item: PropTypes.any,
renderItem: Function,
responsive: Boolean,
itemKey: {
type: [String, Number]
},
registerSize: Function,
display: Boolean,
order: Number,
component: PropTypes.any,
invalidate: Boolean
},
setup(props2, _ref) {
let {
slots,
expose
} = _ref;
const mergedHidden = computed(() => props2.responsive && !props2.display);
const itemNodeRef = ref();
expose({
itemNodeRef
});
function internalRegisterSize(width) {
props2.registerSize(props2.itemKey, width);
}
return () => {
var _a;
const {
prefixCls,
invalidate,
item,
renderItem,
responsive,
registerSize,
itemKey: itemKey2,
display,
order,
component: Component = "div"
} = props2, restProps = __rest$1c(props2, ["prefixCls", "invalidate", "item", "renderItem", "responsive", "registerSize", "itemKey", "display", "order", "component"]);
const children = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
const childNode = renderItem && item !== UNDEFINED ? renderItem(item) : children;
let overflowStyle;
if (!invalidate) {
overflowStyle = {
opacity: mergedHidden.value ? 0 : 1,
height: mergedHidden.value ? 0 : UNDEFINED,
overflowY: mergedHidden.value ? "hidden" : UNDEFINED,
order: responsive ? order : UNDEFINED,
pointerEvents: mergedHidden.value ? "none" : UNDEFINED,
position: mergedHidden.value ? "absolute" : UNDEFINED
};
}
const overflowProps2 = {};
if (mergedHidden.value) {
overflowProps2["aria-hidden"] = true;
}
return createVNode(ResizeObserver$1, {
"disabled": !responsive,
"onResize": (_ref2) => {
let {
offsetWidth
} = _ref2;
internalRegisterSize(offsetWidth);
}
}, {
default: () => createVNode(Component, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"class": classNames(!invalidate && prefixCls),
"style": overflowStyle
}, overflowProps2), restProps), {}, {
"ref": itemNodeRef
}), {
default: () => [childNode]
})
});
};
}
});
var __rest$1b = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const RawItem = defineComponent({
compatConfig: {
MODE: 3
},
name: "RawItem",
inheritAttrs: false,
props: {
component: PropTypes.any,
title: PropTypes.any,
id: String,
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onClick: {
type: Function
},
onKeydown: {
type: Function
},
onFocus: {
type: Function
},
role: String,
tabindex: Number
},
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const context2 = useInjectOverflowContext();
return () => {
var _a;
if (!context2.value) {
const {
component: Component = "div"
} = props2, restProps2 = __rest$1b(props2, ["component"]);
return createVNode(Component, _objectSpread$W(_objectSpread$W({}, restProps2), attrs), {
default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
});
}
const _b = context2.value, {
className: contextClassName
} = _b, restContext = __rest$1b(_b, ["className"]);
const {
class: className
} = attrs, restProps = __rest$1b(attrs, ["class"]);
return createVNode(OverflowContextProvider, {
"value": null
}, {
default: () => [createVNode(Item$2, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"class": classNames(contextClassName, className)
}, restContext), restProps), props2), slots)]
});
};
}
});
var __rest$1a = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const RESPONSIVE = "responsive";
const INVALIDATE = "invalidate";
function defaultRenderRest(omittedItems) {
return `+ ${omittedItems.length} ...`;
}
const overflowProps = () => {
return {
id: String,
prefixCls: String,
data: Array,
itemKey: [String, Number, Function],
/** Used for `responsive`. It will limit render node to avoid perf issue */
itemWidth: {
type: Number,
default: 10
},
renderItem: Function,
/** @private Do not use in your production. Render raw node that need wrap Item by developer self */
renderRawItem: Function,
maxCount: [Number, String],
renderRest: Function,
/** @private Do not use in your production. Render raw node that need wrap Item by developer self */
renderRawRest: Function,
suffix: PropTypes.any,
component: String,
itemComponent: PropTypes.any,
/** @private This API may be refactor since not well design */
onVisibleChange: Function,
/** When set to `full`, ssr will render full items by default and remove at client side */
ssr: String,
onMousedown: Function,
role: String
};
};
const Overflow = defineComponent({
name: "Overflow",
inheritAttrs: false,
props: overflowProps(),
emits: ["visibleChange"],
setup(props2, _ref) {
let {
attrs,
emit,
slots
} = _ref;
const fullySSR = computed(() => props2.ssr === "full");
const containerWidth = shallowRef(null);
const mergedContainerWidth = computed(() => containerWidth.value || 0);
const itemWidths = shallowRef(/* @__PURE__ */ new Map());
const prevRestWidth = shallowRef(0);
const restWidth = shallowRef(0);
const suffixWidth = shallowRef(0);
const suffixFixedStart = shallowRef(null);
const displayCount = shallowRef(null);
const mergedDisplayCount = computed(() => {
if (displayCount.value === null && fullySSR.value) {
return Number.MAX_SAFE_INTEGER;
}
return displayCount.value || 0;
});
const restReady = shallowRef(false);
const itemPrefixCls = computed(() => `${props2.prefixCls}-item`);
const mergedRestWidth = computed(() => Math.max(prevRestWidth.value, restWidth.value));
const isResponsive = computed(() => !!(props2.data.length && props2.maxCount === RESPONSIVE));
const invalidate = computed(() => props2.maxCount === INVALIDATE);
const showRest = computed(() => isResponsive.value || typeof props2.maxCount === "number" && props2.data.length > props2.maxCount);
const mergedData = computed(() => {
let items = props2.data;
if (isResponsive.value) {
if (containerWidth.value === null && fullySSR.value) {
items = props2.data;
} else {
items = props2.data.slice(0, Math.min(props2.data.length, mergedContainerWidth.value / props2.itemWidth));
}
} else if (typeof props2.maxCount === "number") {
items = props2.data.slice(0, props2.maxCount);
}
return items;
});
const omittedItems = computed(() => {
if (isResponsive.value) {
return props2.data.slice(mergedDisplayCount.value + 1);
}
return props2.data.slice(mergedData.value.length);
});
const getKey2 = (item, index2) => {
var _a;
if (typeof props2.itemKey === "function") {
return props2.itemKey(item);
}
return (_a = props2.itemKey && (item === null || item === void 0 ? void 0 : item[props2.itemKey])) !== null && _a !== void 0 ? _a : index2;
};
const mergedRenderItem = computed(() => props2.renderItem || ((item) => item));
const updateDisplayCount = (count, notReady) => {
displayCount.value = count;
if (!notReady) {
restReady.value = count < props2.data.length - 1;
emit("visibleChange", count);
}
};
const onOverflowResize = (_, element) => {
containerWidth.value = element.clientWidth;
};
const registerSize = (key2, width) => {
const clone = new Map(itemWidths.value);
if (width === null) {
clone.delete(key2);
} else {
clone.set(key2, width);
}
itemWidths.value = clone;
};
const registerOverflowSize = (_, width) => {
prevRestWidth.value = restWidth.value;
restWidth.value = width;
};
const registerSuffixSize = (_, width) => {
suffixWidth.value = width;
};
const getItemWidth = (index2) => {
return itemWidths.value.get(getKey2(mergedData.value[index2], index2));
};
watch([mergedContainerWidth, itemWidths, restWidth, suffixWidth, () => props2.itemKey, mergedData], () => {
if (mergedContainerWidth.value && mergedRestWidth.value && mergedData.value) {
let totalWidth = suffixWidth.value;
const len = mergedData.value.length;
const lastIndex = len - 1;
if (!len) {
updateDisplayCount(0);
suffixFixedStart.value = null;
return;
}
for (let i = 0; i < len; i += 1) {
const currentItemWidth = getItemWidth(i);
if (currentItemWidth === void 0) {
updateDisplayCount(i - 1, true);
break;
}
totalWidth += currentItemWidth;
if (
// Only one means `totalWidth` is the final width
lastIndex === 0 && totalWidth <= mergedContainerWidth.value || // Last two width will be the final width
i === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth.value
) {
updateDisplayCount(lastIndex);
suffixFixedStart.value = null;
break;
} else if (totalWidth + mergedRestWidth.value > mergedContainerWidth.value) {
updateDisplayCount(i - 1);
suffixFixedStart.value = totalWidth - currentItemWidth - suffixWidth.value + restWidth.value;
break;
}
}
if (props2.suffix && getItemWidth(0) + suffixWidth.value > mergedContainerWidth.value) {
suffixFixedStart.value = null;
}
}
});
return () => {
const displayRest = restReady.value && !!omittedItems.value.length;
const {
itemComponent,
renderRawItem,
renderRawRest,
renderRest,
prefixCls = "rc-overflow",
suffix,
component: Component = "div",
id,
onMousedown
} = props2;
const {
class: className,
style
} = attrs, restAttrs = __rest$1a(attrs, ["class", "style"]);
let suffixStyle = {};
if (suffixFixedStart.value !== null && isResponsive.value) {
suffixStyle = {
position: "absolute",
left: `${suffixFixedStart.value}px`,
top: 0
};
}
const itemSharedProps = {
prefixCls: itemPrefixCls.value,
responsive: isResponsive.value,
component: itemComponent,
invalidate: invalidate.value
};
const internalRenderItemNode = renderRawItem ? (item, index2) => {
const key2 = getKey2(item, index2);
return createVNode(OverflowContextProvider, {
"key": key2,
"value": _extends(_extends({}, itemSharedProps), {
order: index2,
item,
itemKey: key2,
registerSize,
display: index2 <= mergedDisplayCount.value
})
}, {
default: () => [renderRawItem(item, index2)]
});
} : (item, index2) => {
const key2 = getKey2(item, index2);
return createVNode(Item$2, _objectSpread$W(_objectSpread$W({}, itemSharedProps), {}, {
"order": index2,
"key": key2,
"item": item,
"renderItem": mergedRenderItem.value,
"itemKey": key2,
"registerSize": registerSize,
"display": index2 <= mergedDisplayCount.value
}), null);
};
let restNode = () => null;
const restContextProps = {
order: displayRest ? mergedDisplayCount.value : Number.MAX_SAFE_INTEGER,
className: `${itemPrefixCls.value} ${itemPrefixCls.value}-rest`,
registerSize: registerOverflowSize,
display: displayRest
};
if (!renderRawRest) {
const mergedRenderRest = renderRest || defaultRenderRest;
restNode = () => createVNode(Item$2, _objectSpread$W(_objectSpread$W({}, itemSharedProps), restContextProps), {
default: () => typeof mergedRenderRest === "function" ? mergedRenderRest(omittedItems.value) : mergedRenderRest
});
} else if (renderRawRest) {
restNode = () => createVNode(OverflowContextProvider, {
"value": _extends(_extends({}, itemSharedProps), restContextProps)
}, {
default: () => [renderRawRest(omittedItems.value)]
});
}
const overflowNode = () => {
var _a;
return createVNode(Component, _objectSpread$W({
"id": id,
"class": classNames(!invalidate.value && prefixCls, className),
"style": style,
"onMousedown": onMousedown,
"role": props2.role
}, restAttrs), {
default: () => [mergedData.value.map(internalRenderItemNode), showRest.value ? restNode() : null, suffix && createVNode(Item$2, _objectSpread$W(_objectSpread$W({}, itemSharedProps), {}, {
"order": mergedDisplayCount.value,
"class": `${itemPrefixCls.value}-suffix`,
"registerSize": registerSuffixSize,
"display": true,
"style": suffixStyle
}), {
default: () => suffix
}), (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
});
};
return createVNode(ResizeObserver$1, {
"disabled": !isResponsive.value,
"onResize": onOverflowResize
}, {
default: overflowNode
});
};
}
});
Overflow.Item = RawItem;
Overflow.RESPONSIVE = RESPONSIVE;
Overflow.INVALIDATE = INVALIDATE;
const TreeSelectLegacyContextPropsKey = Symbol("TreeSelectLegacyContextPropsKey");
function useProvideLegacySelectContext(props2) {
return provide(TreeSelectLegacyContextPropsKey, props2);
}
function useInjectLegacySelectContext() {
return inject(TreeSelectLegacyContextPropsKey, {});
}
const props$2 = {
id: String,
prefixCls: String,
values: PropTypes.array,
open: {
type: Boolean,
default: void 0
},
searchValue: String,
inputRef: PropTypes.any,
placeholder: PropTypes.any,
disabled: {
type: Boolean,
default: void 0
},
mode: String,
showSearch: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
autocomplete: String,
activeDescendantId: String,
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
compositionStatus: Boolean,
removeIcon: PropTypes.any,
choiceTransitionName: String,
maxTagCount: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
maxTagTextLength: Number,
maxTagPlaceholder: PropTypes.any.def(() => (omittedValues) => `+ ${omittedValues.length} ...`),
tagRender: Function,
onToggleOpen: {
type: Function
},
onRemove: Function,
onInputChange: Function,
onInputPaste: Function,
onInputKeyDown: Function,
onInputMouseDown: Function,
onInputCompositionStart: Function,
onInputCompositionEnd: Function
};
const onPreventMouseDown = (event) => {
event.preventDefault();
event.stopPropagation();
};
const SelectSelector = defineComponent({
name: "MultipleSelectSelector",
inheritAttrs: false,
props: props$2,
setup(props2) {
const measureRef = shallowRef();
const inputWidth = shallowRef(0);
const focused = shallowRef(false);
const legacyTreeSelectContext = useInjectLegacySelectContext();
const selectionPrefixCls = computed(() => `${props2.prefixCls}-selection`);
const inputValue = computed(() => props2.open || props2.mode === "tags" ? props2.searchValue : "");
const inputEditable = computed(() => props2.mode === "tags" || props2.showSearch && (props2.open || focused.value));
const targetValue = ref("");
watchEffect(() => {
targetValue.value = inputValue.value;
});
function defaultRenderSelector(title, content, itemDisabled, closable, onClose) {
return createVNode("span", {
"class": classNames(`${selectionPrefixCls.value}-item`, {
[`${selectionPrefixCls.value}-item-disabled`]: itemDisabled
}),
"title": typeof title === "string" || typeof title === "number" ? title.toString() : void 0
}, [createVNode("span", {
"class": `${selectionPrefixCls.value}-item-content`
}, [content]), closable && createVNode(TransBtn, {
"class": `${selectionPrefixCls.value}-item-remove`,
"onMousedown": onPreventMouseDown,
"onClick": onClose,
"customizeIcon": props2.removeIcon
}, {
default: () => [createTextVNode("×")]
})]);
}
function customizeRenderSelector(value, content, itemDisabled, closable, onClose, option) {
var _a;
const onMouseDown = (e) => {
onPreventMouseDown(e);
props2.onToggleOpen(!open);
};
let originData = option;
if (legacyTreeSelectContext.keyEntities) {
originData = ((_a = legacyTreeSelectContext.keyEntities[value]) === null || _a === void 0 ? void 0 : _a.node) || {};
}
return createVNode("span", {
"key": value,
"onMousedown": onMouseDown
}, [props2.tagRender({
label: content,
value,
disabled: itemDisabled,
closable,
onClose,
option: originData
})]);
}
function renderItem(valueItem) {
const {
disabled: itemDisabled,
label,
value,
option
} = valueItem;
const closable = !props2.disabled && !itemDisabled;
let displayLabel = label;
if (typeof props2.maxTagTextLength === "number") {
if (typeof label === "string" || typeof label === "number") {
const strLabel = String(displayLabel);
if (strLabel.length > props2.maxTagTextLength) {
displayLabel = `${strLabel.slice(0, props2.maxTagTextLength)}...`;
}
}
}
const onClose = (event) => {
var _a;
if (event) event.stopPropagation();
(_a = props2.onRemove) === null || _a === void 0 ? void 0 : _a.call(props2, valueItem);
};
return typeof props2.tagRender === "function" ? customizeRenderSelector(value, displayLabel, itemDisabled, closable, onClose, option) : defaultRenderSelector(label, displayLabel, itemDisabled, closable, onClose);
}
function renderRest(omittedValues) {
const {
maxTagPlaceholder = (omittedValues2) => `+ ${omittedValues2.length} ...`
} = props2;
const content = typeof maxTagPlaceholder === "function" ? maxTagPlaceholder(omittedValues) : maxTagPlaceholder;
return defaultRenderSelector(content, content, false);
}
const handleInput = (e) => {
const composing = e.target.composing;
targetValue.value = e.target.value;
if (!composing) {
props2.onInputChange(e);
}
};
return () => {
const {
id,
prefixCls,
values,
open: open2,
inputRef,
placeholder,
disabled,
autofocus,
autocomplete,
activeDescendantId,
tabindex,
compositionStatus,
onInputPaste,
onInputKeyDown,
onInputMouseDown,
onInputCompositionStart,
onInputCompositionEnd
} = props2;
const inputNode = createVNode("div", {
"class": `${selectionPrefixCls.value}-search`,
"style": {
width: inputWidth.value + "px"
},
"key": "input"
}, [createVNode(Input$1, {
"inputRef": inputRef,
"open": open2,
"prefixCls": prefixCls,
"id": id,
"inputElement": null,
"disabled": disabled,
"autofocus": autofocus,
"autocomplete": autocomplete,
"editable": inputEditable.value,
"activeDescendantId": activeDescendantId,
"value": targetValue.value,
"onKeydown": onInputKeyDown,
"onMousedown": onInputMouseDown,
"onChange": handleInput,
"onPaste": onInputPaste,
"onCompositionstart": onInputCompositionStart,
"onCompositionend": onInputCompositionEnd,
"tabindex": tabindex,
"attrs": pickAttrs(props2, true),
"onFocus": () => focused.value = true,
"onBlur": () => focused.value = false
}, null), createVNode("span", {
"ref": measureRef,
"class": `${selectionPrefixCls.value}-search-mirror`,
"aria-hidden": true
}, [targetValue.value, createTextVNode(" ")])]);
const selectionNode = createVNode(Overflow, {
"prefixCls": `${selectionPrefixCls.value}-overflow`,
"data": values,
"renderItem": renderItem,
"renderRest": renderRest,
"suffix": inputNode,
"itemKey": "key",
"maxCount": props2.maxTagCount,
"key": "overflow"
}, null);
return createVNode(Fragment, null, [selectionNode, !values.length && !inputValue.value && !compositionStatus && createVNode("span", {
"class": `${selectionPrefixCls.value}-placeholder`
}, [placeholder])]);
};
}
});
const props$1 = {
inputElement: PropTypes.any,
id: String,
prefixCls: String,
values: PropTypes.array,
open: {
type: Boolean,
default: void 0
},
searchValue: String,
inputRef: PropTypes.any,
placeholder: PropTypes.any,
compositionStatus: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
mode: String,
showSearch: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
autocomplete: String,
activeDescendantId: String,
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
activeValue: String,
backfill: {
type: Boolean,
default: void 0
},
optionLabelRender: Function,
onInputChange: Function,
onInputPaste: Function,
onInputKeyDown: Function,
onInputMouseDown: Function,
onInputCompositionStart: Function,
onInputCompositionEnd: Function
};
const SingleSelector = defineComponent({
name: "SingleSelector",
setup(props2) {
const inputChanged = shallowRef(false);
const combobox = computed(() => props2.mode === "combobox");
const inputEditable = computed(() => combobox.value || props2.showSearch);
const inputValue = computed(() => {
let inputValue2 = props2.searchValue || "";
if (combobox.value && props2.activeValue && !inputChanged.value) {
inputValue2 = props2.activeValue;
}
return inputValue2;
});
const legacyTreeSelectContext = useInjectLegacySelectContext();
watch([combobox, () => props2.activeValue], () => {
if (combobox.value) {
inputChanged.value = false;
}
}, {
immediate: true
});
const hasTextInput = computed(() => props2.mode !== "combobox" && !props2.open && !props2.showSearch ? false : !!inputValue.value || props2.compositionStatus);
const title = computed(() => {
const item = props2.values[0];
return item && (typeof item.label === "string" || typeof item.label === "number") ? item.label.toString() : void 0;
});
const renderPlaceholder = () => {
if (props2.values[0]) {
return null;
}
const hiddenStyle = hasTextInput.value ? {
visibility: "hidden"
} : void 0;
return createVNode("span", {
"class": `${props2.prefixCls}-selection-placeholder`,
"style": hiddenStyle
}, [props2.placeholder]);
};
const handleInput = (e) => {
const composing = e.target.composing;
if (!composing) {
inputChanged.value = true;
props2.onInputChange(e);
}
};
return () => {
var _a, _b, _c, _d;
const {
inputElement,
prefixCls,
id,
values,
inputRef,
disabled,
autofocus,
autocomplete,
activeDescendantId,
open: open2,
tabindex,
optionLabelRender,
onInputKeyDown,
onInputMouseDown,
onInputPaste,
onInputCompositionStart,
onInputCompositionEnd
} = props2;
const item = values[0];
let titleNode = null;
if (item && legacyTreeSelectContext.customSlots) {
const key2 = (_a = item.key) !== null && _a !== void 0 ? _a : item.value;
const originData = ((_b = legacyTreeSelectContext.keyEntities[key2]) === null || _b === void 0 ? void 0 : _b.node) || {};
titleNode = legacyTreeSelectContext.customSlots[(_c = originData.slots) === null || _c === void 0 ? void 0 : _c.title] || legacyTreeSelectContext.customSlots.title || item.label;
if (typeof titleNode === "function") {
titleNode = titleNode(originData);
}
} else {
titleNode = optionLabelRender && item ? optionLabelRender(item.option) : item === null || item === void 0 ? void 0 : item.label;
}
return createVNode(Fragment, null, [createVNode("span", {
"class": `${prefixCls}-selection-search`
}, [createVNode(Input$1, {
"inputRef": inputRef,
"prefixCls": prefixCls,
"id": id,
"open": open2,
"inputElement": inputElement,
"disabled": disabled,
"autofocus": autofocus,
"autocomplete": autocomplete,
"editable": inputEditable.value,
"activeDescendantId": activeDescendantId,
"value": inputValue.value,
"onKeydown": onInputKeyDown,
"onMousedown": onInputMouseDown,
"onChange": handleInput,
"onPaste": onInputPaste,
"onCompositionstart": onInputCompositionStart,
"onCompositionend": onInputCompositionEnd,
"tabindex": tabindex,
"attrs": pickAttrs(props2, true)
}, null)]), !combobox.value && item && !hasTextInput.value && createVNode("span", {
"class": `${prefixCls}-selection-item`,
"title": title.value
}, [createVNode(Fragment, {
"key": (_d = item.key) !== null && _d !== void 0 ? _d : item.value
}, [titleNode])]), renderPlaceholder()]);
};
}
});
SingleSelector.props = props$1;
SingleSelector.inheritAttrs = false;
function isValidateOpenKey(currentKeyCode) {
return ![
// System function button
KeyCode.ESC,
KeyCode.SHIFT,
KeyCode.BACKSPACE,
KeyCode.TAB,
KeyCode.WIN_KEY,
KeyCode.ALT,
KeyCode.META,
KeyCode.WIN_KEY_RIGHT,
KeyCode.CTRL,
KeyCode.SEMICOLON,
KeyCode.EQUALS,
KeyCode.CAPS_LOCK,
KeyCode.CONTEXT_MENU,
// F1-F12
KeyCode.F1,
KeyCode.F2,
KeyCode.F3,
KeyCode.F4,
KeyCode.F5,
KeyCode.F6,
KeyCode.F7,
KeyCode.F8,
KeyCode.F9,
KeyCode.F10,
KeyCode.F11,
KeyCode.F12
].includes(currentKeyCode);
}
function useLock() {
let duration = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 250;
let lock = null;
let timeout;
function doLock(locked) {
if (locked || lock === null) {
lock = locked;
}
clearTimeout(timeout);
timeout = setTimeout(() => {
lock = null;
}, duration);
}
return [() => lock, doLock];
}
function createRef() {
const func = (node) => {
func.current = node;
};
return func;
}
const Selector = defineComponent({
name: "Selector",
inheritAttrs: false,
props: {
id: String,
prefixCls: String,
showSearch: {
type: Boolean,
default: void 0
},
open: {
type: Boolean,
default: void 0
},
/** Display in the Selector value, it's not same as `value` prop */
values: PropTypes.array,
multiple: {
type: Boolean,
default: void 0
},
mode: String,
searchValue: String,
activeValue: String,
inputElement: PropTypes.any,
autofocus: {
type: Boolean,
default: void 0
},
activeDescendantId: String,
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
disabled: {
type: Boolean,
default: void 0
},
placeholder: PropTypes.any,
removeIcon: PropTypes.any,
// Tags
maxTagCount: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
maxTagTextLength: Number,
maxTagPlaceholder: PropTypes.any,
tagRender: Function,
optionLabelRender: Function,
/** Check if `tokenSeparators` contains `\n` or `\r\n` */
tokenWithEnter: {
type: Boolean,
default: void 0
},
// Motion
choiceTransitionName: String,
onToggleOpen: {
type: Function
},
/** `onSearch` returns go next step boolean to check if need do toggle open */
onSearch: Function,
onSearchSubmit: Function,
onRemove: Function,
onInputKeyDown: {
type: Function
},
/**
* @private get real dom for trigger align.
* This may be removed after React provides replacement of `findDOMNode`
*/
domRef: Function
},
setup(props2, _ref) {
let {
expose
} = _ref;
const inputRef = createRef();
const compositionStatus = ref(false);
const [getInputMouseDown, setInputMouseDown] = useLock(0);
const onInternalInputKeyDown = (event) => {
const {
which
} = event;
if (which === KeyCode.UP || which === KeyCode.DOWN) {
event.preventDefault();
}
if (props2.onInputKeyDown) {
props2.onInputKeyDown(event);
}
if (which === KeyCode.ENTER && props2.mode === "tags" && !compositionStatus.value && !props2.open) {
props2.onSearchSubmit(event.target.value);
}
if (isValidateOpenKey(which)) {
props2.onToggleOpen(true);
}
};
const onInternalInputMouseDown = () => {
setInputMouseDown(true);
};
let pastedText = null;
const triggerOnSearch = (value) => {
if (props2.onSearch(value, true, compositionStatus.value) !== false) {
props2.onToggleOpen(true);
}
};
const onInputCompositionStart = () => {
compositionStatus.value = true;
};
const onInputCompositionEnd = (e) => {
compositionStatus.value = false;
if (props2.mode !== "combobox") {
triggerOnSearch(e.target.value);
}
};
const onInputChange = (event) => {
let {
target: {
value
}
} = event;
if (props2.tokenWithEnter && pastedText && /[\r\n]/.test(pastedText)) {
const replacedText = pastedText.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " ");
value = value.replace(replacedText, pastedText);
}
pastedText = null;
triggerOnSearch(value);
};
const onInputPaste = (e) => {
const {
clipboardData
} = e;
const value = clipboardData.getData("text");
pastedText = value;
};
const onClick = (_ref2) => {
let {
target
} = _ref2;
if (target !== inputRef.current) {
const isIE = (void 0).body.style.msTouchAction !== void 0;
if (isIE) {
setTimeout(() => {
inputRef.current.focus();
});
} else {
inputRef.current.focus();
}
}
};
const onMousedown = (event) => {
const inputMouseDown = getInputMouseDown();
if (event.target !== inputRef.current && !inputMouseDown) {
event.preventDefault();
}
if (props2.mode !== "combobox" && (!props2.showSearch || !inputMouseDown) || !props2.open) {
if (props2.open) {
props2.onSearch("", true, false);
}
props2.onToggleOpen();
}
};
expose({
focus: () => {
inputRef.current.focus();
},
blur: () => {
inputRef.current.blur();
}
});
return () => {
const {
prefixCls,
domRef,
mode
} = props2;
const sharedProps = {
inputRef,
onInputKeyDown: onInternalInputKeyDown,
onInputMouseDown: onInternalInputMouseDown,
onInputChange,
onInputPaste,
compositionStatus: compositionStatus.value,
onInputCompositionStart,
onInputCompositionEnd
};
const selectNode = mode === "multiple" || mode === "tags" ? createVNode(SelectSelector, _objectSpread$W(_objectSpread$W({}, props2), sharedProps), null) : createVNode(SingleSelector, _objectSpread$W(_objectSpread$W({}, props2), sharedProps), null);
return createVNode("div", {
"ref": domRef,
"class": `${prefixCls}-selector`,
"onClick": onClick,
"onMousedown": onMousedown
}, [selectNode]);
};
}
});
function useDelayReset() {
let timeout = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10;
const bool = shallowRef(false);
let delay;
const cancelLatest = () => {
clearTimeout(delay);
};
const delaySetBool = (value, callback) => {
cancelLatest();
delay = setTimeout(() => {
bool.value = value;
if (callback) {
callback();
}
}, timeout);
};
return [bool, delaySetBool, cancelLatest];
}
const BaseSelectContextKey = Symbol("BaseSelectContextKey");
function useProvideBaseSelectProps(props2) {
return provide(BaseSelectContextKey, props2);
}
function useBaseProps() {
return inject(BaseSelectContextKey, {});
}
const isMobile = (() => {
{
return false;
}
});
function toReactive(objectRef) {
if (!isRef(objectRef)) return reactive(objectRef);
const proxy = new Proxy({}, {
get(_, p, receiver) {
return Reflect.get(objectRef.value, p, receiver);
},
set(_, p, value) {
objectRef.value[p] = value;
return true;
},
deleteProperty(_, p) {
return Reflect.deleteProperty(objectRef.value, p);
},
has(_, p) {
return Reflect.has(objectRef.value, p);
},
ownKeys() {
return Object.keys(objectRef.value);
},
getOwnPropertyDescriptor() {
return {
enumerable: true,
configurable: true
};
}
});
return reactive(proxy);
}
var __rest$19 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const DEFAULT_OMIT_PROPS = ["value", "onChange", "removeIcon", "placeholder", "autofocus", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "choiceTransitionName", "onInputKeyDown", "onPopupScroll", "tabindex", "OptionList", "notFoundContent"];
const baseSelectPrivateProps = () => {
return {
prefixCls: String,
id: String,
omitDomProps: Array,
// >>> Value
displayValues: Array,
onDisplayValuesChange: Function,
// >>> Active
/** Current dropdown list active item string value */
activeValue: String,
/** Link search input with target element */
activeDescendantId: String,
onActiveValueChange: Function,
// >>> Search
searchValue: String,
/** Trigger onSearch, return false to prevent trigger open event */
onSearch: Function,
/** Trigger when search text match the `tokenSeparators`. Will provide split content */
onSearchSplit: Function,
maxLength: Number,
OptionList: PropTypes.any,
/** Tell if provided `options` is empty */
emptyOptions: Boolean
};
};
const baseSelectPropsWithoutPrivate = () => {
return {
showSearch: {
type: Boolean,
default: void 0
},
tagRender: {
type: Function
},
optionLabelRender: {
type: Function
},
direction: {
type: String
},
// MISC
tabindex: Number,
autofocus: Boolean,
notFoundContent: PropTypes.any,
placeholder: PropTypes.any,
onClear: Function,
choiceTransitionName: String,
// >>> Mode
mode: String,
// >>> Status
disabled: {
type: Boolean,
default: void 0
},
loading: {
type: Boolean,
default: void 0
},
// >>> Open
open: {
type: Boolean,
default: void 0
},
defaultOpen: {
type: Boolean,
default: void 0
},
onDropdownVisibleChange: {
type: Function
},
// >>> Customize Input
/** @private Internal usage. Do not use in your production. */
getInputElement: {
type: Function
},
/** @private Internal usage. Do not use in your production. */
getRawInputElement: {
type: Function
},
// >>> Selector
maxTagTextLength: Number,
maxTagCount: {
type: [String, Number]
},
maxTagPlaceholder: PropTypes.any,
// >>> Search
tokenSeparators: {
type: Array
},
// >>> Icons
allowClear: {
type: Boolean,
default: void 0
},
showArrow: {
type: Boolean,
default: void 0
},
inputIcon: PropTypes.any,
/** Clear all icon */
clearIcon: PropTypes.any,
/** Selector remove icon */
removeIcon: PropTypes.any,
// >>> Dropdown
animation: String,
transitionName: String,
dropdownStyle: {
type: Object
},
dropdownClassName: String,
dropdownMatchSelectWidth: {
type: [Boolean, Number],
default: void 0
},
dropdownRender: {
type: Function
},
dropdownAlign: Object,
placement: {
type: String
},
getPopupContainer: {
type: Function
},
// >>> Focus
showAction: {
type: Array
},
onBlur: {
type: Function
},
onFocus: {
type: Function
},
// >>> Rest Events
onKeyup: Function,
onKeydown: Function,
onMousedown: Function,
onPopupScroll: Function,
onInputKeyDown: Function,
onMouseenter: Function,
onMouseleave: Function,
onClick: Function
};
};
const baseSelectProps = () => {
return _extends(_extends({}, baseSelectPrivateProps()), baseSelectPropsWithoutPrivate());
};
function isMultiple(mode) {
return mode === "tags" || mode === "multiple";
}
const BaseSelect = defineComponent({
compatConfig: {
MODE: 3
},
name: "BaseSelect",
inheritAttrs: false,
props: initDefaultProps(baseSelectProps(), {
showAction: [],
notFoundContent: "Not Found"
}),
setup(props2, _ref) {
let {
attrs,
expose,
slots
} = _ref;
const multiple = computed(() => isMultiple(props2.mode));
const mergedShowSearch = computed(() => props2.showSearch !== void 0 ? props2.showSearch : multiple.value || props2.mode === "combobox");
const mobile = shallowRef(false);
const legacyTreeSelectContext = useInjectLegacySelectContext();
const containerRef = shallowRef(null);
const selectorDomRef = createRef();
const triggerRef2 = shallowRef(null);
const selectorRef = shallowRef(null);
const listRef = shallowRef(null);
const blurRef = ref(false);
const [mockFocused, setMockFocused, cancelSetMockFocused] = useDelayReset();
const focus = () => {
var _a;
(_a = selectorRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = selectorRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
expose({
focus,
blur,
scrollTo: (arg) => {
var _a;
return (_a = listRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(arg);
}
});
const mergedSearchValue = computed(() => {
var _a;
if (props2.mode !== "combobox") {
return props2.searchValue;
}
const val = (_a = props2.displayValues[0]) === null || _a === void 0 ? void 0 : _a.value;
return typeof val === "string" || typeof val === "number" ? String(val) : "";
});
const initOpen = props2.open !== void 0 ? props2.open : props2.defaultOpen;
const innerOpen = shallowRef(initOpen);
const mergedOpen = shallowRef(initOpen);
const setInnerOpen = (val) => {
innerOpen.value = props2.open !== void 0 ? props2.open : val;
mergedOpen.value = innerOpen.value;
};
watch(() => props2.open, () => {
setInnerOpen(props2.open);
});
const emptyListContent = computed(() => !props2.notFoundContent && props2.emptyOptions);
watchEffect(() => {
mergedOpen.value = innerOpen.value;
if (props2.disabled || emptyListContent.value && mergedOpen.value && props2.mode === "combobox") {
mergedOpen.value = false;
}
});
const triggerOpen = computed(() => emptyListContent.value ? false : mergedOpen.value);
const onToggleOpen = (newOpen) => {
const nextOpen = newOpen !== void 0 ? newOpen : !mergedOpen.value;
if (mergedOpen.value !== nextOpen && !props2.disabled) {
setInnerOpen(nextOpen);
props2.onDropdownVisibleChange && props2.onDropdownVisibleChange(nextOpen);
if (!nextOpen && popupFocused.value) {
popupFocused.value = false;
setMockFocused(false, () => {
focusRef.value = false;
blurRef.value = false;
});
}
}
};
const tokenWithEnter = computed(() => (props2.tokenSeparators || []).some((tokenSeparator) => ["\n", "\r\n"].includes(tokenSeparator)));
const onInternalSearch = (searchText, fromTyping, isCompositing) => {
var _a, _b;
let ret = true;
let newSearchText = searchText;
(_a = props2.onActiveValueChange) === null || _a === void 0 ? void 0 : _a.call(props2, null);
const patchLabels = isCompositing ? null : getSeparatedContent(searchText, props2.tokenSeparators);
if (props2.mode !== "combobox" && patchLabels) {
newSearchText = "";
(_b = props2.onSearchSplit) === null || _b === void 0 ? void 0 : _b.call(props2, patchLabels);
onToggleOpen(false);
ret = false;
}
if (props2.onSearch && mergedSearchValue.value !== newSearchText) {
props2.onSearch(newSearchText, {
source: fromTyping ? "typing" : "effect"
});
}
return ret;
};
const onInternalSearchSubmit = (searchText) => {
var _a;
if (!searchText || !searchText.trim()) {
return;
}
(_a = props2.onSearch) === null || _a === void 0 ? void 0 : _a.call(props2, searchText, {
source: "submit"
});
};
watch(mergedOpen, () => {
if (!mergedOpen.value && !multiple.value && props2.mode !== "combobox") {
onInternalSearch("", false, false);
}
}, {
immediate: true,
flush: "post"
});
watch(() => props2.disabled, () => {
if (innerOpen.value && !!props2.disabled) {
setInnerOpen(false);
}
if (props2.disabled && !blurRef.value) {
setMockFocused(false);
}
}, {
immediate: true
});
const [getClearLock, setClearLock] = useLock();
const onInternalKeyDown = function(event) {
var _a;
const clearLock = getClearLock();
const {
which
} = event;
if (which === KeyCode.ENTER) {
if (props2.mode !== "combobox") {
event.preventDefault();
}
if (!mergedOpen.value) {
onToggleOpen(true);
}
}
setClearLock(!!mergedSearchValue.value);
if (which === KeyCode.BACKSPACE && !clearLock && multiple.value && !mergedSearchValue.value && props2.displayValues.length) {
const cloneDisplayValues = [...props2.displayValues];
let removedDisplayValue = null;
for (let i = cloneDisplayValues.length - 1; i >= 0; i -= 1) {
const current = cloneDisplayValues[i];
if (!current.disabled) {
cloneDisplayValues.splice(i, 1);
removedDisplayValue = current;
break;
}
}
if (removedDisplayValue) {
props2.onDisplayValuesChange(cloneDisplayValues, {
type: "remove",
values: [removedDisplayValue]
});
}
}
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rest[_key - 1] = arguments[_key];
}
if (mergedOpen.value && listRef.value) {
listRef.value.onKeydown(event, ...rest);
}
(_a = props2.onKeydown) === null || _a === void 0 ? void 0 : _a.call(props2, event, ...rest);
};
const onInternalKeyUp = function(event) {
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
rest[_key2 - 1] = arguments[_key2];
}
if (mergedOpen.value && listRef.value) {
listRef.value.onKeyup(event, ...rest);
}
if (props2.onKeyup) {
props2.onKeyup(event, ...rest);
}
};
const onSelectorRemove = (val) => {
const newValues = props2.displayValues.filter((i) => i !== val);
props2.onDisplayValuesChange(newValues, {
type: "remove",
values: [val]
});
};
const focusRef = shallowRef(false);
const onContainerFocus = function() {
setMockFocused(true);
if (!props2.disabled) {
if (props2.onFocus && !focusRef.value) {
props2.onFocus(...arguments);
}
if (props2.showAction && props2.showAction.includes("focus")) {
onToggleOpen(true);
}
}
focusRef.value = true;
};
const popupFocused = ref(false);
const onContainerBlur = function() {
if (popupFocused.value) {
return;
}
blurRef.value = true;
setMockFocused(false, () => {
focusRef.value = false;
blurRef.value = false;
onToggleOpen(false);
});
if (props2.disabled) {
return;
}
const searchVal = mergedSearchValue.value;
if (searchVal) {
if (props2.mode === "tags") {
props2.onSearch(searchVal, {
source: "submit"
});
} else if (props2.mode === "multiple") {
props2.onSearch("", {
source: "blur"
});
}
}
if (props2.onBlur) {
props2.onBlur(...arguments);
}
};
const onPopupFocusin = () => {
popupFocused.value = true;
};
const onPopupFocusout = () => {
popupFocused.value = false;
};
provide("VCSelectContainerEvent", {
focus: onContainerFocus,
blur: onContainerBlur
});
const onInternalMouseDown = function(event) {
var _a, _b;
const {
target
} = event;
const popupElement = (_a = triggerRef2.value) === null || _a === void 0 ? void 0 : _a.getPopupElement();
if (popupElement && popupElement.contains(target)) {
setTimeout(() => {
var _a2;
cancelSetMockFocused();
if (!mobile.value && !popupElement.contains((void 0).activeElement)) {
(_a2 = selectorRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus();
}
});
}
for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
restArgs[_key3 - 1] = arguments[_key3];
}
(_b = props2.onMousedown) === null || _b === void 0 ? void 0 : _b.call(props2, event, ...restArgs);
};
const containerWidth = shallowRef(null);
const onPopupMouseEnter = () => {
};
useProvideBaseSelectProps(toReactive(_extends(_extends({}, toRefs(props2)), {
open: mergedOpen,
triggerOpen,
showSearch: mergedShowSearch,
multiple,
toggleOpen: onToggleOpen
})));
return () => {
const _a = _extends(_extends({}, props2), attrs), {
prefixCls,
id,
open: open2,
defaultOpen,
mode,
// Search related
showSearch,
searchValue,
onSearch,
// Icons
allowClear,
clearIcon,
showArrow,
inputIcon,
// Others
disabled,
loading: loading2,
getInputElement,
getPopupContainer,
placement,
// Dropdown
animation,
transitionName: transitionName2,
dropdownStyle,
dropdownClassName,
dropdownMatchSelectWidth,
dropdownRender,
dropdownAlign,
showAction,
direction,
// Tags
tokenSeparators,
tagRender,
optionLabelRender,
// Events
onPopupScroll,
onDropdownVisibleChange,
onFocus,
onBlur,
onKeyup,
onKeydown,
onMousedown,
onClear,
omitDomProps,
getRawInputElement,
displayValues,
onDisplayValuesChange,
emptyOptions,
activeDescendantId,
activeValue,
OptionList: OptionList2
} = _a, restProps = __rest$19(_a, ["prefixCls", "id", "open", "defaultOpen", "mode", "showSearch", "searchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "disabled", "loading", "getInputElement", "getPopupContainer", "placement", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "optionLabelRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyup", "onKeydown", "onMousedown", "onClear", "omitDomProps", "getRawInputElement", "displayValues", "onDisplayValuesChange", "emptyOptions", "activeDescendantId", "activeValue", "OptionList"]);
const customizeInputElement = mode === "combobox" && getInputElement && getInputElement() || null;
const customizeRawInputElement = typeof getRawInputElement === "function" && getRawInputElement();
const domProps = _extends({}, restProps);
let onTriggerVisibleChange;
if (customizeRawInputElement) {
onTriggerVisibleChange = (newOpen) => {
onToggleOpen(newOpen);
};
}
DEFAULT_OMIT_PROPS.forEach((propName) => {
delete domProps[propName];
});
omitDomProps === null || omitDomProps === void 0 ? void 0 : omitDomProps.forEach((propName) => {
delete domProps[propName];
});
const mergedShowArrow = showArrow !== void 0 ? showArrow : loading2 || !multiple.value && mode !== "combobox";
let arrowNode;
if (mergedShowArrow) {
arrowNode = createVNode(TransBtn, {
"class": classNames(`${prefixCls}-arrow`, {
[`${prefixCls}-arrow-loading`]: loading2
}),
"customizeIcon": inputIcon,
"customizeIconProps": {
loading: loading2,
searchValue: mergedSearchValue.value,
open: mergedOpen.value,
focused: mockFocused.value,
showSearch: mergedShowSearch.value
}
}, null);
}
let clearNode;
const onClearMouseDown = () => {
onClear === null || onClear === void 0 ? void 0 : onClear();
onDisplayValuesChange([], {
type: "clear",
values: displayValues
});
onInternalSearch("", false, false);
};
if (!disabled && allowClear && (displayValues.length || mergedSearchValue.value)) {
clearNode = createVNode(TransBtn, {
"class": `${prefixCls}-clear`,
"onMousedown": onClearMouseDown,
"customizeIcon": clearIcon
}, {
default: () => [createTextVNode("×")]
});
}
const optionList = createVNode(OptionList2, {
"ref": listRef
}, _extends(_extends({}, legacyTreeSelectContext.customSlots), {
option: slots.option
}));
const mergedClassName = classNames(prefixCls, attrs.class, {
[`${prefixCls}-focused`]: mockFocused.value,
[`${prefixCls}-multiple`]: multiple.value,
[`${prefixCls}-single`]: !multiple.value,
[`${prefixCls}-allow-clear`]: allowClear,
[`${prefixCls}-show-arrow`]: mergedShowArrow,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-loading`]: loading2,
[`${prefixCls}-open`]: mergedOpen.value,
[`${prefixCls}-customize-input`]: customizeInputElement,
[`${prefixCls}-show-search`]: mergedShowSearch.value
});
const selectorNode = createVNode(SelectTrigger, {
"ref": triggerRef2,
"disabled": disabled,
"prefixCls": prefixCls,
"visible": triggerOpen.value,
"popupElement": optionList,
"containerWidth": containerWidth.value,
"animation": animation,
"transitionName": transitionName2,
"dropdownStyle": dropdownStyle,
"dropdownClassName": dropdownClassName,
"direction": direction,
"dropdownMatchSelectWidth": dropdownMatchSelectWidth,
"dropdownRender": dropdownRender,
"dropdownAlign": dropdownAlign,
"placement": placement,
"getPopupContainer": getPopupContainer,
"empty": emptyOptions,
"getTriggerDOMNode": () => selectorDomRef.current,
"onPopupVisibleChange": onTriggerVisibleChange,
"onPopupMouseEnter": onPopupMouseEnter,
"onPopupFocusin": onPopupFocusin,
"onPopupFocusout": onPopupFocusout
}, {
default: () => {
return customizeRawInputElement ? isValidElement(customizeRawInputElement) && cloneElement(customizeRawInputElement, {
ref: selectorDomRef
}, false, true) : createVNode(Selector, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"domRef": selectorDomRef,
"prefixCls": prefixCls,
"inputElement": customizeInputElement,
"ref": selectorRef,
"id": id,
"showSearch": mergedShowSearch.value,
"mode": mode,
"activeDescendantId": activeDescendantId,
"tagRender": tagRender,
"optionLabelRender": optionLabelRender,
"values": displayValues,
"open": mergedOpen.value,
"onToggleOpen": onToggleOpen,
"activeValue": activeValue,
"searchValue": mergedSearchValue.value,
"onSearch": onInternalSearch,
"onSearchSubmit": onInternalSearchSubmit,
"onRemove": onSelectorRemove,
"tokenWithEnter": tokenWithEnter.value
}), null);
}
});
let renderNode;
if (customizeRawInputElement) {
renderNode = selectorNode;
} else {
renderNode = createVNode("div", _objectSpread$W(_objectSpread$W({}, domProps), {}, {
"class": mergedClassName,
"ref": containerRef,
"onMousedown": onInternalMouseDown,
"onKeydown": onInternalKeyDown,
"onKeyup": onInternalKeyUp
}), [mockFocused.value && !mergedOpen.value && createVNode("span", {
"style": {
width: 0,
height: 0,
position: "absolute",
overflow: "hidden",
opacity: 0
},
"aria-live": "polite"
}, [`${displayValues.map((_ref2) => {
let {
label,
value
} = _ref2;
return ["number", "string"].includes(typeof label) ? label : value;
}).join(", ")}`]), selectorNode, arrowNode, clearNode]);
}
return renderNode;
};
}
});
const Filter = (_ref, _ref2) => {
let {
height,
offset: offset2,
prefixCls,
onInnerResize
} = _ref;
let {
slots
} = _ref2;
var _a;
let outerStyle = {};
let innerStyle = {
display: "flex",
flexDirection: "column"
};
if (offset2 !== void 0) {
outerStyle = {
height: `${height}px`,
position: "relative",
overflow: "hidden"
};
innerStyle = _extends(_extends({}, innerStyle), {
transform: `translateY(${offset2}px)`,
position: "absolute",
left: 0,
right: 0,
top: 0
});
}
return createVNode("div", {
"style": outerStyle
}, [createVNode(ResizeObserver$1, {
"onResize": (_ref3) => {
let {
offsetHeight
} = _ref3;
if (offsetHeight && onInnerResize) {
onInnerResize();
}
}
}, {
default: () => [createVNode("div", {
"style": innerStyle,
"class": classNames({
[`${prefixCls}-holder-inner`]: prefixCls
})
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])]
})]);
};
Filter.displayName = "Filter";
Filter.inheritAttrs = false;
Filter.props = {
prefixCls: String,
/** Virtual filler height. Should be `count * itemMinHeight` */
height: Number,
/** Set offset of visible items. Should be the top of start item position */
offset: Number,
onInnerResize: Function
};
const Item$1 = (_ref, _ref2) => {
let {
setRef
} = _ref;
let {
slots
} = _ref2;
var _a;
const children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
return children && children.length ? cloneVNode(children[0], {
ref: setRef
}) : children;
};
Item$1.props = {
setRef: {
type: Function,
default: () => {
}
}
};
const MIN_SIZE = 20;
function getPageY(e) {
return "touches" in e ? e.touches[0].pageY : e.pageY;
}
const ScrollBar = defineComponent({
compatConfig: {
MODE: 3
},
name: "ScrollBar",
inheritAttrs: false,
props: {
prefixCls: String,
scrollTop: Number,
scrollHeight: Number,
height: Number,
count: Number,
onScroll: {
type: Function
},
onStartMove: {
type: Function
},
onStopMove: {
type: Function
}
},
setup() {
return {
moveRaf: null,
scrollbarRef: createRef(),
thumbRef: createRef(),
visibleTimeout: null,
state: reactive({
dragging: false,
pageY: null,
startTop: null,
visible: false
})
};
},
watch: {
scrollTop: {
handler() {
this.delayHidden();
},
flush: "post"
}
},
mounted() {
var _a, _b;
(_a = this.scrollbarRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener("touchstart", this.onScrollbarTouchStart, supportsPassive ? {
passive: false
} : false);
(_b = this.thumbRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener("touchstart", this.onMouseDown, supportsPassive ? {
passive: false
} : false);
},
beforeUnmount() {
this.removeEvents();
clearTimeout(this.visibleTimeout);
},
methods: {
delayHidden() {
clearTimeout(this.visibleTimeout);
this.state.visible = true;
this.visibleTimeout = setTimeout(() => {
this.state.visible = false;
}, 2e3);
},
onScrollbarTouchStart(e) {
e.preventDefault();
},
onContainerMouseDown(e) {
e.stopPropagation();
e.preventDefault();
},
// ======================= Clean =======================
patchEvents() {
(void 0).addEventListener("mousemove", this.onMouseMove);
(void 0).addEventListener("mouseup", this.onMouseUp);
this.thumbRef.current.addEventListener("touchmove", this.onMouseMove, supportsPassive ? {
passive: false
} : false);
this.thumbRef.current.addEventListener("touchend", this.onMouseUp);
},
removeEvents() {
(void 0).removeEventListener("mousemove", this.onMouseMove);
(void 0).removeEventListener("mouseup", this.onMouseUp);
this.scrollbarRef.current.removeEventListener("touchstart", this.onScrollbarTouchStart, supportsPassive ? {
passive: false
} : false);
if (this.thumbRef.current) {
this.thumbRef.current.removeEventListener("touchstart", this.onMouseDown, supportsPassive ? {
passive: false
} : false);
this.thumbRef.current.removeEventListener("touchmove", this.onMouseMove, supportsPassive ? {
passive: false
} : false);
this.thumbRef.current.removeEventListener("touchend", this.onMouseUp);
}
wrapperRaf.cancel(this.moveRaf);
},
// ======================= Thumb =======================
onMouseDown(e) {
const {
onStartMove
} = this.$props;
_extends(this.state, {
dragging: true,
pageY: getPageY(e),
startTop: this.getTop()
});
onStartMove();
this.patchEvents();
e.stopPropagation();
e.preventDefault();
},
onMouseMove(e) {
const {
dragging,
pageY,
startTop
} = this.state;
const {
onScroll
} = this.$props;
wrapperRaf.cancel(this.moveRaf);
if (dragging) {
const offsetY = getPageY(e) - pageY;
const newTop = startTop + offsetY;
const enableScrollRange = this.getEnableScrollRange();
const enableHeightRange = this.getEnableHeightRange();
const ptg = enableHeightRange ? newTop / enableHeightRange : 0;
const newScrollTop = Math.ceil(ptg * enableScrollRange);
this.moveRaf = wrapperRaf(() => {
onScroll(newScrollTop);
});
}
},
onMouseUp() {
const {
onStopMove
} = this.$props;
this.state.dragging = false;
onStopMove();
this.removeEvents();
},
// ===================== Calculate =====================
getSpinHeight() {
const {
height,
scrollHeight
} = this.$props;
let baseHeight = height / scrollHeight * 100;
baseHeight = Math.max(baseHeight, MIN_SIZE);
baseHeight = Math.min(baseHeight, height / 2);
return Math.floor(baseHeight);
},
getEnableScrollRange() {
const {
scrollHeight,
height
} = this.$props;
return scrollHeight - height || 0;
},
getEnableHeightRange() {
const {
height
} = this.$props;
const spinHeight = this.getSpinHeight();
return height - spinHeight || 0;
},
getTop() {
const {
scrollTop
} = this.$props;
const enableScrollRange = this.getEnableScrollRange();
const enableHeightRange = this.getEnableHeightRange();
if (scrollTop === 0 || enableScrollRange === 0) {
return 0;
}
const ptg = scrollTop / enableScrollRange;
return ptg * enableHeightRange;
},
// Not show scrollbar when height is large than scrollHeight
showScroll() {
const {
height,
scrollHeight
} = this.$props;
return scrollHeight > height;
}
},
render() {
const {
dragging,
visible
} = this.state;
const {
prefixCls
} = this.$props;
const spinHeight = this.getSpinHeight() + "px";
const top = this.getTop() + "px";
const canScroll = this.showScroll();
const mergedVisible = canScroll && visible;
return createVNode("div", {
"ref": this.scrollbarRef,
"class": classNames(`${prefixCls}-scrollbar`, {
[`${prefixCls}-scrollbar-show`]: canScroll
}),
"style": {
width: "8px",
top: 0,
bottom: 0,
right: 0,
position: "absolute",
display: mergedVisible ? void 0 : "none"
},
"onMousedown": this.onContainerMouseDown,
"onMousemove": this.delayHidden
}, [createVNode("div", {
"ref": this.thumbRef,
"class": classNames(`${prefixCls}-scrollbar-thumb`, {
[`${prefixCls}-scrollbar-thumb-moving`]: dragging
}),
"style": {
width: "100%",
height: spinHeight,
top,
left: 0,
position: "absolute",
background: "rgba(0, 0, 0, 0.5)",
borderRadius: "99px",
cursor: "pointer",
userSelect: "none"
},
"onMousedown": this.onMouseDown
}, null)]);
}
});
function useHeights(mergedData, getKey2, onItemAdd, onItemRemove) {
const instance = /* @__PURE__ */ new Map();
const heights = /* @__PURE__ */ new Map();
const updatedMark = ref(Symbol("update"));
watch(mergedData, () => {
updatedMark.value = Symbol("update");
});
let collectRaf = void 0;
function cancelRaf() {
wrapperRaf.cancel(collectRaf);
}
function collectHeight() {
cancelRaf();
collectRaf = wrapperRaf(() => {
instance.forEach((element, key2) => {
if (element && element.offsetParent) {
const {
offsetHeight
} = element;
if (heights.get(key2) !== offsetHeight) {
updatedMark.value = Symbol("update");
heights.set(key2, element.offsetHeight);
}
}
});
});
}
function setInstance(item, ins) {
const key2 = getKey2(item);
instance.get(key2);
if (ins) {
instance.set(key2, ins.$el || ins);
collectHeight();
} else {
instance.delete(key2);
}
}
return [setInstance, collectHeight, heights, updatedMark];
}
function useScrollTo(containerRef, mergedData, heights, props2, getKey2, collectHeight, syncScrollTop, triggerFlash) {
let scroll;
return (arg) => {
if (arg === null || arg === void 0) {
triggerFlash();
return;
}
wrapperRaf.cancel(scroll);
const data = mergedData.value;
const itemHeight = props2.itemHeight;
if (typeof arg === "number") {
syncScrollTop(arg);
} else if (arg && typeof arg === "object") {
let index2;
const {
align
} = arg;
if ("index" in arg) {
({
index: index2
} = arg);
} else {
index2 = data.findIndex((item) => getKey2(item) === arg.key);
}
const {
offset: offset2 = 0
} = arg;
const syncScroll = (times, targetAlign) => {
if (times < 0 || !containerRef.value) return;
const height = containerRef.value.clientHeight;
let needCollectHeight = false;
let newTargetAlign = targetAlign;
if (height) {
const mergedAlign = targetAlign || align;
let stackTop = 0;
let itemTop = 0;
let itemBottom = 0;
const maxLen = Math.min(data.length, index2);
for (let i = 0; i <= maxLen; i += 1) {
const key2 = getKey2(data[i]);
itemTop = stackTop;
const cacheHeight = heights.get(key2);
itemBottom = itemTop + (cacheHeight === void 0 ? itemHeight : cacheHeight);
stackTop = itemBottom;
if (i === index2 && cacheHeight === void 0) {
needCollectHeight = true;
}
}
const scrollTop = containerRef.value.scrollTop;
let targetTop = null;
switch (mergedAlign) {
case "top":
targetTop = itemTop - offset2;
break;
case "bottom":
targetTop = itemBottom - height + offset2;
break;
default: {
const scrollBottom = scrollTop + height;
if (itemTop < scrollTop) {
newTargetAlign = "top";
} else if (itemBottom > scrollBottom) {
newTargetAlign = "bottom";
}
}
}
if (targetTop !== null && targetTop !== scrollTop) {
syncScrollTop(targetTop);
}
}
scroll = wrapperRaf(() => {
if (needCollectHeight) {
collectHeight();
}
syncScroll(times - 1, newTargetAlign);
}, 2);
};
syncScroll(5);
}
};
}
const useOriginScroll = ((isScrollAtTop, isScrollAtBottom) => {
let lock = false;
let lockTimeout = null;
function lockScroll() {
clearTimeout(lockTimeout);
lock = true;
lockTimeout = setTimeout(() => {
lock = false;
}, 50);
}
return function(deltaY) {
let smoothOffset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const originScroll = (
// Pass origin wheel when on the top
deltaY < 0 && isScrollAtTop.value || // Pass origin wheel when on the bottom
deltaY > 0 && isScrollAtBottom.value
);
if (smoothOffset && originScroll) {
clearTimeout(lockTimeout);
lock = false;
} else if (!originScroll || lock) {
lockScroll();
}
return !lock && originScroll;
};
});
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta) {
let offsetRef = 0;
let nextFrame = null;
let wheelValue = null;
let isMouseScroll = false;
const originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom);
function onWheel(event) {
if (!inVirtual.value) return;
wrapperRaf.cancel(nextFrame);
const {
deltaY
} = event;
offsetRef += deltaY;
wheelValue = deltaY;
if (originScroll(deltaY)) return;
{
event.preventDefault();
}
nextFrame = wrapperRaf(() => {
const patchMultiple = isMouseScroll ? 10 : 1;
onWheelDelta(offsetRef * patchMultiple);
offsetRef = 0;
});
}
function onFireFoxScroll(event) {
if (!inVirtual.value) return;
isMouseScroll = event.detail === wheelValue;
}
return [onWheel, onFireFoxScroll];
}
var __rest$18 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const EMPTY_DATA$1 = [];
const ScrollStyle = {
overflowY: "auto",
overflowAnchor: "none"
};
function renderChildren(list, startIndex, endIndex, setNodeRef, renderFunc, _ref) {
let {
getKey: getKey2
} = _ref;
return list.slice(startIndex, endIndex + 1).map((item, index2) => {
const eleIndex = startIndex + index2;
const node = renderFunc(item, eleIndex, {
// style: status === 'MEASURE_START' ? { visibility: 'hidden' } : {},
});
const key2 = getKey2(item);
return createVNode(Item$1, {
"key": key2,
"setRef": (ele) => setNodeRef(item, ele)
}, {
default: () => [node]
});
});
}
const List$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "List",
inheritAttrs: false,
props: {
prefixCls: String,
data: PropTypes.array,
height: Number,
itemHeight: Number,
/** If not match virtual scroll condition, Set List still use height of container. */
fullHeight: {
type: Boolean,
default: void 0
},
itemKey: {
type: [String, Number, Function],
required: true
},
component: {
type: [String, Object]
},
/** Set `false` will always use real scroll instead of virtual one */
virtual: {
type: Boolean,
default: void 0
},
children: Function,
onScroll: Function,
onMousedown: Function,
onMouseenter: Function,
onVisibleChange: Function
},
setup(props2, _ref2) {
let {
expose
} = _ref2;
const useVirtual = computed(() => {
const {
height,
itemHeight,
virtual
} = props2;
return !!(virtual !== false && height && itemHeight);
});
const inVirtual = computed(() => {
const {
height,
itemHeight,
data: data2
} = props2;
return useVirtual.value && data2 && itemHeight * data2.length > height;
});
const state = reactive({
scrollTop: 0,
scrollMoving: false
});
const data = computed(() => {
return props2.data || EMPTY_DATA$1;
});
const mergedData = shallowRef([]);
watch(data, () => {
mergedData.value = toRaw(data.value).slice();
}, {
immediate: true
});
const itemKey2 = shallowRef((_item) => void 0);
watch(() => props2.itemKey, (val) => {
if (typeof val === "function") {
itemKey2.value = val;
} else {
itemKey2.value = (item) => item === null || item === void 0 ? void 0 : item[val];
}
}, {
immediate: true
});
const componentRef = shallowRef();
const fillerInnerRef = shallowRef();
const scrollBarRef = shallowRef();
const getKey2 = (item) => {
return itemKey2.value(item);
};
const sharedConfig = {
getKey: getKey2
};
function syncScrollTop(newTop) {
let value;
if (typeof newTop === "function") {
value = newTop(state.scrollTop);
} else {
value = newTop;
}
const alignedTop = keepInRange(value);
if (componentRef.value) {
componentRef.value.scrollTop = alignedTop;
}
state.scrollTop = alignedTop;
}
const [setInstance, collectHeight, heights, updatedMark] = useHeights(mergedData, getKey2);
const calRes = reactive({
scrollHeight: void 0,
start: 0,
end: 0,
offset: void 0
});
const offsetHeight = shallowRef(0);
watch([useVirtual, mergedData], () => {
if (!useVirtual.value) {
_extends(calRes, {
scrollHeight: void 0,
start: 0,
end: mergedData.value.length - 1,
offset: void 0
});
}
}, {
immediate: true
});
watch([useVirtual, mergedData, offsetHeight, inVirtual], () => {
if (useVirtual.value && !inVirtual.value) {
_extends(calRes, {
scrollHeight: offsetHeight.value,
start: 0,
end: mergedData.value.length - 1,
offset: void 0
});
}
if (componentRef.value) {
state.scrollTop = componentRef.value.scrollTop;
}
}, {
immediate: true
});
watch([inVirtual, useVirtual, () => state.scrollTop, mergedData, updatedMark, () => props2.height, offsetHeight], () => {
if (!useVirtual.value || !inVirtual.value) {
return;
}
let itemTop = 0;
let startIndex;
let startOffset;
let endIndex;
const dataLen = mergedData.value.length;
const data2 = mergedData.value;
const scrollTop = state.scrollTop;
const {
itemHeight,
height
} = props2;
const scrollTopHeight = scrollTop + height;
for (let i = 0; i < dataLen; i += 1) {
const item = data2[i];
const key2 = getKey2(item);
let cacheHeight = heights.get(key2);
if (cacheHeight === void 0) {
cacheHeight = itemHeight;
}
const currentItemBottom = itemTop + cacheHeight;
if (startIndex === void 0 && currentItemBottom >= scrollTop) {
startIndex = i;
startOffset = itemTop;
}
if (endIndex === void 0 && currentItemBottom > scrollTopHeight) {
endIndex = i;
}
itemTop = currentItemBottom;
}
if (startIndex === void 0) {
startIndex = 0;
startOffset = 0;
endIndex = Math.ceil(height / itemHeight);
}
if (endIndex === void 0) {
endIndex = dataLen - 1;
}
endIndex = Math.min(endIndex + 1, dataLen);
_extends(calRes, {
scrollHeight: itemTop,
start: startIndex,
end: endIndex,
offset: startOffset
});
}, {
immediate: true
});
const maxScrollHeight = computed(() => calRes.scrollHeight - props2.height);
function keepInRange(newScrollTop) {
let newTop = newScrollTop;
if (!Number.isNaN(maxScrollHeight.value)) {
newTop = Math.min(newTop, maxScrollHeight.value);
}
newTop = Math.max(newTop, 0);
return newTop;
}
const isScrollAtTop = computed(() => state.scrollTop <= 0);
const isScrollAtBottom = computed(() => state.scrollTop >= maxScrollHeight.value);
function onScrollBar(newScrollTop) {
const newTop = newScrollTop;
syncScrollTop(newTop);
}
function onFallbackScroll(e) {
var _a;
const {
scrollTop: newScrollTop
} = e.currentTarget;
if (newScrollTop !== state.scrollTop) {
syncScrollTop(newScrollTop);
}
(_a = props2.onScroll) === null || _a === void 0 ? void 0 : _a.call(props2, e);
}
const [onRawWheel, onFireFoxScroll] = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, (offsetY) => {
syncScrollTop((top) => {
const newTop = top + offsetY;
return newTop;
});
});
function onMozMousePixelScroll(e) {
if (useVirtual.value) {
e.preventDefault();
}
}
const removeEventListener = () => {
if (componentRef.value) {
componentRef.value.removeEventListener("wheel", onRawWheel, supportsPassive ? {
passive: false
} : false);
componentRef.value.removeEventListener("DOMMouseScroll", onFireFoxScroll);
componentRef.value.removeEventListener("MozMousePixelScroll", onMozMousePixelScroll);
}
};
watchEffect(() => {
nextTick(() => {
if (componentRef.value) {
removeEventListener();
componentRef.value.addEventListener("wheel", onRawWheel, supportsPassive ? {
passive: false
} : false);
componentRef.value.addEventListener("DOMMouseScroll", onFireFoxScroll);
componentRef.value.addEventListener("MozMousePixelScroll", onMozMousePixelScroll);
}
});
});
const scrollTo2 = useScrollTo(componentRef, mergedData, heights, props2, getKey2, collectHeight, syncScrollTop, () => {
var _a;
(_a = scrollBarRef.value) === null || _a === void 0 ? void 0 : _a.delayHidden();
});
expose({
scrollTo: scrollTo2
});
const componentStyle = computed(() => {
let cs = null;
if (props2.height) {
cs = _extends({
[props2.fullHeight ? "height" : "maxHeight"]: props2.height + "px"
}, ScrollStyle);
if (useVirtual.value) {
cs.overflowY = "hidden";
if (state.scrollMoving) {
cs.pointerEvents = "none";
}
}
}
return cs;
});
watch([() => calRes.start, () => calRes.end, mergedData], () => {
if (props2.onVisibleChange) {
const renderList = mergedData.value.slice(calRes.start, calRes.end + 1);
props2.onVisibleChange(renderList, mergedData.value);
}
}, {
flush: "post"
});
const delayHideScrollBar = () => {
var _a;
(_a = scrollBarRef.value) === null || _a === void 0 ? void 0 : _a.delayHidden();
};
return {
state,
mergedData,
componentStyle,
onFallbackScroll,
onScrollBar,
componentRef,
useVirtual,
calRes,
collectHeight,
setInstance,
sharedConfig,
scrollBarRef,
fillerInnerRef,
delayHideScrollBar
};
},
render() {
const _a = _extends(_extends({}, this.$props), this.$attrs), {
prefixCls = "rc-virtual-list",
height,
itemHeight,
// eslint-disable-next-line no-unused-vars
fullHeight,
data,
itemKey: itemKey2,
virtual,
component: Component = "div",
onScroll,
children = this.$slots.default,
style,
class: className
} = _a, restProps = __rest$18(_a, ["prefixCls", "height", "itemHeight", "fullHeight", "data", "itemKey", "virtual", "component", "onScroll", "children", "style", "class"]);
const mergedClassName = classNames(prefixCls, className);
const {
scrollTop
} = this.state;
const {
scrollHeight,
offset: offset2,
start,
end
} = this.calRes;
const {
componentStyle,
onFallbackScroll,
onScrollBar,
useVirtual,
collectHeight,
sharedConfig,
setInstance,
mergedData,
delayHideScrollBar
} = this;
return createVNode("div", _objectSpread$W({
"style": _extends(_extends({}, style), {
position: "relative"
}),
"class": mergedClassName
}, restProps), [createVNode(Component, {
"class": `${prefixCls}-holder`,
"style": componentStyle,
"ref": "componentRef",
"onScroll": onFallbackScroll,
"onMouseenter": delayHideScrollBar
}, {
default: () => [createVNode(Filter, {
"prefixCls": prefixCls,
"height": scrollHeight,
"offset": offset2,
"onInnerResize": collectHeight,
"ref": "fillerInnerRef"
}, {
default: () => renderChildren(mergedData, start, end, setInstance, children, sharedConfig)
})]
}), useVirtual && createVNode(ScrollBar, {
"ref": "scrollBarRef",
"prefixCls": prefixCls,
"scrollTop": scrollTop,
"height": height,
"scrollHeight": scrollHeight,
"count": mergedData.length,
"onScroll": onScrollBar,
"onStartMove": () => {
this.state.scrollMoving = true;
},
"onStopMove": () => {
this.state.scrollMoving = false;
}
}, null)]);
}
});
function useMemo(getValue2, condition, shouldUpdate) {
const cacheRef = ref(getValue2());
watch(condition, (next, pre) => {
if (shouldUpdate) {
if (shouldUpdate(next, pre)) {
cacheRef.value = getValue2();
}
} else {
cacheRef.value = getValue2();
}
});
return cacheRef;
}
function isPlatformMac() {
return /(mac\sos|macintosh)/i.test((void 0).appVersion);
}
const SelectContextKey = Symbol("SelectContextKey");
function useProvideSelectProps(props2) {
return provide(SelectContextKey, props2);
}
function useSelectProps() {
return inject(SelectContextKey, {});
}
var __rest$17 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function isTitleType(content) {
return typeof content === "string" || typeof content === "number";
}
const OptionList$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "OptionList",
inheritAttrs: false,
setup(_, _ref) {
let {
expose,
slots
} = _ref;
const baseProps2 = useBaseProps();
const props2 = useSelectProps();
const itemPrefixCls = computed(() => `${baseProps2.prefixCls}-item`);
const memoFlattenOptions = useMemo(() => props2.flattenOptions, [() => baseProps2.open, () => props2.flattenOptions], (next) => next[0]);
const listRef = createRef();
const onListMouseDown = (event) => {
event.preventDefault();
};
const scrollIntoView2 = (args) => {
if (listRef.current) {
listRef.current.scrollTo(typeof args === "number" ? {
index: args
} : args);
}
};
const getEnabledActiveIndex = function(index2) {
let offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
const len = memoFlattenOptions.value.length;
for (let i = 0; i < len; i += 1) {
const current = (index2 + i * offset2 + len) % len;
const {
group,
data
} = memoFlattenOptions.value[current];
if (!group && !data.disabled) {
return current;
}
}
return -1;
};
const state = reactive({
activeIndex: getEnabledActiveIndex(0)
});
const setActive = function(index2) {
let fromKeyboard = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
state.activeIndex = index2;
const info = {
source: fromKeyboard ? "keyboard" : "mouse"
};
const flattenItem = memoFlattenOptions.value[index2];
if (!flattenItem) {
props2.onActiveValue(null, -1, info);
return;
}
props2.onActiveValue(flattenItem.value, index2, info);
};
watch([() => memoFlattenOptions.value.length, () => baseProps2.searchValue], () => {
setActive(props2.defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
}, {
immediate: true
});
const isSelected = (value) => props2.rawValues.has(value) && baseProps2.mode !== "combobox";
watch([() => baseProps2.open, () => baseProps2.searchValue], () => {
if (!baseProps2.multiple && baseProps2.open && props2.rawValues.size === 1) {
const value = Array.from(props2.rawValues)[0];
const index2 = toRaw(memoFlattenOptions.value).findIndex((_ref2) => {
let {
data
} = _ref2;
return data[props2.fieldNames.value] === value;
});
if (index2 !== -1) {
setActive(index2);
nextTick(() => {
scrollIntoView2(index2);
});
}
}
if (baseProps2.open) {
nextTick(() => {
var _a;
(_a = listRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo(void 0);
});
}
}, {
immediate: true,
flush: "post"
});
const onSelectValue = (value) => {
if (value !== void 0) {
props2.onSelect(value, {
selected: !props2.rawValues.has(value)
});
}
if (!baseProps2.multiple) {
baseProps2.toggleOpen(false);
}
};
const getLabel = (item) => typeof item.label === "function" ? item.label() : item.label;
function renderItem(index2) {
const item = memoFlattenOptions.value[index2];
if (!item) return null;
const itemData = item.data || {};
const {
value
} = itemData;
const {
group
} = item;
const attrs = pickAttrs(itemData, true);
const mergedLabel = getLabel(item);
return item ? createVNode("div", _objectSpread$W(_objectSpread$W({
"aria-label": typeof mergedLabel === "string" && !group ? mergedLabel : null
}, attrs), {}, {
"key": index2,
"role": group ? "presentation" : "option",
"id": `${baseProps2.id}_list_${index2}`,
"aria-selected": isSelected(value)
}), [value]) : null;
}
const onKeydown = (event) => {
const {
which,
ctrlKey
} = event;
switch (which) {
// >>> Arrow keys & ctrl + n/p on Mac
case KeyCode.N:
case KeyCode.P:
case KeyCode.UP:
case KeyCode.DOWN: {
let offset2 = 0;
if (which === KeyCode.UP) {
offset2 = -1;
} else if (which === KeyCode.DOWN) {
offset2 = 1;
} else if (isPlatformMac() && ctrlKey) {
if (which === KeyCode.N) {
offset2 = 1;
} else if (which === KeyCode.P) {
offset2 = -1;
}
}
if (offset2 !== 0) {
const nextActiveIndex = getEnabledActiveIndex(state.activeIndex + offset2, offset2);
scrollIntoView2(nextActiveIndex);
setActive(nextActiveIndex, true);
}
break;
}
// >>> Select
case KeyCode.ENTER: {
const item = memoFlattenOptions.value[state.activeIndex];
if (item && !item.data.disabled) {
onSelectValue(item.value);
} else {
onSelectValue(void 0);
}
if (baseProps2.open) {
event.preventDefault();
}
break;
}
// >>> Close
case KeyCode.ESC: {
baseProps2.toggleOpen(false);
if (baseProps2.open) {
event.stopPropagation();
}
}
}
};
const onKeyup = () => {
};
const scrollTo2 = (index2) => {
scrollIntoView2(index2);
};
expose({
onKeydown,
onKeyup,
scrollTo: scrollTo2
});
return () => {
const {
id,
notFoundContent,
onPopupScroll
} = baseProps2;
const {
menuItemSelectedIcon,
fieldNames,
virtual,
listHeight,
listItemHeight
} = props2;
const renderOption = slots.option;
const {
activeIndex
} = state;
const omitFieldNameList = Object.keys(fieldNames).map((key2) => fieldNames[key2]);
if (memoFlattenOptions.value.length === 0) {
return createVNode("div", {
"role": "listbox",
"id": `${id}_list`,
"class": `${itemPrefixCls.value}-empty`,
"onMousedown": onListMouseDown
}, [notFoundContent]);
}
return createVNode(Fragment, null, [createVNode("div", {
"role": "listbox",
"id": `${id}_list`,
"style": {
height: 0,
width: 0,
overflow: "hidden"
}
}, [renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)]), createVNode(List$2, {
"itemKey": "key",
"ref": listRef,
"data": memoFlattenOptions.value,
"height": listHeight,
"itemHeight": listItemHeight,
"fullHeight": false,
"onMousedown": onListMouseDown,
"onScroll": onPopupScroll,
"virtual": virtual
}, {
default: (item, itemIndex) => {
var _a;
const {
group,
groupOption,
data,
value
} = item;
const {
key: key2
} = data;
const label = typeof item.label === "function" ? item.label() : item.label;
if (group) {
const groupTitle = (_a = data.title) !== null && _a !== void 0 ? _a : isTitleType(label) && label;
return createVNode("div", {
"class": classNames(itemPrefixCls.value, `${itemPrefixCls.value}-group`),
"title": groupTitle
}, [renderOption ? renderOption(data) : label !== void 0 ? label : key2]);
}
const {
disabled,
title,
children,
style,
class: cls,
className
} = data, otherProps = __rest$17(data, ["disabled", "title", "children", "style", "class", "className"]);
const passedProps = omit(otherProps, omitFieldNameList);
const selected = isSelected(value);
const optionPrefixCls = `${itemPrefixCls.value}-option`;
const optionClassName = classNames(itemPrefixCls.value, optionPrefixCls, cls, className, {
[`${optionPrefixCls}-grouped`]: groupOption,
[`${optionPrefixCls}-active`]: activeIndex === itemIndex && !disabled,
[`${optionPrefixCls}-disabled`]: disabled,
[`${optionPrefixCls}-selected`]: selected
});
const mergedLabel = getLabel(item);
const iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === "function" || selected;
const content = typeof mergedLabel === "number" ? mergedLabel : mergedLabel || value;
let optionTitle = isTitleType(content) ? content.toString() : void 0;
if (title !== void 0) {
optionTitle = title;
}
return createVNode("div", _objectSpread$W(_objectSpread$W({}, passedProps), {}, {
"aria-selected": selected,
"class": optionClassName,
"title": optionTitle,
"onMousemove": (e) => {
if (otherProps.onMousemove) {
otherProps.onMousemove(e);
}
if (activeIndex === itemIndex || disabled) {
return;
}
setActive(itemIndex);
},
"onClick": (e) => {
if (!disabled) {
onSelectValue(value);
}
if (otherProps.onClick) {
otherProps.onClick(e);
}
},
"style": style
}), [createVNode("div", {
"class": `${optionPrefixCls}-content`
}, [renderOption ? renderOption(data) : content]), isValidElement(menuItemSelectedIcon) || selected, iconVisible && createVNode(TransBtn, {
"class": `${itemPrefixCls.value}-option-state`,
"customizeIcon": menuItemSelectedIcon,
"customizeIconProps": {
isSelected: selected
}
}, {
default: () => [selected ? "✓" : null]
})]);
}
})]);
};
}
});
var __rest$16 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function convertNodeToOption(node) {
const _a = node, {
key: key2,
children
} = _a, _b = _a.props, {
value,
disabled
} = _b, restProps = __rest$16(_b, ["value", "disabled"]);
const child = children === null || children === void 0 ? void 0 : children.default;
return _extends({
key: key2,
value: value !== void 0 ? value : key2,
children: child,
disabled: disabled || disabled === ""
}, restProps);
}
function convertChildrenToData$1(nodes) {
let optionOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const dd = flattenChildren(nodes).map((node, index2) => {
var _a;
if (!isValidElement(node) || !node.type) {
return null;
}
const {
type: {
isSelectOptGroup
},
key: key2,
children,
props: props2
} = node;
if (optionOnly || !isSelectOptGroup) {
return convertNodeToOption(node);
}
const child = children && children.default ? children.default() : void 0;
const label = (props2 === null || props2 === void 0 ? void 0 : props2.label) || ((_a = children.label) === null || _a === void 0 ? void 0 : _a.call(children)) || key2;
return _extends(_extends({
key: `__RC_SELECT_GRP__${key2 === null ? index2 : String(key2)}__`
}, props2), {
label,
options: convertChildrenToData$1(child || [])
});
}).filter((data) => data);
return dd;
}
function useOptions(options, children, fieldNames) {
const mergedOptions = shallowRef();
const valueOptions = shallowRef();
const labelOptions = shallowRef();
const tempMergedOptions = shallowRef([]);
watch([options, children], () => {
if (options.value) {
tempMergedOptions.value = toRaw(options.value).slice();
} else {
tempMergedOptions.value = convertChildrenToData$1(children.value);
}
}, {
immediate: true,
deep: true
});
watchEffect(() => {
const newOptions = tempMergedOptions.value;
const newValueOptions = /* @__PURE__ */ new Map();
const newLabelOptions = /* @__PURE__ */ new Map();
const fieldNamesValue = fieldNames.value;
function dig(optionList) {
let isChildren = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
for (let i = 0; i < optionList.length; i += 1) {
const option = optionList[i];
if (!option[fieldNamesValue.options] || isChildren) {
newValueOptions.set(option[fieldNamesValue.value], option);
newLabelOptions.set(option[fieldNamesValue.label], option);
} else {
dig(option[fieldNamesValue.options], true);
}
}
}
dig(newOptions);
mergedOptions.value = newOptions;
valueOptions.value = newValueOptions;
labelOptions.value = newLabelOptions;
});
return {
options: mergedOptions,
valueOptions,
labelOptions
};
}
function getUUID$2() {
let retId;
{
retId = "TEST_OR_SSR";
}
return retId;
}
function useId$1() {
let id = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ref("");
const innerId = `rc_select_${getUUID$2()}`;
return id.value || innerId;
}
function toArray$7(value) {
if (Array.isArray(value)) {
return value;
}
return value !== void 0 ? [value] : [];
}
function includes(test, search) {
return toArray$7(test).join("").toUpperCase().includes(search);
}
const useFilterOptions = ((options, fieldNames, searchValue, filterOption2, optionFilterProp) => computed(() => {
const searchValueVal = searchValue.value;
const optionFilterPropValue = optionFilterProp === null || optionFilterProp === void 0 ? void 0 : optionFilterProp.value;
const filterOptionValue = filterOption2 === null || filterOption2 === void 0 ? void 0 : filterOption2.value;
if (!searchValueVal || filterOptionValue === false) {
return options.value;
}
const {
options: fieldOptions,
label: fieldLabel,
value: fieldValue
} = fieldNames.value;
const filteredOptions = [];
const customizeFilter = typeof filterOptionValue === "function";
const upperSearch = searchValueVal.toUpperCase();
const filterFunc = customizeFilter ? filterOptionValue : (_, option) => {
if (optionFilterPropValue) {
return includes(option[optionFilterPropValue], upperSearch);
}
if (option[fieldOptions]) {
return includes(option[fieldLabel !== "children" ? fieldLabel : "label"], upperSearch);
}
return includes(option[fieldValue], upperSearch);
};
const wrapOption = customizeFilter ? (opt) => injectPropsWithOption(opt) : (opt) => opt;
options.value.forEach((item) => {
if (item[fieldOptions]) {
const matchGroup = filterFunc(searchValueVal, wrapOption(item));
if (matchGroup) {
filteredOptions.push(item);
} else {
const subOptions = item[fieldOptions].filter((subItem) => filterFunc(searchValueVal, wrapOption(subItem)));
if (subOptions.length) {
filteredOptions.push(_extends(_extends({}, item), {
[fieldOptions]: subOptions
}));
}
}
return;
}
if (filterFunc(searchValueVal, wrapOption(item))) {
filteredOptions.push(item);
}
});
return filteredOptions;
}));
const useCache$1 = ((labeledValues, valueOptions) => {
const cacheRef = shallowRef({
values: /* @__PURE__ */ new Map(),
options: /* @__PURE__ */ new Map()
});
const filledLabeledValues = computed(() => {
const {
values: prevValueCache,
options: prevOptionCache
} = cacheRef.value;
const patchedValues = labeledValues.value.map((item) => {
var _a;
if (item.label === void 0) {
return _extends(_extends({}, item), {
label: (_a = prevValueCache.get(item.value)) === null || _a === void 0 ? void 0 : _a.label
});
}
return item;
});
const valueCache = /* @__PURE__ */ new Map();
const optionCache = /* @__PURE__ */ new Map();
patchedValues.forEach((item) => {
valueCache.set(item.value, item);
optionCache.set(item.value, valueOptions.value.get(item.value) || prevOptionCache.get(item.value));
});
cacheRef.value.values = valueCache;
cacheRef.value.options = optionCache;
return patchedValues;
});
const getOption = (val) => valueOptions.value.get(val) || cacheRef.value.options.get(val);
return [filledLabeledValues, getOption];
});
function useMergedState(defaultStateValue, option) {
const {
defaultValue,
value = ref()
} = option || {};
let initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
if (value.value !== void 0) {
initValue = unref(value);
}
if (defaultValue !== void 0) {
initValue = typeof defaultValue === "function" ? defaultValue() : defaultValue;
}
const innerValue = ref(initValue);
const mergedValue = ref(initValue);
watchEffect(() => {
let val = value.value !== void 0 ? value.value : innerValue.value;
if (option.postState) {
val = option.postState(val);
}
mergedValue.value = val;
});
function triggerChange(newValue) {
const preVal = mergedValue.value;
innerValue.value = newValue;
if (toRaw(mergedValue.value) !== newValue && option.onChange) {
option.onChange(newValue, preVal);
}
}
watch(value, () => {
innerValue.value = value.value;
});
return [mergedValue, triggerChange];
}
function useState$1(defaultStateValue) {
const initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
const innerValue = ref(initValue);
function triggerChange(newValue) {
innerValue.value = newValue;
}
return [innerValue, triggerChange];
}
const OMIT_DOM_PROPS = ["inputValue"];
function selectProps$1() {
return _extends(_extends({}, baseSelectPropsWithoutPrivate()), {
prefixCls: String,
id: String,
backfill: {
type: Boolean,
default: void 0
},
// >>> Field Names
fieldNames: Object,
// >>> Search
/** @deprecated Use `searchValue` instead */
inputValue: String,
searchValue: String,
onSearch: Function,
autoClearSearchValue: {
type: Boolean,
default: void 0
},
// >>> Select
onSelect: Function,
onDeselect: Function,
// >>> Options
/**
* In Select, `false` means do nothing.
* In TreeSelect, `false` will highlight match item.
* It's by design.
*/
filterOption: {
type: [Boolean, Function],
default: void 0
},
filterSort: Function,
optionFilterProp: String,
optionLabelProp: String,
options: Array,
defaultActiveFirstOption: {
type: Boolean,
default: void 0
},
virtual: {
type: Boolean,
default: void 0
},
listHeight: Number,
listItemHeight: Number,
// >>> Icon
menuItemSelectedIcon: PropTypes.any,
mode: String,
labelInValue: {
type: Boolean,
default: void 0
},
value: PropTypes.any,
defaultValue: PropTypes.any,
onChange: Function,
children: Array
});
}
function isRawValue$1(value) {
return !value || typeof value !== "object";
}
const Select$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "VcSelect",
inheritAttrs: false,
props: initDefaultProps(selectProps$1(), {
prefixCls: "vc-select",
autoClearSearchValue: true,
listHeight: 200,
listItemHeight: 20,
dropdownMatchSelectWidth: true
}),
setup(props2, _ref) {
let {
expose,
attrs,
slots
} = _ref;
const mergedId = useId$1(toRef(props2, "id"));
const multiple = computed(() => isMultiple(props2.mode));
const childrenAsData = computed(() => !!(!props2.options && props2.children));
const mergedFilterOption = computed(() => {
if (props2.filterOption === void 0 && props2.mode === "combobox") {
return false;
}
return props2.filterOption;
});
const mergedFieldNames = computed(() => fillFieldNames$3(props2.fieldNames, childrenAsData.value));
const [mergedSearchValue, setSearchValue] = useMergedState("", {
value: computed(() => props2.searchValue !== void 0 ? props2.searchValue : props2.inputValue),
postState: (search) => search || ""
});
const parsedOptions = useOptions(toRef(props2, "options"), toRef(props2, "children"), mergedFieldNames);
const {
valueOptions,
labelOptions,
options: mergedOptions
} = parsedOptions;
const convert2LabelValues = (draftValues) => {
const valueList = toArray$7(draftValues);
return valueList.map((val) => {
var _a, _b;
let rawValue;
let rawLabel;
let rawKey;
let rawDisabled;
if (isRawValue$1(val)) {
rawValue = val;
} else {
rawKey = val.key;
rawLabel = val.label;
rawValue = (_a = val.value) !== null && _a !== void 0 ? _a : rawKey;
}
const option = valueOptions.value.get(rawValue);
if (option) {
if (rawLabel === void 0) rawLabel = option === null || option === void 0 ? void 0 : option[props2.optionLabelProp || mergedFieldNames.value.label];
if (rawKey === void 0) rawKey = (_b = option === null || option === void 0 ? void 0 : option.key) !== null && _b !== void 0 ? _b : rawValue;
rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
}
return {
label: rawLabel,
value: rawValue,
key: rawKey,
disabled: rawDisabled,
option
};
});
};
const [internalValue, setInternalValue] = useMergedState(props2.defaultValue, {
value: toRef(props2, "value")
});
const rawLabeledValues = computed(() => {
var _a;
const values = convert2LabelValues(internalValue.value);
if (props2.mode === "combobox" && !((_a = values[0]) === null || _a === void 0 ? void 0 : _a.value)) {
return [];
}
return values;
});
const [mergedValues, getMixedOption] = useCache$1(rawLabeledValues, valueOptions);
const displayValues = computed(() => {
if (!props2.mode && mergedValues.value.length === 1) {
const firstValue = mergedValues.value[0];
if (firstValue.value === null && (firstValue.label === null || firstValue.label === void 0)) {
return [];
}
}
return mergedValues.value.map((item) => {
var _a;
return _extends(_extends({}, item), {
label: (_a = typeof item.label === "function" ? item.label() : item.label) !== null && _a !== void 0 ? _a : item.value
});
});
});
const rawValues = computed(() => new Set(mergedValues.value.map((val) => val.value)));
watchEffect(() => {
var _a;
if (props2.mode === "combobox") {
const strValue = (_a = mergedValues.value[0]) === null || _a === void 0 ? void 0 : _a.value;
if (strValue !== void 0 && strValue !== null) {
setSearchValue(String(strValue));
}
}
}, {
flush: "post"
});
const createTagOption = (val, label) => {
const mergedLabel = label !== null && label !== void 0 ? label : val;
return {
[mergedFieldNames.value.value]: val,
[mergedFieldNames.value.label]: mergedLabel
};
};
const filledTagOptions = shallowRef();
watchEffect(() => {
if (props2.mode !== "tags") {
filledTagOptions.value = mergedOptions.value;
return;
}
const cloneOptions = mergedOptions.value.slice();
const existOptions = (val) => valueOptions.value.has(val);
[...mergedValues.value].sort((a, b) => a.value < b.value ? -1 : 1).forEach((item) => {
const val = item.value;
if (!existOptions(val)) {
cloneOptions.push(createTagOption(val, item.label));
}
});
filledTagOptions.value = cloneOptions;
});
const filteredOptions = useFilterOptions(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, toRef(props2, "optionFilterProp"));
const filledSearchOptions = computed(() => {
if (props2.mode !== "tags" || !mergedSearchValue.value || filteredOptions.value.some((item) => item[props2.optionFilterProp || "value"] === mergedSearchValue.value)) {
return filteredOptions.value;
}
return [createTagOption(mergedSearchValue.value), ...filteredOptions.value];
});
const orderedFilteredOptions = computed(() => {
if (!props2.filterSort) {
return filledSearchOptions.value;
}
return [...filledSearchOptions.value].sort((a, b) => props2.filterSort(a, b));
});
const displayOptions = computed(() => flattenOptions(orderedFilteredOptions.value, {
fieldNames: mergedFieldNames.value,
childrenAsData: childrenAsData.value
}));
const triggerChange = (values) => {
const labeledValues = convert2LabelValues(values);
setInternalValue(labeledValues);
if (props2.onChange && // Trigger event only when value changed
(labeledValues.length !== mergedValues.value.length || labeledValues.some((newVal, index2) => {
var _a;
return ((_a = mergedValues.value[index2]) === null || _a === void 0 ? void 0 : _a.value) !== (newVal === null || newVal === void 0 ? void 0 : newVal.value);
}))) {
const returnValues = props2.labelInValue ? labeledValues.map((v) => {
return _extends(_extends({}, v), {
originLabel: v.label,
label: typeof v.label === "function" ? v.label() : v.label
});
}) : labeledValues.map((v) => v.value);
const returnOptions = labeledValues.map((v) => injectPropsWithOption(getMixedOption(v.value)));
props2.onChange(
// Value
multiple.value ? returnValues : returnValues[0],
// Option
multiple.value ? returnOptions : returnOptions[0]
);
}
};
const [activeValue, setActiveValue] = useState$1(null);
const [accessibilityIndex, setAccessibilityIndex] = useState$1(0);
const mergedDefaultActiveFirstOption = computed(() => props2.defaultActiveFirstOption !== void 0 ? props2.defaultActiveFirstOption : props2.mode !== "combobox");
const onActiveValue = function(active, index2) {
let {
source = "keyboard"
} = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
setAccessibilityIndex(index2);
if (props2.backfill && props2.mode === "combobox" && active !== null && source === "keyboard") {
setActiveValue(String(active));
}
};
const triggerSelect = (val, selected) => {
const getSelectEnt = () => {
var _a;
const option = getMixedOption(val);
const originLabel = option === null || option === void 0 ? void 0 : option[mergedFieldNames.value.label];
return [props2.labelInValue ? {
label: typeof originLabel === "function" ? originLabel() : originLabel,
originLabel,
value: val,
key: (_a = option === null || option === void 0 ? void 0 : option.key) !== null && _a !== void 0 ? _a : val
} : val, injectPropsWithOption(option)];
};
if (selected && props2.onSelect) {
const [wrappedValue, option] = getSelectEnt();
props2.onSelect(wrappedValue, option);
} else if (!selected && props2.onDeselect) {
const [wrappedValue, option] = getSelectEnt();
props2.onDeselect(wrappedValue, option);
}
};
const onInternalSelect = (val, info) => {
let cloneValues;
const mergedSelect = multiple.value ? info.selected : true;
if (mergedSelect) {
cloneValues = multiple.value ? [...mergedValues.value, val] : [val];
} else {
cloneValues = mergedValues.value.filter((v) => v.value !== val);
}
triggerChange(cloneValues);
triggerSelect(val, mergedSelect);
if (props2.mode === "combobox") {
setActiveValue("");
} else if (!multiple.value || props2.autoClearSearchValue) {
setSearchValue("");
setActiveValue("");
}
};
const onDisplayValuesChange = (nextValues, info) => {
triggerChange(nextValues);
if (info.type === "remove" || info.type === "clear") {
info.values.forEach((item) => {
triggerSelect(item.value, false);
});
}
};
const onInternalSearch = (searchText, info) => {
var _a;
setSearchValue(searchText);
setActiveValue(null);
if (info.source === "submit") {
const formatted = (searchText || "").trim();
if (formatted) {
const newRawValues = Array.from(/* @__PURE__ */ new Set([...rawValues.value, formatted]));
triggerChange(newRawValues);
triggerSelect(formatted, true);
setSearchValue("");
}
return;
}
if (info.source !== "blur") {
if (props2.mode === "combobox") {
triggerChange(searchText);
}
(_a = props2.onSearch) === null || _a === void 0 ? void 0 : _a.call(props2, searchText);
}
};
const onInternalSearchSplit = (words) => {
let patchValues = words;
if (props2.mode !== "tags") {
patchValues = words.map((word) => {
const opt = labelOptions.value.get(word);
return opt === null || opt === void 0 ? void 0 : opt.value;
}).filter((val) => val !== void 0);
}
const newRawValues = Array.from(/* @__PURE__ */ new Set([...rawValues.value, ...patchValues]));
triggerChange(newRawValues);
newRawValues.forEach((newRawValue) => {
triggerSelect(newRawValue, true);
});
};
const realVirtual = computed(() => props2.virtual !== false && props2.dropdownMatchSelectWidth !== false);
useProvideSelectProps(toReactive(_extends(_extends({}, parsedOptions), {
flattenOptions: displayOptions,
onActiveValue,
defaultActiveFirstOption: mergedDefaultActiveFirstOption,
onSelect: onInternalSelect,
menuItemSelectedIcon: toRef(props2, "menuItemSelectedIcon"),
rawValues,
fieldNames: mergedFieldNames,
virtual: realVirtual,
listHeight: toRef(props2, "listHeight"),
listItemHeight: toRef(props2, "listItemHeight"),
childrenAsData
})));
const selectRef = ref();
expose({
focus() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.blur();
},
scrollTo(arg) {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(arg);
}
});
const pickProps = computed(() => {
return omit(props2, [
"id",
"mode",
"prefixCls",
"backfill",
"fieldNames",
// Search
"inputValue",
"searchValue",
"onSearch",
"autoClearSearchValue",
// Select
"onSelect",
"onDeselect",
"dropdownMatchSelectWidth",
// Options
"filterOption",
"filterSort",
"optionFilterProp",
"optionLabelProp",
"options",
"children",
"defaultActiveFirstOption",
"menuItemSelectedIcon",
"virtual",
"listHeight",
"listItemHeight",
// Value
"value",
"defaultValue",
"labelInValue",
"onChange"
]);
});
return () => {
return createVNode(BaseSelect, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, pickProps.value), attrs), {}, {
"id": mergedId,
"prefixCls": props2.prefixCls,
"ref": selectRef,
"omitDomProps": OMIT_DOM_PROPS,
"mode": props2.mode,
"displayValues": displayValues.value,
"onDisplayValuesChange": onDisplayValuesChange,
"searchValue": mergedSearchValue.value,
"onSearch": onInternalSearch,
"onSearchSplit": onInternalSearchSplit,
"dropdownMatchSelectWidth": props2.dropdownMatchSelectWidth,
"OptionList": OptionList$2,
"emptyOptions": !displayOptions.value.length,
"activeValue": activeValue.value,
"activeDescendantId": `${mergedId}_list_${accessibilityIndex.value}`
}), slots);
};
}
});
const Option$1 = () => null;
Option$1.isSelectOption = true;
Option$1.displayName = "ASelectOption";
const OptGroup$1 = () => null;
OptGroup$1.isSelectOptGroup = true;
OptGroup$1.displayName = "ASelectOptGroup";
function getIcons(props2) {
let slots = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const {
loading: loading2,
multiple,
prefixCls,
hasFeedback,
feedbackIcon,
showArrow
} = props2;
const suffixIcon = props2.suffixIcon || slots.suffixIcon && slots.suffixIcon();
const clearIcon = props2.clearIcon || slots.clearIcon && slots.clearIcon();
const menuItemSelectedIcon = props2.menuItemSelectedIcon || slots.menuItemSelectedIcon && slots.menuItemSelectedIcon();
const removeIcon = props2.removeIcon || slots.removeIcon && slots.removeIcon();
const mergedClearIcon = clearIcon !== null && clearIcon !== void 0 ? clearIcon : createVNode(CloseCircleFilled, null, null);
const getSuffixIconNode = (arrowIcon) => createVNode(Fragment, null, [showArrow !== false && arrowIcon, hasFeedback && feedbackIcon]);
let mergedSuffixIcon = null;
if (suffixIcon !== void 0) {
mergedSuffixIcon = getSuffixIconNode(suffixIcon);
} else if (loading2) {
mergedSuffixIcon = getSuffixIconNode(createVNode(LoadingOutlined, {
"spin": true
}, null));
} else {
const iconCls = `${prefixCls}-suffix`;
mergedSuffixIcon = (_ref) => {
let {
open: open2,
showSearch
} = _ref;
if (open2 && showSearch) {
return getSuffixIconNode(createVNode(SearchOutlined, {
"class": iconCls
}, null));
}
return getSuffixIconNode(createVNode(DownOutlined, {
"class": iconCls
}, null));
};
}
let mergedItemIcon = null;
if (menuItemSelectedIcon !== void 0) {
mergedItemIcon = menuItemSelectedIcon;
} else if (multiple) {
mergedItemIcon = createVNode(CheckOutlined, null, null);
} else {
mergedItemIcon = null;
}
let mergedRemoveIcon = null;
if (removeIcon !== void 0) {
mergedRemoveIcon = removeIcon;
} else {
mergedRemoveIcon = createVNode(CloseOutlined, null, null);
}
return {
clearIcon: mergedClearIcon,
suffixIcon: mergedSuffixIcon,
itemIcon: mergedItemIcon,
removeIcon: mergedRemoveIcon
};
}
function createContext(defaultValue) {
const contextKey2 = Symbol("contextKey");
const useProvide = (props2, newProps) => {
const mergedProps = reactive({});
provide(contextKey2, mergedProps);
watchEffect(() => {
_extends(mergedProps, props2, newProps || {});
});
return mergedProps;
};
const useInject = () => {
return inject(contextKey2, defaultValue) || {};
};
return {
useProvide,
useInject
};
}
const ContextKey$1 = Symbol("ContextProps");
const InternalContextKey = Symbol("InternalContextProps");
const useProvideFormItemContext = function(props2) {
let useValidation = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : computed(() => true);
const formItemFields = ref(/* @__PURE__ */ new Map());
const addFormItemField = (key2, type) => {
formItemFields.value.set(key2, type);
formItemFields.value = new Map(formItemFields.value);
};
const removeFormItemField = (key2) => {
formItemFields.value.delete(key2);
formItemFields.value = new Map(formItemFields.value);
};
getCurrentInstance();
watch([useValidation, formItemFields], () => {
});
provide(ContextKey$1, props2);
provide(InternalContextKey, {
addFormItemField,
removeFormItemField
});
};
const defaultContext = {
id: computed(() => void 0),
onFieldBlur: () => {
},
onFieldChange: () => {
},
clearValidate: () => {
}
};
const defaultInternalContext = {
addFormItemField: () => {
},
removeFormItemField: () => {
}
};
const useInjectFormItemContext = () => {
const internalContext = inject(InternalContextKey, defaultInternalContext);
const formItemFieldKey = Symbol("FormItemFieldKey");
const instance = getCurrentInstance();
internalContext.addFormItemField(formItemFieldKey, instance.type);
provide(InternalContextKey, defaultInternalContext);
provide(ContextKey$1, defaultContext);
return inject(ContextKey$1, defaultContext);
};
const FormItemRest = defineComponent({
compatConfig: {
MODE: 3
},
name: "AFormItemRest",
setup(_, _ref) {
let {
slots
} = _ref;
provide(InternalContextKey, defaultInternalContext);
provide(ContextKey$1, defaultContext);
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const FormItemInputContext = createContext({});
const NoFormStatus = defineComponent({
name: "NoFormStatus",
setup(_, _ref2) {
let {
slots
} = _ref2;
FormItemInputContext.useProvide({});
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
function getStatusClassNames(prefixCls, status, hasFeedback) {
return classNames({
[`${prefixCls}-status-success`]: status === "success",
[`${prefixCls}-status-warning`]: status === "warning",
[`${prefixCls}-status-error`]: status === "error",
[`${prefixCls}-status-validating`]: status === "validating",
[`${prefixCls}-has-feedback`]: hasFeedback
});
}
const getMergedStatus = (contextStatus, customStatus) => customStatus || contextStatus;
const genSpaceCompactStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: {
display: "inline-flex",
"&-block": {
display: "flex",
width: "100%"
},
"&-vertical": {
flexDirection: "column"
}
}
};
};
const genSpaceStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: {
display: "inline-flex",
"&-rtl": {
direction: "rtl"
},
"&-vertical": {
flexDirection: "column"
},
"&-align": {
flexDirection: "column",
"&-center": {
alignItems: "center"
},
"&-start": {
alignItems: "flex-start"
},
"&-end": {
alignItems: "flex-end"
},
"&-baseline": {
alignItems: "baseline"
}
},
[`${componentCls}-item`]: {
"&:empty": {
display: "none"
}
}
}
};
};
const useStyle$W = genComponentStyleHook("Space", (token) => [genSpaceStyle(token), genSpaceCompactStyle(token)]);
const spaceCompactItemProps = () => ({
compactSize: String,
compactDirection: PropTypes.oneOf(tuple$1("horizontal", "vertical")).def("horizontal"),
isFirstItem: booleanType(),
isLastItem: booleanType()
});
const SpaceCompactItemContext = createContext(null);
const useCompactItemContext = (prefixCls, direction) => {
const compactItemContext = SpaceCompactItemContext.useInject();
const compactItemClassnames = computed(() => {
if (!compactItemContext || isEmpty$1(compactItemContext)) return "";
const {
compactDirection,
isFirstItem,
isLastItem
} = compactItemContext;
const separator = compactDirection === "vertical" ? "-vertical-" : "-";
return classNames({
[`${prefixCls.value}-compact${separator}item`]: true,
[`${prefixCls.value}-compact${separator}first-item`]: isFirstItem,
[`${prefixCls.value}-compact${separator}last-item`]: isLastItem,
[`${prefixCls.value}-compact${separator}item-rtl`]: direction.value === "rtl"
});
});
return {
compactSize: computed(() => compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.compactSize),
compactDirection: computed(() => compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.compactDirection),
compactItemClassnames
};
};
const NoCompactStyle = defineComponent({
name: "NoCompactStyle",
setup(_, _ref) {
let {
slots
} = _ref;
SpaceCompactItemContext.useProvide(null);
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const spaceCompactProps = () => ({
prefixCls: String,
size: {
type: String
},
direction: PropTypes.oneOf(tuple$1("horizontal", "vertical")).def("horizontal"),
align: PropTypes.oneOf(tuple$1("start", "end", "center", "baseline")),
block: {
type: Boolean,
default: void 0
}
});
const CompactItem = defineComponent({
name: "CompactItem",
props: spaceCompactItemProps(),
setup(props2, _ref2) {
let {
slots
} = _ref2;
SpaceCompactItemContext.useProvide(props2);
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const Compact = defineComponent({
name: "ASpaceCompact",
inheritAttrs: false,
props: spaceCompactProps(),
setup(props2, _ref3) {
let {
attrs,
slots
} = _ref3;
const {
prefixCls,
direction: directionConfig
} = useConfigInject("space-compact", props2);
const compactItemContext = SpaceCompactItemContext.useInject();
const [wrapSSR, hashId] = useStyle$W(prefixCls);
const clx = computed(() => {
return classNames(prefixCls.value, hashId.value, {
[`${prefixCls.value}-rtl`]: directionConfig.value === "rtl",
[`${prefixCls.value}-block`]: props2.block,
[`${prefixCls.value}-vertical`]: props2.direction === "vertical"
});
});
return () => {
var _a;
const childNodes = flattenChildren(((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) || []);
if (childNodes.length === 0) {
return null;
}
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [clx.value, attrs.class]
}), [childNodes.map((child, i) => {
var _a2;
const key2 = child && child.key || `${prefixCls.value}-item-${i}`;
const noCompactItemContext = !compactItemContext || isEmpty$1(compactItemContext);
return createVNode(CompactItem, {
"key": key2,
"compactSize": (_a2 = props2.size) !== null && _a2 !== void 0 ? _a2 : "middle",
"compactDirection": props2.direction,
"isFirstItem": i === 0 && (noCompactItemContext || (compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.isFirstItem)),
"isLastItem": i === childNodes.length - 1 && (noCompactItemContext || (compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.isLastItem))
}, {
default: () => [child]
});
})]));
};
}
});
const initMotionCommon = (duration) => ({
animationDuration: duration,
animationFillMode: "both"
});
const initMotionCommonLeave = (duration) => ({
animationDuration: duration,
animationFillMode: "both"
});
const initMotion = function(motionCls, inKeyframes, outKeyframes, duration) {
let sameLevel = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
const sameLevelPrefix = sameLevel ? "&" : "";
return {
[`
${sameLevelPrefix}${motionCls}-enter,
${sameLevelPrefix}${motionCls}-appear
`]: _extends(_extends({}, initMotionCommon(duration)), {
animationPlayState: "paused"
}),
[`${sameLevelPrefix}${motionCls}-leave`]: _extends(_extends({}, initMotionCommonLeave(duration)), {
animationPlayState: "paused"
}),
[`
${sameLevelPrefix}${motionCls}-enter${motionCls}-enter-active,
${sameLevelPrefix}${motionCls}-appear${motionCls}-appear-active
`]: {
animationName: inKeyframes,
animationPlayState: "running"
},
[`${sameLevelPrefix}${motionCls}-leave${motionCls}-leave-active`]: {
animationName: outKeyframes,
animationPlayState: "running",
pointerEvents: "none"
}
};
};
const fadeIn = new Keyframe("antFadeIn", {
"0%": {
opacity: 0
},
"100%": {
opacity: 1
}
});
const fadeOut = new Keyframe("antFadeOut", {
"0%": {
opacity: 1
},
"100%": {
opacity: 0
}
});
const initFadeMotion = function(token) {
let sameLevel = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const {
antCls
} = token;
const motionCls = `${antCls}-fade`;
const sameLevelPrefix = sameLevel ? "&" : "";
return [initMotion(motionCls, fadeIn, fadeOut, token.motionDurationMid, sameLevel), {
[`
${sameLevelPrefix}${motionCls}-enter,
${sameLevelPrefix}${motionCls}-appear
`]: {
opacity: 0,
animationTimingFunction: "linear"
},
[`${sameLevelPrefix}${motionCls}-leave`]: {
animationTimingFunction: "linear"
}
}];
};
const moveDownIn = new Keyframe("antMoveDownIn", {
"0%": {
transform: "translate3d(0, 100%, 0)",
transformOrigin: "0 0",
opacity: 0
},
"100%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
}
});
const moveDownOut = new Keyframe("antMoveDownOut", {
"0%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
},
"100%": {
transform: "translate3d(0, 100%, 0)",
transformOrigin: "0 0",
opacity: 0
}
});
const moveLeftIn = new Keyframe("antMoveLeftIn", {
"0%": {
transform: "translate3d(-100%, 0, 0)",
transformOrigin: "0 0",
opacity: 0
},
"100%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
}
});
const moveLeftOut = new Keyframe("antMoveLeftOut", {
"0%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
},
"100%": {
transform: "translate3d(-100%, 0, 0)",
transformOrigin: "0 0",
opacity: 0
}
});
const moveRightIn = new Keyframe("antMoveRightIn", {
"0%": {
transform: "translate3d(100%, 0, 0)",
transformOrigin: "0 0",
opacity: 0
},
"100%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
}
});
const moveRightOut = new Keyframe("antMoveRightOut", {
"0%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
},
"100%": {
transform: "translate3d(100%, 0, 0)",
transformOrigin: "0 0",
opacity: 0
}
});
const moveUpIn = new Keyframe("antMoveUpIn", {
"0%": {
transform: "translate3d(0, -100%, 0)",
transformOrigin: "0 0",
opacity: 0
},
"100%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
}
});
const moveUpOut = new Keyframe("antMoveUpOut", {
"0%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
},
"100%": {
transform: "translate3d(0, -100%, 0)",
transformOrigin: "0 0",
opacity: 0
}
});
const moveMotion = {
"move-up": {
inKeyframes: moveUpIn,
outKeyframes: moveUpOut
},
"move-down": {
inKeyframes: moveDownIn,
outKeyframes: moveDownOut
},
"move-left": {
inKeyframes: moveLeftIn,
outKeyframes: moveLeftOut
},
"move-right": {
inKeyframes: moveRightIn,
outKeyframes: moveRightOut
}
};
const initMoveMotion = (token, motionName) => {
const {
antCls
} = token;
const motionCls = `${antCls}-${motionName}`;
const {
inKeyframes,
outKeyframes
} = moveMotion[motionName];
return [initMotion(motionCls, inKeyframes, outKeyframes, token.motionDurationMid), {
[`
${motionCls}-enter,
${motionCls}-appear
`]: {
opacity: 0,
animationTimingFunction: token.motionEaseOutCirc
},
[`${motionCls}-leave`]: {
animationTimingFunction: token.motionEaseInOutCirc
}
}];
};
const slideUpIn = new Keyframe("antSlideUpIn", {
"0%": {
transform: "scaleY(0.8)",
transformOrigin: "0% 0%",
opacity: 0
},
"100%": {
transform: "scaleY(1)",
transformOrigin: "0% 0%",
opacity: 1
}
});
const slideUpOut = new Keyframe("antSlideUpOut", {
"0%": {
transform: "scaleY(1)",
transformOrigin: "0% 0%",
opacity: 1
},
"100%": {
transform: "scaleY(0.8)",
transformOrigin: "0% 0%",
opacity: 0
}
});
const slideDownIn = new Keyframe("antSlideDownIn", {
"0%": {
transform: "scaleY(0.8)",
transformOrigin: "100% 100%",
opacity: 0
},
"100%": {
transform: "scaleY(1)",
transformOrigin: "100% 100%",
opacity: 1
}
});
const slideDownOut = new Keyframe("antSlideDownOut", {
"0%": {
transform: "scaleY(1)",
transformOrigin: "100% 100%",
opacity: 1
},
"100%": {
transform: "scaleY(0.8)",
transformOrigin: "100% 100%",
opacity: 0
}
});
const slideLeftIn = new Keyframe("antSlideLeftIn", {
"0%": {
transform: "scaleX(0.8)",
transformOrigin: "0% 0%",
opacity: 0
},
"100%": {
transform: "scaleX(1)",
transformOrigin: "0% 0%",
opacity: 1
}
});
const slideLeftOut = new Keyframe("antSlideLeftOut", {
"0%": {
transform: "scaleX(1)",
transformOrigin: "0% 0%",
opacity: 1
},
"100%": {
transform: "scaleX(0.8)",
transformOrigin: "0% 0%",
opacity: 0
}
});
const slideRightIn = new Keyframe("antSlideRightIn", {
"0%": {
transform: "scaleX(0.8)",
transformOrigin: "100% 0%",
opacity: 0
},
"100%": {
transform: "scaleX(1)",
transformOrigin: "100% 0%",
opacity: 1
}
});
const slideRightOut = new Keyframe("antSlideRightOut", {
"0%": {
transform: "scaleX(1)",
transformOrigin: "100% 0%",
opacity: 1
},
"100%": {
transform: "scaleX(0.8)",
transformOrigin: "100% 0%",
opacity: 0
}
});
const slideMotion = {
"slide-up": {
inKeyframes: slideUpIn,
outKeyframes: slideUpOut
},
"slide-down": {
inKeyframes: slideDownIn,
outKeyframes: slideDownOut
},
"slide-left": {
inKeyframes: slideLeftIn,
outKeyframes: slideLeftOut
},
"slide-right": {
inKeyframes: slideRightIn,
outKeyframes: slideRightOut
}
};
const initSlideMotion = (token, motionName) => {
const {
antCls
} = token;
const motionCls = `${antCls}-${motionName}`;
const {
inKeyframes,
outKeyframes
} = slideMotion[motionName];
return [initMotion(motionCls, inKeyframes, outKeyframes, token.motionDurationMid), {
[`
${motionCls}-enter,
${motionCls}-appear
`]: {
transform: "scale(0)",
transformOrigin: "0% 0%",
opacity: 0,
animationTimingFunction: token.motionEaseOutQuint
},
[`${motionCls}-leave`]: {
animationTimingFunction: token.motionEaseInQuint
}
}];
};
const zoomIn = new Keyframe("antZoomIn", {
"0%": {
transform: "scale(0.2)",
opacity: 0
},
"100%": {
transform: "scale(1)",
opacity: 1
}
});
const zoomOut = new Keyframe("antZoomOut", {
"0%": {
transform: "scale(1)"
},
"100%": {
transform: "scale(0.2)",
opacity: 0
}
});
const zoomBigIn = new Keyframe("antZoomBigIn", {
"0%": {
transform: "scale(0.8)",
opacity: 0
},
"100%": {
transform: "scale(1)",
opacity: 1
}
});
const zoomBigOut = new Keyframe("antZoomBigOut", {
"0%": {
transform: "scale(1)"
},
"100%": {
transform: "scale(0.8)",
opacity: 0
}
});
const zoomUpIn = new Keyframe("antZoomUpIn", {
"0%": {
transform: "scale(0.8)",
transformOrigin: "50% 0%",
opacity: 0
},
"100%": {
transform: "scale(1)",
transformOrigin: "50% 0%"
}
});
const zoomUpOut = new Keyframe("antZoomUpOut", {
"0%": {
transform: "scale(1)",
transformOrigin: "50% 0%"
},
"100%": {
transform: "scale(0.8)",
transformOrigin: "50% 0%",
opacity: 0
}
});
const zoomLeftIn = new Keyframe("antZoomLeftIn", {
"0%": {
transform: "scale(0.8)",
transformOrigin: "0% 50%",
opacity: 0
},
"100%": {
transform: "scale(1)",
transformOrigin: "0% 50%"
}
});
const zoomLeftOut = new Keyframe("antZoomLeftOut", {
"0%": {
transform: "scale(1)",
transformOrigin: "0% 50%"
},
"100%": {
transform: "scale(0.8)",
transformOrigin: "0% 50%",
opacity: 0
}
});
const zoomRightIn = new Keyframe("antZoomRightIn", {
"0%": {
transform: "scale(0.8)",
transformOrigin: "100% 50%",
opacity: 0
},
"100%": {
transform: "scale(1)",
transformOrigin: "100% 50%"
}
});
const zoomRightOut = new Keyframe("antZoomRightOut", {
"0%": {
transform: "scale(1)",
transformOrigin: "100% 50%"
},
"100%": {
transform: "scale(0.8)",
transformOrigin: "100% 50%",
opacity: 0
}
});
const zoomDownIn = new Keyframe("antZoomDownIn", {
"0%": {
transform: "scale(0.8)",
transformOrigin: "50% 100%",
opacity: 0
},
"100%": {
transform: "scale(1)",
transformOrigin: "50% 100%"
}
});
const zoomDownOut = new Keyframe("antZoomDownOut", {
"0%": {
transform: "scale(1)",
transformOrigin: "50% 100%"
},
"100%": {
transform: "scale(0.8)",
transformOrigin: "50% 100%",
opacity: 0
}
});
const zoomMotion = {
zoom: {
inKeyframes: zoomIn,
outKeyframes: zoomOut
},
"zoom-big": {
inKeyframes: zoomBigIn,
outKeyframes: zoomBigOut
},
"zoom-big-fast": {
inKeyframes: zoomBigIn,
outKeyframes: zoomBigOut
},
"zoom-left": {
inKeyframes: zoomLeftIn,
outKeyframes: zoomLeftOut
},
"zoom-right": {
inKeyframes: zoomRightIn,
outKeyframes: zoomRightOut
},
"zoom-up": {
inKeyframes: zoomUpIn,
outKeyframes: zoomUpOut
},
"zoom-down": {
inKeyframes: zoomDownIn,
outKeyframes: zoomDownOut
}
};
const initZoomMotion = (token, motionName) => {
const {
antCls
} = token;
const motionCls = `${antCls}-${motionName}`;
const {
inKeyframes,
outKeyframes
} = zoomMotion[motionName];
return [initMotion(motionCls, inKeyframes, outKeyframes, motionName === "zoom-big-fast" ? token.motionDurationFast : token.motionDurationMid), {
[`
${motionCls}-enter,
${motionCls}-appear
`]: {
transform: "scale(0)",
opacity: 0,
animationTimingFunction: token.motionEaseOutCirc,
"&-prepare": {
transform: "none"
}
},
[`${motionCls}-leave`]: {
animationTimingFunction: token.motionEaseInOutCirc
}
}];
};
const genCollapseMotion = (token) => ({
[token.componentCls]: {
// For common/openAnimation
[`${token.antCls}-motion-collapse-legacy`]: {
overflow: "hidden",
"&-active": {
transition: `height ${token.motionDurationMid} ${token.motionEaseInOut},
opacity ${token.motionDurationMid} ${token.motionEaseInOut} !important`
}
},
[`${token.antCls}-motion-collapse`]: {
overflow: "hidden",
transition: `height ${token.motionDurationMid} ${token.motionEaseInOut},
opacity ${token.motionDurationMid} ${token.motionEaseInOut} !important`
}
}
});
const genItemStyle = (token) => {
const {
controlPaddingHorizontal
} = token;
return {
position: "relative",
display: "block",
minHeight: token.controlHeight,
padding: `${(token.controlHeight - token.fontSize * token.lineHeight) / 2}px ${controlPaddingHorizontal}px`,
color: token.colorText,
fontWeight: "normal",
fontSize: token.fontSize,
lineHeight: token.lineHeight,
boxSizing: "border-box"
};
};
const genSingleStyle$1 = (token) => {
const {
antCls,
componentCls
} = token;
const selectItemCls = `${componentCls}-item`;
return [
{
[`${componentCls}-dropdown`]: _extends(_extends({}, resetComponent(token)), {
position: "absolute",
top: -9999,
zIndex: token.zIndexPopup,
boxSizing: "border-box",
padding: token.paddingXXS,
overflow: "hidden",
fontSize: token.fontSize,
// Fix select render lag of long text in chrome
// https://github.com/ant-design/ant-design/issues/11456
// https://github.com/ant-design/ant-design/issues/11843
fontVariant: "initial",
backgroundColor: token.colorBgElevated,
borderRadius: token.borderRadiusLG,
outline: "none",
boxShadow: token.boxShadowSecondary,
[`
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-bottomLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-bottomLeft
`]: {
animationName: slideUpIn
},
[`
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-topLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-topLeft
`]: {
animationName: slideDownIn
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-bottomLeft`]: {
animationName: slideUpOut
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-topLeft`]: {
animationName: slideDownOut
},
"&-hidden": {
display: "none"
},
"&-empty": {
color: token.colorTextDisabled
},
// ========================= Options =========================
[`${selectItemCls}-empty`]: _extends(_extends({}, genItemStyle(token)), {
color: token.colorTextDisabled
}),
[`${selectItemCls}`]: _extends(_extends({}, genItemStyle(token)), {
cursor: "pointer",
transition: `background ${token.motionDurationSlow} ease`,
borderRadius: token.borderRadiusSM,
// =========== Group ============
"&-group": {
color: token.colorTextDescription,
fontSize: token.fontSizeSM,
cursor: "default"
},
// =========== Option ===========
"&-option": {
display: "flex",
"&-content": _extends({
flex: "auto"
}, textEllipsis),
"&-state": {
flex: "none"
},
[`&-active:not(${selectItemCls}-option-disabled)`]: {
backgroundColor: token.controlItemBgHover
},
[`&-selected:not(${selectItemCls}-option-disabled)`]: {
color: token.colorText,
fontWeight: token.fontWeightStrong,
backgroundColor: token.controlItemBgActive,
[`${selectItemCls}-option-state`]: {
color: token.colorPrimary
}
},
"&-disabled": {
[`&${selectItemCls}-option-selected`]: {
backgroundColor: token.colorBgContainerDisabled
},
color: token.colorTextDisabled,
cursor: "not-allowed"
},
"&-grouped": {
paddingInlineStart: token.controlPaddingHorizontal * 2
}
}
}),
// =========================== RTL ===========================
"&-rtl": {
direction: "rtl"
}
})
},
// Follow code may reuse in other components
initSlideMotion(token, "slide-up"),
initSlideMotion(token, "slide-down"),
initMoveMotion(token, "move-up"),
initMoveMotion(token, "move-down")
];
};
const FIXED_ITEM_MARGIN = 2;
function getSelectItemStyle(_ref) {
let {
controlHeightSM,
controlHeight,
lineWidth: borderWidth
} = _ref;
const selectItemDist = (controlHeight - controlHeightSM) / 2 - borderWidth;
const selectItemMargin = Math.ceil(selectItemDist / 2);
return [selectItemDist, selectItemMargin];
}
function genSizeStyle$3(token, suffix) {
const {
componentCls,
iconCls
} = token;
const selectOverflowPrefixCls = `${componentCls}-selection-overflow`;
const selectItemHeight = token.controlHeightSM;
const [selectItemDist] = getSelectItemStyle(token);
const suffixCls = suffix ? `${componentCls}-${suffix}` : "";
return {
[`${componentCls}-multiple${suffixCls}`]: {
fontSize: token.fontSize,
/**
* Do not merge `height` & `line-height` under style with `selection` & `search`, since chrome
* may update to redesign with its align logic.
*/
// =========================== Overflow ===========================
[selectOverflowPrefixCls]: {
position: "relative",
display: "flex",
flex: "auto",
flexWrap: "wrap",
maxWidth: "100%",
"&-item": {
flex: "none",
alignSelf: "center",
maxWidth: "100%",
display: "inline-flex"
}
},
// ========================= Selector =========================
[`${componentCls}-selector`]: {
display: "flex",
flexWrap: "wrap",
alignItems: "center",
// Multiple is little different that horizontal is follow the vertical
padding: `${selectItemDist - FIXED_ITEM_MARGIN}px ${FIXED_ITEM_MARGIN * 2}px`,
borderRadius: token.borderRadius,
[`${componentCls}-show-search&`]: {
cursor: "text"
},
[`${componentCls}-disabled&`]: {
background: token.colorBgContainerDisabled,
cursor: "not-allowed"
},
"&:after": {
display: "inline-block",
width: 0,
margin: `${FIXED_ITEM_MARGIN}px 0`,
lineHeight: `${selectItemHeight}px`,
content: '"\\a0"'
}
},
[`
&${componentCls}-show-arrow ${componentCls}-selector,
&${componentCls}-allow-clear ${componentCls}-selector
`]: {
paddingInlineEnd: token.fontSizeIcon + token.controlPaddingHorizontal
},
// ======================== Selections ========================
[`${componentCls}-selection-item`]: {
position: "relative",
display: "flex",
flex: "none",
boxSizing: "border-box",
maxWidth: "100%",
height: selectItemHeight,
marginTop: FIXED_ITEM_MARGIN,
marginBottom: FIXED_ITEM_MARGIN,
lineHeight: `${selectItemHeight - token.lineWidth * 2}px`,
background: token.colorFillSecondary,
border: `${token.lineWidth}px solid ${token.colorSplit}`,
borderRadius: token.borderRadiusSM,
cursor: "default",
transition: `font-size ${token.motionDurationSlow}, line-height ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
userSelect: "none",
marginInlineEnd: FIXED_ITEM_MARGIN * 2,
paddingInlineStart: token.paddingXS,
paddingInlineEnd: token.paddingXS / 2,
[`${componentCls}-disabled&`]: {
color: token.colorTextDisabled,
borderColor: token.colorBorder,
cursor: "not-allowed"
},
// It's ok not to do this, but 24px makes bottom narrow in view should adjust
"&-content": {
display: "inline-block",
marginInlineEnd: token.paddingXS / 2,
overflow: "hidden",
whiteSpace: "pre",
textOverflow: "ellipsis"
},
"&-remove": _extends(_extends({}, resetIcon()), {
display: "inline-block",
color: token.colorIcon,
fontWeight: "bold",
fontSize: 10,
lineHeight: "inherit",
cursor: "pointer",
[`> ${iconCls}`]: {
verticalAlign: "-0.2em"
},
"&:hover": {
color: token.colorIconHover
}
})
},
// ========================== Input ==========================
[`${selectOverflowPrefixCls}-item + ${selectOverflowPrefixCls}-item`]: {
[`${componentCls}-selection-search`]: {
marginInlineStart: 0
}
},
[`${componentCls}-selection-search`]: {
display: "inline-flex",
position: "relative",
maxWidth: "100%",
marginInlineStart: token.inputPaddingHorizontalBase - selectItemDist,
[`
&-input,
&-mirror
`]: {
height: selectItemHeight,
fontFamily: token.fontFamily,
lineHeight: `${selectItemHeight}px`,
transition: `all ${token.motionDurationSlow}`
},
"&-input": {
width: "100%",
minWidth: 4.1
// fix search cursor missing
},
"&-mirror": {
position: "absolute",
top: 0,
insetInlineStart: 0,
insetInlineEnd: "auto",
zIndex: 999,
whiteSpace: "pre",
visibility: "hidden"
}
},
// ======================= Placeholder =======================
[`${componentCls}-selection-placeholder `]: {
position: "absolute",
top: "50%",
insetInlineStart: token.inputPaddingHorizontalBase,
insetInlineEnd: token.inputPaddingHorizontalBase,
transform: "translateY(-50%)",
transition: `all ${token.motionDurationSlow}`
}
}
};
}
function genMultipleStyle(token) {
const {
componentCls
} = token;
const smallToken = merge(token, {
controlHeight: token.controlHeightSM,
controlHeightSM: token.controlHeightXS,
borderRadius: token.borderRadiusSM,
borderRadiusSM: token.borderRadiusXS
});
const [, smSelectItemMargin] = getSelectItemStyle(token);
return [
genSizeStyle$3(token),
// ======================== Small ========================
// Shared
genSizeStyle$3(smallToken, "sm"),
// Padding
{
[`${componentCls}-multiple${componentCls}-sm`]: {
[`${componentCls}-selection-placeholder`]: {
insetInlineStart: token.controlPaddingHorizontalSM - token.lineWidth,
insetInlineEnd: "auto"
},
// https://github.com/ant-design/ant-design/issues/29559
[`${componentCls}-selection-search`]: {
marginInlineStart: smSelectItemMargin
}
}
},
// ======================== Large ========================
// Shared
genSizeStyle$3(merge(token, {
fontSize: token.fontSizeLG,
controlHeight: token.controlHeightLG,
controlHeightSM: token.controlHeight,
borderRadius: token.borderRadiusLG,
borderRadiusSM: token.borderRadius
}), "lg")
];
}
function genSizeStyle$2(token, suffix) {
const {
componentCls,
inputPaddingHorizontalBase,
borderRadius
} = token;
const selectHeightWithoutBorder = token.controlHeight - token.lineWidth * 2;
const selectionItemPadding = Math.ceil(token.fontSize * 1.25);
const suffixCls = suffix ? `${componentCls}-${suffix}` : "";
return {
[`${componentCls}-single${suffixCls}`]: {
fontSize: token.fontSize,
// ========================= Selector =========================
[`${componentCls}-selector`]: _extends(_extends({}, resetComponent(token)), {
display: "flex",
borderRadius,
[`${componentCls}-selection-search`]: {
position: "absolute",
top: 0,
insetInlineStart: inputPaddingHorizontalBase,
insetInlineEnd: inputPaddingHorizontalBase,
bottom: 0,
"&-input": {
width: "100%"
}
},
[`
${componentCls}-selection-item,
${componentCls}-selection-placeholder
`]: {
padding: 0,
lineHeight: `${selectHeightWithoutBorder}px`,
transition: `all ${token.motionDurationSlow}`,
// Firefox inline-block position calculation is not same as Chrome & Safari. Patch this:
"@supports (-moz-appearance: meterbar)": {
lineHeight: `${selectHeightWithoutBorder}px`
}
},
[`${componentCls}-selection-item`]: {
position: "relative",
userSelect: "none"
},
[`${componentCls}-selection-placeholder`]: {
transition: "none",
pointerEvents: "none"
},
// For common baseline align
[[
"&:after",
/* For '' value baseline align */
`${componentCls}-selection-item:after`,
/* For undefined value baseline align */
`${componentCls}-selection-placeholder:after`
].join(",")]: {
display: "inline-block",
width: 0,
visibility: "hidden",
content: '"\\a0"'
}
}),
[`
&${componentCls}-show-arrow ${componentCls}-selection-item,
&${componentCls}-show-arrow ${componentCls}-selection-placeholder
`]: {
paddingInlineEnd: selectionItemPadding
},
// Opacity selection if open
[`&${componentCls}-open ${componentCls}-selection-item`]: {
color: token.colorTextPlaceholder
},
// ========================== Input ==========================
// We only change the style of non-customize input which is only support by `combobox` mode.
// Not customize
[`&:not(${componentCls}-customize-input)`]: {
[`${componentCls}-selector`]: {
width: "100%",
height: token.controlHeight,
padding: `0 ${inputPaddingHorizontalBase}px`,
[`${componentCls}-selection-search-input`]: {
height: selectHeightWithoutBorder
},
"&:after": {
lineHeight: `${selectHeightWithoutBorder}px`
}
}
},
[`&${componentCls}-customize-input`]: {
[`${componentCls}-selector`]: {
"&:after": {
display: "none"
},
[`${componentCls}-selection-search`]: {
position: "static",
width: "100%"
},
[`${componentCls}-selection-placeholder`]: {
position: "absolute",
insetInlineStart: 0,
insetInlineEnd: 0,
padding: `0 ${inputPaddingHorizontalBase}px`,
"&:after": {
display: "none"
}
}
}
}
}
};
}
function genSingleStyle(token) {
const {
componentCls
} = token;
const inputPaddingHorizontalSM = token.controlPaddingHorizontalSM - token.lineWidth;
return [
genSizeStyle$2(token),
// ======================== Small ========================
// Shared
genSizeStyle$2(merge(token, {
controlHeight: token.controlHeightSM,
borderRadius: token.borderRadiusSM
}), "sm"),
// padding
{
[`${componentCls}-single${componentCls}-sm`]: {
[`&:not(${componentCls}-customize-input)`]: {
[`${componentCls}-selection-search`]: {
insetInlineStart: inputPaddingHorizontalSM,
insetInlineEnd: inputPaddingHorizontalSM
},
[`${componentCls}-selector`]: {
padding: `0 ${inputPaddingHorizontalSM}px`
},
// With arrow should provides `padding-right` to show the arrow
[`&${componentCls}-show-arrow ${componentCls}-selection-search`]: {
insetInlineEnd: inputPaddingHorizontalSM + token.fontSize * 1.5
},
[`
&${componentCls}-show-arrow ${componentCls}-selection-item,
&${componentCls}-show-arrow ${componentCls}-selection-placeholder
`]: {
paddingInlineEnd: token.fontSize * 1.5
}
}
}
},
// ======================== Large ========================
// Shared
genSizeStyle$2(merge(token, {
controlHeight: token.controlHeightLG,
fontSize: token.fontSizeLG,
borderRadius: token.borderRadiusLG
}), "lg")
];
}
function compactItemBorder(token, parentCls, options) {
const {
focusElCls,
focus,
borderElCls
} = options;
const childCombinator = borderElCls ? "> *" : "";
const hoverEffects = ["hover", focus ? "focus" : null, "active"].filter(Boolean).map((n) => `&:${n} ${childCombinator}`).join(",");
return {
[`&-item:not(${parentCls}-last-item)`]: {
marginInlineEnd: -token.lineWidth
},
"&-item": _extends(_extends({
[hoverEffects]: {
zIndex: 2
}
}, focusElCls ? {
[`&${focusElCls}`]: {
zIndex: 2
}
} : {}), {
[`&[disabled] ${childCombinator}`]: {
zIndex: 0
}
})
};
}
function compactItemBorderRadius(prefixCls, parentCls, options) {
const {
borderElCls
} = options;
const childCombinator = borderElCls ? `> ${borderElCls}` : "";
return {
[`&-item:not(${parentCls}-first-item):not(${parentCls}-last-item) ${childCombinator}`]: {
borderRadius: 0
},
[`&-item:not(${parentCls}-last-item)${parentCls}-first-item`]: {
[`& ${childCombinator}, &${prefixCls}-sm ${childCombinator}, &${prefixCls}-lg ${childCombinator}`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
[`&-item:not(${parentCls}-first-item)${parentCls}-last-item`]: {
[`& ${childCombinator}, &${prefixCls}-sm ${childCombinator}, &${prefixCls}-lg ${childCombinator}`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
}
};
}
function genCompactItemStyle(token) {
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
focus: true
};
const {
componentCls
} = token;
const compactCls = `${componentCls}-compact`;
return {
[compactCls]: _extends(_extends({}, compactItemBorder(token, compactCls, options)), compactItemBorderRadius(componentCls, compactCls, options))
};
}
const genSelectorStyle = (token) => {
const {
componentCls
} = token;
return {
position: "relative",
backgroundColor: token.colorBgContainer,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,
input: {
cursor: "pointer"
},
[`${componentCls}-show-search&`]: {
cursor: "text",
input: {
cursor: "auto",
color: "inherit"
}
},
[`${componentCls}-disabled&`]: {
color: token.colorTextDisabled,
background: token.colorBgContainerDisabled,
cursor: "not-allowed",
[`${componentCls}-multiple&`]: {
background: token.colorBgContainerDisabled
},
input: {
cursor: "not-allowed"
}
}
};
};
const genStatusStyle$2 = function(rootSelectCls, token) {
let overwriteDefaultBorder = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
const {
componentCls,
borderHoverColor,
outlineColor,
antCls
} = token;
const overwriteStyle = overwriteDefaultBorder ? {
[`${componentCls}-selector`]: {
borderColor: borderHoverColor
}
} : {};
return {
[rootSelectCls]: {
[`&:not(${componentCls}-disabled):not(${componentCls}-customize-input):not(${antCls}-pagination-size-changer)`]: _extends(_extends({}, overwriteStyle), {
[`${componentCls}-focused& ${componentCls}-selector`]: {
borderColor: borderHoverColor,
boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${outlineColor}`,
borderInlineEndWidth: `${token.controlLineWidth}px !important`,
outline: 0
},
[`&:hover ${componentCls}-selector`]: {
borderColor: borderHoverColor,
borderInlineEndWidth: `${token.controlLineWidth}px !important`
}
})
}
};
};
const getSearchInputWithoutBorderStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-selection-search-input`]: {
margin: 0,
padding: 0,
background: "transparent",
border: "none",
outline: "none",
appearance: "none",
"&::-webkit-search-cancel-button": {
display: "none",
"-webkit-appearance": "none"
}
}
};
};
const genBaseStyle$j = (token) => {
const {
componentCls,
inputPaddingHorizontalBase,
iconCls
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "inline-block",
cursor: "pointer",
[`&:not(${componentCls}-customize-input) ${componentCls}-selector`]: _extends(_extends({}, genSelectorStyle(token)), getSearchInputWithoutBorderStyle(token)),
// [`&:not(&-disabled):hover ${selectCls}-selector`]: {
// ...genHoverStyle(token),
// },
// ======================== Selection ========================
[`${componentCls}-selection-item`]: _extends({
flex: 1,
fontWeight: "normal"
}, textEllipsis),
// ======================= Placeholder =======================
[`${componentCls}-selection-placeholder`]: _extends(_extends({}, textEllipsis), {
flex: 1,
color: token.colorTextPlaceholder,
pointerEvents: "none"
}),
// ========================== Arrow ==========================
[`${componentCls}-arrow`]: _extends(_extends({}, resetIcon()), {
position: "absolute",
top: "50%",
insetInlineStart: "auto",
insetInlineEnd: inputPaddingHorizontalBase,
height: token.fontSizeIcon,
marginTop: -token.fontSizeIcon / 2,
color: token.colorTextQuaternary,
fontSize: token.fontSizeIcon,
lineHeight: 1,
textAlign: "center",
pointerEvents: "none",
display: "flex",
alignItems: "center",
[iconCls]: {
verticalAlign: "top",
transition: `transform ${token.motionDurationSlow}`,
"> svg": {
verticalAlign: "top"
},
[`&:not(${componentCls}-suffix)`]: {
pointerEvents: "auto"
}
},
[`${componentCls}-disabled &`]: {
cursor: "not-allowed"
},
"> *:not(:last-child)": {
marginInlineEnd: 8
// FIXME: magic
}
}),
// ========================== Clear ==========================
[`${componentCls}-clear`]: {
position: "absolute",
top: "50%",
insetInlineStart: "auto",
insetInlineEnd: inputPaddingHorizontalBase,
zIndex: 1,
display: "inline-block",
width: token.fontSizeIcon,
height: token.fontSizeIcon,
marginTop: -token.fontSizeIcon / 2,
color: token.colorTextQuaternary,
fontSize: token.fontSizeIcon,
fontStyle: "normal",
lineHeight: 1,
textAlign: "center",
textTransform: "none",
background: token.colorBgContainer,
cursor: "pointer",
opacity: 0,
transition: `color ${token.motionDurationMid} ease, opacity ${token.motionDurationSlow} ease`,
textRendering: "auto",
"&:before": {
display: "block"
},
"&:hover": {
color: token.colorTextTertiary
}
},
"&:hover": {
[`${componentCls}-clear`]: {
opacity: 1
}
}
}),
// ========================= Feedback ==========================
[`${componentCls}-has-feedback`]: {
[`${componentCls}-clear`]: {
insetInlineEnd: inputPaddingHorizontalBase + token.fontSize + token.paddingXXS
}
}
};
};
const genSelectStyle = (token) => {
const {
componentCls
} = token;
return [
{
[componentCls]: {
// ==================== BorderLess ====================
[`&-borderless ${componentCls}-selector`]: {
backgroundColor: `transparent !important`,
borderColor: `transparent !important`,
boxShadow: `none !important`
},
// ==================== In Form ====================
[`&${componentCls}-in-form-item`]: {
width: "100%"
}
}
},
// =====================================================
// == LTR ==
// =====================================================
// Base
genBaseStyle$j(token),
// Single
genSingleStyle(token),
// Multiple
genMultipleStyle(token),
// Dropdown
genSingleStyle$1(token),
// =====================================================
// == RTL ==
// =====================================================
{
[`${componentCls}-rtl`]: {
direction: "rtl"
}
},
// =====================================================
// == Status ==
// =====================================================
genStatusStyle$2(componentCls, merge(token, {
borderHoverColor: token.colorPrimaryHover,
outlineColor: token.controlOutline
})),
genStatusStyle$2(`${componentCls}-status-error`, merge(token, {
borderHoverColor: token.colorErrorHover,
outlineColor: token.colorErrorOutline
}), true),
genStatusStyle$2(`${componentCls}-status-warning`, merge(token, {
borderHoverColor: token.colorWarningHover,
outlineColor: token.colorWarningOutline
}), true),
// =====================================================
// == Space Compact ==
// =====================================================
genCompactItemStyle(token, {
borderElCls: `${componentCls}-selector`,
focusElCls: `${componentCls}-focused`
})
];
};
const useSelectStyle = genComponentStyleHook("Select", (token, _ref) => {
let {
rootPrefixCls
} = _ref;
const selectToken = merge(token, {
rootPrefixCls,
inputPaddingHorizontalBase: token.paddingSM - 1
});
return [genSelectStyle(selectToken)];
}, (token) => ({
zIndexPopup: token.zIndexPopupBase + 50
}));
const selectProps = () => _extends(_extends({}, omit(selectProps$1(), ["inputIcon", "mode", "getInputElement", "getRawInputElement", "backfill"])), {
value: someType([Array, Object, String, Number]),
defaultValue: someType([Array, Object, String, Number]),
notFoundContent: PropTypes.any,
suffixIcon: PropTypes.any,
itemIcon: PropTypes.any,
size: stringType(),
mode: stringType(),
bordered: booleanType(true),
transitionName: String,
choiceTransitionName: stringType(""),
popupClassName: String,
/** @deprecated Please use `popupClassName` instead */
dropdownClassName: String,
placement: stringType(),
status: stringType(),
"onUpdate:value": functionType()
});
const SECRET_COMBOBOX_MODE_DO_NOT_USE = "SECRET_COMBOBOX_MODE_DO_NOT_USE";
const Select = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASelect",
Option: Option$1,
OptGroup: OptGroup$1,
inheritAttrs: false,
props: initDefaultProps(selectProps(), {
listHeight: 256,
listItemHeight: 24
}),
SECRET_COMBOBOX_MODE_DO_NOT_USE,
slots: Object,
setup(props2, _ref) {
let {
attrs,
emit,
slots,
expose
} = _ref;
const selectRef = ref();
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
const focus = () => {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
const scrollTo2 = (arg) => {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(arg);
};
const mode = computed(() => {
const {
mode: mode2
} = props2;
if (mode2 === "combobox") {
return void 0;
}
if (mode2 === SECRET_COMBOBOX_MODE_DO_NOT_USE) {
return "combobox";
}
return mode2;
});
const {
prefixCls,
direction,
renderEmpty: renderEmpty2,
size: contextSize,
getPrefixCls,
getPopupContainer,
disabled,
select
} = useConfigInject("select", props2);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => compactSize.value || contextSize.value);
const contextDisabled = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a;
return (_a = disabled.value) !== null && _a !== void 0 ? _a : contextDisabled.value;
});
const [wrapSSR, hashId] = useSelectStyle(prefixCls);
const rootPrefixCls = computed(() => getPrefixCls());
const placement = computed(() => {
if (props2.placement !== void 0) {
return props2.placement;
}
return direction.value === "rtl" ? "bottomRight" : "bottomLeft";
});
const transitionName2 = computed(() => getTransitionName$1(rootPrefixCls.value, getTransitionDirection(placement.value), props2.transitionName));
const mergedClassName = computed(() => classNames({
[`${prefixCls.value}-lg`]: mergedSize.value === "large",
[`${prefixCls.value}-sm`]: mergedSize.value === "small",
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-borderless`]: !props2.bordered,
[`${prefixCls.value}-in-form-item`]: formItemInputContext.isFormItemInput
}, getStatusClassNames(prefixCls.value, mergedStatus.value, formItemInputContext.hasFeedback), compactItemClassnames.value, hashId.value));
const triggerChange = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
emit("update:value", args[0]);
emit("change", ...args);
formItemContext.onFieldChange();
};
const handleBlur = (e) => {
emit("blur", e);
formItemContext.onFieldBlur();
};
expose({
blur,
focus,
scrollTo: scrollTo2
});
const isMultiple2 = computed(() => mode.value === "multiple" || mode.value === "tags");
const mergedShowArrow = computed(() => props2.showArrow !== void 0 ? props2.showArrow : props2.loading || !(isMultiple2.value || mode.value === "combobox"));
return () => {
var _a, _b, _c, _d;
const {
notFoundContent,
listHeight = 256,
listItemHeight = 24,
popupClassName,
dropdownClassName,
virtual,
dropdownMatchSelectWidth,
id = formItemContext.id.value,
placeholder = (_a = slots.placeholder) === null || _a === void 0 ? void 0 : _a.call(slots),
showArrow
} = props2;
const {
hasFeedback,
feedbackIcon
} = formItemInputContext;
let mergedNotFound;
if (notFoundContent !== void 0) {
mergedNotFound = notFoundContent;
} else if (slots.notFoundContent) {
mergedNotFound = slots.notFoundContent();
} else if (mode.value === "combobox") {
mergedNotFound = null;
} else {
mergedNotFound = (renderEmpty2 === null || renderEmpty2 === void 0 ? void 0 : renderEmpty2("Select")) || createVNode(DefaultRenderEmpty, {
"componentName": "Select"
}, null);
}
const {
suffixIcon,
itemIcon,
removeIcon,
clearIcon
} = getIcons(_extends(_extends({}, props2), {
multiple: isMultiple2.value,
prefixCls: prefixCls.value,
hasFeedback,
feedbackIcon,
showArrow: mergedShowArrow.value
}), slots);
const selectProps2 = omit(props2, ["prefixCls", "suffixIcon", "itemIcon", "removeIcon", "clearIcon", "size", "bordered", "status"]);
const rcSelectRtlDropdownClassName = classNames(popupClassName || dropdownClassName, {
[`${prefixCls.value}-dropdown-${direction.value}`]: direction.value === "rtl"
}, hashId.value);
return wrapSSR(createVNode(Select$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": selectRef,
"virtual": virtual,
"dropdownMatchSelectWidth": dropdownMatchSelectWidth
}, selectProps2), attrs), {}, {
"showSearch": (_b = props2.showSearch) !== null && _b !== void 0 ? _b : (_c = select === null || select === void 0 ? void 0 : select.value) === null || _c === void 0 ? void 0 : _c.showSearch,
"placeholder": placeholder,
"listHeight": listHeight,
"listItemHeight": listItemHeight,
"mode": mode.value,
"prefixCls": prefixCls.value,
"direction": direction.value,
"inputIcon": suffixIcon,
"menuItemSelectedIcon": itemIcon,
"removeIcon": removeIcon,
"clearIcon": clearIcon,
"notFoundContent": mergedNotFound,
"class": [mergedClassName.value, attrs.class],
"getPopupContainer": getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value,
"dropdownClassName": rcSelectRtlDropdownClassName,
"onChange": triggerChange,
"onBlur": handleBlur,
"id": id,
"dropdownRender": selectProps2.dropdownRender || slots.dropdownRender,
"transitionName": transitionName2.value,
"children": (_d = slots.default) === null || _d === void 0 ? void 0 : _d.call(slots),
"tagRender": props2.tagRender || slots.tagRender,
"optionLabelRender": slots.optionLabel,
"maxTagPlaceholder": props2.maxTagPlaceholder || slots.maxTagPlaceholder,
"showArrow": hasFeedback || showArrow,
"disabled": mergedDisabled.value
}), {
option: slots.option
}));
};
}
});
Select.install = function(app) {
app.component(Select.name, Select);
app.component(Select.Option.displayName, Select.Option);
app.component(Select.OptGroup.displayName, Select.OptGroup);
return app;
};
const SelectOption = Select.Option;
const SelectOptGroup = Select.OptGroup;
const Option = () => null;
Option.isSelectOption = true;
Option.displayName = "AAutoCompleteOption";
const OptGroup = () => null;
OptGroup.isSelectOptGroup = true;
OptGroup.displayName = "AAutoCompleteOptGroup";
function isSelectOptionOrSelectOptGroup(child) {
var _a, _b;
return ((_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.isSelectOption) || ((_b = child === null || child === void 0 ? void 0 : child.type) === null || _b === void 0 ? void 0 : _b.isSelectOptGroup);
}
const autoCompleteProps = () => _extends(_extends({}, omit(selectProps(), ["loading", "mode", "optionLabelProp", "labelInValue"])), {
dataSource: Array,
dropdownMenuStyle: {
type: Object,
default: void 0
},
// optionLabelProp: String,
dropdownMatchSelectWidth: {
type: [Number, Boolean],
default: true
},
prefixCls: String,
showSearch: {
type: Boolean,
default: void 0
},
transitionName: String,
choiceTransitionName: {
type: String,
default: "zoom"
},
autofocus: {
type: Boolean,
default: void 0
},
backfill: {
type: Boolean,
default: void 0
},
// optionLabelProp: PropTypes.string.def('children'),
filterOption: {
type: [Boolean, Function],
default: false
},
defaultActiveFirstOption: {
type: Boolean,
default: true
},
status: String
});
const AutoCompleteOption = Option;
const AutoCompleteOptGroup = OptGroup;
const AutoComplete = defineComponent({
compatConfig: {
MODE: 3
},
name: "AAutoComplete",
inheritAttrs: false,
props: autoCompleteProps(),
// emits: ['change', 'select', 'focus', 'blur'],
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
warning(!props2.dropdownClassName);
const selectRef = ref();
const getInputElement = () => {
var _a;
const children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
const element = children.length ? children[0] : void 0;
return element;
};
const focus = () => {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
expose({
focus,
blur
});
const {
prefixCls
} = useConfigInject("select", props2);
return () => {
var _a, _b, _c;
const {
size,
dataSource,
notFoundContent = (_a = slots.notFoundContent) === null || _a === void 0 ? void 0 : _a.call(slots)
} = props2;
let optionChildren;
const {
class: className
} = attrs;
const cls = {
[className]: !!className,
[`${prefixCls.value}-lg`]: size === "large",
[`${prefixCls.value}-sm`]: size === "small",
[`${prefixCls.value}-show-search`]: true,
[`${prefixCls.value}-auto-complete`]: true
};
if (props2.options === void 0) {
const childArray = ((_b = slots.dataSource) === null || _b === void 0 ? void 0 : _b.call(slots)) || ((_c = slots.options) === null || _c === void 0 ? void 0 : _c.call(slots)) || [];
if (childArray.length && isSelectOptionOrSelectOptGroup(childArray[0])) {
optionChildren = childArray;
} else {
optionChildren = dataSource ? dataSource.map((item) => {
if (isValidElement(item)) {
return item;
}
switch (typeof item) {
case "string":
return createVNode(Option, {
"key": item,
"value": item
}, {
default: () => [item]
});
case "object":
return createVNode(Option, {
"key": item.value,
"value": item.value
}, {
default: () => [item.text]
});
default:
throw new Error("AutoComplete[dataSource] only supports type `string[] | Object[]`.");
}
}) : [];
}
}
const selectProps2 = omit(_extends(_extends(_extends({}, props2), attrs), {
mode: Select.SECRET_COMBOBOX_MODE_DO_NOT_USE,
// optionLabelProp,
getInputElement,
notFoundContent,
// placeholder: '',
class: cls,
popupClassName: props2.popupClassName || props2.dropdownClassName,
ref: selectRef
}), ["dataSource", "loading"]);
return createVNode(Select, selectProps2, _objectSpread$W({
default: () => [optionChildren]
}, omit(slots, ["default", "dataSource", "options"])));
};
}
});
const index$n = _extends(AutoComplete, {
Option,
OptGroup,
install(app) {
app.component(AutoComplete.name, AutoComplete);
app.component(Option.displayName, Option);
app.component(OptGroup.displayName, OptGroup);
return app;
}
});
const genAlertTypeStyle = (bgColor, borderColor, iconColor, token, alertCls) => ({
backgroundColor: bgColor,
border: `${token.lineWidth}px ${token.lineType} ${borderColor}`,
[`${alertCls}-icon`]: {
color: iconColor
}
});
const genBaseStyle$i = (token) => {
const {
componentCls,
motionDurationSlow: duration,
marginXS,
marginSM,
fontSize,
fontSizeLG,
lineHeight,
borderRadiusLG: borderRadius,
motionEaseInOutCirc,
alertIconSizeLG,
colorText,
paddingContentVerticalSM,
alertPaddingHorizontal,
paddingMD,
paddingContentHorizontalLG
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "flex",
alignItems: "center",
padding: `${paddingContentVerticalSM}px ${alertPaddingHorizontal}px`,
wordWrap: "break-word",
borderRadius,
[`&${componentCls}-rtl`]: {
direction: "rtl"
},
[`${componentCls}-content`]: {
flex: 1,
minWidth: 0
},
[`${componentCls}-icon`]: {
marginInlineEnd: marginXS,
lineHeight: 0
},
[`&-description`]: {
display: "none",
fontSize,
lineHeight
},
"&-message": {
color: colorText
},
[`&${componentCls}-motion-leave`]: {
overflow: "hidden",
opacity: 1,
transition: `max-height ${duration} ${motionEaseInOutCirc}, opacity ${duration} ${motionEaseInOutCirc},
padding-top ${duration} ${motionEaseInOutCirc}, padding-bottom ${duration} ${motionEaseInOutCirc},
margin-bottom ${duration} ${motionEaseInOutCirc}`
},
[`&${componentCls}-motion-leave-active`]: {
maxHeight: 0,
marginBottom: "0 !important",
paddingTop: 0,
paddingBottom: 0,
opacity: 0
}
}),
[`${componentCls}-with-description`]: {
alignItems: "flex-start",
paddingInline: paddingContentHorizontalLG,
paddingBlock: paddingMD,
[`${componentCls}-icon`]: {
marginInlineEnd: marginSM,
fontSize: alertIconSizeLG,
lineHeight: 0
},
[`${componentCls}-message`]: {
display: "block",
marginBottom: marginXS,
color: colorText,
fontSize: fontSizeLG
},
[`${componentCls}-description`]: {
display: "block"
}
},
[`${componentCls}-banner`]: {
marginBottom: 0,
border: "0 !important",
borderRadius: 0
}
};
};
const genTypeStyle = (token) => {
const {
componentCls,
colorSuccess,
colorSuccessBorder,
colorSuccessBg,
colorWarning,
colorWarningBorder,
colorWarningBg,
colorError,
colorErrorBorder,
colorErrorBg,
colorInfo,
colorInfoBorder,
colorInfoBg
} = token;
return {
[componentCls]: {
"&-success": genAlertTypeStyle(colorSuccessBg, colorSuccessBorder, colorSuccess, token, componentCls),
"&-info": genAlertTypeStyle(colorInfoBg, colorInfoBorder, colorInfo, token, componentCls),
"&-warning": genAlertTypeStyle(colorWarningBg, colorWarningBorder, colorWarning, token, componentCls),
"&-error": _extends(_extends({}, genAlertTypeStyle(colorErrorBg, colorErrorBorder, colorError, token, componentCls)), {
[`${componentCls}-description > pre`]: {
margin: 0,
padding: 0
}
})
}
};
};
const genActionStyle = (token) => {
const {
componentCls,
iconCls,
motionDurationMid,
marginXS,
fontSizeIcon,
colorIcon,
colorIconHover
} = token;
return {
[componentCls]: {
[`&-action`]: {
marginInlineStart: marginXS
},
[`${componentCls}-close-icon`]: {
marginInlineStart: marginXS,
padding: 0,
overflow: "hidden",
fontSize: fontSizeIcon,
lineHeight: `${fontSizeIcon}px`,
backgroundColor: "transparent",
border: "none",
outline: "none",
cursor: "pointer",
[`${iconCls}-close`]: {
color: colorIcon,
transition: `color ${motionDurationMid}`,
"&:hover": {
color: colorIconHover
}
}
},
"&-close-text": {
color: colorIcon,
transition: `color ${motionDurationMid}`,
"&:hover": {
color: colorIconHover
}
}
}
};
};
const genAlertStyle = (token) => [genBaseStyle$i(token), genTypeStyle(token), genActionStyle(token)];
const useStyle$V = genComponentStyleHook("Alert", (token) => {
const {
fontSizeHeading3
} = token;
const alertToken = merge(token, {
alertIconSizeLG: fontSizeHeading3,
alertPaddingHorizontal: 12
// Fixed value here.
});
return [genAlertStyle(alertToken)];
});
const iconMapFilled = {
success: CheckCircleFilled,
info: InfoCircleFilled,
error: CloseCircleFilled,
warning: ExclamationCircleFilled
};
const iconMapOutlined = {
success: CheckCircleOutlined,
info: InfoCircleOutlined,
error: CloseCircleOutlined,
warning: ExclamationCircleOutlined
};
const AlertTypes = tuple$1("success", "info", "warning", "error");
const alertProps = () => ({
/**
* Type of Alert styles, options: `success`, `info`, `warning`, `error`
*/
type: PropTypes.oneOf(AlertTypes),
/** Whether Alert can be closed */
closable: {
type: Boolean,
default: void 0
},
/** Close text to show */
closeText: PropTypes.any,
/** Content of Alert */
message: PropTypes.any,
/** Additional content of Alert */
description: PropTypes.any,
/** Trigger when animation ending of Alert */
afterClose: Function,
/** Whether to show icon */
showIcon: {
type: Boolean,
default: void 0
},
prefixCls: String,
banner: {
type: Boolean,
default: void 0
},
icon: PropTypes.any,
closeIcon: PropTypes.any,
onClose: Function
});
const Alert = defineComponent({
compatConfig: {
MODE: 3
},
name: "AAlert",
inheritAttrs: false,
props: alertProps(),
setup(props2, _ref) {
let {
slots,
emit,
attrs,
expose
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("alert", props2);
const [wrapSSR, hashId] = useStyle$V(prefixCls);
const closing = shallowRef(false);
const closed = shallowRef(false);
const alertNode = shallowRef();
const handleClose = (e) => {
e.preventDefault();
const dom = alertNode.value;
dom.style.height = `${dom.offsetHeight}px`;
dom.style.height = `${dom.offsetHeight}px`;
closing.value = true;
emit("close", e);
};
const animationEnd = () => {
var _a;
closing.value = false;
closed.value = true;
(_a = props2.afterClose) === null || _a === void 0 ? void 0 : _a.call(props2);
};
const mergedType = computed(() => {
const {
type
} = props2;
if (type !== void 0) {
return type;
}
return props2.banner ? "warning" : "info";
});
expose({
animationEnd
});
const motionStyle = shallowRef({});
return () => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
const {
banner,
closeIcon: customCloseIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots)
} = props2;
let {
closable,
showIcon
} = props2;
const closeText = (_b = props2.closeText) !== null && _b !== void 0 ? _b : (_c = slots.closeText) === null || _c === void 0 ? void 0 : _c.call(slots);
const description = (_d = props2.description) !== null && _d !== void 0 ? _d : (_e = slots.description) === null || _e === void 0 ? void 0 : _e.call(slots);
const message = (_f = props2.message) !== null && _f !== void 0 ? _f : (_g = slots.message) === null || _g === void 0 ? void 0 : _g.call(slots);
const icon = (_h = props2.icon) !== null && _h !== void 0 ? _h : (_j = slots.icon) === null || _j === void 0 ? void 0 : _j.call(slots);
const action = (_k = slots.action) === null || _k === void 0 ? void 0 : _k.call(slots);
showIcon = banner && showIcon === void 0 ? true : showIcon;
const IconType = (description ? iconMapOutlined : iconMapFilled)[mergedType.value] || null;
if (closeText) {
closable = true;
}
const prefixClsValue = prefixCls.value;
const alertCls = classNames(prefixClsValue, {
[`${prefixClsValue}-${mergedType.value}`]: true,
[`${prefixClsValue}-closing`]: closing.value,
[`${prefixClsValue}-with-description`]: !!description,
[`${prefixClsValue}-no-icon`]: !showIcon,
[`${prefixClsValue}-banner`]: !!banner,
[`${prefixClsValue}-closable`]: closable,
[`${prefixClsValue}-rtl`]: direction.value === "rtl",
[hashId.value]: true
});
const closeIcon = closable ? createVNode("button", {
"type": "button",
"onClick": handleClose,
"class": `${prefixClsValue}-close-icon`,
"tabindex": 0
}, [closeText ? createVNode("span", {
"class": `${prefixClsValue}-close-text`
}, [closeText]) : customCloseIcon === void 0 ? createVNode(CloseOutlined, null, null) : customCloseIcon]) : null;
const iconNode = icon && (isValidElement(icon) ? cloneElement(icon, {
class: `${prefixClsValue}-icon`
}) : createVNode("span", {
"class": `${prefixClsValue}-icon`
}, [icon])) || createVNode(IconType, {
"class": `${prefixClsValue}-icon`
}, null);
const transitionProps = getTransitionProps(`${prefixClsValue}-motion`, {
appear: false,
css: true,
onAfterLeave: animationEnd,
onBeforeLeave: (node) => {
node.style.maxHeight = `${node.offsetHeight}px`;
},
onLeave: (node) => {
node.style.maxHeight = "0px";
}
});
return wrapSSR(closed.value ? null : createVNode(Transition, transitionProps, {
default: () => [withDirectives(createVNode("div", _objectSpread$W(_objectSpread$W({
"role": "alert"
}, attrs), {}, {
"style": [attrs.style, motionStyle.value],
"class": [attrs.class, alertCls],
"data-show": !closing.value,
"ref": alertNode
}), [showIcon ? iconNode : null, createVNode("div", {
"class": `${prefixClsValue}-content`
}, [message ? createVNode("div", {
"class": `${prefixClsValue}-message`
}, [message]) : null, description ? createVNode("div", {
"class": `${prefixClsValue}-description`
}, [description]) : null]), action ? createVNode("div", {
"class": `${prefixClsValue}-action`
}, [action]) : null, closeIcon]), [[vShow, !closing.value]])]
}));
};
}
});
const index$m = withInstall(Alert);
const responsiveArray = ["xxxl", "xxl", "xl", "lg", "md", "sm", "xs"];
const getResponsiveMap = (token) => ({
xs: `(max-width: ${token.screenXSMax}px)`,
sm: `(min-width: ${token.screenSM}px)`,
md: `(min-width: ${token.screenMD}px)`,
lg: `(min-width: ${token.screenLG}px)`,
xl: `(min-width: ${token.screenXL}px)`,
xxl: `(min-width: ${token.screenXXL}px)`,
xxxl: `{min-width: ${token.screenXXXL}px}`
});
function useResponsiveObserver() {
const [, token] = useToken();
return computed(() => {
const responsiveMap = getResponsiveMap(token.value);
const subscribers = /* @__PURE__ */ new Map();
let subUid = -1;
let screens = {};
return {
matchHandlers: {},
dispatch(pointMap) {
screens = pointMap;
subscribers.forEach((func) => func(screens));
return subscribers.size >= 1;
},
subscribe(func) {
if (!subscribers.size) this.register();
subUid += 1;
subscribers.set(subUid, func);
func(screens);
return subUid;
},
unsubscribe(paramToken) {
subscribers.delete(paramToken);
if (!subscribers.size) this.unregister();
},
unregister() {
Object.keys(responsiveMap).forEach((screen) => {
const matchMediaQuery = responsiveMap[screen];
const handler2 = this.matchHandlers[matchMediaQuery];
handler2 === null || handler2 === void 0 ? void 0 : handler2.mql.removeListener(handler2 === null || handler2 === void 0 ? void 0 : handler2.listener);
});
subscribers.clear();
},
register() {
Object.keys(responsiveMap).forEach((screen) => {
const matchMediaQuery = responsiveMap[screen];
const listener = (_ref) => {
let {
matches
} = _ref;
this.dispatch(_extends(_extends({}, screens), {
[screen]: matches
}));
};
const mql = (void 0).matchMedia(matchMediaQuery);
mql.addListener(listener);
this.matchHandlers[matchMediaQuery] = {
mql,
listener
};
listener(mql);
});
},
responsiveMap
};
});
}
function useBreakpoint() {
const screens = shallowRef({});
useResponsiveObserver();
return screens;
}
function eagerComputed(fn) {
const result = shallowRef();
watchEffect(() => {
result.value = fn();
}, {
flush: "sync"
// needed so updates are immediate.
});
return result;
}
const genBaseStyle$h = (token) => {
const {
antCls,
componentCls,
iconCls,
avatarBg,
avatarColor,
containerSize,
containerSizeLG,
containerSizeSM,
textFontSize,
textFontSizeLG,
textFontSizeSM,
borderRadius,
borderRadiusLG,
borderRadiusSM,
lineWidth,
lineType
} = token;
const avatarSizeStyle = (size, fontSize, radius) => ({
width: size,
height: size,
lineHeight: `${size - lineWidth * 2}px`,
borderRadius: "50%",
[`&${componentCls}-square`]: {
borderRadius: radius
},
[`${componentCls}-string`]: {
position: "absolute",
left: {
_skip_check_: true,
value: "50%"
},
transformOrigin: "0 center"
},
[`&${componentCls}-icon`]: {
fontSize,
[`> ${iconCls}`]: {
margin: 0
}
}
});
return {
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "inline-block",
overflow: "hidden",
color: avatarColor,
whiteSpace: "nowrap",
textAlign: "center",
verticalAlign: "middle",
background: avatarBg,
border: `${lineWidth}px ${lineType} transparent`,
[`&-image`]: {
background: "transparent"
},
[`${antCls}-image-img`]: {
display: "block"
}
}), avatarSizeStyle(containerSize, textFontSize, borderRadius)), {
[`&-lg`]: _extends({}, avatarSizeStyle(containerSizeLG, textFontSizeLG, borderRadiusLG)),
[`&-sm`]: _extends({}, avatarSizeStyle(containerSizeSM, textFontSizeSM, borderRadiusSM)),
"> img": {
display: "block",
width: "100%",
height: "100%",
objectFit: "cover"
}
})
};
};
const genGroupStyle$2 = (token) => {
const {
componentCls,
groupBorderColor,
groupOverlapping,
groupSpace
} = token;
return {
[`${componentCls}-group`]: {
display: "inline-flex",
[`${componentCls}`]: {
borderColor: groupBorderColor
},
[`> *:not(:first-child)`]: {
marginInlineStart: groupOverlapping
}
},
[`${componentCls}-group-popover`]: {
[`${componentCls} + ${componentCls}`]: {
marginInlineStart: groupSpace
}
}
};
};
const useStyle$U = genComponentStyleHook("Avatar", (token) => {
const {
colorTextLightSolid,
colorTextPlaceholder
} = token;
const avatarToken = merge(token, {
avatarBg: colorTextPlaceholder,
avatarColor: colorTextLightSolid
});
return [genBaseStyle$h(avatarToken), genGroupStyle$2(avatarToken)];
}, (token) => {
const {
controlHeight,
controlHeightLG,
controlHeightSM,
fontSize,
fontSizeLG,
fontSizeXL,
fontSizeHeading3,
marginXS,
marginXXS,
colorBorderBg
} = token;
return {
containerSize: controlHeight,
containerSizeLG: controlHeightLG,
containerSizeSM: controlHeightSM,
textFontSize: Math.round((fontSizeLG + fontSizeXL) / 2),
textFontSizeLG: fontSizeHeading3,
textFontSizeSM: fontSize,
groupSpace: marginXXS,
groupOverlapping: -marginXS,
groupBorderColor: colorBorderBg
};
});
const AvatarContextKey = Symbol("AvatarContextKey");
const useAvatarInjectContext = () => {
return inject(AvatarContextKey, {});
};
const useAvatarProviderContext = (context2) => {
return provide(AvatarContextKey, context2);
};
const avatarProps$1 = () => ({
prefixCls: String,
shape: {
type: String,
default: "circle"
},
size: {
type: [Number, String, Object],
default: () => "default"
},
src: String,
/** Srcset of image avatar */
srcset: String,
icon: PropTypes.any,
alt: String,
gap: Number,
draggable: {
type: Boolean,
default: void 0
},
crossOrigin: String,
loadError: {
type: Function
}
});
const Avatar = defineComponent({
compatConfig: {
MODE: 3
},
name: "AAvatar",
inheritAttrs: false,
props: avatarProps$1(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const isImgExist = shallowRef(true);
const isMounted = shallowRef(false);
const scale = shallowRef(1);
const avatarChildrenRef = shallowRef(null);
const avatarNodeRef = shallowRef(null);
const {
prefixCls
} = useConfigInject("avatar", props2);
const [wrapSSR, hashId] = useStyle$U(prefixCls);
const avatarCtx = useAvatarInjectContext();
const size = computed(() => {
return props2.size === "default" ? avatarCtx.size : props2.size;
});
const screens = useBreakpoint();
const responsiveSize = eagerComputed(() => {
if (typeof props2.size !== "object") {
return void 0;
}
const currentBreakpoint = responsiveArray.find((screen) => screens.value[screen]);
const currentSize = props2.size[currentBreakpoint];
return currentSize;
});
const responsiveSizeStyle = (hasIcon) => {
if (responsiveSize.value) {
return {
width: `${responsiveSize.value}px`,
height: `${responsiveSize.value}px`,
lineHeight: `${responsiveSize.value}px`,
fontSize: `${hasIcon ? responsiveSize.value / 2 : 18}px`
};
}
return {};
};
const setScaleParam = () => {
if (!avatarChildrenRef.value || !avatarNodeRef.value) {
return;
}
const childrenWidth = avatarChildrenRef.value.offsetWidth;
const nodeWidth = avatarNodeRef.value.offsetWidth;
if (childrenWidth !== 0 && nodeWidth !== 0) {
const {
gap = 4
} = props2;
if (gap * 2 < nodeWidth) {
scale.value = nodeWidth - gap * 2 < childrenWidth ? (nodeWidth - gap * 2) / childrenWidth : 1;
}
}
};
const handleImgLoadError = () => {
const {
loadError
} = props2;
const errorFlag = loadError === null || loadError === void 0 ? void 0 : loadError();
if (errorFlag !== false) {
isImgExist.value = false;
}
};
watch(() => props2.src, () => {
nextTick(() => {
isImgExist.value = true;
scale.value = 1;
});
});
watch(() => props2.gap, () => {
nextTick(() => {
setScaleParam();
});
});
return () => {
var _a, _b;
const {
shape,
src,
alt,
srcset,
draggable,
crossOrigin
} = props2;
const mergeShape = (_a = avatarCtx.shape) !== null && _a !== void 0 ? _a : shape;
const icon = getPropsSlot(slots, props2, "icon");
const pre = prefixCls.value;
const classString = {
[`${attrs.class}`]: !!attrs.class,
[pre]: true,
[`${pre}-lg`]: size.value === "large",
[`${pre}-sm`]: size.value === "small",
[`${pre}-${mergeShape}`]: true,
[`${pre}-image`]: src && isImgExist.value,
[`${pre}-icon`]: icon,
[hashId.value]: true
};
const sizeStyle = typeof size.value === "number" ? {
width: `${size.value}px`,
height: `${size.value}px`,
lineHeight: `${size.value}px`,
fontSize: icon ? `${size.value / 2}px` : "18px"
} : {};
const children = (_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots);
let childrenToRender;
if (src && isImgExist.value) {
childrenToRender = createVNode("img", {
"draggable": draggable,
"src": src,
"srcset": srcset,
"onError": handleImgLoadError,
"alt": alt,
"crossorigin": crossOrigin
}, null);
} else if (icon) {
childrenToRender = icon;
} else if (isMounted.value || scale.value !== 1) {
const transformString = `scale(${scale.value}) translateX(-50%)`;
const childrenStyle = {
msTransform: transformString,
WebkitTransform: transformString,
transform: transformString
};
const sizeChildrenStyle = typeof size.value === "number" ? {
lineHeight: `${size.value}px`
} : {};
childrenToRender = createVNode(ResizeObserver$1, {
"onResize": setScaleParam
}, {
default: () => [createVNode("span", {
"class": `${pre}-string`,
"ref": avatarChildrenRef,
"style": _extends(_extends({}, sizeChildrenStyle), childrenStyle)
}, [children])]
});
} else {
childrenToRender = createVNode("span", {
"class": `${pre}-string`,
"ref": avatarChildrenRef,
"style": {
opacity: 0
}
}, [children]);
}
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"ref": avatarNodeRef,
"class": classString,
"style": [sizeStyle, responsiveSizeStyle(!!icon), attrs.style]
}), [childrenToRender]));
};
}
});
const autoAdjustOverflow$2 = {
adjustX: 1,
adjustY: 1
};
const targetOffset$3 = [0, 0];
const placements$2 = {
left: {
points: ["cr", "cl"],
overflow: autoAdjustOverflow$2,
offset: [-4, 0],
targetOffset: targetOffset$3
},
right: {
points: ["cl", "cr"],
overflow: autoAdjustOverflow$2,
offset: [4, 0],
targetOffset: targetOffset$3
},
top: {
points: ["bc", "tc"],
overflow: autoAdjustOverflow$2,
offset: [0, -4],
targetOffset: targetOffset$3
},
bottom: {
points: ["tc", "bc"],
overflow: autoAdjustOverflow$2,
offset: [0, 4],
targetOffset: targetOffset$3
},
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow$2,
offset: [0, -4],
targetOffset: targetOffset$3
},
leftTop: {
points: ["tr", "tl"],
overflow: autoAdjustOverflow$2,
offset: [-4, 0],
targetOffset: targetOffset$3
},
topRight: {
points: ["br", "tr"],
overflow: autoAdjustOverflow$2,
offset: [0, -4],
targetOffset: targetOffset$3
},
rightTop: {
points: ["tl", "tr"],
overflow: autoAdjustOverflow$2,
offset: [4, 0],
targetOffset: targetOffset$3
},
bottomRight: {
points: ["tr", "br"],
overflow: autoAdjustOverflow$2,
offset: [0, 4],
targetOffset: targetOffset$3
},
rightBottom: {
points: ["bl", "br"],
overflow: autoAdjustOverflow$2,
offset: [4, 0],
targetOffset: targetOffset$3
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow$2,
offset: [0, 4],
targetOffset: targetOffset$3
},
leftBottom: {
points: ["br", "bl"],
overflow: autoAdjustOverflow$2,
offset: [-4, 0],
targetOffset: targetOffset$3
}
};
const tooltipContentProps = {
prefixCls: String,
id: String,
overlayInnerStyle: PropTypes.any
};
const Content$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "TooltipContent",
props: tooltipContentProps,
setup(props2, _ref) {
let {
slots
} = _ref;
return () => {
var _a;
return createVNode("div", {
"class": `${props2.prefixCls}-inner`,
"id": props2.id,
"role": "tooltip",
"style": props2.overlayInnerStyle
}, [(_a = slots.overlay) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
var __rest$15 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function noop$9() {
}
const Tooltip = defineComponent({
compatConfig: {
MODE: 3
},
name: "Tooltip",
inheritAttrs: false,
props: {
trigger: PropTypes.any.def(["hover"]),
defaultVisible: {
type: Boolean,
default: void 0
},
visible: {
type: Boolean,
default: void 0
},
placement: PropTypes.string.def("right"),
transitionName: String,
animation: PropTypes.any,
afterVisibleChange: PropTypes.func.def(() => {
}),
overlayStyle: {
type: Object,
default: void 0
},
overlayClassName: String,
prefixCls: PropTypes.string.def("rc-tooltip"),
mouseEnterDelay: PropTypes.number.def(0.1),
mouseLeaveDelay: PropTypes.number.def(0.1),
getPopupContainer: Function,
destroyTooltipOnHide: {
type: Boolean,
default: false
},
align: PropTypes.object.def(() => ({})),
arrowContent: PropTypes.any.def(null),
tipId: String,
builtinPlacements: PropTypes.object,
overlayInnerStyle: {
type: Object,
default: void 0
},
popupVisible: {
type: Boolean,
default: void 0
},
onVisibleChange: Function,
onPopupAlign: Function,
arrow: {
type: Boolean,
default: true
}
},
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
const triggerDOM = shallowRef();
const getPopupElement = () => {
const {
prefixCls,
tipId,
overlayInnerStyle
} = props2;
return [!!props2.arrow ? createVNode("div", {
"class": `${prefixCls}-arrow`,
"key": "arrow"
}, [getPropsSlot(slots, props2, "arrowContent")]) : null, createVNode(Content$2, {
"key": "content",
"prefixCls": prefixCls,
"id": tipId,
"overlayInnerStyle": overlayInnerStyle
}, {
overlay: slots.overlay
})];
};
const getPopupDomNode = () => {
return triggerDOM.value.getPopupDomNode();
};
expose({
getPopupDomNode,
triggerDOM,
forcePopupAlign: () => {
var _a;
return (_a = triggerDOM.value) === null || _a === void 0 ? void 0 : _a.forcePopupAlign();
}
});
const destroyTooltip = shallowRef(false);
const autoDestroy = shallowRef(false);
watchEffect(() => {
const {
destroyTooltipOnHide
} = props2;
if (typeof destroyTooltipOnHide === "boolean") {
destroyTooltip.value = destroyTooltipOnHide;
} else if (destroyTooltipOnHide && typeof destroyTooltipOnHide === "object") {
const {
keepParent
} = destroyTooltipOnHide;
destroyTooltip.value = keepParent === true;
autoDestroy.value = keepParent === false;
}
});
return () => {
const {
overlayClassName,
trigger,
mouseEnterDelay,
mouseLeaveDelay,
overlayStyle,
prefixCls,
afterVisibleChange,
transitionName: transitionName2,
animation,
placement,
align,
destroyTooltipOnHide,
defaultVisible
} = props2, restProps = __rest$15(props2, ["overlayClassName", "trigger", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "prefixCls", "afterVisibleChange", "transitionName", "animation", "placement", "align", "destroyTooltipOnHide", "defaultVisible"]);
const extraProps = _extends({}, restProps);
if (props2.visible !== void 0) {
extraProps.popupVisible = props2.visible;
}
const triggerProps2 = _extends(_extends(_extends({
popupClassName: overlayClassName,
prefixCls,
action: trigger,
builtinPlacements: placements$2,
popupPlacement: placement,
popupAlign: align,
afterPopupVisibleChange: afterVisibleChange,
popupTransitionName: transitionName2,
popupAnimation: animation,
defaultPopupVisible: defaultVisible,
destroyPopupOnHide: destroyTooltip.value,
autoDestroy: autoDestroy.value,
mouseLeaveDelay,
popupStyle: overlayStyle,
mouseEnterDelay
}, extraProps), attrs), {
onPopupVisibleChange: props2.onVisibleChange || noop$9,
onPopupAlign: props2.onPopupAlign || noop$9,
ref: triggerDOM,
arrow: !!props2.arrow,
popup: getPopupElement()
});
return createVNode(Trigger, triggerProps2, {
default: slots.default
});
};
}
});
const abstractTooltipProps = (() => ({
trigger: [String, Array],
open: {
type: Boolean,
default: void 0
},
/** @deprecated Please use `open` instead. */
visible: {
type: Boolean,
default: void 0
},
placement: String,
color: String,
transitionName: String,
overlayStyle: objectType(),
overlayInnerStyle: objectType(),
overlayClassName: String,
openClassName: String,
prefixCls: String,
mouseEnterDelay: Number,
mouseLeaveDelay: Number,
getPopupContainer: Function,
/**@deprecated Please use `arrow={{ pointAtCenter: true }}` instead. */
arrowPointAtCenter: {
type: Boolean,
default: void 0
},
arrow: {
type: [Boolean, Object],
default: true
},
autoAdjustOverflow: {
type: [Boolean, Object],
default: void 0
},
destroyTooltipOnHide: {
type: Boolean,
default: void 0
},
align: objectType(),
builtinPlacements: objectType(),
children: Array,
/** @deprecated Please use `onOpenChange` instead. */
onVisibleChange: Function,
/** @deprecated Please use `onUpdate:open` instead. */
"onUpdate:visible": Function,
onOpenChange: Function,
"onUpdate:open": Function
}));
const autoAdjustOverflowEnabled = {
adjustX: 1,
adjustY: 1
};
const autoAdjustOverflowDisabled = {
adjustX: 0,
adjustY: 0
};
const targetOffset$2 = [0, 0];
function getOverflowOptions(autoAdjustOverflow2) {
if (typeof autoAdjustOverflow2 === "boolean") {
return autoAdjustOverflow2 ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;
}
return _extends(_extends({}, autoAdjustOverflowDisabled), autoAdjustOverflow2);
}
function getPlacements$1(config) {
const {
arrowWidth = 4,
horizontalArrowShift = 16,
verticalArrowShift = 8,
autoAdjustOverflow: autoAdjustOverflow2,
arrowPointAtCenter
} = config;
const placementMap = {
left: {
points: ["cr", "cl"],
offset: [-4, 0]
},
right: {
points: ["cl", "cr"],
offset: [4, 0]
},
top: {
points: ["bc", "tc"],
offset: [0, -4]
},
bottom: {
points: ["tc", "bc"],
offset: [0, 4]
},
topLeft: {
points: ["bl", "tc"],
offset: [-(horizontalArrowShift + arrowWidth), -4]
},
leftTop: {
points: ["tr", "cl"],
offset: [-4, -(verticalArrowShift + arrowWidth)]
},
topRight: {
points: ["br", "tc"],
offset: [horizontalArrowShift + arrowWidth, -4]
},
rightTop: {
points: ["tl", "cr"],
offset: [4, -(verticalArrowShift + arrowWidth)]
},
bottomRight: {
points: ["tr", "bc"],
offset: [horizontalArrowShift + arrowWidth, 4]
},
rightBottom: {
points: ["bl", "cr"],
offset: [4, verticalArrowShift + arrowWidth]
},
bottomLeft: {
points: ["tl", "bc"],
offset: [-(horizontalArrowShift + arrowWidth), 4]
},
leftBottom: {
points: ["br", "cl"],
offset: [-4, verticalArrowShift + arrowWidth]
}
};
Object.keys(placementMap).forEach((key2) => {
placementMap[key2] = arrowPointAtCenter ? _extends(_extends({}, placementMap[key2]), {
overflow: getOverflowOptions(autoAdjustOverflow2),
targetOffset: targetOffset$2
}) : _extends(_extends({}, placements$2[key2]), {
overflow: getOverflowOptions(autoAdjustOverflow2)
});
placementMap[key2].ignoreShake = true;
});
return placementMap;
}
function firstNotUndefined() {
let arr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
for (let i = 0, len = arr.length; i < len; i++) {
if (arr[i] !== void 0) {
return arr[i];
}
}
return void 0;
}
const inverseColors = PresetColors.map((color) => `${color}-inverse`);
const PresetStatusColorTypes = ["success", "processing", "error", "default", "warning"];
function isPresetColor(color) {
let includeInverse = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
if (includeInverse) {
return [...inverseColors, ...PresetColors].includes(color);
}
return PresetColors.includes(color);
}
function isPresetStatusColor(color) {
return PresetStatusColorTypes.includes(color);
}
function parseColor(prefixCls, color) {
const isInternalColor = isPresetColor(color);
const className = classNames({
[`${prefixCls}-${color}`]: color && isInternalColor
});
const overlayStyle = {};
const arrowStyle = {};
if (color && !isInternalColor) {
overlayStyle.background = color;
arrowStyle["--antd-arrow-background-color"] = color;
}
return {
className,
overlayStyle,
arrowStyle
};
}
function connectArrowCls(classList) {
let showArrowCls = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
return classList.map((cls) => `${showArrowCls}${cls}`).join(",");
}
const MAX_VERTICAL_CONTENT_RADIUS = 8;
function getArrowOffset(options) {
const maxVerticalContentRadius = MAX_VERTICAL_CONTENT_RADIUS;
const {
sizePopupArrow,
contentRadius,
borderRadiusOuter,
limitVerticalRadius
} = options;
const arrowInnerOffset = sizePopupArrow / 2 - Math.ceil(borderRadiusOuter * (Math.sqrt(2) - 1));
const dropdownArrowOffset = (contentRadius > 12 ? contentRadius + 2 : 12) - arrowInnerOffset;
const dropdownArrowOffsetVertical = limitVerticalRadius ? maxVerticalContentRadius - arrowInnerOffset : dropdownArrowOffset;
return {
dropdownArrowOffset,
dropdownArrowOffsetVertical
};
}
function getArrowStyle(token, options) {
const {
componentCls,
sizePopupArrow,
marginXXS,
borderRadiusXS,
borderRadiusOuter,
boxShadowPopoverArrow
} = token;
const {
colorBg,
showArrowCls,
contentRadius = token.borderRadiusLG,
limitVerticalRadius
} = options;
const {
dropdownArrowOffsetVertical,
dropdownArrowOffset
} = getArrowOffset({
sizePopupArrow,
contentRadius,
borderRadiusOuter,
limitVerticalRadius
});
const dropdownArrowDistance = sizePopupArrow / 2 + marginXXS;
return {
[componentCls]: {
// ============================ Basic ============================
[`${componentCls}-arrow`]: [_extends(_extends({
position: "absolute",
zIndex: 1,
display: "block"
}, roundedArrow(sizePopupArrow, borderRadiusXS, borderRadiusOuter, colorBg, boxShadowPopoverArrow)), {
"&:before": {
background: colorBg
}
})],
// ========================== Placement ==========================
// Here handle the arrow position and rotate stuff
// >>>>> Top
[[`&-placement-top ${componentCls}-arrow`, `&-placement-topLeft ${componentCls}-arrow`, `&-placement-topRight ${componentCls}-arrow`].join(",")]: {
bottom: 0,
transform: "translateY(100%) rotate(180deg)"
},
[`&-placement-top ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: "50%"
},
transform: "translateX(-50%) translateY(100%) rotate(180deg)"
},
[`&-placement-topLeft ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
[`&-placement-topRight ${componentCls}-arrow`]: {
right: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
// >>>>> Bottom
[[`&-placement-bottom ${componentCls}-arrow`, `&-placement-bottomLeft ${componentCls}-arrow`, `&-placement-bottomRight ${componentCls}-arrow`].join(",")]: {
top: 0,
transform: `translateY(-100%)`
},
[`&-placement-bottom ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: "50%"
},
transform: `translateX(-50%) translateY(-100%)`
},
[`&-placement-bottomLeft ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
[`&-placement-bottomRight ${componentCls}-arrow`]: {
right: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
// >>>>> Left
[[`&-placement-left ${componentCls}-arrow`, `&-placement-leftTop ${componentCls}-arrow`, `&-placement-leftBottom ${componentCls}-arrow`].join(",")]: {
right: {
_skip_check_: true,
value: 0
},
transform: "translateX(100%) rotate(90deg)"
},
[`&-placement-left ${componentCls}-arrow`]: {
top: {
_skip_check_: true,
value: "50%"
},
transform: "translateY(-50%) translateX(100%) rotate(90deg)"
},
[`&-placement-leftTop ${componentCls}-arrow`]: {
top: dropdownArrowOffsetVertical
},
[`&-placement-leftBottom ${componentCls}-arrow`]: {
bottom: dropdownArrowOffsetVertical
},
// >>>>> Right
[[`&-placement-right ${componentCls}-arrow`, `&-placement-rightTop ${componentCls}-arrow`, `&-placement-rightBottom ${componentCls}-arrow`].join(",")]: {
left: {
_skip_check_: true,
value: 0
},
transform: "translateX(-100%) rotate(-90deg)"
},
[`&-placement-right ${componentCls}-arrow`]: {
top: {
_skip_check_: true,
value: "50%"
},
transform: "translateY(-50%) translateX(-100%) rotate(-90deg)"
},
[`&-placement-rightTop ${componentCls}-arrow`]: {
top: dropdownArrowOffsetVertical
},
[`&-placement-rightBottom ${componentCls}-arrow`]: {
bottom: dropdownArrowOffsetVertical
},
// =========================== Offset ============================
// Offset the popover to account for the dropdown arrow
// >>>>> Top
[connectArrowCls([`&-placement-topLeft`, `&-placement-top`, `&-placement-topRight`].map((cls) => cls += ":not(&-arrow-hidden)"), showArrowCls)]: {
paddingBottom: dropdownArrowDistance
},
// >>>>> Bottom
[connectArrowCls([`&-placement-bottomLeft`, `&-placement-bottom`, `&-placement-bottomRight`].map((cls) => cls += ":not(&-arrow-hidden)"), showArrowCls)]: {
paddingTop: dropdownArrowDistance
},
// >>>>> Left
[connectArrowCls([`&-placement-leftTop`, `&-placement-left`, `&-placement-leftBottom`].map((cls) => cls += ":not(&-arrow-hidden)"), showArrowCls)]: {
paddingRight: {
_skip_check_: true,
value: dropdownArrowDistance
}
},
// >>>>> Right
[connectArrowCls([`&-placement-rightTop`, `&-placement-right`, `&-placement-rightBottom`].map((cls) => cls += ":not(&-arrow-hidden)"), showArrowCls)]: {
paddingLeft: {
_skip_check_: true,
value: dropdownArrowDistance
}
}
}
};
}
const genTooltipStyle = (token) => {
const {
componentCls,
// ant-tooltip
tooltipMaxWidth,
tooltipColor,
tooltipBg,
tooltipBorderRadius,
zIndexPopup,
controlHeight,
boxShadowSecondary,
paddingSM,
paddingXS,
tooltipRadiusOuter
} = token;
return [
{
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
position: "absolute",
zIndex: zIndexPopup,
display: "block",
"&": [{
width: "max-content"
}, {
width: "intrinsic"
}],
maxWidth: tooltipMaxWidth,
visibility: "visible",
"&-hidden": {
display: "none"
},
"--antd-arrow-background-color": tooltipBg,
// Wrapper for the tooltip content
[`${componentCls}-inner`]: {
minWidth: controlHeight,
minHeight: controlHeight,
padding: `${paddingSM / 2}px ${paddingXS}px`,
color: tooltipColor,
textAlign: "start",
textDecoration: "none",
wordWrap: "break-word",
backgroundColor: tooltipBg,
borderRadius: tooltipBorderRadius,
boxShadow: boxShadowSecondary
},
// Limit left and right placement radius
[[`&-placement-left`, `&-placement-leftTop`, `&-placement-leftBottom`, `&-placement-right`, `&-placement-rightTop`, `&-placement-rightBottom`].join(",")]: {
[`${componentCls}-inner`]: {
borderRadius: Math.min(tooltipBorderRadius, MAX_VERTICAL_CONTENT_RADIUS)
}
},
[`${componentCls}-content`]: {
position: "relative"
}
}), genPresetColor(token, (colorKey, _ref) => {
let {
darkColor
} = _ref;
return {
[`&${componentCls}-${colorKey}`]: {
[`${componentCls}-inner`]: {
backgroundColor: darkColor
},
[`${componentCls}-arrow`]: {
"--antd-arrow-background-color": darkColor
}
}
};
})), {
// RTL
"&-rtl": {
direction: "rtl"
}
})
},
// Arrow Style
getArrowStyle(merge(token, {
borderRadiusOuter: tooltipRadiusOuter
}), {
colorBg: "var(--antd-arrow-background-color)",
showArrowCls: "",
contentRadius: tooltipBorderRadius,
limitVerticalRadius: true
}),
// Pure Render
{
[`${componentCls}-pure`]: {
position: "relative",
maxWidth: "none"
}
}
];
};
const useStyle$T = ((prefixCls, injectStyle) => {
const useOriginHook = genComponentStyleHook("Tooltip", (token) => {
if ((injectStyle === null || injectStyle === void 0 ? void 0 : injectStyle.value) === false) {
return [];
}
const {
borderRadius,
colorTextLightSolid,
colorBgDefault,
borderRadiusOuter
} = token;
const TooltipToken = merge(token, {
// default variables
tooltipMaxWidth: 250,
tooltipColor: colorTextLightSolid,
tooltipBorderRadius: borderRadius,
tooltipBg: colorBgDefault,
tooltipRadiusOuter: borderRadiusOuter > 4 ? 4 : borderRadiusOuter
});
return [genTooltipStyle(TooltipToken), initZoomMotion(token, "zoom-big-fast")];
}, (_ref2) => {
let {
zIndexPopupBase,
colorBgSpotlight
} = _ref2;
return {
zIndexPopup: zIndexPopupBase + 70,
colorBgDefault: colorBgSpotlight
};
});
return useOriginHook(prefixCls);
});
const splitObject = (obj, keys) => {
const picked = {};
const omitted = _extends({}, obj);
keys.forEach((key2) => {
if (obj && key2 in obj) {
picked[key2] = obj[key2];
delete omitted[key2];
}
});
return {
picked,
omitted
};
};
const tooltipProps = () => _extends(_extends({}, abstractTooltipProps()), {
title: PropTypes.any
});
const tooltipDefaultProps = () => ({
trigger: "hover",
align: {},
placement: "top",
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
arrowPointAtCenter: false,
autoAdjustOverflow: true
});
const ToolTip = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATooltip",
inheritAttrs: false,
props: initDefaultProps(tooltipProps(), {
trigger: "hover",
align: {},
placement: "top",
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
arrowPointAtCenter: false,
autoAdjustOverflow: true
}),
slots: Object,
// emits: ['update:visible', 'visibleChange'],
setup(props2, _ref) {
let {
slots,
emit,
attrs,
expose
} = _ref;
const {
prefixCls,
getPopupContainer,
direction,
rootPrefixCls
} = useConfigInject("tooltip", props2);
const mergedOpen = computed(() => {
var _a;
return (_a = props2.open) !== null && _a !== void 0 ? _a : props2.visible;
});
const innerOpen = ref(firstNotUndefined([props2.open, props2.visible]));
const tooltip = ref();
let rafId;
watch(mergedOpen, (val) => {
wrapperRaf.cancel(rafId);
rafId = wrapperRaf(() => {
innerOpen.value = !!val;
});
});
const isNoTitle = () => {
var _a;
const title = (_a = props2.title) !== null && _a !== void 0 ? _a : slots.title;
return !title && title !== 0;
};
const handleVisibleChange = (val) => {
const noTitle = isNoTitle();
if (mergedOpen.value === void 0) {
innerOpen.value = noTitle ? false : val;
}
if (!noTitle) {
emit("update:visible", val);
emit("visibleChange", val);
emit("update:open", val);
emit("openChange", val);
}
};
const getPopupDomNode = () => {
return tooltip.value.getPopupDomNode();
};
expose({
getPopupDomNode,
open: innerOpen,
forcePopupAlign: () => {
var _a;
return (_a = tooltip.value) === null || _a === void 0 ? void 0 : _a.forcePopupAlign();
}
});
const tooltipPlacements = computed(() => {
var _a;
const {
builtinPlacements,
autoAdjustOverflow: autoAdjustOverflow2,
arrow,
arrowPointAtCenter
} = props2;
let mergedArrowPointAtCenter = arrowPointAtCenter;
if (typeof arrow === "object") {
mergedArrowPointAtCenter = (_a = arrow.pointAtCenter) !== null && _a !== void 0 ? _a : arrowPointAtCenter;
}
return builtinPlacements || getPlacements$1({
arrowPointAtCenter: mergedArrowPointAtCenter,
autoAdjustOverflow: autoAdjustOverflow2
});
});
const isTrueProps = (val) => {
return val || val === "";
};
const getDisabledCompatibleChildren = (ele) => {
const elementType = ele.type;
if (typeof elementType === "object" && ele.props) {
if ((elementType.__ANT_BUTTON === true || elementType === "button") && isTrueProps(ele.props.disabled) || elementType.__ANT_SWITCH === true && (isTrueProps(ele.props.disabled) || isTrueProps(ele.props.loading)) || elementType.__ANT_RADIO === true && isTrueProps(ele.props.disabled)) {
const {
picked,
omitted
} = splitObject(getStyle$3(ele), ["position", "left", "right", "top", "bottom", "float", "display", "zIndex"]);
const spanStyle = _extends(_extends({
display: "inline-block"
}, picked), {
cursor: "not-allowed",
lineHeight: 1,
width: ele.props && ele.props.block ? "100%" : void 0
});
const buttonStyle = _extends(_extends({}, omitted), {
pointerEvents: "none"
});
const child = cloneElement(ele, {
style: buttonStyle
}, true);
return createVNode("span", {
"style": spanStyle,
"class": `${prefixCls.value}-disabled-compatible-wrapper`
}, [child]);
}
}
return ele;
};
const getOverlay = () => {
var _a, _b;
return (_a = props2.title) !== null && _a !== void 0 ? _a : (_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots);
};
const onPopupAlign = (domNode, align) => {
const placements2 = tooltipPlacements.value;
const placement = Object.keys(placements2).find((key2) => {
var _a, _b;
return placements2[key2].points[0] === ((_a = align.points) === null || _a === void 0 ? void 0 : _a[0]) && placements2[key2].points[1] === ((_b = align.points) === null || _b === void 0 ? void 0 : _b[1]);
});
if (placement) {
const rect = domNode.getBoundingClientRect();
const transformOrigin = {
top: "50%",
left: "50%"
};
if (placement.indexOf("top") >= 0 || placement.indexOf("Bottom") >= 0) {
transformOrigin.top = `${rect.height - align.offset[1]}px`;
} else if (placement.indexOf("Top") >= 0 || placement.indexOf("bottom") >= 0) {
transformOrigin.top = `${-align.offset[1]}px`;
}
if (placement.indexOf("left") >= 0 || placement.indexOf("Right") >= 0) {
transformOrigin.left = `${rect.width - align.offset[0]}px`;
} else if (placement.indexOf("right") >= 0 || placement.indexOf("Left") >= 0) {
transformOrigin.left = `${-align.offset[0]}px`;
}
domNode.style.transformOrigin = `${transformOrigin.left} ${transformOrigin.top}`;
}
};
const colorInfo = computed(() => parseColor(prefixCls.value, props2.color));
const injectFromPopover = computed(() => attrs["data-popover-inject"]);
const [wrapSSR, hashId] = useStyle$T(prefixCls, computed(() => !injectFromPopover.value));
return () => {
var _a, _b;
const {
openClassName,
overlayClassName,
overlayStyle,
overlayInnerStyle
} = props2;
let children = (_b = filterEmpty((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))) !== null && _b !== void 0 ? _b : null;
children = children.length === 1 ? children[0] : children;
let tempVisible = innerOpen.value;
if (mergedOpen.value === void 0 && isNoTitle()) {
tempVisible = false;
}
if (!children) {
return null;
}
const child = getDisabledCompatibleChildren(isValidElement(children) && !isFragment(children) ? children : createVNode("span", null, [children]));
const childCls = classNames({
[openClassName || `${prefixCls.value}-open`]: true,
[child.props && child.props.class]: child.props && child.props.class
});
const customOverlayClassName = classNames(overlayClassName, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, colorInfo.value.className, hashId.value);
const formattedOverlayInnerStyle = _extends(_extends({}, colorInfo.value.overlayStyle), overlayInnerStyle);
const arrowContentStyle = colorInfo.value.arrowStyle;
const vcTooltipProps = _extends(_extends(_extends({}, attrs), props2), {
prefixCls: prefixCls.value,
arrow: !!props2.arrow,
getPopupContainer: getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value,
builtinPlacements: tooltipPlacements.value,
visible: tempVisible,
ref: tooltip,
overlayClassName: customOverlayClassName,
overlayStyle: _extends(_extends({}, arrowContentStyle), overlayStyle),
overlayInnerStyle: formattedOverlayInnerStyle,
onVisibleChange: handleVisibleChange,
onPopupAlign,
transitionName: getTransitionName$1(rootPrefixCls.value, "zoom-big-fast", props2.transitionName)
});
return wrapSSR(createVNode(Tooltip, vcTooltipProps, {
default: () => [innerOpen.value ? cloneElement(child, {
class: childCls
}) : child],
arrowContent: () => createVNode("span", {
"class": `${prefixCls.value}-arrow-content`
}, null),
overlay: getOverlay
}));
};
}
});
const __nuxt_component_2$4 = withInstall(ToolTip);
const genBaseStyle$g = (token) => {
const {
componentCls,
popoverBg,
popoverColor,
width,
fontWeightStrong,
popoverPadding,
boxShadowSecondary,
colorTextHeading,
borderRadiusLG: borderRadius,
zIndexPopup,
marginXS,
colorBgElevated
} = token;
return [
{
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "absolute",
top: 0,
// use `left` to fix https://github.com/ant-design/ant-design/issues/39195
left: {
_skip_check_: true,
value: 0
},
zIndex: zIndexPopup,
fontWeight: "normal",
whiteSpace: "normal",
textAlign: "start",
cursor: "auto",
userSelect: "text",
"--antd-arrow-background-color": colorBgElevated,
"&-rtl": {
direction: "rtl"
},
"&-hidden": {
display: "none"
},
[`${componentCls}-content`]: {
position: "relative"
},
[`${componentCls}-inner`]: {
backgroundColor: popoverBg,
backgroundClip: "padding-box",
borderRadius,
boxShadow: boxShadowSecondary,
padding: popoverPadding
},
[`${componentCls}-title`]: {
minWidth: width,
marginBottom: marginXS,
color: colorTextHeading,
fontWeight: fontWeightStrong
},
[`${componentCls}-inner-content`]: {
color: popoverColor
}
})
},
// Arrow Style
getArrowStyle(token, {
colorBg: "var(--antd-arrow-background-color)"
}),
// Pure Render
{
[`${componentCls}-pure`]: {
position: "relative",
maxWidth: "none",
[`${componentCls}-content`]: {
display: "inline-block"
}
}
}
];
};
const genColorStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: PresetColors.map((colorKey) => {
const lightColor = token[`${colorKey}-6`];
return {
[`&${componentCls}-${colorKey}`]: {
"--antd-arrow-background-color": lightColor,
[`${componentCls}-inner`]: {
backgroundColor: lightColor
},
[`${componentCls}-arrow`]: {
background: "transparent"
}
}
};
})
};
};
const genWireframeStyle$1 = (token) => {
const {
componentCls,
lineWidth,
lineType,
colorSplit,
paddingSM,
controlHeight,
fontSize,
lineHeight,
padding
} = token;
const titlePaddingBlockDist = controlHeight - Math.round(fontSize * lineHeight);
const popoverTitlePaddingBlockTop = titlePaddingBlockDist / 2;
const popoverTitlePaddingBlockBottom = titlePaddingBlockDist / 2 - lineWidth;
const popoverPaddingHorizontal = padding;
return {
[componentCls]: {
[`${componentCls}-inner`]: {
padding: 0
},
[`${componentCls}-title`]: {
margin: 0,
padding: `${popoverTitlePaddingBlockTop}px ${popoverPaddingHorizontal}px ${popoverTitlePaddingBlockBottom}px`,
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`
},
[`${componentCls}-inner-content`]: {
padding: `${paddingSM}px ${popoverPaddingHorizontal}px`
}
}
};
};
const useStyle$S = genComponentStyleHook("Popover", (token) => {
const {
colorBgElevated,
colorText,
wireframe
} = token;
const popoverToken = merge(token, {
popoverBg: colorBgElevated,
popoverColor: colorText,
popoverPadding: 12
// Fixed Value
});
return [genBaseStyle$g(popoverToken), genColorStyle(popoverToken), wireframe && genWireframeStyle$1(popoverToken), initZoomMotion(popoverToken, "zoom-big")];
}, (_ref) => {
let {
zIndexPopupBase
} = _ref;
return {
zIndexPopup: zIndexPopupBase + 30,
width: 177
};
});
const popoverProps = () => _extends(_extends({}, abstractTooltipProps()), {
content: anyType(),
title: anyType()
});
const Popover = defineComponent({
compatConfig: {
MODE: 3
},
name: "APopover",
inheritAttrs: false,
props: initDefaultProps(popoverProps(), _extends(_extends({}, tooltipDefaultProps()), {
trigger: "hover",
placement: "top",
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1
})),
setup(props2, _ref) {
let {
expose,
slots,
attrs
} = _ref;
const tooltipRef = ref();
warning(props2.visible === void 0);
expose({
getPopupDomNode: () => {
var _a, _b;
return (_b = (_a = tooltipRef.value) === null || _a === void 0 ? void 0 : _a.getPopupDomNode) === null || _b === void 0 ? void 0 : _b.call(_a);
}
});
const {
prefixCls,
configProvider
} = useConfigInject("popover", props2);
const [wrapSSR, hashId] = useStyle$S(prefixCls);
const rootPrefixCls = computed(() => configProvider.getPrefixCls());
const getOverlay = () => {
var _a, _b;
const {
title = filterEmpty((_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots)),
content = filterEmpty((_b = slots.content) === null || _b === void 0 ? void 0 : _b.call(slots))
} = props2;
const hasTitle = !!(Array.isArray(title) ? title.length : title);
const hasContent = !!(Array.isArray(content) ? content.length : title);
if (!hasTitle && !hasContent) return null;
return createVNode(Fragment, null, [hasTitle && createVNode("div", {
"class": `${prefixCls.value}-title`
}, [title]), createVNode("div", {
"class": `${prefixCls.value}-inner-content`
}, [content])]);
};
return () => {
const overlayCls = classNames(props2.overlayClassName, hashId.value);
return wrapSSR(createVNode(__nuxt_component_2$4, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, omit(props2, ["title", "content"])), attrs), {}, {
"prefixCls": prefixCls.value,
"ref": tooltipRef,
"overlayClassName": overlayCls,
"transitionName": getTransitionName$1(rootPrefixCls.value, "zoom-big", props2.transitionName),
"data-popover-inject": true
}), {
title: getOverlay,
default: slots.default
}));
};
}
});
const __nuxt_component_1$6 = withInstall(Popover);
const groupProps = () => ({
prefixCls: String,
maxCount: Number,
maxStyle: {
type: Object,
default: void 0
},
maxPopoverPlacement: {
type: String,
default: "top"
},
maxPopoverTrigger: String,
/*
* Size of avatar, options: `large`, `small`, `default`
* or a custom number size
* */
size: {
type: [Number, String, Object],
default: "default"
},
shape: {
type: String,
default: "circle"
}
});
const Group$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AAvatarGroup",
inheritAttrs: false,
props: groupProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("avatar", props2);
const groupPrefixCls = computed(() => `${prefixCls.value}-group`);
const [wrapSSR, hashId] = useStyle$U(prefixCls);
watchEffect(() => {
const context2 = {
size: props2.size,
shape: props2.shape
};
useAvatarProviderContext(context2);
});
return () => {
const {
maxPopoverPlacement = "top",
maxCount: maxCount2,
maxStyle,
maxPopoverTrigger = "hover",
shape
} = props2;
const cls = {
[groupPrefixCls.value]: true,
[`${groupPrefixCls.value}-rtl`]: direction.value === "rtl",
[`${attrs.class}`]: !!attrs.class,
[hashId.value]: true
};
const children = getPropsSlot(slots, props2);
const childrenWithProps = flattenChildren(children).map((child, index2) => cloneElement(child, {
key: `avatar-key-${index2}`
}));
const numOfChildren = childrenWithProps.length;
if (maxCount2 && maxCount2 < numOfChildren) {
const childrenShow = childrenWithProps.slice(0, maxCount2);
const childrenHidden = childrenWithProps.slice(maxCount2, numOfChildren);
childrenShow.push(createVNode(__nuxt_component_1$6, {
"key": "avatar-popover-key",
"content": childrenHidden,
"trigger": maxPopoverTrigger,
"placement": maxPopoverPlacement,
"overlayClassName": `${groupPrefixCls.value}-popover`
}, {
default: () => [createVNode(Avatar, {
"style": maxStyle,
"shape": shape
}, {
default: () => [`+${numOfChildren - maxCount2}`]
})]
}));
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": cls,
"style": attrs.style
}), [childrenShow]));
}
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": cls,
"style": attrs.style
}), [childrenWithProps]));
};
}
});
Avatar.Group = Group$2;
Avatar.install = function(app) {
app.component(Avatar.name, Avatar);
app.component(Group$2.name, Group$2);
return app;
};
function UnitNumber(_ref) {
let {
prefixCls,
value,
current,
offset: offset2 = 0
} = _ref;
let style;
if (offset2) {
style = {
position: "absolute",
top: `${offset2}00%`,
left: 0
};
}
return createVNode("p", {
"style": style,
"class": classNames(`${prefixCls}-only-unit`, {
current
})
}, [value]);
}
function getOffset$1(start, end, unit) {
let index2 = start;
let offset2 = 0;
while ((index2 + 10) % 10 !== end) {
index2 += unit;
offset2 += unit;
}
return offset2;
}
const SingleNumber = defineComponent({
compatConfig: {
MODE: 3
},
name: "SingleNumber",
props: {
prefixCls: String,
value: String,
count: Number
},
setup(props2) {
const originValue = computed(() => Number(props2.value));
const originCount = computed(() => Math.abs(props2.count));
const state = reactive({
prevValue: originValue.value,
prevCount: originCount.value
});
const onTransitionEnd = () => {
state.prevValue = originValue.value;
state.prevCount = originCount.value;
};
const timeout = ref();
watch(originValue, () => {
clearTimeout(timeout.value);
timeout.value = setTimeout(() => {
onTransitionEnd();
}, 1e3);
}, {
flush: "post"
});
return () => {
let unitNodes;
let offsetStyle = {};
const value = originValue.value;
if (state.prevValue === value || Number.isNaN(value) || Number.isNaN(state.prevValue)) {
unitNodes = [UnitNumber(_extends(_extends({}, props2), {
current: true
}))];
offsetStyle = {
transition: "none"
};
} else {
unitNodes = [];
const end = value + 10;
const unitNumberList = [];
for (let index2 = value; index2 <= end; index2 += 1) {
unitNumberList.push(index2);
}
const prevIndex = unitNumberList.findIndex((n) => n % 10 === state.prevValue);
unitNodes = unitNumberList.map((n, index2) => {
const singleUnit = n % 10;
return UnitNumber(_extends(_extends({}, props2), {
value: singleUnit,
offset: index2 - prevIndex,
current: index2 === prevIndex
}));
});
const unit = state.prevCount < originCount.value ? 1 : -1;
offsetStyle = {
transform: `translateY(${-getOffset$1(state.prevValue, value, unit)}00%)`
};
}
return createVNode("span", {
"class": `${props2.prefixCls}-only`,
"style": offsetStyle,
"onTransitionend": () => onTransitionEnd()
}, [unitNodes]);
};
}
});
var __rest$14 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const scrollNumberProps = {
prefixCls: String,
count: PropTypes.any,
component: String,
title: PropTypes.any,
show: Boolean
};
const ScrollNumber = defineComponent({
compatConfig: {
MODE: 3
},
name: "ScrollNumber",
inheritAttrs: false,
props: scrollNumberProps,
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const {
prefixCls
} = useConfigInject("scroll-number", props2);
return () => {
var _a;
const _b = _extends(_extends({}, props2), attrs), {
prefixCls: customizePrefixCls,
count,
title,
show,
component: Tag2 = "sup",
class: className,
style
} = _b, restProps = __rest$14(_b, ["prefixCls", "count", "title", "show", "component", "class", "style"]);
const newProps = _extends(_extends({}, restProps), {
style,
"data-show": props2.show,
class: classNames(prefixCls.value, className),
title
});
let numberNodes = count;
if (count && Number(count) % 1 === 0) {
const numberList = String(count).split("");
numberNodes = numberList.map((num, i) => createVNode(SingleNumber, {
"prefixCls": prefixCls.value,
"count": Number(count),
"value": num,
"key": numberList.length - i
}, null));
}
if (style && style.borderColor) {
newProps.style = _extends(_extends({}, style), {
boxShadow: `0 0 0 1px ${style.borderColor} inset`
});
}
const children = filterEmpty((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
if (children && children.length) {
return cloneElement(children, {
class: classNames(`${prefixCls.value}-custom-component`)
}, false);
}
return createVNode(Tag2, newProps, {
default: () => [numberNodes]
});
};
}
});
const antStatusProcessing = new Keyframe("antStatusProcessing", {
"0%": {
transform: "scale(0.8)",
opacity: 0.5
},
"100%": {
transform: "scale(2.4)",
opacity: 0
}
});
const antZoomBadgeIn = new Keyframe("antZoomBadgeIn", {
"0%": {
transform: "scale(0) translate(50%, -50%)",
opacity: 0
},
"100%": {
transform: "scale(1) translate(50%, -50%)"
}
});
const antZoomBadgeOut = new Keyframe("antZoomBadgeOut", {
"0%": {
transform: "scale(1) translate(50%, -50%)"
},
"100%": {
transform: "scale(0) translate(50%, -50%)",
opacity: 0
}
});
const antNoWrapperZoomBadgeIn = new Keyframe("antNoWrapperZoomBadgeIn", {
"0%": {
transform: "scale(0)",
opacity: 0
},
"100%": {
transform: "scale(1)"
}
});
const antNoWrapperZoomBadgeOut = new Keyframe("antNoWrapperZoomBadgeOut", {
"0%": {
transform: "scale(1)"
},
"100%": {
transform: "scale(0)",
opacity: 0
}
});
const antBadgeLoadingCircle = new Keyframe("antBadgeLoadingCircle", {
"0%": {
transformOrigin: "50%"
},
"100%": {
transform: "translate(50%, -50%) rotate(360deg)",
transformOrigin: "50%"
}
});
const genSharedBadgeStyle = (token) => {
const {
componentCls,
iconCls,
antCls,
badgeFontHeight,
badgeShadowSize,
badgeHeightSm,
motionDurationSlow,
badgeStatusSize,
marginXS,
badgeRibbonOffset
} = token;
const numberPrefixCls = `${antCls}-scroll-number`;
const ribbonPrefixCls = `${antCls}-ribbon`;
const ribbonWrapperPrefixCls = `${antCls}-ribbon-wrapper`;
const colorPreset = genPresetColor(token, (colorKey, _ref) => {
let {
darkColor
} = _ref;
return {
[`&${componentCls} ${componentCls}-color-${colorKey}`]: {
background: darkColor,
[`&:not(${componentCls}-count)`]: {
color: darkColor
}
}
};
});
const statusRibbonPreset = genPresetColor(token, (colorKey, _ref2) => {
let {
darkColor
} = _ref2;
return {
[`&${ribbonPrefixCls}-color-${colorKey}`]: {
background: darkColor,
color: darkColor
}
};
});
return {
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "inline-block",
width: "fit-content",
lineHeight: 1,
[`${componentCls}-count`]: {
zIndex: token.badgeZIndex,
minWidth: token.badgeHeight,
height: token.badgeHeight,
color: token.badgeTextColor,
fontWeight: token.badgeFontWeight,
fontSize: token.badgeFontSize,
lineHeight: `${token.badgeHeight}px`,
whiteSpace: "nowrap",
textAlign: "center",
background: token.badgeColor,
borderRadius: token.badgeHeight / 2,
boxShadow: `0 0 0 ${badgeShadowSize}px ${token.badgeShadowColor}`,
transition: `background ${token.motionDurationMid}`,
a: {
color: token.badgeTextColor
},
"a:hover": {
color: token.badgeTextColor
},
"a:hover &": {
background: token.badgeColorHover
}
},
[`${componentCls}-count-sm`]: {
minWidth: badgeHeightSm,
height: badgeHeightSm,
fontSize: token.badgeFontSizeSm,
lineHeight: `${badgeHeightSm}px`,
borderRadius: badgeHeightSm / 2
},
[`${componentCls}-multiple-words`]: {
padding: `0 ${token.paddingXS}px`
},
[`${componentCls}-dot`]: {
zIndex: token.badgeZIndex,
width: token.badgeDotSize,
minWidth: token.badgeDotSize,
height: token.badgeDotSize,
background: token.badgeColor,
borderRadius: "100%",
boxShadow: `0 0 0 ${badgeShadowSize}px ${token.badgeShadowColor}`
},
[`${componentCls}-dot${numberPrefixCls}`]: {
transition: `background ${motionDurationSlow}`
},
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
position: "absolute",
top: 0,
insetInlineEnd: 0,
transform: "translate(50%, -50%)",
transformOrigin: "100% 0%",
[`&${iconCls}-spin`]: {
animationName: antBadgeLoadingCircle,
animationDuration: "1s",
animationIterationCount: "infinite",
animationTimingFunction: "linear"
}
},
[`&${componentCls}-status`]: {
lineHeight: "inherit",
verticalAlign: "baseline",
[`${componentCls}-status-dot`]: {
position: "relative",
top: -1,
display: "inline-block",
width: badgeStatusSize,
height: badgeStatusSize,
verticalAlign: "middle",
borderRadius: "50%"
},
[`${componentCls}-status-success`]: {
backgroundColor: token.colorSuccess
},
[`${componentCls}-status-processing`]: {
overflow: "visible",
color: token.colorPrimary,
backgroundColor: token.colorPrimary,
"&::after": {
position: "absolute",
top: 0,
insetInlineStart: 0,
width: "100%",
height: "100%",
borderWidth: badgeShadowSize,
borderStyle: "solid",
borderColor: "inherit",
borderRadius: "50%",
animationName: antStatusProcessing,
animationDuration: token.badgeProcessingDuration,
animationIterationCount: "infinite",
animationTimingFunction: "ease-in-out",
content: '""'
}
},
[`${componentCls}-status-default`]: {
backgroundColor: token.colorTextPlaceholder
},
[`${componentCls}-status-error`]: {
backgroundColor: token.colorError
},
[`${componentCls}-status-warning`]: {
backgroundColor: token.colorWarning
},
[`${componentCls}-status-text`]: {
marginInlineStart: marginXS,
color: token.colorText,
fontSize: token.fontSize
}
}
}), colorPreset), {
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: "both"
},
[`${componentCls}-zoom-leave`]: {
animationName: antZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack,
animationFillMode: "both"
},
[`&${componentCls}-not-a-wrapper`]: {
[`${componentCls}-zoom-appear, ${componentCls}-zoom-enter`]: {
animationName: antNoWrapperZoomBadgeIn,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`${componentCls}-zoom-leave`]: {
animationName: antNoWrapperZoomBadgeOut,
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseOutBack
},
[`&:not(${componentCls}-status)`]: {
verticalAlign: "middle"
},
[`${numberPrefixCls}-custom-component, ${componentCls}-count`]: {
transform: "none"
},
[`${numberPrefixCls}-custom-component, ${numberPrefixCls}`]: {
position: "relative",
top: "auto",
display: "block",
transformOrigin: "50% 50%"
}
},
[`${numberPrefixCls}`]: {
overflow: "hidden",
[`${numberPrefixCls}-only`]: {
position: "relative",
display: "inline-block",
height: token.badgeHeight,
transition: `all ${token.motionDurationSlow} ${token.motionEaseOutBack}`,
WebkitTransformStyle: "preserve-3d",
WebkitBackfaceVisibility: "hidden",
[`> p${numberPrefixCls}-only-unit`]: {
height: token.badgeHeight,
margin: 0,
WebkitTransformStyle: "preserve-3d",
WebkitBackfaceVisibility: "hidden"
}
},
[`${numberPrefixCls}-symbol`]: {
verticalAlign: "top"
}
},
// ====================== RTL =======================
"&-rtl": {
direction: "rtl",
[`${componentCls}-count, ${componentCls}-dot, ${numberPrefixCls}-custom-component`]: {
transform: "translate(-50%, -50%)"
}
}
}),
[`${ribbonWrapperPrefixCls}`]: {
position: "relative"
},
[`${ribbonPrefixCls}`]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
position: "absolute",
top: marginXS,
padding: `0 ${token.paddingXS}px`,
color: token.colorPrimary,
lineHeight: `${badgeFontHeight}px`,
whiteSpace: "nowrap",
backgroundColor: token.colorPrimary,
borderRadius: token.borderRadiusSM,
[`${ribbonPrefixCls}-text`]: {
color: token.colorTextLightSolid
},
[`${ribbonPrefixCls}-corner`]: {
position: "absolute",
top: "100%",
width: badgeRibbonOffset,
height: badgeRibbonOffset,
color: "currentcolor",
border: `${badgeRibbonOffset / 2}px solid`,
transform: token.badgeRibbonCornerTransform,
transformOrigin: "top",
filter: token.badgeRibbonCornerFilter
}
}), statusRibbonPreset), {
[`&${ribbonPrefixCls}-placement-end`]: {
insetInlineEnd: -badgeRibbonOffset,
borderEndEndRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineEnd: 0,
borderInlineEndColor: "transparent",
borderBlockEndColor: "transparent"
}
},
[`&${ribbonPrefixCls}-placement-start`]: {
insetInlineStart: -badgeRibbonOffset,
borderEndStartRadius: 0,
[`${ribbonPrefixCls}-corner`]: {
insetInlineStart: 0,
borderBlockEndColor: "transparent",
borderInlineStartColor: "transparent"
}
},
// ====================== RTL =======================
"&-rtl": {
direction: "rtl"
}
})
};
};
const useStyle$R = genComponentStyleHook("Badge", (token) => {
const {
fontSize,
lineHeight,
fontSizeSM,
lineWidth,
marginXS,
colorBorderBg
} = token;
const badgeFontHeight = Math.round(fontSize * lineHeight);
const badgeShadowSize = lineWidth;
const badgeZIndex = "auto";
const badgeHeight = badgeFontHeight - 2 * badgeShadowSize;
const badgeTextColor = token.colorBgContainer;
const badgeFontWeight = "normal";
const badgeFontSize = fontSizeSM;
const badgeColor = token.colorError;
const badgeColorHover = token.colorErrorHover;
const badgeHeightSm = fontSize;
const badgeDotSize = fontSizeSM / 2;
const badgeFontSizeSm = fontSizeSM;
const badgeStatusSize = fontSizeSM / 2;
const badgeToken = merge(token, {
badgeFontHeight,
badgeShadowSize,
badgeZIndex,
badgeHeight,
badgeTextColor,
badgeFontWeight,
badgeFontSize,
badgeColor,
badgeColorHover,
badgeShadowColor: colorBorderBg,
badgeHeightSm,
badgeDotSize,
badgeFontSizeSm,
badgeStatusSize,
badgeProcessingDuration: "1.2s",
badgeRibbonOffset: marginXS,
// Follow token just by Design. Not related with token
badgeRibbonCornerTransform: "scaleY(0.75)",
badgeRibbonCornerFilter: `brightness(75%)`
});
return [genSharedBadgeStyle(badgeToken)];
});
var __rest$13 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const ribbonProps = () => ({
prefix: String,
color: {
type: String
},
text: PropTypes.any,
placement: {
type: String,
default: "end"
}
});
const Ribbon = defineComponent({
compatConfig: {
MODE: 3
},
name: "ABadgeRibbon",
inheritAttrs: false,
props: ribbonProps(),
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("ribbon", props2);
const [wrapSSR, hashId] = useStyle$R(prefixCls);
const colorInPreset = computed(() => isPresetColor(props2.color, false));
const ribbonCls = computed(() => [prefixCls.value, `${prefixCls.value}-placement-${props2.placement}`, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-color-${props2.color}`]: colorInPreset.value
}]);
return () => {
var _a, _b;
const {
class: className,
style
} = attrs, restAttrs = __rest$13(attrs, ["class", "style"]);
const colorStyle = {};
const cornerColorStyle = {};
if (props2.color && !colorInPreset.value) {
colorStyle.background = props2.color;
cornerColorStyle.color = props2.color;
}
return wrapSSR(createVNode("div", _objectSpread$W({
"class": `${prefixCls.value}-wrapper ${hashId.value}`
}, restAttrs), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots), createVNode("div", {
"class": [ribbonCls.value, className, hashId.value],
"style": _extends(_extends({}, colorStyle), style)
}, [createVNode("span", {
"class": `${prefixCls.value}-text`
}, [props2.text || ((_b = slots.text) === null || _b === void 0 ? void 0 : _b.call(slots))]), createVNode("div", {
"class": `${prefixCls.value}-corner`,
"style": cornerColorStyle
}, null)])]));
};
}
});
const isNumeric = (value) => {
return !isNaN(parseFloat(value)) && isFinite(value);
};
const badgeProps = () => ({
/** Number to show in badge */
count: PropTypes.any.def(null),
showZero: {
type: Boolean,
default: void 0
},
/** Max count to show */
overflowCount: {
type: Number,
default: 99
},
/** whether to show red dot without number */
dot: {
type: Boolean,
default: void 0
},
prefixCls: String,
scrollNumberPrefixCls: String,
status: {
type: String
},
size: {
type: String,
default: "default"
},
color: String,
text: PropTypes.any,
offset: Array,
numberStyle: {
type: Object,
default: void 0
},
title: String
});
const Badge = defineComponent({
compatConfig: {
MODE: 3
},
name: "ABadge",
Ribbon,
inheritAttrs: false,
props: badgeProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("badge", props2);
const [wrapSSR, hashId] = useStyle$R(prefixCls);
const numberedDisplayCount = computed(() => {
return props2.count > props2.overflowCount ? `${props2.overflowCount}+` : props2.count;
});
const isZero = computed(() => numberedDisplayCount.value === "0" || numberedDisplayCount.value === 0);
const ignoreCount = computed(() => props2.count === null || isZero.value && !props2.showZero);
const hasStatus = computed(() => (props2.status !== null && props2.status !== void 0 || props2.color !== null && props2.color !== void 0) && ignoreCount.value);
const showAsDot = computed(() => props2.dot && !isZero.value);
const mergedCount = computed(() => showAsDot.value ? "" : numberedDisplayCount.value);
const isHidden = computed(() => {
const isEmpty2 = mergedCount.value === null || mergedCount.value === void 0 || mergedCount.value === "";
return (isEmpty2 || isZero.value && !props2.showZero) && !showAsDot.value;
});
const livingCount = ref(props2.count);
const displayCount = ref(mergedCount.value);
const isDotRef = ref(showAsDot.value);
watch([() => props2.count, mergedCount, showAsDot], () => {
if (!isHidden.value) {
livingCount.value = props2.count;
displayCount.value = mergedCount.value;
isDotRef.value = showAsDot.value;
}
}, {
immediate: true
});
const isInternalColor = computed(() => isPresetColor(props2.color, false));
const statusCls = computed(() => ({
[`${prefixCls.value}-status-dot`]: hasStatus.value,
[`${prefixCls.value}-status-${props2.status}`]: !!props2.status,
[`${prefixCls.value}-color-${props2.color}`]: isInternalColor.value
}));
const statusStyle = computed(() => {
if (props2.color && !isInternalColor.value) {
return {
background: props2.color,
color: props2.color
};
} else {
return {};
}
});
const scrollNumberCls = computed(() => ({
[`${prefixCls.value}-dot`]: isDotRef.value,
[`${prefixCls.value}-count`]: !isDotRef.value,
[`${prefixCls.value}-count-sm`]: props2.size === "small",
[`${prefixCls.value}-multiple-words`]: !isDotRef.value && displayCount.value && displayCount.value.toString().length > 1,
[`${prefixCls.value}-status-${props2.status}`]: !!props2.status,
[`${prefixCls.value}-color-${props2.color}`]: isInternalColor.value
}));
return () => {
var _a, _b;
const {
offset: offset2,
title,
color
} = props2;
const style = attrs.style;
const text = getPropsSlot(slots, props2, "text");
const pre = prefixCls.value;
const count = livingCount.value;
let children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
children = children.length ? children : null;
const visible = !!(!isHidden.value || slots.count);
const mergedStyle = (() => {
if (!offset2) {
return _extends({}, style);
}
const offsetStyle = {
marginTop: isNumeric(offset2[1]) ? `${offset2[1]}px` : offset2[1]
};
if (direction.value === "rtl") {
offsetStyle.left = `${parseInt(offset2[0], 10)}px`;
} else {
offsetStyle.right = `${-parseInt(offset2[0], 10)}px`;
}
return _extends(_extends({}, offsetStyle), style);
})();
const titleNode = title !== null && title !== void 0 ? title : typeof count === "string" || typeof count === "number" ? count : void 0;
const statusTextNode = visible || !text ? null : createVNode("span", {
"class": `${pre}-status-text`
}, [text]);
const displayNode = typeof count === "object" || count === void 0 && slots.count ? cloneElement(count !== null && count !== void 0 ? count : (_b = slots.count) === null || _b === void 0 ? void 0 : _b.call(slots), {
style: mergedStyle
}, false) : null;
const badgeClassName = classNames(pre, {
[`${pre}-status`]: hasStatus.value,
[`${pre}-not-a-wrapper`]: !children,
[`${pre}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value);
if (!children && hasStatus.value) {
const statusTextColor = mergedStyle.color;
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": badgeClassName,
"style": mergedStyle
}), [createVNode("span", {
"class": statusCls.value,
"style": statusStyle.value
}, null), createVNode("span", {
"style": {
color: statusTextColor
},
"class": `${pre}-status-text`
}, [text])]));
}
const transitionProps = getTransitionProps(children ? `${pre}-zoom` : "", {
appear: false
});
let scrollNumberStyle = _extends(_extends({}, mergedStyle), props2.numberStyle);
if (color && !isInternalColor.value) {
scrollNumberStyle = scrollNumberStyle || {};
scrollNumberStyle.background = color;
}
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": badgeClassName
}), [children, createVNode(Transition, transitionProps, {
default: () => [withDirectives(createVNode(ScrollNumber, {
"prefixCls": props2.scrollNumberPrefixCls,
"show": visible,
"class": scrollNumberCls.value,
"count": displayCount.value,
"title": titleNode,
"style": scrollNumberStyle,
"key": "scrollNumber"
}, {
default: () => [displayNode]
}), [[vShow, visible]])]
}), statusTextNode]));
};
}
});
Badge.install = function(app) {
app.component(Badge.name, Badge);
app.component(Ribbon.name, Ribbon);
return app;
};
const autoAdjustOverflow$1 = {
adjustX: 1,
adjustY: 1
};
const targetOffset$1 = [0, 0];
const placements$1 = {
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow$1,
offset: [0, -4],
targetOffset: targetOffset$1
},
topCenter: {
points: ["bc", "tc"],
overflow: autoAdjustOverflow$1,
offset: [0, -4],
targetOffset: targetOffset$1
},
topRight: {
points: ["br", "tr"],
overflow: autoAdjustOverflow$1,
offset: [0, -4],
targetOffset: targetOffset$1
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow$1,
offset: [0, 4],
targetOffset: targetOffset$1
},
bottomCenter: {
points: ["tc", "bc"],
overflow: autoAdjustOverflow$1,
offset: [0, 4],
targetOffset: targetOffset$1
},
bottomRight: {
points: ["tr", "br"],
overflow: autoAdjustOverflow$1,
offset: [0, 4],
targetOffset: targetOffset$1
}
};
var __rest$12 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Dropdown$1 = defineComponent({
compatConfig: {
MODE: 3
},
props: {
minOverlayWidthMatchTrigger: {
type: Boolean,
default: void 0
},
arrow: {
type: Boolean,
default: false
},
prefixCls: PropTypes.string.def("rc-dropdown"),
transitionName: String,
overlayClassName: PropTypes.string.def(""),
openClassName: String,
animation: PropTypes.any,
align: PropTypes.object,
overlayStyle: {
type: Object,
default: void 0
},
placement: PropTypes.string.def("bottomLeft"),
overlay: PropTypes.any,
trigger: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]).def("hover"),
alignPoint: {
type: Boolean,
default: void 0
},
showAction: PropTypes.array,
hideAction: PropTypes.array,
getPopupContainer: Function,
visible: {
type: Boolean,
default: void 0
},
defaultVisible: {
type: Boolean,
default: false
},
mouseEnterDelay: PropTypes.number.def(0.15),
mouseLeaveDelay: PropTypes.number.def(0.1)
},
emits: ["visibleChange", "overlayClick"],
setup(props2, _ref) {
let {
slots,
emit,
expose
} = _ref;
const triggerVisible = ref(!!props2.visible);
watch(() => props2.visible, (val) => {
if (val !== void 0) {
triggerVisible.value = val;
}
});
const triggerRef2 = ref();
expose({
triggerRef: triggerRef2
});
const onClick = (e) => {
if (props2.visible === void 0) {
triggerVisible.value = false;
}
emit("overlayClick", e);
};
const onVisibleChange = (visible) => {
if (props2.visible === void 0) {
triggerVisible.value = visible;
}
emit("visibleChange", visible);
};
const getMenuElement = () => {
var _a;
const overlayElement = (_a = slots.overlay) === null || _a === void 0 ? void 0 : _a.call(slots);
const extraOverlayProps = {
prefixCls: `${props2.prefixCls}-menu`,
onClick
};
return createVNode(Fragment, {
"key": skipFlattenKey
}, [props2.arrow && createVNode("div", {
"class": `${props2.prefixCls}-arrow`
}, null), cloneElement(overlayElement, extraOverlayProps, false)]);
};
const minOverlayWidthMatchTrigger = computed(() => {
const {
minOverlayWidthMatchTrigger: matchTrigger = !props2.alignPoint
} = props2;
return matchTrigger;
});
const renderChildren2 = () => {
var _a;
const children = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
return triggerVisible.value && children ? cloneElement(children[0], {
class: props2.openClassName || `${props2.prefixCls}-open`
}, false) : children;
};
const triggerHideAction = computed(() => {
if (!props2.hideAction && props2.trigger.indexOf("contextmenu") !== -1) {
return ["click"];
}
return props2.hideAction;
});
return () => {
const {
prefixCls,
arrow,
showAction,
overlayStyle,
trigger,
placement,
align,
getPopupContainer,
transitionName: transitionName2,
animation,
overlayClassName
} = props2, otherProps = __rest$12(props2, ["prefixCls", "arrow", "showAction", "overlayStyle", "trigger", "placement", "align", "getPopupContainer", "transitionName", "animation", "overlayClassName"]);
return createVNode(Trigger, _objectSpread$W(_objectSpread$W({}, otherProps), {}, {
"prefixCls": prefixCls,
"ref": triggerRef2,
"popupClassName": classNames(overlayClassName, {
[`${prefixCls}-show-arrow`]: arrow
}),
"popupStyle": overlayStyle,
"builtinPlacements": placements$1,
"action": trigger,
"showAction": showAction,
"hideAction": triggerHideAction.value || [],
"popupPlacement": placement,
"popupAlign": align,
"popupTransitionName": transitionName2,
"popupAnimation": animation,
"popupVisible": triggerVisible.value,
"stretch": minOverlayWidthMatchTrigger.value ? "minWidth" : "",
"onPopupVisibleChange": onVisibleChange,
"getPopupContainer": getPopupContainer
}), {
popup: getMenuElement,
default: renderChildren2
});
};
}
});
const genWaveStyle = (token) => {
const {
componentCls,
colorPrimary
} = token;
return {
[componentCls]: {
position: "absolute",
background: "transparent",
pointerEvents: "none",
boxSizing: "border-box",
color: `var(--wave-color, ${colorPrimary})`,
boxShadow: `0 0 0 0 currentcolor`,
opacity: 0.2,
// =================== Motion ===================
"&.wave-motion-appear": {
transition: [`box-shadow 0.4s ${token.motionEaseOutCirc}`, `opacity 2s ${token.motionEaseOutCirc}`].join(","),
"&-active": {
boxShadow: `0 0 0 6px currentcolor`,
opacity: 0
}
}
}
};
};
const useStyle$Q = genComponentStyleHook("Wave", (token) => [genWaveStyle(token)]);
const WaveEffect = defineComponent({
props: {
target: objectType(),
className: String
},
setup(props2) {
const divRef = shallowRef(null);
const [color, setWaveColor] = useState$1(null);
const [borderRadius, setBorderRadius] = useState$1([]);
const [left, setLeft] = useState$1(0);
const [top, setTop] = useState$1(0);
const [width, setWidth] = useState$1(0);
const [height, setHeight] = useState$1(0);
const [enabled, setEnabled] = useState$1(false);
const removeDom = () => {
var _a;
const holder = (_a = divRef.value) === null || _a === void 0 ? void 0 : _a.parentElement;
if (holder) {
render(null, holder);
if (holder.parentElement) {
holder.parentElement.removeChild(holder);
}
}
};
const onTransitionend = (e) => {
if (e.propertyName === "opacity") {
removeDom();
}
};
return () => {
if (!enabled.value) {
return null;
}
const waveStyle = {
left: `${left.value}px`,
top: `${top.value}px`,
width: `${width.value}px`,
height: `${height.value}px`,
borderRadius: borderRadius.value.map((radius) => `${radius}px`).join(" ")
};
if (color) {
waveStyle["--wave-color"] = color.value;
}
return createVNode(Transition, {
"appear": true,
"name": "wave-motion",
"appearFromClass": "wave-motion-appear",
"appearActiveClass": "wave-motion-appear",
"appearToClass": "wave-motion-appear wave-motion-appear-active"
}, {
default: () => [createVNode("div", {
"ref": divRef,
"class": props2.className,
"style": waveStyle,
"onTransitionend": onTransitionend
}, null)]
});
};
}
});
function showWaveEffect(node, className) {
const holder = (void 0).createElement("div");
holder.style.position = "absolute";
holder.style.left = `0px`;
holder.style.top = `0px`;
node === null || node === void 0 ? void 0 : node.insertBefore(holder, node === null || node === void 0 ? void 0 : node.firstChild);
render(createVNode(WaveEffect, {
"target": node,
"className": className
}, null), holder);
return () => {
render(null, holder);
if (holder.parentElement) {
holder.parentElement.removeChild(holder);
}
};
}
function useWave(className, wave) {
const instance = getCurrentInstance();
let stopWave;
function showWave() {
var _a;
const node = findDOMNode(instance);
stopWave === null || stopWave === void 0 ? void 0 : stopWave();
if (((_a = wave === null || wave === void 0 ? void 0 : wave.value) === null || _a === void 0 ? void 0 : _a.disabled) || !node) {
return;
}
stopWave = showWaveEffect(node, className.value);
}
return showWave;
}
const Wave = defineComponent({
compatConfig: {
MODE: 3
},
name: "Wave",
props: {
disabled: Boolean
},
setup(props2, _ref) {
let {
slots
} = _ref;
getCurrentInstance();
const {
prefixCls,
wave
} = useConfigInject("wave", props2);
const [, hashId] = useStyle$Q(prefixCls);
useWave(computed(() => classNames(prefixCls.value, hashId.value)), wave);
return () => {
var _a;
const children = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)[0];
return children;
};
}
});
function convertLegacyProps(type) {
if (type === "danger") {
return {
danger: true
};
}
return {
type
};
}
const buttonProps = () => ({
prefixCls: String,
type: String,
htmlType: {
type: String,
default: "button"
},
shape: {
type: String
},
size: {
type: String
},
loading: {
type: [Boolean, Object],
default: () => false
},
disabled: {
type: Boolean,
default: void 0
},
ghost: {
type: Boolean,
default: void 0
},
block: {
type: Boolean,
default: void 0
},
danger: {
type: Boolean,
default: void 0
},
icon: PropTypes.any,
href: String,
target: String,
title: String,
onClick: eventType(),
onMousedown: eventType()
});
const getCollapsedWidth = (node) => {
if (node) {
node.style.width = "0px";
node.style.opacity = "0";
node.style.transform = "scale(0)";
}
};
const getRealWidth = (node) => {
nextTick(() => {
if (node) {
node.style.width = `${node.scrollWidth}px`;
node.style.opacity = "1";
node.style.transform = "scale(1)";
}
});
};
const resetStyle = (node) => {
if (node && node.style) {
node.style.width = null;
node.style.opacity = null;
node.style.transform = null;
}
};
const LoadingIcon = defineComponent({
compatConfig: {
MODE: 3
},
name: "LoadingIcon",
props: {
prefixCls: String,
loading: [Boolean, Object],
existIcon: Boolean
},
setup(props2) {
return () => {
const {
existIcon,
prefixCls,
loading: loading2
} = props2;
if (existIcon) {
return createVNode("span", {
"class": `${prefixCls}-loading-icon`
}, [createVNode(LoadingOutlined, null, null)]);
}
const visible = !!loading2;
return createVNode(Transition, {
"name": `${prefixCls}-loading-icon-motion`,
"onBeforeEnter": getCollapsedWidth,
"onEnter": getRealWidth,
"onAfterEnter": resetStyle,
"onBeforeLeave": getRealWidth,
"onLeave": (node) => {
setTimeout(() => {
getCollapsedWidth(node);
});
},
"onAfterLeave": resetStyle
}, {
default: () => [visible ? createVNode("span", {
"class": `${prefixCls}-loading-icon`
}, [createVNode(LoadingOutlined, null, null)]) : null]
});
};
}
});
const genButtonBorderStyle = (buttonTypeCls, borderColor) => ({
// Border
[`> span, > ${buttonTypeCls}`]: {
"&:not(:last-child)": {
[`&, & > ${buttonTypeCls}`]: {
"&:not(:disabled)": {
borderInlineEndColor: borderColor
}
}
},
"&:not(:first-child)": {
[`&, & > ${buttonTypeCls}`]: {
"&:not(:disabled)": {
borderInlineStartColor: borderColor
}
}
}
}
});
const genGroupStyle$1 = (token) => {
const {
componentCls,
fontSize,
lineWidth,
colorPrimaryHover,
colorErrorHover
} = token;
return {
[`${componentCls}-group`]: [
{
position: "relative",
display: "inline-flex",
// Border
[`> span, > ${componentCls}`]: {
"&:not(:last-child)": {
[`&, & > ${componentCls}`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
"&:not(:first-child)": {
marginInlineStart: -lineWidth,
[`&, & > ${componentCls}`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
}
},
[componentCls]: {
position: "relative",
zIndex: 1,
[`&:hover,
&:focus,
&:active`]: {
zIndex: 2
},
"&[disabled]": {
zIndex: 0
}
},
[`${componentCls}-icon-only`]: {
fontSize
}
},
// Border Color
genButtonBorderStyle(`${componentCls}-primary`, colorPrimaryHover),
genButtonBorderStyle(`${componentCls}-danger`, colorErrorHover)
]
};
};
function compactItemVerticalBorder(token, parentCls) {
return {
// border collapse
[`&-item:not(${parentCls}-last-item)`]: {
marginBottom: -token.lineWidth
},
"&-item": {
"&:hover,&:focus,&:active": {
zIndex: 2
},
"&[disabled]": {
zIndex: 0
}
}
};
}
function compactItemBorderVerticalRadius(prefixCls, parentCls) {
return {
[`&-item:not(${parentCls}-first-item):not(${parentCls}-last-item)`]: {
borderRadius: 0
},
[`&-item${parentCls}-first-item:not(${parentCls}-last-item)`]: {
[`&, &${prefixCls}-sm, &${prefixCls}-lg`]: {
borderEndEndRadius: 0,
borderEndStartRadius: 0
}
},
[`&-item${parentCls}-last-item:not(${parentCls}-first-item)`]: {
[`&, &${prefixCls}-sm, &${prefixCls}-lg`]: {
borderStartStartRadius: 0,
borderStartEndRadius: 0
}
}
};
}
function genCompactItemVerticalStyle(token) {
const compactCls = `${token.componentCls}-compact-vertical`;
return {
[compactCls]: _extends(_extends({}, compactItemVerticalBorder(token, compactCls)), compactItemBorderVerticalRadius(token.componentCls, compactCls))
};
}
const genSharedButtonStyle = (token) => {
const {
componentCls,
iconCls
} = token;
return {
[componentCls]: {
outline: "none",
position: "relative",
display: "inline-block",
fontWeight: 400,
whiteSpace: "nowrap",
textAlign: "center",
backgroundImage: "none",
backgroundColor: "transparent",
border: `${token.lineWidth}px ${token.lineType} transparent`,
cursor: "pointer",
transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,
userSelect: "none",
touchAction: "manipulation",
lineHeight: token.lineHeight,
color: token.colorText,
"> span": {
display: "inline-block"
},
// Leave a space between icon and text.
[`> ${iconCls} + span, > span + ${iconCls}`]: {
marginInlineStart: token.marginXS
},
"> a": {
color: "currentColor"
},
"&:not(:disabled)": _extends({}, genFocusStyle(token)),
// make `btn-icon-only` not too narrow
[`&-icon-only${componentCls}-compact-item`]: {
flex: "none"
},
// Special styles for Primary Button
[`&-compact-item${componentCls}-primary`]: {
[`&:not([disabled]) + ${componentCls}-compact-item${componentCls}-primary:not([disabled])`]: {
position: "relative",
"&:before": {
position: "absolute",
top: -token.lineWidth,
insetInlineStart: -token.lineWidth,
display: "inline-block",
width: token.lineWidth,
height: `calc(100% + ${token.lineWidth * 2}px)`,
backgroundColor: token.colorPrimaryHover,
content: '""'
}
}
},
// Special styles for Primary Button
"&-compact-vertical-item": {
[`&${componentCls}-primary`]: {
[`&:not([disabled]) + ${componentCls}-compact-vertical-item${componentCls}-primary:not([disabled])`]: {
position: "relative",
"&:before": {
position: "absolute",
top: -token.lineWidth,
insetInlineStart: -token.lineWidth,
display: "inline-block",
width: `calc(100% + ${token.lineWidth * 2}px)`,
height: token.lineWidth,
backgroundColor: token.colorPrimaryHover,
content: '""'
}
}
}
}
}
};
};
const genHoverActiveButtonStyle = (hoverStyle, activeStyle) => ({
"&:not(:disabled)": {
"&:hover": hoverStyle,
"&:active": activeStyle
}
});
const genCircleButtonStyle = (token) => ({
minWidth: token.controlHeight,
paddingInlineStart: 0,
paddingInlineEnd: 0,
borderRadius: "50%"
});
const genRoundButtonStyle = (token) => ({
borderRadius: token.controlHeight,
paddingInlineStart: token.controlHeight / 2,
paddingInlineEnd: token.controlHeight / 2
});
const genDisabledStyle$1 = (token) => ({
cursor: "not-allowed",
borderColor: token.colorBorder,
color: token.colorTextDisabled,
backgroundColor: token.colorBgContainerDisabled,
boxShadow: "none"
});
const genGhostButtonStyle = (btnCls, textColor, borderColor, textColorDisabled, borderColorDisabled, hoverStyle, activeStyle) => ({
[`&${btnCls}-background-ghost`]: _extends(_extends({
color: textColor || void 0,
backgroundColor: "transparent",
borderColor: borderColor || void 0,
boxShadow: "none"
}, genHoverActiveButtonStyle(_extends({
backgroundColor: "transparent"
}, hoverStyle), _extends({
backgroundColor: "transparent"
}, activeStyle))), {
"&:disabled": {
cursor: "not-allowed",
color: textColorDisabled || void 0,
borderColor: borderColorDisabled || void 0
}
})
});
const genSolidDisabledButtonStyle = (token) => ({
"&:disabled": _extends({}, genDisabledStyle$1(token))
});
const genSolidButtonStyle = (token) => _extends({}, genSolidDisabledButtonStyle(token));
const genPureDisabledButtonStyle = (token) => ({
"&:disabled": {
cursor: "not-allowed",
color: token.colorTextDisabled
}
});
const genDefaultButtonStyle = (token) => _extends(_extends(_extends(_extends(_extends({}, genSolidButtonStyle(token)), {
backgroundColor: token.colorBgContainer,
borderColor: token.colorBorder,
boxShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlTmpOutline}`
}), genHoverActiveButtonStyle({
color: token.colorPrimaryHover,
borderColor: token.colorPrimaryHover
}, {
color: token.colorPrimaryActive,
borderColor: token.colorPrimaryActive
})), genGhostButtonStyle(token.componentCls, token.colorBgContainer, token.colorBgContainer, token.colorTextDisabled, token.colorBorder)), {
[`&${token.componentCls}-dangerous`]: _extends(_extends(_extends({
color: token.colorError,
borderColor: token.colorError
}, genHoverActiveButtonStyle({
color: token.colorErrorHover,
borderColor: token.colorErrorBorderHover
}, {
color: token.colorErrorActive,
borderColor: token.colorErrorActive
})), genGhostButtonStyle(token.componentCls, token.colorError, token.colorError, token.colorTextDisabled, token.colorBorder)), genSolidDisabledButtonStyle(token))
});
const genPrimaryButtonStyle = (token) => _extends(_extends(_extends(_extends(_extends({}, genSolidButtonStyle(token)), {
color: token.colorTextLightSolid,
backgroundColor: token.colorPrimary,
boxShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlOutline}`
}), genHoverActiveButtonStyle({
color: token.colorTextLightSolid,
backgroundColor: token.colorPrimaryHover
}, {
color: token.colorTextLightSolid,
backgroundColor: token.colorPrimaryActive
})), genGhostButtonStyle(token.componentCls, token.colorPrimary, token.colorPrimary, token.colorTextDisabled, token.colorBorder, {
color: token.colorPrimaryHover,
borderColor: token.colorPrimaryHover
}, {
color: token.colorPrimaryActive,
borderColor: token.colorPrimaryActive
})), {
[`&${token.componentCls}-dangerous`]: _extends(_extends(_extends({
backgroundColor: token.colorError,
boxShadow: `0 ${token.controlOutlineWidth}px 0 ${token.colorErrorOutline}`
}, genHoverActiveButtonStyle({
backgroundColor: token.colorErrorHover
}, {
backgroundColor: token.colorErrorActive
})), genGhostButtonStyle(token.componentCls, token.colorError, token.colorError, token.colorTextDisabled, token.colorBorder, {
color: token.colorErrorHover,
borderColor: token.colorErrorHover
}, {
color: token.colorErrorActive,
borderColor: token.colorErrorActive
})), genSolidDisabledButtonStyle(token))
});
const genDashedButtonStyle = (token) => _extends(_extends({}, genDefaultButtonStyle(token)), {
borderStyle: "dashed"
});
const genLinkButtonStyle = (token) => _extends(_extends(_extends({
color: token.colorLink
}, genHoverActiveButtonStyle({
color: token.colorLinkHover
}, {
color: token.colorLinkActive
})), genPureDisabledButtonStyle(token)), {
[`&${token.componentCls}-dangerous`]: _extends(_extends({
color: token.colorError
}, genHoverActiveButtonStyle({
color: token.colorErrorHover
}, {
color: token.colorErrorActive
})), genPureDisabledButtonStyle(token))
});
const genTextButtonStyle = (token) => _extends(_extends(_extends({}, genHoverActiveButtonStyle({
color: token.colorText,
backgroundColor: token.colorBgTextHover
}, {
color: token.colorText,
backgroundColor: token.colorBgTextActive
})), genPureDisabledButtonStyle(token)), {
[`&${token.componentCls}-dangerous`]: _extends(_extends({
color: token.colorError
}, genPureDisabledButtonStyle(token)), genHoverActiveButtonStyle({
color: token.colorErrorHover,
backgroundColor: token.colorErrorBg
}, {
color: token.colorErrorHover,
backgroundColor: token.colorErrorBg
}))
});
const genDisabledButtonStyle = (token) => _extends(_extends({}, genDisabledStyle$1(token)), {
[`&${token.componentCls}:hover`]: _extends({}, genDisabledStyle$1(token))
});
const genTypeButtonStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-default`]: genDefaultButtonStyle(token),
[`${componentCls}-primary`]: genPrimaryButtonStyle(token),
[`${componentCls}-dashed`]: genDashedButtonStyle(token),
[`${componentCls}-link`]: genLinkButtonStyle(token),
[`${componentCls}-text`]: genTextButtonStyle(token),
[`${componentCls}-disabled`]: genDisabledButtonStyle(token)
};
};
const genSizeButtonStyle = function(token) {
let sizePrefixCls = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
const {
componentCls,
iconCls,
controlHeight,
fontSize,
lineHeight,
lineWidth,
borderRadius,
buttonPaddingHorizontal
} = token;
const paddingVertical = Math.max(0, (controlHeight - fontSize * lineHeight) / 2 - lineWidth);
const paddingHorizontal = buttonPaddingHorizontal - lineWidth;
const iconOnlyCls = `${componentCls}-icon-only`;
return [
// Size
{
[`${componentCls}${sizePrefixCls}`]: {
fontSize,
height: controlHeight,
padding: `${paddingVertical}px ${paddingHorizontal}px`,
borderRadius,
[`&${iconOnlyCls}`]: {
width: controlHeight,
paddingInlineStart: 0,
paddingInlineEnd: 0,
[`&${componentCls}-round`]: {
width: "auto"
},
"> span": {
transform: "scale(1.143)"
// 14px -> 16px
}
},
// Loading
[`&${componentCls}-loading`]: {
opacity: token.opacityLoading,
cursor: "default"
},
[`${componentCls}-loading-icon`]: {
transition: `width ${token.motionDurationSlow} ${token.motionEaseInOut}, opacity ${token.motionDurationSlow} ${token.motionEaseInOut}`
},
[`&:not(${iconOnlyCls}) ${componentCls}-loading-icon > ${iconCls}`]: {
marginInlineEnd: token.marginXS
}
}
},
// Shape - patch prefixCls again to override solid border radius style
{
[`${componentCls}${componentCls}-circle${sizePrefixCls}`]: genCircleButtonStyle(token)
},
{
[`${componentCls}${componentCls}-round${sizePrefixCls}`]: genRoundButtonStyle(token)
}
];
};
const genSizeBaseButtonStyle = (token) => genSizeButtonStyle(token);
const genSizeSmallButtonStyle = (token) => {
const smallToken = merge(token, {
controlHeight: token.controlHeightSM,
padding: token.paddingXS,
buttonPaddingHorizontal: 8,
borderRadius: token.borderRadiusSM
});
return genSizeButtonStyle(smallToken, `${token.componentCls}-sm`);
};
const genSizeLargeButtonStyle = (token) => {
const largeToken = merge(token, {
controlHeight: token.controlHeightLG,
fontSize: token.fontSizeLG,
borderRadius: token.borderRadiusLG
});
return genSizeButtonStyle(largeToken, `${token.componentCls}-lg`);
};
const genBlockButtonStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: {
[`&${componentCls}-block`]: {
width: "100%"
}
}
};
};
const useStyle$P = genComponentStyleHook("Button", (token) => {
const {
controlTmpOutline,
paddingContentHorizontal
} = token;
const buttonToken = merge(token, {
colorOutlineDefault: controlTmpOutline,
buttonPaddingHorizontal: paddingContentHorizontal
});
return [
// Shared
genSharedButtonStyle(buttonToken),
// Size
genSizeSmallButtonStyle(buttonToken),
genSizeBaseButtonStyle(buttonToken),
genSizeLargeButtonStyle(buttonToken),
// Block
genBlockButtonStyle(buttonToken),
// Group (type, ghost, danger, disabled, loading)
genTypeButtonStyle(buttonToken),
// Button Group
genGroupStyle$1(buttonToken),
// Space Compact
genCompactItemStyle(token, {
focus: false
}),
genCompactItemVerticalStyle(token)
];
});
const buttonGroupProps = () => ({
prefixCls: String,
size: {
type: String
}
});
const GroupSizeContext = createContext();
const ButtonGroup$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AButtonGroup",
props: buttonGroupProps(),
setup(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("btn-group", props2);
const [, , hashId] = useToken();
GroupSizeContext.useProvide(reactive({
size: computed(() => props2.size)
}));
const classes = computed(() => {
const {
size
} = props2;
let sizeCls = "";
switch (size) {
case "large":
sizeCls = "lg";
break;
case "small":
sizeCls = "sm";
break;
case "middle":
case void 0:
break;
default:
devWarning(!size, "Button.Group", "Invalid prop `size`.");
}
return {
[`${prefixCls.value}`]: true,
[`${prefixCls.value}-${sizeCls}`]: sizeCls,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[hashId.value]: true
};
});
return () => {
var _a;
return createVNode("div", {
"class": classes.value
}, [flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))]);
};
}
});
const rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
const isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
function isUnBorderedButtonType(type) {
return type === "text" || type === "link";
}
const Button = defineComponent({
compatConfig: {
MODE: 3
},
name: "AButton",
inheritAttrs: false,
__ANT_BUTTON: true,
props: initDefaultProps(buttonProps(), {
type: "default"
}),
slots: Object,
// emits: ['click', 'mousedown'],
setup(props2, _ref) {
let {
slots,
attrs,
emit,
expose
} = _ref;
const {
prefixCls,
autoInsertSpaceInButton,
direction,
size
} = useConfigInject("btn", props2);
const [wrapSSR, hashId] = useStyle$P(prefixCls);
const groupSizeContext = GroupSizeContext.useInject();
const disabledContext = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a;
return (_a = props2.disabled) !== null && _a !== void 0 ? _a : disabledContext.value;
});
const buttonNodeRef = shallowRef(null);
const delayTimeoutRef = shallowRef(void 0);
let isNeedInserted = false;
const innerLoading = shallowRef(false);
const hasTwoCNChar = shallowRef(false);
const autoInsertSpace = computed(() => autoInsertSpaceInButton.value !== false);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const loadingOrDelay = computed(() => typeof props2.loading === "object" && props2.loading.delay ? props2.loading.delay || true : !!props2.loading);
watch(loadingOrDelay, (val) => {
clearTimeout(delayTimeoutRef.value);
if (typeof loadingOrDelay.value === "number") {
delayTimeoutRef.value = setTimeout(() => {
innerLoading.value = val;
}, loadingOrDelay.value);
} else {
innerLoading.value = val;
}
}, {
immediate: true
});
const classes = computed(() => {
const {
type,
shape = "default",
ghost,
block,
danger
} = props2;
const pre = prefixCls.value;
const sizeClassNameMap = {
large: "lg",
small: "sm",
middle: void 0
};
const sizeFullname = compactSize.value || (groupSizeContext === null || groupSizeContext === void 0 ? void 0 : groupSizeContext.size) || size.value;
const sizeCls = sizeFullname ? sizeClassNameMap[sizeFullname] || "" : "";
return [compactItemClassnames.value, {
[hashId.value]: true,
[`${pre}`]: true,
[`${pre}-${shape}`]: shape !== "default" && shape,
[`${pre}-${type}`]: type,
[`${pre}-${sizeCls}`]: sizeCls,
[`${pre}-loading`]: innerLoading.value,
[`${pre}-background-ghost`]: ghost && !isUnBorderedButtonType(type),
[`${pre}-two-chinese-chars`]: hasTwoCNChar.value && autoInsertSpace.value,
[`${pre}-block`]: block,
[`${pre}-dangerous`]: !!danger,
[`${pre}-rtl`]: direction.value === "rtl"
}];
});
const handleClick = (event) => {
if (innerLoading.value || mergedDisabled.value) {
event.preventDefault();
return;
}
emit("click", event);
};
const handleMousedown = (event) => {
emit("mousedown", event);
};
const insertSpace = (child, needInserted) => {
const SPACE = needInserted ? " " : "";
if (child.type === Text$1) {
let text = child.children.trim();
if (isTwoCNChar(text)) {
text = text.split("").join(SPACE);
}
return createVNode("span", null, [text]);
}
return child;
};
watchEffect(() => {
devWarning(!(props2.ghost && isUnBorderedButtonType(props2.type)), "Button", "`link` or `text` button can't be a `ghost` button.");
});
const focus = () => {
var _a;
(_a = buttonNodeRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = buttonNodeRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
expose({
focus,
blur
});
return () => {
var _a, _b;
const {
icon = (_a = slots.icon) === null || _a === void 0 ? void 0 : _a.call(slots)
} = props2;
const children = flattenChildren((_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots));
isNeedInserted = children.length === 1 && !icon && !isUnBorderedButtonType(props2.type);
const {
type,
htmlType,
href,
title,
target
} = props2;
const iconType = innerLoading.value ? "loading" : icon;
const buttonProps2 = _extends(_extends({}, attrs), {
title,
disabled: mergedDisabled.value,
class: [classes.value, attrs.class, {
[`${prefixCls.value}-icon-only`]: children.length === 0 && !!iconType
}],
onClick: handleClick,
onMousedown: handleMousedown
});
if (!mergedDisabled.value) {
delete buttonProps2.disabled;
}
const iconNode = icon && !innerLoading.value ? icon : createVNode(LoadingIcon, {
"existIcon": !!icon,
"prefixCls": prefixCls.value,
"loading": !!innerLoading.value
}, null);
const kids = children.map((child) => insertSpace(child, isNeedInserted && autoInsertSpace.value));
if (href !== void 0) {
return wrapSSR(createVNode("a", _objectSpread$W(_objectSpread$W({}, buttonProps2), {}, {
"href": href,
"target": target,
"ref": buttonNodeRef
}), [iconNode, kids]));
}
let buttonNode = createVNode("button", _objectSpread$W(_objectSpread$W({}, buttonProps2), {}, {
"ref": buttonNodeRef,
"type": htmlType
}), [iconNode, kids]);
if (!isUnBorderedButtonType(type)) {
const _buttonNode = /* @__PURE__ */ (function() {
return buttonNode;
})();
buttonNode = createVNode(Wave, {
"ref": "wave",
"disabled": !!innerLoading.value
}, {
default: () => [_buttonNode]
});
}
return wrapSSR(buttonNode);
};
}
});
Button.Group = ButtonGroup$1;
Button.install = function(app) {
app.component(Button.name, Button);
app.component(ButtonGroup$1.name, ButtonGroup$1);
return app;
};
const dropdownProps = () => ({
arrow: someType([Boolean, Object]),
trigger: {
type: [Array, String]
},
menu: objectType(),
overlay: PropTypes.any,
/** @deprecated Please use `open` instead */
visible: booleanType(),
open: booleanType(),
disabled: booleanType(),
danger: booleanType(),
autofocus: booleanType(),
align: objectType(),
getPopupContainer: Function,
prefixCls: String,
transitionName: String,
placement: String,
overlayClassName: String,
overlayStyle: objectType(),
forceRender: booleanType(),
mouseEnterDelay: Number,
mouseLeaveDelay: Number,
openClassName: String,
minOverlayWidthMatchTrigger: booleanType(),
destroyPopupOnHide: booleanType(),
/** @deprecated Please use `onOpenChange` instead */
onVisibleChange: {
type: Function
},
/** @deprecated Please use `onUpdate:open` instead */
"onUpdate:visible": {
type: Function
},
onOpenChange: {
type: Function
},
"onUpdate:open": {
type: Function
}
});
const buttonTypesProps = buttonProps();
const dropdownButtonProps = () => _extends(_extends({}, dropdownProps()), {
type: buttonTypesProps.type,
size: String,
htmlType: buttonTypesProps.htmlType,
href: String,
disabled: booleanType(),
prefixCls: String,
icon: PropTypes.any,
title: String,
loading: buttonTypesProps.loading,
onClick: eventType()
});
const genButtonStyle = (token) => {
const {
componentCls,
antCls,
paddingXS,
opacityLoading
} = token;
return {
[`${componentCls}-button`]: {
whiteSpace: "nowrap",
[`&${antCls}-btn-group > ${antCls}-btn`]: {
[`&-loading, &-loading + ${antCls}-btn`]: {
cursor: "default",
pointerEvents: "none",
opacity: opacityLoading
},
[`&:last-child:not(:first-child):not(${antCls}-btn-icon-only)`]: {
paddingInline: paddingXS
}
}
}
};
};
const genStatusStyle$1 = (token) => {
const {
componentCls,
menuCls,
colorError,
colorTextLightSolid
} = token;
const itemCls = `${menuCls}-item`;
return {
[`${componentCls}, ${componentCls}-menu-submenu`]: {
[`${menuCls} ${itemCls}`]: {
[`&${itemCls}-danger:not(${itemCls}-disabled)`]: {
color: colorError,
"&:hover": {
color: colorTextLightSolid,
backgroundColor: colorError
}
}
}
}
};
};
const genBaseStyle$f = (token) => {
const {
componentCls,
menuCls,
zIndexPopup,
dropdownArrowDistance,
dropdownArrowOffset,
sizePopupArrow,
antCls,
iconCls,
motionDurationMid,
dropdownPaddingVertical,
fontSize,
dropdownEdgeChildPadding,
colorTextDisabled,
fontSizeIcon,
controlPaddingHorizontal,
colorBgElevated,
boxShadowPopoverArrow
} = token;
return [
{
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "absolute",
top: -9999,
left: {
_skip_check_: true,
value: -9999
},
zIndex: zIndexPopup,
display: "block",
// A placeholder out of dropdown visible range to avoid close when user moving
"&::before": {
position: "absolute",
insetBlock: -dropdownArrowDistance + sizePopupArrow / 2,
// insetInlineStart: -7, // FIXME: Seems not work for hidden element
zIndex: -9999,
opacity: 1e-4,
content: '""'
},
[`${componentCls}-wrap`]: {
position: "relative",
[`${antCls}-btn > ${iconCls}-down`]: {
fontSize: fontSizeIcon
},
[`${iconCls}-down::before`]: {
transition: `transform ${motionDurationMid}`
}
},
[`${componentCls}-wrap-open`]: {
[`${iconCls}-down::before`]: {
transform: `rotate(180deg)`
}
},
[`
&-hidden,
&-menu-hidden,
&-menu-submenu-hidden
`]: {
display: "none"
},
// =============================================================
// == Arrow ==
// =============================================================
// Offset the popover to account for the dropdown arrow
[`
&-show-arrow${componentCls}-placement-topLeft,
&-show-arrow${componentCls}-placement-top,
&-show-arrow${componentCls}-placement-topRight
`]: {
paddingBottom: dropdownArrowDistance
},
[`
&-show-arrow${componentCls}-placement-bottomLeft,
&-show-arrow${componentCls}-placement-bottom,
&-show-arrow${componentCls}-placement-bottomRight
`]: {
paddingTop: dropdownArrowDistance
},
// Note: .popover-arrow is outer, .popover-arrow:after is inner
[`${componentCls}-arrow`]: _extends({
position: "absolute",
zIndex: 1,
display: "block"
}, roundedArrow(sizePopupArrow, token.borderRadiusXS, token.borderRadiusOuter, colorBgElevated, boxShadowPopoverArrow)),
[`
&-placement-top > ${componentCls}-arrow,
&-placement-topLeft > ${componentCls}-arrow,
&-placement-topRight > ${componentCls}-arrow
`]: {
bottom: dropdownArrowDistance,
transform: "translateY(100%) rotate(180deg)"
},
[`&-placement-top > ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: "50%"
},
transform: "translateX(-50%) translateY(100%) rotate(180deg)"
},
[`&-placement-topLeft > ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
[`&-placement-topRight > ${componentCls}-arrow`]: {
right: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
[`
&-placement-bottom > ${componentCls}-arrow,
&-placement-bottomLeft > ${componentCls}-arrow,
&-placement-bottomRight > ${componentCls}-arrow
`]: {
top: dropdownArrowDistance,
transform: `translateY(-100%)`
},
[`&-placement-bottom > ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: "50%"
},
transform: `translateY(-100%) translateX(-50%)`
},
[`&-placement-bottomLeft > ${componentCls}-arrow`]: {
left: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
[`&-placement-bottomRight > ${componentCls}-arrow`]: {
right: {
_skip_check_: true,
value: dropdownArrowOffset
}
},
// =============================================================
// == Motion ==
// =============================================================
// When position is not enough for dropdown, the placement will revert.
// We will handle this with revert motion name.
[`&${antCls}-slide-down-enter${antCls}-slide-down-enter-active${componentCls}-placement-bottomLeft,
&${antCls}-slide-down-appear${antCls}-slide-down-appear-active${componentCls}-placement-bottomLeft,
&${antCls}-slide-down-enter${antCls}-slide-down-enter-active${componentCls}-placement-bottom,
&${antCls}-slide-down-appear${antCls}-slide-down-appear-active${componentCls}-placement-bottom,
&${antCls}-slide-down-enter${antCls}-slide-down-enter-active${componentCls}-placement-bottomRight,
&${antCls}-slide-down-appear${antCls}-slide-down-appear-active${componentCls}-placement-bottomRight`]: {
animationName: slideUpIn
},
[`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-placement-topLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-placement-topLeft,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-placement-top,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-placement-top,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-placement-topRight,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-placement-topRight`]: {
animationName: slideDownIn
},
[`&${antCls}-slide-down-leave${antCls}-slide-down-leave-active${componentCls}-placement-bottomLeft,
&${antCls}-slide-down-leave${antCls}-slide-down-leave-active${componentCls}-placement-bottom,
&${antCls}-slide-down-leave${antCls}-slide-down-leave-active${componentCls}-placement-bottomRight`]: {
animationName: slideUpOut
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-placement-topLeft,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-placement-top,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-placement-topRight`]: {
animationName: slideDownOut
}
})
},
{
// =============================================================
// == Menu ==
// =============================================================
[`${componentCls} ${menuCls}`]: {
position: "relative",
margin: 0
},
[`${menuCls}-submenu-popup`]: {
position: "absolute",
zIndex: zIndexPopup,
background: "transparent",
boxShadow: "none",
transformOrigin: "0 0",
"ul,li": {
listStyle: "none"
},
ul: {
marginInline: "0.3em"
}
},
[`${componentCls}, ${componentCls}-menu-submenu`]: {
[menuCls]: _extends(_extends({
padding: dropdownEdgeChildPadding,
listStyleType: "none",
backgroundColor: colorBgElevated,
backgroundClip: "padding-box",
borderRadius: token.borderRadiusLG,
outline: "none",
boxShadow: token.boxShadowSecondary
}, genFocusStyle(token)), {
[`${menuCls}-item-group-title`]: {
padding: `${dropdownPaddingVertical}px ${controlPaddingHorizontal}px`,
color: token.colorTextDescription,
transition: `all ${motionDurationMid}`
},
// ======================= Item Content =======================
[`${menuCls}-item`]: {
position: "relative",
display: "flex",
alignItems: "center",
borderRadius: token.borderRadiusSM
},
[`${menuCls}-item-icon`]: {
minWidth: fontSize,
marginInlineEnd: token.marginXS,
fontSize: token.fontSizeSM
},
[`${menuCls}-title-content`]: {
flex: "auto",
"> a": {
color: "inherit",
transition: `all ${motionDurationMid}`,
"&:hover": {
color: "inherit"
},
"&::after": {
position: "absolute",
inset: 0,
content: '""'
}
}
},
// =========================== Item ===========================
[`${menuCls}-item, ${menuCls}-submenu-title`]: _extends(_extends({
clear: "both",
margin: 0,
padding: `${dropdownPaddingVertical}px ${controlPaddingHorizontal}px`,
color: token.colorText,
fontWeight: "normal",
fontSize,
lineHeight: token.lineHeight,
cursor: "pointer",
transition: `all ${motionDurationMid}`,
[`&:hover, &-active`]: {
backgroundColor: token.controlItemBgHover
}
}, genFocusStyle(token)), {
"&-selected": {
color: token.colorPrimary,
backgroundColor: token.controlItemBgActive,
"&:hover, &-active": {
backgroundColor: token.controlItemBgActiveHover
}
},
"&-disabled": {
color: colorTextDisabled,
cursor: "not-allowed",
"&:hover": {
color: colorTextDisabled,
backgroundColor: colorBgElevated,
cursor: "not-allowed"
},
a: {
pointerEvents: "none"
}
},
"&-divider": {
height: 1,
margin: `${token.marginXXS}px 0`,
overflow: "hidden",
lineHeight: 0,
backgroundColor: token.colorSplit
},
[`${componentCls}-menu-submenu-expand-icon`]: {
position: "absolute",
insetInlineEnd: token.paddingXS,
[`${componentCls}-menu-submenu-arrow-icon`]: {
marginInlineEnd: "0 !important",
color: token.colorTextDescription,
fontSize: fontSizeIcon,
fontStyle: "normal"
}
}
}),
[`${menuCls}-item-group-list`]: {
margin: `0 ${token.marginXS}px`,
padding: 0,
listStyle: "none"
},
[`${menuCls}-submenu-title`]: {
paddingInlineEnd: controlPaddingHorizontal + token.fontSizeSM
},
[`${menuCls}-submenu-vertical`]: {
position: "relative"
},
[`${menuCls}-submenu${menuCls}-submenu-disabled ${componentCls}-menu-submenu-title`]: {
[`&, ${componentCls}-menu-submenu-arrow-icon`]: {
color: colorTextDisabled,
backgroundColor: colorBgElevated,
cursor: "not-allowed"
}
},
// https://github.com/ant-design/ant-design/issues/19264
[`${menuCls}-submenu-selected ${componentCls}-menu-submenu-title`]: {
color: token.colorPrimary
}
})
}
},
// Follow code may reuse in other components
[initSlideMotion(token, "slide-up"), initSlideMotion(token, "slide-down"), initMoveMotion(token, "move-up"), initMoveMotion(token, "move-down"), initZoomMotion(token, "zoom-big")]
];
};
const useStyle$O = genComponentStyleHook("Dropdown", (token, _ref) => {
let {
rootPrefixCls
} = _ref;
const {
marginXXS,
sizePopupArrow,
controlHeight,
fontSize,
lineHeight,
paddingXXS,
componentCls,
borderRadiusOuter,
borderRadiusLG
} = token;
const dropdownPaddingVertical = (controlHeight - fontSize * lineHeight) / 2;
const {
dropdownArrowOffset
} = getArrowOffset({
sizePopupArrow,
contentRadius: borderRadiusLG,
borderRadiusOuter
});
const dropdownToken = merge(token, {
menuCls: `${componentCls}-menu`,
rootPrefixCls,
dropdownArrowDistance: sizePopupArrow / 2 + marginXXS,
dropdownArrowOffset,
dropdownPaddingVertical,
dropdownEdgeChildPadding: paddingXXS
});
return [genBaseStyle$f(dropdownToken), genButtonStyle(dropdownToken), genStatusStyle$1(dropdownToken)];
}, (token) => ({
zIndexPopup: token.zIndexPopupBase + 50
}));
var __rest$11 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const ButtonGroup = Button.Group;
const DropdownButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADropdownButton",
inheritAttrs: false,
__ANT_BUTTON: true,
props: initDefaultProps(dropdownButtonProps(), {
trigger: "hover",
placement: "bottomRight",
type: "default"
}),
// emits: ['click', 'visibleChange', 'update:visible'],s
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs,
emit
} = _ref;
const handleVisibleChange = (val) => {
emit("update:visible", val);
emit("visibleChange", val);
emit("update:open", val);
emit("openChange", val);
};
const {
prefixCls,
direction,
getPopupContainer
} = useConfigInject("dropdown", props2);
const buttonPrefixCls = computed(() => `${prefixCls.value}-button`);
const [wrapSSR, hashId] = useStyle$O(prefixCls);
return () => {
var _a, _b;
const _c = _extends(_extends({}, props2), attrs), {
type = "default",
disabled,
danger,
loading: loading2,
htmlType,
class: className = "",
overlay = (_a = slots.overlay) === null || _a === void 0 ? void 0 : _a.call(slots),
trigger,
align,
open: open2,
visible,
onVisibleChange: _onVisibleChange,
placement = direction.value === "rtl" ? "bottomLeft" : "bottomRight",
href,
title,
icon = ((_b = slots.icon) === null || _b === void 0 ? void 0 : _b.call(slots)) || createVNode(EllipsisOutlined, null, null),
mouseEnterDelay,
mouseLeaveDelay,
overlayClassName,
overlayStyle,
destroyPopupOnHide,
onClick,
"onUpdate:open": _updateVisible
} = _c, restProps = __rest$11(_c, ["type", "disabled", "danger", "loading", "htmlType", "class", "overlay", "trigger", "align", "open", "visible", "onVisibleChange", "placement", "href", "title", "icon", "mouseEnterDelay", "mouseLeaveDelay", "overlayClassName", "overlayStyle", "destroyPopupOnHide", "onClick", "onUpdate:open"]);
const dropdownProps2 = {
align,
disabled,
trigger: disabled ? [] : trigger,
placement,
getPopupContainer: getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value,
onOpenChange: handleVisibleChange,
mouseEnterDelay,
mouseLeaveDelay,
open: open2 !== null && open2 !== void 0 ? open2 : visible,
overlayClassName,
overlayStyle,
destroyPopupOnHide
};
const leftButton = createVNode(Button, {
"danger": danger,
"type": type,
"disabled": disabled,
"loading": loading2,
"onClick": onClick,
"htmlType": htmlType,
"href": href,
"title": title
}, {
default: slots.default
});
const rightButton = createVNode(Button, {
"danger": danger,
"type": type,
"icon": icon
}, null);
return wrapSSR(createVNode(ButtonGroup, _objectSpread$W(_objectSpread$W({}, restProps), {}, {
"class": classNames(buttonPrefixCls.value, className, hashId.value)
}), {
default: () => [slots.leftButton ? slots.leftButton({
button: leftButton
}) : leftButton, createVNode(Dropdown, dropdownProps2, {
default: () => [slots.rightButton ? slots.rightButton({
button: rightButton
}) : rightButton],
overlay: () => overlay
})]
}));
};
}
});
const OverrideContextKey = Symbol("OverrideContextKey");
const useInjectOverride = () => {
return inject(OverrideContextKey, void 0);
};
const useProvideOverride = (props2) => {
var _a, _b, _c;
const {
prefixCls,
mode,
selectable,
validator,
onClick,
expandIcon
} = useInjectOverride() || {};
provide(OverrideContextKey, {
prefixCls: computed(() => {
var _a2, _b2;
return (_b2 = (_a2 = props2.prefixCls) === null || _a2 === void 0 ? void 0 : _a2.value) !== null && _b2 !== void 0 ? _b2 : prefixCls === null || prefixCls === void 0 ? void 0 : prefixCls.value;
}),
mode: computed(() => {
var _a2, _b2;
return (_b2 = (_a2 = props2.mode) === null || _a2 === void 0 ? void 0 : _a2.value) !== null && _b2 !== void 0 ? _b2 : mode === null || mode === void 0 ? void 0 : mode.value;
}),
selectable: computed(() => {
var _a2, _b2;
return (_b2 = (_a2 = props2.selectable) === null || _a2 === void 0 ? void 0 : _a2.value) !== null && _b2 !== void 0 ? _b2 : selectable === null || selectable === void 0 ? void 0 : selectable.value;
}),
validator: (_a = props2.validator) !== null && _a !== void 0 ? _a : validator,
onClick: (_b = props2.onClick) !== null && _b !== void 0 ? _b : onClick,
expandIcon: (_c = props2.expandIcon) !== null && _c !== void 0 ? _c : expandIcon === null || expandIcon === void 0 ? void 0 : expandIcon.value
});
};
const Dropdown = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADropdown",
inheritAttrs: false,
props: initDefaultProps(dropdownProps(), {
mouseEnterDelay: 0.15,
mouseLeaveDelay: 0.1,
placement: "bottomLeft",
trigger: "hover"
}),
// emits: ['visibleChange', 'update:visible'],
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs,
emit
} = _ref;
const {
prefixCls,
rootPrefixCls,
direction,
getPopupContainer
} = useConfigInject("dropdown", props2);
const [wrapSSR, hashId] = useStyle$O(prefixCls);
const transitionName2 = computed(() => {
const {
placement: placement2 = "",
transitionName: transitionName3
} = props2;
if (transitionName3 !== void 0) {
return transitionName3;
}
if (placement2.includes("top")) {
return `${rootPrefixCls.value}-slide-down`;
}
return `${rootPrefixCls.value}-slide-up`;
});
useProvideOverride({
prefixCls: computed(() => `${prefixCls.value}-menu`),
expandIcon: computed(() => {
return createVNode("span", {
"class": `${prefixCls.value}-menu-submenu-arrow`
}, [createVNode(RightOutlined, {
"class": `${prefixCls.value}-menu-submenu-arrow-icon`
}, null)]);
}),
mode: computed(() => "vertical"),
selectable: computed(() => false),
onClick: () => {
},
validator: (_ref3) => {
let {
mode
} = _ref3;
}
});
const renderOverlay = () => {
var _a, _b, _c;
const overlay = props2.overlay || ((_a = slots.overlay) === null || _a === void 0 ? void 0 : _a.call(slots));
const overlayNode = Array.isArray(overlay) ? overlay[0] : overlay;
if (!overlayNode) return null;
const overlayProps = overlayNode.props || {};
devWarning(!overlayProps.mode || overlayProps.mode === "vertical", "Dropdown", `mode="${overlayProps.mode}" is not supported for Dropdown's Menu.`);
const {
selectable = false,
expandIcon = (_c = (_b = overlayNode.children) === null || _b === void 0 ? void 0 : _b.expandIcon) === null || _c === void 0 ? void 0 : _c.call(_b)
} = overlayProps;
const overlayNodeExpandIcon = typeof expandIcon !== "undefined" && isValidElement(expandIcon) ? expandIcon : createVNode("span", {
"class": `${prefixCls.value}-menu-submenu-arrow`
}, [createVNode(RightOutlined, {
"class": `${prefixCls.value}-menu-submenu-arrow-icon`
}, null)]);
const fixedModeOverlay = isValidElement(overlayNode) ? cloneElement(overlayNode, {
mode: "vertical",
selectable,
expandIcon: () => overlayNodeExpandIcon
}) : overlayNode;
return fixedModeOverlay;
};
const placement = computed(() => {
const placement2 = props2.placement;
if (!placement2) {
return direction.value === "rtl" ? "bottomRight" : "bottomLeft";
}
if (placement2.includes("Center")) {
const newPlacement = placement2.slice(0, placement2.indexOf("Center"));
devWarning(!placement2.includes("Center"), "Dropdown", `You are using '${placement2}' placement in Dropdown, which is deprecated. Try to use '${newPlacement}' instead.`);
return newPlacement;
}
return placement2;
});
const mergedVisible = computed(() => {
return typeof props2.visible === "boolean" ? props2.visible : props2.open;
});
const handleVisibleChange = (val) => {
emit("update:visible", val);
emit("visibleChange", val);
emit("update:open", val);
emit("openChange", val);
};
return () => {
var _a, _b;
const {
arrow,
trigger,
disabled,
overlayClassName
} = props2;
const child = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)[0];
const dropdownTrigger = cloneElement(child, _extends({
class: classNames((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.class, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, `${prefixCls.value}-trigger`)
}, disabled ? {
disabled
} : {}));
const overlayClassNameCustomized = classNames(overlayClassName, hashId.value, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
});
const triggerActions = disabled ? [] : trigger;
let alignPoint2;
if (triggerActions && triggerActions.includes("contextmenu")) {
alignPoint2 = true;
}
const builtinPlacements = getPlacements$1({
arrowPointAtCenter: typeof arrow === "object" && arrow.pointAtCenter,
autoAdjustOverflow: true
});
const dropdownProps2 = omit(_extends(_extends(_extends({}, props2), attrs), {
visible: mergedVisible.value,
builtinPlacements,
overlayClassName: overlayClassNameCustomized,
arrow: !!arrow,
alignPoint: alignPoint2,
prefixCls: prefixCls.value,
getPopupContainer: getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value,
transitionName: transitionName2.value,
trigger: triggerActions,
onVisibleChange: handleVisibleChange,
placement: placement.value
}), ["overlay", "onUpdate:visible"]);
return wrapSSR(createVNode(Dropdown$1, dropdownProps2, {
default: () => [dropdownTrigger],
overlay: renderOverlay
}));
};
}
});
Dropdown.Button = DropdownButton;
var __rest$10 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const breadcrumbItemProps = () => ({
prefixCls: String,
href: String,
separator: PropTypes.any,
dropdownProps: objectType(),
overlay: PropTypes.any,
onClick: eventType()
});
const BreadcrumbItem = defineComponent({
compatConfig: {
MODE: 3
},
name: "ABreadcrumbItem",
inheritAttrs: false,
__ANT_BREADCRUMB_ITEM: true,
props: breadcrumbItemProps(),
// emits: ['click'],
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs,
emit
} = _ref;
const {
prefixCls
} = useConfigInject("breadcrumb", props2);
const renderBreadcrumbNode = (breadcrumbItem, prefixCls2) => {
const overlay = getPropsSlot(slots, props2, "overlay");
if (overlay) {
return createVNode(Dropdown, _objectSpread$W(_objectSpread$W({}, props2.dropdownProps), {}, {
"overlay": overlay,
"placement": "bottom"
}), {
default: () => [createVNode("span", {
"class": `${prefixCls2}-overlay-link`
}, [breadcrumbItem, createVNode(DownOutlined, null, null)])]
});
}
return breadcrumbItem;
};
const handleClick = (e) => {
emit("click", e);
};
return () => {
var _a;
const separator = (_a = getPropsSlot(slots, props2, "separator")) !== null && _a !== void 0 ? _a : "/";
const children = getPropsSlot(slots, props2);
const {
class: cls,
style
} = attrs, restAttrs = __rest$10(attrs, ["class", "style"]);
let link;
if (props2.href !== void 0) {
link = createVNode("a", _objectSpread$W({
"class": `${prefixCls.value}-link`,
"onClick": handleClick
}, restAttrs), [children]);
} else {
link = createVNode("span", _objectSpread$W({
"class": `${prefixCls.value}-link`,
"onClick": handleClick
}, restAttrs), [children]);
}
link = renderBreadcrumbNode(link, prefixCls.value);
if (children !== void 0 && children !== null) {
return createVNode("li", {
"class": cls,
"style": style
}, [link, separator && createVNode("span", {
"class": `${prefixCls.value}-separator`
}, [separator])]);
}
return null;
};
}
});
function shallowEqual(objA, objB, compare, compareContext) {
let ret = void 0;
if (ret !== void 0) {
return !!ret;
}
if (objA === objB) {
return true;
}
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
return false;
}
const keysA = Object.keys(objA);
const keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
const bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
for (let idx = 0; idx < keysA.length; idx++) {
const key2 = keysA[idx];
if (!bHasOwnProperty(key2)) {
return false;
}
const valueA = objA[key2];
const valueB = objB[key2];
ret = void 0;
if (ret === false || ret === void 0 && valueA !== valueB) {
return false;
}
}
return true;
}
function shallowequal(value, other) {
return shallowEqual(toRaw(value), toRaw(other));
}
const MenuContextKey = Symbol("menuContextKey");
const useProvideMenu = (props2) => {
provide(MenuContextKey, props2);
};
const useInjectMenu = () => {
return inject(MenuContextKey);
};
const ForceRenderKey = Symbol("ForceRenderKey");
const useProvideForceRender = (forceRender) => {
provide(ForceRenderKey, forceRender);
};
const useInjectForceRender = () => {
return inject(ForceRenderKey, false);
};
const MenuFirstLevelContextKey = Symbol("menuFirstLevelContextKey");
const useProvideFirstLevel = (firstLevel) => {
provide(MenuFirstLevelContextKey, firstLevel);
};
const useInjectFirstLevel = () => {
return inject(MenuFirstLevelContextKey, true);
};
const MenuContextProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "MenuContextProvider",
inheritAttrs: false,
props: {
mode: {
type: String,
default: void 0
},
overflowDisabled: {
type: Boolean,
default: void 0
}
},
setup(props2, _ref) {
let {
slots
} = _ref;
const menuContext = useInjectMenu();
const newContext = _extends({}, menuContext);
if (props2.mode !== void 0) {
newContext.mode = toRef(props2, "mode");
}
if (props2.overflowDisabled !== void 0) {
newContext.overflowDisabled = toRef(props2, "overflowDisabled");
}
useProvideMenu(newContext);
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const SiderCollapsedKey = Symbol("siderCollapsed");
const SiderHookProviderKey = Symbol("siderHookProvider");
const OVERFLOW_KEY = "$$__vc-menu-more__key";
const KeyPathContext = Symbol("KeyPathContext");
const useInjectKeyPath = () => {
return inject(KeyPathContext, {
parentEventKeys: computed(() => []),
parentKeys: computed(() => []),
parentInfo: {}
});
};
const useProvideKeyPath = (eventKey, key2, menuInfo) => {
const {
parentEventKeys,
parentKeys
} = useInjectKeyPath();
const eventKeys = computed(() => [...parentEventKeys.value, eventKey]);
const keys = computed(() => [...parentKeys.value, key2]);
provide(KeyPathContext, {
parentEventKeys: eventKeys,
parentKeys: keys,
parentInfo: menuInfo
});
return keys;
};
const measure$1 = Symbol("measure");
const PathContext = defineComponent({
compatConfig: {
MODE: 3
},
setup(_props, _ref) {
let {
slots
} = _ref;
provide(measure$1, true);
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const useMeasure = () => {
return inject(measure$1, false);
};
function useDirectionStyle(level) {
const {
mode,
rtl: rtl2,
inlineIndent
} = useInjectMenu();
return computed(() => mode.value !== "inline" ? null : rtl2.value ? {
paddingRight: `${level.value * inlineIndent.value}px`
} : {
paddingLeft: `${level.value * inlineIndent.value}px`
});
}
let indexGuid$3 = 0;
const menuItemProps = () => ({
id: String,
role: String,
disabled: Boolean,
danger: Boolean,
title: {
type: [String, Boolean],
default: void 0
},
icon: PropTypes.any,
onMouseenter: Function,
onMouseleave: Function,
onClick: Function,
onKeydown: Function,
onFocus: Function,
// Internal user prop
originItemValue: objectType()
});
const __nuxt_component_1$5 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenuItem",
inheritAttrs: false,
props: menuItemProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
emit,
attrs
} = _ref;
const instance = getCurrentInstance();
const isMeasure = useMeasure();
const key2 = typeof instance.vnode.key === "symbol" ? String(instance.vnode.key) : instance.vnode.key;
devWarning(typeof instance.vnode.key !== "symbol", "MenuItem", `MenuItem \`:key="${String(key2)}"\` not support Symbol type`);
const eventKey = `menu_item_${++indexGuid$3}_$$_${key2}`;
const {
parentEventKeys,
parentKeys
} = useInjectKeyPath();
const {
prefixCls,
activeKeys,
disabled,
changeActiveKeys,
rtl: rtl2,
inlineCollapsed,
siderCollapsed,
onItemClick,
selectedKeys,
registerMenuInfo,
unRegisterMenuInfo
} = useInjectMenu();
const firstLevel = useInjectFirstLevel();
const isActive = shallowRef(false);
const keysPath = computed(() => {
return [...parentKeys.value, key2];
});
const menuInfo = {
eventKey,
key: key2,
parentEventKeys,
parentKeys,
isLeaf: true
};
registerMenuInfo(eventKey, menuInfo);
watch(activeKeys, () => {
isActive.value = !!activeKeys.value.find((val) => val === key2);
}, {
immediate: true
});
const mergedDisabled = computed(() => disabled.value || props2.disabled);
const selected = computed(() => selectedKeys.value.includes(key2));
const classNames2 = computed(() => {
const itemCls = `${prefixCls.value}-item`;
return {
[`${itemCls}`]: true,
[`${itemCls}-danger`]: props2.danger,
[`${itemCls}-active`]: isActive.value,
[`${itemCls}-selected`]: selected.value,
[`${itemCls}-disabled`]: mergedDisabled.value
};
});
const getEventInfo = (e) => {
return {
key: key2,
eventKey,
keyPath: keysPath.value,
eventKeyPath: [...parentEventKeys.value, eventKey],
domEvent: e,
item: _extends(_extends({}, props2), attrs)
};
};
const onInternalClick = (e) => {
if (mergedDisabled.value) {
return;
}
const info = getEventInfo(e);
emit("click", e);
onItemClick(info);
};
const onMouseEnter = (event) => {
if (!mergedDisabled.value) {
changeActiveKeys(keysPath.value);
emit("mouseenter", event);
}
};
const onMouseLeave = (event) => {
if (!mergedDisabled.value) {
changeActiveKeys([]);
emit("mouseleave", event);
}
};
const onInternalKeyDown = (e) => {
emit("keydown", e);
if (e.which === KeyCode.ENTER) {
const info = getEventInfo(e);
emit("click", e);
onItemClick(info);
}
};
const onInternalFocus = (e) => {
changeActiveKeys(keysPath.value);
emit("focus", e);
};
const renderItemChildren = (icon, children) => {
const wrapNode = createVNode("span", {
"class": `${prefixCls.value}-title-content`
}, [children]);
if (!icon || isValidElement(children) && children.type === "span") {
if (children && inlineCollapsed.value && firstLevel && typeof children === "string") {
return createVNode("div", {
"class": `${prefixCls.value}-inline-collapsed-noicon`
}, [children.charAt(0)]);
}
}
return wrapNode;
};
const directionStyle = useDirectionStyle(computed(() => keysPath.value.length));
return () => {
var _a, _b, _c, _d, _e;
if (isMeasure) return null;
const title = (_a = props2.title) !== null && _a !== void 0 ? _a : (_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots);
const children = flattenChildren((_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots));
const childrenLength = children.length;
let tooltipTitle = title;
if (typeof title === "undefined") {
tooltipTitle = firstLevel && childrenLength ? children : "";
} else if (title === false) {
tooltipTitle = "";
}
const tooltipProps2 = {
title: tooltipTitle
};
if (!siderCollapsed.value && !inlineCollapsed.value) {
tooltipProps2.title = null;
tooltipProps2.open = false;
}
const optionRoleProps = {};
if (props2.role === "option") {
optionRoleProps["aria-selected"] = selected.value;
}
const icon = (_d = props2.icon) !== null && _d !== void 0 ? _d : (_e = slots.icon) === null || _e === void 0 ? void 0 : _e.call(slots, props2);
return createVNode(__nuxt_component_2$4, _objectSpread$W(_objectSpread$W({}, tooltipProps2), {}, {
"placement": rtl2.value ? "left" : "right",
"overlayClassName": `${prefixCls.value}-inline-collapsed-tooltip`
}), {
default: () => [createVNode(Overflow.Item, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"component": "li"
}, attrs), {}, {
"id": props2.id,
"style": _extends(_extends({}, attrs.style || {}), directionStyle.value),
"class": [classNames2.value, {
[`${attrs.class}`]: !!attrs.class,
[`${prefixCls.value}-item-only-child`]: (icon ? childrenLength + 1 : childrenLength) === 1
}],
"role": props2.role || "menuitem",
"tabindex": props2.disabled ? null : -1,
"data-menu-id": key2,
"aria-disabled": props2.disabled
}, optionRoleProps), {}, {
"onMouseenter": onMouseEnter,
"onMouseleave": onMouseLeave,
"onClick": onInternalClick,
"onKeydown": onInternalKeyDown,
"onFocus": onInternalFocus,
"title": typeof title === "string" ? title : void 0
}), {
default: () => [cloneElement(typeof icon === "function" ? icon(props2.originItemValue) : icon, {
class: `${prefixCls.value}-item-icon`
}, false), renderItemChildren(icon, children)]
})]
});
};
}
});
const autoAdjustOverflow = {
adjustX: 1,
adjustY: 1
};
const placements = {
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow,
offset: [0, -7]
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow,
offset: [0, 7]
},
leftTop: {
points: ["tr", "tl"],
overflow: autoAdjustOverflow,
offset: [-4, 0]
},
rightTop: {
points: ["tl", "tr"],
overflow: autoAdjustOverflow,
offset: [4, 0]
}
};
const placementsRtl = {
topLeft: {
points: ["bl", "tl"],
overflow: autoAdjustOverflow,
offset: [0, -7]
},
bottomLeft: {
points: ["tl", "bl"],
overflow: autoAdjustOverflow,
offset: [0, 7]
},
rightTop: {
points: ["tr", "tl"],
overflow: autoAdjustOverflow,
offset: [-4, 0]
},
leftTop: {
points: ["tl", "tr"],
overflow: autoAdjustOverflow,
offset: [4, 0]
}
};
const popupPlacementMap = {
horizontal: "bottomLeft",
vertical: "rightTop",
"vertical-left": "rightTop",
"vertical-right": "leftTop"
};
const PopupTrigger = defineComponent({
compatConfig: {
MODE: 3
},
name: "PopupTrigger",
inheritAttrs: false,
props: {
prefixCls: String,
mode: String,
visible: Boolean,
// popup: React.ReactNode;
popupClassName: String,
popupOffset: Array,
disabled: Boolean,
onVisibleChange: Function
},
slots: Object,
emits: ["visibleChange"],
setup(props2, _ref) {
let {
slots,
emit
} = _ref;
const innerVisible = shallowRef(false);
const {
getPopupContainer,
rtl: rtl2,
subMenuOpenDelay,
subMenuCloseDelay,
builtinPlacements,
triggerSubMenuAction,
forceSubMenuRender,
motion,
defaultMotions,
rootClassName
} = useInjectMenu();
const forceRender = useInjectForceRender();
const placement = computed(() => rtl2.value ? _extends(_extends({}, placementsRtl), builtinPlacements.value) : _extends(_extends({}, placements), builtinPlacements.value));
const popupPlacement = computed(() => popupPlacementMap[props2.mode]);
const visibleRef = shallowRef();
watch(() => props2.visible, (visible) => {
wrapperRaf.cancel(visibleRef.value);
visibleRef.value = wrapperRaf(() => {
innerVisible.value = visible;
});
}, {
immediate: true
});
const onVisibleChange = (visible) => {
emit("visibleChange", visible);
};
const mergedMotion = computed(() => {
var _a, _b;
const m = motion.value || ((_a = defaultMotions.value) === null || _a === void 0 ? void 0 : _a[props2.mode]) || ((_b = defaultMotions.value) === null || _b === void 0 ? void 0 : _b.other);
const res = typeof m === "function" ? m() : m;
return res ? getTransitionProps(res.name, {
css: true
}) : void 0;
});
return () => {
const {
prefixCls,
popupClassName,
mode,
popupOffset,
disabled
} = props2;
return createVNode(Trigger, {
"prefixCls": prefixCls,
"popupClassName": classNames(`${prefixCls}-popup`, {
[`${prefixCls}-rtl`]: rtl2.value
}, popupClassName, rootClassName.value),
"stretch": mode === "horizontal" ? "minWidth" : null,
"getPopupContainer": getPopupContainer.value,
"builtinPlacements": placement.value,
"popupPlacement": popupPlacement.value,
"popupVisible": innerVisible.value,
"popupAlign": popupOffset && {
offset: popupOffset
},
"action": disabled ? [] : [triggerSubMenuAction.value],
"mouseEnterDelay": subMenuOpenDelay.value,
"mouseLeaveDelay": subMenuCloseDelay.value,
"onPopupVisibleChange": onVisibleChange,
"forceRender": forceRender || forceSubMenuRender.value,
"popupAnimation": mergedMotion.value
}, {
popup: slots.popup,
default: slots.default
});
};
}
});
const InternalSubMenuList = (_props, _ref) => {
let {
slots,
attrs
} = _ref;
var _a;
const {
prefixCls,
mode
} = useInjectMenu();
return createVNode("ul", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(prefixCls.value, `${prefixCls.value}-sub`, `${prefixCls.value}-${mode.value === "inline" ? "inline" : "vertical"}`),
"data-menu-list": true
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
InternalSubMenuList.displayName = "SubMenuList";
const InlineSubMenuList = defineComponent({
compatConfig: {
MODE: 3
},
name: "InlineSubMenuList",
inheritAttrs: false,
props: {
id: String,
open: Boolean,
keyPath: Array
},
setup(props2, _ref) {
let {
slots
} = _ref;
const fixedMode = computed(() => "inline");
const {
motion,
mode,
defaultMotions
} = useInjectMenu();
const sameModeRef = computed(() => mode.value === fixedMode.value);
const destroy = ref(!sameModeRef.value);
const mergedOpen = computed(() => sameModeRef.value ? props2.open : false);
watch(mode, () => {
if (sameModeRef.value) {
destroy.value = false;
}
}, {
flush: "post"
});
const mergedMotion = computed(() => {
var _a, _b;
const m = motion.value || ((_a = defaultMotions.value) === null || _a === void 0 ? void 0 : _a[fixedMode.value]) || ((_b = defaultMotions.value) === null || _b === void 0 ? void 0 : _b.other);
const res = typeof m === "function" ? m() : m;
return _extends(_extends({}, res), {
appear: props2.keyPath.length <= 1
});
});
return () => {
var _a;
if (destroy.value) {
return null;
}
return createVNode(MenuContextProvider, {
"mode": fixedMode.value
}, {
default: () => [createVNode(Transition, mergedMotion.value, {
default: () => [withDirectives(createVNode(InternalSubMenuList, {
"id": props2.id
}, {
default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
}), [[vShow, mergedOpen.value]])]
})]
});
};
}
});
let indexGuid$2 = 0;
const subMenuProps = () => ({
icon: PropTypes.any,
title: PropTypes.any,
disabled: Boolean,
level: Number,
popupClassName: String,
popupOffset: Array,
internalPopupClose: Boolean,
eventKey: String,
expandIcon: Function,
theme: String,
onMouseenter: Function,
onMouseleave: Function,
onTitleClick: Function,
// Internal user prop
originItemValue: objectType()
});
const SubMenu$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASubMenu",
inheritAttrs: false,
props: subMenuProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs,
emit
} = _ref;
var _a, _b;
useProvideFirstLevel(false);
const isMeasure = useMeasure();
const instance = getCurrentInstance();
const vnodeKey = typeof instance.vnode.key === "symbol" ? String(instance.vnode.key) : instance.vnode.key;
devWarning(typeof instance.vnode.key !== "symbol", "SubMenu", `SubMenu \`:key="${String(vnodeKey)}"\` not support Symbol type`);
const key2 = isValid$2(vnodeKey) ? vnodeKey : `sub_menu_${++indexGuid$2}_$$_not_set_key`;
const eventKey = (_a = props2.eventKey) !== null && _a !== void 0 ? _a : isValid$2(vnodeKey) ? `sub_menu_${++indexGuid$2}_$$_${vnodeKey}` : key2;
const {
parentEventKeys,
parentInfo,
parentKeys
} = useInjectKeyPath();
const keysPath = computed(() => [...parentKeys.value, key2]);
const childrenEventKeys = shallowRef([]);
const menuInfo = {
eventKey,
key: key2,
parentEventKeys,
childrenEventKeys,
parentKeys
};
(_b = parentInfo.childrenEventKeys) === null || _b === void 0 ? void 0 : _b.value.push(eventKey);
useProvideKeyPath(eventKey, key2, menuInfo);
const {
prefixCls,
activeKeys,
disabled: contextDisabled,
changeActiveKeys,
mode,
inlineCollapsed,
openKeys,
overflowDisabled,
onOpenChange,
registerMenuInfo,
unRegisterMenuInfo,
selectedSubMenuKeys,
expandIcon: menuExpandIcon,
theme
} = useInjectMenu();
const hasKey = vnodeKey !== void 0 && vnodeKey !== null;
const forceRender = !isMeasure && (useInjectForceRender() || !hasKey);
useProvideForceRender(forceRender);
if (isMeasure && hasKey || !isMeasure && !hasKey || forceRender) {
registerMenuInfo(eventKey, menuInfo);
}
const subMenuPrefixCls = computed(() => `${prefixCls.value}-submenu`);
const mergedDisabled = computed(() => contextDisabled.value || props2.disabled);
const elementRef = shallowRef();
const popupRef = shallowRef();
const originOpen = computed(() => openKeys.value.includes(key2));
const open2 = computed(() => !overflowDisabled.value && originOpen.value);
const childrenSelected = computed(() => {
return selectedSubMenuKeys.value.includes(key2);
});
const isActive = shallowRef(false);
watch(activeKeys, () => {
isActive.value = !!activeKeys.value.find((val) => val === key2);
}, {
immediate: true
});
const onInternalTitleClick = (e) => {
if (mergedDisabled.value) {
return;
}
emit("titleClick", e, key2);
if (mode.value === "inline") {
onOpenChange(key2, !originOpen.value);
}
};
const onMouseEnter = (event) => {
if (!mergedDisabled.value) {
changeActiveKeys(keysPath.value);
emit("mouseenter", event);
}
};
const onMouseLeave = (event) => {
if (!mergedDisabled.value) {
changeActiveKeys([]);
emit("mouseleave", event);
}
};
const directionStyle = useDirectionStyle(computed(() => keysPath.value.length));
const onPopupVisibleChange = (newVisible) => {
if (mode.value !== "inline") {
onOpenChange(key2, newVisible);
}
};
const onInternalFocus = () => {
changeActiveKeys(keysPath.value);
};
const popupId = eventKey && `${eventKey}-popup`;
const popupClassName = computed(() => classNames(prefixCls.value, `${prefixCls.value}-${props2.theme || theme.value}`, props2.popupClassName));
const renderTitle = (title, icon) => {
if (!icon) {
return inlineCollapsed.value && !parentKeys.value.length && title && typeof title === "string" ? createVNode("div", {
"class": `${prefixCls.value}-inline-collapsed-noicon`
}, [title.charAt(0)]) : createVNode("span", {
"class": `${prefixCls.value}-title-content`
}, [title]);
}
const titleIsSpan = isValidElement(title) && title.type === "span";
return createVNode(Fragment, null, [cloneElement(typeof icon === "function" ? icon(props2.originItemValue) : icon, {
class: `${prefixCls.value}-item-icon`
}, false), titleIsSpan ? title : createVNode("span", {
"class": `${prefixCls.value}-title-content`
}, [title])]);
};
const triggerModeRef = computed(() => {
return mode.value !== "inline" && keysPath.value.length > 1 ? "vertical" : mode.value;
});
const renderMode = computed(() => mode.value === "horizontal" ? "vertical" : mode.value);
const subMenuTriggerModeRef = computed(() => triggerModeRef.value === "horizontal" ? "vertical" : triggerModeRef.value);
const baseTitleNode = () => {
var _a2, _b2;
const subMenuPrefixClsValue = subMenuPrefixCls.value;
const icon = (_a2 = props2.icon) !== null && _a2 !== void 0 ? _a2 : (_b2 = slots.icon) === null || _b2 === void 0 ? void 0 : _b2.call(slots, props2);
const expandIcon = props2.expandIcon || slots.expandIcon || menuExpandIcon.value;
const title = renderTitle(getPropsSlot(slots, props2, "title"), icon);
return createVNode("div", {
"style": directionStyle.value,
"class": `${subMenuPrefixClsValue}-title`,
"tabindex": mergedDisabled.value ? null : -1,
"ref": elementRef,
"title": typeof title === "string" ? title : null,
"data-menu-id": key2,
"aria-expanded": open2.value,
"aria-haspopup": true,
"aria-controls": popupId,
"aria-disabled": mergedDisabled.value,
"onClick": onInternalTitleClick,
"onFocus": onInternalFocus
}, [title, mode.value !== "horizontal" && expandIcon ? expandIcon(_extends(_extends({}, props2), {
isOpen: open2.value
})) : createVNode("i", {
"class": `${subMenuPrefixClsValue}-arrow`
}, null)]);
};
return () => {
var _a2;
if (isMeasure) {
if (!hasKey) {
return null;
}
return (_a2 = slots.default) === null || _a2 === void 0 ? void 0 : _a2.call(slots);
}
const subMenuPrefixClsValue = subMenuPrefixCls.value;
let titleNode = () => null;
if (!overflowDisabled.value && mode.value !== "inline") {
const popupOffset = mode.value === "horizontal" ? [0, 8] : [10, 0];
titleNode = () => createVNode(PopupTrigger, {
"mode": triggerModeRef.value,
"prefixCls": subMenuPrefixClsValue,
"visible": !props2.internalPopupClose && open2.value,
"popupClassName": popupClassName.value,
"popupOffset": props2.popupOffset || popupOffset,
"disabled": mergedDisabled.value,
"onVisibleChange": onPopupVisibleChange
}, {
default: () => [baseTitleNode()],
popup: () => createVNode(MenuContextProvider, {
"mode": subMenuTriggerModeRef.value
}, {
default: () => [createVNode(InternalSubMenuList, {
"id": popupId,
"ref": popupRef
}, {
default: slots.default
})]
})
});
} else {
titleNode = () => createVNode(PopupTrigger, null, {
default: baseTitleNode
});
}
return createVNode(MenuContextProvider, {
"mode": renderMode.value
}, {
default: () => [createVNode(Overflow.Item, _objectSpread$W(_objectSpread$W({
"component": "li"
}, attrs), {}, {
"role": "none",
"class": classNames(subMenuPrefixClsValue, `${subMenuPrefixClsValue}-${mode.value}`, attrs.class, {
[`${subMenuPrefixClsValue}-open`]: open2.value,
[`${subMenuPrefixClsValue}-active`]: isActive.value,
[`${subMenuPrefixClsValue}-selected`]: childrenSelected.value,
[`${subMenuPrefixClsValue}-disabled`]: mergedDisabled.value
}),
"onMouseenter": onMouseEnter,
"onMouseleave": onMouseLeave,
"data-submenu-id": key2
}), {
default: () => {
return createVNode(Fragment, null, [titleNode(), !overflowDisabled.value && createVNode(InlineSubMenuList, {
"id": popupId,
"open": open2.value,
"keyPath": keysPath.value
}, {
default: slots.default
})]);
}
})]
});
};
}
});
function hasClass(node, className) {
if (node.classList) {
return node.classList.contains(className);
}
const originClass = node.className;
return ` ${originClass} `.indexOf(` ${className} `) > -1;
}
function addClass(node, className) {
if (node.classList) {
node.classList.add(className);
} else {
if (!hasClass(node, className)) {
node.className = `${node.className} ${className}`;
}
}
}
function removeClass(node, className) {
if (node.classList) {
node.classList.remove(className);
} else {
if (hasClass(node, className)) {
const originClass = node.className;
node.className = ` ${originClass} `.replace(` ${className} `, " ");
}
}
}
const collapseMotion = function() {
let name = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "ant-motion-collapse";
let appear = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
return {
name,
appear,
css: true,
onBeforeEnter: (node) => {
node.style.height = "0px";
node.style.opacity = "0";
addClass(node, name);
},
onEnter: (node) => {
nextTick(() => {
node.style.height = `${node.scrollHeight}px`;
node.style.opacity = "1";
});
},
onAfterEnter: (node) => {
if (node) {
removeClass(node, name);
node.style.height = null;
node.style.opacity = null;
}
},
onBeforeLeave: (node) => {
addClass(node, name);
node.style.height = `${node.offsetHeight}px`;
node.style.opacity = null;
},
onLeave: (node) => {
setTimeout(() => {
node.style.height = "0px";
node.style.opacity = "0";
});
},
onAfterLeave: (node) => {
if (node) {
removeClass(node, name);
if (node.style) {
node.style.height = null;
node.style.opacity = null;
}
}
}
};
};
const menuItemGroupProps = () => ({
title: PropTypes.any,
// Internal user prop
originItemValue: objectType()
});
const ItemGroup = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenuItemGroup",
inheritAttrs: false,
props: menuItemGroupProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls
} = useInjectMenu();
const groupPrefixCls = computed(() => `${prefixCls.value}-item-group`);
const isMeasure = useMeasure();
return () => {
var _a, _b;
if (isMeasure) return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
return createVNode("li", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"onClick": (e) => e.stopPropagation(),
"class": groupPrefixCls.value
}), [createVNode("div", {
"title": typeof props2.title === "string" ? props2.title : void 0,
"class": `${groupPrefixCls.value}-title`
}, [getPropsSlot(slots, props2, "title")]), createVNode("ul", {
"class": `${groupPrefixCls.value}-list`
}, [(_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots)])]);
};
}
});
const menuDividerProps = () => ({
prefixCls: String,
dashed: Boolean
});
const Divider$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenuDivider",
props: menuDividerProps(),
setup(props2) {
const {
prefixCls
} = useInjectMenu();
const cls = computed(() => {
return {
[`${prefixCls.value}-item-divider`]: true,
[`${prefixCls.value}-item-divider-dashed`]: !!props2.dashed
};
});
return () => {
return createVNode("li", {
"class": cls.value
}, null);
};
}
});
var __rest$$ = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function convertItemsToNodes(list, store, parentMenuInfo) {
return (list || []).map((opt, index2) => {
if (opt && typeof opt === "object") {
const _a = opt, {
label,
children,
key: key2,
type
} = _a, restProps = __rest$$(_a, ["label", "children", "key", "type"]);
const mergedKey = key2 !== null && key2 !== void 0 ? key2 : `tmp-${index2}`;
const parentKeys = parentMenuInfo ? parentMenuInfo.parentKeys.slice() : [];
const childrenEventKeys = [];
const menuInfo = {
eventKey: mergedKey,
key: mergedKey,
parentEventKeys: ref(parentKeys),
parentKeys: ref(parentKeys),
childrenEventKeys: ref(childrenEventKeys),
isLeaf: false
};
if (children || type === "group") {
if (type === "group") {
const childrenNodes2 = convertItemsToNodes(children, store, parentMenuInfo);
return createVNode(ItemGroup, _objectSpread$W(_objectSpread$W({
"key": mergedKey
}, restProps), {}, {
"title": label,
"originItemValue": opt
}), {
default: () => [childrenNodes2]
});
}
store.set(mergedKey, menuInfo);
if (parentMenuInfo) {
parentMenuInfo.childrenEventKeys.push(mergedKey);
}
const childrenNodes = convertItemsToNodes(children, store, {
childrenEventKeys,
parentKeys: [].concat(parentKeys, mergedKey)
});
return createVNode(SubMenu$1, _objectSpread$W(_objectSpread$W({
"key": mergedKey
}, restProps), {}, {
"title": label,
"originItemValue": opt
}), {
default: () => [childrenNodes]
});
}
if (type === "divider") {
return createVNode(Divider$1, _objectSpread$W({
"key": mergedKey
}, restProps), null);
}
menuInfo.isLeaf = true;
store.set(mergedKey, menuInfo);
return createVNode(__nuxt_component_1$5, _objectSpread$W(_objectSpread$W({
"key": mergedKey
}, restProps), {}, {
"originItemValue": opt
}), {
default: () => [label]
});
}
return null;
}).filter((opt) => opt);
}
function useItems(props2) {
const itemsNodes = shallowRef([]);
const hasItmes = shallowRef(false);
const store = shallowRef(/* @__PURE__ */ new Map());
watch(() => props2.items, () => {
const newStore = /* @__PURE__ */ new Map();
hasItmes.value = false;
if (props2.items) {
hasItmes.value = true;
itemsNodes.value = convertItemsToNodes(props2.items, newStore);
} else {
itemsNodes.value = void 0;
}
store.value = newStore;
}, {
immediate: true,
deep: true
});
return {
itemsNodes,
store,
hasItmes
};
}
const getHorizontalStyle = (token) => {
const {
componentCls,
motionDurationSlow,
menuHorizontalHeight,
colorSplit,
lineWidth,
lineType,
menuItemPaddingInline
} = token;
return {
[`${componentCls}-horizontal`]: {
lineHeight: `${menuHorizontalHeight}px`,
border: 0,
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`,
boxShadow: "none",
"&::after": {
display: "block",
clear: "both",
height: 0,
content: '"\\20"'
},
// ======================= Item =======================
[`${componentCls}-item, ${componentCls}-submenu`]: {
position: "relative",
display: "inline-block",
verticalAlign: "bottom",
paddingInline: menuItemPaddingInline
},
[`> ${componentCls}-item:hover,
> ${componentCls}-item-active,
> ${componentCls}-submenu ${componentCls}-submenu-title:hover`]: {
backgroundColor: "transparent"
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`].join(",")
},
// ===================== Sub Menu =====================
[`${componentCls}-submenu-arrow`]: {
display: "none"
}
}
};
};
const getRTLStyle = (_ref) => {
let {
componentCls,
menuArrowOffset
} = _ref;
return {
[`${componentCls}-rtl`]: {
direction: "rtl"
},
[`${componentCls}-submenu-rtl`]: {
transformOrigin: "100% 0"
},
// Vertical Arrow
[`${componentCls}-rtl${componentCls}-vertical,
${componentCls}-submenu-rtl ${componentCls}-vertical`]: {
[`${componentCls}-submenu-arrow`]: {
"&::before": {
transform: `rotate(-45deg) translateY(-${menuArrowOffset})`
},
"&::after": {
transform: `rotate(45deg) translateY(${menuArrowOffset})`
}
}
}
};
};
const accessibilityFocus = (token) => _extends({}, genFocusOutline(token));
const getThemeStyle = (token, themeSuffix) => {
const {
componentCls,
colorItemText,
colorItemTextSelected,
colorGroupTitle,
colorItemBg,
colorSubItemBg,
colorItemBgSelected,
colorActiveBarHeight,
colorActiveBarWidth,
colorActiveBarBorderSize,
motionDurationSlow,
motionEaseInOut,
motionEaseOut,
menuItemPaddingInline,
motionDurationMid,
colorItemTextHover,
lineType,
colorSplit,
// Disabled
colorItemTextDisabled,
// Danger
colorDangerItemText,
colorDangerItemTextHover,
colorDangerItemTextSelected,
colorDangerItemBgActive,
colorDangerItemBgSelected,
colorItemBgHover,
menuSubMenuBg,
// Horizontal
colorItemTextSelectedHorizontal,
colorItemBgSelectedHorizontal
} = token;
return {
[`${componentCls}-${themeSuffix}`]: {
color: colorItemText,
background: colorItemBg,
[`&${componentCls}-root:focus-visible`]: _extends({}, accessibilityFocus(token)),
// ======================== Item ========================
[`${componentCls}-item-group-title`]: {
color: colorGroupTitle
},
[`${componentCls}-submenu-selected`]: {
[`> ${componentCls}-submenu-title`]: {
color: colorItemTextSelected
}
},
// Disabled
[`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
color: `${colorItemTextDisabled} !important`
},
// Hover
[`${componentCls}-item:hover, ${componentCls}-submenu-title:hover`]: {
[`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
color: colorItemTextHover
}
},
[`&:not(${componentCls}-horizontal)`]: {
[`${componentCls}-item:not(${componentCls}-item-selected)`]: {
"&:hover": {
backgroundColor: colorItemBgHover
},
"&:active": {
backgroundColor: colorItemBgSelected
}
},
[`${componentCls}-submenu-title`]: {
"&:hover": {
backgroundColor: colorItemBgHover
},
"&:active": {
backgroundColor: colorItemBgSelected
}
}
},
// Danger - only Item has
[`${componentCls}-item-danger`]: {
color: colorDangerItemText,
[`&${componentCls}-item:hover`]: {
[`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
color: colorDangerItemTextHover
}
},
[`&${componentCls}-item:active`]: {
background: colorDangerItemBgActive
}
},
[`${componentCls}-item a`]: {
"&, &:hover": {
color: "inherit"
}
},
[`${componentCls}-item-selected`]: {
color: colorItemTextSelected,
// Danger
[`&${componentCls}-item-danger`]: {
color: colorDangerItemTextSelected
},
[`a, a:hover`]: {
color: "inherit"
}
},
[`& ${componentCls}-item-selected`]: {
backgroundColor: colorItemBgSelected,
// Danger
[`&${componentCls}-item-danger`]: {
backgroundColor: colorDangerItemBgSelected
}
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
[`&:not(${componentCls}-item-disabled):focus-visible`]: _extends({}, accessibilityFocus(token))
},
[`&${componentCls}-submenu > ${componentCls}`]: {
backgroundColor: menuSubMenuBg
},
[`&${componentCls}-popup > ${componentCls}`]: {
backgroundColor: colorItemBg
},
// ====================== Horizontal ======================
[`&${componentCls}-horizontal`]: _extends(_extends({}, themeSuffix === "dark" ? {
borderBottom: 0
} : {}), {
[`> ${componentCls}-item, > ${componentCls}-submenu`]: {
top: colorActiveBarBorderSize,
marginTop: -colorActiveBarBorderSize,
marginBottom: 0,
borderRadius: 0,
"&::after": {
position: "absolute",
insetInline: menuItemPaddingInline,
bottom: 0,
borderBottom: `${colorActiveBarHeight}px solid transparent`,
transition: `border-color ${motionDurationSlow} ${motionEaseInOut}`,
content: '""'
},
[`&:hover, &-active, &-open`]: {
"&::after": {
borderBottomWidth: colorActiveBarHeight,
borderBottomColor: colorItemTextSelectedHorizontal
}
},
[`&-selected`]: {
color: colorItemTextSelectedHorizontal,
backgroundColor: colorItemBgSelectedHorizontal,
"&::after": {
borderBottomWidth: colorActiveBarHeight,
borderBottomColor: colorItemTextSelectedHorizontal
}
}
}
}),
// ================== Inline & Vertical ===================
//
[`&${componentCls}-root`]: {
[`&${componentCls}-inline, &${componentCls}-vertical`]: {
borderInlineEnd: `${colorActiveBarBorderSize}px ${lineType} ${colorSplit}`
}
},
// ======================== Inline ========================
[`&${componentCls}-inline`]: {
// Sub
[`${componentCls}-sub${componentCls}-inline`]: {
background: colorSubItemBg
},
// Item
[`${componentCls}-item, ${componentCls}-submenu-title`]: colorActiveBarBorderSize && colorActiveBarWidth ? {
width: `calc(100% + ${colorActiveBarBorderSize}px)`
} : {},
[`${componentCls}-item`]: {
position: "relative",
"&::after": {
position: "absolute",
insetBlock: 0,
insetInlineEnd: 0,
borderInlineEnd: `${colorActiveBarWidth}px solid ${colorItemTextSelected}`,
transform: "scaleY(0.0001)",
opacity: 0,
transition: [`transform ${motionDurationMid} ${motionEaseOut}`, `opacity ${motionDurationMid} ${motionEaseOut}`].join(","),
content: '""'
},
// Danger
[`&${componentCls}-item-danger`]: {
"&::after": {
borderInlineEndColor: colorDangerItemTextSelected
}
}
},
[`${componentCls}-selected, ${componentCls}-item-selected`]: {
"&::after": {
transform: "scaleY(1)",
opacity: 1,
transition: [`transform ${motionDurationMid} ${motionEaseInOut}`, `opacity ${motionDurationMid} ${motionEaseInOut}`].join(",")
}
}
}
}
};
};
const getVerticalInlineStyle = (token) => {
const {
componentCls,
menuItemHeight,
itemMarginInline,
padding,
menuArrowSize,
marginXS,
marginXXS
} = token;
const paddingWithArrow = padding + menuArrowSize + marginXS;
return {
[`${componentCls}-item`]: {
position: "relative"
},
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
height: menuItemHeight,
lineHeight: `${menuItemHeight}px`,
paddingInline: padding,
overflow: "hidden",
textOverflow: "ellipsis",
marginInline: itemMarginInline,
marginBlock: marginXXS,
width: `calc(100% - ${itemMarginInline * 2}px)`
},
// disable margin collapsed
[`${componentCls}-submenu`]: {
paddingBottom: 0.02
},
[`> ${componentCls}-item,
> ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
height: menuItemHeight,
lineHeight: `${menuItemHeight}px`
},
[`${componentCls}-item-group-list ${componentCls}-submenu-title,
${componentCls}-submenu-title`]: {
paddingInlineEnd: paddingWithArrow
}
};
};
const getVerticalStyle = (token) => {
const {
componentCls,
iconCls,
menuItemHeight,
colorTextLightSolid,
dropdownWidth,
controlHeightLG,
motionDurationMid,
motionEaseOut,
paddingXL,
fontSizeSM,
fontSizeLG,
motionDurationSlow,
paddingXS,
boxShadowSecondary
} = token;
const inlineItemStyle = {
height: menuItemHeight,
lineHeight: `${menuItemHeight}px`,
listStylePosition: "inside",
listStyleType: "disc"
};
return [
{
[componentCls]: {
[`&-inline, &-vertical`]: _extends({
[`&${componentCls}-root`]: {
boxShadow: "none"
}
}, getVerticalInlineStyle(token))
},
[`${componentCls}-submenu-popup`]: {
[`${componentCls}-vertical`]: _extends(_extends({}, getVerticalInlineStyle(token)), {
boxShadow: boxShadowSecondary
})
}
},
// Vertical only
{
[`${componentCls}-submenu-popup ${componentCls}-vertical${componentCls}-sub`]: {
minWidth: dropdownWidth,
maxHeight: `calc(100vh - ${controlHeightLG * 2.5}px)`,
padding: "0",
overflow: "hidden",
borderInlineEnd: 0,
// https://github.com/ant-design/ant-design/issues/22244
// https://github.com/ant-design/ant-design/issues/26812
"&:not([class*='-active'])": {
overflowX: "hidden",
overflowY: "auto"
}
}
},
// Inline Only
{
[`${componentCls}-inline`]: {
width: "100%",
// Motion enhance for first level
[`&${componentCls}-root`]: {
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
display: "flex",
alignItems: "center",
transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`, `padding ${motionDurationMid} ${motionEaseOut}`].join(","),
[`> ${componentCls}-title-content`]: {
flex: "auto",
minWidth: 0,
overflow: "hidden",
textOverflow: "ellipsis"
},
"> *": {
flex: "none"
}
}
},
// >>>>> Sub
[`${componentCls}-sub${componentCls}-inline`]: {
padding: 0,
border: 0,
borderRadius: 0,
boxShadow: "none",
[`& > ${componentCls}-submenu > ${componentCls}-submenu-title`]: inlineItemStyle,
[`& ${componentCls}-item-group-title`]: {
paddingInlineStart: paddingXL
}
},
// >>>>> Item
[`${componentCls}-item`]: inlineItemStyle
}
},
// Inline Collapse Only
{
[`${componentCls}-inline-collapsed`]: {
width: menuItemHeight * 2,
[`&${componentCls}-root`]: {
[`${componentCls}-item, ${componentCls}-submenu ${componentCls}-submenu-title`]: {
[`> ${componentCls}-inline-collapsed-noicon`]: {
fontSize: fontSizeLG,
textAlign: "center"
}
}
},
[`> ${componentCls}-item,
> ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-item,
> ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-submenu > ${componentCls}-submenu-title,
> ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
insetInlineStart: 0,
paddingInline: `calc(50% - ${fontSizeSM}px)`,
textOverflow: "clip",
[`
${componentCls}-submenu-arrow,
${componentCls}-submenu-expand-icon
`]: {
opacity: 0
},
[`${componentCls}-item-icon, ${iconCls}`]: {
margin: 0,
fontSize: fontSizeLG,
lineHeight: `${menuItemHeight}px`,
"+ span": {
display: "inline-block",
opacity: 0
}
}
},
[`${componentCls}-item-icon, ${iconCls}`]: {
display: "inline-block"
},
"&-tooltip": {
pointerEvents: "none",
[`${componentCls}-item-icon, ${iconCls}`]: {
display: "none"
},
"a, a:hover": {
color: colorTextLightSolid
}
},
[`${componentCls}-item-group-title`]: _extends(_extends({}, textEllipsis), {
paddingInline: paddingXS
})
}
}
];
};
const genMenuItemStyle = (token) => {
const {
componentCls,
fontSize,
motionDurationSlow,
motionDurationMid,
motionEaseInOut,
motionEaseOut,
iconCls,
controlHeightSM
} = token;
return {
// >>>>> Item
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
position: "relative",
display: "block",
margin: 0,
whiteSpace: "nowrap",
cursor: "pointer",
transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`, `padding ${motionDurationSlow} ${motionEaseInOut}`].join(","),
[`${componentCls}-item-icon, ${iconCls}`]: {
minWidth: fontSize,
fontSize,
transition: [`font-size ${motionDurationMid} ${motionEaseOut}`, `margin ${motionDurationSlow} ${motionEaseInOut}`, `color ${motionDurationSlow}`].join(","),
"+ span": {
marginInlineStart: controlHeightSM - fontSize,
opacity: 1,
transition: [`opacity ${motionDurationSlow} ${motionEaseInOut}`, `margin ${motionDurationSlow}`, `color ${motionDurationSlow}`].join(",")
}
},
[`${componentCls}-item-icon`]: _extends({}, resetIcon()),
[`&${componentCls}-item-only-child`]: {
[`> ${iconCls}, > ${componentCls}-item-icon`]: {
marginInlineEnd: 0
}
}
},
// Disabled state sets text to gray and nukes hover/tab effects
[`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
background: "none !important",
cursor: "not-allowed",
"&::after": {
borderColor: "transparent !important"
},
a: {
color: "inherit !important"
},
[`> ${componentCls}-submenu-title`]: {
color: "inherit !important",
cursor: "not-allowed"
}
}
};
};
const genSubMenuArrowStyle = (token) => {
const {
componentCls,
motionDurationSlow,
motionEaseInOut,
borderRadius,
menuArrowSize,
menuArrowOffset
} = token;
return {
[`${componentCls}-submenu`]: {
[`&-expand-icon, &-arrow`]: {
position: "absolute",
top: "50%",
insetInlineEnd: token.margin,
width: menuArrowSize,
color: "currentcolor",
transform: "translateY(-50%)",
transition: `transform ${motionDurationSlow} ${motionEaseInOut}, opacity ${motionDurationSlow}`
},
"&-arrow": {
// →
"&::before, &::after": {
position: "absolute",
width: menuArrowSize * 0.6,
height: menuArrowSize * 0.15,
backgroundColor: "currentcolor",
borderRadius,
transition: [`background ${motionDurationSlow} ${motionEaseInOut}`, `transform ${motionDurationSlow} ${motionEaseInOut}`, `top ${motionDurationSlow} ${motionEaseInOut}`, `color ${motionDurationSlow} ${motionEaseInOut}`].join(","),
content: '""'
},
"&::before": {
transform: `rotate(45deg) translateY(-${menuArrowOffset})`
},
"&::after": {
transform: `rotate(-45deg) translateY(${menuArrowOffset})`
}
}
}
};
};
const getBaseStyle = (token) => {
const {
antCls,
componentCls,
fontSize,
motionDurationSlow,
motionDurationMid,
motionEaseInOut,
lineHeight,
paddingXS,
padding,
colorSplit,
lineWidth,
zIndexPopup,
borderRadiusLG,
radiusSubMenuItem,
menuArrowSize,
menuArrowOffset,
lineType,
menuPanelMaskInset
} = token;
return [
// Misc
{
"": {
[`${componentCls}`]: _extends(_extends({}, clearFix()), {
// Hidden
[`&-hidden`]: {
display: "none"
}
})
},
[`${componentCls}-submenu-hidden`]: {
display: "none"
}
},
{
[componentCls]: _extends(_extends(_extends(_extends(_extends(_extends(_extends({}, resetComponent(token)), clearFix()), {
marginBottom: 0,
paddingInlineStart: 0,
// Override default ul/ol
fontSize,
lineHeight: 0,
listStyle: "none",
outline: "none",
transition: `width ${motionDurationSlow} cubic-bezier(0.2, 0, 0, 1) 0s`,
[`ul, ol`]: {
margin: 0,
padding: 0,
listStyle: "none"
},
// Overflow ellipsis
[`&-overflow`]: {
display: "flex",
[`${componentCls}-item`]: {
flex: "none"
}
},
[`${componentCls}-item, ${componentCls}-submenu, ${componentCls}-submenu-title`]: {
borderRadius: token.radiusItem
},
[`${componentCls}-item-group-title`]: {
padding: `${paddingXS}px ${padding}px`,
fontSize,
lineHeight,
transition: `all ${motionDurationSlow}`
},
[`&-horizontal ${componentCls}-submenu`]: {
transition: [`border-color ${motionDurationSlow} ${motionEaseInOut}`, `background ${motionDurationSlow} ${motionEaseInOut}`].join(",")
},
[`${componentCls}-submenu, ${componentCls}-submenu-inline`]: {
transition: [`border-color ${motionDurationSlow} ${motionEaseInOut}`, `background ${motionDurationSlow} ${motionEaseInOut}`, `padding ${motionDurationMid} ${motionEaseInOut}`].join(",")
},
[`${componentCls}-submenu ${componentCls}-sub`]: {
cursor: "initial",
transition: [`background ${motionDurationSlow} ${motionEaseInOut}`, `padding ${motionDurationSlow} ${motionEaseInOut}`].join(",")
},
[`${componentCls}-title-content`]: {
transition: `color ${motionDurationSlow}`
},
[`${componentCls}-item a`]: {
"&::before": {
position: "absolute",
inset: 0,
backgroundColor: "transparent",
content: '""'
}
},
// Removed a Badge related style seems it's safe
// https://github.com/ant-design/ant-design/issues/19809
// >>>>> Divider
[`${componentCls}-item-divider`]: {
overflow: "hidden",
lineHeight: 0,
borderColor: colorSplit,
borderStyle: lineType,
borderWidth: 0,
borderTopWidth: lineWidth,
marginBlock: lineWidth,
padding: 0,
"&-dashed": {
borderStyle: "dashed"
}
}
}), genMenuItemStyle(token)), {
[`${componentCls}-item-group`]: {
[`${componentCls}-item-group-list`]: {
margin: 0,
padding: 0,
[`${componentCls}-item, ${componentCls}-submenu-title`]: {
paddingInline: `${fontSize * 2}px ${padding}px`
}
}
},
// ======================= Sub Menu =======================
"&-submenu": {
"&-popup": {
position: "absolute",
zIndex: zIndexPopup,
background: "transparent",
borderRadius: borderRadiusLG,
boxShadow: "none",
transformOrigin: "0 0",
// https://github.com/ant-design/ant-design/issues/13955
"&::before": {
position: "absolute",
inset: `${menuPanelMaskInset}px 0 0`,
zIndex: -1,
width: "100%",
height: "100%",
opacity: 0,
content: '""'
}
},
// https://github.com/ant-design/ant-design/issues/13955
"&-placement-rightTop::before": {
top: 0,
insetInlineStart: menuPanelMaskInset
},
[`> ${componentCls}`]: _extends(_extends(_extends({
borderRadius: borderRadiusLG
}, genMenuItemStyle(token)), genSubMenuArrowStyle(token)), {
[`${componentCls}-item, ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
borderRadius: radiusSubMenuItem
},
[`${componentCls}-submenu-title::after`]: {
transition: `transform ${motionDurationSlow} ${motionEaseInOut}`
}
})
}
}), genSubMenuArrowStyle(token)), {
[`&-inline-collapsed ${componentCls}-submenu-arrow,
&-inline ${componentCls}-submenu-arrow`]: {
// ↓
"&::before": {
transform: `rotate(-45deg) translateX(${menuArrowOffset})`
},
"&::after": {
transform: `rotate(45deg) translateX(-${menuArrowOffset})`
}
},
[`${componentCls}-submenu-open${componentCls}-submenu-inline > ${componentCls}-submenu-title > ${componentCls}-submenu-arrow`]: {
// ↑
transform: `translateY(-${menuArrowSize * 0.2}px)`,
"&::after": {
transform: `rotate(-45deg) translateX(-${menuArrowOffset})`
},
"&::before": {
transform: `rotate(45deg) translateX(${menuArrowOffset})`
}
}
})
},
// Integration with header element so menu items have the same height
{
[`${antCls}-layout-header`]: {
[componentCls]: {
lineHeight: "inherit"
}
}
}
];
};
const useStyle$N = ((prefixCls, injectStyle) => {
const useOriginHook = genComponentStyleHook("Menu", (token, _ref) => {
let {
overrideComponentToken
} = _ref;
if ((injectStyle === null || injectStyle === void 0 ? void 0 : injectStyle.value) === false) {
return [];
}
const {
colorBgElevated,
colorPrimary,
colorError,
colorErrorHover,
colorTextLightSolid
} = token;
const {
controlHeightLG,
fontSize
} = token;
const menuArrowSize = fontSize / 7 * 5;
const menuToken = merge(token, {
menuItemHeight: controlHeightLG,
menuItemPaddingInline: token.margin,
menuArrowSize,
menuHorizontalHeight: controlHeightLG * 1.15,
menuArrowOffset: `${menuArrowSize * 0.25}px`,
menuPanelMaskInset: -7,
menuSubMenuBg: colorBgElevated
});
const colorTextDark = new TinyColor(colorTextLightSolid).setAlpha(0.65).toRgbString();
const menuDarkToken = merge(menuToken, {
colorItemText: colorTextDark,
colorItemTextHover: colorTextLightSolid,
colorGroupTitle: colorTextDark,
colorItemTextSelected: colorTextLightSolid,
colorItemBg: "#001529",
colorSubItemBg: "#000c17",
colorItemBgActive: "transparent",
colorItemBgSelected: colorPrimary,
colorActiveBarWidth: 0,
colorActiveBarHeight: 0,
colorActiveBarBorderSize: 0,
// Disabled
colorItemTextDisabled: new TinyColor(colorTextLightSolid).setAlpha(0.25).toRgbString(),
// Danger
colorDangerItemText: colorError,
colorDangerItemTextHover: colorErrorHover,
colorDangerItemTextSelected: colorTextLightSolid,
colorDangerItemBgActive: colorError,
colorDangerItemBgSelected: colorError,
menuSubMenuBg: "#001529",
// Horizontal
colorItemTextSelectedHorizontal: colorTextLightSolid,
colorItemBgSelectedHorizontal: colorPrimary
}, _extends({}, overrideComponentToken));
return [
// Basic
getBaseStyle(menuToken),
// Horizontal
getHorizontalStyle(menuToken),
// Vertical
getVerticalStyle(menuToken),
// Theme
getThemeStyle(menuToken, "light"),
getThemeStyle(menuDarkToken, "dark"),
// RTL
getRTLStyle(menuToken),
// Motion
genCollapseMotion(menuToken),
initSlideMotion(menuToken, "slide-up"),
initSlideMotion(menuToken, "slide-down"),
initZoomMotion(menuToken, "zoom-big")
];
}, (token) => {
const {
colorPrimary,
colorError,
colorTextDisabled,
colorErrorBg,
colorText,
colorTextDescription,
colorBgContainer,
colorFillAlter,
colorFillContent,
lineWidth,
lineWidthBold,
controlItemBgActive,
colorBgTextHover
} = token;
return {
dropdownWidth: 160,
zIndexPopup: token.zIndexPopupBase + 50,
radiusItem: token.borderRadiusLG,
radiusSubMenuItem: token.borderRadiusSM,
colorItemText: colorText,
colorItemTextHover: colorText,
colorItemTextHoverHorizontal: colorPrimary,
colorGroupTitle: colorTextDescription,
colorItemTextSelected: colorPrimary,
colorItemTextSelectedHorizontal: colorPrimary,
colorItemBg: colorBgContainer,
colorItemBgHover: colorBgTextHover,
colorItemBgActive: colorFillContent,
colorSubItemBg: colorFillAlter,
colorItemBgSelected: controlItemBgActive,
colorItemBgSelectedHorizontal: "transparent",
colorActiveBarWidth: 0,
colorActiveBarHeight: lineWidthBold,
colorActiveBarBorderSize: lineWidth,
// Disabled
colorItemTextDisabled: colorTextDisabled,
// Danger
colorDangerItemText: colorError,
colorDangerItemTextHover: colorError,
colorDangerItemTextSelected: colorError,
colorDangerItemBgActive: colorErrorBg,
colorDangerItemBgSelected: colorErrorBg,
itemMarginInline: token.marginXXS
};
});
return useOriginHook(prefixCls);
});
const menuProps = () => ({
id: String,
prefixCls: String,
// donot use items, now only support inner use
items: Array,
disabled: Boolean,
inlineCollapsed: Boolean,
disabledOverflow: Boolean,
forceSubMenuRender: Boolean,
openKeys: Array,
selectedKeys: Array,
activeKey: String,
selectable: {
type: Boolean,
default: true
},
multiple: {
type: Boolean,
default: false
},
tabindex: {
type: [Number, String]
},
motion: Object,
role: String,
theme: {
type: String,
default: "light"
},
mode: {
type: String,
default: "vertical"
},
inlineIndent: {
type: Number,
default: 24
},
subMenuOpenDelay: {
type: Number,
default: 0
},
subMenuCloseDelay: {
type: Number,
default: 0.1
},
builtinPlacements: {
type: Object
},
triggerSubMenuAction: {
type: String,
default: "hover"
},
getPopupContainer: Function,
expandIcon: Function,
onOpenChange: Function,
onSelect: Function,
onDeselect: Function,
onClick: [Function, Array],
onFocus: Function,
onBlur: Function,
onMousedown: Function,
"onUpdate:openKeys": Function,
"onUpdate:selectedKeys": Function,
"onUpdate:activeKey": Function
});
const EMPTY_LIST$2 = [];
const Menu = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMenu",
inheritAttrs: false,
props: menuProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
emit,
attrs
} = _ref;
const {
direction,
getPrefixCls
} = useConfigInject("menu", props2);
const override = useInjectOverride();
const prefixCls = computed(() => {
var _a;
return getPrefixCls("menu", props2.prefixCls || ((_a = override === null || override === void 0 ? void 0 : override.prefixCls) === null || _a === void 0 ? void 0 : _a.value));
});
const [wrapSSR, hashId] = useStyle$N(prefixCls, computed(() => {
return !override;
}));
const store = shallowRef(/* @__PURE__ */ new Map());
const siderCollapsed = inject(SiderCollapsedKey, ref(void 0));
const inlineCollapsed = computed(() => {
if (siderCollapsed.value !== void 0) {
return siderCollapsed.value;
}
return props2.inlineCollapsed;
});
const {
itemsNodes
} = useItems(props2);
const isMounted = shallowRef(false);
watchEffect(() => {
devWarning(!(props2.inlineCollapsed === true && props2.mode !== "inline"), "Menu", "`inlineCollapsed` should only be used when `mode` is inline.");
devWarning(!(siderCollapsed.value !== void 0 && props2.inlineCollapsed === true), "Menu", "`inlineCollapsed` not control Menu under Sider. Should set `collapsed` on Sider instead.");
});
const activeKeys = ref([]);
const mergedSelectedKeys = ref([]);
const keyMapStore = ref({});
watch(store, () => {
const newKeyMapStore = {};
for (const menuInfo of store.value.values()) {
newKeyMapStore[menuInfo.key] = menuInfo;
}
keyMapStore.value = newKeyMapStore;
}, {
flush: "post"
});
watchEffect(() => {
if (props2.activeKey !== void 0) {
let keys = [];
const menuInfo = props2.activeKey ? keyMapStore.value[props2.activeKey] : void 0;
if (menuInfo && props2.activeKey !== void 0) {
keys = uniq([].concat(unref(menuInfo.parentKeys), props2.activeKey));
} else {
keys = [];
}
if (!shallowequal(activeKeys.value, keys)) {
activeKeys.value = keys;
}
}
});
watch(() => props2.selectedKeys, (selectedKeys) => {
if (selectedKeys) {
mergedSelectedKeys.value = selectedKeys.slice();
}
}, {
immediate: true,
deep: true
});
const selectedSubMenuKeys = ref([]);
watch([keyMapStore, mergedSelectedKeys], () => {
let subMenuParentKeys = [];
mergedSelectedKeys.value.forEach((key2) => {
const menuInfo = keyMapStore.value[key2];
if (menuInfo) {
subMenuParentKeys = subMenuParentKeys.concat(unref(menuInfo.parentKeys));
}
});
subMenuParentKeys = uniq(subMenuParentKeys);
if (!shallowequal(selectedSubMenuKeys.value, subMenuParentKeys)) {
selectedSubMenuKeys.value = subMenuParentKeys;
}
}, {
immediate: true
});
const triggerSelection = (info) => {
if (props2.selectable) {
const {
key: targetKey
} = info;
const exist = mergedSelectedKeys.value.includes(targetKey);
let newSelectedKeys;
if (props2.multiple) {
if (exist) {
newSelectedKeys = mergedSelectedKeys.value.filter((key2) => key2 !== targetKey);
} else {
newSelectedKeys = [...mergedSelectedKeys.value, targetKey];
}
} else {
newSelectedKeys = [targetKey];
}
const selectInfo = _extends(_extends({}, info), {
selectedKeys: newSelectedKeys
});
if (!shallowequal(newSelectedKeys, mergedSelectedKeys.value)) {
if (props2.selectedKeys === void 0) {
mergedSelectedKeys.value = newSelectedKeys;
}
emit("update:selectedKeys", newSelectedKeys);
if (exist && props2.multiple) {
emit("deselect", selectInfo);
} else {
emit("select", selectInfo);
}
}
}
if (mergedMode.value !== "inline" && !props2.multiple && mergedOpenKeys.value.length) {
triggerOpenKeys(EMPTY_LIST$2);
}
};
const mergedOpenKeys = ref([]);
watch(() => props2.openKeys, function() {
let openKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : mergedOpenKeys.value;
if (!shallowequal(mergedOpenKeys.value, openKeys)) {
mergedOpenKeys.value = openKeys.slice();
}
}, {
immediate: true,
deep: true
});
let timeout;
const changeActiveKeys = (keys) => {
clearTimeout(timeout);
timeout = setTimeout(() => {
if (props2.activeKey === void 0) {
activeKeys.value = keys;
}
emit("update:activeKey", keys[keys.length - 1]);
});
};
const disabled = computed(() => !!props2.disabled);
const isRtl = computed(() => direction.value === "rtl");
const mergedMode = ref("vertical");
const mergedInlineCollapsed = shallowRef(false);
watchEffect(() => {
var _a;
if ((props2.mode === "inline" || props2.mode === "vertical") && inlineCollapsed.value) {
mergedMode.value = "vertical";
mergedInlineCollapsed.value = inlineCollapsed.value;
} else {
mergedMode.value = props2.mode;
mergedInlineCollapsed.value = false;
}
if ((_a = override === null || override === void 0 ? void 0 : override.mode) === null || _a === void 0 ? void 0 : _a.value) {
mergedMode.value = override.mode.value;
}
});
const isInlineMode = computed(() => mergedMode.value === "inline");
const triggerOpenKeys = (keys) => {
mergedOpenKeys.value = keys;
emit("update:openKeys", keys);
emit("openChange", keys);
};
const inlineCacheOpenKeys = ref(mergedOpenKeys.value);
const mountRef = shallowRef(false);
watch(mergedOpenKeys, () => {
if (isInlineMode.value) {
inlineCacheOpenKeys.value = mergedOpenKeys.value;
}
}, {
immediate: true
});
watch(isInlineMode, () => {
if (!mountRef.value) {
mountRef.value = true;
return;
}
if (isInlineMode.value) {
mergedOpenKeys.value = inlineCacheOpenKeys.value;
} else {
triggerOpenKeys(EMPTY_LIST$2);
}
}, {
immediate: true
});
const className = computed(() => {
return {
[`${prefixCls.value}`]: true,
[`${prefixCls.value}-root`]: true,
[`${prefixCls.value}-${mergedMode.value}`]: true,
[`${prefixCls.value}-inline-collapsed`]: mergedInlineCollapsed.value,
[`${prefixCls.value}-rtl`]: isRtl.value,
[`${prefixCls.value}-${props2.theme}`]: true
};
});
const rootPrefixCls = computed(() => getPrefixCls());
const defaultMotions = computed(() => ({
horizontal: {
name: `${rootPrefixCls.value}-slide-up`
},
inline: collapseMotion(`${rootPrefixCls.value}-motion-collapse`),
other: {
name: `${rootPrefixCls.value}-zoom-big`
}
}));
useProvideFirstLevel(true);
const getChildrenKeys = function() {
let eventKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
const keys = [];
const storeValue = store.value;
eventKeys.forEach((eventKey) => {
const {
key: key2,
childrenEventKeys
} = storeValue.get(eventKey);
keys.push(key2, ...getChildrenKeys(unref(childrenEventKeys)));
});
return keys;
};
const onInternalClick = (info) => {
var _a;
emit("click", info);
triggerSelection(info);
(_a = override === null || override === void 0 ? void 0 : override.onClick) === null || _a === void 0 ? void 0 : _a.call(override);
};
const onInternalOpenChange = (key2, open2) => {
var _a;
const childrenEventKeys = ((_a = keyMapStore.value[key2]) === null || _a === void 0 ? void 0 : _a.childrenEventKeys) || [];
let newOpenKeys = mergedOpenKeys.value.filter((k) => k !== key2);
if (open2) {
newOpenKeys.push(key2);
} else if (mergedMode.value !== "inline") {
const subPathKeys = getChildrenKeys(unref(childrenEventKeys));
newOpenKeys = uniq(newOpenKeys.filter((k) => !subPathKeys.includes(k)));
}
if (!shallowequal(mergedOpenKeys, newOpenKeys)) {
triggerOpenKeys(newOpenKeys);
}
};
const registerMenuInfo = (key2, info) => {
store.value.set(key2, info);
store.value = new Map(store.value);
};
const unRegisterMenuInfo = (key2) => {
store.value.delete(key2);
store.value = new Map(store.value);
};
const lastVisibleIndex = ref(0);
const expandIcon = computed(() => {
var _a;
return props2.expandIcon || slots.expandIcon || ((_a = override === null || override === void 0 ? void 0 : override.expandIcon) === null || _a === void 0 ? void 0 : _a.value) ? (opt) => {
let icon = props2.expandIcon || slots.expandIcon;
icon = typeof icon === "function" ? icon(opt) : icon;
return cloneElement(icon, {
class: `${prefixCls.value}-submenu-expand-icon`
}, false);
} : null;
});
useProvideMenu({
prefixCls,
activeKeys,
openKeys: mergedOpenKeys,
selectedKeys: mergedSelectedKeys,
changeActiveKeys,
disabled,
rtl: isRtl,
mode: mergedMode,
inlineIndent: computed(() => props2.inlineIndent),
subMenuCloseDelay: computed(() => props2.subMenuCloseDelay),
subMenuOpenDelay: computed(() => props2.subMenuOpenDelay),
builtinPlacements: computed(() => props2.builtinPlacements),
triggerSubMenuAction: computed(() => props2.triggerSubMenuAction),
getPopupContainer: computed(() => props2.getPopupContainer),
inlineCollapsed: mergedInlineCollapsed,
theme: computed(() => props2.theme),
siderCollapsed,
defaultMotions: computed(() => isMounted.value ? defaultMotions.value : null),
motion: computed(() => isMounted.value ? props2.motion : null),
overflowDisabled: shallowRef(void 0),
onOpenChange: onInternalOpenChange,
onItemClick: onInternalClick,
registerMenuInfo,
unRegisterMenuInfo,
selectedSubMenuKeys,
expandIcon,
forceSubMenuRender: computed(() => props2.forceSubMenuRender),
rootClassName: hashId
});
const getChildrenList = () => {
var _a;
return itemsNodes.value || flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
};
return () => {
var _a;
const childList = getChildrenList();
const allVisible = lastVisibleIndex.value >= childList.length - 1 || mergedMode.value !== "horizontal" || props2.disabledOverflow;
const getWrapperList = (childList2) => {
return mergedMode.value !== "horizontal" || props2.disabledOverflow ? childList2 : (
// Need wrap for overflow dropdown that do not response for open
childList2.map((child, index2) => (
// Always wrap provider to avoid sub node re-mount
createVNode(MenuContextProvider, {
"key": child.key,
"overflowDisabled": index2 > lastVisibleIndex.value
}, {
default: () => child
})
))
);
};
const overflowedIndicator = ((_a = slots.overflowedIndicator) === null || _a === void 0 ? void 0 : _a.call(slots)) || createVNode(EllipsisOutlined, null, null);
return wrapSSR(createVNode(Overflow, _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"onMousedown": props2.onMousedown,
"prefixCls": `${prefixCls.value}-overflow`,
"component": "ul",
"itemComponent": __nuxt_component_1$5,
"class": [className.value, attrs.class, hashId.value],
"role": "menu",
"id": props2.id,
"data": getWrapperList(childList),
"renderRawItem": (node) => node,
"renderRawRest": (omitItems) => {
const len = omitItems.length;
const originOmitItems = len ? childList.slice(-len) : null;
return createVNode(Fragment, null, [createVNode(SubMenu$1, {
"eventKey": OVERFLOW_KEY,
"key": OVERFLOW_KEY,
"title": overflowedIndicator,
"disabled": allVisible,
"internalPopupClose": len === 0
}, {
default: () => originOmitItems
}), createVNode(PathContext, null, {
default: () => [createVNode(SubMenu$1, {
"eventKey": OVERFLOW_KEY,
"key": OVERFLOW_KEY,
"title": overflowedIndicator,
"disabled": allVisible,
"internalPopupClose": len === 0
}, {
default: () => originOmitItems
})]
})]);
},
"maxCount": mergedMode.value !== "horizontal" || props2.disabledOverflow ? Overflow.INVALIDATE : Overflow.RESPONSIVE,
"ssr": "full",
"data-menu-list": true,
"onVisibleChange": (newLastIndex) => {
lastVisibleIndex.value = newLastIndex;
}
}), {
default: () => [createVNode(Teleport, {
"to": "body"
}, {
default: () => [createVNode("div", {
"style": {
display: "none"
},
"aria-hidden": true
}, [createVNode(PathContext, null, {
default: () => [getWrapperList(getChildrenList())]
})])]
})]
}));
};
}
});
Menu.install = function(app) {
app.component(Menu.name, Menu);
app.component(__nuxt_component_1$5.name, __nuxt_component_1$5);
app.component(SubMenu$1.name, SubMenu$1);
app.component(Divider$1.name, Divider$1);
app.component(ItemGroup.name, ItemGroup);
return app;
};
Menu.Item = __nuxt_component_1$5;
Menu.Divider = Divider$1;
Menu.SubMenu = SubMenu$1;
Menu.ItemGroup = ItemGroup;
const genBreadcrumbStyle = (token) => {
const {
componentCls,
iconCls
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
color: token.breadcrumbBaseColor,
fontSize: token.breadcrumbFontSize,
[iconCls]: {
fontSize: token.breadcrumbIconFontSize
},
ol: {
display: "flex",
flexWrap: "wrap",
margin: 0,
padding: 0,
listStyle: "none"
},
a: _extends({
color: token.breadcrumbLinkColor,
transition: `color ${token.motionDurationMid}`,
padding: `0 ${token.paddingXXS}px`,
borderRadius: token.borderRadiusSM,
height: token.lineHeight * token.fontSize,
display: "inline-block",
marginInline: -token.marginXXS,
"&:hover": {
color: token.breadcrumbLinkColorHover,
backgroundColor: token.colorBgTextHover
}
}, genFocusStyle(token)),
[`li:last-child`]: {
color: token.breadcrumbLastItemColor,
[`& > ${componentCls}-separator`]: {
display: "none"
}
},
[`${componentCls}-separator`]: {
marginInline: token.breadcrumbSeparatorMargin,
color: token.breadcrumbSeparatorColor
},
[`${componentCls}-link`]: {
[`
> ${iconCls} + span,
> ${iconCls} + a
`]: {
marginInlineStart: token.marginXXS
}
},
[`${componentCls}-overlay-link`]: {
borderRadius: token.borderRadiusSM,
height: token.lineHeight * token.fontSize,
display: "inline-block",
padding: `0 ${token.paddingXXS}px`,
marginInline: -token.marginXXS,
[`> ${iconCls}`]: {
marginInlineStart: token.marginXXS,
fontSize: token.fontSizeIcon
},
"&:hover": {
color: token.breadcrumbLinkColorHover,
backgroundColor: token.colorBgTextHover,
a: {
color: token.breadcrumbLinkColorHover
}
},
a: {
"&:hover": {
backgroundColor: "transparent"
}
}
},
// rtl style
[`&${token.componentCls}-rtl`]: {
direction: "rtl"
}
})
};
};
const useStyle$M = genComponentStyleHook("Breadcrumb", (token) => {
const BreadcrumbToken = merge(token, {
breadcrumbBaseColor: token.colorTextDescription,
breadcrumbFontSize: token.fontSize,
breadcrumbIconFontSize: token.fontSize,
breadcrumbLinkColor: token.colorTextDescription,
breadcrumbLinkColorHover: token.colorText,
breadcrumbLastItemColor: token.colorText,
breadcrumbSeparatorMargin: token.marginXS,
breadcrumbSeparatorColor: token.colorTextDescription
});
return [genBreadcrumbStyle(BreadcrumbToken)];
});
const breadcrumbProps = () => ({
prefixCls: String,
routes: {
type: Array
},
params: PropTypes.any,
separator: PropTypes.any,
itemRender: {
type: Function
}
});
function getBreadcrumbName(route, params) {
if (!route.breadcrumbName) {
return null;
}
const paramsKeys = Object.keys(params).join("|");
const name = route.breadcrumbName.replace(new RegExp(`:(${paramsKeys})`, "g"), (replacement, key2) => params[key2] || replacement);
return name;
}
function defaultItemRender$1(opt) {
const {
route,
params,
routes,
paths
} = opt;
const isLastItem = routes.indexOf(route) === routes.length - 1;
const name = getBreadcrumbName(route, params);
return isLastItem ? createVNode("span", null, [name]) : createVNode("a", {
"href": `#/${paths.join("/")}`
}, [name]);
}
const Breadcrumb = defineComponent({
compatConfig: {
MODE: 3
},
name: "ABreadcrumb",
inheritAttrs: false,
props: breadcrumbProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("breadcrumb", props2);
const [wrapSSR, hashId] = useStyle$M(prefixCls);
const getPath = (path2, params) => {
path2 = (path2 || "").replace(/^\//, "");
Object.keys(params).forEach((key2) => {
path2 = path2.replace(`:${key2}`, params[key2]);
});
return path2;
};
const addChildPath = (paths, childPath, params) => {
const originalPaths = [...paths];
const path2 = getPath(childPath || "", params);
if (path2) {
originalPaths.push(path2);
}
return originalPaths;
};
const genForRoutes = (_ref2) => {
let {
routes = [],
params = {},
separator,
itemRender = defaultItemRender$1
} = _ref2;
const paths = [];
return routes.map((route) => {
const path2 = getPath(route.path, params);
if (path2) {
paths.push(path2);
}
const tempPaths = [...paths];
let overlay = null;
if (route.children && route.children.length) {
overlay = createVNode(Menu, {
"items": route.children.map((child) => ({
key: child.path || child.breadcrumbName,
label: itemRender({
route: child,
params,
routes,
paths: addChildPath(tempPaths, child.path, params)
})
}))
}, null);
}
const itemProps = {
separator
};
if (overlay) {
itemProps.overlay = overlay;
}
return createVNode(BreadcrumbItem, _objectSpread$W(_objectSpread$W({}, itemProps), {}, {
"key": path2 || route.breadcrumbName
}), {
default: () => [itemRender({
route,
params,
routes,
paths: tempPaths
})]
});
});
};
return () => {
var _a;
let crumbs;
const {
routes,
params = {}
} = props2;
const children = flattenChildren(getPropsSlot(slots, props2));
const separator = (_a = getPropsSlot(slots, props2, "separator")) !== null && _a !== void 0 ? _a : "/";
const itemRender = props2.itemRender || slots.itemRender || defaultItemRender$1;
if (routes && routes.length > 0) {
crumbs = genForRoutes({
routes,
params,
separator,
itemRender
});
} else if (children.length) {
crumbs = children.map((element, index2) => {
warning(typeof element.type === "object" && (element.type.__ANT_BREADCRUMB_ITEM || element.type.__ANT_BREADCRUMB_SEPARATOR));
return cloneVNode(element, {
separator,
key: index2
});
});
}
const breadcrumbClassName = {
[prefixCls.value]: true,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${attrs.class}`]: !!attrs.class,
[hashId.value]: true
};
return wrapSSR(createVNode("nav", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": breadcrumbClassName
}), [createVNode("ol", null, [crumbs])]));
};
}
});
var __rest$_ = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const breadcrumbSeparatorProps = () => ({
prefixCls: String
});
const BreadcrumbSeparator = defineComponent({
compatConfig: {
MODE: 3
},
name: "ABreadcrumbSeparator",
__ANT_BREADCRUMB_SEPARATOR: true,
inheritAttrs: false,
props: breadcrumbSeparatorProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls
} = useConfigInject("breadcrumb", props2);
return () => {
var _a;
const {
separator,
class: className
} = attrs, restAttrs = __rest$_(attrs, ["separator", "class"]);
const children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
return createVNode("span", _objectSpread$W({
"class": [`${prefixCls.value}-separator`, className]
}, restAttrs), [children.length > 0 ? children : "/"]);
};
}
});
Breadcrumb.Item = BreadcrumbItem;
Breadcrumb.Separator = BreadcrumbSeparator;
Breadcrumb.install = function(app) {
app.component(Breadcrumb.name, Breadcrumb);
app.component(BreadcrumbItem.name, BreadcrumbItem);
app.component(BreadcrumbSeparator.name, BreadcrumbSeparator);
return app;
};
dayjs.extend(customParseFormat);
dayjs.extend(advancedFormat);
dayjs.extend(weekday);
dayjs.extend(localeData);
dayjs.extend(weekOfYear);
dayjs.extend(weekYear);
dayjs.extend(quarterOfYear);
dayjs.extend((_o, c) => {
const proto = c.prototype;
const oldFormat = proto.format;
proto.format = function f(formatStr) {
const str = (formatStr || "").replace("Wo", "wo");
return oldFormat.bind(this)(str);
};
});
const localeMap = {
// ar_EG:
// az_AZ:
// bg_BG:
bn_BD: "bn-bd",
by_BY: "be",
// ca_ES:
// cs_CZ:
// da_DK:
// de_DE:
// el_GR:
en_GB: "en-gb",
en_US: "en",
// es_ES:
// et_EE:
// fa_IR:
// fi_FI:
fr_BE: "fr",
fr_CA: "fr-ca",
// fr_FR:
// ga_IE:
// gl_ES:
// he_IL:
// hi_IN:
// hr_HR:
// hu_HU:
hy_AM: "hy-am",
// id_ID:
// is_IS:
// it_IT:
// ja_JP:
// ka_GE:
// kk_KZ:
// km_KH:
kmr_IQ: "ku",
// kn_IN:
// ko_KR:
// ku_IQ: // previous ku in antd
// lt_LT:
// lv_LV:
// mk_MK:
// ml_IN:
// mn_MN:
// ms_MY:
// nb_NO:
// ne_NP:
nl_BE: "nl-be",
// nl_NL:
// pl_PL:
pt_BR: "pt-br",
// pt_PT:
// ro_RO:
// ru_RU:
// sk_SK:
// sl_SI:
// sr_RS:
// sv_SE:
// ta_IN:
// th_TH:
// tr_TR:
// uk_UA:
// ur_PK:
// vi_VN:
zh_CN: "zh-cn",
zh_HK: "zh-hk",
zh_TW: "zh-tw"
};
const parseLocale = (locale2) => {
const mapLocale = localeMap[locale2];
return mapLocale || locale2.split("_")[0];
};
const parseNoMatchNotice = () => {
noteOnce(false, "Not match any format. Please help to fire a issue about this.");
};
const advancedFormatRegex = /\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|k{1,2}|S/g;
function findTargetStr(val, index2, segmentation) {
const items = [...new Set(val.split(segmentation))];
let idx = 0;
for (let i = 0; i < items.length; i++) {
const item = items[i];
idx += item.length;
if (idx > index2) {
return item;
}
idx += segmentation.length;
}
}
const toDateWithValueFormat = (val, valueFormat) => {
if (!val) return null;
if (dayjs.isDayjs(val)) {
return val;
}
const matchs = valueFormat.matchAll(advancedFormatRegex);
let baseDate = dayjs(val, valueFormat);
if (matchs === null) {
return baseDate;
}
for (const match2 of matchs) {
const origin = match2[0];
const index2 = match2["index"];
if (origin === "Q") {
const segmentation = val.slice(index2 - 1, index2);
const quarterStr = findTargetStr(val, index2, segmentation).match(/\d+/)[0];
baseDate = baseDate.quarter(parseInt(quarterStr));
}
if (origin.toLowerCase() === "wo") {
const segmentation = val.slice(index2 - 1, index2);
const weekStr = findTargetStr(val, index2, segmentation).match(/\d+/)[0];
baseDate = baseDate.week(parseInt(weekStr));
}
if (origin.toLowerCase() === "ww") {
baseDate = baseDate.week(parseInt(val.slice(index2, index2 + origin.length)));
}
if (origin.toLowerCase() === "w") {
baseDate = baseDate.week(parseInt(val.slice(index2, index2 + origin.length + 1)));
}
}
return baseDate;
};
const generateConfig = {
// get
getNow: () => dayjs(),
getFixedDate: (string) => dayjs(string, ["YYYY-M-DD", "YYYY-MM-DD"]),
getEndDate: (date) => date.endOf("month"),
getWeekDay: (date) => {
const clone = date.locale("en");
return clone.weekday() + clone.localeData().firstDayOfWeek();
},
getYear: (date) => date.year(),
getMonth: (date) => date.month(),
getDate: (date) => date.date(),
getHour: (date) => date.hour(),
getMinute: (date) => date.minute(),
getSecond: (date) => date.second(),
// set
addYear: (date, diff) => date.add(diff, "year"),
addMonth: (date, diff) => date.add(diff, "month"),
addDate: (date, diff) => date.add(diff, "day"),
setYear: (date, year) => date.year(year),
setMonth: (date, month) => date.month(month),
setDate: (date, num) => date.date(num),
setHour: (date, hour) => date.hour(hour),
setMinute: (date, minute) => date.minute(minute),
setSecond: (date, second) => date.second(second),
// Compare
isAfter: (date1, date2) => date1.isAfter(date2),
isValidate: (date) => date.isValid(),
locale: {
getWeekFirstDay: (locale2) => dayjs().locale(parseLocale(locale2)).localeData().firstDayOfWeek(),
getWeekFirstDate: (locale2, date) => date.locale(parseLocale(locale2)).weekday(0),
getWeek: (locale2, date) => date.locale(parseLocale(locale2)).week(),
getShortWeekDays: (locale2) => dayjs().locale(parseLocale(locale2)).localeData().weekdaysMin(),
getShortMonths: (locale2) => dayjs().locale(parseLocale(locale2)).localeData().monthsShort(),
format: (locale2, date, format2) => date.locale(parseLocale(locale2)).format(format2),
parse: (locale2, text, formats) => {
const localeStr = parseLocale(locale2);
for (let i = 0; i < formats.length; i += 1) {
const format2 = formats[i];
const formatText = text;
if (format2.includes("wo") || format2.includes("Wo")) {
const year = formatText.split("-")[0];
const weekStr = formatText.split("-")[1];
const firstWeek = dayjs(year, "YYYY").startOf("year").locale(localeStr);
for (let j = 0; j <= 52; j += 1) {
const nextWeek = firstWeek.add(j, "week");
if (nextWeek.format("Wo") === weekStr) {
return nextWeek;
}
}
parseNoMatchNotice();
return null;
}
const date = dayjs(formatText, format2, true).locale(localeStr);
if (date.isValid()) {
return date;
}
}
if (!text) {
parseNoMatchNotice();
}
return null;
}
},
toDate: (value, valueFormat) => {
if (Array.isArray(value)) {
return value.map((val) => toDateWithValueFormat(val, valueFormat));
} else {
return toDateWithValueFormat(value, valueFormat);
}
},
toString: (value, valueFormat) => {
if (Array.isArray(value)) {
return value.map((val) => dayjs.isDayjs(val) ? val.format(valueFormat) : val);
} else {
return dayjs.isDayjs(value) ? value.format(valueFormat) : value;
}
}
};
function useMergeProps(props2) {
const attrs = useAttrs();
return _extends(_extends({}, props2), attrs);
}
const PanelContextKey = Symbol("PanelContextProps");
const useProvidePanel = (props2) => {
provide(PanelContextKey, props2);
};
const useInjectPanel = () => {
return inject(PanelContextKey, {});
};
const HIDDEN_STYLE$2 = {
visibility: "hidden"
};
function Header$2(_props, _ref) {
let {
slots
} = _ref;
var _a;
const props2 = useMergeProps(_props);
const {
prefixCls,
prevIcon = "‹",
nextIcon = "›",
superPrevIcon = "«",
superNextIcon = "»",
onSuperPrev,
onSuperNext,
onPrev,
onNext
} = props2;
const {
hideNextBtn,
hidePrevBtn
} = useInjectPanel();
return createVNode("div", {
"class": prefixCls
}, [onSuperPrev && createVNode("button", {
"type": "button",
"onClick": onSuperPrev,
"tabindex": -1,
"class": `${prefixCls}-super-prev-btn`,
"style": hidePrevBtn.value ? HIDDEN_STYLE$2 : {}
}, [superPrevIcon]), onPrev && createVNode("button", {
"type": "button",
"onClick": onPrev,
"tabindex": -1,
"class": `${prefixCls}-prev-btn`,
"style": hidePrevBtn.value ? HIDDEN_STYLE$2 : {}
}, [prevIcon]), createVNode("div", {
"class": `${prefixCls}-view`
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]), onNext && createVNode("button", {
"type": "button",
"onClick": onNext,
"tabindex": -1,
"class": `${prefixCls}-next-btn`,
"style": hideNextBtn.value ? HIDDEN_STYLE$2 : {}
}, [nextIcon]), onSuperNext && createVNode("button", {
"type": "button",
"onClick": onSuperNext,
"tabindex": -1,
"class": `${prefixCls}-super-next-btn`,
"style": hideNextBtn.value ? HIDDEN_STYLE$2 : {}
}, [superNextIcon])]);
}
Header$2.displayName = "Header";
Header$2.inheritAttrs = false;
function DecadeHeader(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
generateConfig: generateConfig2,
viewDate,
onPrevDecades,
onNextDecades
} = props2;
const {
hideHeader
} = useInjectPanel();
if (hideHeader) {
return null;
}
const headerPrefixCls = `${prefixCls}-header`;
const yearNumber = generateConfig2.getYear(viewDate);
const startYear = Math.floor(yearNumber / DECADE_DISTANCE_COUNT) * DECADE_DISTANCE_COUNT;
const endYear = startYear + DECADE_DISTANCE_COUNT - 1;
return createVNode(Header$2, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevDecades,
"onSuperNext": onNextDecades
}), {
default: () => [startYear, createTextVNode("-"), endYear]
});
}
DecadeHeader.displayName = "DecadeHeader";
DecadeHeader.inheritAttrs = false;
function setTime(generateConfig2, date, hour, minute, second) {
let nextTime = generateConfig2.setHour(date, hour);
nextTime = generateConfig2.setMinute(nextTime, minute);
nextTime = generateConfig2.setSecond(nextTime, second);
return nextTime;
}
function setDateTime(generateConfig2, date, defaultDate) {
if (!defaultDate) {
return date;
}
let newDate = date;
newDate = generateConfig2.setHour(newDate, generateConfig2.getHour(defaultDate));
newDate = generateConfig2.setMinute(newDate, generateConfig2.getMinute(defaultDate));
newDate = generateConfig2.setSecond(newDate, generateConfig2.getSecond(defaultDate));
return newDate;
}
function getLowerBoundTime(hour, minute, second, hourStep, minuteStep, secondStep) {
const lowerBoundHour = Math.floor(hour / hourStep) * hourStep;
if (lowerBoundHour < hour) {
return [lowerBoundHour, 60 - minuteStep, 60 - secondStep];
}
const lowerBoundMinute = Math.floor(minute / minuteStep) * minuteStep;
if (lowerBoundMinute < minute) {
return [lowerBoundHour, lowerBoundMinute, 60 - secondStep];
}
const lowerBoundSecond = Math.floor(second / secondStep) * secondStep;
return [lowerBoundHour, lowerBoundMinute, lowerBoundSecond];
}
function getLastDay(generateConfig2, date) {
const year = generateConfig2.getYear(date);
const month = generateConfig2.getMonth(date) + 1;
const endDate = generateConfig2.getEndDate(generateConfig2.getFixedDate(`${year}-${month}-01`));
const lastDay = generateConfig2.getDate(endDate);
const monthShow = month < 10 ? `0${month}` : `${month}`;
return `${year}-${monthShow}-${lastDay}`;
}
function PanelBody(_props) {
const {
prefixCls,
disabledDate,
onSelect,
picker,
rowNum,
colNum,
prefixColumn,
rowClassName,
baseDate,
getCellClassName,
getCellText,
getCellNode,
getCellDate,
generateConfig: generateConfig2,
titleCell,
headerCells
} = useMergeProps(_props);
const {
onDateMouseenter,
onDateMouseleave,
mode
} = useInjectPanel();
const cellPrefixCls = `${prefixCls}-cell`;
const rows = [];
for (let i = 0; i < rowNum; i += 1) {
const row = [];
let rowStartDate;
for (let j = 0; j < colNum; j += 1) {
const offset2 = i * colNum + j;
const currentDate = getCellDate(baseDate, offset2);
const disabled = getCellDateDisabled({
cellDate: currentDate,
mode: mode.value,
disabledDate,
generateConfig: generateConfig2
});
if (j === 0) {
rowStartDate = currentDate;
if (prefixColumn) {
row.push(prefixColumn(rowStartDate));
}
}
const title = titleCell && titleCell(currentDate);
row.push(createVNode("td", {
"key": j,
"title": title,
"class": classNames(cellPrefixCls, _extends({
[`${cellPrefixCls}-disabled`]: disabled,
[`${cellPrefixCls}-start`]: getCellText(currentDate) === 1 || picker === "year" && Number(title) % 10 === 0,
[`${cellPrefixCls}-end`]: title === getLastDay(generateConfig2, currentDate) || picker === "year" && Number(title) % 10 === 9
}, getCellClassName(currentDate))),
"onClick": (e) => {
e.stopPropagation();
if (!disabled) {
onSelect(currentDate);
}
},
"onMouseenter": () => {
if (!disabled && onDateMouseenter) {
onDateMouseenter(currentDate);
}
},
"onMouseleave": () => {
if (!disabled && onDateMouseleave) {
onDateMouseleave(currentDate);
}
}
}, [getCellNode ? getCellNode(currentDate) : createVNode("div", {
"class": `${cellPrefixCls}-inner`
}, [getCellText(currentDate)])]));
}
rows.push(createVNode("tr", {
"key": i,
"class": rowClassName && rowClassName(rowStartDate)
}, [row]));
}
return createVNode("div", {
"class": `${prefixCls}-body`
}, [createVNode("table", {
"class": `${prefixCls}-content`
}, [headerCells && createVNode("thead", null, [createVNode("tr", null, [headerCells])]), createVNode("tbody", null, [rows])])]);
}
PanelBody.displayName = "PanelBody";
PanelBody.inheritAttrs = false;
const DECADE_COL_COUNT = 3;
const DECADE_ROW_COUNT = 4;
function DecadeBody(_props) {
const props2 = useMergeProps(_props);
const DECADE_UNIT_DIFF_DES = DECADE_UNIT_DIFF - 1;
const {
prefixCls,
viewDate,
generateConfig: generateConfig2
} = props2;
const cellPrefixCls = `${prefixCls}-cell`;
const yearNumber = generateConfig2.getYear(viewDate);
const decadeYearNumber = Math.floor(yearNumber / DECADE_UNIT_DIFF) * DECADE_UNIT_DIFF;
const startDecadeYear = Math.floor(yearNumber / DECADE_DISTANCE_COUNT) * DECADE_DISTANCE_COUNT;
const endDecadeYear = startDecadeYear + DECADE_DISTANCE_COUNT - 1;
const baseDecadeYear = generateConfig2.setYear(viewDate, startDecadeYear - Math.ceil((DECADE_COL_COUNT * DECADE_ROW_COUNT * DECADE_UNIT_DIFF - DECADE_DISTANCE_COUNT) / 2));
const getCellClassName = (date) => {
const startDecadeNumber = generateConfig2.getYear(date);
const endDecadeNumber = startDecadeNumber + DECADE_UNIT_DIFF_DES;
return {
[`${cellPrefixCls}-in-view`]: startDecadeYear <= startDecadeNumber && endDecadeNumber <= endDecadeYear,
[`${cellPrefixCls}-selected`]: startDecadeNumber === decadeYearNumber
};
};
return createVNode(PanelBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"rowNum": DECADE_ROW_COUNT,
"colNum": DECADE_COL_COUNT,
"baseDate": baseDecadeYear,
"getCellText": (date) => {
const startDecadeNumber = generateConfig2.getYear(date);
return `${startDecadeNumber}-${startDecadeNumber + DECADE_UNIT_DIFF_DES}`;
},
"getCellClassName": getCellClassName,
"getCellDate": (date, offset2) => generateConfig2.addYear(date, offset2 * DECADE_UNIT_DIFF)
}), null);
}
DecadeBody.displayName = "DecadeBody";
DecadeBody.inheritAttrs = false;
const scrollIds = /* @__PURE__ */ new Map();
function waitElementReady(element, callback) {
let id;
function tryOrNextFrame() {
if (isVisible(element)) {
callback();
} else {
id = wrapperRaf(() => {
tryOrNextFrame();
});
}
}
tryOrNextFrame();
return () => {
wrapperRaf.cancel(id);
};
}
function scrollTo(element, to, duration) {
if (scrollIds.get(element)) {
wrapperRaf.cancel(scrollIds.get(element));
}
if (duration <= 0) {
scrollIds.set(element, wrapperRaf(() => {
element.scrollTop = to;
}));
return;
}
const difference = to - element.scrollTop;
const perTick = difference / duration * 10;
scrollIds.set(element, wrapperRaf(() => {
element.scrollTop += perTick;
if (element.scrollTop !== to) {
scrollTo(element, to, duration - 10);
}
}));
}
function createKeydownHandler(event, _ref) {
let {
onLeftRight,
onCtrlLeftRight,
onUpDown,
onPageUpDown,
onEnter
} = _ref;
const {
which,
ctrlKey,
metaKey
} = event;
switch (which) {
case KeyCode.LEFT:
if (ctrlKey || metaKey) {
if (onCtrlLeftRight) {
onCtrlLeftRight(-1);
return true;
}
} else if (onLeftRight) {
onLeftRight(-1);
return true;
}
break;
case KeyCode.RIGHT:
if (ctrlKey || metaKey) {
if (onCtrlLeftRight) {
onCtrlLeftRight(1);
return true;
}
} else if (onLeftRight) {
onLeftRight(1);
return true;
}
break;
case KeyCode.UP:
if (onUpDown) {
onUpDown(-1);
return true;
}
break;
case KeyCode.DOWN:
if (onUpDown) {
onUpDown(1);
return true;
}
break;
case KeyCode.PAGE_UP:
if (onPageUpDown) {
onPageUpDown(-1);
return true;
}
break;
case KeyCode.PAGE_DOWN:
if (onPageUpDown) {
onPageUpDown(1);
return true;
}
break;
case KeyCode.ENTER:
if (onEnter) {
onEnter();
return true;
}
break;
}
return false;
}
function getDefaultFormat(format2, picker, showTime, use12Hours) {
let mergedFormat = format2;
if (!mergedFormat) {
switch (picker) {
case "time":
mergedFormat = use12Hours ? "hh:mm:ss a" : "HH:mm:ss";
break;
case "week":
mergedFormat = "gggg-wo";
break;
case "month":
mergedFormat = "YYYY-MM";
break;
case "quarter":
mergedFormat = "YYYY-[Q]Q";
break;
case "year":
mergedFormat = "YYYY";
break;
default:
mergedFormat = showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
}
}
return mergedFormat;
}
function getInputSize(picker, format2, generateConfig2) {
const defaultSize = picker === "time" ? 8 : 10;
const length = typeof format2 === "function" ? format2(generateConfig2.getNow()).length : format2.length;
return Math.max(defaultSize, length) + 2;
}
const getYearNextMode = (next) => {
if (next === "month" || next === "date") {
return "year";
}
return next;
};
const getMonthNextMode = (next) => {
if (next === "date") {
return "month";
}
return next;
};
const getQuarterNextMode = (next) => {
if (next === "month" || next === "date") {
return "quarter";
}
return next;
};
const getWeekNextMode = (next) => {
if (next === "date") {
return "week";
}
return next;
};
const PickerModeMap = {
year: getYearNextMode,
month: getMonthNextMode,
quarter: getQuarterNextMode,
week: getWeekNextMode,
time: null,
date: null
};
function elementsContains(elements, target) {
return elements.some((ele) => ele && ele.contains(target));
}
const DECADE_UNIT_DIFF = 10;
const DECADE_DISTANCE_COUNT = DECADE_UNIT_DIFF * 10;
function DecadePanel(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
onViewDateChange,
generateConfig: generateConfig2,
viewDate,
operationRef,
onSelect,
onPanelChange
} = props2;
const panelPrefixCls = `${prefixCls}-decade-panel`;
operationRef.value = {
onKeydown: (event) => createKeydownHandler(event, {
onLeftRight: (diff) => {
onSelect(generateConfig2.addYear(viewDate, diff * DECADE_UNIT_DIFF), "key");
},
onCtrlLeftRight: (diff) => {
onSelect(generateConfig2.addYear(viewDate, diff * DECADE_DISTANCE_COUNT), "key");
},
onUpDown: (diff) => {
onSelect(generateConfig2.addYear(viewDate, diff * DECADE_UNIT_DIFF * DECADE_COL_COUNT), "key");
},
onEnter: () => {
onPanelChange("year", viewDate);
}
})
};
const onDecadesChange = (diff) => {
const newDate = generateConfig2.addYear(viewDate, diff * DECADE_DISTANCE_COUNT);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
const onInternalSelect = (date) => {
onSelect(date, "mouse");
onPanelChange("year", date);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(DecadeHeader, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onPrevDecades": () => {
onDecadesChange(-1);
},
"onNextDecades": () => {
onDecadesChange(1);
}
}), null), createVNode(DecadeBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onSelect": onInternalSelect
}), null)]);
}
DecadePanel.displayName = "DecadePanel";
DecadePanel.inheritAttrs = false;
const WEEK_DAY_COUNT = 7;
function isNullEqual(value1, value2) {
if (!value1 && !value2) {
return true;
}
if (!value1 || !value2) {
return false;
}
return void 0;
}
function isSameDecade(generateConfig2, decade1, decade2) {
const equal = isNullEqual(decade1, decade2);
if (typeof equal === "boolean") {
return equal;
}
const num1 = Math.floor(generateConfig2.getYear(decade1) / 10);
const num2 = Math.floor(generateConfig2.getYear(decade2) / 10);
return num1 === num2;
}
function isSameYear(generateConfig2, year1, year2) {
const equal = isNullEqual(year1, year2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.getYear(year1) === generateConfig2.getYear(year2);
}
function getQuarter(generateConfig2, date) {
const quota = Math.floor(generateConfig2.getMonth(date) / 3);
return quota + 1;
}
function isSameQuarter(generateConfig2, quarter1, quarter2) {
const equal = isNullEqual(quarter1, quarter2);
if (typeof equal === "boolean") {
return equal;
}
return isSameYear(generateConfig2, quarter1, quarter2) && getQuarter(generateConfig2, quarter1) === getQuarter(generateConfig2, quarter2);
}
function isSameMonth(generateConfig2, month1, month2) {
const equal = isNullEqual(month1, month2);
if (typeof equal === "boolean") {
return equal;
}
return isSameYear(generateConfig2, month1, month2) && generateConfig2.getMonth(month1) === generateConfig2.getMonth(month2);
}
function isSameDate(generateConfig2, date1, date2) {
const equal = isNullEqual(date1, date2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.getYear(date1) === generateConfig2.getYear(date2) && generateConfig2.getMonth(date1) === generateConfig2.getMonth(date2) && generateConfig2.getDate(date1) === generateConfig2.getDate(date2);
}
function isSameTime(generateConfig2, time1, time2) {
const equal = isNullEqual(time1, time2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.getHour(time1) === generateConfig2.getHour(time2) && generateConfig2.getMinute(time1) === generateConfig2.getMinute(time2) && generateConfig2.getSecond(time1) === generateConfig2.getSecond(time2);
}
function isSameWeek(generateConfig2, locale2, date1, date2) {
const equal = isNullEqual(date1, date2);
if (typeof equal === "boolean") {
return equal;
}
return generateConfig2.locale.getWeek(locale2, date1) === generateConfig2.locale.getWeek(locale2, date2);
}
function isEqual$1(generateConfig2, value1, value2) {
return isSameDate(generateConfig2, value1, value2) && isSameTime(generateConfig2, value1, value2);
}
function isInRange(generateConfig2, startDate, endDate, current) {
if (!startDate || !endDate || !current) {
return false;
}
return !isSameDate(generateConfig2, startDate, current) && !isSameDate(generateConfig2, endDate, current) && generateConfig2.isAfter(current, startDate) && generateConfig2.isAfter(endDate, current);
}
function getWeekStartDate(locale2, generateConfig2, value) {
const weekFirstDay = generateConfig2.locale.getWeekFirstDay(locale2);
const monthStartDate = generateConfig2.setDate(value, 1);
const startDateWeekDay = generateConfig2.getWeekDay(monthStartDate);
let alignStartDate = generateConfig2.addDate(monthStartDate, weekFirstDay - startDateWeekDay);
if (generateConfig2.getMonth(alignStartDate) === generateConfig2.getMonth(value) && generateConfig2.getDate(alignStartDate) > 1) {
alignStartDate = generateConfig2.addDate(alignStartDate, -7);
}
return alignStartDate;
}
function getClosingViewDate(viewDate, picker, generateConfig2) {
let offset2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
switch (picker) {
case "year":
return generateConfig2.addYear(viewDate, offset2 * 10);
case "quarter":
case "month":
return generateConfig2.addYear(viewDate, offset2);
default:
return generateConfig2.addMonth(viewDate, offset2);
}
}
function formatValue(value, _ref) {
let {
generateConfig: generateConfig2,
locale: locale2,
format: format2
} = _ref;
return typeof format2 === "function" ? format2(value) : generateConfig2.locale.format(locale2.locale, value, format2);
}
function parseValue(value, _ref2) {
let {
generateConfig: generateConfig2,
locale: locale2,
formatList
} = _ref2;
if (!value || typeof formatList[0] === "function") {
return null;
}
return generateConfig2.locale.parse(locale2.locale, value, formatList);
}
function getCellDateDisabled(_ref3) {
let {
cellDate,
mode,
disabledDate,
generateConfig: generateConfig2
} = _ref3;
if (!disabledDate) return false;
const getDisabledFromRange = (currentMode, start, end) => {
let current = start;
while (current <= end) {
let date;
switch (currentMode) {
case "date": {
date = generateConfig2.setDate(cellDate, current);
if (!disabledDate(date)) {
return false;
}
break;
}
case "month": {
date = generateConfig2.setMonth(cellDate, current);
if (!getCellDateDisabled({
cellDate: date,
mode: "month",
generateConfig: generateConfig2,
disabledDate
})) {
return false;
}
break;
}
case "year": {
date = generateConfig2.setYear(cellDate, current);
if (!getCellDateDisabled({
cellDate: date,
mode: "year",
generateConfig: generateConfig2,
disabledDate
})) {
return false;
}
break;
}
}
current += 1;
}
return true;
};
switch (mode) {
case "date":
case "week": {
return disabledDate(cellDate);
}
case "month": {
const startDate = 1;
const endDate = generateConfig2.getDate(generateConfig2.getEndDate(cellDate));
return getDisabledFromRange("date", startDate, endDate);
}
case "quarter": {
const startMonth = Math.floor(generateConfig2.getMonth(cellDate) / 3) * 3;
const endMonth = startMonth + 2;
return getDisabledFromRange("month", startMonth, endMonth);
}
case "year": {
return getDisabledFromRange("month", 0, 11);
}
case "decade": {
const year = generateConfig2.getYear(cellDate);
const startYear = Math.floor(year / DECADE_UNIT_DIFF) * DECADE_UNIT_DIFF;
const endYear = startYear + DECADE_UNIT_DIFF - 1;
return getDisabledFromRange("year", startYear, endYear);
}
}
}
function TimeHeader(_props) {
const props2 = useMergeProps(_props);
const {
hideHeader
} = useInjectPanel();
if (hideHeader.value) {
return null;
}
const {
prefixCls,
generateConfig: generateConfig2,
locale: locale2,
value,
format: format2
} = props2;
const headerPrefixCls = `${prefixCls}-header`;
return createVNode(Header$2, {
"prefixCls": headerPrefixCls
}, {
default: () => [value ? formatValue(value, {
locale: locale2,
format: format2,
generateConfig: generateConfig2
}) : " "]
});
}
TimeHeader.displayName = "TimeHeader";
TimeHeader.inheritAttrs = false;
const TimeUnitColumn = defineComponent({
name: "TimeUnitColumn",
props: ["prefixCls", "units", "onSelect", "value", "active", "hideDisabledOptions"],
setup(props2) {
const {
open: open2
} = useInjectPanel();
const ulRef = shallowRef(null);
const liRefs = ref(/* @__PURE__ */ new Map());
const scrollRef = ref();
watch(() => props2.value, () => {
const li = liRefs.value.get(props2.value);
if (li && open2.value !== false) {
scrollTo(ulRef.value, li.offsetTop, 120);
}
});
watch(open2, () => {
var _a;
(_a = scrollRef.value) === null || _a === void 0 ? void 0 : _a.call(scrollRef);
nextTick(() => {
if (open2.value) {
const li = liRefs.value.get(props2.value);
if (li) {
scrollRef.value = waitElementReady(li, () => {
scrollTo(ulRef.value, li.offsetTop, 0);
});
}
}
});
}, {
immediate: true,
flush: "post"
});
return () => {
const {
prefixCls,
units,
onSelect,
value,
active,
hideDisabledOptions
} = props2;
const cellPrefixCls = `${prefixCls}-cell`;
return createVNode("ul", {
"class": classNames(`${prefixCls}-column`, {
[`${prefixCls}-column-active`]: active
}),
"ref": ulRef,
"style": {
position: "relative"
}
}, [units.map((unit) => {
if (hideDisabledOptions && unit.disabled) {
return null;
}
return createVNode("li", {
"key": unit.value,
"ref": (element) => {
liRefs.value.set(unit.value, element);
},
"class": classNames(cellPrefixCls, {
[`${cellPrefixCls}-disabled`]: unit.disabled,
[`${cellPrefixCls}-selected`]: value === unit.value
}),
"onClick": () => {
if (unit.disabled) {
return;
}
onSelect(unit.value);
}
}, [createVNode("div", {
"class": `${cellPrefixCls}-inner`
}, [unit.label])]);
})]);
};
}
});
function leftPad(str, length) {
let fill = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "0";
let current = String(str);
while (current.length < length) {
current = `${fill}${str}`;
}
return current;
}
const tuple = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args;
};
function toArray$6(val) {
if (val === null || val === void 0) {
return [];
}
return Array.isArray(val) ? val : [val];
}
function getDataOrAriaProps(props2) {
const retProps = {};
Object.keys(props2).forEach((key2) => {
if ((key2.startsWith("data-") || key2.startsWith("aria-") || key2 === "role" || key2 === "name") && !key2.startsWith("data-__")) {
retProps[key2] = props2[key2];
}
});
return retProps;
}
function getValue$1(values, index2) {
return values ? values[index2] : null;
}
function updateValues(values, value, index2) {
const newValues = [getValue$1(values, 0), getValue$1(values, 1)];
newValues[index2] = typeof value === "function" ? value(newValues[index2]) : value;
if (!newValues[0] && !newValues[1]) {
return null;
}
return newValues;
}
function generateUnits(start, end, step, disabledUnits) {
const units = [];
for (let i = start; i <= end; i += step) {
units.push({
label: leftPad(i, 2),
value: i,
disabled: (disabledUnits || []).includes(i)
});
}
return units;
}
const TimeBody = defineComponent({
compatConfig: {
MODE: 3
},
name: "TimeBody",
inheritAttrs: false,
props: ["generateConfig", "prefixCls", "operationRef", "activeColumnIndex", "value", "showHour", "showMinute", "showSecond", "use12Hours", "hourStep", "minuteStep", "secondStep", "disabledHours", "disabledMinutes", "disabledSeconds", "disabledTime", "hideDisabledOptions", "onSelect"],
setup(props2) {
const originHour = computed(() => props2.value ? props2.generateConfig.getHour(props2.value) : -1);
const isPM = computed(() => {
if (props2.use12Hours) {
return originHour.value >= 12;
} else {
return false;
}
});
const hour = computed(() => {
if (props2.use12Hours) {
return originHour.value % 12;
} else {
return originHour.value;
}
});
const minute = computed(() => props2.value ? props2.generateConfig.getMinute(props2.value) : -1);
const second = computed(() => props2.value ? props2.generateConfig.getSecond(props2.value) : -1);
const now2 = ref(props2.generateConfig.getNow());
const mergedDisabledHours = ref();
const mergedDisabledMinutes = ref();
const mergedDisabledSeconds = ref();
watchEffect(() => {
if (props2.disabledTime) {
const disabledConfig = props2.disabledTime(now2);
[mergedDisabledHours.value, mergedDisabledMinutes.value, mergedDisabledSeconds.value] = [disabledConfig.disabledHours, disabledConfig.disabledMinutes, disabledConfig.disabledSeconds];
} else {
[mergedDisabledHours.value, mergedDisabledMinutes.value, mergedDisabledSeconds.value] = [props2.disabledHours, props2.disabledMinutes, props2.disabledSeconds];
}
});
const setTime$1 = (isNewPM, newHour, newMinute, newSecond) => {
let newDate = props2.value || props2.generateConfig.getNow();
const mergedHour = Math.max(0, newHour);
const mergedMinute = Math.max(0, newMinute);
const mergedSecond = Math.max(0, newSecond);
newDate = setTime(props2.generateConfig, newDate, !props2.use12Hours || !isNewPM ? mergedHour : mergedHour + 12, mergedMinute, mergedSecond);
return newDate;
};
const rawHours = computed(() => {
var _a;
return generateUnits(0, 23, (_a = props2.hourStep) !== null && _a !== void 0 ? _a : 1, mergedDisabledHours.value && mergedDisabledHours.value());
});
const AMPMDisabled = computed(() => {
if (!props2.use12Hours) {
return [false, false];
}
const AMPMDisabled2 = [true, true];
rawHours.value.forEach((_ref) => {
let {
disabled,
value: hourValue
} = _ref;
if (disabled) return;
if (hourValue >= 12) {
AMPMDisabled2[1] = false;
} else {
AMPMDisabled2[0] = false;
}
});
return AMPMDisabled2;
});
const hours = computed(() => {
if (!props2.use12Hours) return rawHours.value;
return rawHours.value.filter(isPM.value ? (hourMeta) => hourMeta.value >= 12 : (hourMeta) => hourMeta.value < 12).map((hourMeta) => {
const hourValue = hourMeta.value % 12;
const hourLabel = hourValue === 0 ? "12" : leftPad(hourValue, 2);
return _extends(_extends({}, hourMeta), {
label: hourLabel,
value: hourValue
});
});
});
const minutes = computed(() => {
var _a;
return generateUnits(0, 59, (_a = props2.minuteStep) !== null && _a !== void 0 ? _a : 1, mergedDisabledMinutes.value && mergedDisabledMinutes.value(originHour.value));
});
const seconds = computed(() => {
var _a;
return generateUnits(0, 59, (_a = props2.secondStep) !== null && _a !== void 0 ? _a : 1, mergedDisabledSeconds.value && mergedDisabledSeconds.value(originHour.value, minute.value));
});
return () => {
const {
prefixCls,
operationRef,
activeColumnIndex,
showHour,
showMinute,
showSecond,
use12Hours,
hideDisabledOptions,
onSelect
} = props2;
const columns = [];
const contentPrefixCls = `${prefixCls}-content`;
const columnPrefixCls = `${prefixCls}-time-panel`;
operationRef.value = {
onUpDown: (diff) => {
const column = columns[activeColumnIndex];
if (column) {
const valueIndex = column.units.findIndex((unit) => unit.value === column.value);
const unitLen = column.units.length;
for (let i = 1; i < unitLen; i += 1) {
const nextUnit = column.units[(valueIndex + diff * i + unitLen) % unitLen];
if (nextUnit.disabled !== true) {
column.onSelect(nextUnit.value);
break;
}
}
}
}
};
function addColumnNode(condition, node, columnValue, units, onColumnSelect) {
if (condition !== false) {
columns.push({
node: cloneElement(node, {
prefixCls: columnPrefixCls,
value: columnValue,
active: activeColumnIndex === columns.length,
onSelect: onColumnSelect,
units,
hideDisabledOptions
}),
onSelect: onColumnSelect,
value: columnValue,
units
});
}
}
addColumnNode(showHour, createVNode(TimeUnitColumn, {
"key": "hour"
}, null), hour.value, hours.value, (num) => {
onSelect(setTime$1(isPM.value, num, minute.value, second.value), "mouse");
});
addColumnNode(showMinute, createVNode(TimeUnitColumn, {
"key": "minute"
}, null), minute.value, minutes.value, (num) => {
onSelect(setTime$1(isPM.value, hour.value, num, second.value), "mouse");
});
addColumnNode(showSecond, createVNode(TimeUnitColumn, {
"key": "second"
}, null), second.value, seconds.value, (num) => {
onSelect(setTime$1(isPM.value, hour.value, minute.value, num), "mouse");
});
let PMIndex = -1;
if (typeof isPM.value === "boolean") {
PMIndex = isPM.value ? 1 : 0;
}
addColumnNode(use12Hours === true, createVNode(TimeUnitColumn, {
"key": "12hours"
}, null), PMIndex, [{
label: "AM",
value: 0,
disabled: AMPMDisabled.value[0]
}, {
label: "PM",
value: 1,
disabled: AMPMDisabled.value[1]
}], (num) => {
onSelect(setTime$1(!!num, hour.value, minute.value, second.value), "mouse");
});
return createVNode("div", {
"class": contentPrefixCls
}, [columns.map((_ref2) => {
let {
node
} = _ref2;
return node;
})]);
};
}
});
const countBoolean = (boolList) => boolList.filter((bool) => bool !== false).length;
function TimePanel(_props) {
const props2 = useMergeProps(_props);
const {
generateConfig: generateConfig2,
format: format2 = "HH:mm:ss",
prefixCls,
active,
operationRef,
showHour,
showMinute,
showSecond,
use12Hours = false,
onSelect,
value
} = props2;
const panelPrefixCls = `${prefixCls}-time-panel`;
const bodyOperationRef = ref();
const activeColumnIndex = ref(-1);
const columnsCount = countBoolean([showHour, showMinute, showSecond, use12Hours]);
operationRef.value = {
onKeydown: (event) => createKeydownHandler(event, {
onLeftRight: (diff) => {
activeColumnIndex.value = (activeColumnIndex.value + diff + columnsCount) % columnsCount;
},
onUpDown: (diff) => {
if (activeColumnIndex.value === -1) {
activeColumnIndex.value = 0;
} else if (bodyOperationRef.value) {
bodyOperationRef.value.onUpDown(diff);
}
},
onEnter: () => {
onSelect(value || generateConfig2.getNow(), "key");
activeColumnIndex.value = -1;
}
}),
onBlur: () => {
activeColumnIndex.value = -1;
}
};
return createVNode("div", {
"class": classNames(panelPrefixCls, {
[`${panelPrefixCls}-active`]: active
})
}, [createVNode(TimeHeader, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"format": format2,
"prefixCls": prefixCls
}), null), createVNode(TimeBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"activeColumnIndex": activeColumnIndex.value,
"operationRef": bodyOperationRef
}), null)]);
}
TimePanel.displayName = "TimePanel";
TimePanel.inheritAttrs = false;
function useCellClassName(_ref) {
let {
cellPrefixCls,
generateConfig: generateConfig2,
rangedValue,
hoverRangedValue,
isInView,
isSameCell,
offsetCell,
today,
value
} = _ref;
function getClassName(currentDate) {
const prevDate = offsetCell(currentDate, -1);
const nextDate = offsetCell(currentDate, 1);
const rangeStart = getValue$1(rangedValue, 0);
const rangeEnd = getValue$1(rangedValue, 1);
const hoverStart = getValue$1(hoverRangedValue, 0);
const hoverEnd = getValue$1(hoverRangedValue, 1);
const isRangeHovered = isInRange(generateConfig2, hoverStart, hoverEnd, currentDate);
function isRangeStart(date) {
return isSameCell(rangeStart, date);
}
function isRangeEnd(date) {
return isSameCell(rangeEnd, date);
}
const isHoverStart = isSameCell(hoverStart, currentDate);
const isHoverEnd = isSameCell(hoverEnd, currentDate);
const isHoverEdgeStart = (isRangeHovered || isHoverEnd) && (!isInView(prevDate) || isRangeEnd(prevDate));
const isHoverEdgeEnd = (isRangeHovered || isHoverStart) && (!isInView(nextDate) || isRangeStart(nextDate));
return {
// In view
[`${cellPrefixCls}-in-view`]: isInView(currentDate),
// Range
[`${cellPrefixCls}-in-range`]: isInRange(generateConfig2, rangeStart, rangeEnd, currentDate),
[`${cellPrefixCls}-range-start`]: isRangeStart(currentDate),
[`${cellPrefixCls}-range-end`]: isRangeEnd(currentDate),
[`${cellPrefixCls}-range-start-single`]: isRangeStart(currentDate) && !rangeEnd,
[`${cellPrefixCls}-range-end-single`]: isRangeEnd(currentDate) && !rangeStart,
[`${cellPrefixCls}-range-start-near-hover`]: isRangeStart(currentDate) && (isSameCell(prevDate, hoverStart) || isInRange(generateConfig2, hoverStart, hoverEnd, prevDate)),
[`${cellPrefixCls}-range-end-near-hover`]: isRangeEnd(currentDate) && (isSameCell(nextDate, hoverEnd) || isInRange(generateConfig2, hoverStart, hoverEnd, nextDate)),
// Range Hover
[`${cellPrefixCls}-range-hover`]: isRangeHovered,
[`${cellPrefixCls}-range-hover-start`]: isHoverStart,
[`${cellPrefixCls}-range-hover-end`]: isHoverEnd,
// Range Edge
[`${cellPrefixCls}-range-hover-edge-start`]: isHoverEdgeStart,
[`${cellPrefixCls}-range-hover-edge-end`]: isHoverEdgeEnd,
[`${cellPrefixCls}-range-hover-edge-start-near-range`]: isHoverEdgeStart && isSameCell(prevDate, rangeEnd),
[`${cellPrefixCls}-range-hover-edge-end-near-range`]: isHoverEdgeEnd && isSameCell(nextDate, rangeStart),
// Others
[`${cellPrefixCls}-today`]: isSameCell(today, currentDate),
[`${cellPrefixCls}-selected`]: isSameCell(value, currentDate)
};
}
return getClassName;
}
const RangeContextKey = Symbol("RangeContextProps");
const useProvideRange = (props2) => {
provide(RangeContextKey, props2);
};
const useInjectRange = () => {
return inject(RangeContextKey, {
rangedValue: ref(),
hoverRangedValue: ref(),
inRange: ref(),
panelPosition: ref()
});
};
const RangeContextProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "PanelContextProvider",
inheritAttrs: false,
props: {
value: {
type: Object,
default: () => ({})
}
},
setup(props2, _ref) {
let {
slots
} = _ref;
const value = {
rangedValue: ref(props2.value.rangedValue),
hoverRangedValue: ref(props2.value.hoverRangedValue),
inRange: ref(props2.value.inRange),
panelPosition: ref(props2.value.panelPosition)
};
useProvideRange(value);
watch(() => props2.value, () => {
Object.keys(props2.value).forEach((key2) => {
if (value[key2]) {
value[key2].value = props2.value[key2];
}
});
});
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
function DateBody(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
generateConfig: generateConfig2,
prefixColumn,
locale: locale2,
rowCount,
viewDate,
value,
dateRender
} = props2;
const {
rangedValue,
hoverRangedValue
} = useInjectRange();
const baseDate = getWeekStartDate(locale2.locale, generateConfig2, viewDate);
const cellPrefixCls = `${prefixCls}-cell`;
const weekFirstDay = generateConfig2.locale.getWeekFirstDay(locale2.locale);
const today = generateConfig2.getNow();
const headerCells = [];
const weekDaysLocale = locale2.shortWeekDays || (generateConfig2.locale.getShortWeekDays ? generateConfig2.locale.getShortWeekDays(locale2.locale) : []);
if (prefixColumn) {
headerCells.push(createVNode("th", {
"key": "empty",
"aria-label": "empty cell"
}, null));
}
for (let i = 0; i < WEEK_DAY_COUNT; i += 1) {
headerCells.push(createVNode("th", {
"key": i
}, [weekDaysLocale[(i + weekFirstDay) % WEEK_DAY_COUNT]]));
}
const getCellClassName = useCellClassName({
cellPrefixCls,
today,
value,
generateConfig: generateConfig2,
rangedValue: prefixColumn ? null : rangedValue.value,
hoverRangedValue: prefixColumn ? null : hoverRangedValue.value,
isSameCell: (current, target) => isSameDate(generateConfig2, current, target),
isInView: (date) => isSameMonth(generateConfig2, date, viewDate),
offsetCell: (date, offset2) => generateConfig2.addDate(date, offset2)
});
const getCellNode = dateRender ? (date) => dateRender({
current: date,
today
}) : void 0;
return createVNode(PanelBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"rowNum": rowCount,
"colNum": WEEK_DAY_COUNT,
"baseDate": baseDate,
"getCellNode": getCellNode,
"getCellText": generateConfig2.getDate,
"getCellClassName": getCellClassName,
"getCellDate": generateConfig2.addDate,
"titleCell": (date) => formatValue(date, {
locale: locale2,
format: "YYYY-MM-DD",
generateConfig: generateConfig2
}),
"headerCells": headerCells
}), null);
}
DateBody.displayName = "DateBody";
DateBody.inheritAttrs = false;
DateBody.props = [
"prefixCls",
"generateConfig",
"value?",
"viewDate",
"locale",
"rowCount",
"onSelect",
"dateRender?",
"disabledDate?",
// Used for week panel
"prefixColumn?",
"rowClassName?"
];
function DateHeader(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
generateConfig: generateConfig2,
locale: locale2,
viewDate,
onNextMonth,
onPrevMonth,
onNextYear,
onPrevYear,
onYearClick,
onMonthClick
} = props2;
const {
hideHeader
} = useInjectPanel();
if (hideHeader.value) {
return null;
}
const headerPrefixCls = `${prefixCls}-header`;
const monthsLocale = locale2.shortMonths || (generateConfig2.locale.getShortMonths ? generateConfig2.locale.getShortMonths(locale2.locale) : []);
const month = generateConfig2.getMonth(viewDate);
const yearNode = createVNode("button", {
"type": "button",
"key": "year",
"onClick": onYearClick,
"tabindex": -1,
"class": `${prefixCls}-year-btn`
}, [formatValue(viewDate, {
locale: locale2,
format: locale2.yearFormat,
generateConfig: generateConfig2
})]);
const monthNode = createVNode("button", {
"type": "button",
"key": "month",
"onClick": onMonthClick,
"tabindex": -1,
"class": `${prefixCls}-month-btn`
}, [locale2.monthFormat ? formatValue(viewDate, {
locale: locale2,
format: locale2.monthFormat,
generateConfig: generateConfig2
}) : monthsLocale[month]]);
const monthYearNodes = locale2.monthBeforeYear ? [monthNode, yearNode] : [yearNode, monthNode];
return createVNode(Header$2, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevYear,
"onPrev": onPrevMonth,
"onNext": onNextMonth,
"onSuperNext": onNextYear
}), {
default: () => [monthYearNodes]
});
}
DateHeader.displayName = "DateHeader";
DateHeader.inheritAttrs = false;
const DATE_ROW_COUNT = 6;
function DatePanel(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
panelName = "date",
keyboardConfig,
active,
operationRef,
generateConfig: generateConfig2,
value,
viewDate,
onViewDateChange,
onPanelChange,
onSelect
} = props2;
const panelPrefixCls = `${prefixCls}-${panelName}-panel`;
operationRef.value = {
onKeydown: (event) => createKeydownHandler(event, _extends({
onLeftRight: (diff) => {
onSelect(generateConfig2.addDate(value || viewDate, diff), "key");
},
onCtrlLeftRight: (diff) => {
onSelect(generateConfig2.addYear(value || viewDate, diff), "key");
},
onUpDown: (diff) => {
onSelect(generateConfig2.addDate(value || viewDate, diff * WEEK_DAY_COUNT), "key");
},
onPageUpDown: (diff) => {
onSelect(generateConfig2.addMonth(value || viewDate, diff), "key");
}
}, keyboardConfig))
};
const onYearChange = (diff) => {
const newDate = generateConfig2.addYear(viewDate, diff);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
const onMonthChange = (diff) => {
const newDate = generateConfig2.addMonth(viewDate, diff);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": classNames(panelPrefixCls, {
[`${panelPrefixCls}-active`]: active
})
}, [createVNode(DateHeader, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"value": value,
"viewDate": viewDate,
"onPrevYear": () => {
onYearChange(-1);
},
"onNextYear": () => {
onYearChange(1);
},
"onPrevMonth": () => {
onMonthChange(-1);
},
"onNextMonth": () => {
onMonthChange(1);
},
"onMonthClick": () => {
onPanelChange("month", viewDate);
},
"onYearClick": () => {
onPanelChange("year", viewDate);
}
}), null), createVNode(DateBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"onSelect": (date) => onSelect(date, "mouse"),
"prefixCls": prefixCls,
"value": value,
"viewDate": viewDate,
"rowCount": DATE_ROW_COUNT
}), null)]);
}
DatePanel.displayName = "DatePanel";
DatePanel.inheritAttrs = false;
const ACTIVE_PANEL = tuple("date", "time");
function DatetimePanel(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
operationRef,
generateConfig: generateConfig2,
value,
defaultValue,
disabledTime,
showTime,
onSelect
} = props2;
const panelPrefixCls = `${prefixCls}-datetime-panel`;
const activePanel = ref(null);
const dateOperationRef = ref({});
const timeOperationRef = ref({});
const timeProps = typeof showTime === "object" ? _extends({}, showTime) : {};
function getNextActive(offset2) {
const activeIndex = ACTIVE_PANEL.indexOf(activePanel.value) + offset2;
const nextActivePanel = ACTIVE_PANEL[activeIndex] || null;
return nextActivePanel;
}
const onBlur = (e) => {
if (timeOperationRef.value.onBlur) {
timeOperationRef.value.onBlur(e);
}
activePanel.value = null;
};
operationRef.value = {
onKeydown: (event) => {
if (event.which === KeyCode.TAB) {
const nextActivePanel = getNextActive(event.shiftKey ? -1 : 1);
activePanel.value = nextActivePanel;
if (nextActivePanel) {
event.preventDefault();
}
return true;
}
if (activePanel.value) {
const ref2 = activePanel.value === "date" ? dateOperationRef : timeOperationRef;
if (ref2.value && ref2.value.onKeydown) {
ref2.value.onKeydown(event);
}
return true;
}
if ([KeyCode.LEFT, KeyCode.RIGHT, KeyCode.UP, KeyCode.DOWN].includes(event.which)) {
activePanel.value = "date";
return true;
}
return false;
},
onBlur,
onClose: onBlur
};
const onInternalSelect = (date, source) => {
let selectedDate = date;
if (source === "date" && !value && timeProps.defaultValue) {
selectedDate = generateConfig2.setHour(selectedDate, generateConfig2.getHour(timeProps.defaultValue));
selectedDate = generateConfig2.setMinute(selectedDate, generateConfig2.getMinute(timeProps.defaultValue));
selectedDate = generateConfig2.setSecond(selectedDate, generateConfig2.getSecond(timeProps.defaultValue));
} else if (source === "time" && !value && defaultValue) {
selectedDate = generateConfig2.setYear(selectedDate, generateConfig2.getYear(defaultValue));
selectedDate = generateConfig2.setMonth(selectedDate, generateConfig2.getMonth(defaultValue));
selectedDate = generateConfig2.setDate(selectedDate, generateConfig2.getDate(defaultValue));
}
if (onSelect) {
onSelect(selectedDate, "mouse");
}
};
const disabledTimes = disabledTime ? disabledTime(value || null) : {};
return createVNode("div", {
"class": classNames(panelPrefixCls, {
[`${panelPrefixCls}-active`]: activePanel.value
})
}, [createVNode(DatePanel, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"operationRef": dateOperationRef,
"active": activePanel.value === "date",
"onSelect": (date) => {
onInternalSelect(setDateTime(generateConfig2, date, !value && typeof showTime === "object" ? showTime.defaultValue : null), "date");
}
}), null), createVNode(TimePanel, _objectSpread$W(_objectSpread$W(_objectSpread$W(_objectSpread$W({}, props2), {}, {
"format": void 0
}, timeProps), disabledTimes), {}, {
"disabledTime": null,
"defaultValue": void 0,
"operationRef": timeOperationRef,
"active": activePanel.value === "time",
"onSelect": (date) => {
onInternalSelect(date, "time");
}
}), null)]);
}
DatetimePanel.displayName = "DatetimePanel";
DatetimePanel.inheritAttrs = false;
function WeekPanel(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
generateConfig: generateConfig2,
locale: locale2,
value
} = props2;
const cellPrefixCls = `${prefixCls}-cell`;
const prefixColumn = (date) => createVNode("td", {
"key": "week",
"class": classNames(cellPrefixCls, `${cellPrefixCls}-week`)
}, [generateConfig2.locale.getWeek(locale2.locale, date)]);
const rowPrefixCls = `${prefixCls}-week-panel-row`;
const rowClassName = (date) => classNames(rowPrefixCls, {
[`${rowPrefixCls}-selected`]: isSameWeek(generateConfig2, locale2.locale, value, date)
});
return createVNode(DatePanel, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"panelName": "week",
"prefixColumn": prefixColumn,
"rowClassName": rowClassName,
"keyboardConfig": {
onLeftRight: null
}
}), null);
}
WeekPanel.displayName = "WeekPanel";
WeekPanel.inheritAttrs = false;
function MonthHeader(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
generateConfig: generateConfig2,
locale: locale2,
viewDate,
onNextYear,
onPrevYear,
onYearClick
} = props2;
const {
hideHeader
} = useInjectPanel();
if (hideHeader.value) {
return null;
}
const headerPrefixCls = `${prefixCls}-header`;
return createVNode(Header$2, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevYear,
"onSuperNext": onNextYear
}), {
default: () => [createVNode("button", {
"type": "button",
"onClick": onYearClick,
"class": `${prefixCls}-year-btn`
}, [formatValue(viewDate, {
locale: locale2,
format: locale2.yearFormat,
generateConfig: generateConfig2
})])]
});
}
MonthHeader.displayName = "MonthHeader";
MonthHeader.inheritAttrs = false;
const MONTH_COL_COUNT = 3;
const MONTH_ROW_COUNT = 4;
function MonthBody(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
locale: locale2,
value,
viewDate,
generateConfig: generateConfig2,
monthCellRender
} = props2;
const {
rangedValue,
hoverRangedValue
} = useInjectRange();
const cellPrefixCls = `${prefixCls}-cell`;
const getCellClassName = useCellClassName({
cellPrefixCls,
value,
generateConfig: generateConfig2,
rangedValue: rangedValue.value,
hoverRangedValue: hoverRangedValue.value,
isSameCell: (current, target) => isSameMonth(generateConfig2, current, target),
isInView: () => true,
offsetCell: (date, offset2) => generateConfig2.addMonth(date, offset2)
});
const monthsLocale = locale2.shortMonths || (generateConfig2.locale.getShortMonths ? generateConfig2.locale.getShortMonths(locale2.locale) : []);
const baseMonth = generateConfig2.setMonth(viewDate, 0);
const getCellNode = monthCellRender ? (date) => monthCellRender({
current: date,
locale: locale2
}) : void 0;
return createVNode(PanelBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"rowNum": MONTH_ROW_COUNT,
"colNum": MONTH_COL_COUNT,
"baseDate": baseMonth,
"getCellNode": getCellNode,
"getCellText": (date) => locale2.monthFormat ? formatValue(date, {
locale: locale2,
format: locale2.monthFormat,
generateConfig: generateConfig2
}) : monthsLocale[generateConfig2.getMonth(date)],
"getCellClassName": getCellClassName,
"getCellDate": generateConfig2.addMonth,
"titleCell": (date) => formatValue(date, {
locale: locale2,
format: "YYYY-MM",
generateConfig: generateConfig2
})
}), null);
}
MonthBody.displayName = "MonthBody";
MonthBody.inheritAttrs = false;
function MonthPanel(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
operationRef,
onViewDateChange,
generateConfig: generateConfig2,
value,
viewDate,
onPanelChange,
onSelect
} = props2;
const panelPrefixCls = `${prefixCls}-month-panel`;
operationRef.value = {
onKeydown: (event) => createKeydownHandler(event, {
onLeftRight: (diff) => {
onSelect(generateConfig2.addMonth(value || viewDate, diff), "key");
},
onCtrlLeftRight: (diff) => {
onSelect(generateConfig2.addYear(value || viewDate, diff), "key");
},
onUpDown: (diff) => {
onSelect(generateConfig2.addMonth(value || viewDate, diff * MONTH_COL_COUNT), "key");
},
onEnter: () => {
onPanelChange("date", value || viewDate);
}
})
};
const onYearChange = (diff) => {
const newDate = generateConfig2.addYear(viewDate, diff);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(MonthHeader, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onPrevYear": () => {
onYearChange(-1);
},
"onNextYear": () => {
onYearChange(1);
},
"onYearClick": () => {
onPanelChange("year", viewDate);
}
}), null), createVNode(MonthBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onSelect": (date) => {
onSelect(date, "mouse");
onPanelChange("date", date);
}
}), null)]);
}
MonthPanel.displayName = "MonthPanel";
MonthPanel.inheritAttrs = false;
function QuarterHeader(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
generateConfig: generateConfig2,
locale: locale2,
viewDate,
onNextYear,
onPrevYear,
onYearClick
} = props2;
const {
hideHeader
} = useInjectPanel();
if (hideHeader.value) {
return null;
}
const headerPrefixCls = `${prefixCls}-header`;
return createVNode(Header$2, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevYear,
"onSuperNext": onNextYear
}), {
default: () => [createVNode("button", {
"type": "button",
"onClick": onYearClick,
"class": `${prefixCls}-year-btn`
}, [formatValue(viewDate, {
locale: locale2,
format: locale2.yearFormat,
generateConfig: generateConfig2
})])]
});
}
QuarterHeader.displayName = "QuarterHeader";
QuarterHeader.inheritAttrs = false;
const QUARTER_COL_COUNT = 4;
const QUARTER_ROW_COUNT = 1;
function QuarterBody(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
locale: locale2,
value,
viewDate,
generateConfig: generateConfig2
} = props2;
const {
rangedValue,
hoverRangedValue
} = useInjectRange();
const cellPrefixCls = `${prefixCls}-cell`;
const getCellClassName = useCellClassName({
cellPrefixCls,
value,
generateConfig: generateConfig2,
rangedValue: rangedValue.value,
hoverRangedValue: hoverRangedValue.value,
isSameCell: (current, target) => isSameQuarter(generateConfig2, current, target),
isInView: () => true,
offsetCell: (date, offset2) => generateConfig2.addMonth(date, offset2 * 3)
});
const baseQuarter = generateConfig2.setDate(generateConfig2.setMonth(viewDate, 0), 1);
return createVNode(PanelBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"rowNum": QUARTER_ROW_COUNT,
"colNum": QUARTER_COL_COUNT,
"baseDate": baseQuarter,
"getCellText": (date) => formatValue(date, {
locale: locale2,
format: locale2.quarterFormat || "[Q]Q",
generateConfig: generateConfig2
}),
"getCellClassName": getCellClassName,
"getCellDate": (date, offset2) => generateConfig2.addMonth(date, offset2 * 3),
"titleCell": (date) => formatValue(date, {
locale: locale2,
format: "YYYY-[Q]Q",
generateConfig: generateConfig2
})
}), null);
}
QuarterBody.displayName = "QuarterBody";
QuarterBody.inheritAttrs = false;
function QuarterPanel(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
operationRef,
onViewDateChange,
generateConfig: generateConfig2,
value,
viewDate,
onPanelChange,
onSelect
} = props2;
const panelPrefixCls = `${prefixCls}-quarter-panel`;
operationRef.value = {
onKeydown: (event) => createKeydownHandler(event, {
onLeftRight: (diff) => {
onSelect(generateConfig2.addMonth(value || viewDate, diff * 3), "key");
},
onCtrlLeftRight: (diff) => {
onSelect(generateConfig2.addYear(value || viewDate, diff), "key");
},
onUpDown: (diff) => {
onSelect(generateConfig2.addYear(value || viewDate, diff), "key");
}
})
};
const onYearChange = (diff) => {
const newDate = generateConfig2.addYear(viewDate, diff);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(QuarterHeader, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onPrevYear": () => {
onYearChange(-1);
},
"onNextYear": () => {
onYearChange(1);
},
"onYearClick": () => {
onPanelChange("year", viewDate);
}
}), null), createVNode(QuarterBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onSelect": (date) => {
onSelect(date, "mouse");
}
}), null)]);
}
QuarterPanel.displayName = "QuarterPanel";
QuarterPanel.inheritAttrs = false;
function YearHeader(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
generateConfig: generateConfig2,
viewDate,
onPrevDecade,
onNextDecade,
onDecadeClick
} = props2;
const {
hideHeader
} = useInjectPanel();
if (hideHeader.value) {
return null;
}
const headerPrefixCls = `${prefixCls}-header`;
const yearNumber = generateConfig2.getYear(viewDate);
const startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;
const endYear = startYear + YEAR_DECADE_COUNT - 1;
return createVNode(Header$2, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": headerPrefixCls,
"onSuperPrev": onPrevDecade,
"onSuperNext": onNextDecade
}), {
default: () => [createVNode("button", {
"type": "button",
"onClick": onDecadeClick,
"class": `${prefixCls}-decade-btn`
}, [startYear, createTextVNode("-"), endYear])]
});
}
YearHeader.displayName = "YearHeader";
YearHeader.inheritAttrs = false;
const YEAR_COL_COUNT = 3;
const YEAR_ROW_COUNT = 4;
function YearBody(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
value,
viewDate,
locale: locale2,
generateConfig: generateConfig2
} = props2;
const {
rangedValue,
hoverRangedValue
} = useInjectRange();
const yearPrefixCls = `${prefixCls}-cell`;
const yearNumber = generateConfig2.getYear(viewDate);
const startYear = Math.floor(yearNumber / YEAR_DECADE_COUNT) * YEAR_DECADE_COUNT;
const endYear = startYear + YEAR_DECADE_COUNT - 1;
const baseYear = generateConfig2.setYear(viewDate, startYear - Math.ceil((YEAR_COL_COUNT * YEAR_ROW_COUNT - YEAR_DECADE_COUNT) / 2));
const isInView = (date) => {
const currentYearNumber = generateConfig2.getYear(date);
return startYear <= currentYearNumber && currentYearNumber <= endYear;
};
const getCellClassName = useCellClassName({
cellPrefixCls: yearPrefixCls,
value,
generateConfig: generateConfig2,
rangedValue: rangedValue.value,
hoverRangedValue: hoverRangedValue.value,
isSameCell: (current, target) => isSameYear(generateConfig2, current, target),
isInView,
offsetCell: (date, offset2) => generateConfig2.addYear(date, offset2)
});
return createVNode(PanelBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"rowNum": YEAR_ROW_COUNT,
"colNum": YEAR_COL_COUNT,
"baseDate": baseYear,
"getCellText": generateConfig2.getYear,
"getCellClassName": getCellClassName,
"getCellDate": generateConfig2.addYear,
"titleCell": (date) => formatValue(date, {
locale: locale2,
format: "YYYY",
generateConfig: generateConfig2
})
}), null);
}
YearBody.displayName = "YearBody";
YearBody.inheritAttrs = false;
const YEAR_DECADE_COUNT = 10;
function YearPanel(_props) {
const props2 = useMergeProps(_props);
const {
prefixCls,
operationRef,
onViewDateChange,
generateConfig: generateConfig2,
value,
viewDate,
sourceMode,
onSelect,
onPanelChange
} = props2;
const panelPrefixCls = `${prefixCls}-year-panel`;
operationRef.value = {
onKeydown: (event) => createKeydownHandler(event, {
onLeftRight: (diff) => {
onSelect(generateConfig2.addYear(value || viewDate, diff), "key");
},
onCtrlLeftRight: (diff) => {
onSelect(generateConfig2.addYear(value || viewDate, diff * YEAR_DECADE_COUNT), "key");
},
onUpDown: (diff) => {
onSelect(generateConfig2.addYear(value || viewDate, diff * YEAR_COL_COUNT), "key");
},
onEnter: () => {
onPanelChange(sourceMode === "date" ? "date" : "month", value || viewDate);
}
})
};
const onDecadeChange = (diff) => {
const newDate = generateConfig2.addYear(viewDate, diff * 10);
onViewDateChange(newDate);
onPanelChange(null, newDate);
};
return createVNode("div", {
"class": panelPrefixCls
}, [createVNode(YearHeader, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onPrevDecade": () => {
onDecadeChange(-1);
},
"onNextDecade": () => {
onDecadeChange(1);
},
"onDecadeClick": () => {
onPanelChange("decade", viewDate);
}
}), null), createVNode(YearBody, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls,
"onSelect": (date) => {
onPanelChange(sourceMode === "date" ? "date" : "month", date);
onSelect(date, "mouse");
}
}), null)]);
}
YearPanel.displayName = "YearPanel";
YearPanel.inheritAttrs = false;
function getExtraFooter(prefixCls, mode, renderExtraFooter) {
if (!renderExtraFooter) {
return null;
}
return createVNode("div", {
"class": `${prefixCls}-footer-extra`
}, [renderExtraFooter(mode)]);
}
function getRanges(_ref) {
let {
prefixCls,
components: components2 = {},
needConfirmButton,
onNow,
onOk,
okDisabled,
showNow,
locale: locale2
} = _ref;
let presetNode;
let okNode;
if (needConfirmButton) {
const Button2 = components2.button || "button";
if (onNow && showNow !== false) {
presetNode = createVNode("li", {
"class": `${prefixCls}-now`
}, [createVNode("a", {
"class": `${prefixCls}-now-btn`,
"onClick": onNow
}, [locale2.now])]);
}
okNode = needConfirmButton && createVNode("li", {
"class": `${prefixCls}-ok`
}, [createVNode(Button2, {
"disabled": okDisabled,
"onClick": (e) => {
e.stopPropagation();
onOk && onOk();
}
}, {
default: () => [locale2.ok]
})]);
}
if (!presetNode && !okNode) {
return null;
}
return createVNode("ul", {
"class": `${prefixCls}-ranges`
}, [presetNode, okNode]);
}
function PickerPanel() {
return defineComponent({
name: "PickerPanel",
inheritAttrs: false,
props: {
prefixCls: String,
locale: Object,
generateConfig: Object,
value: Object,
defaultValue: Object,
pickerValue: Object,
defaultPickerValue: Object,
disabledDate: Function,
mode: String,
picker: {
type: String,
default: "date"
},
tabindex: {
type: [Number, String],
default: 0
},
showNow: {
type: Boolean,
default: void 0
},
showTime: [Boolean, Object],
showToday: Boolean,
renderExtraFooter: Function,
dateRender: Function,
hideHeader: {
type: Boolean,
default: void 0
},
onSelect: Function,
onChange: Function,
onPanelChange: Function,
onMousedown: Function,
onPickerValueChange: Function,
onOk: Function,
components: Object,
direction: String,
hourStep: {
type: Number,
default: 1
},
minuteStep: {
type: Number,
default: 1
},
secondStep: {
type: Number,
default: 1
}
},
setup(props2, _ref) {
let {
attrs
} = _ref;
const needConfirmButton = computed(() => props2.picker === "date" && !!props2.showTime || props2.picker === "time");
const isHourStepValid = computed(() => 24 % props2.hourStep === 0);
const isMinuteStepValid = computed(() => 60 % props2.minuteStep === 0);
const isSecondStepValid = computed(() => 60 % props2.secondStep === 0);
const panelContext = useInjectPanel();
const {
operationRef,
onSelect: onContextSelect,
hideRanges,
defaultOpenValue
} = panelContext;
const {
inRange,
panelPosition,
rangedValue,
hoverRangedValue
} = useInjectRange();
const panelRef = ref({});
const [mergedValue, setInnerValue] = useMergedState(null, {
value: toRef(props2, "value"),
defaultValue: props2.defaultValue,
postState: (val) => {
if (!val && (defaultOpenValue === null || defaultOpenValue === void 0 ? void 0 : defaultOpenValue.value) && props2.picker === "time") {
return defaultOpenValue.value;
}
return val;
}
});
const [viewDate, setInnerViewDate] = useMergedState(null, {
value: toRef(props2, "pickerValue"),
defaultValue: props2.defaultPickerValue || mergedValue.value,
postState: (date) => {
const {
generateConfig: generateConfig2,
showTime,
defaultValue
} = props2;
const now2 = generateConfig2.getNow();
if (!date) return now2;
if (!mergedValue.value && props2.showTime) {
if (typeof showTime === "object") {
return setDateTime(generateConfig2, Array.isArray(date) ? date[0] : date, showTime.defaultValue || now2);
}
if (defaultValue) {
return setDateTime(generateConfig2, Array.isArray(date) ? date[0] : date, defaultValue);
}
return setDateTime(generateConfig2, Array.isArray(date) ? date[0] : date, now2);
}
return date;
}
});
const setViewDate = (date) => {
setInnerViewDate(date);
if (props2.onPickerValueChange) {
props2.onPickerValueChange(date);
}
};
const getInternalNextMode = (nextMode) => {
const getNextMode = PickerModeMap[props2.picker];
if (getNextMode) {
return getNextMode(nextMode);
}
return nextMode;
};
const [mergedMode, setInnerMode] = useMergedState(() => {
if (props2.picker === "time") {
return "time";
}
return getInternalNextMode("date");
}, {
value: toRef(props2, "mode")
});
watch(() => props2.picker, () => {
setInnerMode(props2.picker);
});
const sourceMode = ref(mergedMode.value);
const setSourceMode = (val) => {
sourceMode.value = val;
};
const onInternalPanelChange = (newMode, viewValue) => {
const {
onPanelChange,
generateConfig: generateConfig2
} = props2;
const nextMode = getInternalNextMode(newMode || mergedMode.value);
setSourceMode(mergedMode.value);
setInnerMode(nextMode);
if (onPanelChange && (mergedMode.value !== nextMode || isEqual$1(generateConfig2, viewDate.value, viewDate.value))) {
onPanelChange(viewValue, nextMode);
}
};
const triggerSelect = function(date, type) {
let forceTriggerSelect = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
const {
picker,
generateConfig: generateConfig2,
onSelect,
onChange,
disabledDate
} = props2;
if (mergedMode.value === picker || forceTriggerSelect) {
setInnerValue(date);
if (onSelect) {
onSelect(date);
}
if (onContextSelect) {
onContextSelect(date, type);
}
if (onChange && !isEqual$1(generateConfig2, date, mergedValue.value) && !(disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date))) {
onChange(date);
}
}
};
const onInternalKeydown = (e) => {
if (panelRef.value && panelRef.value.onKeydown) {
if ([KeyCode.LEFT, KeyCode.RIGHT, KeyCode.UP, KeyCode.DOWN, KeyCode.PAGE_UP, KeyCode.PAGE_DOWN, KeyCode.ENTER].includes(e.which)) {
e.preventDefault();
}
return panelRef.value.onKeydown(e);
}
{
return false;
}
};
const onInternalBlur = (e) => {
if (panelRef.value && panelRef.value.onBlur) {
panelRef.value.onBlur(e);
}
};
const onNow = () => {
const {
generateConfig: generateConfig2,
hourStep,
minuteStep,
secondStep
} = props2;
const now2 = generateConfig2.getNow();
const lowerBoundTime = getLowerBoundTime(generateConfig2.getHour(now2), generateConfig2.getMinute(now2), generateConfig2.getSecond(now2), isHourStepValid.value ? hourStep : 1, isMinuteStepValid.value ? minuteStep : 1, isSecondStepValid.value ? secondStep : 1);
const adjustedNow = setTime(
generateConfig2,
now2,
lowerBoundTime[0],
// hour
lowerBoundTime[1],
// minute
lowerBoundTime[2]
);
triggerSelect(adjustedNow, "submit");
};
const classString = computed(() => {
const {
prefixCls,
direction
} = props2;
return classNames(`${prefixCls}-panel`, {
[`${prefixCls}-panel-has-range`]: rangedValue && rangedValue.value && rangedValue.value[0] && rangedValue.value[1],
[`${prefixCls}-panel-has-range-hover`]: hoverRangedValue && hoverRangedValue.value && hoverRangedValue.value[0] && hoverRangedValue.value[1],
[`${prefixCls}-panel-rtl`]: direction === "rtl"
});
});
useProvidePanel(_extends(_extends({}, panelContext), {
mode: mergedMode,
hideHeader: computed(() => {
var _a;
return props2.hideHeader !== void 0 ? props2.hideHeader : (_a = panelContext.hideHeader) === null || _a === void 0 ? void 0 : _a.value;
}),
hidePrevBtn: computed(() => inRange.value && panelPosition.value === "right"),
hideNextBtn: computed(() => inRange.value && panelPosition.value === "left")
}));
watch(() => props2.value, () => {
if (props2.value) {
setInnerViewDate(props2.value);
}
});
return () => {
const {
prefixCls = "ant-picker",
locale: locale2,
generateConfig: generateConfig2,
disabledDate,
picker = "date",
tabindex = 0,
showNow,
showTime,
showToday,
renderExtraFooter,
onMousedown,
onOk,
components: components2
} = props2;
if (operationRef && panelPosition.value !== "right") {
operationRef.value = {
onKeydown: onInternalKeydown,
onClose: () => {
if (panelRef.value && panelRef.value.onClose) {
panelRef.value.onClose();
}
}
};
}
let panelNode;
const pickerProps = _extends(_extends(_extends({}, attrs), props2), {
operationRef: panelRef,
prefixCls,
viewDate: viewDate.value,
value: mergedValue.value,
onViewDateChange: setViewDate,
sourceMode: sourceMode.value,
onPanelChange: onInternalPanelChange,
disabledDate
});
delete pickerProps.onChange;
delete pickerProps.onSelect;
switch (mergedMode.value) {
case "decade":
panelNode = createVNode(DecadePanel, _objectSpread$W(_objectSpread$W({}, pickerProps), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
break;
case "year":
panelNode = createVNode(YearPanel, _objectSpread$W(_objectSpread$W({}, pickerProps), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
break;
case "month":
panelNode = createVNode(MonthPanel, _objectSpread$W(_objectSpread$W({}, pickerProps), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
break;
case "quarter":
panelNode = createVNode(QuarterPanel, _objectSpread$W(_objectSpread$W({}, pickerProps), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
break;
case "week":
panelNode = createVNode(WeekPanel, _objectSpread$W(_objectSpread$W({}, pickerProps), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
break;
case "time":
delete pickerProps.showTime;
panelNode = createVNode(TimePanel, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, pickerProps), typeof showTime === "object" ? showTime : null), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
break;
default:
if (showTime) {
panelNode = createVNode(DatetimePanel, _objectSpread$W(_objectSpread$W({}, pickerProps), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
} else {
panelNode = createVNode(DatePanel, _objectSpread$W(_objectSpread$W({}, pickerProps), {}, {
"onSelect": (date, type) => {
setViewDate(date);
triggerSelect(date, type);
}
}), null);
}
}
let extraFooter;
let rangesNode;
if (!(hideRanges === null || hideRanges === void 0 ? void 0 : hideRanges.value)) {
extraFooter = getExtraFooter(prefixCls, mergedMode.value, renderExtraFooter);
rangesNode = getRanges({
prefixCls,
components: components2,
needConfirmButton: needConfirmButton.value,
okDisabled: !mergedValue.value || disabledDate && disabledDate(mergedValue.value),
locale: locale2,
showNow,
onNow: needConfirmButton.value && onNow,
onOk: () => {
if (mergedValue.value) {
triggerSelect(mergedValue.value, "submit", true);
if (onOk) {
onOk(mergedValue.value);
}
}
}
});
}
let todayNode;
if (showToday && mergedMode.value === "date" && picker === "date" && !showTime) {
const now2 = generateConfig2.getNow();
const todayCls = `${prefixCls}-today-btn`;
const disabled = disabledDate && disabledDate(now2);
todayNode = createVNode("a", {
"class": classNames(todayCls, disabled && `${todayCls}-disabled`),
"aria-disabled": disabled,
"onClick": () => {
if (!disabled) {
triggerSelect(now2, "mouse", true);
}
}
}, [locale2.today]);
}
return createVNode("div", {
"tabindex": tabindex,
"class": classNames(classString.value, attrs.class),
"style": attrs.style,
"onKeydown": onInternalKeydown,
"onBlur": onInternalBlur,
"onMousedown": onMousedown
}, [panelNode, extraFooter || rangesNode || todayNode ? createVNode("div", {
"class": `${prefixCls}-footer`
}, [extraFooter, rangesNode, todayNode]) : null]);
};
}
});
}
const InterPickerPanel = PickerPanel();
const PickerPanel$1 = ((props2) => createVNode(InterPickerPanel, props2));
const BUILT_IN_PLACEMENTS$1 = {
bottomLeft: {
points: ["tl", "bl"],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
bottomRight: {
points: ["tr", "br"],
offset: [0, 4],
overflow: {
adjustX: 1,
adjustY: 1
}
},
topLeft: {
points: ["bl", "tl"],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
},
topRight: {
points: ["br", "tr"],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
}
};
function PickerTrigger(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls,
popupStyle,
visible,
dropdownClassName,
dropdownAlign,
transitionName: transitionName2,
getPopupContainer,
range,
popupPlacement,
direction
} = useMergeProps(props2);
const dropdownPrefixCls = `${prefixCls}-dropdown`;
const getPopupPlacement = () => {
if (popupPlacement !== void 0) {
return popupPlacement;
}
return direction === "rtl" ? "bottomRight" : "bottomLeft";
};
return createVNode(Trigger, {
"showAction": [],
"hideAction": [],
"popupPlacement": getPopupPlacement(),
"builtinPlacements": BUILT_IN_PLACEMENTS$1,
"prefixCls": dropdownPrefixCls,
"popupTransitionName": transitionName2,
"popupAlign": dropdownAlign,
"popupVisible": visible,
"popupClassName": classNames(dropdownClassName, {
[`${dropdownPrefixCls}-range`]: range,
[`${dropdownPrefixCls}-rtl`]: direction === "rtl"
}),
"popupStyle": popupStyle,
"getPopupContainer": getPopupContainer
}, {
default: slots.default,
popup: slots.popupElement
});
}
const PresetPanel = defineComponent({
name: "PresetPanel",
props: {
prefixCls: String,
presets: {
type: Array,
default: () => []
},
onClick: Function,
onHover: Function
},
setup(props2) {
return () => {
if (!props2.presets.length) {
return null;
}
return createVNode("div", {
"class": `${props2.prefixCls}-presets`
}, [createVNode("ul", null, [props2.presets.map((_ref, index2) => {
let {
label,
value
} = _ref;
return createVNode("li", {
"key": index2,
"onClick": (e) => {
e.stopPropagation();
props2.onClick(value);
},
"onMouseenter": () => {
var _a;
(_a = props2.onHover) === null || _a === void 0 ? void 0 : _a.call(props2, value);
},
"onMouseleave": () => {
var _a;
(_a = props2.onHover) === null || _a === void 0 ? void 0 : _a.call(props2, null);
}
}, [label]);
})])]);
};
}
});
function usePickerInput(_ref) {
let {
open: open2,
value,
isClickOutside,
triggerOpen,
forwardKeydown,
onKeydown,
blurToCancel,
onSubmit,
onCancel,
onFocus,
onBlur
} = _ref;
const typing = shallowRef(false);
const focused = shallowRef(false);
const preventBlurRef = shallowRef(false);
const valueChangedRef = shallowRef(false);
const preventDefaultRef = shallowRef(false);
const inputProps2 = computed(() => ({
onMousedown: () => {
typing.value = true;
triggerOpen(true);
},
onKeydown: (e) => {
const preventDefault = () => {
preventDefaultRef.value = true;
};
onKeydown(e, preventDefault);
if (preventDefaultRef.value) return;
switch (e.which) {
case KeyCode.ENTER: {
if (!open2.value) {
triggerOpen(true);
} else if (onSubmit() !== false) {
typing.value = true;
}
e.preventDefault();
return;
}
case KeyCode.TAB: {
if (typing.value && open2.value && !e.shiftKey) {
typing.value = false;
e.preventDefault();
} else if (!typing.value && open2.value) {
if (!forwardKeydown(e) && e.shiftKey) {
typing.value = true;
e.preventDefault();
}
}
return;
}
case KeyCode.ESC: {
typing.value = true;
onCancel();
return;
}
}
if (!open2.value && ![KeyCode.SHIFT].includes(e.which)) {
triggerOpen(true);
} else if (!typing.value) {
forwardKeydown(e);
}
},
onFocus: (e) => {
typing.value = true;
focused.value = true;
if (onFocus) {
onFocus(e);
}
},
onBlur: (e) => {
if (preventBlurRef.value || !isClickOutside((void 0).activeElement)) {
preventBlurRef.value = false;
return;
}
if (blurToCancel.value) {
setTimeout(() => {
let {
activeElement
} = void 0;
while (activeElement && activeElement.shadowRoot) {
activeElement = activeElement.shadowRoot.activeElement;
}
if (isClickOutside(activeElement)) {
onCancel();
}
}, 0);
} else if (open2.value) {
triggerOpen(false);
if (valueChangedRef.value) {
onSubmit();
}
}
focused.value = false;
if (onBlur) {
onBlur(e);
}
}
}));
watch(open2, () => {
valueChangedRef.value = false;
});
watch(value, () => {
valueChangedRef.value = true;
});
shallowRef();
return [inputProps2, {
focused,
typing
}];
}
function useTextValueMapping(_ref) {
let {
valueTexts,
onTextChange
} = _ref;
const text = ref("");
function triggerTextChange(value) {
text.value = value;
onTextChange(value);
}
function resetText() {
text.value = valueTexts.value[0];
}
watch(() => [...valueTexts.value], function(cur) {
let pre = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
if (cur.join("||") !== pre.join("||") && valueTexts.value.every((valText) => valText !== text.value)) {
resetText();
}
}, {
immediate: true
});
return [text, triggerTextChange, resetText];
}
function useValueTexts(value, _ref) {
let {
formatList,
generateConfig: generateConfig2,
locale: locale2
} = _ref;
const texts = useMemo(() => {
if (!value.value) {
return [[""], ""];
}
let firstValueText2 = "";
const fullValueTexts2 = [];
for (let i = 0; i < formatList.value.length; i += 1) {
const format2 = formatList.value[i];
const formatStr = formatValue(value.value, {
generateConfig: generateConfig2.value,
locale: locale2.value,
format: format2
});
fullValueTexts2.push(formatStr);
if (i === 0) {
firstValueText2 = formatStr;
}
}
return [fullValueTexts2, firstValueText2];
}, [value, formatList], (next, prev) => prev[0] !== next[0] || !shallowequal(prev[1], next[1]));
const fullValueTexts = computed(() => texts.value[0]);
const firstValueText = computed(() => texts.value[1]);
return [fullValueTexts, firstValueText];
}
function useHoverValue(valueText, _ref) {
let {
formatList,
generateConfig: generateConfig2,
locale: locale2
} = _ref;
const innerValue = ref(null);
let rafId;
function setValue2(val) {
let immediately = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
wrapperRaf.cancel(rafId);
if (immediately) {
innerValue.value = val;
return;
}
rafId = wrapperRaf(() => {
innerValue.value = val;
});
}
const [, firstText] = useValueTexts(innerValue, {
formatList,
generateConfig: generateConfig2,
locale: locale2
});
function onEnter(date) {
setValue2(date);
}
function onLeave() {
let immediately = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
setValue2(null, immediately);
}
watch(valueText, () => {
onLeave(true);
});
return [firstText, onEnter, onLeave];
}
function usePresets(presets, legacyRanges) {
return computed(() => {
if (presets === null || presets === void 0 ? void 0 : presets.value) {
return presets.value;
}
if (legacyRanges === null || legacyRanges === void 0 ? void 0 : legacyRanges.value) {
warningOnce(false, "`ranges` is deprecated. Please use `presets` instead.");
const rangeLabels = Object.keys(legacyRanges.value);
return rangeLabels.map((label) => {
const range = legacyRanges.value[label];
const newValues = typeof range === "function" ? range() : range;
return {
label,
value: newValues
};
});
}
return [];
});
}
function Picker() {
return defineComponent({
name: "Picker",
inheritAttrs: false,
props: ["prefixCls", "id", "tabindex", "dropdownClassName", "dropdownAlign", "popupStyle", "transitionName", "generateConfig", "locale", "inputReadOnly", "allowClear", "autofocus", "showTime", "showNow", "showHour", "showMinute", "showSecond", "picker", "format", "use12Hours", "value", "defaultValue", "open", "defaultOpen", "defaultOpenValue", "suffixIcon", "presets", "clearIcon", "disabled", "disabledDate", "placeholder", "getPopupContainer", "panelRender", "inputRender", "onChange", "onOpenChange", "onPanelChange", "onFocus", "onBlur", "onMousedown", "onMouseup", "onMouseenter", "onMouseleave", "onContextmenu", "onClick", "onKeydown", "onSelect", "direction", "autocomplete", "showToday", "renderExtraFooter", "dateRender", "minuteStep", "hourStep", "secondStep", "hideDisabledOptions"],
setup(props2, _ref) {
let {
attrs,
expose
} = _ref;
const inputRef = ref(null);
const presets = computed(() => props2.presets);
const presetList = usePresets(presets);
const picker = computed(() => {
var _a;
return (_a = props2.picker) !== null && _a !== void 0 ? _a : "date";
});
const needConfirmButton = computed(() => picker.value === "date" && !!props2.showTime || picker.value === "time");
const formatList = computed(() => toArray$6(getDefaultFormat(props2.format, picker.value, props2.showTime, props2.use12Hours)));
const panelDivRef = ref(null);
const inputDivRef = ref(null);
const containerRef = ref(null);
const [mergedValue, setInnerValue] = useMergedState(null, {
value: toRef(props2, "value"),
defaultValue: props2.defaultValue
});
const selectedValue = ref(mergedValue.value);
const setSelectedValue = (val) => {
selectedValue.value = val;
};
const operationRef = ref(null);
const [mergedOpen, triggerInnerOpen] = useMergedState(false, {
value: toRef(props2, "open"),
defaultValue: props2.defaultOpen,
postState: (postOpen) => props2.disabled ? false : postOpen,
onChange: (newOpen) => {
if (props2.onOpenChange) {
props2.onOpenChange(newOpen);
}
if (!newOpen && operationRef.value && operationRef.value.onClose) {
operationRef.value.onClose();
}
}
});
const [valueTexts, firstValueText] = useValueTexts(selectedValue, {
formatList,
generateConfig: toRef(props2, "generateConfig"),
locale: toRef(props2, "locale")
});
const [text, triggerTextChange, resetText] = useTextValueMapping({
valueTexts,
onTextChange: (newText) => {
const inputDate = parseValue(newText, {
locale: props2.locale,
formatList: formatList.value,
generateConfig: props2.generateConfig
});
if (inputDate && (!props2.disabledDate || !props2.disabledDate(inputDate))) {
setSelectedValue(inputDate);
}
}
});
const triggerChange = (newValue) => {
const {
onChange,
generateConfig: generateConfig2,
locale: locale2
} = props2;
setSelectedValue(newValue);
setInnerValue(newValue);
if (onChange && !isEqual$1(generateConfig2, mergedValue.value, newValue)) {
onChange(newValue, newValue ? formatValue(newValue, {
generateConfig: generateConfig2,
locale: locale2,
format: formatList.value[0]
}) : "");
}
};
const triggerOpen = (newOpen) => {
if (props2.disabled && newOpen) {
return;
}
triggerInnerOpen(newOpen);
};
const forwardKeydown = (e) => {
if (mergedOpen.value && operationRef.value && operationRef.value.onKeydown) {
return operationRef.value.onKeydown(e);
}
{
return false;
}
};
const onInternalMouseup = function() {
if (props2.onMouseup) {
props2.onMouseup(...arguments);
}
if (inputRef.value) {
inputRef.value.focus();
triggerOpen(true);
}
};
const [inputProps2, {
focused,
typing
}] = usePickerInput({
blurToCancel: needConfirmButton,
open: mergedOpen,
value: text,
triggerOpen,
forwardKeydown,
isClickOutside: (target) => !elementsContains([panelDivRef.value, inputDivRef.value, containerRef.value], target),
onSubmit: () => {
if (
// When user typing disabledDate with keyboard and enter, this value will be empty
!selectedValue.value || // Normal disabled check
props2.disabledDate && props2.disabledDate(selectedValue.value)
) {
return false;
}
triggerChange(selectedValue.value);
triggerOpen(false);
resetText();
return true;
},
onCancel: () => {
triggerOpen(false);
setSelectedValue(mergedValue.value);
resetText();
},
onKeydown: (e, preventDefault) => {
var _a;
(_a = props2.onKeydown) === null || _a === void 0 ? void 0 : _a.call(props2, e, preventDefault);
},
onFocus: (e) => {
var _a;
(_a = props2.onFocus) === null || _a === void 0 ? void 0 : _a.call(props2, e);
},
onBlur: (e) => {
var _a;
(_a = props2.onBlur) === null || _a === void 0 ? void 0 : _a.call(props2, e);
}
});
watch([mergedOpen, valueTexts], () => {
if (!mergedOpen.value) {
setSelectedValue(mergedValue.value);
if (!valueTexts.value.length || valueTexts.value[0] === "") {
triggerTextChange("");
} else if (firstValueText.value !== text.value) {
resetText();
}
}
});
watch(picker, () => {
if (!mergedOpen.value) {
resetText();
}
});
watch(mergedValue, () => {
setSelectedValue(mergedValue.value);
});
const [hoverValue, onEnter, onLeave] = useHoverValue(text, {
formatList,
generateConfig: toRef(props2, "generateConfig"),
locale: toRef(props2, "locale")
});
const onContextSelect = (date, type) => {
if (type === "submit" || type !== "key" && !needConfirmButton.value) {
triggerChange(date);
triggerOpen(false);
}
};
useProvidePanel({
operationRef,
hideHeader: computed(() => picker.value === "time"),
onSelect: onContextSelect,
open: mergedOpen,
defaultOpenValue: toRef(props2, "defaultOpenValue"),
onDateMouseenter: onEnter,
onDateMouseleave: onLeave
});
expose({
focus: () => {
if (inputRef.value) {
inputRef.value.focus();
}
},
blur: () => {
if (inputRef.value) {
inputRef.value.blur();
}
}
});
return () => {
const {
prefixCls = "rc-picker",
id,
tabindex,
dropdownClassName,
dropdownAlign,
popupStyle,
transitionName: transitionName2,
generateConfig: generateConfig2,
locale: locale2,
inputReadOnly,
allowClear,
autofocus,
picker: picker2 = "date",
defaultOpenValue,
suffixIcon,
clearIcon,
disabled,
placeholder,
getPopupContainer,
panelRender: panelRender2,
onMousedown,
onMouseenter,
onMouseleave,
onContextmenu,
onClick,
onSelect,
direction,
autocomplete = "off"
} = props2;
const panelProps = _extends(_extends(_extends({}, props2), attrs), {
class: classNames({
[`${prefixCls}-panel-focused`]: !typing.value
}),
style: void 0,
pickerValue: void 0,
onPickerValueChange: void 0,
onChange: null
});
let panelNode = createVNode("div", {
"class": `${prefixCls}-panel-layout`
}, [createVNode(PresetPanel, {
"prefixCls": prefixCls,
"presets": presetList.value,
"onClick": (nextValue) => {
triggerChange(nextValue);
triggerOpen(false);
}
}, null), createVNode(PickerPanel$1, _objectSpread$W(_objectSpread$W({}, panelProps), {}, {
"generateConfig": generateConfig2,
"value": selectedValue.value,
"locale": locale2,
"tabindex": -1,
"onSelect": (date) => {
onSelect === null || onSelect === void 0 ? void 0 : onSelect(date);
setSelectedValue(date);
},
"direction": direction,
"onPanelChange": (viewDate, mode) => {
const {
onPanelChange
} = props2;
onLeave(true);
onPanelChange === null || onPanelChange === void 0 ? void 0 : onPanelChange(viewDate, mode);
}
}), null)]);
if (panelRender2) {
panelNode = panelRender2(panelNode);
}
const panel = createVNode("div", {
"class": `${prefixCls}-panel-container`,
"ref": panelDivRef,
"onMousedown": (e) => {
e.preventDefault();
}
}, [panelNode]);
let suffixNode;
if (suffixIcon) {
suffixNode = createVNode("span", {
"class": `${prefixCls}-suffix`
}, [suffixIcon]);
}
let clearNode;
if (allowClear && mergedValue.value && !disabled) {
clearNode = createVNode("span", {
"onMousedown": (e) => {
e.preventDefault();
e.stopPropagation();
},
"onMouseup": (e) => {
e.preventDefault();
e.stopPropagation();
triggerChange(null);
triggerOpen(false);
},
"class": `${prefixCls}-clear`,
"role": "button"
}, [clearIcon || createVNode("span", {
"class": `${prefixCls}-clear-btn`
}, null)]);
}
const mergedInputProps = _extends(_extends(_extends(_extends({
id,
tabindex,
disabled,
readonly: inputReadOnly || typeof formatList.value[0] === "function" || !typing.value,
value: hoverValue.value || text.value,
onInput: (e) => {
triggerTextChange(e.target.value);
},
autofocus,
placeholder,
ref: inputRef,
title: text.value
}, inputProps2.value), {
size: getInputSize(picker2, formatList.value[0], generateConfig2)
}), getDataOrAriaProps(props2)), {
autocomplete
});
const inputNode = props2.inputRender ? props2.inputRender(mergedInputProps) : createVNode("input", mergedInputProps, null);
const popupPlacement = direction === "rtl" ? "bottomRight" : "bottomLeft";
return createVNode("div", {
"ref": containerRef,
"class": classNames(prefixCls, attrs.class, {
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-focused`]: focused.value,
[`${prefixCls}-rtl`]: direction === "rtl"
}),
"style": attrs.style,
"onMousedown": onMousedown,
"onMouseup": onInternalMouseup,
"onMouseenter": onMouseenter,
"onMouseleave": onMouseleave,
"onContextmenu": onContextmenu,
"onClick": onClick
}, [createVNode("div", {
"class": classNames(`${prefixCls}-input`, {
[`${prefixCls}-input-placeholder`]: !!hoverValue.value
}),
"ref": inputDivRef
}, [inputNode, suffixNode, clearNode]), createVNode(PickerTrigger, {
"visible": mergedOpen.value,
"popupStyle": popupStyle,
"prefixCls": prefixCls,
"dropdownClassName": dropdownClassName,
"dropdownAlign": dropdownAlign,
"getPopupContainer": getPopupContainer,
"transitionName": transitionName2,
"popupPlacement": popupPlacement,
"direction": direction
}, {
default: () => [createVNode("div", {
"style": {
pointerEvents: "none",
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0
}
}, null)],
popupElement: () => panel
})]);
};
}
});
}
const Picker$1 = Picker();
function useRangeDisabled(_ref, openRecordsRef) {
let {
picker,
locale: locale2,
selectedValue,
disabledDate,
disabled,
generateConfig: generateConfig2
} = _ref;
const startDate = computed(() => getValue$1(selectedValue.value, 0));
const endDate = computed(() => getValue$1(selectedValue.value, 1));
function weekFirstDate(date) {
return generateConfig2.value.locale.getWeekFirstDate(locale2.value.locale, date);
}
function monthNumber(date) {
const year = generateConfig2.value.getYear(date);
const month = generateConfig2.value.getMonth(date);
return year * 100 + month;
}
function quarterNumber(date) {
const year = generateConfig2.value.getYear(date);
const quarter = getQuarter(generateConfig2.value, date);
return year * 10 + quarter;
}
const disabledStartDate = (date) => {
var _a;
if (disabledDate && ((_a = disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate.value) === null || _a === void 0 ? void 0 : _a.call(disabledDate, date))) {
return true;
}
if (disabled[1] && endDate) {
return !isSameDate(generateConfig2.value, date, endDate.value) && generateConfig2.value.isAfter(date, endDate.value);
}
if (openRecordsRef.value[1] && endDate.value) {
switch (picker.value) {
case "quarter":
return quarterNumber(date) > quarterNumber(endDate.value);
case "month":
return monthNumber(date) > monthNumber(endDate.value);
case "week":
return weekFirstDate(date) > weekFirstDate(endDate.value);
default:
return !isSameDate(generateConfig2.value, date, endDate.value) && generateConfig2.value.isAfter(date, endDate.value);
}
}
return false;
};
const disabledEndDate = (date) => {
var _a;
if ((_a = disabledDate.value) === null || _a === void 0 ? void 0 : _a.call(disabledDate, date)) {
return true;
}
if (disabled[0] && startDate) {
return !isSameDate(generateConfig2.value, date, endDate.value) && generateConfig2.value.isAfter(startDate.value, date);
}
if (openRecordsRef.value[0] && startDate.value) {
switch (picker.value) {
case "quarter":
return quarterNumber(date) < quarterNumber(startDate.value);
case "month":
return monthNumber(date) < monthNumber(startDate.value);
case "week":
return weekFirstDate(date) < weekFirstDate(startDate.value);
default:
return !isSameDate(generateConfig2.value, date, startDate.value) && generateConfig2.value.isAfter(startDate.value, date);
}
}
return false;
};
return [disabledStartDate, disabledEndDate];
}
function getStartEndDistance(startDate, endDate, picker, generateConfig2) {
const startNext = getClosingViewDate(startDate, picker, generateConfig2, 1);
function getDistance(compareFunc) {
if (compareFunc(startDate, endDate)) {
return "same";
}
if (compareFunc(startNext, endDate)) {
return "closing";
}
return "far";
}
switch (picker) {
case "year":
return getDistance((start, end) => isSameDecade(generateConfig2, start, end));
case "quarter":
case "month":
return getDistance((start, end) => isSameYear(generateConfig2, start, end));
default:
return getDistance((start, end) => isSameMonth(generateConfig2, start, end));
}
}
function getRangeViewDate(values, index2, picker, generateConfig2) {
const startDate = getValue$1(values, 0);
const endDate = getValue$1(values, 1);
if (index2 === 0) {
return startDate;
}
if (startDate && endDate) {
const distance = getStartEndDistance(startDate, endDate, picker, generateConfig2);
switch (distance) {
case "same":
return startDate;
case "closing":
return startDate;
default:
return getClosingViewDate(endDate, picker, generateConfig2, -1);
}
}
return startDate;
}
function useRangeViewDates(_ref) {
let {
values,
picker,
defaultDates,
generateConfig: generateConfig2
} = _ref;
const defaultViewDates = ref([getValue$1(defaultDates, 0), getValue$1(defaultDates, 1)]);
const viewDates = ref(null);
const startDate = computed(() => getValue$1(values.value, 0));
const endDate = computed(() => getValue$1(values.value, 1));
const getViewDate = (index2) => {
if (defaultViewDates.value[index2]) {
return defaultViewDates.value[index2];
}
return getValue$1(viewDates.value, index2) || getRangeViewDate(values.value, index2, picker.value, generateConfig2.value) || startDate.value || endDate.value || generateConfig2.value.getNow();
};
const startViewDate = ref(null);
const endViewDate = ref(null);
watchEffect(() => {
startViewDate.value = getViewDate(0);
endViewDate.value = getViewDate(1);
});
function setViewDate(viewDate, index2) {
if (viewDate) {
let newViewDates = updateValues(viewDates.value, viewDate, index2);
defaultViewDates.value = updateValues(defaultViewDates.value, null, index2) || [null, null];
const anotherIndex = (index2 + 1) % 2;
if (!getValue$1(values.value, anotherIndex)) {
newViewDates = updateValues(newViewDates, viewDate, anotherIndex);
}
viewDates.value = newViewDates;
} else if (startDate.value || endDate.value) {
viewDates.value = null;
}
}
return [startViewDate, endViewDate, setViewDate];
}
function tryOnScopeDispose(fn) {
if (getCurrentScope()) {
onScopeDispose(fn);
return true;
}
return false;
}
function resolveUnref(r) {
return typeof r === "function" ? r() : unref(r);
}
function unrefElement(elRef) {
var _a;
const plain = resolveUnref(elRef);
return (_a = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _a !== void 0 ? _a : plain;
}
function tryOnMounted(fn) {
let sync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
if (getCurrentInstance()) onMounted(fn);
else if (sync) fn();
else nextTick(fn);
}
function useSupported(callback) {
let sync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const isSupported = shallowRef();
const update = () => isSupported.value = Boolean(callback());
update();
tryOnMounted(update, sync);
return isSupported;
}
const defaultWindow = void 0;
var __rest$Z = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function useResizeObserver(target, callback) {
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
const {
window = defaultWindow
} = options, observerOptions = __rest$Z(options, ["window"]);
let observer;
const isSupported = useSupported(() => window && "ResizeObserver" in window);
const cleanup2 = () => {
if (observer) {
observer.disconnect();
observer = void 0;
}
};
const stopWatch = watch(() => unrefElement(target), (el) => {
cleanup2();
if (isSupported.value && window && el) {
observer = new ResizeObserver(callback);
observer.observe(el, observerOptions);
}
}, {
immediate: true,
flush: "post"
});
const stop = () => {
cleanup2();
stopWatch();
};
tryOnScopeDispose(stop);
return {
isSupported,
stop
};
}
function useElementSize(target) {
let initialSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
width: 0,
height: 0
};
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
const {
box: box2 = "content-box"
} = options;
const width = shallowRef(initialSize.width);
const height = shallowRef(initialSize.height);
useResizeObserver(target, (_ref) => {
let [entry2] = _ref;
const boxSize = box2 === "border-box" ? entry2.borderBoxSize : box2 === "content-box" ? entry2.contentBoxSize : entry2.devicePixelContentBoxSize;
if (boxSize) {
width.value = boxSize.reduce((acc, _ref2) => {
let {
inlineSize
} = _ref2;
return acc + inlineSize;
}, 0);
height.value = boxSize.reduce((acc, _ref3) => {
let {
blockSize
} = _ref3;
return acc + blockSize;
}, 0);
} else {
width.value = entry2.contentRect.width;
height.value = entry2.contentRect.height;
}
}, options);
watch(() => unrefElement(target), (ele) => {
width.value = ele ? initialSize.width : 0;
height.value = ele ? initialSize.height : 0;
});
return {
width,
height
};
}
function reorderValues(values, generateConfig2) {
if (values && values[0] && values[1] && generateConfig2.isAfter(values[0], values[1])) {
return [values[1], values[0]];
}
return values;
}
function canValueTrigger(value, index2, disabled, allowEmpty) {
if (value) {
return true;
}
if (allowEmpty && allowEmpty[index2]) {
return true;
}
if (disabled[(index2 + 1) % 2]) {
return true;
}
return false;
}
function RangerPicker() {
return defineComponent({
name: "RangerPicker",
inheritAttrs: false,
props: ["prefixCls", "id", "popupStyle", "dropdownClassName", "transitionName", "dropdownAlign", "getPopupContainer", "generateConfig", "locale", "placeholder", "autofocus", "disabled", "format", "picker", "showTime", "showNow", "showHour", "showMinute", "showSecond", "use12Hours", "separator", "value", "defaultValue", "defaultPickerValue", "open", "defaultOpen", "disabledDate", "disabledTime", "dateRender", "panelRender", "ranges", "allowEmpty", "allowClear", "suffixIcon", "clearIcon", "pickerRef", "inputReadOnly", "mode", "renderExtraFooter", "onChange", "onOpenChange", "onPanelChange", "onCalendarChange", "onFocus", "onBlur", "onMousedown", "onMouseup", "onMouseenter", "onMouseleave", "onClick", "onOk", "onKeydown", "components", "order", "direction", "activePickerIndex", "autocomplete", "minuteStep", "hourStep", "secondStep", "hideDisabledOptions", "disabledMinutes", "presets", "prevIcon", "nextIcon", "superPrevIcon", "superNextIcon"],
setup(props2, _ref) {
let {
attrs,
expose
} = _ref;
const needConfirmButton = computed(() => props2.picker === "date" && !!props2.showTime || props2.picker === "time");
const presets = computed(() => props2.presets);
const ranges = computed(() => props2.ranges);
const presetList = usePresets(presets, ranges);
const openRecordsRef = ref({});
const containerRef = ref(null);
const panelDivRef = ref(null);
const startInputDivRef = ref(null);
const endInputDivRef = ref(null);
const separatorRef = ref(null);
const startInputRef = ref(null);
const endInputRef = ref(null);
const arrowRef = ref(null);
const formatList = computed(() => toArray$6(getDefaultFormat(props2.format, props2.picker, props2.showTime, props2.use12Hours)));
const [mergedActivePickerIndex, setMergedActivePickerIndex] = useMergedState(0, {
value: toRef(props2, "activePickerIndex")
});
const operationRef = ref(null);
const mergedDisabled = computed(() => {
const {
disabled
} = props2;
if (Array.isArray(disabled)) {
return disabled;
}
return [disabled || false, disabled || false];
});
const [mergedValue, setInnerValue] = useMergedState(null, {
value: toRef(props2, "value"),
defaultValue: props2.defaultValue,
postState: (values) => props2.picker === "time" && !props2.order ? values : reorderValues(values, props2.generateConfig)
});
const [startViewDate, endViewDate, setViewDate] = useRangeViewDates({
values: mergedValue,
picker: toRef(props2, "picker"),
defaultDates: props2.defaultPickerValue,
generateConfig: toRef(props2, "generateConfig")
});
const [selectedValue, setSelectedValue] = useMergedState(mergedValue.value, {
postState: (values) => {
let postValues = values;
if (mergedDisabled.value[0] && mergedDisabled.value[1]) {
return postValues;
}
for (let i = 0; i < 2; i += 1) {
if (mergedDisabled.value[i] && !getValue$1(postValues, i) && !getValue$1(props2.allowEmpty, i)) {
postValues = updateValues(postValues, props2.generateConfig.getNow(), i);
}
}
return postValues;
}
});
const [mergedModes, setInnerModes] = useMergedState([props2.picker, props2.picker], {
value: toRef(props2, "mode")
});
watch(() => props2.picker, () => {
setInnerModes([props2.picker, props2.picker]);
});
const triggerModesChange = (modes, values) => {
var _a;
setInnerModes(modes);
(_a = props2.onPanelChange) === null || _a === void 0 ? void 0 : _a.call(props2, values, modes);
};
const [disabledStartDate, disabledEndDate] = useRangeDisabled({
picker: toRef(props2, "picker"),
selectedValue,
locale: toRef(props2, "locale"),
disabled: mergedDisabled,
disabledDate: toRef(props2, "disabledDate"),
generateConfig: toRef(props2, "generateConfig")
}, openRecordsRef);
const [mergedOpen, triggerInnerOpen] = useMergedState(false, {
value: toRef(props2, "open"),
defaultValue: props2.defaultOpen,
postState: (postOpen) => mergedDisabled.value[mergedActivePickerIndex.value] ? false : postOpen,
onChange: (newOpen) => {
var _a;
(_a = props2.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(props2, newOpen);
if (!newOpen && operationRef.value && operationRef.value.onClose) {
operationRef.value.onClose();
}
}
});
const startOpen = computed(() => mergedOpen.value && mergedActivePickerIndex.value === 0);
const endOpen = computed(() => mergedOpen.value && mergedActivePickerIndex.value === 1);
const panelLeft = ref(0);
const arrowLeft = ref(0);
const popupMinWidth = ref(0);
const {
width: containerWidth
} = useElementSize(containerRef);
watch([mergedOpen, containerWidth], () => {
if (!mergedOpen.value && containerRef.value) {
popupMinWidth.value = containerWidth.value;
}
});
const {
width: panelDivWidth
} = useElementSize(panelDivRef);
const {
width: arrowWidth
} = useElementSize(arrowRef);
const {
width: startInputDivWidth
} = useElementSize(startInputDivRef);
const {
width: separatorWidth
} = useElementSize(separatorRef);
watch([mergedActivePickerIndex, mergedOpen, panelDivWidth, arrowWidth, startInputDivWidth, separatorWidth, () => props2.direction], () => {
arrowLeft.value = 0;
if (mergedActivePickerIndex.value) {
if (startInputDivRef.value && separatorRef.value) {
arrowLeft.value = startInputDivWidth.value + separatorWidth.value;
if (panelDivWidth.value && arrowWidth.value && arrowLeft.value > panelDivWidth.value - arrowWidth.value - (props2.direction === "rtl" || arrowRef.value.offsetLeft > arrowLeft.value ? 0 : arrowRef.value.offsetLeft)) {
panelLeft.value = arrowLeft.value;
}
}
} else if (mergedActivePickerIndex.value === 0) {
panelLeft.value = 0;
}
}, {
immediate: true
});
const triggerRef2 = ref();
function triggerOpen(newOpen, index2) {
if (newOpen) {
clearTimeout(triggerRef2.value);
openRecordsRef.value[index2] = true;
setMergedActivePickerIndex(index2);
triggerInnerOpen(newOpen);
if (!mergedOpen.value) {
setViewDate(null, index2);
}
} else if (mergedActivePickerIndex.value === index2) {
triggerInnerOpen(newOpen);
const openRecords = openRecordsRef.value;
triggerRef2.value = setTimeout(() => {
if (openRecords === openRecordsRef.value) {
openRecordsRef.value = {};
}
});
}
}
function triggerOpenAndFocus(index2) {
triggerOpen(true, index2);
setTimeout(() => {
const inputRef = [startInputRef, endInputRef][index2];
if (inputRef.value) {
inputRef.value.focus();
}
}, 0);
}
function triggerChange(newValue, sourceIndex) {
let values = newValue;
let startValue = getValue$1(values, 0);
let endValue = getValue$1(values, 1);
const {
generateConfig: generateConfig2,
locale: locale2,
picker,
order,
onCalendarChange,
allowEmpty,
onChange,
showTime
} = props2;
if (startValue && endValue && generateConfig2.isAfter(startValue, endValue)) {
if (
// WeekPicker only compare week
picker === "week" && !isSameWeek(generateConfig2, locale2.locale, startValue, endValue) || // QuotaPicker only compare week
picker === "quarter" && !isSameQuarter(generateConfig2, startValue, endValue) || // Other non-TimePicker compare date
picker !== "week" && picker !== "quarter" && picker !== "time" && !(showTime ? isEqual$1(generateConfig2, startValue, endValue) : isSameDate(generateConfig2, startValue, endValue))
) {
if (sourceIndex === 0) {
values = [startValue, null];
endValue = null;
} else {
startValue = null;
values = [null, endValue];
}
openRecordsRef.value = {
[sourceIndex]: true
};
} else if (picker !== "time" || order !== false) {
values = reorderValues(values, generateConfig2);
}
}
setSelectedValue(values);
const startStr2 = values && values[0] ? formatValue(values[0], {
generateConfig: generateConfig2,
locale: locale2,
format: formatList.value[0]
}) : "";
const endStr2 = values && values[1] ? formatValue(values[1], {
generateConfig: generateConfig2,
locale: locale2,
format: formatList.value[0]
}) : "";
if (onCalendarChange) {
const info = {
range: sourceIndex === 0 ? "start" : "end"
};
onCalendarChange(values, [startStr2, endStr2], info);
}
const canStartValueTrigger = canValueTrigger(startValue, 0, mergedDisabled.value, allowEmpty);
const canEndValueTrigger = canValueTrigger(endValue, 1, mergedDisabled.value, allowEmpty);
const canTrigger = values === null || canStartValueTrigger && canEndValueTrigger;
if (canTrigger) {
setInnerValue(values);
if (onChange && (!isEqual$1(generateConfig2, getValue$1(mergedValue.value, 0), startValue) || !isEqual$1(generateConfig2, getValue$1(mergedValue.value, 1), endValue))) {
onChange(values, [startStr2, endStr2]);
}
}
let nextOpenIndex = null;
if (sourceIndex === 0 && !mergedDisabled.value[1]) {
nextOpenIndex = 1;
} else if (sourceIndex === 1 && !mergedDisabled.value[0]) {
nextOpenIndex = 0;
}
if (nextOpenIndex !== null && nextOpenIndex !== mergedActivePickerIndex.value && (!openRecordsRef.value[nextOpenIndex] || !getValue$1(values, nextOpenIndex)) && getValue$1(values, sourceIndex)) {
triggerOpenAndFocus(nextOpenIndex);
} else {
triggerOpen(false, sourceIndex);
}
}
const forwardKeydown = (e) => {
if (mergedOpen && operationRef.value && operationRef.value.onKeydown) {
return operationRef.value.onKeydown(e);
}
{
return false;
}
};
const sharedTextHooksProps = {
formatList,
generateConfig: toRef(props2, "generateConfig"),
locale: toRef(props2, "locale")
};
const [startValueTexts, firstStartValueText] = useValueTexts(computed(() => getValue$1(selectedValue.value, 0)), sharedTextHooksProps);
const [endValueTexts, firstEndValueText] = useValueTexts(computed(() => getValue$1(selectedValue.value, 1)), sharedTextHooksProps);
const onTextChange = (newText, index2) => {
const inputDate = parseValue(newText, {
locale: props2.locale,
formatList: formatList.value,
generateConfig: props2.generateConfig
});
const disabledFunc = index2 === 0 ? disabledStartDate : disabledEndDate;
if (inputDate && !disabledFunc(inputDate)) {
setSelectedValue(updateValues(selectedValue.value, inputDate, index2));
setViewDate(inputDate, index2);
}
};
const [startText, triggerStartTextChange, resetStartText] = useTextValueMapping({
valueTexts: startValueTexts,
onTextChange: (newText) => onTextChange(newText, 0)
});
const [endText, triggerEndTextChange, resetEndText] = useTextValueMapping({
valueTexts: endValueTexts,
onTextChange: (newText) => onTextChange(newText, 1)
});
const [rangeHoverValue, setRangeHoverValue] = useState$1(null);
const [hoverRangedValue, setHoverRangedValue] = useState$1(null);
const [startHoverValue, onStartEnter, onStartLeave] = useHoverValue(startText, sharedTextHooksProps);
const [endHoverValue, onEndEnter, onEndLeave] = useHoverValue(endText, sharedTextHooksProps);
const onDateMouseenter = (date) => {
setHoverRangedValue(updateValues(selectedValue.value, date, mergedActivePickerIndex.value));
if (mergedActivePickerIndex.value === 0) {
onStartEnter(date);
} else {
onEndEnter(date);
}
};
const onDateMouseleave = () => {
setHoverRangedValue(updateValues(selectedValue.value, null, mergedActivePickerIndex.value));
if (mergedActivePickerIndex.value === 0) {
onStartLeave();
} else {
onEndLeave();
}
};
const getSharedInputHookProps = (index2, resetText) => ({
forwardKeydown,
onBlur: (e) => {
var _a;
(_a = props2.onBlur) === null || _a === void 0 ? void 0 : _a.call(props2, e);
},
isClickOutside: (target) => !elementsContains([panelDivRef.value, startInputDivRef.value, endInputDivRef.value, containerRef.value], target),
onFocus: (e) => {
var _a;
setMergedActivePickerIndex(index2);
(_a = props2.onFocus) === null || _a === void 0 ? void 0 : _a.call(props2, e);
},
triggerOpen: (newOpen) => {
triggerOpen(newOpen, index2);
},
onSubmit: () => {
if (
// When user typing disabledDate with keyboard and enter, this value will be empty
!selectedValue.value || // Normal disabled check
props2.disabledDate && props2.disabledDate(selectedValue.value[index2])
) {
return false;
}
triggerChange(selectedValue.value, index2);
resetText();
},
onCancel: () => {
triggerOpen(false, index2);
setSelectedValue(mergedValue.value);
resetText();
}
});
const [startInputProps, {
focused: startFocused,
typing: startTyping
}] = usePickerInput(_extends(_extends({}, getSharedInputHookProps(0, resetStartText)), {
blurToCancel: needConfirmButton,
open: startOpen,
value: startText,
onKeydown: (e, preventDefault) => {
var _a;
(_a = props2.onKeydown) === null || _a === void 0 ? void 0 : _a.call(props2, e, preventDefault);
}
}));
const [endInputProps, {
focused: endFocused,
typing: endTyping
}] = usePickerInput(_extends(_extends({}, getSharedInputHookProps(1, resetEndText)), {
blurToCancel: needConfirmButton,
open: endOpen,
value: endText,
onKeydown: (e, preventDefault) => {
var _a;
(_a = props2.onKeydown) === null || _a === void 0 ? void 0 : _a.call(props2, e, preventDefault);
}
}));
const onPickerClick = (e) => {
var _a;
(_a = props2.onClick) === null || _a === void 0 ? void 0 : _a.call(props2, e);
if (!mergedOpen.value && !startInputRef.value.contains(e.target) && !endInputRef.value.contains(e.target)) {
if (!mergedDisabled.value[0]) {
triggerOpenAndFocus(0);
} else if (!mergedDisabled.value[1]) {
triggerOpenAndFocus(1);
}
}
};
const onPickerMousedown = (e) => {
var _a;
(_a = props2.onMousedown) === null || _a === void 0 ? void 0 : _a.call(props2, e);
if (mergedOpen.value && (startFocused.value || endFocused.value) && !startInputRef.value.contains(e.target) && !endInputRef.value.contains(e.target)) {
e.preventDefault();
}
};
const startStr = computed(() => {
var _a;
return ((_a = mergedValue.value) === null || _a === void 0 ? void 0 : _a[0]) ? formatValue(mergedValue.value[0], {
locale: props2.locale,
format: "YYYYMMDDHHmmss",
generateConfig: props2.generateConfig
}) : "";
});
const endStr = computed(() => {
var _a;
return ((_a = mergedValue.value) === null || _a === void 0 ? void 0 : _a[1]) ? formatValue(mergedValue.value[1], {
locale: props2.locale,
format: "YYYYMMDDHHmmss",
generateConfig: props2.generateConfig
}) : "";
});
watch([mergedOpen, startValueTexts, endValueTexts], () => {
if (!mergedOpen.value) {
setSelectedValue(mergedValue.value);
if (!startValueTexts.value.length || startValueTexts.value[0] === "") {
triggerStartTextChange("");
} else if (firstStartValueText.value !== startText.value) {
resetStartText();
}
if (!endValueTexts.value.length || endValueTexts.value[0] === "") {
triggerEndTextChange("");
} else if (firstEndValueText.value !== endText.value) {
resetEndText();
}
}
});
watch([startStr, endStr], () => {
setSelectedValue(mergedValue.value);
});
expose({
focus: () => {
if (startInputRef.value) {
startInputRef.value.focus();
}
},
blur: () => {
if (startInputRef.value) {
startInputRef.value.blur();
}
if (endInputRef.value) {
endInputRef.value.blur();
}
}
});
const panelHoverRangedValue = computed(() => {
if (mergedOpen.value && hoverRangedValue.value && hoverRangedValue.value[0] && hoverRangedValue.value[1] && props2.generateConfig.isAfter(hoverRangedValue.value[1], hoverRangedValue.value[0])) {
return hoverRangedValue.value;
} else {
return null;
}
});
function renderPanel() {
let panelPosition = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
let panelProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const {
generateConfig: generateConfig2,
showTime,
dateRender,
direction,
disabledTime,
prefixCls,
locale: locale2
} = props2;
let panelShowTime = showTime;
if (showTime && typeof showTime === "object" && showTime.defaultValue) {
const timeDefaultValues = showTime.defaultValue;
panelShowTime = _extends(_extends({}, showTime), {
defaultValue: getValue$1(timeDefaultValues, mergedActivePickerIndex.value) || void 0
});
}
let panelDateRender = null;
if (dateRender) {
panelDateRender = (_ref2) => {
let {
current: date,
today
} = _ref2;
return dateRender({
current: date,
today,
info: {
range: mergedActivePickerIndex.value ? "end" : "start"
}
});
};
}
return createVNode(RangeContextProvider, {
"value": {
inRange: true,
panelPosition,
rangedValue: rangeHoverValue.value || selectedValue.value,
hoverRangedValue: panelHoverRangedValue.value
}
}, {
default: () => [createVNode(PickerPanel$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, props2), panelProps), {}, {
"dateRender": panelDateRender,
"showTime": panelShowTime,
"mode": mergedModes.value[mergedActivePickerIndex.value],
"generateConfig": generateConfig2,
"style": void 0,
"direction": direction,
"disabledDate": mergedActivePickerIndex.value === 0 ? disabledStartDate : disabledEndDate,
"disabledTime": (date) => {
if (disabledTime) {
return disabledTime(date, mergedActivePickerIndex.value === 0 ? "start" : "end");
}
return false;
},
"class": classNames({
[`${prefixCls}-panel-focused`]: mergedActivePickerIndex.value === 0 ? !startTyping.value : !endTyping.value
}),
"value": getValue$1(selectedValue.value, mergedActivePickerIndex.value),
"locale": locale2,
"tabIndex": -1,
"onPanelChange": (date, newMode) => {
if (mergedActivePickerIndex.value === 0) {
onStartLeave(true);
}
if (mergedActivePickerIndex.value === 1) {
onEndLeave(true);
}
triggerModesChange(updateValues(mergedModes.value, newMode, mergedActivePickerIndex.value), updateValues(selectedValue.value, date, mergedActivePickerIndex.value));
let viewDate = date;
if (panelPosition === "right" && mergedModes.value[mergedActivePickerIndex.value] === newMode) {
viewDate = getClosingViewDate(viewDate, newMode, generateConfig2, -1);
}
setViewDate(viewDate, mergedActivePickerIndex.value);
},
"onOk": null,
"onSelect": void 0,
"onChange": void 0,
"defaultValue": mergedActivePickerIndex.value === 0 ? getValue$1(selectedValue.value, 1) : getValue$1(selectedValue.value, 0)
}), null)]
});
}
const onContextSelect = (date, type) => {
const values = updateValues(selectedValue.value, date, mergedActivePickerIndex.value);
if (type === "submit" || type !== "key" && !needConfirmButton.value) {
triggerChange(values, mergedActivePickerIndex.value);
if (mergedActivePickerIndex.value === 0) {
onStartLeave();
} else {
onEndLeave();
}
} else {
setSelectedValue(values);
}
};
useProvidePanel({
operationRef,
hideHeader: computed(() => props2.picker === "time"),
onDateMouseenter,
onDateMouseleave,
hideRanges: computed(() => true),
onSelect: onContextSelect,
open: mergedOpen
});
return () => {
const {
prefixCls = "rc-picker",
id,
popupStyle,
dropdownClassName,
transitionName: transitionName2,
dropdownAlign,
getPopupContainer,
generateConfig: generateConfig2,
locale: locale2,
placeholder,
autofocus,
picker = "date",
showTime,
separator = "~",
disabledDate,
panelRender: panelRender2,
allowClear,
suffixIcon,
clearIcon,
inputReadOnly,
renderExtraFooter,
onMouseenter,
onMouseleave,
onMouseup,
onOk,
components: components2,
direction,
autocomplete = "off"
} = props2;
const arrowPositionStyle = direction === "rtl" ? {
right: `${arrowLeft.value}px`
} : {
left: `${arrowLeft.value}px`
};
function renderPanels() {
let panels;
const extraNode = getExtraFooter(prefixCls, mergedModes.value[mergedActivePickerIndex.value], renderExtraFooter);
const rangesNode = getRanges({
prefixCls,
components: components2,
needConfirmButton: needConfirmButton.value,
okDisabled: !getValue$1(selectedValue.value, mergedActivePickerIndex.value) || disabledDate && disabledDate(selectedValue.value[mergedActivePickerIndex.value]),
locale: locale2,
onOk: () => {
if (getValue$1(selectedValue.value, mergedActivePickerIndex.value)) {
triggerChange(selectedValue.value, mergedActivePickerIndex.value);
if (onOk) {
onOk(selectedValue.value);
}
}
}
});
if (picker !== "time" && !showTime) {
const viewDate = mergedActivePickerIndex.value === 0 ? startViewDate.value : endViewDate.value;
const nextViewDate = getClosingViewDate(viewDate, picker, generateConfig2);
const currentMode = mergedModes.value[mergedActivePickerIndex.value];
const showDoublePanel = currentMode === picker;
const leftPanel = renderPanel(showDoublePanel ? "left" : false, {
pickerValue: viewDate,
onPickerValueChange: (newViewDate) => {
setViewDate(newViewDate, mergedActivePickerIndex.value);
}
});
const rightPanel = renderPanel("right", {
pickerValue: nextViewDate,
onPickerValueChange: (newViewDate) => {
setViewDate(getClosingViewDate(newViewDate, picker, generateConfig2, -1), mergedActivePickerIndex.value);
}
});
if (direction === "rtl") {
panels = createVNode(Fragment, null, [rightPanel, showDoublePanel && leftPanel]);
} else {
panels = createVNode(Fragment, null, [leftPanel, showDoublePanel && rightPanel]);
}
} else {
panels = renderPanel();
}
let mergedNodes = createVNode("div", {
"class": `${prefixCls}-panel-layout`
}, [createVNode(PresetPanel, {
"prefixCls": prefixCls,
"presets": presetList.value,
"onClick": (nextValue) => {
triggerChange(nextValue, null);
triggerOpen(false, mergedActivePickerIndex.value);
},
"onHover": (hoverValue) => {
setRangeHoverValue(hoverValue);
}
}, null), createVNode("div", null, [createVNode("div", {
"class": `${prefixCls}-panels`
}, [panels]), (extraNode || rangesNode) && createVNode("div", {
"class": `${prefixCls}-footer`
}, [extraNode, rangesNode])])]);
if (panelRender2) {
mergedNodes = panelRender2(mergedNodes);
}
return createVNode("div", {
"class": `${prefixCls}-panel-container`,
"style": {
marginLeft: `${panelLeft.value}px`
},
"ref": panelDivRef,
"onMousedown": (e) => {
e.preventDefault();
}
}, [mergedNodes]);
}
const rangePanel = createVNode("div", {
"class": classNames(`${prefixCls}-range-wrapper`, `${prefixCls}-${picker}-range-wrapper`),
"style": {
minWidth: `${popupMinWidth.value}px`
}
}, [createVNode("div", {
"ref": arrowRef,
"class": `${prefixCls}-range-arrow`,
"style": arrowPositionStyle
}, null), renderPanels()]);
let suffixNode;
if (suffixIcon) {
suffixNode = createVNode("span", {
"class": `${prefixCls}-suffix`
}, [suffixIcon]);
}
let clearNode;
if (allowClear && (getValue$1(mergedValue.value, 0) && !mergedDisabled.value[0] || getValue$1(mergedValue.value, 1) && !mergedDisabled.value[1])) {
clearNode = createVNode("span", {
"onMousedown": (e) => {
e.preventDefault();
e.stopPropagation();
},
"onMouseup": (e) => {
e.preventDefault();
e.stopPropagation();
let values = mergedValue.value;
if (!mergedDisabled.value[0]) {
values = updateValues(values, null, 0);
}
if (!mergedDisabled.value[1]) {
values = updateValues(values, null, 1);
}
triggerChange(values, null);
triggerOpen(false, mergedActivePickerIndex.value);
},
"class": `${prefixCls}-clear`
}, [clearIcon || createVNode("span", {
"class": `${prefixCls}-clear-btn`
}, null)]);
}
const inputSharedProps = {
size: getInputSize(picker, formatList.value[0], generateConfig2)
};
let activeBarLeft = 0;
let activeBarWidth = 0;
if (startInputDivRef.value && endInputDivRef.value && separatorRef.value) {
if (mergedActivePickerIndex.value === 0) {
activeBarWidth = startInputDivRef.value.offsetWidth;
} else {
activeBarLeft = arrowLeft.value;
activeBarWidth = endInputDivRef.value.offsetWidth;
}
}
const activeBarPositionStyle = direction === "rtl" ? {
right: `${activeBarLeft}px`
} : {
left: `${activeBarLeft}px`
};
return createVNode("div", _objectSpread$W({
"ref": containerRef,
"class": classNames(prefixCls, `${prefixCls}-range`, attrs.class, {
[`${prefixCls}-disabled`]: mergedDisabled.value[0] && mergedDisabled.value[1],
[`${prefixCls}-focused`]: mergedActivePickerIndex.value === 0 ? startFocused.value : endFocused.value,
[`${prefixCls}-rtl`]: direction === "rtl"
}),
"style": attrs.style,
"onClick": onPickerClick,
"onMouseenter": onMouseenter,
"onMouseleave": onMouseleave,
"onMousedown": onPickerMousedown,
"onMouseup": onMouseup
}, getDataOrAriaProps(props2)), [createVNode("div", {
"class": classNames(`${prefixCls}-input`, {
[`${prefixCls}-input-active`]: mergedActivePickerIndex.value === 0,
[`${prefixCls}-input-placeholder`]: !!startHoverValue.value
}),
"ref": startInputDivRef
}, [createVNode("input", _objectSpread$W(_objectSpread$W(_objectSpread$W({
"id": id,
"disabled": mergedDisabled.value[0],
"readonly": inputReadOnly || typeof formatList.value[0] === "function" || !startTyping.value,
"value": startHoverValue.value || startText.value,
"onInput": (e) => {
triggerStartTextChange(e.target.value);
},
"autofocus": autofocus,
"placeholder": getValue$1(placeholder, 0) || "",
"ref": startInputRef
}, startInputProps.value), inputSharedProps), {}, {
"autocomplete": autocomplete
}), null)]), createVNode("div", {
"class": `${prefixCls}-range-separator`,
"ref": separatorRef
}, [separator]), createVNode("div", {
"class": classNames(`${prefixCls}-input`, {
[`${prefixCls}-input-active`]: mergedActivePickerIndex.value === 1,
[`${prefixCls}-input-placeholder`]: !!endHoverValue.value
}),
"ref": endInputDivRef
}, [createVNode("input", _objectSpread$W(_objectSpread$W(_objectSpread$W({
"disabled": mergedDisabled.value[1],
"readonly": inputReadOnly || typeof formatList.value[0] === "function" || !endTyping.value,
"value": endHoverValue.value || endText.value,
"onInput": (e) => {
triggerEndTextChange(e.target.value);
},
"placeholder": getValue$1(placeholder, 1) || "",
"ref": endInputRef
}, endInputProps.value), inputSharedProps), {}, {
"autocomplete": autocomplete
}), null)]), createVNode("div", {
"class": `${prefixCls}-active-bar`,
"style": _extends(_extends({}, activeBarPositionStyle), {
width: `${activeBarWidth}px`,
position: "absolute"
})
}, null), suffixNode, clearNode, createVNode(PickerTrigger, {
"visible": mergedOpen.value,
"popupStyle": popupStyle,
"prefixCls": prefixCls,
"dropdownClassName": dropdownClassName,
"dropdownAlign": dropdownAlign,
"getPopupContainer": getPopupContainer,
"transitionName": transitionName2,
"range": true,
"direction": direction
}, {
default: () => [createVNode("div", {
"style": {
pointerEvents: "none",
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0
}
}, null)],
popupElement: () => rangePanel
})]);
};
}
});
}
const InterRangerPicker = RangerPicker();
var __rest$Y = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const checkboxProps$1 = {
prefixCls: String,
name: String,
id: String,
type: String,
defaultChecked: {
type: [Boolean, Number],
default: void 0
},
checked: {
type: [Boolean, Number],
default: void 0
},
disabled: Boolean,
tabindex: {
type: [Number, String]
},
readonly: Boolean,
autofocus: Boolean,
value: PropTypes.any,
required: Boolean
};
const VcCheckbox = defineComponent({
compatConfig: {
MODE: 3
},
name: "Checkbox",
inheritAttrs: false,
props: initDefaultProps(checkboxProps$1, {
prefixCls: "rc-checkbox",
type: "checkbox",
defaultChecked: false
}),
emits: ["click", "change"],
setup(props2, _ref) {
let {
attrs,
emit,
expose
} = _ref;
const checked = ref(props2.checked === void 0 ? props2.defaultChecked : props2.checked);
const inputRef = ref();
watch(() => props2.checked, () => {
checked.value = props2.checked;
});
expose({
focus() {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur() {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.blur();
}
});
const eventShiftKey = ref();
const handleChange = (e) => {
if (props2.disabled) {
return;
}
if (props2.checked === void 0) {
checked.value = e.target.checked;
}
e.shiftKey = eventShiftKey.value;
const eventObj = {
target: _extends(_extends({}, props2), {
checked: e.target.checked
}),
stopPropagation() {
e.stopPropagation();
},
preventDefault() {
e.preventDefault();
},
nativeEvent: e
};
if (props2.checked !== void 0) {
inputRef.value.checked = !!props2.checked;
}
emit("change", eventObj);
eventShiftKey.value = false;
};
const onClick = (e) => {
emit("click", e);
eventShiftKey.value = e.shiftKey;
};
return () => {
const {
prefixCls,
name,
id,
type,
disabled,
readonly,
tabindex,
autofocus,
value,
required
} = props2, others = __rest$Y(props2, ["prefixCls", "name", "id", "type", "disabled", "readonly", "tabindex", "autofocus", "value", "required"]);
const {
class: className,
onFocus,
onBlur,
onKeydown,
onKeypress,
onKeyup
} = attrs;
const othersAndAttrs = _extends(_extends({}, others), attrs);
const globalProps = Object.keys(othersAndAttrs).reduce((prev, key2) => {
if (key2.startsWith("data-") || key2.startsWith("aria-") || key2 === "role") {
prev[key2] = othersAndAttrs[key2];
}
return prev;
}, {});
const classString = classNames(prefixCls, className, {
[`${prefixCls}-checked`]: checked.value,
[`${prefixCls}-disabled`]: disabled
});
const inputProps2 = _extends(_extends({
name,
id,
type,
readonly,
disabled,
tabindex,
class: `${prefixCls}-input`,
checked: !!checked.value,
autofocus,
value
}, globalProps), {
onChange: handleChange,
onClick,
onFocus,
onBlur,
onKeydown,
onKeypress,
onKeyup,
required
});
return createVNode("span", {
"class": classString
}, [createVNode("input", _objectSpread$W({
"ref": inputRef
}, inputProps2), null), createVNode("span", {
"class": `${prefixCls}-inner`
}, null)]);
};
}
});
const radioGroupContextKey = Symbol("radioGroupContextKey");
const useProvideRadioGroupContext = (props2) => {
provide(radioGroupContextKey, props2);
};
const useInjectRadioGroupContext = () => {
return inject(radioGroupContextKey, void 0);
};
const radioOptionTypeContextKey = Symbol("radioOptionTypeContextKey");
const useProvideRadioOptionTypeContext = (props2) => {
provide(radioOptionTypeContextKey, props2);
};
const useInjectRadioOptionTypeContext = () => {
return inject(radioOptionTypeContextKey, void 0);
};
const antRadioEffect = new Keyframe("antRadioEffect", {
"0%": {
transform: "scale(1)",
opacity: 0.5
},
"100%": {
transform: "scale(1.6)",
opacity: 0
}
});
const getGroupRadioStyle = (token) => {
const {
componentCls,
antCls
} = token;
const groupPrefixCls = `${componentCls}-group`;
return {
[groupPrefixCls]: _extends(_extends({}, resetComponent(token)), {
display: "inline-block",
fontSize: 0,
// RTL
[`&${groupPrefixCls}-rtl`]: {
direction: "rtl"
},
[`${antCls}-badge ${antCls}-badge-count`]: {
zIndex: 1
},
[`> ${antCls}-badge:not(:first-child) > ${antCls}-button-wrapper`]: {
borderInlineStart: "none"
}
})
};
};
const getRadioBasicStyle = (token) => {
const {
componentCls,
radioWrapperMarginRight,
radioCheckedColor,
radioSize,
motionDurationSlow,
motionDurationMid,
motionEaseInOut,
motionEaseInOutCirc,
radioButtonBg,
colorBorder,
lineWidth,
radioDotSize,
colorBgContainerDisabled,
colorTextDisabled,
paddingXS,
radioDotDisabledColor,
lineType,
radioDotDisabledSize,
wireframe,
colorWhite
} = token;
const radioInnerPrefixCls = `${componentCls}-inner`;
return {
[`${componentCls}-wrapper`]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "inline-flex",
alignItems: "baseline",
marginInlineStart: 0,
marginInlineEnd: radioWrapperMarginRight,
cursor: "pointer",
// RTL
[`&${componentCls}-wrapper-rtl`]: {
direction: "rtl"
},
"&-disabled": {
cursor: "not-allowed",
color: token.colorTextDisabled
},
"&::after": {
display: "inline-block",
width: 0,
overflow: "hidden",
content: '"\\a0"'
},
// hashId 在 wrapper 上,只能铺平
[`${componentCls}-checked::after`]: {
position: "absolute",
insetBlockStart: 0,
insetInlineStart: 0,
width: "100%",
height: "100%",
border: `${lineWidth}px ${lineType} ${radioCheckedColor}`,
borderRadius: "50%",
visibility: "hidden",
animationName: antRadioEffect,
animationDuration: motionDurationSlow,
animationTimingFunction: motionEaseInOut,
animationFillMode: "both",
content: '""'
},
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "inline-block",
outline: "none",
cursor: "pointer",
alignSelf: "center"
}),
[`${componentCls}-wrapper:hover &,
&:hover ${radioInnerPrefixCls}`]: {
borderColor: radioCheckedColor
},
[`${componentCls}-input:focus-visible + ${radioInnerPrefixCls}`]: _extends({}, genFocusOutline(token)),
[`${componentCls}:hover::after, ${componentCls}-wrapper:hover &::after`]: {
visibility: "visible"
},
[`${componentCls}-inner`]: {
"&::after": {
boxSizing: "border-box",
position: "absolute",
insetBlockStart: "50%",
insetInlineStart: "50%",
display: "block",
width: radioSize,
height: radioSize,
marginBlockStart: radioSize / -2,
marginInlineStart: radioSize / -2,
backgroundColor: wireframe ? radioCheckedColor : colorWhite,
borderBlockStart: 0,
borderInlineStart: 0,
borderRadius: radioSize,
transform: "scale(0)",
opacity: 0,
transition: `all ${motionDurationSlow} ${motionEaseInOutCirc}`,
content: '""'
},
boxSizing: "border-box",
position: "relative",
insetBlockStart: 0,
insetInlineStart: 0,
display: "block",
width: radioSize,
height: radioSize,
backgroundColor: radioButtonBg,
borderColor: colorBorder,
borderStyle: "solid",
borderWidth: lineWidth,
borderRadius: "50%",
transition: `all ${motionDurationMid}`
},
[`${componentCls}-input`]: {
position: "absolute",
insetBlockStart: 0,
insetInlineEnd: 0,
insetBlockEnd: 0,
insetInlineStart: 0,
zIndex: 1,
cursor: "pointer",
opacity: 0
},
// 选中状态
[`${componentCls}-checked`]: {
[radioInnerPrefixCls]: {
borderColor: radioCheckedColor,
backgroundColor: wireframe ? radioButtonBg : radioCheckedColor,
"&::after": {
transform: `scale(${radioDotSize / radioSize})`,
opacity: 1,
transition: `all ${motionDurationSlow} ${motionEaseInOutCirc}`
}
}
},
[`${componentCls}-disabled`]: {
cursor: "not-allowed",
[radioInnerPrefixCls]: {
backgroundColor: colorBgContainerDisabled,
borderColor: colorBorder,
cursor: "not-allowed",
"&::after": {
backgroundColor: radioDotDisabledColor
}
},
[`${componentCls}-input`]: {
cursor: "not-allowed"
},
[`${componentCls}-disabled + span`]: {
color: colorTextDisabled,
cursor: "not-allowed"
},
[`&${componentCls}-checked`]: {
[radioInnerPrefixCls]: {
"&::after": {
transform: `scale(${radioDotDisabledSize / radioSize})`
}
}
}
},
[`span${componentCls} + *`]: {
paddingInlineStart: paddingXS,
paddingInlineEnd: paddingXS
}
})
};
};
const getRadioButtonStyle = (token) => {
const {
radioButtonColor,
controlHeight,
componentCls,
lineWidth,
lineType,
colorBorder,
motionDurationSlow,
motionDurationMid,
radioButtonPaddingHorizontal,
fontSize,
radioButtonBg,
fontSizeLG,
controlHeightLG,
controlHeightSM,
paddingXS,
borderRadius,
borderRadiusSM,
borderRadiusLG,
radioCheckedColor,
radioButtonCheckedBg,
radioButtonHoverColor,
radioButtonActiveColor,
radioSolidCheckedColor,
colorTextDisabled,
colorBgContainerDisabled,
radioDisabledButtonCheckedColor,
radioDisabledButtonCheckedBg
} = token;
return {
[`${componentCls}-button-wrapper`]: {
position: "relative",
display: "inline-block",
height: controlHeight,
margin: 0,
paddingInline: radioButtonPaddingHorizontal,
paddingBlock: 0,
color: radioButtonColor,
fontSize,
lineHeight: `${controlHeight - lineWidth * 2}px`,
background: radioButtonBg,
border: `${lineWidth}px ${lineType} ${colorBorder}`,
// strange align fix for chrome but works
// https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
borderBlockStartWidth: lineWidth + 0.02,
borderInlineStartWidth: 0,
borderInlineEndWidth: lineWidth,
cursor: "pointer",
transition: [`color ${motionDurationMid}`, `background ${motionDurationMid}`, `border-color ${motionDurationMid}`, `box-shadow ${motionDurationMid}`].join(","),
a: {
color: radioButtonColor
},
[`> ${componentCls}-button`]: {
position: "absolute",
insetBlockStart: 0,
insetInlineStart: 0,
zIndex: -1,
width: "100%",
height: "100%"
},
"&:not(:first-child)": {
"&::before": {
position: "absolute",
insetBlockStart: -lineWidth,
insetInlineStart: -lineWidth,
display: "block",
boxSizing: "content-box",
width: 1,
height: "100%",
paddingBlock: lineWidth,
paddingInline: 0,
backgroundColor: colorBorder,
transition: `background-color ${motionDurationSlow}`,
content: '""'
}
},
"&:first-child": {
borderInlineStart: `${lineWidth}px ${lineType} ${colorBorder}`,
borderStartStartRadius: borderRadius,
borderEndStartRadius: borderRadius
},
"&:last-child": {
borderStartEndRadius: borderRadius,
borderEndEndRadius: borderRadius
},
"&:first-child:last-child": {
borderRadius
},
[`${componentCls}-group-large &`]: {
height: controlHeightLG,
fontSize: fontSizeLG,
lineHeight: `${controlHeightLG - lineWidth * 2}px`,
"&:first-child": {
borderStartStartRadius: borderRadiusLG,
borderEndStartRadius: borderRadiusLG
},
"&:last-child": {
borderStartEndRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
}
},
[`${componentCls}-group-small &`]: {
height: controlHeightSM,
paddingInline: paddingXS - lineWidth,
paddingBlock: 0,
lineHeight: `${controlHeightSM - lineWidth * 2}px`,
"&:first-child": {
borderStartStartRadius: borderRadiusSM,
borderEndStartRadius: borderRadiusSM
},
"&:last-child": {
borderStartEndRadius: borderRadiusSM,
borderEndEndRadius: borderRadiusSM
}
},
"&:hover": {
position: "relative",
color: radioCheckedColor
},
"&:has(:focus-visible)": _extends({}, genFocusOutline(token)),
[`${componentCls}-inner, input[type='checkbox'], input[type='radio']`]: {
width: 0,
height: 0,
opacity: 0,
pointerEvents: "none"
},
[`&-checked:not(${componentCls}-button-wrapper-disabled)`]: {
zIndex: 1,
color: radioCheckedColor,
background: radioButtonCheckedBg,
borderColor: radioCheckedColor,
"&::before": {
backgroundColor: radioCheckedColor
},
"&:first-child": {
borderColor: radioCheckedColor
},
"&:hover": {
color: radioButtonHoverColor,
borderColor: radioButtonHoverColor,
"&::before": {
backgroundColor: radioButtonHoverColor
}
},
"&:active": {
color: radioButtonActiveColor,
borderColor: radioButtonActiveColor,
"&::before": {
backgroundColor: radioButtonActiveColor
}
}
},
[`${componentCls}-group-solid &-checked:not(${componentCls}-button-wrapper-disabled)`]: {
color: radioSolidCheckedColor,
background: radioCheckedColor,
borderColor: radioCheckedColor,
"&:hover": {
color: radioSolidCheckedColor,
background: radioButtonHoverColor,
borderColor: radioButtonHoverColor
},
"&:active": {
color: radioSolidCheckedColor,
background: radioButtonActiveColor,
borderColor: radioButtonActiveColor
}
},
"&-disabled": {
color: colorTextDisabled,
backgroundColor: colorBgContainerDisabled,
borderColor: colorBorder,
cursor: "not-allowed",
"&:first-child, &:hover": {
color: colorTextDisabled,
backgroundColor: colorBgContainerDisabled,
borderColor: colorBorder
}
},
[`&-disabled${componentCls}-button-wrapper-checked`]: {
color: radioDisabledButtonCheckedColor,
backgroundColor: radioDisabledButtonCheckedBg,
borderColor: colorBorder,
boxShadow: "none"
}
}
};
};
const useStyle$L = genComponentStyleHook("Radio", (token) => {
const {
padding,
lineWidth,
controlItemBgActiveDisabled,
colorTextDisabled,
colorBgContainer,
fontSizeLG,
controlOutline,
colorPrimaryHover,
colorPrimaryActive,
colorText,
colorPrimary,
marginXS,
controlOutlineWidth,
colorTextLightSolid,
wireframe
} = token;
const radioFocusShadow = `0 0 0 ${controlOutlineWidth}px ${controlOutline}`;
const radioButtonFocusShadow = radioFocusShadow;
const radioSize = fontSizeLG;
const dotPadding = 4;
const radioDotDisabledSize = radioSize - dotPadding * 2;
const radioDotSize = wireframe ? radioDotDisabledSize : radioSize - (dotPadding + lineWidth) * 2;
const radioCheckedColor = colorPrimary;
const radioButtonColor = colorText;
const radioButtonHoverColor = colorPrimaryHover;
const radioButtonActiveColor = colorPrimaryActive;
const radioButtonPaddingHorizontal = padding - lineWidth;
const radioDisabledButtonCheckedColor = colorTextDisabled;
const radioWrapperMarginRight = marginXS;
const radioToken = merge(token, {
radioFocusShadow,
radioButtonFocusShadow,
radioSize,
radioDotSize,
radioDotDisabledSize,
radioCheckedColor,
radioDotDisabledColor: colorTextDisabled,
radioSolidCheckedColor: colorTextLightSolid,
radioButtonBg: colorBgContainer,
radioButtonCheckedBg: colorBgContainer,
radioButtonColor,
radioButtonHoverColor,
radioButtonActiveColor,
radioButtonPaddingHorizontal,
radioDisabledButtonCheckedBg: controlItemBgActiveDisabled,
radioDisabledButtonCheckedColor,
radioWrapperMarginRight
});
return [getGroupRadioStyle(radioToken), getRadioBasicStyle(radioToken), getRadioButtonStyle(radioToken)];
});
var __rest$X = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const radioProps = () => ({
prefixCls: String,
checked: booleanType(),
disabled: booleanType(),
isGroup: booleanType(),
value: PropTypes.any,
name: String,
id: String,
autofocus: booleanType(),
onChange: functionType(),
onFocus: functionType(),
onBlur: functionType(),
onClick: functionType(),
"onUpdate:checked": functionType(),
"onUpdate:value": functionType()
});
const Radio = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARadio",
inheritAttrs: false,
props: radioProps(),
setup(props2, _ref) {
let {
emit,
expose,
slots,
attrs
} = _ref;
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const radioOptionTypeContext = useInjectRadioOptionTypeContext();
const radioGroupContext = useInjectRadioGroupContext();
const disabledContext = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a;
return (_a = disabled.value) !== null && _a !== void 0 ? _a : disabledContext.value;
});
const vcCheckbox = ref();
const {
prefixCls: radioPrefixCls,
direction,
disabled
} = useConfigInject("radio", props2);
const prefixCls = computed(() => (radioGroupContext === null || radioGroupContext === void 0 ? void 0 : radioGroupContext.optionType.value) === "button" || radioOptionTypeContext === "button" ? `${radioPrefixCls.value}-button` : radioPrefixCls.value);
const contextDisabled = useInjectDisabled();
const [wrapSSR, hashId] = useStyle$L(radioPrefixCls);
const focus = () => {
vcCheckbox.value.focus();
};
const blur = () => {
vcCheckbox.value.blur();
};
expose({
focus,
blur
});
const handleChange = (event) => {
const targetChecked = event.target.checked;
emit("update:checked", targetChecked);
emit("update:value", targetChecked);
emit("change", event);
formItemContext.onFieldChange();
};
const onChange = (e) => {
emit("change", e);
if (radioGroupContext && radioGroupContext.onChange) {
radioGroupContext.onChange(e);
}
};
return () => {
var _a;
const radioGroup = radioGroupContext;
const {
prefixCls: customizePrefixCls,
id = formItemContext.id.value
} = props2, restProps = __rest$X(props2, ["prefixCls", "id"]);
const rProps = _extends(_extends({
prefixCls: prefixCls.value,
id
}, omit(restProps, ["onUpdate:checked", "onUpdate:value"])), {
disabled: (_a = disabled.value) !== null && _a !== void 0 ? _a : contextDisabled.value
});
if (radioGroup) {
rProps.name = radioGroup.name.value;
rProps.onChange = onChange;
rProps.checked = props2.value === radioGroup.value.value;
rProps.disabled = mergedDisabled.value || radioGroup.disabled.value;
} else {
rProps.onChange = handleChange;
}
const wrapperClassString = classNames({
[`${prefixCls.value}-wrapper`]: true,
[`${prefixCls.value}-wrapper-checked`]: rProps.checked,
[`${prefixCls.value}-wrapper-disabled`]: rProps.disabled,
[`${prefixCls.value}-wrapper-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-wrapper-in-form-item`]: formItemInputContext.isFormItemInput
}, attrs.class, hashId.value);
return wrapSSR(createVNode("label", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": wrapperClassString
}), [createVNode(VcCheckbox, _objectSpread$W(_objectSpread$W({}, rProps), {}, {
"type": "radio",
"ref": vcCheckbox
}), null), slots.default && createVNode("span", null, [slots.default()])]));
};
}
});
const radioGroupProps = () => ({
prefixCls: String,
value: PropTypes.any,
size: stringType(),
options: arrayType(),
disabled: booleanType(),
name: String,
buttonStyle: stringType("outline"),
id: String,
optionType: stringType("default"),
onChange: functionType(),
"onUpdate:value": functionType()
});
const __nuxt_component_1$4 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARadioGroup",
inheritAttrs: false,
props: radioGroupProps(),
// emits: ['update:value', 'change'],
setup(props2, _ref) {
let {
slots,
emit,
attrs
} = _ref;
const formItemContext = useInjectFormItemContext();
const {
prefixCls,
direction,
size
} = useConfigInject("radio", props2);
const [wrapSSR, hashId] = useStyle$L(prefixCls);
const stateValue = ref(props2.value);
const updatingValue = ref(false);
watch(() => props2.value, (val) => {
stateValue.value = val;
updatingValue.value = false;
});
const onRadioChange = (ev) => {
const lastValue = stateValue.value;
const {
value
} = ev.target;
if (!("value" in props2)) {
stateValue.value = value;
}
if (!updatingValue.value && value !== lastValue) {
updatingValue.value = true;
emit("update:value", value);
emit("change", ev);
formItemContext.onFieldChange();
}
nextTick(() => {
updatingValue.value = false;
});
};
useProvideRadioGroupContext({
onChange: onRadioChange,
value: stateValue,
disabled: computed(() => props2.disabled),
name: computed(() => props2.name),
optionType: computed(() => props2.optionType)
});
return () => {
var _a;
const {
options,
buttonStyle,
id = formItemContext.id.value
} = props2;
const groupPrefixCls = `${prefixCls.value}-group`;
const classString = classNames(groupPrefixCls, `${groupPrefixCls}-${buttonStyle}`, {
[`${groupPrefixCls}-${size.value}`]: size.value,
[`${groupPrefixCls}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value);
let children = null;
if (options && options.length > 0) {
children = options.map((option) => {
if (typeof option === "string" || typeof option === "number") {
return createVNode(Radio, {
"key": option,
"prefixCls": prefixCls.value,
"disabled": props2.disabled,
"value": option,
"checked": stateValue.value === option
}, {
default: () => [option]
});
}
const {
value,
disabled,
label
} = option;
return createVNode(Radio, {
"key": `radio-group-value-options-${value}`,
"prefixCls": prefixCls.value,
"disabled": disabled || props2.disabled,
"value": value,
"checked": stateValue.value === value
}, {
default: () => [label]
});
});
} else {
children = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
}
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classString,
"id": id
}), [children]));
};
}
});
const __nuxt_component_2$3 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARadioButton",
inheritAttrs: false,
props: radioProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls
} = useConfigInject("radio", props2);
useProvideRadioOptionTypeContext("button");
return () => {
var _a;
return createVNode(Radio, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), props2), {}, {
"prefixCls": prefixCls.value
}), {
default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
});
};
}
});
Radio.Group = __nuxt_component_1$4;
Radio.Button = __nuxt_component_2$3;
Radio.install = function(app) {
app.component(Radio.name, Radio);
app.component(Radio.Group.name, Radio.Group);
app.component(Radio.Button.name, Radio.Button);
return app;
};
const YearSelectOffset = 10;
const YearSelectTotal = 20;
function YearSelect(props2) {
const {
fullscreen,
validRange,
generateConfig: generateConfig2,
locale: locale2,
prefixCls,
value,
onChange,
divRef
} = props2;
const year = generateConfig2.getYear(value || generateConfig2.getNow());
let start = year - YearSelectOffset;
let end = start + YearSelectTotal;
if (validRange) {
start = generateConfig2.getYear(validRange[0]);
end = generateConfig2.getYear(validRange[1]) + 1;
}
const suffix = locale2 && locale2.year === "年" ? "年" : "";
const options = [];
for (let index2 = start; index2 < end; index2++) {
options.push({
label: `${index2}${suffix}`,
value: index2
});
}
return createVNode(Select, {
"size": fullscreen ? void 0 : "small",
"options": options,
"value": year,
"class": `${prefixCls}-year-select`,
"onChange": (numYear) => {
let newDate = generateConfig2.setYear(value, numYear);
if (validRange) {
const [startDate, endDate] = validRange;
const newYear = generateConfig2.getYear(newDate);
const newMonth = generateConfig2.getMonth(newDate);
if (newYear === generateConfig2.getYear(endDate) && newMonth > generateConfig2.getMonth(endDate)) {
newDate = generateConfig2.setMonth(newDate, generateConfig2.getMonth(endDate));
}
if (newYear === generateConfig2.getYear(startDate) && newMonth < generateConfig2.getMonth(startDate)) {
newDate = generateConfig2.setMonth(newDate, generateConfig2.getMonth(startDate));
}
}
onChange(newDate);
},
"getPopupContainer": () => divRef.value
}, null);
}
YearSelect.inheritAttrs = false;
function MonthSelect(props2) {
const {
prefixCls,
fullscreen,
validRange,
value,
generateConfig: generateConfig2,
locale: locale2,
onChange,
divRef
} = props2;
const month = generateConfig2.getMonth(value || generateConfig2.getNow());
let start = 0;
let end = 11;
if (validRange) {
const [rangeStart, rangeEnd] = validRange;
const currentYear = generateConfig2.getYear(value);
if (generateConfig2.getYear(rangeEnd) === currentYear) {
end = generateConfig2.getMonth(rangeEnd);
}
if (generateConfig2.getYear(rangeStart) === currentYear) {
start = generateConfig2.getMonth(rangeStart);
}
}
const months = locale2.shortMonths || generateConfig2.locale.getShortMonths(locale2.locale);
const options = [];
for (let index2 = start; index2 <= end; index2 += 1) {
options.push({
label: months[index2],
value: index2
});
}
return createVNode(Select, {
"size": fullscreen ? void 0 : "small",
"class": `${prefixCls}-month-select`,
"value": month,
"options": options,
"onChange": (newMonth) => {
onChange(generateConfig2.setMonth(value, newMonth));
},
"getPopupContainer": () => divRef.value
}, null);
}
MonthSelect.inheritAttrs = false;
function ModeSwitch(props2) {
const {
prefixCls,
locale: locale2,
mode,
fullscreen,
onModeChange
} = props2;
return createVNode(__nuxt_component_1$4, {
"onChange": (_ref) => {
let {
target: {
value
}
} = _ref;
onModeChange(value);
},
"value": mode,
"size": fullscreen ? void 0 : "small",
"class": `${prefixCls}-mode-switch`
}, {
default: () => [createVNode(__nuxt_component_2$3, {
"value": "month"
}, {
default: () => [locale2.month]
}), createVNode(__nuxt_component_2$3, {
"value": "year"
}, {
default: () => [locale2.year]
})]
});
}
ModeSwitch.inheritAttrs = false;
const CalendarHeader = defineComponent({
name: "CalendarHeader",
inheritAttrs: false,
props: ["mode", "prefixCls", "value", "validRange", "generateConfig", "locale", "mode", "fullscreen"],
setup(_props, _ref2) {
let {
attrs
} = _ref2;
const divRef = ref(null);
const formItemInputContext = FormItemInputContext.useInject();
FormItemInputContext.useProvide(formItemInputContext, {
isFormItemInput: false
});
return () => {
const props2 = _extends(_extends({}, _props), attrs);
const {
prefixCls,
fullscreen,
mode,
onChange,
onModeChange
} = props2;
const sharedProps = _extends(_extends({}, props2), {
fullscreen,
divRef
});
return createVNode("div", {
"class": `${prefixCls}-header`,
"ref": divRef
}, [createVNode(YearSelect, _objectSpread$W(_objectSpread$W({}, sharedProps), {}, {
"onChange": (v) => {
onChange(v, "year");
}
}), null), mode === "month" && createVNode(MonthSelect, _objectSpread$W(_objectSpread$W({}, sharedProps), {}, {
"onChange": (v) => {
onChange(v, "month");
}
}), null), createVNode(ModeSwitch, _objectSpread$W(_objectSpread$W({}, sharedProps), {}, {
"onModeChange": onModeChange
}), null)]);
};
}
});
const genPlaceholderStyle = (color) => ({
// Firefox
"&::-moz-placeholder": {
opacity: 1
},
"&::placeholder": {
color,
userSelect: "none"
// https://github.com/ant-design/ant-design/pull/32639
},
"&:placeholder-shown": {
textOverflow: "ellipsis"
}
});
const genHoverStyle = (token) => ({
borderColor: token.inputBorderHoverColor,
borderInlineEndWidth: token.lineWidth
});
const genActiveStyle = (token) => ({
borderColor: token.inputBorderHoverColor,
boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.controlOutline}`,
borderInlineEndWidth: token.lineWidth,
outline: 0
});
const genDisabledStyle = (token) => ({
color: token.colorTextDisabled,
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
boxShadow: "none",
cursor: "not-allowed",
opacity: 1,
"&:hover": _extends({}, genHoverStyle(merge(token, {
inputBorderHoverColor: token.colorBorder
})))
});
const genInputLargeStyle = (token) => {
const {
inputPaddingVerticalLG,
fontSizeLG,
lineHeightLG,
borderRadiusLG,
inputPaddingHorizontalLG
} = token;
return {
padding: `${inputPaddingVerticalLG}px ${inputPaddingHorizontalLG}px`,
fontSize: fontSizeLG,
lineHeight: lineHeightLG,
borderRadius: borderRadiusLG
};
};
const genInputSmallStyle = (token) => ({
padding: `${token.inputPaddingVerticalSM}px ${token.controlPaddingHorizontalSM - 1}px`,
borderRadius: token.borderRadiusSM
});
const genStatusStyle = (token, parentCls) => {
const {
componentCls,
colorError,
colorWarning,
colorErrorOutline,
colorWarningOutline,
colorErrorBorderHover,
colorWarningBorderHover
} = token;
return {
[`&-status-error:not(${parentCls}-disabled):not(${parentCls}-borderless)${parentCls}`]: {
borderColor: colorError,
"&:hover": {
borderColor: colorErrorBorderHover
},
"&:focus, &-focused": _extends({}, genActiveStyle(merge(token, {
inputBorderActiveColor: colorError,
inputBorderHoverColor: colorError,
controlOutline: colorErrorOutline
}))),
[`${componentCls}-prefix`]: {
color: colorError
}
},
[`&-status-warning:not(${parentCls}-disabled):not(${parentCls}-borderless)${parentCls}`]: {
borderColor: colorWarning,
"&:hover": {
borderColor: colorWarningBorderHover
},
"&:focus, &-focused": _extends({}, genActiveStyle(merge(token, {
inputBorderActiveColor: colorWarning,
inputBorderHoverColor: colorWarning,
controlOutline: colorWarningOutline
}))),
[`${componentCls}-prefix`]: {
color: colorWarning
}
}
};
};
const genBasicInputStyle = (token) => _extends(_extends({
position: "relative",
display: "inline-block",
width: "100%",
minWidth: 0,
padding: `${token.inputPaddingVertical}px ${token.inputPaddingHorizontal}px`,
color: token.colorText,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
backgroundColor: token.colorBgContainer,
backgroundImage: "none",
borderWidth: token.lineWidth,
borderStyle: token.lineType,
borderColor: token.colorBorder,
borderRadius: token.borderRadius,
transition: `all ${token.motionDurationMid}`
}, genPlaceholderStyle(token.colorTextPlaceholder)), {
"&:hover": _extends({}, genHoverStyle(token)),
"&:focus, &-focused": _extends({}, genActiveStyle(token)),
"&-disabled, &[disabled]": _extends({}, genDisabledStyle(token)),
"&-borderless": {
"&, &:hover, &:focus, &-focused, &-disabled, &[disabled]": {
backgroundColor: "transparent",
border: "none",
boxShadow: "none"
}
},
// Reset height for `textarea`s
"textarea&": {
maxWidth: "100%",
height: "auto",
minHeight: token.controlHeight,
lineHeight: token.lineHeight,
verticalAlign: "bottom",
transition: `all ${token.motionDurationSlow}, height 0s`,
resize: "vertical"
},
// Size
"&-lg": _extends({}, genInputLargeStyle(token)),
"&-sm": _extends({}, genInputSmallStyle(token)),
// RTL
"&-rtl": {
direction: "rtl"
},
"&-textarea-rtl": {
direction: "rtl"
}
});
const genInputGroupStyle = (token) => {
const {
componentCls,
antCls
} = token;
return {
position: "relative",
display: "table",
width: "100%",
borderCollapse: "separate",
borderSpacing: 0,
// Undo padding and float of grid classes
[`&[class*='col-']`]: {
paddingInlineEnd: token.paddingXS,
"&:last-child": {
paddingInlineEnd: 0
}
},
// Sizing options
[`&-lg ${componentCls}, &-lg > ${componentCls}-group-addon`]: _extends({}, genInputLargeStyle(token)),
[`&-sm ${componentCls}, &-sm > ${componentCls}-group-addon`]: _extends({}, genInputSmallStyle(token)),
[`> ${componentCls}`]: {
display: "table-cell",
"&:not(:first-child):not(:last-child)": {
borderRadius: 0
}
},
[`${componentCls}-group`]: {
[`&-addon, &-wrap`]: {
display: "table-cell",
width: 1,
whiteSpace: "nowrap",
verticalAlign: "middle",
"&:not(:first-child):not(:last-child)": {
borderRadius: 0
}
},
"&-wrap > *": {
display: "block !important"
},
"&-addon": {
position: "relative",
padding: `0 ${token.inputPaddingHorizontal}px`,
color: token.colorText,
fontWeight: "normal",
fontSize: token.fontSize,
textAlign: "center",
backgroundColor: token.colorFillAlter,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadius,
transition: `all ${token.motionDurationSlow}`,
lineHeight: 1,
// Reset Select's style in addon
[`${antCls}-select`]: {
margin: `-${token.inputPaddingVertical + 1}px -${token.inputPaddingHorizontal}px`,
[`&${antCls}-select-single:not(${antCls}-select-customize-input)`]: {
[`${antCls}-select-selector`]: {
backgroundColor: "inherit",
border: `${token.lineWidth}px ${token.lineType} transparent`,
boxShadow: "none"
}
},
"&-open, &-focused": {
[`${antCls}-select-selector`]: {
color: token.colorPrimary
}
}
},
// https://github.com/ant-design/ant-design/issues/31333
[`${antCls}-cascader-picker`]: {
margin: `-9px -${token.inputPaddingHorizontal}px`,
backgroundColor: "transparent",
[`${antCls}-cascader-input`]: {
textAlign: "start",
border: 0,
boxShadow: "none"
}
}
},
"&-addon:first-child": {
borderInlineEnd: 0
},
"&-addon:last-child": {
borderInlineStart: 0
}
},
[`${componentCls}`]: {
float: "inline-start",
width: "100%",
marginBottom: 0,
textAlign: "inherit",
"&:focus": {
zIndex: 1,
borderInlineEndWidth: 1
},
"&:hover": {
zIndex: 1,
borderInlineEndWidth: 1,
[`${componentCls}-search-with-button &`]: {
zIndex: 0
}
}
},
// Reset rounded corners
[`> ${componentCls}:first-child, ${componentCls}-group-addon:first-child`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0,
// Reset Select's style in addon
[`${antCls}-select ${antCls}-select-selector`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
[`> ${componentCls}-affix-wrapper`]: {
[`&:not(:first-child) ${componentCls}`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
},
[`&:not(:last-child) ${componentCls}`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
},
[`> ${componentCls}:last-child, ${componentCls}-group-addon:last-child`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0,
// Reset Select's style in addon
[`${antCls}-select ${antCls}-select-selector`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
},
[`${componentCls}-affix-wrapper`]: {
"&:not(:last-child)": {
borderStartEndRadius: 0,
borderEndEndRadius: 0,
[`${componentCls}-search &`]: {
borderStartStartRadius: token.borderRadius,
borderEndStartRadius: token.borderRadius
}
},
[`&:not(:first-child), ${componentCls}-search &:not(:first-child)`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0
}
},
[`&${componentCls}-group-compact`]: _extends(_extends({
display: "block"
}, clearFix()), {
[`${componentCls}-group-addon, ${componentCls}-group-wrap, > ${componentCls}`]: {
"&:not(:first-child):not(:last-child)": {
borderInlineEndWidth: token.lineWidth,
"&:hover": {
zIndex: 1
},
"&:focus": {
zIndex: 1
}
}
},
"& > *": {
display: "inline-block",
float: "none",
verticalAlign: "top",
borderRadius: 0
},
[`& > ${componentCls}-affix-wrapper`]: {
display: "inline-flex"
},
[`& > ${antCls}-picker-range`]: {
display: "inline-flex"
},
"& > *:not(:last-child)": {
marginInlineEnd: -token.lineWidth,
borderInlineEndWidth: token.lineWidth
},
// Undo float for .ant-input-group .ant-input
[`${componentCls}`]: {
float: "none"
},
// reset border for Select, DatePicker, AutoComplete, Cascader, Mention, TimePicker, Input
[`& > ${antCls}-select > ${antCls}-select-selector,
& > ${antCls}-select-auto-complete ${componentCls},
& > ${antCls}-cascader-picker ${componentCls},
& > ${componentCls}-group-wrapper ${componentCls}`]: {
borderInlineEndWidth: token.lineWidth,
borderRadius: 0,
"&:hover": {
zIndex: 1
},
"&:focus": {
zIndex: 1
}
},
[`& > ${antCls}-select-focused`]: {
zIndex: 1
},
// update z-index for arrow icon
[`& > ${antCls}-select > ${antCls}-select-arrow`]: {
zIndex: 1
// https://github.com/ant-design/ant-design/issues/20371
},
[`& > *:first-child,
& > ${antCls}-select:first-child > ${antCls}-select-selector,
& > ${antCls}-select-auto-complete:first-child ${componentCls},
& > ${antCls}-cascader-picker:first-child ${componentCls}`]: {
borderStartStartRadius: token.borderRadius,
borderEndStartRadius: token.borderRadius
},
[`& > *:last-child,
& > ${antCls}-select:last-child > ${antCls}-select-selector,
& > ${antCls}-cascader-picker:last-child ${componentCls},
& > ${antCls}-cascader-picker-focused:last-child ${componentCls}`]: {
borderInlineEndWidth: token.lineWidth,
borderStartEndRadius: token.borderRadius,
borderEndEndRadius: token.borderRadius
},
// https://github.com/ant-design/ant-design/issues/12493
[`& > ${antCls}-select-auto-complete ${componentCls}`]: {
verticalAlign: "top"
},
[`${componentCls}-group-wrapper + ${componentCls}-group-wrapper`]: {
marginInlineStart: -token.lineWidth,
[`${componentCls}-affix-wrapper`]: {
borderRadius: 0
}
},
[`${componentCls}-group-wrapper:not(:last-child)`]: {
[`&${componentCls}-search > ${componentCls}-group`]: {
[`& > ${componentCls}-group-addon > ${componentCls}-search-button`]: {
borderRadius: 0
},
[`& > ${componentCls}`]: {
borderStartStartRadius: token.borderRadius,
borderStartEndRadius: 0,
borderEndEndRadius: 0,
borderEndStartRadius: token.borderRadius
}
}
}
}),
[`&&-sm ${antCls}-btn`]: {
fontSize: token.fontSizeSM,
height: token.controlHeightSM,
lineHeight: "normal"
},
[`&&-lg ${antCls}-btn`]: {
fontSize: token.fontSizeLG,
height: token.controlHeightLG,
lineHeight: "normal"
},
// Fix https://github.com/ant-design/ant-design/issues/5754
[`&&-lg ${antCls}-select-single ${antCls}-select-selector`]: {
height: `${token.controlHeightLG}px`,
[`${antCls}-select-selection-item, ${antCls}-select-selection-placeholder`]: {
// -2 is for the border size & override default
lineHeight: `${token.controlHeightLG - 2}px`
},
[`${antCls}-select-selection-search-input`]: {
height: `${token.controlHeightLG}px`
}
},
[`&&-sm ${antCls}-select-single ${antCls}-select-selector`]: {
height: `${token.controlHeightSM}px`,
[`${antCls}-select-selection-item, ${antCls}-select-selection-placeholder`]: {
// -2 is for the border size & override default
lineHeight: `${token.controlHeightSM - 2}px`
},
[`${antCls}-select-selection-search-input`]: {
height: `${token.controlHeightSM}px`
}
}
};
};
const genInputStyle = (token) => {
const {
componentCls,
controlHeightSM,
lineWidth
} = token;
const FIXED_CHROME_COLOR_HEIGHT = 16;
const colorSmallPadding = (controlHeightSM - lineWidth * 2 - FIXED_CHROME_COLOR_HEIGHT) / 2;
return {
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), genBasicInputStyle(token)), genStatusStyle(token, componentCls)), {
'&[type="color"]': {
height: token.controlHeight,
[`&${componentCls}-lg`]: {
height: token.controlHeightLG
},
[`&${componentCls}-sm`]: {
height: controlHeightSM,
paddingTop: colorSmallPadding,
paddingBottom: colorSmallPadding
}
}
})
};
};
const genAllowClearStyle = (token) => {
const {
componentCls
} = token;
return {
// ========================= Input =========================
[`${componentCls}-clear-icon`]: {
margin: 0,
color: token.colorTextQuaternary,
fontSize: token.fontSizeIcon,
verticalAlign: -1,
// https://github.com/ant-design/ant-design/pull/18151
// https://codesandbox.io/s/wizardly-sun-u10br
cursor: "pointer",
transition: `color ${token.motionDurationSlow}`,
"&:hover": {
color: token.colorTextTertiary
},
"&:active": {
color: token.colorText
},
"&-hidden": {
visibility: "hidden"
},
"&-has-suffix": {
margin: `0 ${token.inputAffixPadding}px`
}
},
// ======================= TextArea ========================
"&-textarea-with-clear-btn": {
padding: "0 !important",
border: "0 !important",
[`${componentCls}-clear-icon`]: {
position: "absolute",
insetBlockStart: token.paddingXS,
insetInlineEnd: token.paddingXS,
zIndex: 1
}
}
};
};
const genAffixStyle = (token) => {
const {
componentCls,
inputAffixPadding,
colorTextDescription,
motionDurationSlow,
colorIcon,
colorIconHover,
iconCls
} = token;
return {
[`${componentCls}-affix-wrapper`]: _extends(_extends(_extends(_extends(_extends({}, genBasicInputStyle(token)), {
display: "inline-flex",
[`&:not(${componentCls}-affix-wrapper-disabled):hover`]: _extends(_extends({}, genHoverStyle(token)), {
zIndex: 1,
[`${componentCls}-search-with-button &`]: {
zIndex: 0
}
}),
"&-focused, &:focus": {
zIndex: 1
},
"&-disabled": {
[`${componentCls}[disabled]`]: {
background: "transparent"
}
},
[`> input${componentCls}`]: {
padding: 0,
fontSize: "inherit",
border: "none",
borderRadius: 0,
outline: "none",
"&:focus": {
boxShadow: "none !important"
}
},
"&::before": {
width: 0,
visibility: "hidden",
content: '"\\a0"'
},
[`${componentCls}`]: {
"&-prefix, &-suffix": {
display: "flex",
flex: "none",
alignItems: "center",
"> *:not(:last-child)": {
marginInlineEnd: token.paddingXS
}
},
"&-show-count-suffix": {
color: colorTextDescription
},
"&-show-count-has-suffix": {
marginInlineEnd: token.paddingXXS
},
"&-prefix": {
marginInlineEnd: inputAffixPadding
},
"&-suffix": {
marginInlineStart: inputAffixPadding
}
}
}), genAllowClearStyle(token)), {
// password
[`${iconCls}${componentCls}-password-icon`]: {
color: colorIcon,
cursor: "pointer",
transition: `all ${motionDurationSlow}`,
"&:hover": {
color: colorIconHover
}
}
}), genStatusStyle(token, `${componentCls}-affix-wrapper`))
};
};
const genGroupStyle = (token) => {
const {
componentCls,
colorError,
colorSuccess,
borderRadiusLG,
borderRadiusSM
} = token;
return {
[`${componentCls}-group`]: _extends(_extends(_extends({}, resetComponent(token)), genInputGroupStyle(token)), {
"&-rtl": {
direction: "rtl"
},
"&-wrapper": {
display: "inline-block",
width: "100%",
textAlign: "start",
verticalAlign: "top",
"&-rtl": {
direction: "rtl"
},
// Size
"&-lg": {
[`${componentCls}-group-addon`]: {
borderRadius: borderRadiusLG
}
},
"&-sm": {
[`${componentCls}-group-addon`]: {
borderRadius: borderRadiusSM
}
},
// Status
"&-status-error": {
[`${componentCls}-group-addon`]: {
color: colorError,
borderColor: colorError
}
},
"&-status-warning": {
[`${componentCls}-group-addon:last-child`]: {
color: colorSuccess,
borderColor: colorSuccess
}
}
}
})
};
};
const genSearchInputStyle = (token) => {
const {
componentCls,
antCls
} = token;
const searchPrefixCls = `${componentCls}-search`;
return {
[searchPrefixCls]: {
[`${componentCls}`]: {
"&:hover, &:focus": {
borderColor: token.colorPrimaryHover,
[`+ ${componentCls}-group-addon ${searchPrefixCls}-button:not(${antCls}-btn-primary)`]: {
borderInlineStartColor: token.colorPrimaryHover
}
}
},
[`${componentCls}-affix-wrapper`]: {
borderRadius: 0
},
// fix slight height diff in Firefox:
// https://ant.design/components/auto-complete-cn/#components-auto-complete-demo-certain-category
[`${componentCls}-lg`]: {
lineHeight: token.lineHeightLG - 2e-4
},
[`> ${componentCls}-group`]: {
[`> ${componentCls}-group-addon:last-child`]: {
insetInlineStart: -1,
padding: 0,
border: 0,
[`${searchPrefixCls}-button`]: {
paddingTop: 0,
paddingBottom: 0,
borderStartStartRadius: 0,
borderStartEndRadius: token.borderRadius,
borderEndEndRadius: token.borderRadius,
borderEndStartRadius: 0
},
[`${searchPrefixCls}-button:not(${antCls}-btn-primary)`]: {
color: token.colorTextDescription,
"&:hover": {
color: token.colorPrimaryHover
},
"&:active": {
color: token.colorPrimaryActive
},
[`&${antCls}-btn-loading::before`]: {
insetInlineStart: 0,
insetInlineEnd: 0,
insetBlockStart: 0,
insetBlockEnd: 0
}
}
}
},
[`${searchPrefixCls}-button`]: {
height: token.controlHeight,
"&:hover, &:focus": {
zIndex: 1
}
},
[`&-large ${searchPrefixCls}-button`]: {
height: token.controlHeightLG
},
[`&-small ${searchPrefixCls}-button`]: {
height: token.controlHeightSM
},
"&-rtl": {
direction: "rtl"
},
// ===================== Compact Item Customized Styles =====================
[`&${componentCls}-compact-item`]: {
[`&:not(${componentCls}-compact-last-item)`]: {
[`${componentCls}-group-addon`]: {
[`${componentCls}-search-button`]: {
marginInlineEnd: -token.lineWidth,
borderRadius: 0
}
}
},
[`&:not(${componentCls}-compact-first-item)`]: {
[`${componentCls},${componentCls}-affix-wrapper`]: {
borderRadius: 0
}
},
[`> ${componentCls}-group-addon ${componentCls}-search-button,
> ${componentCls},
${componentCls}-affix-wrapper`]: {
"&:hover,&:focus,&:active": {
zIndex: 2
}
},
[`> ${componentCls}-affix-wrapper-focused`]: {
zIndex: 2
}
}
}
};
};
function initInputToken(token) {
return merge(token, {
inputAffixPadding: token.paddingXXS,
inputPaddingVertical: Math.max(Math.round((token.controlHeight - token.fontSize * token.lineHeight) / 2 * 10) / 10 - token.lineWidth, 3),
inputPaddingVerticalLG: Math.ceil((token.controlHeightLG - token.fontSizeLG * token.lineHeightLG) / 2 * 10) / 10 - token.lineWidth,
inputPaddingVerticalSM: Math.max(Math.round((token.controlHeightSM - token.fontSize * token.lineHeight) / 2 * 10) / 10 - token.lineWidth, 0),
inputPaddingHorizontal: token.paddingSM - token.lineWidth,
inputPaddingHorizontalSM: token.paddingXS - token.lineWidth,
inputPaddingHorizontalLG: token.controlPaddingHorizontal - token.lineWidth,
inputBorderHoverColor: token.colorPrimaryHover,
inputBorderActiveColor: token.colorPrimaryHover
});
}
const genTextAreaStyle = (token) => {
const {
componentCls,
inputPaddingHorizontal,
paddingLG
} = token;
const textareaPrefixCls = `${componentCls}-textarea`;
return {
[textareaPrefixCls]: {
position: "relative",
[`${textareaPrefixCls}-suffix`]: {
position: "absolute",
top: 0,
insetInlineEnd: inputPaddingHorizontal,
bottom: 0,
zIndex: 1,
display: "inline-flex",
alignItems: "center",
margin: "auto"
},
[`&-status-error,
&-status-warning,
&-status-success,
&-status-validating`]: {
[`&${textareaPrefixCls}-has-feedback`]: {
[`${componentCls}`]: {
paddingInlineEnd: paddingLG
}
}
},
"&-show-count": {
// https://github.com/ant-design/ant-design/issues/33049
[`> ${componentCls}`]: {
height: "100%"
},
"&::after": {
color: token.colorTextDescription,
whiteSpace: "nowrap",
content: "attr(data-count)",
pointerEvents: "none",
float: "right"
}
},
"&-rtl": {
"&::after": {
float: "left"
}
}
}
};
};
const useStyle$K = genComponentStyleHook("Input", (token) => {
const inputToken = initInputToken(token);
return [
genInputStyle(inputToken),
genTextAreaStyle(inputToken),
genAffixStyle(inputToken),
genGroupStyle(inputToken),
genSearchInputStyle(inputToken),
// =====================================================
// == Space Compact ==
// =====================================================
genCompactItemStyle(inputToken)
];
});
const genPikerPadding = (token, inputHeight, fontSize, paddingHorizontal) => {
const {
lineHeight
} = token;
const fontHeight = Math.floor(fontSize * lineHeight) + 2;
const paddingTop = Math.max((inputHeight - fontHeight) / 2, 0);
const paddingBottom = Math.max(inputHeight - fontHeight - paddingTop, 0);
return {
padding: `${paddingTop}px ${paddingHorizontal}px ${paddingBottom}px`
};
};
const genPickerCellInnerStyle = (token) => {
const {
componentCls,
pickerCellCls,
pickerCellInnerCls,
pickerPanelCellHeight,
motionDurationSlow,
borderRadiusSM,
motionDurationMid,
controlItemBgHover,
lineWidth,
lineType,
colorPrimary,
controlItemBgActive,
colorTextLightSolid,
controlHeightSM,
pickerDateHoverRangeBorderColor,
pickerCellBorderGap,
pickerBasicCellHoverWithRangeColor,
pickerPanelCellWidth,
colorTextDisabled,
colorBgContainerDisabled
} = token;
return {
"&::before": {
position: "absolute",
top: "50%",
insetInlineStart: 0,
insetInlineEnd: 0,
zIndex: 1,
height: pickerPanelCellHeight,
transform: "translateY(-50%)",
transition: `all ${motionDurationSlow}`,
content: '""'
},
// >>> Default
[pickerCellInnerCls]: {
position: "relative",
zIndex: 2,
display: "inline-block",
minWidth: pickerPanelCellHeight,
height: pickerPanelCellHeight,
lineHeight: `${pickerPanelCellHeight}px`,
borderRadius: borderRadiusSM,
transition: `background ${motionDurationMid}, border ${motionDurationMid}`
},
// >>> Hover
[`&:hover:not(${pickerCellCls}-in-view),
&:hover:not(${pickerCellCls}-selected):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end):not(${pickerCellCls}-range-hover-start):not(${pickerCellCls}-range-hover-end)`]: {
[pickerCellInnerCls]: {
background: controlItemBgHover
}
},
// >>> Today
[`&-in-view${pickerCellCls}-today ${pickerCellInnerCls}`]: {
"&::before": {
position: "absolute",
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
zIndex: 1,
border: `${lineWidth}px ${lineType} ${colorPrimary}`,
borderRadius: borderRadiusSM,
content: '""'
}
},
// >>> In Range
[`&-in-view${pickerCellCls}-in-range`]: {
position: "relative",
"&::before": {
background: controlItemBgActive
}
},
// >>> Selected
[`&-in-view${pickerCellCls}-selected ${pickerCellInnerCls},
&-in-view${pickerCellCls}-range-start ${pickerCellInnerCls},
&-in-view${pickerCellCls}-range-end ${pickerCellInnerCls}`]: {
color: colorTextLightSolid,
background: colorPrimary
},
[`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-start-single),
&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-end-single)`]: {
"&::before": {
background: controlItemBgActive
}
},
[`&-in-view${pickerCellCls}-range-start::before`]: {
insetInlineStart: "50%"
},
[`&-in-view${pickerCellCls}-range-end::before`]: {
insetInlineEnd: "50%"
},
// >>> Range Hover
[`&-in-view${pickerCellCls}-range-hover-start:not(${pickerCellCls}-in-range):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end),
&-in-view${pickerCellCls}-range-hover-end:not(${pickerCellCls}-in-range):not(${pickerCellCls}-range-start):not(${pickerCellCls}-range-end),
&-in-view${pickerCellCls}-range-hover-start${pickerCellCls}-range-start-single,
&-in-view${pickerCellCls}-range-hover-start${pickerCellCls}-range-start${pickerCellCls}-range-end${pickerCellCls}-range-end-near-hover,
&-in-view${pickerCellCls}-range-hover-end${pickerCellCls}-range-start${pickerCellCls}-range-end${pickerCellCls}-range-start-near-hover,
&-in-view${pickerCellCls}-range-hover-end${pickerCellCls}-range-end-single,
&-in-view${pickerCellCls}-range-hover:not(${pickerCellCls}-in-range)`]: {
"&::after": {
position: "absolute",
top: "50%",
zIndex: 0,
height: controlHeightSM,
borderTop: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
borderBottom: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
transform: "translateY(-50%)",
transition: `all ${motionDurationSlow}`,
content: '""'
}
},
// Add space for stash
[`&-range-hover-start::after,
&-range-hover-end::after,
&-range-hover::after`]: {
insetInlineEnd: 0,
insetInlineStart: pickerCellBorderGap
},
// Hover with in range
[`&-in-view${pickerCellCls}-in-range${pickerCellCls}-range-hover::before,
&-in-view${pickerCellCls}-range-start${pickerCellCls}-range-hover::before,
&-in-view${pickerCellCls}-range-end${pickerCellCls}-range-hover::before,
&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-start-single)${pickerCellCls}-range-hover-start::before,
&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-end-single)${pickerCellCls}-range-hover-end::before,
${componentCls}-panel
> :not(${componentCls}-date-panel)
&-in-view${pickerCellCls}-in-range${pickerCellCls}-range-hover-start::before,
${componentCls}-panel
> :not(${componentCls}-date-panel)
&-in-view${pickerCellCls}-in-range${pickerCellCls}-range-hover-end::before`]: {
background: pickerBasicCellHoverWithRangeColor
},
// range start border-radius
[`&-in-view${pickerCellCls}-range-start:not(${pickerCellCls}-range-start-single):not(${pickerCellCls}-range-end) ${pickerCellInnerCls}`]: {
borderStartStartRadius: borderRadiusSM,
borderEndStartRadius: borderRadiusSM,
borderStartEndRadius: 0,
borderEndEndRadius: 0
},
// range end border-radius
[`&-in-view${pickerCellCls}-range-end:not(${pickerCellCls}-range-end-single):not(${pickerCellCls}-range-start) ${pickerCellInnerCls}`]: {
borderStartStartRadius: 0,
borderEndStartRadius: 0,
borderStartEndRadius: borderRadiusSM,
borderEndEndRadius: borderRadiusSM
},
[`&-range-hover${pickerCellCls}-range-end::after`]: {
insetInlineStart: "50%"
},
// Edge start
[`tr > &-in-view${pickerCellCls}-range-hover:first-child::after,
tr > &-in-view${pickerCellCls}-range-hover-end:first-child::after,
&-in-view${pickerCellCls}-start${pickerCellCls}-range-hover-edge-start${pickerCellCls}-range-hover-edge-start-near-range::after,
&-in-view${pickerCellCls}-range-hover-edge-start:not(${pickerCellCls}-range-hover-edge-start-near-range)::after,
&-in-view${pickerCellCls}-range-hover-start::after`]: {
insetInlineStart: (pickerPanelCellWidth - pickerPanelCellHeight) / 2,
borderInlineStart: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
borderStartStartRadius: lineWidth,
borderEndStartRadius: lineWidth
},
// Edge end
[`tr > &-in-view${pickerCellCls}-range-hover:last-child::after,
tr > &-in-view${pickerCellCls}-range-hover-start:last-child::after,
&-in-view${pickerCellCls}-end${pickerCellCls}-range-hover-edge-end${pickerCellCls}-range-hover-edge-end-near-range::after,
&-in-view${pickerCellCls}-range-hover-edge-end:not(${pickerCellCls}-range-hover-edge-end-near-range)::after,
&-in-view${pickerCellCls}-range-hover-end::after`]: {
insetInlineEnd: (pickerPanelCellWidth - pickerPanelCellHeight) / 2,
borderInlineEnd: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
borderStartEndRadius: lineWidth,
borderEndEndRadius: lineWidth
},
// >>> Disabled
"&-disabled": {
color: colorTextDisabled,
pointerEvents: "none",
[pickerCellInnerCls]: {
background: "transparent"
},
"&::before": {
background: colorBgContainerDisabled
}
},
[`&-disabled${pickerCellCls}-today ${pickerCellInnerCls}::before`]: {
borderColor: colorTextDisabled
}
};
};
const genPanelStyle = (token) => {
const {
componentCls,
pickerCellInnerCls,
pickerYearMonthCellWidth,
pickerControlIconSize,
pickerPanelCellWidth,
paddingSM,
paddingXS,
paddingXXS,
colorBgContainer,
lineWidth,
lineType,
borderRadiusLG,
colorPrimary,
colorTextHeading,
colorSplit,
pickerControlIconBorderWidth,
colorIcon,
pickerTextHeight,
motionDurationMid,
colorIconHover,
fontWeightStrong,
pickerPanelCellHeight,
pickerCellPaddingVertical,
colorTextDisabled,
colorText,
fontSize,
pickerBasicCellHoverWithRangeColor,
motionDurationSlow,
pickerPanelWithoutTimeCellHeight,
pickerQuarterPanelContentHeight,
colorLink,
colorLinkActive,
colorLinkHover,
pickerDateHoverRangeBorderColor,
borderRadiusSM,
colorTextLightSolid,
borderRadius,
controlItemBgHover,
pickerTimePanelColumnHeight,
pickerTimePanelColumnWidth,
pickerTimePanelCellHeight,
controlItemBgActive,
marginXXS
} = token;
const pickerPanelWidth = pickerPanelCellWidth * 7 + paddingSM * 2 + 4;
const hoverCellFixedDistance = (pickerPanelWidth - paddingXS * 2) / 3 - pickerYearMonthCellWidth - paddingSM;
return {
[componentCls]: {
"&-panel": {
display: "inline-flex",
flexDirection: "column",
textAlign: "center",
background: colorBgContainer,
border: `${lineWidth}px ${lineType} ${colorSplit}`,
borderRadius: borderRadiusLG,
outline: "none",
"&-focused": {
borderColor: colorPrimary
},
"&-rtl": {
direction: "rtl",
[`${componentCls}-prev-icon,
${componentCls}-super-prev-icon`]: {
transform: "rotate(45deg)"
},
[`${componentCls}-next-icon,
${componentCls}-super-next-icon`]: {
transform: "rotate(-135deg)"
}
}
},
// ========================================================
// = Shared Panel =
// ========================================================
[`&-decade-panel,
&-year-panel,
&-quarter-panel,
&-month-panel,
&-week-panel,
&-date-panel,
&-time-panel`]: {
display: "flex",
flexDirection: "column",
width: pickerPanelWidth
},
// ======================= Header =======================
"&-header": {
display: "flex",
padding: `0 ${paddingXS}px`,
color: colorTextHeading,
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`,
"> *": {
flex: "none"
},
button: {
padding: 0,
color: colorIcon,
lineHeight: `${pickerTextHeight}px`,
background: "transparent",
border: 0,
cursor: "pointer",
transition: `color ${motionDurationMid}`
},
"> button": {
minWidth: "1.6em",
fontSize,
"&:hover": {
color: colorIconHover
}
},
"&-view": {
flex: "auto",
fontWeight: fontWeightStrong,
lineHeight: `${pickerTextHeight}px`,
button: {
color: "inherit",
fontWeight: "inherit",
verticalAlign: "top",
"&:not(:first-child)": {
marginInlineStart: paddingXS
},
"&:hover": {
color: colorPrimary
}
}
}
},
// Arrow button
[`&-prev-icon,
&-next-icon,
&-super-prev-icon,
&-super-next-icon`]: {
position: "relative",
display: "inline-block",
width: pickerControlIconSize,
height: pickerControlIconSize,
"&::before": {
position: "absolute",
top: 0,
insetInlineStart: 0,
display: "inline-block",
width: pickerControlIconSize,
height: pickerControlIconSize,
border: `0 solid currentcolor`,
borderBlockStartWidth: pickerControlIconBorderWidth,
borderBlockEndWidth: 0,
borderInlineStartWidth: pickerControlIconBorderWidth,
borderInlineEndWidth: 0,
content: '""'
}
},
[`&-super-prev-icon,
&-super-next-icon`]: {
"&::after": {
position: "absolute",
top: Math.ceil(pickerControlIconSize / 2),
insetInlineStart: Math.ceil(pickerControlIconSize / 2),
display: "inline-block",
width: pickerControlIconSize,
height: pickerControlIconSize,
border: "0 solid currentcolor",
borderBlockStartWidth: pickerControlIconBorderWidth,
borderBlockEndWidth: 0,
borderInlineStartWidth: pickerControlIconBorderWidth,
borderInlineEndWidth: 0,
content: '""'
}
},
[`&-prev-icon,
&-super-prev-icon`]: {
transform: "rotate(-45deg)"
},
[`&-next-icon,
&-super-next-icon`]: {
transform: "rotate(135deg)"
},
// ======================== Body ========================
"&-content": {
width: "100%",
tableLayout: "fixed",
borderCollapse: "collapse",
"th, td": {
position: "relative",
minWidth: pickerPanelCellHeight,
fontWeight: "normal"
},
th: {
height: pickerPanelCellHeight + pickerCellPaddingVertical * 2,
color: colorText,
verticalAlign: "middle"
}
},
"&-cell": _extends({
padding: `${pickerCellPaddingVertical}px 0`,
color: colorTextDisabled,
cursor: "pointer",
// In view
"&-in-view": {
color: colorText
}
}, genPickerCellInnerStyle(token)),
// DatePanel only
[`&-date-panel ${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-start ${pickerCellInnerCls},
&-date-panel ${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-end ${pickerCellInnerCls}`]: {
"&::after": {
position: "absolute",
top: 0,
bottom: 0,
zIndex: -1,
background: pickerBasicCellHoverWithRangeColor,
transition: `all ${motionDurationSlow}`,
content: '""'
}
},
[`&-date-panel
${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-start
${pickerCellInnerCls}::after`]: {
insetInlineEnd: -(pickerPanelCellWidth - pickerPanelCellHeight) / 2,
insetInlineStart: 0
},
[`&-date-panel ${componentCls}-cell-in-view${componentCls}-cell-in-range${componentCls}-cell-range-hover-end ${pickerCellInnerCls}::after`]: {
insetInlineEnd: 0,
insetInlineStart: -(pickerPanelCellWidth - pickerPanelCellHeight) / 2
},
// Hover with range start & end
[`&-range-hover${componentCls}-range-start::after`]: {
insetInlineEnd: "50%"
},
[`&-decade-panel,
&-year-panel,
&-quarter-panel,
&-month-panel`]: {
[`${componentCls}-content`]: {
height: pickerPanelWithoutTimeCellHeight * 4
},
[pickerCellInnerCls]: {
padding: `0 ${paddingXS}px`
}
},
"&-quarter-panel": {
[`${componentCls}-content`]: {
height: pickerQuarterPanelContentHeight
}
},
// ======================== Footer ========================
[`&-panel ${componentCls}-footer`]: {
borderTop: `${lineWidth}px ${lineType} ${colorSplit}`
},
"&-footer": {
width: "min-content",
minWidth: "100%",
lineHeight: `${pickerTextHeight - 2 * lineWidth}px`,
textAlign: "center",
"&-extra": {
padding: `0 ${paddingSM}`,
lineHeight: `${pickerTextHeight - 2 * lineWidth}px`,
textAlign: "start",
"&:not(:last-child)": {
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`
}
}
},
"&-now": {
textAlign: "start"
},
"&-today-btn": {
color: colorLink,
"&:hover": {
color: colorLinkHover
},
"&:active": {
color: colorLinkActive
},
[`&${componentCls}-today-btn-disabled`]: {
color: colorTextDisabled,
cursor: "not-allowed"
}
},
// ========================================================
// = Special =
// ========================================================
// ===================== Decade Panel =====================
"&-decade-panel": {
[pickerCellInnerCls]: {
padding: `0 ${paddingXS / 2}px`
},
[`${componentCls}-cell::before`]: {
display: "none"
}
},
// ============= Year & Quarter & Month Panel =============
[`&-year-panel,
&-quarter-panel,
&-month-panel`]: {
[`${componentCls}-body`]: {
padding: `0 ${paddingXS}px`
},
[pickerCellInnerCls]: {
width: pickerYearMonthCellWidth
},
[`${componentCls}-cell-range-hover-start::after`]: {
insetInlineStart: hoverCellFixedDistance,
borderInlineStart: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
borderStartStartRadius: borderRadiusSM,
borderBottomStartRadius: borderRadiusSM,
borderStartEndRadius: 0,
borderBottomEndRadius: 0,
[`${componentCls}-panel-rtl &`]: {
insetInlineEnd: hoverCellFixedDistance,
borderInlineEnd: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
borderStartStartRadius: 0,
borderBottomStartRadius: 0,
borderStartEndRadius: borderRadiusSM,
borderBottomEndRadius: borderRadiusSM
}
},
[`${componentCls}-cell-range-hover-end::after`]: {
insetInlineEnd: hoverCellFixedDistance,
borderInlineEnd: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
borderStartStartRadius: 0,
borderEndStartRadius: 0,
borderStartEndRadius: borderRadius,
borderEndEndRadius: borderRadius,
[`${componentCls}-panel-rtl &`]: {
insetInlineStart: hoverCellFixedDistance,
borderInlineStart: `${lineWidth}px dashed ${pickerDateHoverRangeBorderColor}`,
borderStartStartRadius: borderRadius,
borderEndStartRadius: borderRadius,
borderStartEndRadius: 0,
borderEndEndRadius: 0
}
}
},
// ====================== Week Panel ======================
"&-week-panel": {
[`${componentCls}-body`]: {
padding: `${paddingXS}px ${paddingSM}px`
},
// Clear cell style
[`${componentCls}-cell`]: {
[`&:hover ${pickerCellInnerCls},
&-selected ${pickerCellInnerCls},
${pickerCellInnerCls}`]: {
background: "transparent !important"
}
},
"&-row": {
td: {
transition: `background ${motionDurationMid}`,
"&:first-child": {
borderStartStartRadius: borderRadiusSM,
borderEndStartRadius: borderRadiusSM
},
"&:last-child": {
borderStartEndRadius: borderRadiusSM,
borderEndEndRadius: borderRadiusSM
}
},
"&:hover td": {
background: controlItemBgHover
},
[`&-selected td,
&-selected:hover td`]: {
background: colorPrimary,
[`&${componentCls}-cell-week`]: {
color: new TinyColor(colorTextLightSolid).setAlpha(0.5).toHexString()
},
[`&${componentCls}-cell-today ${pickerCellInnerCls}::before`]: {
borderColor: colorTextLightSolid
},
[pickerCellInnerCls]: {
color: colorTextLightSolid
}
}
}
},
// ====================== Date Panel ======================
"&-date-panel": {
[`${componentCls}-body`]: {
padding: `${paddingXS}px ${paddingSM}px`
},
[`${componentCls}-content`]: {
width: pickerPanelCellWidth * 7,
th: {
width: pickerPanelCellWidth
}
}
},
// ==================== Datetime Panel ====================
"&-datetime-panel": {
display: "flex",
[`${componentCls}-time-panel`]: {
borderInlineStart: `${lineWidth}px ${lineType} ${colorSplit}`
},
[`${componentCls}-date-panel,
${componentCls}-time-panel`]: {
transition: `opacity ${motionDurationSlow}`
},
// Keyboard
"&-active": {
[`${componentCls}-date-panel,
${componentCls}-time-panel`]: {
opacity: 0.3,
"&-active": {
opacity: 1
}
}
}
},
// ====================== Time Panel ======================
"&-time-panel": {
width: "auto",
minWidth: "auto",
direction: "ltr",
[`${componentCls}-content`]: {
display: "flex",
flex: "auto",
height: pickerTimePanelColumnHeight
},
"&-column": {
flex: "1 0 auto",
width: pickerTimePanelColumnWidth,
margin: `${paddingXXS}px 0`,
padding: 0,
overflowY: "hidden",
textAlign: "start",
listStyle: "none",
transition: `background ${motionDurationMid}`,
overflowX: "hidden",
"&::after": {
display: "block",
height: pickerTimePanelColumnHeight - pickerTimePanelCellHeight,
content: '""'
},
"&:not(:first-child)": {
borderInlineStart: `${lineWidth}px ${lineType} ${colorSplit}`
},
"&-active": {
background: new TinyColor(controlItemBgActive).setAlpha(0.2).toHexString()
},
"&:hover": {
overflowY: "auto"
},
"> li": {
margin: 0,
padding: 0,
[`&${componentCls}-time-panel-cell`]: {
marginInline: marginXXS,
[`${componentCls}-time-panel-cell-inner`]: {
display: "block",
width: pickerTimePanelColumnWidth - 2 * marginXXS,
height: pickerTimePanelCellHeight,
margin: 0,
paddingBlock: 0,
paddingInlineEnd: 0,
paddingInlineStart: (pickerTimePanelColumnWidth - pickerTimePanelCellHeight) / 2,
color: colorText,
lineHeight: `${pickerTimePanelCellHeight}px`,
borderRadius: borderRadiusSM,
cursor: "pointer",
transition: `background ${motionDurationMid}`,
"&:hover": {
background: controlItemBgHover
}
},
"&-selected": {
[`${componentCls}-time-panel-cell-inner`]: {
background: controlItemBgActive
}
},
"&-disabled": {
[`${componentCls}-time-panel-cell-inner`]: {
color: colorTextDisabled,
background: "transparent",
cursor: "not-allowed"
}
}
}
}
}
},
// https://github.com/ant-design/ant-design/issues/39227
[`&-datetime-panel ${componentCls}-time-panel-column:after`]: {
height: pickerTimePanelColumnHeight - pickerTimePanelCellHeight + paddingXXS * 2
}
}
};
};
const genPickerStatusStyle = (token) => {
const {
componentCls,
colorBgContainer,
colorError,
colorErrorOutline,
colorWarning,
colorWarningOutline
} = token;
return {
[componentCls]: {
[`&-status-error${componentCls}`]: {
"&, &:not([disabled]):hover": {
backgroundColor: colorBgContainer,
borderColor: colorError
},
"&-focused, &:focus": _extends({}, genActiveStyle(merge(token, {
inputBorderActiveColor: colorError,
inputBorderHoverColor: colorError,
controlOutline: colorErrorOutline
}))),
[`${componentCls}-active-bar`]: {
background: colorError
}
},
[`&-status-warning${componentCls}`]: {
"&, &:not([disabled]):hover": {
backgroundColor: colorBgContainer,
borderColor: colorWarning
},
"&-focused, &:focus": _extends({}, genActiveStyle(merge(token, {
inputBorderActiveColor: colorWarning,
inputBorderHoverColor: colorWarning,
controlOutline: colorWarningOutline
}))),
[`${componentCls}-active-bar`]: {
background: colorWarning
}
}
}
};
};
const genPickerStyle = (token) => {
const {
componentCls,
antCls,
boxShadowPopoverArrow,
controlHeight,
fontSize,
inputPaddingHorizontal,
colorBgContainer,
lineWidth,
lineType,
colorBorder,
borderRadius,
motionDurationMid,
colorBgContainerDisabled,
colorTextDisabled,
colorTextPlaceholder,
controlHeightLG,
fontSizeLG,
controlHeightSM,
inputPaddingHorizontalSM,
paddingXS,
marginXS,
colorTextDescription,
lineWidthBold,
lineHeight,
colorPrimary,
motionDurationSlow,
zIndexPopup,
paddingXXS,
paddingSM,
pickerTextHeight,
controlItemBgActive,
colorPrimaryBorder,
sizePopupArrow,
borderRadiusXS,
borderRadiusOuter,
colorBgElevated,
borderRadiusLG,
boxShadowSecondary,
borderRadiusSM,
colorSplit,
controlItemBgHover,
presetsWidth,
presetsMaxWidth
} = token;
return [
{
[componentCls]: _extends(_extends(_extends({}, resetComponent(token)), genPikerPadding(token, controlHeight, fontSize, inputPaddingHorizontal)), {
position: "relative",
display: "inline-flex",
alignItems: "center",
background: colorBgContainer,
lineHeight: 1,
border: `${lineWidth}px ${lineType} ${colorBorder}`,
borderRadius,
transition: `border ${motionDurationMid}, box-shadow ${motionDurationMid}`,
"&:hover, &-focused": _extends({}, genHoverStyle(token)),
"&-focused": _extends({}, genActiveStyle(token)),
[`&${componentCls}-disabled`]: {
background: colorBgContainerDisabled,
borderColor: colorBorder,
cursor: "not-allowed",
[`${componentCls}-suffix`]: {
color: colorTextDisabled
}
},
[`&${componentCls}-borderless`]: {
backgroundColor: "transparent !important",
borderColor: "transparent !important",
boxShadow: "none !important"
},
// ======================== Input =========================
[`${componentCls}-input`]: {
position: "relative",
display: "inline-flex",
alignItems: "center",
width: "100%",
"> input": _extends(_extends({}, genBasicInputStyle(token)), {
flex: "auto",
// Fix Firefox flex not correct:
// https://github.com/ant-design/ant-design/pull/20023#issuecomment-564389553
minWidth: 1,
height: "auto",
padding: 0,
background: "transparent",
border: 0,
"&:focus": {
boxShadow: "none"
},
"&[disabled]": {
background: "transparent"
}
}),
"&:hover": {
[`${componentCls}-clear`]: {
opacity: 1
}
},
"&-placeholder": {
"> input": {
color: colorTextPlaceholder
}
}
},
// Size
"&-large": _extends(_extends({}, genPikerPadding(token, controlHeightLG, fontSizeLG, inputPaddingHorizontal)), {
[`${componentCls}-input > input`]: {
fontSize: fontSizeLG
}
}),
"&-small": _extends({}, genPikerPadding(token, controlHeightSM, fontSize, inputPaddingHorizontalSM)),
[`${componentCls}-suffix`]: {
display: "flex",
flex: "none",
alignSelf: "center",
marginInlineStart: paddingXS / 2,
color: colorTextDisabled,
lineHeight: 1,
pointerEvents: "none",
"> *": {
verticalAlign: "top",
"&:not(:last-child)": {
marginInlineEnd: marginXS
}
}
},
[`${componentCls}-clear`]: {
position: "absolute",
top: "50%",
insetInlineEnd: 0,
color: colorTextDisabled,
lineHeight: 1,
background: colorBgContainer,
transform: "translateY(-50%)",
cursor: "pointer",
opacity: 0,
transition: `opacity ${motionDurationMid}, color ${motionDurationMid}`,
"> *": {
verticalAlign: "top"
},
"&:hover": {
color: colorTextDescription
}
},
[`${componentCls}-separator`]: {
position: "relative",
display: "inline-block",
width: "1em",
height: fontSizeLG,
color: colorTextDisabled,
fontSize: fontSizeLG,
verticalAlign: "top",
cursor: "default",
[`${componentCls}-focused &`]: {
color: colorTextDescription
},
[`${componentCls}-range-separator &`]: {
[`${componentCls}-disabled &`]: {
cursor: "not-allowed"
}
}
},
// ======================== Range =========================
"&-range": {
position: "relative",
display: "inline-flex",
// Clear
[`${componentCls}-clear`]: {
insetInlineEnd: inputPaddingHorizontal
},
"&:hover": {
[`${componentCls}-clear`]: {
opacity: 1
}
},
// Active bar
[`${componentCls}-active-bar`]: {
bottom: -lineWidth,
height: lineWidthBold,
marginInlineStart: inputPaddingHorizontal,
background: colorPrimary,
opacity: 0,
transition: `all ${motionDurationSlow} ease-out`,
pointerEvents: "none"
},
[`&${componentCls}-focused`]: {
[`${componentCls}-active-bar`]: {
opacity: 1
}
},
[`${componentCls}-range-separator`]: {
alignItems: "center",
padding: `0 ${paddingXS}px`,
lineHeight: 1
},
[`&${componentCls}-small`]: {
[`${componentCls}-clear`]: {
insetInlineEnd: inputPaddingHorizontalSM
},
[`${componentCls}-active-bar`]: {
marginInlineStart: inputPaddingHorizontalSM
}
}
},
// ======================= Dropdown =======================
"&-dropdown": _extends(_extends(_extends({}, resetComponent(token)), genPanelStyle(token)), {
position: "absolute",
// Fix incorrect position of picker popup
// https://github.com/ant-design/ant-design/issues/35590
top: -9999,
left: {
_skip_check_: true,
value: -9999
},
zIndex: zIndexPopup,
[`&${componentCls}-dropdown-hidden`]: {
display: "none"
},
[`&${componentCls}-dropdown-placement-bottomLeft`]: {
[`${componentCls}-range-arrow`]: {
top: 0,
display: "block",
transform: "translateY(-100%)"
}
},
[`&${componentCls}-dropdown-placement-topLeft`]: {
[`${componentCls}-range-arrow`]: {
bottom: 0,
display: "block",
transform: "translateY(100%) rotate(180deg)"
}
},
[`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-topLeft,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-topRight,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-topLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-topRight`]: {
animationName: slideDownIn
},
[`&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-bottomLeft,
&${antCls}-slide-up-enter${antCls}-slide-up-enter-active${componentCls}-dropdown-placement-bottomRight,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-bottomLeft,
&${antCls}-slide-up-appear${antCls}-slide-up-appear-active${componentCls}-dropdown-placement-bottomRight`]: {
animationName: slideUpIn
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-topLeft,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-topRight`]: {
animationName: slideDownOut
},
[`&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-bottomLeft,
&${antCls}-slide-up-leave${antCls}-slide-up-leave-active${componentCls}-dropdown-placement-bottomRight`]: {
animationName: slideUpOut
},
// Time picker with additional style
[`${componentCls}-panel > ${componentCls}-time-panel`]: {
paddingTop: paddingXXS
},
// ======================== Ranges ========================
[`${componentCls}-ranges`]: {
marginBottom: 0,
padding: `${paddingXXS}px ${paddingSM}px`,
overflow: "hidden",
lineHeight: `${pickerTextHeight - 2 * lineWidth - paddingXS / 2}px`,
textAlign: "start",
listStyle: "none",
display: "flex",
justifyContent: "space-between",
"> li": {
display: "inline-block"
},
// https://github.com/ant-design/ant-design/issues/23687
[`${componentCls}-preset > ${antCls}-tag-blue`]: {
color: colorPrimary,
background: controlItemBgActive,
borderColor: colorPrimaryBorder,
cursor: "pointer"
},
[`${componentCls}-ok`]: {
marginInlineStart: "auto"
}
},
[`${componentCls}-range-wrapper`]: {
display: "flex",
position: "relative"
},
[`${componentCls}-range-arrow`]: _extends({
position: "absolute",
zIndex: 1,
display: "none",
marginInlineStart: inputPaddingHorizontal * 1.5,
transition: `left ${motionDurationSlow} ease-out`
}, roundedArrow(sizePopupArrow, borderRadiusXS, borderRadiusOuter, colorBgElevated, boxShadowPopoverArrow)),
[`${componentCls}-panel-container`]: {
overflow: "hidden",
verticalAlign: "top",
background: colorBgElevated,
borderRadius: borderRadiusLG,
boxShadow: boxShadowSecondary,
transition: `margin ${motionDurationSlow}`,
// ======================== Layout ========================
[`${componentCls}-panel-layout`]: {
display: "flex",
flexWrap: "nowrap",
alignItems: "stretch"
},
// ======================== Preset ========================
[`${componentCls}-presets`]: {
display: "flex",
flexDirection: "column",
minWidth: presetsWidth,
maxWidth: presetsMaxWidth,
ul: {
height: 0,
flex: "auto",
listStyle: "none",
overflow: "auto",
margin: 0,
padding: paddingXS,
borderInlineEnd: `${lineWidth}px ${lineType} ${colorSplit}`,
li: _extends(_extends({}, textEllipsis), {
borderRadius: borderRadiusSM,
paddingInline: paddingXS,
paddingBlock: (controlHeightSM - Math.round(fontSize * lineHeight)) / 2,
cursor: "pointer",
transition: `all ${motionDurationSlow}`,
"+ li": {
marginTop: marginXS
},
"&:hover": {
background: controlItemBgHover
}
})
}
},
// ======================== Panels ========================
[`${componentCls}-panels`]: {
display: "inline-flex",
flexWrap: "nowrap",
direction: "ltr",
[`${componentCls}-panel`]: {
borderWidth: `0 0 ${lineWidth}px`
},
"&:last-child": {
[`${componentCls}-panel`]: {
borderWidth: 0
}
}
},
[`${componentCls}-panel`]: {
verticalAlign: "top",
background: "transparent",
borderRadius: 0,
borderWidth: 0,
[`${componentCls}-content,
table`]: {
textAlign: "center"
},
"&-focused": {
borderColor: colorBorder
}
}
}
}),
"&-dropdown-range": {
padding: `${sizePopupArrow * 2 / 3}px 0`,
"&-hidden": {
display: "none"
}
},
"&-rtl": {
direction: "rtl",
[`${componentCls}-separator`]: {
transform: "rotate(180deg)"
},
[`${componentCls}-footer`]: {
"&-extra": {
direction: "rtl"
}
}
}
})
},
// Follow code may reuse in other components
initSlideMotion(token, "slide-up"),
initSlideMotion(token, "slide-down"),
initMoveMotion(token, "move-up"),
initMoveMotion(token, "move-down")
];
};
const initPickerPanelToken = (token) => {
const pickerTimePanelCellHeight = 28;
const {
componentCls,
controlHeightLG,
controlHeightSM,
colorPrimary,
paddingXXS
} = token;
return {
pickerCellCls: `${componentCls}-cell`,
pickerCellInnerCls: `${componentCls}-cell-inner`,
pickerTextHeight: controlHeightLG,
pickerPanelCellWidth: controlHeightSM * 1.5,
pickerPanelCellHeight: controlHeightSM,
pickerDateHoverRangeBorderColor: new TinyColor(colorPrimary).lighten(20).toHexString(),
pickerBasicCellHoverWithRangeColor: new TinyColor(colorPrimary).lighten(35).toHexString(),
pickerPanelWithoutTimeCellHeight: controlHeightLG * 1.65,
pickerYearMonthCellWidth: controlHeightLG * 1.5,
pickerTimePanelColumnHeight: pickerTimePanelCellHeight * 8,
pickerTimePanelColumnWidth: controlHeightLG * 1.4,
pickerTimePanelCellHeight,
pickerQuarterPanelContentHeight: controlHeightLG * 1.4,
pickerCellPaddingVertical: paddingXXS,
pickerCellBorderGap: 2,
pickerControlIconSize: 7,
pickerControlIconBorderWidth: 1.5
};
};
const useStyle$J = genComponentStyleHook("DatePicker", (token) => {
const pickerToken = merge(initInputToken(token), initPickerPanelToken(token));
return [
genPickerStyle(pickerToken),
genPickerStatusStyle(pickerToken),
// =====================================================
// == Space Compact ==
// =====================================================
genCompactItemStyle(token, {
focusElCls: `${token.componentCls}-focused`
})
];
}, (token) => ({
presetsWidth: 120,
presetsMaxWidth: 200,
zIndexPopup: token.zIndexPopupBase + 50
}));
const genCalendarStyles = (token) => {
const {
calendarCls,
componentCls,
calendarFullBg,
calendarFullPanelBg,
calendarItemActiveBg
} = token;
return {
[calendarCls]: _extends(_extends(_extends({}, genPanelStyle(token)), resetComponent(token)), {
background: calendarFullBg,
"&-rtl": {
direction: "rtl"
},
[`${calendarCls}-header`]: {
display: "flex",
justifyContent: "flex-end",
padding: `${token.paddingSM}px 0`,
[`${calendarCls}-year-select`]: {
minWidth: token.yearControlWidth
},
[`${calendarCls}-month-select`]: {
minWidth: token.monthControlWidth,
marginInlineStart: token.marginXS
},
[`${calendarCls}-mode-switch`]: {
marginInlineStart: token.marginXS
}
}
}),
[`${calendarCls} ${componentCls}-panel`]: {
background: calendarFullPanelBg,
border: 0,
borderTop: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
borderRadius: 0,
[`${componentCls}-month-panel, ${componentCls}-date-panel`]: {
width: "auto"
},
[`${componentCls}-body`]: {
padding: `${token.paddingXS}px 0`
},
[`${componentCls}-content`]: {
width: "100%"
}
},
[`${calendarCls}-mini`]: {
borderRadius: token.borderRadiusLG,
[`${calendarCls}-header`]: {
paddingInlineEnd: token.paddingXS,
paddingInlineStart: token.paddingXS
},
[`${componentCls}-panel`]: {
borderRadius: `0 0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px`
},
[`${componentCls}-content`]: {
height: token.miniContentHeight,
th: {
height: "auto",
padding: 0,
lineHeight: `${token.weekHeight}px`
}
},
[`${componentCls}-cell::before`]: {
pointerEvents: "none"
}
},
[`${calendarCls}${calendarCls}-full`]: {
[`${componentCls}-panel`]: {
display: "block",
width: "100%",
textAlign: "end",
background: calendarFullBg,
border: 0,
[`${componentCls}-body`]: {
"th, td": {
padding: 0
},
th: {
height: "auto",
paddingInlineEnd: token.paddingSM,
paddingBottom: token.paddingXXS,
lineHeight: `${token.weekHeight}px`
}
}
},
[`${componentCls}-cell`]: {
"&::before": {
display: "none"
},
"&:hover": {
[`${calendarCls}-date`]: {
background: token.controlItemBgHover
}
},
[`${calendarCls}-date-today::before`]: {
display: "none"
},
// >>> Selected
[`&-in-view${componentCls}-cell-selected`]: {
[`${calendarCls}-date, ${calendarCls}-date-today`]: {
background: calendarItemActiveBg
}
},
"&-selected, &-selected:hover": {
[`${calendarCls}-date, ${calendarCls}-date-today`]: {
[`${calendarCls}-date-value`]: {
color: token.colorPrimary
}
}
}
},
[`${calendarCls}-date`]: {
display: "block",
width: "auto",
height: "auto",
margin: `0 ${token.marginXS / 2}px`,
padding: `${token.paddingXS / 2}px ${token.paddingXS}px 0`,
border: 0,
borderTop: `${token.lineWidthBold}px ${token.lineType} ${token.colorSplit}`,
borderRadius: 0,
transition: `background ${token.motionDurationSlow}`,
"&-value": {
lineHeight: `${token.dateValueHeight}px`,
transition: `color ${token.motionDurationSlow}`
},
"&-content": {
position: "static",
width: "auto",
height: token.dateContentHeight,
overflowY: "auto",
color: token.colorText,
lineHeight: token.lineHeight,
textAlign: "start"
},
"&-today": {
borderColor: token.colorPrimary,
[`${calendarCls}-date-value`]: {
color: token.colorText
}
}
}
},
[`@media only screen and (max-width: ${token.screenXS}px) `]: {
[`${calendarCls}`]: {
[`${calendarCls}-header`]: {
display: "block",
[`${calendarCls}-year-select`]: {
width: "50%"
},
[`${calendarCls}-month-select`]: {
width: `calc(50% - ${token.paddingXS}px)`
},
[`${calendarCls}-mode-switch`]: {
width: "100%",
marginTop: token.marginXS,
marginInlineStart: 0,
"> label": {
width: "50%",
textAlign: "center"
}
}
}
}
}
};
};
const useStyle$I = genComponentStyleHook("Calendar", (token) => {
const calendarCls = `${token.componentCls}-calendar`;
const calendarToken = merge(initInputToken(token), initPickerPanelToken(token), {
calendarCls,
pickerCellInnerCls: `${token.componentCls}-cell-inner`,
calendarFullBg: token.colorBgContainer,
calendarFullPanelBg: token.colorBgContainer,
calendarItemActiveBg: token.controlItemBgActive,
dateValueHeight: token.controlHeightSM,
weekHeight: token.controlHeightSM * 0.75,
dateContentHeight: (token.fontSizeSM * token.lineHeightSM + token.marginXS) * 3 + token.lineWidth * 2
});
return [genCalendarStyles(calendarToken)];
}, {
yearControlWidth: 80,
monthControlWidth: 70,
miniContentHeight: 256
});
function generateCalendar(generateConfig2) {
function isSameYear2(date1, date2) {
return date1 && date2 && generateConfig2.getYear(date1) === generateConfig2.getYear(date2);
}
function isSameMonth2(date1, date2) {
return isSameYear2(date1, date2) && generateConfig2.getMonth(date1) === generateConfig2.getMonth(date2);
}
function isSameDate2(date1, date2) {
return isSameMonth2(date1, date2) && generateConfig2.getDate(date1) === generateConfig2.getDate(date2);
}
const Calendar2 = defineComponent({
name: "ACalendar",
inheritAttrs: false,
props: {
prefixCls: String,
locale: {
type: Object,
default: void 0
},
validRange: {
type: Array,
default: void 0
},
disabledDate: {
type: Function,
default: void 0
},
dateFullCellRender: {
type: Function,
default: void 0
},
dateCellRender: {
type: Function,
default: void 0
},
monthFullCellRender: {
type: Function,
default: void 0
},
monthCellRender: {
type: Function,
default: void 0
},
headerRender: {
type: Function,
default: void 0
},
value: {
type: [Object, String],
default: void 0
},
defaultValue: {
type: [Object, String],
default: void 0
},
mode: {
type: String,
default: void 0
},
fullscreen: {
type: Boolean,
default: void 0
},
onChange: {
type: Function,
default: void 0
},
"onUpdate:value": {
type: Function,
default: void 0
},
onPanelChange: {
type: Function,
default: void 0
},
onSelect: {
type: Function,
default: void 0
},
valueFormat: {
type: String,
default: void 0
}
},
slots: Object,
setup(p, _ref) {
let {
emit,
slots,
attrs
} = _ref;
const props2 = p;
const {
prefixCls,
direction
} = useConfigInject("picker", props2);
const [wrapSSR, hashId] = useStyle$I(prefixCls);
const calendarPrefixCls = computed(() => `${prefixCls.value}-calendar`);
const maybeToString = (date) => {
return props2.valueFormat ? generateConfig2.toString(date, props2.valueFormat) : date;
};
const value = computed(() => {
if (props2.value) {
return props2.valueFormat ? generateConfig2.toDate(props2.value, props2.valueFormat) : props2.value;
}
return props2.value === "" ? void 0 : props2.value;
});
const defaultValue = computed(() => {
if (props2.defaultValue) {
return props2.valueFormat ? generateConfig2.toDate(props2.defaultValue, props2.valueFormat) : props2.defaultValue;
}
return props2.defaultValue === "" ? void 0 : props2.defaultValue;
});
const [mergedValue, setMergedValue] = useMergedState(() => value.value || generateConfig2.getNow(), {
defaultValue: defaultValue.value,
value
});
const [mergedMode, setMergedMode] = useMergedState("month", {
value: toRef(props2, "mode")
});
const panelMode = computed(() => mergedMode.value === "year" ? "month" : "date");
const mergedDisabledDate = computed(() => {
return (date) => {
var _a;
const notInRange = props2.validRange ? generateConfig2.isAfter(props2.validRange[0], date) || generateConfig2.isAfter(date, props2.validRange[1]) : false;
return notInRange || !!((_a = props2.disabledDate) === null || _a === void 0 ? void 0 : _a.call(props2, date));
};
});
const triggerPanelChange = (date, newMode) => {
emit("panelChange", maybeToString(date), newMode);
};
const triggerChange = (date) => {
setMergedValue(date);
if (!isSameDate2(date, mergedValue.value)) {
if (panelMode.value === "date" && !isSameMonth2(date, mergedValue.value) || panelMode.value === "month" && !isSameYear2(date, mergedValue.value)) {
triggerPanelChange(date, mergedMode.value);
}
const val = maybeToString(date);
emit("update:value", val);
emit("change", val);
}
};
const triggerModeChange = (newMode) => {
setMergedMode(newMode);
triggerPanelChange(mergedValue.value, newMode);
};
const onInternalSelect = (date, source) => {
triggerChange(date);
emit("select", maybeToString(date), {
source
});
};
const defaultLocale = computed(() => {
const {
locale: locale2
} = props2;
const result = _extends(_extends({}, locale$1), locale2);
result.lang = _extends(_extends({}, result.lang), (locale2 || {}).lang);
return result;
});
const [mergedLocale] = useLocaleReceiver("Calendar", defaultLocale);
return () => {
const today = generateConfig2.getNow();
const {
dateFullCellRender = slots === null || slots === void 0 ? void 0 : slots.dateFullCellRender,
dateCellRender = slots === null || slots === void 0 ? void 0 : slots.dateCellRender,
monthFullCellRender = slots === null || slots === void 0 ? void 0 : slots.monthFullCellRender,
monthCellRender = slots === null || slots === void 0 ? void 0 : slots.monthCellRender,
headerRender = slots === null || slots === void 0 ? void 0 : slots.headerRender,
fullscreen = true,
validRange
} = props2;
const dateRender = (_ref2) => {
let {
current: date
} = _ref2;
if (dateFullCellRender) {
return dateFullCellRender({
current: date
});
}
return createVNode("div", {
"class": classNames(`${prefixCls.value}-cell-inner`, `${calendarPrefixCls.value}-date`, {
[`${calendarPrefixCls.value}-date-today`]: isSameDate2(today, date)
})
}, [createVNode("div", {
"class": `${calendarPrefixCls.value}-date-value`
}, [String(generateConfig2.getDate(date)).padStart(2, "0")]), createVNode("div", {
"class": `${calendarPrefixCls.value}-date-content`
}, [dateCellRender && dateCellRender({
current: date
})])]);
};
const monthRender = (_ref3, locale2) => {
let {
current: date
} = _ref3;
if (monthFullCellRender) {
return monthFullCellRender({
current: date
});
}
const months = locale2.shortMonths || generateConfig2.locale.getShortMonths(locale2.locale);
return createVNode("div", {
"class": classNames(`${prefixCls.value}-cell-inner`, `${calendarPrefixCls.value}-date`, {
[`${calendarPrefixCls.value}-date-today`]: isSameMonth2(today, date)
})
}, [createVNode("div", {
"class": `${calendarPrefixCls.value}-date-value`
}, [months[generateConfig2.getMonth(date)]]), createVNode("div", {
"class": `${calendarPrefixCls.value}-date-content`
}, [monthCellRender && monthCellRender({
current: date
})])]);
};
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(calendarPrefixCls.value, {
[`${calendarPrefixCls.value}-full`]: fullscreen,
[`${calendarPrefixCls.value}-mini`]: !fullscreen,
[`${calendarPrefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value)
}), [headerRender ? headerRender({
value: mergedValue.value,
type: mergedMode.value,
onChange: (nextDate) => {
onInternalSelect(nextDate, "customize");
},
onTypeChange: triggerModeChange
}) : createVNode(CalendarHeader, {
"prefixCls": calendarPrefixCls.value,
"value": mergedValue.value,
"generateConfig": generateConfig2,
"mode": mergedMode.value,
"fullscreen": fullscreen,
"locale": mergedLocale.value.lang,
"validRange": validRange,
"onChange": onInternalSelect,
"onModeChange": triggerModeChange
}, null), createVNode(PickerPanel$1, {
"value": mergedValue.value,
"prefixCls": prefixCls.value,
"locale": mergedLocale.value.lang,
"generateConfig": generateConfig2,
"dateRender": dateRender,
"monthCellRender": (obj) => monthRender(obj, mergedLocale.value.lang),
"onSelect": (nextDate) => {
onInternalSelect(nextDate, panelMode.value);
},
"mode": panelMode.value,
"picker": panelMode.value,
"disabledDate": mergedDisabledDate.value,
"hideHeader": true
}, null)]));
};
}
});
Calendar2.install = function(app) {
app.component(Calendar2.name, Calendar2);
return app;
};
return Calendar2;
}
const Calendar = generateCalendar(generateConfig);
const Calendar$1 = withInstall(Calendar);
function useRaf(callback) {
const rafRef = shallowRef();
const removedRef = shallowRef(false);
function trigger() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (!removedRef.value) {
wrapperRaf.cancel(rafRef.value);
rafRef.value = wrapperRaf(() => {
callback(...args);
});
}
}
return trigger;
}
function useRafState(defaultState) {
const batchRef = shallowRef([]);
const state = shallowRef(typeof defaultState === "function" ? defaultState() : defaultState);
const flushUpdate = useRaf(() => {
let value = state.value;
batchRef.value.forEach((callback) => {
value = callback(value);
});
batchRef.value = [];
state.value = value;
});
function updater(callback) {
batchRef.value.push(callback);
flushUpdate();
}
return [state, updater];
}
const TabNode = defineComponent({
compatConfig: {
MODE: 3
},
name: "TabNode",
props: {
id: {
type: String
},
prefixCls: {
type: String
},
tab: {
type: Object
},
active: {
type: Boolean
},
closable: {
type: Boolean
},
editable: {
type: Object
},
onClick: {
type: Function
},
onResize: {
type: Function
},
renderWrapper: {
type: Function
},
removeAriaLabel: {
type: String
},
// onRemove: { type: Function as PropType<() => void> },
onFocus: {
type: Function
}
},
emits: ["click", "resize", "remove", "focus"],
setup(props2, _ref) {
let {
expose,
attrs
} = _ref;
const domRef = ref();
function onInternalClick(e) {
var _a;
if ((_a = props2.tab) === null || _a === void 0 ? void 0 : _a.disabled) {
return;
}
props2.onClick(e);
}
expose({
domRef
});
function onRemoveTab(event) {
var _a;
event.preventDefault();
event.stopPropagation();
props2.editable.onEdit("remove", {
key: (_a = props2.tab) === null || _a === void 0 ? void 0 : _a.key,
event
});
}
const removable = computed(() => {
var _a;
return props2.editable && props2.closable !== false && !((_a = props2.tab) === null || _a === void 0 ? void 0 : _a.disabled);
});
return () => {
var _a;
const {
prefixCls,
id,
active,
tab: {
key: key2,
tab,
disabled,
closeIcon
},
renderWrapper,
removeAriaLabel,
editable,
onFocus
} = props2;
const tabPrefix = `${prefixCls}-tab`;
const node = createVNode("div", {
"key": key2,
"ref": domRef,
"class": classNames(tabPrefix, {
[`${tabPrefix}-with-remove`]: removable.value,
[`${tabPrefix}-active`]: active,
[`${tabPrefix}-disabled`]: disabled
}),
"style": attrs.style,
"onClick": onInternalClick
}, [createVNode("div", {
"role": "tab",
"aria-selected": active,
"id": id && `${id}-tab-${key2}`,
"class": `${tabPrefix}-btn`,
"aria-controls": id && `${id}-panel-${key2}`,
"aria-disabled": disabled,
"tabindex": disabled ? null : 0,
"onClick": (e) => {
e.stopPropagation();
onInternalClick(e);
},
"onKeydown": (e) => {
if ([KeyCode.SPACE, KeyCode.ENTER].includes(e.which)) {
e.preventDefault();
onInternalClick(e);
}
},
"onFocus": onFocus
}, [typeof tab === "function" ? tab() : tab]), removable.value && createVNode("button", {
"type": "button",
"aria-label": removeAriaLabel || "remove",
"tabindex": 0,
"class": `${tabPrefix}-remove`,
"onClick": (e) => {
e.stopPropagation();
onRemoveTab(e);
}
}, [(closeIcon === null || closeIcon === void 0 ? void 0 : closeIcon()) || ((_a = editable.removeIcon) === null || _a === void 0 ? void 0 : _a.call(editable)) || "×"])]);
return renderWrapper ? renderWrapper(node) : node;
};
}
});
const DEFAULT_SIZE$2 = {
width: 0,
height: 0,
left: 0,
top: 0
};
function useOffsets(tabs, tabSizes) {
const offsetMap = ref(/* @__PURE__ */ new Map());
watchEffect(() => {
var _a, _b;
const map = /* @__PURE__ */ new Map();
const tabsValue = tabs.value;
const lastOffset = tabSizes.value.get((_a = tabsValue[0]) === null || _a === void 0 ? void 0 : _a.key) || DEFAULT_SIZE$2;
const rightOffset = lastOffset.left + lastOffset.width;
for (let i = 0; i < tabsValue.length; i += 1) {
const {
key: key2
} = tabsValue[i];
let data = tabSizes.value.get(key2);
if (!data) {
data = tabSizes.value.get((_b = tabsValue[i - 1]) === null || _b === void 0 ? void 0 : _b.key) || DEFAULT_SIZE$2;
}
const entity = map.get(key2) || _extends({}, data);
entity.right = rightOffset - entity.left - entity.width;
map.set(key2, entity);
}
offsetMap.value = new Map(map);
});
return offsetMap;
}
const AddButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "AddButton",
inheritAttrs: false,
props: {
prefixCls: String,
editable: {
type: Object
},
locale: {
type: Object,
default: void 0
}
},
setup(props2, _ref) {
let {
expose,
attrs
} = _ref;
const domRef = ref();
expose({
domRef
});
return () => {
const {
prefixCls,
editable,
locale: locale2
} = props2;
if (!editable || editable.showAdd === false) {
return null;
}
return createVNode("button", {
"ref": domRef,
"type": "button",
"class": `${prefixCls}-nav-add`,
"style": attrs.style,
"aria-label": (locale2 === null || locale2 === void 0 ? void 0 : locale2.addAriaLabel) || "Add tab",
"onClick": (event) => {
editable.onEdit("add", {
event
});
}
}, [editable.addIcon ? editable.addIcon() : "+"]);
};
}
});
const operationNodeProps = {
prefixCls: {
type: String
},
id: {
type: String
},
tabs: {
type: Object
},
rtl: {
type: Boolean
},
tabBarGutter: {
type: Number
},
activeKey: {
type: [String, Number]
},
mobile: {
type: Boolean
},
moreIcon: PropTypes.any,
moreTransitionName: {
type: String
},
editable: {
type: Object
},
locale: {
type: Object,
default: void 0
},
removeAriaLabel: String,
onTabClick: {
type: Function
},
popupClassName: String,
getPopupContainer: functionType()
};
const OperationNode = defineComponent({
compatConfig: {
MODE: 3
},
name: "OperationNode",
inheritAttrs: false,
props: operationNodeProps,
emits: ["tabClick"],
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const [open2, setOpen] = useState$1(false);
const [selectedKey, setSelectedKey] = useState$1(null);
const selectOffset = (offset2) => {
const enabledTabs = props2.tabs.filter((tab) => !tab.disabled);
let selectedIndex = enabledTabs.findIndex((tab) => tab.key === selectedKey.value) || 0;
const len = enabledTabs.length;
for (let i = 0; i < len; i += 1) {
selectedIndex = (selectedIndex + offset2 + len) % len;
const tab = enabledTabs[selectedIndex];
if (!tab.disabled) {
setSelectedKey(tab.key);
return;
}
}
};
const onKeyDown2 = (e) => {
const {
which
} = e;
if (!open2.value) {
if ([KeyCode.DOWN, KeyCode.SPACE, KeyCode.ENTER].includes(which)) {
setOpen(true);
e.preventDefault();
}
return;
}
switch (which) {
case KeyCode.UP:
selectOffset(-1);
e.preventDefault();
break;
case KeyCode.DOWN:
selectOffset(1);
e.preventDefault();
break;
case KeyCode.ESC:
setOpen(false);
break;
case KeyCode.SPACE:
case KeyCode.ENTER:
if (selectedKey.value !== null) props2.onTabClick(selectedKey.value, e);
break;
}
};
const popupId = computed(() => `${props2.id}-more-popup`);
const selectedItemId = computed(() => selectedKey.value !== null ? `${popupId.value}-${selectedKey.value}` : null);
const onRemoveTab = (event, key2) => {
event.preventDefault();
event.stopPropagation();
props2.editable.onEdit("remove", {
key: key2,
event
});
};
watch(open2, () => {
if (!open2.value) {
setSelectedKey(null);
}
});
useProvideOverride({});
return () => {
var _a;
const {
prefixCls,
id,
tabs,
locale: locale2,
mobile,
moreIcon = ((_a = slots.moreIcon) === null || _a === void 0 ? void 0 : _a.call(slots)) || createVNode(EllipsisOutlined, null, null),
moreTransitionName,
editable,
tabBarGutter,
rtl: rtl2,
onTabClick,
popupClassName
} = props2;
if (!tabs.length) return null;
const dropdownPrefix = `${prefixCls}-dropdown`;
const dropdownAriaLabel = locale2 === null || locale2 === void 0 ? void 0 : locale2.dropdownAriaLabel;
const moreStyle = {
[rtl2 ? "marginRight" : "marginLeft"]: tabBarGutter
};
if (!tabs.length) {
moreStyle.visibility = "hidden";
moreStyle.order = 1;
}
const overlayClassName = classNames({
[`${dropdownPrefix}-rtl`]: rtl2,
[`${popupClassName}`]: true
});
const moreNode = mobile ? null : createVNode(Dropdown$1, {
"prefixCls": dropdownPrefix,
"trigger": ["hover"],
"visible": open2.value,
"transitionName": moreTransitionName,
"onVisibleChange": setOpen,
"overlayClassName": overlayClassName,
"mouseEnterDelay": 0.1,
"mouseLeaveDelay": 0.1,
"getPopupContainer": props2.getPopupContainer
}, {
overlay: () => createVNode(Menu, {
"onClick": (_ref2) => {
let {
key: key2,
domEvent
} = _ref2;
onTabClick(key2, domEvent);
setOpen(false);
},
"id": popupId.value,
"tabindex": -1,
"role": "listbox",
"aria-activedescendant": selectedItemId.value,
"selectedKeys": [selectedKey.value],
"aria-label": dropdownAriaLabel !== void 0 ? dropdownAriaLabel : "expanded dropdown"
}, {
default: () => [tabs.map((tab) => {
var _a2, _b;
const removable = editable && tab.closable !== false && !tab.disabled;
return createVNode(__nuxt_component_1$5, {
"key": tab.key,
"id": `${popupId.value}-${tab.key}`,
"role": "option",
"aria-controls": id && `${id}-panel-${tab.key}`,
"disabled": tab.disabled
}, {
default: () => [createVNode("span", null, [typeof tab.tab === "function" ? tab.tab() : tab.tab]), removable && createVNode("button", {
"type": "button",
"aria-label": props2.removeAriaLabel || "remove",
"tabindex": 0,
"class": `${dropdownPrefix}-menu-item-remove`,
"onClick": (e) => {
e.stopPropagation();
onRemoveTab(e, tab.key);
}
}, [((_a2 = tab.closeIcon) === null || _a2 === void 0 ? void 0 : _a2.call(tab)) || ((_b = editable.removeIcon) === null || _b === void 0 ? void 0 : _b.call(editable)) || "×"])]
});
})]
}),
default: () => createVNode("button", {
"type": "button",
"class": `${prefixCls}-nav-more`,
"style": moreStyle,
"tabindex": -1,
"aria-hidden": "true",
"aria-haspopup": "listbox",
"aria-controls": popupId.value,
"id": `${id}-more`,
"aria-expanded": open2.value,
"onKeydown": onKeyDown2
}, [moreIcon])
});
return createVNode("div", {
"class": classNames(`${prefixCls}-nav-operations`, attrs.class),
"style": attrs.style
}, [moreNode, createVNode(AddButton, {
"prefixCls": prefixCls,
"locale": locale2,
"editable": editable
}, null)]);
};
}
});
const TabsContextKey = Symbol("tabsContextKey");
const useProvideTabs = (props2) => {
provide(TabsContextKey, props2);
};
const useInjectTabs = () => {
return inject(TabsContextKey, {
tabs: ref([]),
prefixCls: ref()
});
};
defineComponent({
compatConfig: {
MODE: 3
},
name: "TabsContextProvider",
inheritAttrs: false,
props: {
tabs: {
type: Object,
default: void 0
},
prefixCls: {
type: String,
default: void 0
}
},
setup(props2, _ref) {
let {
slots
} = _ref;
useProvideTabs(toRefs(props2));
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const MIN_SWIPE_DISTANCE = 0.1;
const STOP_SWIPE_DISTANCE = 0.01;
const REFRESH_INTERVAL = 20;
const SPEED_OFF_MULTIPLE = Math.pow(0.995, REFRESH_INTERVAL);
function useTouchMove(domRef, onOffset) {
const [touchPosition, setTouchPosition] = useState$1();
const [lastTimestamp, setLastTimestamp] = useState$1(0);
const [lastTimeDiff, setLastTimeDiff] = useState$1(0);
const [lastOffset, setLastOffset] = useState$1();
const motionInterval = ref();
function onTouchStart(e) {
const {
screenX,
screenY
} = e.touches[0];
setTouchPosition({
x: screenX,
y: screenY
});
clearInterval(motionInterval.value);
}
function onTouchMove(e) {
if (!touchPosition.value) return;
e.preventDefault();
const {
screenX,
screenY
} = e.touches[0];
const offsetX = screenX - touchPosition.value.x;
const offsetY = screenY - touchPosition.value.y;
onOffset(offsetX, offsetY);
setTouchPosition({
x: screenX,
y: screenY
});
const now2 = Date.now();
setLastTimeDiff(now2 - lastTimestamp.value);
setLastTimestamp(now2);
setLastOffset({
x: offsetX,
y: offsetY
});
}
function onTouchEnd() {
if (!touchPosition.value) return;
const lastOffsetValue = lastOffset.value;
setTouchPosition(null);
setLastOffset(null);
if (lastOffsetValue) {
const distanceX = lastOffsetValue.x / lastTimeDiff.value;
const distanceY = lastOffsetValue.y / lastTimeDiff.value;
const absX = Math.abs(distanceX);
const absY = Math.abs(distanceY);
if (Math.max(absX, absY) < MIN_SWIPE_DISTANCE) return;
let currentX = distanceX;
let currentY = distanceY;
motionInterval.value = setInterval(() => {
if (Math.abs(currentX) < STOP_SWIPE_DISTANCE && Math.abs(currentY) < STOP_SWIPE_DISTANCE) {
clearInterval(motionInterval.value);
return;
}
currentX *= SPEED_OFF_MULTIPLE;
currentY *= SPEED_OFF_MULTIPLE;
onOffset(currentX * REFRESH_INTERVAL, currentY * REFRESH_INTERVAL);
}, REFRESH_INTERVAL);
}
}
const lastWheelDirectionRef = ref();
function onWheel(e) {
const {
deltaX,
deltaY
} = e;
let mixed = 0;
const absX = Math.abs(deltaX);
const absY = Math.abs(deltaY);
if (absX === absY) {
mixed = lastWheelDirectionRef.value === "x" ? deltaX : deltaY;
} else if (absX > absY) {
mixed = deltaX;
lastWheelDirectionRef.value = "x";
} else {
mixed = deltaY;
lastWheelDirectionRef.value = "y";
}
if (onOffset(-mixed, -mixed)) {
e.preventDefault();
}
}
ref({
onTouchStart,
onTouchMove,
onTouchEnd,
onWheel
});
}
function useSyncState(defaultState, onChange) {
const stateRef = ref(defaultState);
function setState(updater) {
const newValue = typeof updater === "function" ? updater(stateRef.value) : updater;
if (newValue !== stateRef.value) {
onChange(newValue, stateRef.value);
}
stateRef.value = newValue;
}
return [stateRef, setState];
}
const useRefs = () => {
const refs = ref(/* @__PURE__ */ new Map());
const setRef = (key2) => (el) => {
refs.value.set(key2, el);
};
return [setRef, refs];
};
const DEFAULT_SIZE$1 = {
width: 0,
height: 0,
left: 0,
top: 0,
right: 0
};
const tabNavListProps = () => {
return {
id: {
type: String
},
tabPosition: {
type: String
},
activeKey: {
type: [String, Number]
},
rtl: {
type: Boolean
},
animated: objectType(),
editable: objectType(),
moreIcon: PropTypes.any,
moreTransitionName: {
type: String
},
mobile: {
type: Boolean
},
tabBarGutter: {
type: Number
},
renderTabBar: {
type: Function
},
locale: objectType(),
popupClassName: String,
getPopupContainer: functionType(),
onTabClick: {
type: Function
},
onTabScroll: {
type: Function
}
};
};
const getTabSize = (tab, containerRect) => {
const {
offsetWidth,
offsetHeight,
offsetTop,
offsetLeft
} = tab;
const {
width,
height,
x,
y
} = tab.getBoundingClientRect();
if (Math.abs(width - offsetWidth) < 1) {
return [width, height, x - containerRect.x, y - containerRect.y];
}
return [offsetWidth, offsetHeight, offsetLeft, offsetTop];
};
const TabNavList = defineComponent({
compatConfig: {
MODE: 3
},
name: "TabNavList",
inheritAttrs: false,
props: tabNavListProps(),
slots: Object,
emits: ["tabClick", "tabScroll"],
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const {
tabs,
prefixCls
} = useInjectTabs();
const tabsWrapperRef = shallowRef();
const tabListRef = shallowRef();
const operationsRef = shallowRef();
const innerAddButtonRef = shallowRef();
const [setRef, btnRefs] = useRefs();
const tabPositionTopOrBottom = computed(() => props2.tabPosition === "top" || props2.tabPosition === "bottom");
const [transformLeft, setTransformLeft] = useSyncState(0, (next, prev) => {
if (tabPositionTopOrBottom.value && props2.onTabScroll) {
props2.onTabScroll({
direction: next > prev ? "left" : "right"
});
}
});
const [transformTop, setTransformTop] = useSyncState(0, (next, prev) => {
if (!tabPositionTopOrBottom.value && props2.onTabScroll) {
props2.onTabScroll({
direction: next > prev ? "top" : "bottom"
});
}
});
const [wrapperScrollWidth, setWrapperScrollWidth] = useState$1(0);
const [wrapperScrollHeight, setWrapperScrollHeight] = useState$1(0);
const [wrapperWidth, setWrapperWidth] = useState$1(null);
const [wrapperHeight, setWrapperHeight] = useState$1(null);
const [addWidth, setAddWidth] = useState$1(0);
const [addHeight, setAddHeight] = useState$1(0);
const [tabSizes, setTabSizes] = useRafState(/* @__PURE__ */ new Map());
const tabOffsets = useOffsets(tabs, tabSizes);
const operationsHiddenClassName = computed(() => `${prefixCls.value}-nav-operations-hidden`);
const transformMin = shallowRef(0);
const transformMax = shallowRef(0);
watchEffect(() => {
if (!tabPositionTopOrBottom.value) {
transformMin.value = Math.min(0, wrapperHeight.value - wrapperScrollHeight.value);
transformMax.value = 0;
} else if (props2.rtl) {
transformMin.value = 0;
transformMax.value = Math.max(0, wrapperScrollWidth.value - wrapperWidth.value);
} else {
transformMin.value = Math.min(0, wrapperWidth.value - wrapperScrollWidth.value);
transformMax.value = 0;
}
});
const alignInRange = (value) => {
if (value < transformMin.value) {
return transformMin.value;
}
if (value > transformMax.value) {
return transformMax.value;
}
return value;
};
const touchMovingRef = shallowRef();
const [lockAnimation, setLockAnimation] = useState$1();
const doLockAnimation = () => {
setLockAnimation(Date.now());
};
const clearTouchMoving = () => {
clearTimeout(touchMovingRef.value);
};
const doMove = (setState, offset2) => {
setState((value) => {
const newValue = alignInRange(value + offset2);
return newValue;
});
};
useTouchMove(tabsWrapperRef, (offsetX, offsetY) => {
if (tabPositionTopOrBottom.value) {
if (wrapperWidth.value >= wrapperScrollWidth.value) {
return false;
}
doMove(setTransformLeft, offsetX);
} else {
if (wrapperHeight.value >= wrapperScrollHeight.value) {
return false;
}
doMove(setTransformTop, offsetY);
}
clearTouchMoving();
doLockAnimation();
return true;
});
watch(lockAnimation, () => {
clearTouchMoving();
if (lockAnimation.value) {
touchMovingRef.value = setTimeout(() => {
setLockAnimation(0);
}, 100);
}
});
const scrollToTab = function() {
let key2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : props2.activeKey;
const tabOffset = tabOffsets.value.get(key2) || {
width: 0,
height: 0,
left: 0,
right: 0,
top: 0
};
if (tabPositionTopOrBottom.value) {
let newTransform = transformLeft.value;
if (props2.rtl) {
if (tabOffset.right < transformLeft.value) {
newTransform = tabOffset.right;
} else if (tabOffset.right + tabOffset.width > transformLeft.value + wrapperWidth.value) {
newTransform = tabOffset.right + tabOffset.width - wrapperWidth.value;
}
} else if (tabOffset.left < -transformLeft.value) {
newTransform = -tabOffset.left;
} else if (tabOffset.left + tabOffset.width > -transformLeft.value + wrapperWidth.value) {
newTransform = -(tabOffset.left + tabOffset.width - wrapperWidth.value);
}
setTransformTop(0);
setTransformLeft(alignInRange(newTransform));
} else {
let newTransform = transformTop.value;
if (tabOffset.top < -transformTop.value) {
newTransform = -tabOffset.top;
} else if (tabOffset.top + tabOffset.height > -transformTop.value + wrapperHeight.value) {
newTransform = -(tabOffset.top + tabOffset.height - wrapperHeight.value);
}
setTransformLeft(0);
setTransformTop(alignInRange(newTransform));
}
};
const visibleStart = shallowRef(0);
const visibleEnd = shallowRef(0);
watchEffect(() => {
let unit;
let position;
let transformSize;
let basicSize;
let tabContentSize;
let addSize;
const tabOffsetsValue = tabOffsets.value;
if (["top", "bottom"].includes(props2.tabPosition)) {
unit = "width";
basicSize = wrapperWidth.value;
tabContentSize = wrapperScrollWidth.value;
addSize = addWidth.value;
position = props2.rtl ? "right" : "left";
transformSize = Math.abs(transformLeft.value);
} else {
unit = "height";
basicSize = wrapperHeight.value;
tabContentSize = wrapperScrollWidth.value;
addSize = addHeight.value;
position = "top";
transformSize = -transformTop.value;
}
let mergedBasicSize = basicSize;
if (tabContentSize + addSize > basicSize && tabContentSize < basicSize) {
mergedBasicSize = basicSize - addSize;
}
const tabsVal = tabs.value;
if (!tabsVal.length) {
return [visibleStart.value, visibleEnd.value] = [0, 0];
}
const len = tabsVal.length;
let endIndex = len;
for (let i = 0; i < len; i += 1) {
const offset2 = tabOffsetsValue.get(tabsVal[i].key) || DEFAULT_SIZE$1;
if (offset2[position] + offset2[unit] > transformSize + mergedBasicSize) {
endIndex = i - 1;
break;
}
}
let startIndex = 0;
for (let i = len - 1; i >= 0; i -= 1) {
const offset2 = tabOffsetsValue.get(tabsVal[i].key) || DEFAULT_SIZE$1;
if (offset2[position] < transformSize) {
startIndex = i + 1;
break;
}
}
return [visibleStart.value, visibleEnd.value] = [startIndex, endIndex];
});
const updateTabSizes = () => {
setTabSizes(() => {
var _a;
const newSizes = /* @__PURE__ */ new Map();
const listRect = (_a = tabListRef.value) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
tabs.value.forEach((_ref2) => {
let {
key: key2
} = _ref2;
const btnRef = btnRefs.value.get(key2);
const btnNode = (btnRef === null || btnRef === void 0 ? void 0 : btnRef.$el) || btnRef;
if (btnNode) {
const [width, height, left, top] = getTabSize(btnNode, listRect);
newSizes.set(key2, {
width,
height,
left,
top
});
}
});
return newSizes;
});
};
watch(() => tabs.value.map((tab) => tab.key).join("%%"), () => {
updateTabSizes();
}, {
flush: "post"
});
const onListHolderResize = () => {
var _a, _b, _c, _d, _e;
const offsetWidth = ((_a = tabsWrapperRef.value) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0;
const offsetHeight = ((_b = tabsWrapperRef.value) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
const addDom = ((_c = innerAddButtonRef.value) === null || _c === void 0 ? void 0 : _c.$el) || {};
const newAddWidth = addDom.offsetWidth || 0;
const newAddHeight = addDom.offsetHeight || 0;
setWrapperWidth(offsetWidth);
setWrapperHeight(offsetHeight);
setAddWidth(newAddWidth);
setAddHeight(newAddHeight);
const newWrapperScrollWidth = (((_d = tabListRef.value) === null || _d === void 0 ? void 0 : _d.offsetWidth) || 0) - newAddWidth;
const newWrapperScrollHeight = (((_e = tabListRef.value) === null || _e === void 0 ? void 0 : _e.offsetHeight) || 0) - newAddHeight;
setWrapperScrollWidth(newWrapperScrollWidth);
setWrapperScrollHeight(newWrapperScrollHeight);
updateTabSizes();
};
const hiddenTabs = computed(() => [...tabs.value.slice(0, visibleStart.value), ...tabs.value.slice(visibleEnd.value + 1)]);
const [inkStyle, setInkStyle] = useState$1();
const activeTabOffset = computed(() => tabOffsets.value.get(props2.activeKey));
const inkBarRafRef = shallowRef();
const cleanInkBarRaf = () => {
wrapperRaf.cancel(inkBarRafRef.value);
};
watch([activeTabOffset, tabPositionTopOrBottom, () => props2.rtl], () => {
const newInkStyle = {};
if (activeTabOffset.value) {
if (tabPositionTopOrBottom.value) {
if (props2.rtl) {
newInkStyle.right = toPx(activeTabOffset.value.right);
} else {
newInkStyle.left = toPx(activeTabOffset.value.left);
}
newInkStyle.width = toPx(activeTabOffset.value.width);
} else {
newInkStyle.top = toPx(activeTabOffset.value.top);
newInkStyle.height = toPx(activeTabOffset.value.height);
}
}
cleanInkBarRaf();
inkBarRafRef.value = wrapperRaf(() => {
setInkStyle(newInkStyle);
});
});
watch([() => props2.activeKey, activeTabOffset, tabOffsets, tabPositionTopOrBottom], () => {
scrollToTab();
}, {
flush: "post"
});
watch([() => props2.rtl, () => props2.tabBarGutter, () => props2.activeKey, () => tabs.value], () => {
onListHolderResize();
}, {
flush: "post"
});
const ExtraContent = (_ref3) => {
let {
position,
prefixCls: prefixCls2,
extra
} = _ref3;
if (!extra) return null;
const content = extra === null || extra === void 0 ? void 0 : extra({
position
});
return content ? createVNode("div", {
"class": `${prefixCls2}-extra-content`
}, [content]) : null;
};
return () => {
const {
id,
animated,
activeKey,
rtl: rtl2,
editable,
locale: locale2,
tabPosition,
tabBarGutter,
onTabClick
} = props2;
const {
class: className,
style
} = attrs;
const pre = prefixCls.value;
const hasDropdown = !!hiddenTabs.value.length;
const wrapPrefix = `${pre}-nav-wrap`;
let pingLeft;
let pingRight;
let pingTop;
let pingBottom;
if (tabPositionTopOrBottom.value) {
if (rtl2) {
pingRight = transformLeft.value > 0;
pingLeft = transformLeft.value + wrapperWidth.value < wrapperScrollWidth.value;
} else {
pingLeft = transformLeft.value < 0;
pingRight = -transformLeft.value + wrapperWidth.value < wrapperScrollWidth.value;
}
} else {
pingTop = transformTop.value < 0;
pingBottom = -transformTop.value + wrapperHeight.value < wrapperScrollHeight.value;
}
const tabNodeStyle = {};
if (tabPosition === "top" || tabPosition === "bottom") {
tabNodeStyle[rtl2 ? "marginRight" : "marginLeft"] = typeof tabBarGutter === "number" ? `${tabBarGutter}px` : tabBarGutter;
} else {
tabNodeStyle.marginTop = typeof tabBarGutter === "number" ? `${tabBarGutter}px` : tabBarGutter;
}
const tabNodes = tabs.value.map((tab, i) => {
const {
key: key2
} = tab;
return createVNode(TabNode, {
"id": id,
"prefixCls": pre,
"key": key2,
"tab": tab,
"style": i === 0 ? void 0 : tabNodeStyle,
"closable": tab.closable,
"editable": editable,
"active": key2 === activeKey,
"removeAriaLabel": locale2 === null || locale2 === void 0 ? void 0 : locale2.removeAriaLabel,
"ref": setRef(key2),
"onClick": (e) => {
onTabClick(key2, e);
},
"onFocus": () => {
scrollToTab(key2);
doLockAnimation();
if (!tabsWrapperRef.value) {
return;
}
if (!rtl2) {
tabsWrapperRef.value.scrollLeft = 0;
}
tabsWrapperRef.value.scrollTop = 0;
}
}, slots);
});
return createVNode("div", {
"role": "tablist",
"class": classNames(`${pre}-nav`, className),
"style": style,
"onKeydown": () => {
doLockAnimation();
}
}, [createVNode(ExtraContent, {
"position": "left",
"prefixCls": pre,
"extra": slots.leftExtra
}, null), createVNode(ResizeObserver$1, {
"onResize": onListHolderResize
}, {
default: () => [createVNode("div", {
"class": classNames(wrapPrefix, {
[`${wrapPrefix}-ping-left`]: pingLeft,
[`${wrapPrefix}-ping-right`]: pingRight,
[`${wrapPrefix}-ping-top`]: pingTop,
[`${wrapPrefix}-ping-bottom`]: pingBottom
}),
"ref": tabsWrapperRef
}, [createVNode(ResizeObserver$1, {
"onResize": onListHolderResize
}, {
default: () => [createVNode("div", {
"ref": tabListRef,
"class": `${pre}-nav-list`,
"style": {
transform: `translate(${transformLeft.value}px, ${transformTop.value}px)`,
transition: lockAnimation.value ? "none" : void 0
}
}, [tabNodes, createVNode(AddButton, {
"ref": innerAddButtonRef,
"prefixCls": pre,
"locale": locale2,
"editable": editable,
"style": _extends(_extends({}, tabNodes.length === 0 ? void 0 : tabNodeStyle), {
visibility: hasDropdown ? "hidden" : null
})
}, null), createVNode("div", {
"class": classNames(`${pre}-ink-bar`, {
[`${pre}-ink-bar-animated`]: animated.inkBar
}),
"style": inkStyle.value
}, null)])]
})])]
}), createVNode(OperationNode, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"removeAriaLabel": locale2 === null || locale2 === void 0 ? void 0 : locale2.removeAriaLabel,
"ref": operationsRef,
"prefixCls": pre,
"tabs": hiddenTabs.value,
"class": !hasDropdown && operationsHiddenClassName.value
}), pick(slots, ["moreIcon"])), createVNode(ExtraContent, {
"position": "right",
"prefixCls": pre,
"extra": slots.rightExtra
}, null), createVNode(ExtraContent, {
"position": "right",
"prefixCls": pre,
"extra": slots.tabBarExtraContent
}, null)]);
};
}
});
const TabPanelList = defineComponent({
compatConfig: {
MODE: 3
},
name: "TabPanelList",
inheritAttrs: false,
props: {
activeKey: {
type: [String, Number]
},
id: {
type: String
},
rtl: {
type: Boolean
},
animated: {
type: Object,
default: void 0
},
tabPosition: {
type: String
},
destroyInactiveTabPane: {
type: Boolean
}
},
setup(props2) {
const {
tabs,
prefixCls
} = useInjectTabs();
return () => {
const {
id,
activeKey,
animated,
tabPosition,
rtl: rtl2,
destroyInactiveTabPane
} = props2;
const tabPaneAnimated = animated.tabPane;
const pre = prefixCls.value;
const activeIndex = tabs.value.findIndex((tab) => tab.key === activeKey);
return createVNode("div", {
"class": `${pre}-content-holder`
}, [createVNode("div", {
"class": [`${pre}-content`, `${pre}-content-${tabPosition}`, {
[`${pre}-content-animated`]: tabPaneAnimated
}],
"style": activeIndex && tabPaneAnimated ? {
[rtl2 ? "marginRight" : "marginLeft"]: `-${activeIndex}00%`
} : null
}, [tabs.value.map((tab) => {
return cloneElement(tab.node, {
key: tab.key,
prefixCls: pre,
tabKey: tab.key,
id,
animated: tabPaneAnimated,
active: tab.key === activeKey,
destroyInactiveTabPane
});
})])]);
};
}
});
const genMotionStyle$2 = (token) => {
const {
componentCls,
motionDurationSlow
} = token;
return [
{
[componentCls]: {
[`${componentCls}-switch`]: {
"&-appear, &-enter": {
transition: "none",
"&-start": {
opacity: 0
},
"&-active": {
opacity: 1,
transition: `opacity ${motionDurationSlow}`
}
},
"&-leave": {
position: "absolute",
transition: "none",
inset: 0,
"&-start": {
opacity: 1
},
"&-active": {
opacity: 0,
transition: `opacity ${motionDurationSlow}`
}
}
}
}
},
// Follow code may reuse in other components
[initSlideMotion(token, "slide-up"), initSlideMotion(token, "slide-down")]
];
};
const genCardStyle$1 = (token) => {
const {
componentCls,
tabsCardHorizontalPadding,
tabsCardHeadBackground,
tabsCardGutter,
colorSplit
} = token;
return {
[`${componentCls}-card`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
margin: 0,
padding: tabsCardHorizontalPadding,
background: tabsCardHeadBackground,
border: `${token.lineWidth}px ${token.lineType} ${colorSplit}`,
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`
},
[`${componentCls}-tab-active`]: {
color: token.colorPrimary,
background: token.colorBgContainer
},
[`${componentCls}-ink-bar`]: {
visibility: "hidden"
}
},
// ========================== Top & Bottom ==========================
[`&${componentCls}-top, &${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab + ${componentCls}-tab`]: {
marginLeft: {
_skip_check_: true,
value: `${tabsCardGutter}px`
}
}
}
},
[`&${componentCls}-top`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`
},
[`${componentCls}-tab-active`]: {
borderBottomColor: token.colorBgContainer
}
}
},
[`&${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: `0 0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px`
},
[`${componentCls}-tab-active`]: {
borderTopColor: token.colorBgContainer
}
}
},
// ========================== Left & Right ==========================
[`&${componentCls}-left, &${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab + ${componentCls}-tab`]: {
marginTop: `${tabsCardGutter}px`
}
}
},
[`&${componentCls}-left`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `${token.borderRadiusLG}px 0 0 ${token.borderRadiusLG}px`
}
},
[`${componentCls}-tab-active`]: {
borderRightColor: {
_skip_check_: true,
value: token.colorBgContainer
}
}
}
},
[`&${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px 0`
}
},
[`${componentCls}-tab-active`]: {
borderLeftColor: {
_skip_check_: true,
value: token.colorBgContainer
}
}
}
}
}
};
};
const genDropdownStyle = (token) => {
const {
componentCls,
tabsHoverColor,
dropdownEdgeChildVerticalPadding
} = token;
return {
[`${componentCls}-dropdown`]: _extends(_extends({}, resetComponent(token)), {
position: "absolute",
top: -9999,
left: {
_skip_check_: true,
value: -9999
},
zIndex: token.zIndexPopup,
display: "block",
"&-hidden": {
display: "none"
},
[`${componentCls}-dropdown-menu`]: {
maxHeight: token.tabsDropdownHeight,
margin: 0,
padding: `${dropdownEdgeChildVerticalPadding}px 0`,
overflowX: "hidden",
overflowY: "auto",
textAlign: {
_skip_check_: true,
value: "left"
},
listStyleType: "none",
backgroundColor: token.colorBgContainer,
backgroundClip: "padding-box",
borderRadius: token.borderRadiusLG,
outline: "none",
boxShadow: token.boxShadowSecondary,
"&-item": _extends(_extends({}, textEllipsis), {
display: "flex",
alignItems: "center",
minWidth: token.tabsDropdownWidth,
margin: 0,
padding: `${token.paddingXXS}px ${token.paddingSM}px`,
color: token.colorText,
fontWeight: "normal",
fontSize: token.fontSize,
lineHeight: token.lineHeight,
cursor: "pointer",
transition: `all ${token.motionDurationSlow}`,
"> span": {
flex: 1,
whiteSpace: "nowrap"
},
"&-remove": {
flex: "none",
marginLeft: {
_skip_check_: true,
value: token.marginSM
},
color: token.colorTextDescription,
fontSize: token.fontSizeSM,
background: "transparent",
border: 0,
cursor: "pointer",
"&:hover": {
color: tabsHoverColor
}
},
"&:hover": {
background: token.controlItemBgHover
},
"&-disabled": {
"&, &:hover": {
color: token.colorTextDisabled,
background: "transparent",
cursor: "not-allowed"
}
}
})
}
})
};
};
const genPositionStyle = (token) => {
const {
componentCls,
margin,
colorSplit
} = token;
return {
// ========================== Top & Bottom ==========================
[`${componentCls}-top, ${componentCls}-bottom`]: {
flexDirection: "column",
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
margin: `0 0 ${margin}px 0`,
"&::before": {
position: "absolute",
right: {
_skip_check_: true,
value: 0
},
left: {
_skip_check_: true,
value: 0
},
borderBottom: `${token.lineWidth}px ${token.lineType} ${colorSplit}`,
content: "''"
},
[`${componentCls}-ink-bar`]: {
height: token.lineWidthBold,
"&-animated": {
transition: `width ${token.motionDurationSlow}, left ${token.motionDurationSlow},
right ${token.motionDurationSlow}`
}
},
[`${componentCls}-nav-wrap`]: {
"&::before, &::after": {
top: 0,
bottom: 0,
width: token.controlHeight
},
"&::before": {
left: {
_skip_check_: true,
value: 0
},
boxShadow: token.boxShadowTabsOverflowLeft
},
"&::after": {
right: {
_skip_check_: true,
value: 0
},
boxShadow: token.boxShadowTabsOverflowRight
},
[`&${componentCls}-nav-wrap-ping-left::before`]: {
opacity: 1
},
[`&${componentCls}-nav-wrap-ping-right::after`]: {
opacity: 1
}
}
}
},
[`${componentCls}-top`]: {
[`> ${componentCls}-nav,
> div > ${componentCls}-nav`]: {
"&::before": {
bottom: 0
},
[`${componentCls}-ink-bar`]: {
bottom: 0
}
}
},
[`${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
order: 1,
marginTop: `${margin}px`,
marginBottom: 0,
"&::before": {
top: 0
},
[`${componentCls}-ink-bar`]: {
top: 0
}
},
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
order: 0
}
},
// ========================== Left & Right ==========================
[`${componentCls}-left, ${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
flexDirection: "column",
minWidth: token.controlHeight * 1.25,
// >>>>>>>>>>> Tab
[`${componentCls}-tab`]: {
padding: `${token.paddingXS}px ${token.paddingLG}px`,
textAlign: "center"
},
[`${componentCls}-tab + ${componentCls}-tab`]: {
margin: `${token.margin}px 0 0 0`
},
// >>>>>>>>>>> Nav
[`${componentCls}-nav-wrap`]: {
flexDirection: "column",
"&::before, &::after": {
right: {
_skip_check_: true,
value: 0
},
left: {
_skip_check_: true,
value: 0
},
height: token.controlHeight
},
"&::before": {
top: 0,
boxShadow: token.boxShadowTabsOverflowTop
},
"&::after": {
bottom: 0,
boxShadow: token.boxShadowTabsOverflowBottom
},
[`&${componentCls}-nav-wrap-ping-top::before`]: {
opacity: 1
},
[`&${componentCls}-nav-wrap-ping-bottom::after`]: {
opacity: 1
}
},
// >>>>>>>>>>> Ink Bar
[`${componentCls}-ink-bar`]: {
width: token.lineWidthBold,
"&-animated": {
transition: `height ${token.motionDurationSlow}, top ${token.motionDurationSlow}`
}
},
[`${componentCls}-nav-list, ${componentCls}-nav-operations`]: {
flex: "1 0 auto",
flexDirection: "column"
}
}
},
[`${componentCls}-left`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-ink-bar`]: {
right: {
_skip_check_: true,
value: 0
}
}
},
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
marginLeft: {
_skip_check_: true,
value: `-${token.lineWidth}px`
},
borderLeft: {
_skip_check_: true,
value: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`
},
[`> ${componentCls}-content > ${componentCls}-tabpane`]: {
paddingLeft: {
_skip_check_: true,
value: token.paddingLG
}
}
}
},
[`${componentCls}-right`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
order: 1,
[`${componentCls}-ink-bar`]: {
left: {
_skip_check_: true,
value: 0
}
}
},
[`> ${componentCls}-content-holder, > div > ${componentCls}-content-holder`]: {
order: 0,
marginRight: {
_skip_check_: true,
value: -token.lineWidth
},
borderRight: {
_skip_check_: true,
value: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`
},
[`> ${componentCls}-content > ${componentCls}-tabpane`]: {
paddingRight: {
_skip_check_: true,
value: token.paddingLG
}
}
}
}
};
};
const genSizeStyle$1 = (token) => {
const {
componentCls,
padding
} = token;
return {
[componentCls]: {
"&-small": {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: `${token.paddingXS}px 0`,
fontSize: token.fontSize
}
}
},
"&-large": {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: `${padding}px 0`,
fontSize: token.fontSizeLG
}
}
}
},
[`${componentCls}-card`]: {
[`&${componentCls}-small`]: {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: `${token.paddingXXS * 1.5}px ${padding}px`
}
},
[`&${componentCls}-bottom`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
}
},
[`&${componentCls}-top`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
}
},
[`&${componentCls}-right`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `0 ${token.borderRadius}px ${token.borderRadius}px 0`
}
}
},
[`&${componentCls}-left`]: {
[`> ${componentCls}-nav ${componentCls}-tab`]: {
borderRadius: {
_skip_check_: true,
value: `${token.borderRadius}px 0 0 ${token.borderRadius}px`
}
}
}
},
[`&${componentCls}-large`]: {
[`> ${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
padding: `${token.paddingXS}px ${padding}px ${token.paddingXXS * 1.5}px`
}
}
}
}
};
};
const genTabStyle = (token) => {
const {
componentCls,
tabsActiveColor,
tabsHoverColor,
iconCls,
tabsHorizontalGutter
} = token;
const tabCls = `${componentCls}-tab`;
return {
[tabCls]: {
position: "relative",
display: "inline-flex",
alignItems: "center",
padding: `${token.paddingSM}px 0`,
fontSize: `${token.fontSize}px`,
background: "transparent",
border: 0,
outline: "none",
cursor: "pointer",
"&-btn, &-remove": _extends({
"&:focus:not(:focus-visible), &:active": {
color: tabsActiveColor
}
}, genFocusStyle(token)),
"&-btn": {
outline: "none",
transition: "all 0.3s"
},
"&-remove": {
flex: "none",
marginRight: {
_skip_check_: true,
value: -token.marginXXS
},
marginLeft: {
_skip_check_: true,
value: token.marginXS
},
color: token.colorTextDescription,
fontSize: token.fontSizeSM,
background: "transparent",
border: "none",
outline: "none",
cursor: "pointer",
transition: `all ${token.motionDurationSlow}`,
"&:hover": {
color: token.colorTextHeading
}
},
"&:hover": {
color: tabsHoverColor
},
[`&${tabCls}-active ${tabCls}-btn`]: {
color: token.colorPrimary,
textShadow: token.tabsActiveTextShadow
},
[`&${tabCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: "not-allowed"
},
[`&${tabCls}-disabled ${tabCls}-btn, &${tabCls}-disabled ${componentCls}-remove`]: {
"&:focus, &:active": {
color: token.colorTextDisabled
}
},
[`& ${tabCls}-remove ${iconCls}`]: {
margin: 0
},
[iconCls]: {
marginRight: {
_skip_check_: true,
value: token.marginSM
}
}
},
[`${tabCls} + ${tabCls}`]: {
margin: {
_skip_check_: true,
value: `0 0 0 ${tabsHorizontalGutter}px`
}
}
};
};
const genRtlStyle$1 = (token) => {
const {
componentCls,
tabsHorizontalGutter,
iconCls,
tabsCardGutter
} = token;
const rtlCls = `${componentCls}-rtl`;
return {
[rtlCls]: {
direction: "rtl",
[`${componentCls}-nav`]: {
[`${componentCls}-tab`]: {
margin: {
_skip_check_: true,
value: `0 0 0 ${tabsHorizontalGutter}px`
},
[`${componentCls}-tab:last-of-type`]: {
marginLeft: {
_skip_check_: true,
value: 0
}
},
[iconCls]: {
marginRight: {
_skip_check_: true,
value: 0
},
marginLeft: {
_skip_check_: true,
value: `${token.marginSM}px`
}
},
[`${componentCls}-tab-remove`]: {
marginRight: {
_skip_check_: true,
value: `${token.marginXS}px`
},
marginLeft: {
_skip_check_: true,
value: `-${token.marginXXS}px`
},
[iconCls]: {
margin: 0
}
}
}
},
[`&${componentCls}-left`]: {
[`> ${componentCls}-nav`]: {
order: 1
},
[`> ${componentCls}-content-holder`]: {
order: 0
}
},
[`&${componentCls}-right`]: {
[`> ${componentCls}-nav`]: {
order: 0
},
[`> ${componentCls}-content-holder`]: {
order: 1
}
},
// ====================== Card ======================
[`&${componentCls}-card${componentCls}-top, &${componentCls}-card${componentCls}-bottom`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-tab + ${componentCls}-tab`]: {
marginRight: {
_skip_check_: true,
value: `${tabsCardGutter}px`
},
marginLeft: {
_skip_check_: true,
value: 0
}
}
}
}
},
[`${componentCls}-dropdown-rtl`]: {
direction: "rtl"
},
[`${componentCls}-menu-item`]: {
[`${componentCls}-dropdown-rtl`]: {
textAlign: {
_skip_check_: true,
value: "right"
}
}
}
};
};
const genTabsStyle = (token) => {
const {
componentCls,
tabsCardHorizontalPadding,
tabsCardHeight,
tabsCardGutter,
tabsHoverColor,
tabsActiveColor,
colorSplit
} = token;
return {
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
display: "flex",
// ========================== Navigation ==========================
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
position: "relative",
display: "flex",
flex: "none",
alignItems: "center",
[`${componentCls}-nav-wrap`]: {
position: "relative",
display: "flex",
flex: "auto",
alignSelf: "stretch",
overflow: "hidden",
whiteSpace: "nowrap",
transform: "translate(0)",
// >>>>> Ping shadow
"&::before, &::after": {
position: "absolute",
zIndex: 1,
opacity: 0,
transition: `opacity ${token.motionDurationSlow}`,
content: "''",
pointerEvents: "none"
}
},
[`${componentCls}-nav-list`]: {
position: "relative",
display: "flex",
transition: `opacity ${token.motionDurationSlow}`
},
// >>>>>>>> Operations
[`${componentCls}-nav-operations`]: {
display: "flex",
alignSelf: "stretch"
},
[`${componentCls}-nav-operations-hidden`]: {
position: "absolute",
visibility: "hidden",
pointerEvents: "none"
},
[`${componentCls}-nav-more`]: {
position: "relative",
padding: tabsCardHorizontalPadding,
background: "transparent",
border: 0,
"&::after": {
position: "absolute",
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
left: {
_skip_check_: true,
value: 0
},
height: token.controlHeightLG / 8,
transform: "translateY(100%)",
content: "''"
}
},
[`${componentCls}-nav-add`]: _extends({
minWidth: `${tabsCardHeight}px`,
marginLeft: {
_skip_check_: true,
value: `${tabsCardGutter}px`
},
padding: `0 ${token.paddingXS}px`,
background: "transparent",
border: `${token.lineWidth}px ${token.lineType} ${colorSplit}`,
borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`,
outline: "none",
cursor: "pointer",
color: token.colorText,
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOut}`,
"&:hover": {
color: tabsHoverColor
},
"&:active, &:focus:not(:focus-visible)": {
color: tabsActiveColor
}
}, genFocusStyle(token))
},
[`${componentCls}-extra-content`]: {
flex: "none"
},
// ============================ InkBar ============================
[`${componentCls}-ink-bar`]: {
position: "absolute",
background: token.colorPrimary,
pointerEvents: "none"
}
}), genTabStyle(token)), {
// =========================== TabPanes ===========================
[`${componentCls}-content`]: {
position: "relative",
display: "flex",
width: "100%",
["&-animated"]: {
transition: "margin 0.3s"
}
},
[`${componentCls}-content-holder`]: {
flex: "auto",
minWidth: 0,
minHeight: 0
},
[`${componentCls}-tabpane`]: {
outline: "none",
flex: "none",
width: "100%"
}
}),
[`${componentCls}-centered`]: {
[`> ${componentCls}-nav, > div > ${componentCls}-nav`]: {
[`${componentCls}-nav-wrap`]: {
[`&:not([class*='${componentCls}-nav-wrap-ping'])`]: {
justifyContent: "center"
}
}
}
}
};
};
const useStyle$H = genComponentStyleHook("Tabs", (token) => {
const tabsCardHeight = token.controlHeightLG;
const tabsToken = merge(token, {
tabsHoverColor: token.colorPrimaryHover,
tabsActiveColor: token.colorPrimaryActive,
tabsCardHorizontalPadding: `${(tabsCardHeight - Math.round(token.fontSize * token.lineHeight)) / 2 - token.lineWidth}px ${token.padding}px`,
tabsCardHeight,
tabsCardGutter: token.marginXXS / 2,
tabsHorizontalGutter: 32,
tabsCardHeadBackground: token.colorFillAlter,
dropdownEdgeChildVerticalPadding: token.paddingXXS,
tabsActiveTextShadow: "0 0 0.25px currentcolor",
tabsDropdownHeight: 200,
tabsDropdownWidth: 120
});
return [genSizeStyle$1(tabsToken), genRtlStyle$1(tabsToken), genPositionStyle(tabsToken), genDropdownStyle(tabsToken), genCardStyle$1(tabsToken), genTabsStyle(tabsToken), genMotionStyle$2(tabsToken)];
}, (token) => ({
zIndexPopup: token.zIndexPopupBase + 50
}));
const tabsProps = () => {
return {
prefixCls: {
type: String
},
id: {
type: String
},
popupClassName: String,
getPopupContainer: functionType(),
activeKey: {
type: [String, Number]
},
defaultActiveKey: {
type: [String, Number]
},
direction: stringType(),
animated: someType([Boolean, Object]),
renderTabBar: functionType(),
tabBarGutter: {
type: Number
},
tabBarStyle: objectType(),
tabPosition: stringType(),
destroyInactiveTabPane: booleanType(),
hideAdd: Boolean,
type: stringType(),
size: stringType(),
centered: Boolean,
onEdit: functionType(),
onChange: functionType(),
onTabClick: functionType(),
onTabScroll: functionType(),
"onUpdate:activeKey": functionType(),
// Accessibility
locale: objectType(),
onPrevClick: functionType(),
onNextClick: functionType(),
tabBarExtraContent: PropTypes.any
};
};
function parseTabList(children) {
return children.map((node) => {
if (isValidElement(node)) {
const props2 = _extends({}, node.props || {});
for (const [k, v] of Object.entries(props2)) {
delete props2[k];
props2[camelize(k)] = v;
}
const slots = node.children || {};
const key2 = node.key !== void 0 ? node.key : void 0;
const {
tab = slots.tab,
disabled,
forceRender,
closable,
animated,
active,
destroyInactiveTabPane
} = props2;
return _extends(_extends({
key: key2
}, props2), {
node,
closeIcon: slots.closeIcon,
tab,
disabled: disabled === "" || disabled,
forceRender: forceRender === "" || forceRender,
closable: closable === "" || closable,
animated: animated === "" || animated,
active: active === "" || active,
destroyInactiveTabPane: destroyInactiveTabPane === "" || destroyInactiveTabPane
});
}
return null;
}).filter((tab) => tab);
}
const InternalTabs = defineComponent({
compatConfig: {
MODE: 3
},
name: "InternalTabs",
inheritAttrs: false,
props: _extends(_extends({}, initDefaultProps(tabsProps(), {
tabPosition: "top",
animated: {
inkBar: true,
tabPane: false
}
})), {
tabs: arrayType()
}),
slots: Object,
// emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
devWarning(!(props2.onPrevClick !== void 0) && !(props2.onNextClick !== void 0), "Tabs", "`onPrevClick / @prevClick` and `onNextClick / @nextClick` has been removed. Please use `onTabScroll / @tabScroll` instead.");
devWarning(!(props2.tabBarExtraContent !== void 0), "Tabs", "`tabBarExtraContent` prop has been removed. Please use `rightExtra` slot instead.");
devWarning(!(slots.tabBarExtraContent !== void 0), "Tabs", "`tabBarExtraContent` slot is deprecated. Please use `rightExtra` slot instead.");
const {
prefixCls,
direction,
size,
rootPrefixCls,
getPopupContainer
} = useConfigInject("tabs", props2);
const [wrapSSR, hashId] = useStyle$H(prefixCls);
const rtl2 = computed(() => direction.value === "rtl");
const mergedAnimated = computed(() => {
const {
animated,
tabPosition
} = props2;
if (animated === false || ["left", "right"].includes(tabPosition)) {
return {
inkBar: false,
tabPane: false
};
} else if (animated === true) {
return {
inkBar: true,
tabPane: true
};
} else {
return _extends({
inkBar: true,
tabPane: false
}, typeof animated === "object" ? animated : {});
}
});
const [mobile, setMobile] = useState$1(false);
const [mergedActiveKey, setMergedActiveKey] = useMergedState(() => {
var _a;
return (_a = props2.tabs[0]) === null || _a === void 0 ? void 0 : _a.key;
}, {
value: computed(() => props2.activeKey),
defaultValue: props2.defaultActiveKey
});
const [activeIndex, setActiveIndex] = useState$1(() => props2.tabs.findIndex((tab) => tab.key === mergedActiveKey.value));
watchEffect(() => {
var _a;
let newActiveIndex = props2.tabs.findIndex((tab) => tab.key === mergedActiveKey.value);
if (newActiveIndex === -1) {
newActiveIndex = Math.max(0, Math.min(activeIndex.value, props2.tabs.length - 1));
setMergedActiveKey((_a = props2.tabs[newActiveIndex]) === null || _a === void 0 ? void 0 : _a.key);
}
setActiveIndex(newActiveIndex);
});
const [mergedId, setMergedId] = useMergedState(null, {
value: computed(() => props2.id)
});
const mergedTabPosition = computed(() => {
if (mobile.value && !["left", "right"].includes(props2.tabPosition)) {
return "top";
} else {
return props2.tabPosition;
}
});
const onInternalTabClick = (key2, e) => {
var _a, _b;
(_a = props2.onTabClick) === null || _a === void 0 ? void 0 : _a.call(props2, key2, e);
const isActiveChanged = key2 !== mergedActiveKey.value;
setMergedActiveKey(key2);
if (isActiveChanged) {
(_b = props2.onChange) === null || _b === void 0 ? void 0 : _b.call(props2, key2);
}
};
useProvideTabs({
tabs: computed(() => props2.tabs),
prefixCls
});
return () => {
const {
id,
type,
tabBarGutter,
tabBarStyle,
locale: locale2,
destroyInactiveTabPane,
renderTabBar = slots.renderTabBar,
onTabScroll,
hideAdd,
centered
} = props2;
const sharedProps = {
id: mergedId.value,
activeKey: mergedActiveKey.value,
animated: mergedAnimated.value,
tabPosition: mergedTabPosition.value,
rtl: rtl2.value,
mobile: mobile.value
};
let editable;
if (type === "editable-card") {
editable = {
onEdit: (editType, _ref2) => {
let {
key: key2,
event
} = _ref2;
var _a;
(_a = props2.onEdit) === null || _a === void 0 ? void 0 : _a.call(props2, editType === "add" ? event : key2, editType);
},
removeIcon: () => createVNode(CloseOutlined, null, null),
addIcon: slots.addIcon ? slots.addIcon : () => createVNode(PlusOutlined, null, null),
showAdd: hideAdd !== true
};
}
let tabNavBar;
const tabNavBarProps = _extends(_extends({}, sharedProps), {
moreTransitionName: `${rootPrefixCls.value}-slide-up`,
editable,
locale: locale2,
tabBarGutter,
onTabClick: onInternalTabClick,
onTabScroll,
style: tabBarStyle,
getPopupContainer: getPopupContainer.value,
popupClassName: classNames(props2.popupClassName, hashId.value)
});
if (renderTabBar) {
tabNavBar = renderTabBar(_extends(_extends({}, tabNavBarProps), {
DefaultTabBar: TabNavList
}));
} else {
tabNavBar = createVNode(TabNavList, tabNavBarProps, pick(slots, ["moreIcon", "leftExtra", "rightExtra", "tabBarExtraContent"]));
}
const pre = prefixCls.value;
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"id": id,
"class": classNames(pre, `${pre}-${mergedTabPosition.value}`, {
[hashId.value]: true,
[`${pre}-${size.value}`]: size.value,
[`${pre}-card`]: ["card", "editable-card"].includes(type),
[`${pre}-editable-card`]: type === "editable-card",
[`${pre}-centered`]: centered,
[`${pre}-mobile`]: mobile.value,
[`${pre}-editable`]: type === "editable-card",
[`${pre}-rtl`]: rtl2.value
}, attrs.class)
}), [tabNavBar, createVNode(TabPanelList, _objectSpread$W(_objectSpread$W({
"destroyInactiveTabPane": destroyInactiveTabPane
}, sharedProps), {}, {
"animated": mergedAnimated.value
}), null)]));
};
}
});
const Tabs = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATabs",
inheritAttrs: false,
props: initDefaultProps(tabsProps(), {
tabPosition: "top",
animated: {
inkBar: true,
tabPane: false
}
}),
slots: Object,
// emits: ['tabClick', 'tabScroll', 'change', 'update:activeKey'],
setup(props2, _ref3) {
let {
attrs,
slots,
emit
} = _ref3;
const handleChange = (key2) => {
emit("update:activeKey", key2);
emit("change", key2);
};
return () => {
var _a;
const tabs = parseTabList(flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)));
return createVNode(InternalTabs, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, omit(props2, ["onUpdate:activeKey"])), attrs), {}, {
"onChange": handleChange,
"tabs": tabs
}), slots);
};
}
});
const tabPaneProps = () => ({
tab: PropTypes.any,
disabled: {
type: Boolean
},
forceRender: {
type: Boolean
},
closable: {
type: Boolean
},
animated: {
type: Boolean
},
active: {
type: Boolean
},
destroyInactiveTabPane: {
type: Boolean
},
// Pass by TabPaneList
prefixCls: {
type: String
},
tabKey: {
type: [String, Number]
},
id: {
type: String
}
// closeIcon: PropTypes.any,
});
const __nuxt_component_2$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATabPane",
inheritAttrs: false,
__ANT_TAB_PANE: true,
props: tabPaneProps(),
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const visited = ref(props2.forceRender);
watch([() => props2.active, () => props2.destroyInactiveTabPane], () => {
if (props2.active) {
visited.value = true;
} else if (props2.destroyInactiveTabPane) {
visited.value = false;
}
}, {
immediate: true
});
const mergedStyle = computed(() => {
if (!props2.active) {
if (props2.animated) {
return {
visibility: "hidden",
height: 0,
overflowY: "hidden"
};
} else {
return {
display: "none"
};
}
}
return {};
});
return () => {
var _a;
const {
prefixCls,
forceRender,
id,
active,
tabKey
} = props2;
return createVNode("div", {
"id": id && `${id}-panel-${tabKey}`,
"role": "tabpanel",
"tabindex": active ? 0 : -1,
"aria-labelledby": id && `${id}-tab-${tabKey}`,
"aria-hidden": !active,
"style": [mergedStyle.value, attrs.style],
"class": [`${prefixCls}-tabpane`, active && `${prefixCls}-tabpane-active`, attrs.class]
}, [(active || visited.value || forceRender) && ((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))]);
};
}
});
Tabs.TabPane = __nuxt_component_2$2;
Tabs.install = function(app) {
app.component(Tabs.name, Tabs);
app.component(__nuxt_component_2$2.name, __nuxt_component_2$2);
return app;
};
const genCardHeadStyle = (token) => {
const {
antCls,
componentCls,
cardHeadHeight,
cardPaddingBase,
cardHeadTabsMarginBottom
} = token;
return _extends(_extends({
display: "flex",
justifyContent: "center",
flexDirection: "column",
minHeight: cardHeadHeight,
marginBottom: -1,
padding: `0 ${cardPaddingBase}px`,
color: token.colorTextHeading,
fontWeight: token.fontWeightStrong,
fontSize: token.fontSizeLG,
background: "transparent",
borderBottom: `${token.lineWidth}px ${token.lineType} ${token.colorBorderSecondary}`,
borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`
}, clearFix()), {
"&-wrapper": {
width: "100%",
display: "flex",
alignItems: "center"
},
"&-title": _extends(_extends({
display: "inline-block",
flex: 1
}, textEllipsis), {
[`
> ${componentCls}-typography,
> ${componentCls}-typography-edit-content
`]: {
insetInlineStart: 0,
marginTop: 0,
marginBottom: 0
}
}),
[`${antCls}-tabs-top`]: {
clear: "both",
marginBottom: cardHeadTabsMarginBottom,
color: token.colorText,
fontWeight: "normal",
fontSize: token.fontSize,
"&-bar": {
borderBottom: `${token.lineWidth}px ${token.lineType} ${token.colorBorderSecondary}`
}
}
});
};
const genCardGridStyle = (token) => {
const {
cardPaddingBase,
colorBorderSecondary,
cardShadow,
lineWidth
} = token;
return {
width: "33.33%",
padding: cardPaddingBase,
border: 0,
borderRadius: 0,
boxShadow: `
${lineWidth}px 0 0 0 ${colorBorderSecondary},
0 ${lineWidth}px 0 0 ${colorBorderSecondary},
${lineWidth}px ${lineWidth}px 0 0 ${colorBorderSecondary},
${lineWidth}px 0 0 0 ${colorBorderSecondary} inset,
0 ${lineWidth}px 0 0 ${colorBorderSecondary} inset;
`,
transition: `all ${token.motionDurationMid}`,
"&-hoverable:hover": {
position: "relative",
zIndex: 1,
boxShadow: cardShadow
}
};
};
const genCardActionsStyle = (token) => {
const {
componentCls,
iconCls,
cardActionsLiMargin,
cardActionsIconSize,
colorBorderSecondary
} = token;
return _extends(_extends({
margin: 0,
padding: 0,
listStyle: "none",
background: token.colorBgContainer,
borderTop: `${token.lineWidth}px ${token.lineType} ${colorBorderSecondary}`,
display: "flex",
borderRadius: `0 0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px `
}, clearFix()), {
"& > li": {
margin: cardActionsLiMargin,
color: token.colorTextDescription,
textAlign: "center",
"> span": {
position: "relative",
display: "block",
minWidth: token.cardActionsIconSize * 2,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
cursor: "pointer",
"&:hover": {
color: token.colorPrimary,
transition: `color ${token.motionDurationMid}`
},
[`a:not(${componentCls}-btn), > ${iconCls}`]: {
display: "inline-block",
width: "100%",
color: token.colorTextDescription,
lineHeight: `${token.fontSize * token.lineHeight}px`,
transition: `color ${token.motionDurationMid}`,
"&:hover": {
color: token.colorPrimary
}
},
[`> ${iconCls}`]: {
fontSize: cardActionsIconSize,
lineHeight: `${cardActionsIconSize * token.lineHeight}px`
}
},
"&:not(:last-child)": {
borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${colorBorderSecondary}`
}
}
});
};
const genCardMetaStyle = (token) => _extends(_extends({
margin: `-${token.marginXXS}px 0`,
display: "flex"
}, clearFix()), {
"&-avatar": {
paddingInlineEnd: token.padding
},
"&-detail": {
overflow: "hidden",
flex: 1,
"> div:not(:last-child)": {
marginBottom: token.marginXS
}
},
"&-title": _extends({
color: token.colorTextHeading,
fontWeight: token.fontWeightStrong,
fontSize: token.fontSizeLG
}, textEllipsis),
"&-description": {
color: token.colorTextDescription
}
});
const genCardTypeInnerStyle = (token) => {
const {
componentCls,
cardPaddingBase,
colorFillAlter
} = token;
return {
[`${componentCls}-head`]: {
padding: `0 ${cardPaddingBase}px`,
background: colorFillAlter,
"&-title": {
fontSize: token.fontSize
}
},
[`${componentCls}-body`]: {
padding: `${token.padding}px ${cardPaddingBase}px`
}
};
};
const genCardLoadingStyle = (token) => {
const {
componentCls
} = token;
return {
overflow: "hidden",
[`${componentCls}-body`]: {
userSelect: "none"
}
};
};
const genCardStyle = (token) => {
const {
componentCls,
cardShadow,
cardHeadPadding,
colorBorderSecondary,
boxShadow,
cardPaddingBase
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
background: token.colorBgContainer,
borderRadius: token.borderRadiusLG,
[`&:not(${componentCls}-bordered)`]: {
boxShadow
},
[`${componentCls}-head`]: genCardHeadStyle(token),
[`${componentCls}-extra`]: {
// https://stackoverflow.com/a/22429853/3040605
marginInlineStart: "auto",
color: "",
fontWeight: "normal",
fontSize: token.fontSize
},
[`${componentCls}-body`]: _extends({
padding: cardPaddingBase,
borderRadius: ` 0 0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px`
}, clearFix()),
[`${componentCls}-grid`]: genCardGridStyle(token),
[`${componentCls}-cover`]: {
"> *": {
display: "block",
width: "100%"
},
img: {
borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`
}
},
[`${componentCls}-actions`]: genCardActionsStyle(token),
[`${componentCls}-meta`]: genCardMetaStyle(token)
}),
[`${componentCls}-bordered`]: {
border: `${token.lineWidth}px ${token.lineType} ${colorBorderSecondary}`,
[`${componentCls}-cover`]: {
marginTop: -1,
marginInlineStart: -1,
marginInlineEnd: -1
}
},
[`${componentCls}-hoverable`]: {
cursor: "pointer",
transition: `box-shadow ${token.motionDurationMid}, border-color ${token.motionDurationMid}`,
"&:hover": {
borderColor: "transparent",
boxShadow: cardShadow
}
},
[`${componentCls}-contain-grid`]: {
[`${componentCls}-body`]: {
display: "flex",
flexWrap: "wrap"
},
[`&:not(${componentCls}-loading) ${componentCls}-body`]: {
marginBlockStart: -token.lineWidth,
marginInlineStart: -token.lineWidth,
padding: 0
}
},
[`${componentCls}-contain-tabs`]: {
[`> ${componentCls}-head`]: {
[`${componentCls}-head-title, ${componentCls}-extra`]: {
paddingTop: cardHeadPadding
}
}
},
[`${componentCls}-type-inner`]: genCardTypeInnerStyle(token),
[`${componentCls}-loading`]: genCardLoadingStyle(token),
[`${componentCls}-rtl`]: {
direction: "rtl"
}
};
};
const genCardSizeStyle = (token) => {
const {
componentCls,
cardPaddingSM,
cardHeadHeightSM
} = token;
return {
[`${componentCls}-small`]: {
[`> ${componentCls}-head`]: {
minHeight: cardHeadHeightSM,
padding: `0 ${cardPaddingSM}px`,
fontSize: token.fontSize,
[`> ${componentCls}-head-wrapper`]: {
[`> ${componentCls}-extra`]: {
fontSize: token.fontSize
}
}
},
[`> ${componentCls}-body`]: {
padding: cardPaddingSM
}
},
[`${componentCls}-small${componentCls}-contain-tabs`]: {
[`> ${componentCls}-head`]: {
[`${componentCls}-head-title, ${componentCls}-extra`]: {
minHeight: cardHeadHeightSM,
paddingTop: 0,
display: "flex",
alignItems: "center"
}
}
}
};
};
const useStyle$G = genComponentStyleHook("Card", (token) => {
const cardToken = merge(token, {
cardShadow: token.boxShadowCard,
cardHeadHeight: token.fontSizeLG * token.lineHeightLG + token.padding * 2,
cardHeadHeightSM: token.fontSize * token.lineHeight + token.paddingXS * 2,
cardHeadPadding: token.padding,
cardPaddingBase: token.paddingLG,
cardHeadTabsMarginBottom: -token.padding - token.lineWidth,
cardActionsLiMargin: `${token.paddingSM}px 0`,
cardActionsIconSize: token.fontSize,
cardPaddingSM: 12
// Fixed padding.
});
return [
// Style
genCardStyle(cardToken),
// Size
genCardSizeStyle(cardToken)
];
});
const skeletonTitleProps = () => ({
prefixCls: String,
width: {
type: [Number, String]
}
});
const SkeletonTitle = defineComponent({
compatConfig: {
MODE: 3
},
name: "SkeletonTitle",
props: skeletonTitleProps(),
setup(props2) {
return () => {
const {
prefixCls,
width
} = props2;
const zWidth = typeof width === "number" ? `${width}px` : width;
return createVNode("h3", {
"class": prefixCls,
"style": {
width: zWidth
}
}, null);
};
}
});
const skeletonParagraphProps = () => ({
prefixCls: String,
width: {
type: [Number, String, Array]
},
rows: Number
});
const SkeletonParagraph = defineComponent({
compatConfig: {
MODE: 3
},
name: "SkeletonParagraph",
props: skeletonParagraphProps(),
setup(props2) {
const getWidth2 = (index2) => {
const {
width,
rows = 2
} = props2;
if (Array.isArray(width)) {
return width[index2];
}
if (rows - 1 === index2) {
return width;
}
return void 0;
};
return () => {
const {
prefixCls,
rows
} = props2;
const rowList = [...Array(rows)].map((_, index2) => {
const width = getWidth2(index2);
return createVNode("li", {
"key": index2,
"style": {
width: typeof width === "number" ? `${width}px` : width
}
}, null);
});
return createVNode("ul", {
"class": prefixCls
}, [rowList]);
};
}
});
const skeletonElementProps = () => ({
prefixCls: String,
size: [String, Number],
shape: String,
active: {
type: Boolean,
default: void 0
}
});
const Element = (props2) => {
const {
prefixCls,
size,
shape
} = props2;
const sizeCls = classNames({
[`${prefixCls}-lg`]: size === "large",
[`${prefixCls}-sm`]: size === "small"
});
const shapeCls = classNames({
[`${prefixCls}-circle`]: shape === "circle",
[`${prefixCls}-square`]: shape === "square",
[`${prefixCls}-round`]: shape === "round"
});
const sizeStyle = typeof size === "number" ? {
width: `${size}px`,
height: `${size}px`,
lineHeight: `${size}px`
} : {};
return createVNode("span", {
"class": classNames(prefixCls, sizeCls, shapeCls),
"style": sizeStyle
}, null);
};
Element.displayName = "SkeletonElement";
const skeletonClsLoading = new Keyframe(`ant-skeleton-loading`, {
"0%": {
transform: "translateX(-37.5%)"
},
"100%": {
transform: "translateX(37.5%)"
}
});
const genSkeletonElementCommonSize = (size) => ({
height: size,
lineHeight: `${size}px`
});
const genSkeletonElementAvatarSize = (size) => _extends({
width: size
}, genSkeletonElementCommonSize(size));
const genSkeletonColor = (token) => ({
position: "relative",
// fix https://github.com/ant-design/ant-design/issues/36444
// https://monshin.github.io/202109/css/safari-border-radius-overflow-hidden/
/* stylelint-disable-next-line property-no-vendor-prefix,value-no-vendor-prefix */
zIndex: 0,
overflow: "hidden",
background: "transparent",
"&::after": {
position: "absolute",
top: 0,
insetInlineEnd: "-150%",
bottom: 0,
insetInlineStart: "-150%",
background: token.skeletonLoadingBackground,
animationName: skeletonClsLoading,
animationDuration: token.skeletonLoadingMotionDuration,
animationTimingFunction: "ease",
animationIterationCount: "infinite",
content: '""'
}
});
const genSkeletonElementInputSize = (size) => _extends({
width: size * 5,
minWidth: size * 5
}, genSkeletonElementCommonSize(size));
const genSkeletonElementAvatar = (token) => {
const {
skeletonAvatarCls,
color,
controlHeight,
controlHeightLG,
controlHeightSM
} = token;
return {
[`${skeletonAvatarCls}`]: _extends({
display: "inline-block",
verticalAlign: "top",
background: color
}, genSkeletonElementAvatarSize(controlHeight)),
[`${skeletonAvatarCls}${skeletonAvatarCls}-circle`]: {
borderRadius: "50%"
},
[`${skeletonAvatarCls}${skeletonAvatarCls}-lg`]: _extends({}, genSkeletonElementAvatarSize(controlHeightLG)),
[`${skeletonAvatarCls}${skeletonAvatarCls}-sm`]: _extends({}, genSkeletonElementAvatarSize(controlHeightSM))
};
};
const genSkeletonElementInput = (token) => {
const {
controlHeight,
borderRadiusSM,
skeletonInputCls,
controlHeightLG,
controlHeightSM,
color
} = token;
return {
[`${skeletonInputCls}`]: _extends({
display: "inline-block",
verticalAlign: "top",
background: color,
borderRadius: borderRadiusSM
}, genSkeletonElementInputSize(controlHeight)),
[`${skeletonInputCls}-lg`]: _extends({}, genSkeletonElementInputSize(controlHeightLG)),
[`${skeletonInputCls}-sm`]: _extends({}, genSkeletonElementInputSize(controlHeightSM))
};
};
const genSkeletonElementImageSize = (size) => _extends({
width: size
}, genSkeletonElementCommonSize(size));
const genSkeletonElementImage = (token) => {
const {
skeletonImageCls,
imageSizeBase,
color,
borderRadiusSM
} = token;
return {
[`${skeletonImageCls}`]: _extends(_extends({
display: "flex",
alignItems: "center",
justifyContent: "center",
verticalAlign: "top",
background: color,
borderRadius: borderRadiusSM
}, genSkeletonElementImageSize(imageSizeBase * 2)), {
[`${skeletonImageCls}-path`]: {
fill: "#bfbfbf"
},
[`${skeletonImageCls}-svg`]: _extends(_extends({}, genSkeletonElementImageSize(imageSizeBase)), {
maxWidth: imageSizeBase * 4,
maxHeight: imageSizeBase * 4
}),
[`${skeletonImageCls}-svg${skeletonImageCls}-svg-circle`]: {
borderRadius: "50%"
}
}),
[`${skeletonImageCls}${skeletonImageCls}-circle`]: {
borderRadius: "50%"
}
};
};
const genSkeletonElementButtonShape = (token, size, buttonCls) => {
const {
skeletonButtonCls
} = token;
return {
[`${buttonCls}${skeletonButtonCls}-circle`]: {
width: size,
minWidth: size,
borderRadius: "50%"
},
[`${buttonCls}${skeletonButtonCls}-round`]: {
borderRadius: size
}
};
};
const genSkeletonElementButtonSize = (size) => _extends({
width: size * 2,
minWidth: size * 2
}, genSkeletonElementCommonSize(size));
const genSkeletonElementButton = (token) => {
const {
borderRadiusSM,
skeletonButtonCls,
controlHeight,
controlHeightLG,
controlHeightSM,
color
} = token;
return _extends(_extends(_extends(_extends(_extends({
[`${skeletonButtonCls}`]: _extends({
display: "inline-block",
verticalAlign: "top",
background: color,
borderRadius: borderRadiusSM,
width: controlHeight * 2,
minWidth: controlHeight * 2
}, genSkeletonElementButtonSize(controlHeight))
}, genSkeletonElementButtonShape(token, controlHeight, skeletonButtonCls)), {
[`${skeletonButtonCls}-lg`]: _extends({}, genSkeletonElementButtonSize(controlHeightLG))
}), genSkeletonElementButtonShape(token, controlHeightLG, `${skeletonButtonCls}-lg`)), {
[`${skeletonButtonCls}-sm`]: _extends({}, genSkeletonElementButtonSize(controlHeightSM))
}), genSkeletonElementButtonShape(token, controlHeightSM, `${skeletonButtonCls}-sm`));
};
const genBaseStyle$e = (token) => {
const {
componentCls,
skeletonAvatarCls,
skeletonTitleCls,
skeletonParagraphCls,
skeletonButtonCls,
skeletonInputCls,
skeletonImageCls,
controlHeight,
controlHeightLG,
controlHeightSM,
color,
padding,
marginSM,
borderRadius,
skeletonTitleHeight,
skeletonBlockRadius,
skeletonParagraphLineHeight,
controlHeightXS,
skeletonParagraphMarginTop
} = token;
return {
[`${componentCls}`]: {
display: "table",
width: "100%",
[`${componentCls}-header`]: {
display: "table-cell",
paddingInlineEnd: padding,
verticalAlign: "top",
// Avatar
[`${skeletonAvatarCls}`]: _extends({
display: "inline-block",
verticalAlign: "top",
background: color
}, genSkeletonElementAvatarSize(controlHeight)),
[`${skeletonAvatarCls}-circle`]: {
borderRadius: "50%"
},
[`${skeletonAvatarCls}-lg`]: _extends({}, genSkeletonElementAvatarSize(controlHeightLG)),
[`${skeletonAvatarCls}-sm`]: _extends({}, genSkeletonElementAvatarSize(controlHeightSM))
},
[`${componentCls}-content`]: {
display: "table-cell",
width: "100%",
verticalAlign: "top",
// Title
[`${skeletonTitleCls}`]: {
width: "100%",
height: skeletonTitleHeight,
background: color,
borderRadius: skeletonBlockRadius,
[`+ ${skeletonParagraphCls}`]: {
marginBlockStart: controlHeightSM
}
},
// paragraph
[`${skeletonParagraphCls}`]: {
padding: 0,
"> li": {
width: "100%",
height: skeletonParagraphLineHeight,
listStyle: "none",
background: color,
borderRadius: skeletonBlockRadius,
"+ li": {
marginBlockStart: controlHeightXS
}
}
},
[`${skeletonParagraphCls}> li:last-child:not(:first-child):not(:nth-child(2))`]: {
width: "61%"
}
},
[`&-round ${componentCls}-content`]: {
[`${skeletonTitleCls}, ${skeletonParagraphCls} > li`]: {
borderRadius
}
}
},
[`${componentCls}-with-avatar ${componentCls}-content`]: {
// Title
[`${skeletonTitleCls}`]: {
marginBlockStart: marginSM,
[`+ ${skeletonParagraphCls}`]: {
marginBlockStart: skeletonParagraphMarginTop
}
}
},
// Skeleton element
[`${componentCls}${componentCls}-element`]: _extends(_extends(_extends(_extends({
display: "inline-block",
width: "auto"
}, genSkeletonElementButton(token)), genSkeletonElementAvatar(token)), genSkeletonElementInput(token)), genSkeletonElementImage(token)),
// Skeleton Block Button, Input
[`${componentCls}${componentCls}-block`]: {
width: "100%",
[`${skeletonButtonCls}`]: {
width: "100%"
},
[`${skeletonInputCls}`]: {
width: "100%"
}
},
// With active animation
[`${componentCls}${componentCls}-active`]: {
[`
${skeletonTitleCls},
${skeletonParagraphCls} > li,
${skeletonAvatarCls},
${skeletonButtonCls},
${skeletonInputCls},
${skeletonImageCls}
`]: _extends({}, genSkeletonColor(token))
}
};
};
const useStyle$F = genComponentStyleHook("Skeleton", (token) => {
const {
componentCls
} = token;
const skeletonToken = merge(token, {
skeletonAvatarCls: `${componentCls}-avatar`,
skeletonTitleCls: `${componentCls}-title`,
skeletonParagraphCls: `${componentCls}-paragraph`,
skeletonButtonCls: `${componentCls}-button`,
skeletonInputCls: `${componentCls}-input`,
skeletonImageCls: `${componentCls}-image`,
imageSizeBase: token.controlHeight * 1.5,
skeletonTitleHeight: token.controlHeight / 2,
skeletonBlockRadius: token.borderRadiusSM,
skeletonParagraphLineHeight: token.controlHeight / 2,
skeletonParagraphMarginTop: token.marginLG + token.marginXXS,
borderRadius: 100,
skeletonLoadingBackground: `linear-gradient(90deg, ${token.color} 25%, ${token.colorGradientEnd} 37%, ${token.color} 63%)`,
skeletonLoadingMotionDuration: "1.4s"
});
return [genBaseStyle$e(skeletonToken)];
}, (token) => {
const {
colorFillContent,
colorFill
} = token;
return {
color: colorFillContent,
colorGradientEnd: colorFill
};
});
const skeletonProps = () => ({
active: {
type: Boolean,
default: void 0
},
loading: {
type: Boolean,
default: void 0
},
prefixCls: String,
avatar: {
type: [Boolean, Object],
default: void 0
},
title: {
type: [Boolean, Object],
default: void 0
},
paragraph: {
type: [Boolean, Object],
default: void 0
},
round: {
type: Boolean,
default: void 0
}
});
function getComponentProps(prop) {
if (prop && typeof prop === "object") {
return prop;
}
return {};
}
function getAvatarBasicProps(hasTitle, hasParagraph) {
if (hasTitle && !hasParagraph) {
return {
size: "large",
shape: "square"
};
}
return {
size: "large",
shape: "circle"
};
}
function getTitleBasicProps(hasAvatar, hasParagraph) {
if (!hasAvatar && hasParagraph) {
return {
width: "38%"
};
}
if (hasAvatar && hasParagraph) {
return {
width: "50%"
};
}
return {};
}
function getParagraphBasicProps(hasAvatar, hasTitle) {
const basicProps2 = {};
if (!hasAvatar || !hasTitle) {
basicProps2.width = "61%";
}
if (!hasAvatar && hasTitle) {
basicProps2.rows = 3;
} else {
basicProps2.rows = 2;
}
return basicProps2;
}
const Skeleton = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASkeleton",
props: initDefaultProps(skeletonProps(), {
avatar: false,
title: true,
paragraph: true
}),
setup(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("skeleton", props2);
const [wrapSSR, hashId] = useStyle$F(prefixCls);
return () => {
var _a;
const {
loading: loading2,
avatar,
title,
paragraph,
active,
round
} = props2;
const pre = prefixCls.value;
if (loading2 || props2.loading === void 0) {
const hasAvatar = !!avatar || avatar === "";
const hasTitle = !!title || title === "";
const hasParagraph = !!paragraph || paragraph === "";
let avatarNode;
if (hasAvatar) {
const avatarProps2 = _extends(_extends({
prefixCls: `${pre}-avatar`
}, getAvatarBasicProps(hasTitle, hasParagraph)), getComponentProps(avatar));
avatarNode = createVNode("div", {
"class": `${pre}-header`
}, [createVNode(Element, avatarProps2, null)]);
}
let contentNode;
if (hasTitle || hasParagraph) {
let $title;
if (hasTitle) {
const titleProps2 = _extends(_extends({
prefixCls: `${pre}-title`
}, getTitleBasicProps(hasAvatar, hasParagraph)), getComponentProps(title));
$title = createVNode(SkeletonTitle, titleProps2, null);
}
let paragraphNode;
if (hasParagraph) {
const paragraphProps2 = _extends(_extends({
prefixCls: `${pre}-paragraph`
}, getParagraphBasicProps(hasAvatar, hasTitle)), getComponentProps(paragraph));
paragraphNode = createVNode(SkeletonParagraph, paragraphProps2, null);
}
contentNode = createVNode("div", {
"class": `${pre}-content`
}, [$title, paragraphNode]);
}
const cls = classNames(pre, {
[`${pre}-with-avatar`]: hasAvatar,
[`${pre}-active`]: active,
[`${pre}-rtl`]: direction.value === "rtl",
[`${pre}-round`]: round,
[hashId.value]: true
});
return wrapSSR(createVNode("div", {
"class": cls
}, [avatarNode, contentNode]));
}
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const skeletonButtonProps = () => {
return _extends(_extends({}, skeletonElementProps()), {
size: String,
block: Boolean
});
};
const SkeletonButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASkeletonButton",
props: initDefaultProps(skeletonButtonProps(), {
size: "default"
}),
setup(props2) {
const {
prefixCls
} = useConfigInject("skeleton", props2);
const [wrapSSR, hashId] = useStyle$F(prefixCls);
const cls = computed(() => classNames(prefixCls.value, `${prefixCls.value}-element`, {
[`${prefixCls.value}-active`]: props2.active,
[`${prefixCls.value}-block`]: props2.block
}, hashId.value));
return () => {
return wrapSSR(createVNode("div", {
"class": cls.value
}, [createVNode(Element, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": `${prefixCls.value}-button`
}), null)]));
};
}
});
const SkeletonInput = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASkeletonInput",
props: _extends(_extends({}, omit(skeletonElementProps(), ["shape"])), {
size: String,
block: Boolean
}),
setup(props2) {
const {
prefixCls
} = useConfigInject("skeleton", props2);
const [wrapSSR, hashId] = useStyle$F(prefixCls);
const cls = computed(() => classNames(prefixCls.value, `${prefixCls.value}-element`, {
[`${prefixCls.value}-active`]: props2.active,
[`${prefixCls.value}-block`]: props2.block
}, hashId.value));
return () => {
return wrapSSR(createVNode("div", {
"class": cls.value
}, [createVNode(Element, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": `${prefixCls.value}-input`
}), null)]));
};
}
});
const path = "M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z";
const SkeletonImage = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASkeletonImage",
props: omit(skeletonElementProps(), ["size", "shape", "active"]),
setup(props2) {
const {
prefixCls
} = useConfigInject("skeleton", props2);
const [wrapSSR, hashId] = useStyle$F(prefixCls);
const cls = computed(() => classNames(prefixCls.value, `${prefixCls.value}-element`, hashId.value));
return () => {
return wrapSSR(createVNode("div", {
"class": cls.value
}, [createVNode("div", {
"class": `${prefixCls.value}-image`
}, [createVNode("svg", {
"viewBox": "0 0 1098 1024",
"xmlns": "http://www.w3.org/2000/svg",
"class": `${prefixCls.value}-image-svg`
}, [createVNode("path", {
"d": path,
"class": `${prefixCls.value}-image-path`
}, null)])])]));
};
}
});
const avatarProps = () => {
return _extends(_extends({}, skeletonElementProps()), {
shape: String
});
};
const SkeletonAvatar = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASkeletonAvatar",
props: initDefaultProps(avatarProps(), {
size: "default",
shape: "circle"
}),
setup(props2) {
const {
prefixCls
} = useConfigInject("skeleton", props2);
const [wrapSSR, hashId] = useStyle$F(prefixCls);
const cls = computed(() => classNames(prefixCls.value, `${prefixCls.value}-element`, {
[`${prefixCls.value}-active`]: props2.active
}, hashId.value));
return () => {
return wrapSSR(createVNode("div", {
"class": cls.value
}, [createVNode(Element, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": `${prefixCls.value}-avatar`
}), null)]));
};
}
});
Skeleton.Button = SkeletonButton;
Skeleton.Avatar = SkeletonAvatar;
Skeleton.Input = SkeletonInput;
Skeleton.Image = SkeletonImage;
Skeleton.Title = SkeletonTitle;
Skeleton.install = function(app) {
app.component(Skeleton.name, Skeleton);
app.component(Skeleton.Button.name, SkeletonButton);
app.component(Skeleton.Avatar.name, SkeletonAvatar);
app.component(Skeleton.Input.name, SkeletonInput);
app.component(Skeleton.Image.name, SkeletonImage);
app.component(Skeleton.Title.name, SkeletonTitle);
return app;
};
const {
TabPane
} = Tabs;
const cardProps = () => ({
prefixCls: String,
title: PropTypes.any,
extra: PropTypes.any,
bordered: {
type: Boolean,
default: true
},
bodyStyle: {
type: Object,
default: void 0
},
headStyle: {
type: Object,
default: void 0
},
loading: {
type: Boolean,
default: false
},
hoverable: {
type: Boolean,
default: false
},
type: {
type: String
},
size: {
type: String
},
actions: PropTypes.any,
tabList: {
type: Array
},
tabBarExtraContent: PropTypes.any,
activeTabKey: String,
defaultActiveTabKey: String,
cover: PropTypes.any,
onTabChange: {
type: Function
}
});
const Card = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACard",
inheritAttrs: false,
props: cardProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction,
size
} = useConfigInject("card", props2);
const [wrapSSR, hashId] = useStyle$G(prefixCls);
const getAction = (actions) => {
const actionList = actions.map((action, index2) => isVNode(action) && !isEmptyElement(action) || !isVNode(action) ? createVNode("li", {
"style": {
width: `${100 / actions.length}%`
},
"key": `action-${index2}`
}, [createVNode("span", null, [action])]) : null);
return actionList;
};
const triggerTabChange = (key2) => {
var _a;
(_a = props2.onTabChange) === null || _a === void 0 ? void 0 : _a.call(props2, key2);
};
const isContainGrid = function() {
let obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
let containGrid;
obj.forEach((element) => {
if (element && isPlainObject(element.type) && element.type.__ANT_CARD_GRID) {
containGrid = true;
}
});
return containGrid;
};
return () => {
var _a, _b, _c, _d, _e, _f;
const {
headStyle = {},
bodyStyle = {},
loading: loading2,
bordered = true,
type,
tabList,
hoverable,
activeTabKey,
defaultActiveTabKey,
tabBarExtraContent = filterEmptyWithUndefined((_a = slots.tabBarExtraContent) === null || _a === void 0 ? void 0 : _a.call(slots)),
title = filterEmptyWithUndefined((_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots)),
extra = filterEmptyWithUndefined((_c = slots.extra) === null || _c === void 0 ? void 0 : _c.call(slots)),
actions = filterEmptyWithUndefined((_d = slots.actions) === null || _d === void 0 ? void 0 : _d.call(slots)),
cover = filterEmptyWithUndefined((_e = slots.cover) === null || _e === void 0 ? void 0 : _e.call(slots))
} = props2;
const children = flattenChildren((_f = slots.default) === null || _f === void 0 ? void 0 : _f.call(slots));
const pre = prefixCls.value;
const classString = {
[`${pre}`]: true,
[hashId.value]: true,
[`${pre}-loading`]: loading2,
[`${pre}-bordered`]: bordered,
[`${pre}-hoverable`]: !!hoverable,
[`${pre}-contain-grid`]: isContainGrid(children),
[`${pre}-contain-tabs`]: tabList && tabList.length,
[`${pre}-${size.value}`]: size.value,
[`${pre}-type-${type}`]: !!type,
[`${pre}-rtl`]: direction.value === "rtl"
};
const loadingBlock = createVNode(Skeleton, {
"loading": true,
"active": true,
"paragraph": {
rows: 4
},
"title": false
}, {
default: () => [children]
});
const hasActiveTabKey = activeTabKey !== void 0;
const tabsProps2 = {
size: "large",
[hasActiveTabKey ? "activeKey" : "defaultActiveKey"]: hasActiveTabKey ? activeTabKey : defaultActiveTabKey,
onChange: triggerTabChange,
class: `${pre}-head-tabs`
};
let head;
const tabs = tabList && tabList.length ? createVNode(Tabs, tabsProps2, {
default: () => [tabList.map((item) => {
const {
tab: temp,
slots: itemSlots
} = item;
const name = itemSlots === null || itemSlots === void 0 ? void 0 : itemSlots.tab;
devWarning(!itemSlots, "Card", `tabList slots is deprecated, Please use \`customTab\` instead.`);
let tab = temp !== void 0 ? temp : slots[name] ? slots[name](item) : null;
tab = customRenderSlot(slots, "customTab", item, () => [tab]);
return createVNode(TabPane, {
"tab": tab,
"key": item.key,
"disabled": item.disabled
}, null);
})],
rightExtra: tabBarExtraContent ? () => tabBarExtraContent : null
}) : null;
if (title || extra || tabs) {
head = createVNode("div", {
"class": `${pre}-head`,
"style": headStyle
}, [createVNode("div", {
"class": `${pre}-head-wrapper`
}, [title && createVNode("div", {
"class": `${pre}-head-title`
}, [title]), extra && createVNode("div", {
"class": `${pre}-extra`
}, [extra])]), tabs]);
}
const coverDom = cover ? createVNode("div", {
"class": `${pre}-cover`
}, [cover]) : null;
const body = createVNode("div", {
"class": `${pre}-body`,
"style": bodyStyle
}, [loading2 ? loadingBlock : children]);
const actionDom = actions && actions.length ? createVNode("ul", {
"class": `${pre}-actions`
}, [getAction(actions)]) : null;
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({
"ref": "cardContainerRef"
}, attrs), {}, {
"class": [classString, attrs.class]
}), [head, coverDom, children && children.length ? body : null, actionDom]));
};
}
});
const cardMetaProps = () => ({
prefixCls: String,
title: vNodeType(),
description: vNodeType(),
avatar: vNodeType()
});
const Meta = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACardMeta",
props: cardMetaProps(),
slots: Object,
setup(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls
} = useConfigInject("card", props2);
return () => {
const classString = {
[`${prefixCls.value}-meta`]: true
};
const avatar = getPropsSlot(slots, props2, "avatar");
const title = getPropsSlot(slots, props2, "title");
const description = getPropsSlot(slots, props2, "description");
const avatarDom = avatar ? createVNode("div", {
"class": `${prefixCls.value}-meta-avatar`
}, [avatar]) : null;
const titleDom = title ? createVNode("div", {
"class": `${prefixCls.value}-meta-title`
}, [title]) : null;
const descriptionDom = description ? createVNode("div", {
"class": `${prefixCls.value}-meta-description`
}, [description]) : null;
const MetaDetail = titleDom || descriptionDom ? createVNode("div", {
"class": `${prefixCls.value}-meta-detail`
}, [titleDom, descriptionDom]) : null;
return createVNode("div", {
"class": classString
}, [avatarDom, MetaDetail]);
};
}
});
const cardGridProps = () => ({
prefixCls: String,
hoverable: {
type: Boolean,
default: true
}
});
const Grid = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACardGrid",
__ANT_CARD_GRID: true,
props: cardGridProps(),
setup(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls
} = useConfigInject("card", props2);
const classNames2 = computed(() => {
return {
[`${prefixCls.value}-grid`]: true,
[`${prefixCls.value}-grid-hoverable`]: props2.hoverable
};
});
return () => {
var _a;
return createVNode("div", {
"class": classNames2.value
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
Card.Meta = Meta;
Card.Grid = Grid;
Card.install = function(app) {
app.component(Card.name, Card);
app.component(Meta.name, Meta);
app.component(Grid.name, Grid);
return app;
};
const collapseProps = () => ({
prefixCls: String,
activeKey: someType([Array, Number, String]),
defaultActiveKey: someType([Array, Number, String]),
accordion: booleanType(),
destroyInactivePanel: booleanType(),
bordered: booleanType(),
expandIcon: functionType(),
openAnimation: PropTypes.object,
expandIconPosition: stringType(),
collapsible: stringType(),
ghost: booleanType(),
onChange: functionType(),
"onUpdate:activeKey": functionType()
});
const collapsePanelProps = () => ({
openAnimation: PropTypes.object,
prefixCls: String,
header: PropTypes.any,
headerClass: String,
showArrow: booleanType(),
isActive: booleanType(),
destroyInactivePanel: booleanType(),
/** @deprecated Use `collapsible="disabled"` instead */
disabled: booleanType(),
accordion: booleanType(),
forceRender: booleanType(),
expandIcon: functionType(),
extra: PropTypes.any,
panelKey: someType(),
collapsible: stringType(),
role: String,
onItemClick: functionType()
});
const genBaseStyle$d = (token) => {
const {
componentCls,
collapseContentBg,
padding,
collapseContentPaddingHorizontal,
collapseHeaderBg,
collapseHeaderPadding,
collapsePanelBorderRadius,
lineWidth,
lineType,
colorBorder,
colorText,
colorTextHeading,
colorTextDisabled,
fontSize,
lineHeight,
marginSM,
paddingSM,
motionDurationSlow,
fontSizeIcon
} = token;
const borderBase = `${lineWidth}px ${lineType} ${colorBorder}`;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
backgroundColor: collapseHeaderBg,
border: borderBase,
borderBottom: 0,
borderRadius: `${collapsePanelBorderRadius}px`,
[`&-rtl`]: {
direction: "rtl"
},
[`& > ${componentCls}-item`]: {
borderBottom: borderBase,
[`&:last-child`]: {
[`
&,
& > ${componentCls}-header`]: {
borderRadius: `0 0 ${collapsePanelBorderRadius}px ${collapsePanelBorderRadius}px`
}
},
[`> ${componentCls}-header`]: {
position: "relative",
display: "flex",
flexWrap: "nowrap",
alignItems: "flex-start",
padding: collapseHeaderPadding,
color: colorTextHeading,
lineHeight,
cursor: "pointer",
transition: `all ${motionDurationSlow}, visibility 0s`,
[`> ${componentCls}-header-text`]: {
flex: "auto"
},
"&:focus": {
outline: "none"
},
// >>>>> Arrow
[`${componentCls}-expand-icon`]: {
height: fontSize * lineHeight,
display: "flex",
alignItems: "center",
paddingInlineEnd: marginSM
},
[`${componentCls}-arrow`]: _extends(_extends({}, resetIcon()), {
fontSize: fontSizeIcon,
svg: {
transition: `transform ${motionDurationSlow}`
}
}),
// >>>>> Text
[`${componentCls}-header-text`]: {
marginInlineEnd: "auto"
}
},
[`${componentCls}-header-collapsible-only`]: {
cursor: "default",
[`${componentCls}-header-text`]: {
flex: "none",
cursor: "pointer"
},
[`${componentCls}-expand-icon`]: {
cursor: "pointer"
}
},
[`${componentCls}-icon-collapsible-only`]: {
cursor: "default",
[`${componentCls}-expand-icon`]: {
cursor: "pointer"
}
},
[`&${componentCls}-no-arrow`]: {
[`> ${componentCls}-header`]: {
paddingInlineStart: paddingSM
}
}
},
[`${componentCls}-content`]: {
color: colorText,
backgroundColor: collapseContentBg,
borderTop: borderBase,
[`& > ${componentCls}-content-box`]: {
padding: `${padding}px ${collapseContentPaddingHorizontal}px`
},
[`&-hidden`]: {
display: "none"
}
},
[`${componentCls}-item:last-child`]: {
[`> ${componentCls}-content`]: {
borderRadius: `0 0 ${collapsePanelBorderRadius}px ${collapsePanelBorderRadius}px`
}
},
[`& ${componentCls}-item-disabled > ${componentCls}-header`]: {
[`
&,
& > .arrow
`]: {
color: colorTextDisabled,
cursor: "not-allowed"
}
},
// ========================== Icon Position ==========================
[`&${componentCls}-icon-position-end`]: {
[`& > ${componentCls}-item`]: {
[`> ${componentCls}-header`]: {
[`${componentCls}-expand-icon`]: {
order: 1,
paddingInlineEnd: 0,
paddingInlineStart: marginSM
}
}
}
}
})
};
};
const genArrowStyle = (token) => {
const {
componentCls
} = token;
const fixedSelector = `> ${componentCls}-item > ${componentCls}-header ${componentCls}-arrow svg`;
return {
[`${componentCls}-rtl`]: {
[fixedSelector]: {
transform: `rotate(180deg)`
}
}
};
};
const genBorderlessStyle = (token) => {
const {
componentCls,
collapseHeaderBg,
paddingXXS,
colorBorder
} = token;
return {
[`${componentCls}-borderless`]: {
backgroundColor: collapseHeaderBg,
border: 0,
[`> ${componentCls}-item`]: {
borderBottom: `1px solid ${colorBorder}`
},
[`
> ${componentCls}-item:last-child,
> ${componentCls}-item:last-child ${componentCls}-header
`]: {
borderRadius: 0
},
[`> ${componentCls}-item:last-child`]: {
borderBottom: 0
},
[`> ${componentCls}-item > ${componentCls}-content`]: {
backgroundColor: "transparent",
borderTop: 0
},
[`> ${componentCls}-item > ${componentCls}-content > ${componentCls}-content-box`]: {
paddingTop: paddingXXS
}
}
};
};
const genGhostStyle = (token) => {
const {
componentCls,
paddingSM
} = token;
return {
[`${componentCls}-ghost`]: {
backgroundColor: "transparent",
border: 0,
[`> ${componentCls}-item`]: {
borderBottom: 0,
[`> ${componentCls}-content`]: {
backgroundColor: "transparent",
border: 0,
[`> ${componentCls}-content-box`]: {
paddingBlock: paddingSM
}
}
}
}
};
};
const useStyle$E = genComponentStyleHook("Collapse", (token) => {
const collapseToken = merge(token, {
collapseContentBg: token.colorBgContainer,
collapseHeaderBg: token.colorFillAlter,
collapseHeaderPadding: `${token.paddingSM}px ${token.padding}px`,
collapsePanelBorderRadius: token.borderRadiusLG,
collapseContentPaddingHorizontal: 16
// Fixed value
});
return [genBaseStyle$d(collapseToken), genBorderlessStyle(collapseToken), genGhostStyle(collapseToken), genArrowStyle(collapseToken), genCollapseMotion(collapseToken)];
});
function getActiveKeysArray(activeKey) {
let currentActiveKey = activeKey;
if (!Array.isArray(currentActiveKey)) {
const activeKeyType = typeof currentActiveKey;
currentActiveKey = activeKeyType === "number" || activeKeyType === "string" ? [currentActiveKey] : [];
}
return currentActiveKey.map((key2) => String(key2));
}
const Collapse = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACollapse",
inheritAttrs: false,
props: initDefaultProps(collapseProps(), {
accordion: false,
destroyInactivePanel: false,
bordered: true,
expandIconPosition: "start"
}),
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots,
emit
} = _ref;
const stateActiveKey = ref(getActiveKeysArray(firstNotUndefined([props2.activeKey, props2.defaultActiveKey])));
watch(() => props2.activeKey, () => {
stateActiveKey.value = getActiveKeysArray(props2.activeKey);
}, {
deep: true
});
const {
prefixCls,
direction,
rootPrefixCls
} = useConfigInject("collapse", props2);
const [wrapSSR, hashId] = useStyle$E(prefixCls);
const iconPosition = computed(() => {
const {
expandIconPosition
} = props2;
if (expandIconPosition !== void 0) {
return expandIconPosition;
}
return direction.value === "rtl" ? "end" : "start";
});
const renderExpandIcon2 = (panelProps) => {
const {
expandIcon = slots.expandIcon
} = props2;
const icon = expandIcon ? expandIcon(panelProps) : createVNode(RightOutlined, {
"rotate": panelProps.isActive ? 90 : void 0
}, null);
return createVNode("div", {
"class": [`${prefixCls.value}-expand-icon`, hashId.value],
"onClick": () => ["header", "icon"].includes(props2.collapsible) && onClickItem(panelProps.panelKey)
}, [isValidElement(Array.isArray(expandIcon) ? icon[0] : icon) ? cloneElement(icon, {
class: `${prefixCls.value}-arrow`
}, false) : icon]);
};
const setActiveKey = (activeKey) => {
if (props2.activeKey === void 0) {
stateActiveKey.value = activeKey;
}
const newKey = props2.accordion ? activeKey[0] : activeKey;
emit("update:activeKey", newKey);
emit("change", newKey);
};
const onClickItem = (key2) => {
let activeKey = stateActiveKey.value;
if (props2.accordion) {
activeKey = activeKey[0] === key2 ? [] : [key2];
} else {
activeKey = [...activeKey];
const index2 = activeKey.indexOf(key2);
const isActive = index2 > -1;
if (isActive) {
activeKey.splice(index2, 1);
} else {
activeKey.push(key2);
}
}
setActiveKey(activeKey);
};
const getNewChild = (child, index2) => {
var _a, _b, _c;
if (isEmptyElement(child)) return;
const activeKey = stateActiveKey.value;
const {
accordion,
destroyInactivePanel,
collapsible,
openAnimation
} = props2;
const animation = openAnimation || collapseMotion(`${rootPrefixCls.value}-motion-collapse`);
const key2 = String((_a = child.key) !== null && _a !== void 0 ? _a : index2);
const {
header = (_c = (_b = child.children) === null || _b === void 0 ? void 0 : _b.header) === null || _c === void 0 ? void 0 : _c.call(_b),
headerClass,
collapsible: childCollapsible,
disabled
} = child.props || {};
let isActive = false;
if (accordion) {
isActive = activeKey[0] === key2;
} else {
isActive = activeKey.indexOf(key2) > -1;
}
let mergeCollapsible = childCollapsible !== null && childCollapsible !== void 0 ? childCollapsible : collapsible;
if (disabled || disabled === "") {
mergeCollapsible = "disabled";
}
const newProps = {
key: key2,
panelKey: key2,
header,
headerClass,
isActive,
prefixCls: prefixCls.value,
destroyInactivePanel,
openAnimation: animation,
accordion,
onItemClick: mergeCollapsible === "disabled" ? null : onClickItem,
expandIcon: renderExpandIcon2,
collapsible: mergeCollapsible
};
return cloneElement(child, newProps);
};
const getItems = () => {
var _a;
return flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)).map(getNewChild);
};
return () => {
const {
accordion,
bordered,
ghost
} = props2;
const collapseClassName = classNames(prefixCls.value, {
[`${prefixCls.value}-borderless`]: !bordered,
[`${prefixCls.value}-icon-position-${iconPosition.value}`]: true,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-ghost`]: !!ghost,
[attrs.class]: !!attrs.class
}, hashId.value);
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({
"class": collapseClassName
}, getDataAndAriaProps(attrs)), {}, {
"style": attrs.style,
"role": accordion ? "tablist" : null
}), [getItems()]));
};
}
});
const PanelContent = defineComponent({
compatConfig: {
MODE: 3
},
name: "PanelContent",
props: collapsePanelProps(),
setup(props2, _ref) {
let {
slots
} = _ref;
const rendered = shallowRef(false);
watchEffect(() => {
if (props2.isActive || props2.forceRender) {
rendered.value = true;
}
});
return () => {
var _a;
if (!rendered.value) return null;
const {
prefixCls,
isActive,
role
} = props2;
return createVNode("div", {
"class": classNames(`${prefixCls}-content`, {
[`${prefixCls}-content-active`]: isActive,
[`${prefixCls}-content-inactive`]: !isActive
}),
"role": role
}, [createVNode("div", {
"class": `${prefixCls}-content-box`
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])]);
};
}
});
const __nuxt_component_6 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACollapsePanel",
inheritAttrs: false,
props: initDefaultProps(collapsePanelProps(), {
showArrow: true,
isActive: false,
onItemClick() {
},
headerClass: "",
forceRender: false
}),
slots: Object,
// emits: ['itemClick'],
setup(props2, _ref) {
let {
slots,
emit,
attrs
} = _ref;
devWarning(props2.disabled === void 0, "Collapse.Panel", '`disabled` is deprecated. Please use `collapsible="disabled"` instead.');
const {
prefixCls
} = useConfigInject("collapse", props2);
const handleItemClick = () => {
emit("itemClick", props2.panelKey);
};
const handleKeyPress = (e) => {
if (e.key === "Enter" || e.keyCode === 13 || e.which === 13) {
handleItemClick();
}
};
return () => {
var _a, _b;
const {
header = (_a = slots.header) === null || _a === void 0 ? void 0 : _a.call(slots),
headerClass,
isActive,
showArrow,
destroyInactivePanel,
accordion,
forceRender,
openAnimation,
expandIcon = slots.expandIcon,
extra = (_b = slots.extra) === null || _b === void 0 ? void 0 : _b.call(slots),
collapsible
} = props2;
const disabled = collapsible === "disabled";
const prefixClsValue = prefixCls.value;
const headerCls = classNames(`${prefixClsValue}-header`, {
[headerClass]: headerClass,
[`${prefixClsValue}-header-collapsible-only`]: collapsible === "header",
[`${prefixClsValue}-icon-collapsible-only`]: collapsible === "icon"
});
const itemCls = classNames({
[`${prefixClsValue}-item`]: true,
[`${prefixClsValue}-item-active`]: isActive,
[`${prefixClsValue}-item-disabled`]: disabled,
[`${prefixClsValue}-no-arrow`]: !showArrow,
[`${attrs.class}`]: !!attrs.class
});
let icon = createVNode("i", {
"class": "arrow"
}, null);
if (showArrow && typeof expandIcon === "function") {
icon = expandIcon(props2);
}
const panelContent = withDirectives(createVNode(PanelContent, {
"prefixCls": prefixClsValue,
"isActive": isActive,
"forceRender": forceRender,
"role": accordion ? "tabpanel" : null
}, {
default: slots.default
}), [[vShow, isActive]]);
const transitionProps = _extends({
appear: false,
css: false
}, openAnimation);
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": itemCls
}), [createVNode("div", {
"class": headerCls,
"onClick": () => !["header", "icon"].includes(collapsible) && handleItemClick(),
"role": accordion ? "tab" : "button",
"tabindex": disabled ? -1 : 0,
"aria-expanded": isActive,
"onKeypress": handleKeyPress
}, [showArrow && icon, createVNode("span", {
"onClick": () => collapsible === "header" && handleItemClick(),
"class": `${prefixClsValue}-header-text`
}, [header]), extra && createVNode("div", {
"class": `${prefixClsValue}-extra`
}, [extra])]), createVNode(Transition, transitionProps, {
default: () => [!destroyInactivePanel || isActive ? panelContent : null]
})]);
};
}
});
Collapse.Panel = __nuxt_component_6;
Collapse.install = function(app) {
app.component(Collapse.name, Collapse);
app.component(__nuxt_component_6.name, __nuxt_component_6);
return app;
};
const camel2hyphen = function(str) {
return str.replace(/[A-Z]/g, function(match2) {
return "-" + match2.toLowerCase();
}).toLowerCase();
};
const isDimension = function(feature) {
const re = /[height|width]$/;
return re.test(feature);
};
const obj2mq = function(obj) {
let mq = "";
const features = Object.keys(obj);
features.forEach(function(feature, index2) {
let value = obj[feature];
feature = camel2hyphen(feature);
if (isDimension(feature) && typeof value === "number") {
value = value + "px";
}
if (value === true) {
mq += feature;
} else if (value === false) {
mq += "not " + feature;
} else {
mq += "(" + feature + ": " + value + ")";
}
if (index2 < features.length - 1) {
mq += " and ";
}
});
return mq;
};
function json2mq(query) {
let mq = "";
if (typeof query === "string") {
return query;
}
if (query instanceof Array) {
query.forEach(function(q, index2) {
mq += obj2mq(q);
if (index2 < query.length - 1) {
mq += ", ";
}
});
return mq;
}
return obj2mq(query);
}
const defaultProps$2 = {
accessibility: {
type: Boolean,
default: true
},
// 自定义高度
adaptiveHeight: {
type: Boolean,
default: false
},
afterChange: PropTypes.any.def(null),
arrows: {
type: Boolean,
default: true
},
autoplay: {
type: Boolean,
default: false
},
autoplaySpeed: PropTypes.number.def(3e3),
beforeChange: PropTypes.any.def(null),
centerMode: {
type: Boolean,
default: false
},
centerPadding: PropTypes.string.def("50px"),
cssEase: PropTypes.string.def("ease"),
dots: {
type: Boolean,
default: false
},
dotsClass: PropTypes.string.def("slick-dots"),
draggable: {
type: Boolean,
default: true
},
unslick: {
type: Boolean,
default: false
},
easing: PropTypes.string.def("linear"),
edgeFriction: PropTypes.number.def(0.35),
fade: {
type: Boolean,
default: false
},
focusOnSelect: {
type: Boolean,
default: false
},
infinite: {
type: Boolean,
default: true
},
initialSlide: PropTypes.number.def(0),
lazyLoad: PropTypes.any.def(null),
verticalSwiping: {
type: Boolean,
default: false
},
asNavFor: PropTypes.any.def(null),
// 圆点hover是否暂停
pauseOnDotsHover: {
type: Boolean,
default: false
},
// focus是否暂停
pauseOnFocus: {
type: Boolean,
default: false
},
// hover是否暂停
pauseOnHover: {
type: Boolean,
default: true
},
responsive: PropTypes.array,
rows: PropTypes.number.def(1),
rtl: {
type: Boolean,
default: false
},
slide: PropTypes.string.def("div"),
slidesPerRow: PropTypes.number.def(1),
slidesToScroll: PropTypes.number.def(1),
slidesToShow: PropTypes.number.def(1),
speed: PropTypes.number.def(500),
swipe: {
type: Boolean,
default: true
},
swipeEvent: PropTypes.any.def(null),
swipeToSlide: {
type: Boolean,
default: false
},
touchMove: {
type: Boolean,
default: true
},
touchThreshold: PropTypes.number.def(5),
useCSS: {
type: Boolean,
default: true
},
useTransform: {
type: Boolean,
default: true
},
variableWidth: {
type: Boolean,
default: false
},
vertical: {
type: Boolean,
default: false
},
waitForAnimate: {
type: Boolean,
default: true
},
children: PropTypes.array,
__propsSymbol__: PropTypes.any
};
const initialState = {
animating: false,
autoplaying: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
dragging: false,
edgeDragged: false,
initialized: false,
lazyLoadedList: [],
listHeight: null,
listWidth: null,
scrolling: false,
slideCount: null,
slideHeight: null,
slideWidth: null,
swipeLeft: null,
swiped: false,
swiping: false,
touchObject: {
startX: 0,
startY: 0,
curX: 0,
curY: 0
},
trackStyle: {},
trackWidth: 0,
targetSlide: 0
};
function clamp(number, lowerBound, upperBound) {
return Math.max(lowerBound, Math.min(number, upperBound));
}
const safePreventDefault = (event) => {
const passiveEvents = ["touchstart", "touchmove", "wheel"];
if (!passiveEvents.includes(event.type)) {
event.preventDefault();
}
};
const getOnDemandLazySlides = (spec) => {
const onDemandSlides = [];
const startIndex = lazyStartIndex(spec);
const endIndex = lazyEndIndex(spec);
for (let slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
onDemandSlides.push(slideIndex);
}
}
return onDemandSlides;
};
const lazyStartIndex = (spec) => spec.currentSlide - lazySlidesOnLeft(spec);
const lazyEndIndex = (spec) => spec.currentSlide + lazySlidesOnRight(spec);
const lazySlidesOnLeft = (spec) => spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
const lazySlidesOnRight = (spec) => spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
const getWidth = (elem) => elem && elem.offsetWidth || 0;
const getHeight = (elem) => elem && elem.offsetHeight || 0;
const getSwipeDirection = function(touchObject) {
let verticalSwiping = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
let swipeAngle;
const xDist = touchObject.startX - touchObject.curX;
const yDist = touchObject.startY - touchObject.curY;
const r = Math.atan2(yDist, xDist);
swipeAngle = Math.round(r * 180 / Math.PI);
if (swipeAngle < 0) {
swipeAngle = 360 - Math.abs(swipeAngle);
}
if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
return "left";
}
if (swipeAngle >= 135 && swipeAngle <= 225) {
return "right";
}
if (verticalSwiping === true) {
if (swipeAngle >= 35 && swipeAngle <= 135) {
return "up";
} else {
return "down";
}
}
return "vertical";
};
const canGoNext = (spec) => {
let canGo = true;
if (!spec.infinite) {
if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
canGo = false;
} else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
canGo = false;
}
}
return canGo;
};
const extractObject = (spec, keys) => {
const newObject = {};
keys.forEach((key2) => newObject[key2] = spec[key2]);
return newObject;
};
const initializedState = (spec) => {
const slideCount = spec.children.length;
const listNode = spec.listRef;
const listWidth = Math.ceil(getWidth(listNode));
const trackNode = spec.trackRef;
const trackWidth = Math.ceil(getWidth(trackNode));
let slideWidth;
if (!spec.vertical) {
let centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
centerPaddingAdj *= listWidth / 100;
}
slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
} else {
slideWidth = listWidth;
}
const slideHeight = listNode && getHeight(listNode.querySelector('[data-index="0"]'));
const listHeight = slideHeight * spec.slidesToShow;
let currentSlide = spec.currentSlide === void 0 ? spec.initialSlide : spec.currentSlide;
if (spec.rtl && spec.currentSlide === void 0) {
currentSlide = slideCount - 1 - spec.initialSlide;
}
let lazyLoadedList = spec.lazyLoadedList || [];
const slidesToLoad = getOnDemandLazySlides(_extends(_extends({}, spec), {
currentSlide,
lazyLoadedList
}));
lazyLoadedList = lazyLoadedList.concat(slidesToLoad);
const state = {
slideCount,
slideWidth,
listWidth,
trackWidth,
currentSlide,
slideHeight,
listHeight,
lazyLoadedList
};
if (spec.autoplaying === null && spec.autoplay) {
state["autoplaying"] = "playing";
}
return state;
};
const slideHandler = (spec) => {
const {
waitForAnimate,
animating,
fade,
infinite,
index: index2,
slideCount,
lazyLoad,
currentSlide,
centerMode,
slidesToScroll,
slidesToShow,
useCSS
} = spec;
let {
lazyLoadedList
} = spec;
if (waitForAnimate && animating) return {};
let animationSlide = index2;
let finalSlide;
let animationLeft;
let finalLeft;
let state = {};
let nextState = {};
const targetSlide = infinite ? index2 : clamp(index2, 0, slideCount - 1);
if (fade) {
if (!infinite && (index2 < 0 || index2 >= slideCount)) return {};
if (index2 < 0) {
animationSlide = index2 + slideCount;
} else if (index2 >= slideCount) {
animationSlide = index2 - slideCount;
}
if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
lazyLoadedList = lazyLoadedList.concat(animationSlide);
}
state = {
animating: true,
currentSlide: animationSlide,
lazyLoadedList,
targetSlide: animationSlide
};
nextState = {
animating: false,
targetSlide: animationSlide
};
} else {
finalSlide = animationSlide;
if (animationSlide < 0) {
finalSlide = animationSlide + slideCount;
if (!infinite) finalSlide = 0;
else if (slideCount % slidesToScroll !== 0) {
finalSlide = slideCount - slideCount % slidesToScroll;
}
} else if (!canGoNext(spec) && animationSlide > currentSlide) {
animationSlide = finalSlide = currentSlide;
} else if (centerMode && animationSlide >= slideCount) {
animationSlide = infinite ? slideCount : slideCount - 1;
finalSlide = infinite ? 0 : slideCount - 1;
} else if (animationSlide >= slideCount) {
finalSlide = animationSlide - slideCount;
if (!infinite) finalSlide = slideCount - slidesToShow;
else if (slideCount % slidesToScroll !== 0) finalSlide = 0;
}
if (!infinite && animationSlide + slidesToShow >= slideCount) {
finalSlide = slideCount - slidesToShow;
}
animationLeft = getTrackLeft(_extends(_extends({}, spec), {
slideIndex: animationSlide
}));
finalLeft = getTrackLeft(_extends(_extends({}, spec), {
slideIndex: finalSlide
}));
if (!infinite) {
if (animationLeft === finalLeft) animationSlide = finalSlide;
animationLeft = finalLeft;
}
if (lazyLoad) {
lazyLoadedList = lazyLoadedList.concat(getOnDemandLazySlides(_extends(_extends({}, spec), {
currentSlide: animationSlide
})));
}
if (!useCSS) {
state = {
currentSlide: finalSlide,
trackStyle: getTrackCSS(_extends(_extends({}, spec), {
left: finalLeft
})),
lazyLoadedList,
targetSlide
};
} else {
state = {
animating: true,
currentSlide: finalSlide,
trackStyle: getTrackAnimateCSS(_extends(_extends({}, spec), {
left: animationLeft
})),
lazyLoadedList,
targetSlide
};
nextState = {
animating: false,
currentSlide: finalSlide,
trackStyle: getTrackCSS(_extends(_extends({}, spec), {
left: finalLeft
})),
swipeLeft: null,
targetSlide
};
}
}
return {
state,
nextState
};
};
const changeSlide = (spec, options) => {
let previousInt, slideOffset, targetSlide;
const {
slidesToScroll,
slidesToShow,
slideCount,
currentSlide,
targetSlide: previousTargetSlide,
lazyLoad,
infinite
} = spec;
const unevenOffset = slideCount % slidesToScroll !== 0;
const indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
if (options.message === "previous") {
slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
targetSlide = currentSlide - slideOffset;
if (lazyLoad && !infinite) {
previousInt = currentSlide - slideOffset;
targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
}
if (!infinite) {
targetSlide = previousTargetSlide - slidesToScroll;
}
} else if (options.message === "next") {
slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
targetSlide = currentSlide + slideOffset;
if (lazyLoad && !infinite) {
targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
}
if (!infinite) {
targetSlide = previousTargetSlide + slidesToScroll;
}
} else if (options.message === "dots") {
targetSlide = options.index * options.slidesToScroll;
} else if (options.message === "children") {
targetSlide = options.index;
if (infinite) {
const direction = siblingDirection(_extends(_extends({}, spec), {
targetSlide
}));
if (targetSlide > options.currentSlide && direction === "left") {
targetSlide = targetSlide - slideCount;
} else if (targetSlide < options.currentSlide && direction === "right") {
targetSlide = targetSlide + slideCount;
}
}
} else if (options.message === "index") {
targetSlide = Number(options.index);
}
return targetSlide;
};
const keyHandler = (e, accessibility, rtl2) => {
if (e.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility) {
return "";
}
if (e.keyCode === 37) return rtl2 ? "next" : "previous";
if (e.keyCode === 39) return rtl2 ? "previous" : "next";
return "";
};
const swipeStart = (e, swipe, draggable) => {
e.target.tagName === "IMG" && safePreventDefault(e);
if (!swipe || !draggable && e.type.indexOf("mouse") !== -1) return "";
return {
dragging: true,
touchObject: {
startX: e.touches ? e.touches[0].pageX : e.clientX,
startY: e.touches ? e.touches[0].pageY : e.clientY,
curX: e.touches ? e.touches[0].pageX : e.clientX,
curY: e.touches ? e.touches[0].pageY : e.clientY
}
};
};
const swipeMove = (e, spec) => {
const {
scrolling,
animating,
vertical,
swipeToSlide,
verticalSwiping,
rtl: rtl2,
currentSlide,
edgeFriction,
edgeDragged,
onEdge,
swiped,
swiping,
slideCount,
slidesToScroll,
infinite,
touchObject,
swipeEvent,
listHeight,
listWidth
} = spec;
if (scrolling) return;
if (animating) return safePreventDefault(e);
if (vertical && swipeToSlide && verticalSwiping) safePreventDefault(e);
let swipeLeft;
let state = {};
const curLeft = getTrackLeft(spec);
touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX;
touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY;
touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
const verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
return {
scrolling: true
};
}
if (verticalSwiping) touchObject.swipeLength = verticalSwipeLength;
let positionOffset = (!rtl2 ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
if (verticalSwiping) {
positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
}
const dotCount = Math.ceil(slideCount / slidesToScroll);
const swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
let touchSwipeLength = touchObject.swipeLength;
if (!infinite) {
if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
touchSwipeLength = touchObject.swipeLength * edgeFriction;
if (edgeDragged === false && onEdge) {
onEdge(swipeDirection);
state["edgeDragged"] = true;
}
}
}
if (!swiped && swipeEvent) {
swipeEvent(swipeDirection);
state["swiped"] = true;
}
if (!vertical) {
if (!rtl2) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
} else {
swipeLeft = curLeft - touchSwipeLength * positionOffset;
}
} else {
swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
}
if (verticalSwiping) {
swipeLeft = curLeft + touchSwipeLength * positionOffset;
}
state = _extends(_extends({}, state), {
touchObject,
swipeLeft,
trackStyle: getTrackCSS(_extends(_extends({}, spec), {
left: swipeLeft
}))
});
if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
return state;
}
if (touchObject.swipeLength > 10) {
state["swiping"] = true;
safePreventDefault(e);
}
return state;
};
const swipeEnd = (e, spec) => {
const {
dragging,
swipe,
touchObject,
listWidth,
touchThreshold,
verticalSwiping,
listHeight,
swipeToSlide,
scrolling,
onSwipe,
targetSlide,
currentSlide,
infinite
} = spec;
if (!dragging) {
if (swipe) safePreventDefault(e);
return {};
}
const minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
const swipeDirection = getSwipeDirection(touchObject, verticalSwiping);
const state = {
dragging: false,
edgeDragged: false,
scrolling: false,
swiping: false,
swiped: false,
swipeLeft: null,
touchObject: {}
};
if (scrolling) {
return state;
}
if (!touchObject.swipeLength) {
return state;
}
if (touchObject.swipeLength > minSwipe) {
safePreventDefault(e);
if (onSwipe) {
onSwipe(swipeDirection);
}
let slideCount, newSlide;
const activeSlide = infinite ? currentSlide : targetSlide;
switch (swipeDirection) {
case "left":
case "up":
newSlide = activeSlide + getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 0;
break;
case "right":
case "down":
newSlide = activeSlide - getSlideCount(spec);
slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
state["currentDirection"] = 1;
break;
default:
slideCount = activeSlide;
}
state["triggerSlideHandler"] = slideCount;
} else {
const currentLeft = getTrackLeft(spec);
state["trackStyle"] = getTrackAnimateCSS(_extends(_extends({}, spec), {
left: currentLeft
}));
}
return state;
};
const getNavigableIndexes = (spec) => {
const max = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
let breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
let counter = spec.infinite ? spec.slidesToShow * -1 : 0;
const indexes = [];
while (breakpoint < max) {
indexes.push(breakpoint);
breakpoint = counter + spec.slidesToScroll;
counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
}
return indexes;
};
const checkNavigable = (spec, index2) => {
const navigables = getNavigableIndexes(spec);
let prevNavigable = 0;
if (index2 > navigables[navigables.length - 1]) {
index2 = navigables[navigables.length - 1];
} else {
for (const n in navigables) {
if (index2 < navigables[n]) {
index2 = prevNavigable;
break;
}
prevNavigable = navigables[n];
}
}
return index2;
};
const getSlideCount = (spec) => {
const centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
if (spec.swipeToSlide) {
let swipedSlide;
const slickList = spec.listRef;
const slides = slickList.querySelectorAll && slickList.querySelectorAll(".slick-slide") || [];
Array.from(slides).every((slide) => {
if (!spec.vertical) {
if (slide.offsetLeft - centerOffset + getWidth(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
} else {
if (slide.offsetTop + getHeight(slide) / 2 > spec.swipeLeft * -1) {
swipedSlide = slide;
return false;
}
}
return true;
});
if (!swipedSlide) {
return 0;
}
const currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
const slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
return slidesTraversed;
} else {
return spec.slidesToScroll;
}
};
const checkSpecKeys = (spec, keysArray) => keysArray.reduce((value, key2) => value && spec.hasOwnProperty(key2), true) ? null : console.error("Keys Missing:", spec);
const getTrackCSS = (spec) => {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
let trackWidth, trackHeight;
const trackChildren = spec.slideCount + 2 * spec.slidesToShow;
if (!spec.vertical) {
trackWidth = getTotalSlides(spec) * spec.slideWidth;
} else {
trackHeight = trackChildren * spec.slideHeight;
}
let style = {
opacity: 1,
transition: "",
WebkitTransition: ""
};
if (spec.useTransform) {
const WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
const transform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
const msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
style = _extends(_extends({}, style), {
WebkitTransform,
transform,
msTransform
});
} else {
if (spec.vertical) {
style["top"] = spec.left;
} else {
style["left"] = spec.left;
}
}
if (spec.fade) style = {
opacity: 1
};
if (trackWidth) style.width = trackWidth + "px";
if (trackHeight) style.height = trackHeight + "px";
return style;
};
const getTrackAnimateCSS = (spec) => {
checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
const style = getTrackCSS(spec);
if (spec.useTransform) {
style.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
style.transition = "transform " + spec.speed + "ms " + spec.cssEase;
} else {
if (spec.vertical) {
style.transition = "top " + spec.speed + "ms " + spec.cssEase;
} else {
style.transition = "left " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
const getTrackLeft = (spec) => {
if (spec.unslick) {
return 0;
}
checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
const {
slideIndex,
trackRef,
infinite,
centerMode,
slideCount,
slidesToShow,
slidesToScroll,
slideWidth,
listWidth,
variableWidth,
slideHeight,
fade,
vertical
} = spec;
let slideOffset = 0;
let targetLeft;
let targetSlide;
let verticalOffset = 0;
if (fade || spec.slideCount === 1) {
return 0;
}
let slidesToOffset = 0;
if (infinite) {
slidesToOffset = -getPreClones(spec);
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
}
if (centerMode) {
slidesToOffset += parseInt(slidesToShow / 2);
}
} else {
if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
slidesToOffset = slidesToShow - slideCount % slidesToScroll;
}
if (centerMode) {
slidesToOffset = parseInt(slidesToShow / 2);
}
}
slideOffset = slidesToOffset * slideWidth;
verticalOffset = slidesToOffset * slideHeight;
if (!vertical) {
targetLeft = slideIndex * slideWidth * -1 + slideOffset;
} else {
targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
}
if (variableWidth === true) {
let targetSlideIndex;
const trackElem = trackRef;
targetSlideIndex = slideIndex + getPreClones(spec);
targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
if (centerMode === true) {
targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
targetSlide = trackElem && trackElem.children[targetSlideIndex];
targetLeft = 0;
for (let slide = 0; slide < targetSlideIndex; slide++) {
targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
}
targetLeft -= parseInt(spec.centerPadding);
targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
}
}
return targetLeft;
};
const getPreClones = (spec) => {
if (spec.unslick || !spec.infinite) {
return 0;
}
if (spec.variableWidth) {
return spec.slideCount;
}
return spec.slidesToShow + (spec.centerMode ? 1 : 0);
};
const getPostClones = (spec) => {
if (spec.unslick || !spec.infinite) {
return 0;
}
return spec.slideCount;
};
const getTotalSlides = (spec) => spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
const siblingDirection = (spec) => {
if (spec.targetSlide > spec.currentSlide) {
if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
return "left";
}
return "right";
} else {
if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
return "right";
}
return "left";
}
};
const slidesOnRight = (_ref) => {
let {
slidesToShow,
centerMode,
rtl: rtl2,
centerPadding
} = _ref;
if (centerMode) {
let right = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) right += 1;
if (rtl2 && slidesToShow % 2 === 0) right += 1;
return right;
}
if (rtl2) {
return 0;
}
return slidesToShow - 1;
};
const slidesOnLeft = (_ref2) => {
let {
slidesToShow,
centerMode,
rtl: rtl2,
centerPadding
} = _ref2;
if (centerMode) {
let left = (slidesToShow - 1) / 2 + 1;
if (parseInt(centerPadding) > 0) left += 1;
if (!rtl2 && slidesToShow % 2 === 0) left += 1;
return left;
}
if (rtl2) {
return slidesToShow - 1;
}
return 0;
};
const getSlideClasses = (spec) => {
let slickActive, slickCenter;
let centerOffset, index2;
if (spec.rtl) {
index2 = spec.slideCount - 1 - spec.index;
} else {
index2 = spec.index;
}
const slickCloned = index2 < 0 || index2 >= spec.slideCount;
if (spec.centerMode) {
centerOffset = Math.floor(spec.slidesToShow / 2);
slickCenter = (index2 - spec.currentSlide) % spec.slideCount === 0;
if (index2 > spec.currentSlide - centerOffset - 1 && index2 <= spec.currentSlide + centerOffset) {
slickActive = true;
}
} else {
slickActive = spec.currentSlide <= index2 && index2 < spec.currentSlide + spec.slidesToShow;
}
let focusedSlide;
if (spec.targetSlide < 0) {
focusedSlide = spec.targetSlide + spec.slideCount;
} else if (spec.targetSlide >= spec.slideCount) {
focusedSlide = spec.targetSlide - spec.slideCount;
} else {
focusedSlide = spec.targetSlide;
}
const slickCurrent = index2 === focusedSlide;
return {
"slick-slide": true,
"slick-active": slickActive,
"slick-center": slickCenter,
"slick-cloned": slickCloned,
"slick-current": slickCurrent
// dubious in case of RTL
};
};
const getSlideStyle = function(spec) {
const style = {};
if (spec.variableWidth === void 0 || spec.variableWidth === false) {
style.width = spec.slideWidth + (typeof spec.slideWidth === "number" ? "px" : "");
}
if (spec.fade) {
style.position = "relative";
if (spec.vertical) {
style.top = -spec.index * parseInt(spec.slideHeight) + "px";
} else {
style.left = -spec.index * parseInt(spec.slideWidth) + "px";
}
style.opacity = spec.currentSlide === spec.index ? 1 : 0;
if (spec.useCSS) {
style.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", visibility " + spec.speed + "ms " + spec.cssEase;
}
}
return style;
};
const getKey$1 = (child, fallbackKey) => child.key + "-" + fallbackKey;
const renderSlides = function(spec, children) {
let key2;
const slides = [];
const preCloneSlides = [];
const postCloneSlides = [];
const childrenCount = children.length;
const startIndex = lazyStartIndex(spec);
const endIndex = lazyEndIndex(spec);
children.forEach((elem, index2) => {
let child;
const childOnClickOptions = {
message: "children",
index: index2,
slidesToScroll: spec.slidesToScroll,
currentSlide: spec.currentSlide
};
if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index2) >= 0) {
child = elem;
} else {
child = createVNode("div");
}
const childStyle = getSlideStyle(_extends(_extends({}, spec), {
index: index2
}));
const slideClass = child.props.class || "";
let slideClasses = getSlideClasses(_extends(_extends({}, spec), {
index: index2
}));
slides.push(deepCloneElement(child, {
key: "original" + getKey$1(child, index2),
tabindex: "-1",
"data-index": index2,
"aria-hidden": !slideClasses["slick-active"],
class: classNames(slideClasses, slideClass),
style: _extends(_extends({
outline: "none"
}, child.props.style || {}), childStyle),
onClick: () => {
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
if (spec.infinite && spec.fade === false) {
const preCloneNo = childrenCount - index2;
if (preCloneNo <= getPreClones(spec) && childrenCount !== spec.slidesToShow) {
key2 = -preCloneNo;
if (key2 >= startIndex) {
child = elem;
}
slideClasses = getSlideClasses(_extends(_extends({}, spec), {
index: key2
}));
preCloneSlides.push(deepCloneElement(child, {
key: "precloned" + getKey$1(child, key2),
class: classNames(slideClasses, slideClass),
tabindex: "-1",
"data-index": key2,
"aria-hidden": !slideClasses["slick-active"],
style: _extends(_extends({}, child.props.style || {}), childStyle),
onClick: () => {
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
if (childrenCount !== spec.slidesToShow) {
key2 = childrenCount + index2;
if (key2 < endIndex) {
child = elem;
}
slideClasses = getSlideClasses(_extends(_extends({}, spec), {
index: key2
}));
postCloneSlides.push(deepCloneElement(child, {
key: "postcloned" + getKey$1(child, key2),
tabindex: "-1",
"data-index": key2,
"aria-hidden": !slideClasses["slick-active"],
class: classNames(slideClasses, slideClass),
style: _extends(_extends({}, child.props.style || {}), childStyle),
onClick: () => {
if (spec.focusOnSelect) {
spec.focusOnSelect(childOnClickOptions);
}
}
}));
}
}
});
if (spec.rtl) {
return preCloneSlides.concat(slides, postCloneSlides).reverse();
} else {
return preCloneSlides.concat(slides, postCloneSlides);
}
};
const Track$1 = (_, _ref) => {
let {
attrs,
slots
} = _ref;
const slides = renderSlides(attrs, flattenChildren(slots === null || slots === void 0 ? void 0 : slots.default()));
const {
onMouseenter,
onMouseover,
onMouseleave
} = attrs;
const mouseEvents = {
onMouseenter,
onMouseover,
onMouseleave
};
const trackProps = _extends({
class: "slick-track",
style: attrs.trackStyle
}, mouseEvents);
return createVNode("div", trackProps, [slides]);
};
Track$1.inheritAttrs = false;
const getDotCount = function(spec) {
let dots;
if (spec.infinite) {
dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
} else {
dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
}
return dots;
};
const Dots = (_, _ref) => {
let {
attrs
} = _ref;
const {
slideCount,
slidesToScroll,
slidesToShow,
infinite,
currentSlide,
appendDots,
customPaging,
clickHandler,
dotsClass,
onMouseenter,
onMouseover,
onMouseleave
} = attrs;
const dotCount = getDotCount({
slideCount,
slidesToScroll,
slidesToShow,
infinite
});
const mouseEvents = {
onMouseenter,
onMouseover,
onMouseleave
};
let dots = [];
for (let i = 0; i < dotCount; i++) {
let onClick = function(e) {
if (e) {
e.preventDefault();
}
clickHandler(dotOptions);
};
const _rightBound = (i + 1) * slidesToScroll - 1;
const rightBound = infinite ? _rightBound : clamp(_rightBound, 0, slideCount - 1);
const _leftBound = rightBound - (slidesToScroll - 1);
const leftBound = infinite ? _leftBound : clamp(_leftBound, 0, slideCount - 1);
const className = classNames({
"slick-active": infinite ? currentSlide >= leftBound && currentSlide <= rightBound : currentSlide === leftBound
});
const dotOptions = {
message: "dots",
index: i,
slidesToScroll,
currentSlide
};
dots = dots.concat(createVNode("li", {
"key": i,
"class": className
}, [cloneElement(customPaging({
i
}), {
onClick
})]));
}
return cloneElement(appendDots({
dots
}), _extends({
class: dotsClass
}, mouseEvents));
};
Dots.inheritAttrs = false;
function noop$8() {
}
function handler(options, handle, e) {
if (e) {
e.preventDefault();
}
handle(options, e);
}
const PrevArrow = (_, _ref) => {
let {
attrs
} = _ref;
const {
clickHandler,
infinite,
currentSlide,
slideCount,
slidesToShow
} = attrs;
const prevClasses = {
"slick-arrow": true,
"slick-prev": true
};
let prevHandler = function(e) {
handler({
message: "previous"
}, clickHandler, e);
};
if (!infinite && (currentSlide === 0 || slideCount <= slidesToShow)) {
prevClasses["slick-disabled"] = true;
prevHandler = noop$8;
}
const prevArrowProps = {
key: "0",
"data-role": "none",
class: prevClasses,
style: {
display: "block"
},
onClick: prevHandler
};
const customProps = {
currentSlide,
slideCount
};
let prevArrow;
if (attrs.prevArrow) {
prevArrow = cloneElement(attrs.prevArrow(_extends(_extends({}, prevArrowProps), customProps)), {
key: "0",
class: prevClasses,
style: {
display: "block"
},
onClick: prevHandler
}, false);
} else {
prevArrow = createVNode("button", _objectSpread$W({
"key": "0",
"type": "button"
}, prevArrowProps), [" ", createTextVNode("Previous")]);
}
return prevArrow;
};
PrevArrow.inheritAttrs = false;
const NextArrow = (_, _ref2) => {
let {
attrs
} = _ref2;
const {
clickHandler,
currentSlide,
slideCount
} = attrs;
const nextClasses = {
"slick-arrow": true,
"slick-next": true
};
let nextHandler = function(e) {
handler({
message: "next"
}, clickHandler, e);
};
if (!canGoNext(attrs)) {
nextClasses["slick-disabled"] = true;
nextHandler = noop$8;
}
const nextArrowProps = {
key: "1",
"data-role": "none",
class: classNames(nextClasses),
style: {
display: "block"
},
onClick: nextHandler
};
const customProps = {
currentSlide,
slideCount
};
let nextArrow;
if (attrs.nextArrow) {
nextArrow = cloneElement(attrs.nextArrow(_extends(_extends({}, nextArrowProps), customProps)), {
key: "1",
class: classNames(nextClasses),
style: {
display: "block"
},
onClick: nextHandler
}, false);
} else {
nextArrow = createVNode("button", _objectSpread$W({
"key": "1",
"type": "button"
}, nextArrowProps), [" ", createTextVNode("Next")]);
}
return nextArrow;
};
NextArrow.inheritAttrs = false;
var __rest$W = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function noop$7() {
}
const InnerSlider = {
name: "InnerSlider",
mixins: [BaseMixin],
inheritAttrs: false,
props: _extends({}, defaultProps$2),
data() {
this.preProps = _extends({}, this.$props);
this.list = null;
this.track = null;
this.callbackTimers = [];
this.clickable = true;
this.debouncedResize = null;
const ssrState = this.ssrInit();
return _extends(_extends(_extends({}, initialState), {
currentSlide: this.initialSlide,
slideCount: this.children.length
}), ssrState);
},
watch: {
autoplay(newValue, oldValue) {
if (!oldValue && newValue) {
this.handleAutoPlay("playing");
} else if (newValue) {
this.handleAutoPlay("update");
} else {
this.pause("paused");
}
},
__propsSymbol__() {
const nextProps = this.$props;
const spec = _extends(_extends({
listRef: this.list,
trackRef: this.track
}, nextProps), this.$data);
let setTrackStyle = false;
for (const key2 of Object.keys(this.preProps)) {
if (!nextProps.hasOwnProperty(key2)) {
setTrackStyle = true;
break;
}
if (typeof nextProps[key2] === "object" || typeof nextProps[key2] === "function" || typeof nextProps[key2] === "symbol") {
continue;
}
if (nextProps[key2] !== this.preProps[key2]) {
setTrackStyle = true;
break;
}
}
this.updateState(spec, setTrackStyle, () => {
if (this.currentSlide >= nextProps.children.length) {
this.changeSlide({
message: "index",
index: nextProps.children.length - nextProps.slidesToShow,
currentSlide: this.currentSlide
});
}
if (!this.preProps.autoplay && nextProps.autoplay) {
this.handleAutoPlay("playing");
} else if (nextProps.autoplay) {
this.handleAutoPlay("update");
} else {
this.pause("paused");
}
});
this.preProps = _extends({}, nextProps);
}
},
mounted() {
this.__emit("init");
if (this.lazyLoad) {
const slidesToLoad = getOnDemandLazySlides(_extends(_extends({}, this.$props), this.$data));
if (slidesToLoad.length > 0) {
this.setState((prevState) => ({
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
}));
this.__emit("lazyLoad", slidesToLoad);
}
}
this.$nextTick(() => {
const spec = _extends({
listRef: this.list,
trackRef: this.track,
children: this.children
}, this.$props);
this.updateState(spec, true, () => {
this.adaptHeight();
this.autoplay && this.handleAutoPlay("playing");
});
if (this.lazyLoad === "progressive") {
this.lazyLoadTimer = setInterval(this.progressiveLazyLoad, 1e3);
}
this.ro = new ResizeObserver$2(() => {
if (this.animating) {
this.onWindowResized(false);
this.callbackTimers.push(setTimeout(() => this.onWindowResized(), this.speed));
} else {
this.onWindowResized();
}
});
this.ro.observe(this.list);
(void 0).querySelectorAll && Array.prototype.forEach.call((void 0).querySelectorAll(".slick-slide"), (slide) => {
slide.onfocus = this.$props.pauseOnFocus ? this.onSlideFocus : null;
slide.onblur = this.$props.pauseOnFocus ? this.onSlideBlur : null;
});
if ((void 0).addEventListener) {
(void 0).addEventListener("resize", this.onWindowResized);
} else {
(void 0).attachEvent("onresize", this.onWindowResized);
}
});
},
beforeUnmount() {
var _a;
if (this.animationEndCallback) {
clearTimeout(this.animationEndCallback);
}
if (this.lazyLoadTimer) {
clearInterval(this.lazyLoadTimer);
}
if (this.callbackTimers.length) {
this.callbackTimers.forEach((timer) => clearTimeout(timer));
this.callbackTimers = [];
}
if ((void 0).addEventListener) {
(void 0).removeEventListener("resize", this.onWindowResized);
} else {
(void 0).detachEvent("onresize", this.onWindowResized);
}
if (this.autoplayTimer) {
clearInterval(this.autoplayTimer);
}
(_a = this.ro) === null || _a === void 0 ? void 0 : _a.disconnect();
},
updated() {
this.checkImagesLoad();
this.__emit("reInit");
if (this.lazyLoad) {
const slidesToLoad = getOnDemandLazySlides(_extends(_extends({}, this.$props), this.$data));
if (slidesToLoad.length > 0) {
this.setState((prevState) => ({
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
}));
this.__emit("lazyLoad");
}
}
this.adaptHeight();
},
methods: {
listRefHandler(ref2) {
this.list = ref2;
},
trackRefHandler(ref2) {
this.track = ref2;
},
adaptHeight() {
if (this.adaptiveHeight && this.list) {
const elem = this.list.querySelector(`[data-index="${this.currentSlide}"]`);
this.list.style.height = getHeight(elem) + "px";
}
},
onWindowResized(setTrackStyle) {
if (this.debouncedResize) this.debouncedResize.cancel();
this.debouncedResize = debounce$1(() => this.resizeWindow(setTrackStyle), 50);
this.debouncedResize();
},
resizeWindow() {
let setTrackStyle = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
const isTrackMounted = Boolean(this.track);
if (!isTrackMounted) return;
const spec = _extends(_extends({
listRef: this.list,
trackRef: this.track,
children: this.children
}, this.$props), this.$data);
this.updateState(spec, setTrackStyle, () => {
if (this.autoplay) {
this.handleAutoPlay("update");
} else {
this.pause("paused");
}
});
this.setState({
animating: false
});
clearTimeout(this.animationEndCallback);
delete this.animationEndCallback;
},
updateState(spec, setTrackStyle, callback) {
const updatedState = initializedState(spec);
spec = _extends(_extends(_extends({}, spec), updatedState), {
slideIndex: updatedState.currentSlide
});
const targetLeft = getTrackLeft(spec);
spec = _extends(_extends({}, spec), {
left: targetLeft
});
const trackStyle = getTrackCSS(spec);
if (setTrackStyle || this.children.length !== spec.children.length) {
updatedState["trackStyle"] = trackStyle;
}
this.setState(updatedState, callback);
},
ssrInit() {
const children = this.children;
if (this.variableWidth) {
let trackWidth2 = 0;
let trackLeft2 = 0;
const childrenWidths = [];
const preClones = getPreClones(_extends(_extends(_extends({}, this.$props), this.$data), {
slideCount: children.length
}));
const postClones = getPostClones(_extends(_extends(_extends({}, this.$props), this.$data), {
slideCount: children.length
}));
children.forEach((child) => {
var _a, _b;
const childWidth = ((_b = (_a = child.props.style) === null || _a === void 0 ? void 0 : _a.width) === null || _b === void 0 ? void 0 : _b.split("px")[0]) || 0;
childrenWidths.push(childWidth);
trackWidth2 += childWidth;
});
for (let i = 0; i < preClones; i++) {
trackLeft2 += childrenWidths[childrenWidths.length - 1 - i];
trackWidth2 += childrenWidths[childrenWidths.length - 1 - i];
}
for (let i = 0; i < postClones; i++) {
trackWidth2 += childrenWidths[i];
}
for (let i = 0; i < this.currentSlide; i++) {
trackLeft2 += childrenWidths[i];
}
const trackStyle2 = {
width: trackWidth2 + "px",
left: -trackLeft2 + "px"
};
if (this.centerMode) {
const currentWidth = `${childrenWidths[this.currentSlide]}px`;
trackStyle2.left = `calc(${trackStyle2.left} + (100% - ${currentWidth}) / 2 ) `;
}
return {
trackStyle: trackStyle2
};
}
const childrenCount = children.length;
const spec = _extends(_extends(_extends({}, this.$props), this.$data), {
slideCount: childrenCount
});
const slideCount = getPreClones(spec) + getPostClones(spec) + childrenCount;
const trackWidth = 100 / this.slidesToShow * slideCount;
const slideWidth = 100 / slideCount;
let trackLeft = -slideWidth * (getPreClones(spec) + this.currentSlide) * trackWidth / 100;
if (this.centerMode) {
trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
}
const trackStyle = {
width: trackWidth + "%",
left: trackLeft + "%"
};
return {
slideWidth: slideWidth + "%",
trackStyle
};
},
checkImagesLoad() {
const images = this.list && this.list.querySelectorAll && this.list.querySelectorAll(".slick-slide img") || [];
const imagesCount = images.length;
let loadedCount = 0;
Array.prototype.forEach.call(images, (image) => {
const handler2 = () => ++loadedCount && loadedCount >= imagesCount && this.onWindowResized();
if (!image.onclick) {
image.onclick = () => image.parentNode.focus();
} else {
const prevClickHandler = image.onclick;
image.onclick = () => {
prevClickHandler();
image.parentNode.focus();
};
}
if (!image.onload) {
if (this.$props.lazyLoad) {
image.onload = () => {
this.adaptHeight();
this.callbackTimers.push(setTimeout(this.onWindowResized, this.speed));
};
} else {
image.onload = handler2;
image.onerror = () => {
handler2();
this.__emit("lazyLoadError");
};
}
}
});
},
progressiveLazyLoad() {
const slidesToLoad = [];
const spec = _extends(_extends({}, this.$props), this.$data);
for (let index2 = this.currentSlide; index2 < this.slideCount + getPostClones(spec); index2++) {
if (this.lazyLoadedList.indexOf(index2) < 0) {
slidesToLoad.push(index2);
break;
}
}
for (let index2 = this.currentSlide - 1; index2 >= -getPreClones(spec); index2--) {
if (this.lazyLoadedList.indexOf(index2) < 0) {
slidesToLoad.push(index2);
break;
}
}
if (slidesToLoad.length > 0) {
this.setState((state) => ({
lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
}));
this.__emit("lazyLoad", slidesToLoad);
} else {
if (this.lazyLoadTimer) {
clearInterval(this.lazyLoadTimer);
delete this.lazyLoadTimer;
}
}
},
slideHandler(index2) {
let dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const {
asNavFor,
beforeChange,
speed,
afterChange
} = this.$props;
const {
state,
nextState
} = slideHandler(_extends(_extends(_extends({
index: index2
}, this.$props), this.$data), {
trackRef: this.track,
useCSS: this.useCSS && !dontAnimate
}));
if (!state) return;
beforeChange && beforeChange(this.currentSlide, state.currentSlide);
const slidesToLoad = state.lazyLoadedList.filter((value) => this.lazyLoadedList.indexOf(value) < 0);
if (this.$attrs.onLazyLoad && slidesToLoad.length > 0) {
this.__emit("lazyLoad", slidesToLoad);
}
if (!this.$props.waitForAnimate && this.animationEndCallback) {
clearTimeout(this.animationEndCallback);
afterChange && afterChange(this.currentSlide);
delete this.animationEndCallback;
}
this.setState(state, () => {
if (asNavFor && this.asNavForIndex !== index2) {
this.asNavForIndex = index2;
asNavFor.innerSlider.slideHandler(index2);
}
if (!nextState) return;
this.animationEndCallback = setTimeout(() => {
const {
animating
} = nextState, firstBatch = __rest$W(nextState, ["animating"]);
this.setState(firstBatch, () => {
this.callbackTimers.push(setTimeout(() => this.setState({
animating
}), 10));
afterChange && afterChange(state.currentSlide);
delete this.animationEndCallback;
});
}, speed);
});
},
changeSlide(options) {
let dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const spec = _extends(_extends({}, this.$props), this.$data);
const targetSlide = changeSlide(spec, options);
if (targetSlide !== 0 && !targetSlide) return;
if (dontAnimate === true) {
this.slideHandler(targetSlide, dontAnimate);
} else {
this.slideHandler(targetSlide);
}
this.$props.autoplay && this.handleAutoPlay("update");
if (this.$props.focusOnSelect) {
const nodes = this.list.querySelectorAll(".slick-current");
nodes[0] && nodes[0].focus();
}
},
clickHandler(e) {
if (this.clickable === false) {
e.stopPropagation();
e.preventDefault();
}
this.clickable = true;
},
keyHandler(e) {
const dir = keyHandler(e, this.accessibility, this.rtl);
dir !== "" && this.changeSlide({
message: dir
});
},
selectHandler(options) {
this.changeSlide(options);
},
disableBodyScroll() {
const preventDefault = (e) => {
e = e || (void 0).event;
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
};
(void 0).ontouchmove = preventDefault;
},
enableBodyScroll() {
(void 0).ontouchmove = null;
},
swipeStart(e) {
if (this.verticalSwiping) {
this.disableBodyScroll();
}
const state = swipeStart(e, this.swipe, this.draggable);
state !== "" && this.setState(state);
},
swipeMove(e) {
const state = swipeMove(e, _extends(_extends(_extends({}, this.$props), this.$data), {
trackRef: this.track,
listRef: this.list,
slideIndex: this.currentSlide
}));
if (!state) return;
if (state["swiping"]) {
this.clickable = false;
}
this.setState(state);
},
swipeEnd(e) {
const state = swipeEnd(e, _extends(_extends(_extends({}, this.$props), this.$data), {
trackRef: this.track,
listRef: this.list,
slideIndex: this.currentSlide
}));
if (!state) return;
const triggerSlideHandler = state["triggerSlideHandler"];
delete state["triggerSlideHandler"];
this.setState(state);
if (triggerSlideHandler === void 0) return;
this.slideHandler(triggerSlideHandler);
if (this.$props.verticalSwiping) {
this.enableBodyScroll();
}
},
touchEnd(e) {
this.swipeEnd(e);
this.clickable = true;
},
slickPrev() {
this.callbackTimers.push(setTimeout(() => this.changeSlide({
message: "previous"
}), 0));
},
slickNext() {
this.callbackTimers.push(setTimeout(() => this.changeSlide({
message: "next"
}), 0));
},
slickGoTo(slide) {
let dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
slide = Number(slide);
if (isNaN(slide)) return "";
this.callbackTimers.push(setTimeout(() => this.changeSlide({
message: "index",
index: slide,
currentSlide: this.currentSlide
}, dontAnimate), 0));
},
play() {
let nextIndex;
if (this.rtl) {
nextIndex = this.currentSlide - this.slidesToScroll;
} else {
if (canGoNext(_extends(_extends({}, this.$props), this.$data))) {
nextIndex = this.currentSlide + this.slidesToScroll;
} else {
return false;
}
}
this.slideHandler(nextIndex);
},
handleAutoPlay(playType) {
if (this.autoplayTimer) {
clearInterval(this.autoplayTimer);
}
const autoplaying = this.autoplaying;
if (playType === "update") {
if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
return;
}
} else if (playType === "leave") {
if (autoplaying === "paused" || autoplaying === "focused") {
return;
}
} else if (playType === "blur") {
if (autoplaying === "paused" || autoplaying === "hovered") {
return;
}
}
this.autoplayTimer = setInterval(this.play, this.autoplaySpeed + 50);
this.setState({
autoplaying: "playing"
});
},
pause(pauseType) {
if (this.autoplayTimer) {
clearInterval(this.autoplayTimer);
this.autoplayTimer = null;
}
const autoplaying = this.autoplaying;
if (pauseType === "paused") {
this.setState({
autoplaying: "paused"
});
} else if (pauseType === "focused") {
if (autoplaying === "hovered" || autoplaying === "playing") {
this.setState({
autoplaying: "focused"
});
}
} else {
if (autoplaying === "playing") {
this.setState({
autoplaying: "hovered"
});
}
}
},
onDotsOver() {
this.autoplay && this.pause("hovered");
},
onDotsLeave() {
this.autoplay && this.autoplaying === "hovered" && this.handleAutoPlay("leave");
},
onTrackOver() {
this.autoplay && this.pause("hovered");
},
onTrackLeave() {
this.autoplay && this.autoplaying === "hovered" && this.handleAutoPlay("leave");
},
onSlideFocus() {
this.autoplay && this.pause("focused");
},
onSlideBlur() {
this.autoplay && this.autoplaying === "focused" && this.handleAutoPlay("blur");
},
customPaging(_ref) {
let {
i
} = _ref;
return createVNode("button", null, [i + 1]);
},
appendDots(_ref2) {
let {
dots
} = _ref2;
return createVNode("ul", {
"style": {
display: "block"
}
}, [dots]);
}
},
render() {
const className = classNames("slick-slider", this.$attrs.class, {
"slick-vertical": this.vertical,
"slick-initialized": true
});
const spec = _extends(_extends({}, this.$props), this.$data);
let trackProps = extractObject(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding", "targetSlide", "useCSS"]);
const {
pauseOnHover
} = this.$props;
trackProps = _extends(_extends({}, trackProps), {
focusOnSelect: this.focusOnSelect && this.clickable ? this.selectHandler : null,
ref: this.trackRefHandler,
onMouseleave: pauseOnHover ? this.onTrackLeave : noop$7,
onMouseover: pauseOnHover ? this.onTrackOver : noop$7
});
let dots;
if (this.dots === true && this.slideCount >= this.slidesToShow) {
let dotProps = extractObject(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "infinite", "appendDots"]);
dotProps.customPaging = this.customPaging;
dotProps.appendDots = this.appendDots;
const {
customPaging,
appendDots
} = this.$slots;
if (customPaging) {
dotProps.customPaging = customPaging;
}
if (appendDots) {
dotProps.appendDots = appendDots;
}
const {
pauseOnDotsHover
} = this.$props;
dotProps = _extends(_extends({}, dotProps), {
clickHandler: this.changeSlide,
onMouseover: pauseOnDotsHover ? this.onDotsOver : noop$7,
onMouseleave: pauseOnDotsHover ? this.onDotsLeave : noop$7
});
dots = createVNode(Dots, dotProps, null);
}
let prevArrow, nextArrow;
const arrowProps = extractObject(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow"]);
arrowProps.clickHandler = this.changeSlide;
const {
prevArrow: prevArrowCustom,
nextArrow: nextArrowCustom
} = this.$slots;
if (prevArrowCustom) {
arrowProps.prevArrow = prevArrowCustom;
}
if (nextArrowCustom) {
arrowProps.nextArrow = nextArrowCustom;
}
if (this.arrows) {
prevArrow = createVNode(PrevArrow, arrowProps, null);
nextArrow = createVNode(NextArrow, arrowProps, null);
}
let verticalHeightStyle = null;
if (this.vertical) {
verticalHeightStyle = {
height: typeof this.listHeight === "number" ? `${this.listHeight}px` : this.listHeight
};
}
let centerPaddingStyle = null;
if (this.vertical === false) {
if (this.centerMode === true) {
centerPaddingStyle = {
padding: "0px " + this.centerPadding
};
}
} else {
if (this.centerMode === true) {
centerPaddingStyle = {
padding: this.centerPadding + " 0px"
};
}
}
const listStyle = _extends(_extends({}, verticalHeightStyle), centerPaddingStyle);
const touchMove = this.touchMove;
let listProps2 = {
ref: this.listRefHandler,
class: "slick-list",
style: listStyle,
onClick: this.clickHandler,
onMousedown: touchMove ? this.swipeStart : noop$7,
onMousemove: this.dragging && touchMove ? this.swipeMove : noop$7,
onMouseup: touchMove ? this.swipeEnd : noop$7,
onMouseleave: this.dragging && touchMove ? this.swipeEnd : noop$7,
[supportsPassive ? "onTouchstartPassive" : "onTouchstart"]: touchMove ? this.swipeStart : noop$7,
[supportsPassive ? "onTouchmovePassive" : "onTouchmove"]: this.dragging && touchMove ? this.swipeMove : noop$7,
onTouchend: touchMove ? this.touchEnd : noop$7,
onTouchcancel: this.dragging && touchMove ? this.swipeEnd : noop$7,
onKeydown: this.accessibility ? this.keyHandler : noop$7
};
let innerSliderProps = {
class: className,
dir: "ltr",
style: this.$attrs.style
};
if (this.unslick) {
listProps2 = {
class: "slick-list",
ref: this.listRefHandler
};
innerSliderProps = {
class: className
};
}
return createVNode("div", innerSliderProps, [!this.unslick ? prevArrow : "", createVNode("div", listProps2, [createVNode(Track$1, trackProps, {
default: () => [this.children]
})]), !this.unslick ? nextArrow : "", !this.unslick ? dots : ""]);
}
};
const Slider$3 = defineComponent({
name: "Slider",
mixins: [BaseMixin],
inheritAttrs: false,
props: _extends({}, defaultProps$2),
data() {
this._responsiveMediaHandlers = [];
return {
breakpoint: null
};
},
// handles responsive breakpoints
mounted() {
if (this.responsive) {
const breakpoints = this.responsive.map((breakpt) => breakpt.breakpoint);
breakpoints.sort((x, y) => x - y);
breakpoints.forEach((breakpoint, index2) => {
if (index2 === 0) {
json2mq({
minWidth: 0,
maxWidth: breakpoint
});
} else {
json2mq({
minWidth: breakpoints[index2 - 1] + 1,
maxWidth: breakpoint
});
}
});
json2mq({
minWidth: breakpoints.slice(-1)[0]
});
}
},
beforeUnmount() {
this._responsiveMediaHandlers.forEach(function(obj) {
obj.mql.removeListener(obj.listener);
});
},
methods: {
innerSliderRefHandler(ref2) {
this.innerSlider = ref2;
},
media(query, handler2) {
const mql = (void 0).matchMedia(query);
const listener = (_ref) => {
let {
matches
} = _ref;
if (matches) {
handler2();
}
};
mql.addListener(listener);
listener(mql);
this._responsiveMediaHandlers.push({
mql,
query,
listener
});
},
slickPrev() {
var _a;
(_a = this.innerSlider) === null || _a === void 0 ? void 0 : _a.slickPrev();
},
slickNext() {
var _a;
(_a = this.innerSlider) === null || _a === void 0 ? void 0 : _a.slickNext();
},
slickGoTo(slide) {
let dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var _a;
(_a = this.innerSlider) === null || _a === void 0 ? void 0 : _a.slickGoTo(slide, dontAnimate);
},
slickPause() {
var _a;
(_a = this.innerSlider) === null || _a === void 0 ? void 0 : _a.pause("paused");
},
slickPlay() {
var _a;
(_a = this.innerSlider) === null || _a === void 0 ? void 0 : _a.handleAutoPlay("play");
}
},
render() {
var _a;
let settings;
let newProps;
if (this.breakpoint) {
newProps = this.responsive.filter((resp) => resp.breakpoint === this.breakpoint);
settings = newProps[0].settings === "unslick" ? "unslick" : _extends(_extends({}, this.$props), newProps[0].settings);
} else {
settings = _extends({}, this.$props);
}
if (settings.centerMode) {
if (settings.slidesToScroll > 1 && "production" !== "production") ;
settings.slidesToScroll = 1;
}
if (settings.fade) {
if (settings.slidesToShow > 1 && "production" !== "production") ;
if (settings.slidesToScroll > 1 && "production" !== "production") ;
settings.slidesToShow = 1;
settings.slidesToScroll = 1;
}
let children = getSlot(this) || [];
children = children.filter((child) => {
if (typeof child === "string") {
return !!child.trim();
}
return !!child;
});
if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
console.warn(`variableWidth is not supported in case of rows > 1 or slidesPerRow > 1`);
settings.variableWidth = false;
}
const newChildren = [];
let currentWidth = null;
for (let i = 0; i < children.length; i += settings.rows * settings.slidesPerRow) {
const newSlide = [];
for (let j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) {
const row = [];
for (let k = j; k < j + settings.slidesPerRow; k += 1) {
if (settings.variableWidth && ((_a = children[k].props) === null || _a === void 0 ? void 0 : _a.style)) {
currentWidth = children[k].props.style.width;
}
if (k >= children.length) break;
row.push(cloneElement(children[k], {
key: 100 * i + 10 * j + k,
tabindex: -1,
style: {
width: `${100 / settings.slidesPerRow}%`,
display: "inline-block"
}
}));
}
newSlide.push(createVNode("div", {
"key": 10 * i + j
}, [row]));
}
if (settings.variableWidth) {
newChildren.push(createVNode("div", {
"key": i,
"style": {
width: currentWidth
}
}, [newSlide]));
} else {
newChildren.push(createVNode("div", {
"key": i
}, [newSlide]));
}
}
if (settings === "unslick") {
const className = "regular slider " + (this.className || "");
return createVNode("div", {
"class": className
}, [children]);
} else if (newChildren.length <= settings.slidesToShow) {
settings.unslick = true;
}
const sliderProps2 = _extends(_extends(_extends({}, this.$attrs), settings), {
children: newChildren,
ref: this.innerSliderRefHandler
});
return createVNode(InnerSlider, _objectSpread$W(_objectSpread$W({}, sliderProps2), {}, {
"__propsSymbol__": []
}), this.$slots);
}
});
const genCarouselStyle = (token) => {
const {
componentCls,
antCls,
carouselArrowSize,
carouselDotOffset,
marginXXS
} = token;
const arrowOffset = -carouselArrowSize * 1.25;
const carouselDotMargin = marginXXS;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
".slick-slider": {
position: "relative",
display: "block",
boxSizing: "border-box",
touchAction: "pan-y",
WebkitTouchCallout: "none",
WebkitTapHighlightColor: "transparent",
".slick-track, .slick-list": {
transform: "translate3d(0, 0, 0)",
touchAction: "pan-y"
}
},
".slick-list": {
position: "relative",
display: "block",
margin: 0,
padding: 0,
overflow: "hidden",
"&:focus": {
outline: "none"
},
"&.dragging": {
cursor: "pointer"
},
".slick-slide": {
pointerEvents: "none",
// https://github.com/ant-design/ant-design/issues/23294
[`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
visibility: "hidden"
},
"&.slick-active": {
pointerEvents: "auto",
[`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
visibility: "visible"
}
},
// fix Carousel content height not match parent node
// when children is empty node
// https://github.com/ant-design/ant-design/issues/25878
"> div > div": {
verticalAlign: "bottom"
}
}
},
".slick-track": {
position: "relative",
top: 0,
insetInlineStart: 0,
display: "block",
"&::before, &::after": {
display: "table",
content: '""'
},
"&::after": {
clear: "both"
}
},
".slick-slide": {
display: "none",
float: "left",
height: "100%",
minHeight: 1,
img: {
display: "block"
},
"&.dragging img": {
pointerEvents: "none"
}
},
".slick-initialized .slick-slide": {
display: "block"
},
".slick-vertical .slick-slide": {
display: "block",
height: "auto"
},
".slick-arrow.slick-hidden": {
display: "none"
},
// Arrows
".slick-prev, .slick-next": {
position: "absolute",
top: "50%",
display: "block",
width: carouselArrowSize,
height: carouselArrowSize,
marginTop: -carouselArrowSize / 2,
padding: 0,
color: "transparent",
fontSize: 0,
lineHeight: 0,
background: "transparent",
border: 0,
outline: "none",
cursor: "pointer",
"&:hover, &:focus": {
color: "transparent",
background: "transparent",
outline: "none",
"&::before": {
opacity: 1
}
},
"&.slick-disabled::before": {
opacity: 0.25
}
},
".slick-prev": {
insetInlineStart: arrowOffset,
"&::before": {
content: '"←"'
}
},
".slick-next": {
insetInlineEnd: arrowOffset,
"&::before": {
content: '"→"'
}
},
// Dots
".slick-dots": {
position: "absolute",
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
zIndex: 15,
display: "flex !important",
justifyContent: "center",
paddingInlineStart: 0,
listStyle: "none",
"&-bottom": {
bottom: carouselDotOffset
},
"&-top": {
top: carouselDotOffset,
bottom: "auto"
},
li: {
position: "relative",
display: "inline-block",
flex: "0 1 auto",
boxSizing: "content-box",
width: token.dotWidth,
height: token.dotHeight,
marginInline: carouselDotMargin,
padding: 0,
textAlign: "center",
textIndent: -999,
verticalAlign: "top",
transition: `all ${token.motionDurationSlow}`,
button: {
position: "relative",
display: "block",
width: "100%",
height: token.dotHeight,
padding: 0,
color: "transparent",
fontSize: 0,
background: token.colorBgContainer,
border: 0,
borderRadius: 1,
outline: "none",
cursor: "pointer",
opacity: 0.3,
transition: `all ${token.motionDurationSlow}`,
"&: hover, &:focus": {
opacity: 0.75
},
"&::after": {
position: "absolute",
inset: -carouselDotMargin,
content: '""'
}
},
"&.slick-active": {
width: token.dotWidthActive,
"& button": {
background: token.colorBgContainer,
opacity: 1
},
"&: hover, &:focus": {
opacity: 1
}
}
}
}
})
};
};
const genCarouselVerticalStyle = (token) => {
const {
componentCls,
carouselDotOffset,
marginXXS
} = token;
const reverseSizeOfDot = {
width: token.dotHeight,
height: token.dotWidth
};
return {
[`${componentCls}-vertical`]: {
".slick-dots": {
top: "50%",
bottom: "auto",
flexDirection: "column",
width: token.dotHeight,
height: "auto",
margin: 0,
transform: "translateY(-50%)",
"&-left": {
insetInlineEnd: "auto",
insetInlineStart: carouselDotOffset
},
"&-right": {
insetInlineEnd: carouselDotOffset,
insetInlineStart: "auto"
},
li: _extends(_extends({}, reverseSizeOfDot), {
margin: `${marginXXS}px 0`,
verticalAlign: "baseline",
button: reverseSizeOfDot,
"&.slick-active": _extends(_extends({}, reverseSizeOfDot), {
button: reverseSizeOfDot
})
})
}
}
};
};
const genCarouselRtlStyle = (token) => {
const {
componentCls
} = token;
return [{
[`${componentCls}-rtl`]: {
direction: "rtl",
// Dots
".slick-dots": {
[`${componentCls}-rtl&`]: {
flexDirection: "row-reverse"
}
}
}
}, {
[`${componentCls}-vertical`]: {
".slick-dots": {
[`${componentCls}-rtl&`]: {
flexDirection: "column"
}
}
}
}];
};
const useStyle$D = genComponentStyleHook("Carousel", (token) => {
const {
controlHeightLG,
controlHeightSM
} = token;
const carouselToken = merge(token, {
carouselArrowSize: controlHeightLG / 2,
carouselDotOffset: controlHeightSM / 2
});
return [genCarouselStyle(carouselToken), genCarouselVerticalStyle(carouselToken), genCarouselRtlStyle(carouselToken)];
}, {
dotWidth: 16,
dotHeight: 3,
dotWidthActive: 24
});
var __rest$V = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const carouselProps = () => ({
effect: stringType(),
dots: booleanType(true),
vertical: booleanType(),
autoplay: booleanType(),
easing: String,
beforeChange: functionType(),
afterChange: functionType(),
// style: PropTypes.React.CSSProperties,
prefixCls: String,
accessibility: booleanType(),
nextArrow: PropTypes.any,
prevArrow: PropTypes.any,
pauseOnHover: booleanType(),
// className: String,
adaptiveHeight: booleanType(),
arrows: booleanType(false),
autoplaySpeed: Number,
centerMode: booleanType(),
centerPadding: String,
cssEase: String,
dotsClass: String,
draggable: booleanType(false),
fade: booleanType(),
focusOnSelect: booleanType(),
infinite: booleanType(),
initialSlide: Number,
lazyLoad: stringType(),
rtl: booleanType(),
slide: String,
slidesToShow: Number,
slidesToScroll: Number,
speed: Number,
swipe: booleanType(),
swipeToSlide: booleanType(),
swipeEvent: functionType(),
touchMove: booleanType(),
touchThreshold: Number,
variableWidth: booleanType(),
useCSS: booleanType(),
slickGoTo: Number,
responsive: Array,
dotPosition: stringType(),
verticalSwiping: booleanType(false)
});
const Carousel = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACarousel",
inheritAttrs: false,
props: carouselProps(),
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
const slickRef = ref();
const goTo = function(slide) {
let dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
var _a;
(_a = slickRef.value) === null || _a === void 0 ? void 0 : _a.slickGoTo(slide, dontAnimate);
};
expose({
goTo,
autoplay: (palyType) => {
var _a, _b;
(_b = (_a = slickRef.value) === null || _a === void 0 ? void 0 : _a.innerSlider) === null || _b === void 0 ? void 0 : _b.handleAutoPlay(palyType);
},
prev: () => {
var _a;
(_a = slickRef.value) === null || _a === void 0 ? void 0 : _a.slickPrev();
},
next: () => {
var _a;
(_a = slickRef.value) === null || _a === void 0 ? void 0 : _a.slickNext();
},
innerSlider: computed(() => {
var _a;
return (_a = slickRef.value) === null || _a === void 0 ? void 0 : _a.innerSlider;
})
});
watchEffect(() => {
warning(props2.vertical === void 0);
});
const {
prefixCls,
direction
} = useConfigInject("carousel", props2);
const [wrapSSR, hashId] = useStyle$D(prefixCls);
const dotPosition = computed(() => {
if (props2.dotPosition) return props2.dotPosition;
if (props2.vertical !== void 0) return props2.vertical ? "right" : "bottom";
return "bottom";
});
const vertical = computed(() => dotPosition.value === "left" || dotPosition.value === "right");
const dsClass = computed(() => {
const dotsClass = "slick-dots";
return classNames({
[dotsClass]: true,
[`${dotsClass}-${dotPosition.value}`]: true,
[`${props2.dotsClass}`]: !!props2.dotsClass
});
});
return () => {
const {
dots,
arrows,
draggable,
effect
} = props2;
const {
class: cls,
style
} = attrs, restAttrs = __rest$V(attrs, ["class", "style"]);
const fade = effect === "fade" ? true : props2.fade;
const className = classNames(prefixCls.value, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-vertical`]: vertical.value,
[`${cls}`]: !!cls
}, hashId.value);
return wrapSSR(createVNode("div", {
"class": className,
"style": style
}, [createVNode(Slider$3, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": slickRef
}, props2), restAttrs), {}, {
"dots": !!dots,
"dotsClass": dsClass.value,
"arrows": arrows,
"draggable": draggable,
"fade": fade,
"vertical": vertical.value
}), slots)]));
};
}
});
const index$l = withInstall(Carousel);
const VALUE_SPLIT = "__RC_CASCADER_SPLIT__";
const SHOW_PARENT$1 = "SHOW_PARENT";
const SHOW_CHILD$1 = "SHOW_CHILD";
function toPathKey(value) {
return value.join(VALUE_SPLIT);
}
function toPathKeys(value) {
return value.map(toPathKey);
}
function toPathValueStr(pathKey) {
return pathKey.split(VALUE_SPLIT);
}
function fillFieldNames$2(fieldNames) {
const {
label,
value,
children
} = fieldNames || {};
const val = value || "value";
return {
label: label || "label",
value: val,
key: val,
children: children || "children"
};
}
function isLeaf(option, fieldNames) {
var _a, _b;
return (_a = option.isLeaf) !== null && _a !== void 0 ? _a : !((_b = option[fieldNames.children]) === null || _b === void 0 ? void 0 : _b.length);
}
const TreeContextKey = Symbol("TreeContextKey");
const TreeContext = defineComponent({
compatConfig: {
MODE: 3
},
name: "TreeContext",
props: {
value: {
type: Object
}
},
setup(props2, _ref) {
let {
slots
} = _ref;
provide(TreeContextKey, computed(() => props2.value));
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const useInjectTreeContext = () => {
return inject(TreeContextKey, computed(() => ({})));
};
const KeysStateKey = Symbol("KeysStateKey");
const useProvideKeysState = (state) => {
provide(KeysStateKey, state);
};
const useInjectKeysState = () => {
return inject(KeysStateKey, {
expandedKeys: shallowRef([]),
selectedKeys: shallowRef([]),
loadedKeys: shallowRef([]),
loadingKeys: shallowRef([]),
checkedKeys: shallowRef([]),
halfCheckedKeys: shallowRef([]),
expandedKeysSet: computed(() => /* @__PURE__ */ new Set()),
selectedKeysSet: computed(() => /* @__PURE__ */ new Set()),
loadedKeysSet: computed(() => /* @__PURE__ */ new Set()),
loadingKeysSet: computed(() => /* @__PURE__ */ new Set()),
checkedKeysSet: computed(() => /* @__PURE__ */ new Set()),
halfCheckedKeysSet: computed(() => /* @__PURE__ */ new Set()),
flattenNodes: shallowRef([])
});
};
const Indent = (_ref) => {
let {
prefixCls,
level,
isStart,
isEnd
} = _ref;
const baseClassName = `${prefixCls}-indent-unit`;
const list = [];
for (let i = 0; i < level; i += 1) {
list.push(createVNode("span", {
"key": i,
"class": {
[baseClassName]: true,
[`${baseClassName}-start`]: isStart[i],
[`${baseClassName}-end`]: isEnd[i]
}
}, null));
}
return createVNode("span", {
"aria-hidden": "true",
"class": `${prefixCls}-indent`
}, [list]);
};
const treeNodeProps = {
eventKey: [String, Number],
prefixCls: String,
// By parent
// expanded: { type: Boolean, default: undefined },
// selected: { type: Boolean, default: undefined },
// checked: { type: Boolean, default: undefined },
// loaded: { type: Boolean, default: undefined },
// loading: { type: Boolean, default: undefined },
// halfChecked: { type: Boolean, default: undefined },
// dragOver: { type: Boolean, default: undefined },
// dragOverGapTop: { type: Boolean, default: undefined },
// dragOverGapBottom: { type: Boolean, default: undefined },
// pos: String,
title: PropTypes.any,
/** New added in Tree for easy data access */
data: {
type: Object,
default: void 0
},
parent: {
type: Object,
default: void 0
},
isStart: {
type: Array
},
isEnd: {
type: Array
},
active: {
type: Boolean,
default: void 0
},
onMousemove: {
type: Function
},
// By user
isLeaf: {
type: Boolean,
default: void 0
},
checkable: {
type: Boolean,
default: void 0
},
selectable: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
disableCheckbox: {
type: Boolean,
default: void 0
},
icon: PropTypes.any,
switcherIcon: PropTypes.any,
domRef: {
type: Function
}
};
const nodeListProps = {
prefixCls: {
type: String
},
// data: { type: Array as PropType },
motion: {
type: Object
},
focusable: {
type: Boolean
},
activeItem: {
type: Object
},
focused: {
type: Boolean
},
tabindex: {
type: Number
},
checkable: {
type: Boolean
},
selectable: {
type: Boolean
},
disabled: {
type: Boolean
},
// expandedKeys: { type: Array as PropType },
// selectedKeys: { type: Array as PropType },
// checkedKeys: { type: Array as PropType },
// loadedKeys: { type: Array as PropType },
// loadingKeys: { type: Array as PropType },
// halfCheckedKeys: { type: Array as PropType },
// keyEntities: { type: Object as PropType>> },
// dragging: { type: Boolean as PropType },
// dragOverNodeKey: { type: [String, Number] as PropType },
// dropPosition: { type: Number as PropType },
// Virtual list
height: {
type: Number
},
itemHeight: {
type: Number
},
virtual: {
type: Boolean
},
onScroll: {
type: Function
},
onKeydown: {
type: Function
},
onFocus: {
type: Function
},
onBlur: {
type: Function
},
onActiveChange: {
type: Function
},
onContextmenu: {
type: Function
},
onListChangeStart: {
type: Function
},
onListChangeEnd: {
type: Function
}
};
const treeProps$1 = () => ({
prefixCls: String,
focusable: {
type: Boolean,
default: void 0
},
activeKey: [Number, String],
tabindex: Number,
children: PropTypes.any,
treeData: {
type: Array
},
fieldNames: {
type: Object
},
showLine: {
type: [Boolean, Object],
default: void 0
},
showIcon: {
type: Boolean,
default: void 0
},
icon: PropTypes.any,
selectable: {
type: Boolean,
default: void 0
},
expandAction: [String, Boolean],
disabled: {
type: Boolean,
default: void 0
},
multiple: {
type: Boolean,
default: void 0
},
checkable: {
type: Boolean,
default: void 0
},
checkStrictly: {
type: Boolean,
default: void 0
},
draggable: {
type: [Function, Boolean]
},
defaultExpandParent: {
type: Boolean,
default: void 0
},
autoExpandParent: {
type: Boolean,
default: void 0
},
defaultExpandAll: {
type: Boolean,
default: void 0
},
defaultExpandedKeys: {
type: Array
},
expandedKeys: {
type: Array
},
defaultCheckedKeys: {
type: Array
},
checkedKeys: {
type: [Object, Array]
},
defaultSelectedKeys: {
type: Array
},
selectedKeys: {
type: Array
},
allowDrop: {
type: Function
},
dropIndicatorRender: {
type: Function
},
onFocus: {
type: Function
},
onBlur: {
type: Function
},
onKeydown: {
type: Function
},
onContextmenu: {
type: Function
},
onClick: {
type: Function
},
onDblclick: {
type: Function
},
onScroll: {
type: Function
},
onExpand: {
type: Function
},
onCheck: {
type: Function
},
onSelect: {
type: Function
},
onLoad: {
type: Function
},
loadData: {
type: Function
},
loadedKeys: {
type: Array
},
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onRightClick: {
type: Function
},
onDragstart: {
type: Function
},
onDragenter: {
type: Function
},
onDragover: {
type: Function
},
onDragleave: {
type: Function
},
onDragend: {
type: Function
},
onDrop: {
type: Function
},
/**
* Used for `rc-tree-select` only.
* Do not use in your production code directly since this will be refactor.
*/
onActiveChange: {
type: Function
},
filterTreeNode: {
type: Function
},
motion: PropTypes.any,
switcherIcon: PropTypes.any,
// Virtual List
height: Number,
itemHeight: Number,
virtual: {
type: Boolean,
default: void 0
},
// direction for drag logic
direction: {
type: String
},
rootClassName: String,
rootStyle: Object
});
var __rest$U = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const ICON_OPEN = "open";
const ICON_CLOSE = "close";
const defaultTitle = "---";
const VcTreeNode = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATreeNode",
inheritAttrs: false,
props: treeNodeProps,
isTreeNode: 1,
setup(props2, _ref) {
let {
attrs,
slots,
expose
} = _ref;
warning$1(!("slots" in props2.data), `treeData slots is deprecated, please use ${Object.keys(props2.data.slots || {}).map((key2) => "`v-slot:" + key2 + "` ")}instead`);
const dragNodeHighlight = shallowRef(false);
const context2 = useInjectTreeContext();
const {
expandedKeysSet,
selectedKeysSet,
loadedKeysSet,
loadingKeysSet,
checkedKeysSet,
halfCheckedKeysSet
} = useInjectKeysState();
const {
dragOverNodeKey,
dropPosition,
keyEntities
} = context2.value;
const mergedTreeNodeProps = computed(() => {
return getTreeNodeProps(props2.eventKey, {
expandedKeysSet: expandedKeysSet.value,
selectedKeysSet: selectedKeysSet.value,
loadedKeysSet: loadedKeysSet.value,
loadingKeysSet: loadingKeysSet.value,
checkedKeysSet: checkedKeysSet.value,
halfCheckedKeysSet: halfCheckedKeysSet.value,
dragOverNodeKey,
dropPosition,
keyEntities
});
});
const expanded = eagerComputed(() => mergedTreeNodeProps.value.expanded);
const selected = eagerComputed(() => mergedTreeNodeProps.value.selected);
const checked = eagerComputed(() => mergedTreeNodeProps.value.checked);
const loaded = eagerComputed(() => mergedTreeNodeProps.value.loaded);
const loading2 = eagerComputed(() => mergedTreeNodeProps.value.loading);
const halfChecked = eagerComputed(() => mergedTreeNodeProps.value.halfChecked);
const dragOver = eagerComputed(() => mergedTreeNodeProps.value.dragOver);
const dragOverGapTop = eagerComputed(() => mergedTreeNodeProps.value.dragOverGapTop);
const dragOverGapBottom = eagerComputed(() => mergedTreeNodeProps.value.dragOverGapBottom);
const pos = eagerComputed(() => mergedTreeNodeProps.value.pos);
const selectHandle = shallowRef();
const hasChildren = computed(() => {
const {
eventKey
} = props2;
const {
keyEntities: keyEntities2
} = context2.value;
const {
children
} = keyEntities2[eventKey] || {};
return !!(children || []).length;
});
const isLeaf2 = computed(() => {
const {
isLeaf: isLeaf3
} = props2;
const {
loadData
} = context2.value;
const has = hasChildren.value;
if (isLeaf3 === false) {
return false;
}
return isLeaf3 || !loadData && !has || loadData && loaded.value && !has;
});
const nodeState = computed(() => {
if (isLeaf2.value) {
return null;
}
return expanded.value ? ICON_OPEN : ICON_CLOSE;
});
const isDisabled = computed(() => {
const {
disabled
} = props2;
const {
disabled: treeDisabled
} = context2.value;
return !!(treeDisabled || disabled);
});
const isCheckable = computed(() => {
const {
checkable
} = props2;
const {
checkable: treeCheckable
} = context2.value;
if (!treeCheckable || checkable === false) return false;
return treeCheckable;
});
const isSelectable = computed(() => {
const {
selectable
} = props2;
const {
selectable: treeSelectable
} = context2.value;
if (typeof selectable === "boolean") {
return selectable;
}
return treeSelectable;
});
const renderArgsData = computed(() => {
const {
data,
active,
checkable,
disableCheckbox,
disabled,
selectable
} = props2;
return _extends(_extends({
active,
checkable,
disableCheckbox,
disabled,
selectable
}, data), {
dataRef: data,
data,
isLeaf: isLeaf2.value,
checked: checked.value,
expanded: expanded.value,
loading: loading2.value,
selected: selected.value,
halfChecked: halfChecked.value
});
});
const instance = getCurrentInstance();
const eventData = computed(() => {
const {
eventKey
} = props2;
const {
keyEntities: keyEntities2
} = context2.value;
const {
parent
} = keyEntities2[eventKey] || {};
return _extends(_extends({}, convertNodePropsToEventData(_extends({}, props2, mergedTreeNodeProps.value))), {
parent
});
});
const dragNodeEvent = reactive({
eventData,
eventKey: computed(() => props2.eventKey),
selectHandle,
pos,
key: instance.vnode.key
});
expose(dragNodeEvent);
const onSelectorDoubleClick = (e) => {
const {
onNodeDoubleClick
} = context2.value;
onNodeDoubleClick(e, eventData.value);
};
const onSelect = (e) => {
if (isDisabled.value) return;
const {
onNodeSelect
} = context2.value;
e.preventDefault();
onNodeSelect(e, eventData.value);
};
const onCheck = (e) => {
if (isDisabled.value) return;
const {
disableCheckbox
} = props2;
const {
onNodeCheck
} = context2.value;
if (!isCheckable.value || disableCheckbox) return;
e.preventDefault();
const targetChecked = !checked.value;
onNodeCheck(e, eventData.value, targetChecked);
};
const onSelectorClick = (e) => {
const {
onNodeClick
} = context2.value;
onNodeClick(e, eventData.value);
if (isSelectable.value) {
onSelect(e);
} else {
onCheck(e);
}
};
const onMouseEnter = (e) => {
const {
onNodeMouseEnter
} = context2.value;
onNodeMouseEnter(e, eventData.value);
};
const onMouseLeave = (e) => {
const {
onNodeMouseLeave
} = context2.value;
onNodeMouseLeave(e, eventData.value);
};
const onContextmenu = (e) => {
const {
onNodeContextMenu
} = context2.value;
onNodeContextMenu(e, eventData.value);
};
const onDragStart = (e) => {
const {
onNodeDragStart
} = context2.value;
e.stopPropagation();
dragNodeHighlight.value = true;
onNodeDragStart(e, dragNodeEvent);
try {
e.dataTransfer.setData("text/plain", "");
} catch (error) {
}
};
const onDragEnter = (e) => {
const {
onNodeDragEnter
} = context2.value;
e.preventDefault();
e.stopPropagation();
onNodeDragEnter(e, dragNodeEvent);
};
const onDragOver = (e) => {
const {
onNodeDragOver
} = context2.value;
e.preventDefault();
e.stopPropagation();
onNodeDragOver(e, dragNodeEvent);
};
const onDragLeave = (e) => {
const {
onNodeDragLeave
} = context2.value;
e.stopPropagation();
onNodeDragLeave(e, dragNodeEvent);
};
const onDragEnd = (e) => {
const {
onNodeDragEnd
} = context2.value;
e.stopPropagation();
dragNodeHighlight.value = false;
onNodeDragEnd(e, dragNodeEvent);
};
const onDrop = (e) => {
const {
onNodeDrop
} = context2.value;
e.preventDefault();
e.stopPropagation();
dragNodeHighlight.value = false;
onNodeDrop(e, dragNodeEvent);
};
const onExpand = (e) => {
const {
onNodeExpand
} = context2.value;
if (loading2.value) return;
onNodeExpand(e, eventData.value);
};
const isDraggable = () => {
const {
data
} = props2;
const {
draggable
} = context2.value;
return !!(draggable && (!draggable.nodeDraggable || draggable.nodeDraggable(data)));
};
const renderDragHandler = () => {
const {
draggable,
prefixCls
} = context2.value;
return draggable && (draggable === null || draggable === void 0 ? void 0 : draggable.icon) ? createVNode("span", {
"class": `${prefixCls}-draggable-icon`
}, [draggable.icon]) : null;
};
const renderSwitcherIconDom = () => {
var _a, _b, _c;
const {
switcherIcon: switcherIconFromProps = slots.switcherIcon || ((_a = context2.value.slots) === null || _a === void 0 ? void 0 : _a[(_c = (_b = props2.data) === null || _b === void 0 ? void 0 : _b.slots) === null || _c === void 0 ? void 0 : _c.switcherIcon])
} = props2;
const {
switcherIcon: switcherIconFromCtx
} = context2.value;
const switcherIcon = switcherIconFromProps || switcherIconFromCtx;
if (typeof switcherIcon === "function") {
return switcherIcon(renderArgsData.value);
}
return switcherIcon;
};
const renderSwitcher = () => {
const {
prefixCls
} = context2.value;
const switcherIconDom = renderSwitcherIconDom();
if (isLeaf2.value) {
return switcherIconDom !== false ? createVNode("span", {
"class": classNames(`${prefixCls}-switcher`, `${prefixCls}-switcher-noop`)
}, [switcherIconDom]) : null;
}
const switcherCls = classNames(`${prefixCls}-switcher`, `${prefixCls}-switcher_${expanded.value ? ICON_OPEN : ICON_CLOSE}`);
return switcherIconDom !== false ? createVNode("span", {
"onClick": onExpand,
"class": switcherCls
}, [switcherIconDom]) : null;
};
const renderCheckbox = () => {
var _a, _b;
const {
disableCheckbox
} = props2;
const {
prefixCls
} = context2.value;
const disabled = isDisabled.value;
const checkable = isCheckable.value;
if (!checkable) return null;
return createVNode("span", {
"class": classNames(`${prefixCls}-checkbox`, checked.value && `${prefixCls}-checkbox-checked`, !checked.value && halfChecked.value && `${prefixCls}-checkbox-indeterminate`, (disabled || disableCheckbox) && `${prefixCls}-checkbox-disabled`),
"onClick": onCheck
}, [(_b = (_a = context2.value).customCheckable) === null || _b === void 0 ? void 0 : _b.call(_a)]);
};
const renderIcon2 = () => {
const {
prefixCls
} = context2.value;
return createVNode("span", {
"class": classNames(`${prefixCls}-iconEle`, `${prefixCls}-icon__${nodeState.value || "docu"}`, loading2.value && `${prefixCls}-icon_loading`)
}, null);
};
const renderDropIndicator = () => {
const {
disabled,
eventKey
} = props2;
const {
draggable,
dropLevelOffset,
dropPosition: dropPosition2,
prefixCls,
indent,
dropIndicatorRender: dropIndicatorRender2,
dragOverNodeKey: dragOverNodeKey2,
direction
} = context2.value;
const rootDraggable = draggable !== false;
const showIndicator = !disabled && rootDraggable && dragOverNodeKey2 === eventKey;
return showIndicator ? dropIndicatorRender2({
dropPosition: dropPosition2,
dropLevelOffset,
indent,
prefixCls,
direction
}) : null;
};
const renderSelector = () => {
var _a, _b, _c, _d, _e, _f;
const {
// title = slots.title ||
// context.value.slots?.[props.data?.slots?.title] ||
// context.value.slots?.title,
// selected,
icon = slots.icon,
// loading,
data
} = props2;
const title = slots.title || ((_a = context2.value.slots) === null || _a === void 0 ? void 0 : _a[(_c = (_b = props2.data) === null || _b === void 0 ? void 0 : _b.slots) === null || _c === void 0 ? void 0 : _c.title]) || ((_d = context2.value.slots) === null || _d === void 0 ? void 0 : _d.title) || props2.title;
const {
prefixCls,
showIcon,
icon: treeIcon,
loadData
// slots: contextSlots,
} = context2.value;
const disabled = isDisabled.value;
const wrapClass = `${prefixCls}-node-content-wrapper`;
let $icon;
if (showIcon) {
const currentIcon = icon || ((_e = context2.value.slots) === null || _e === void 0 ? void 0 : _e[(_f = data === null || data === void 0 ? void 0 : data.slots) === null || _f === void 0 ? void 0 : _f.icon]) || treeIcon;
$icon = currentIcon ? createVNode("span", {
"class": classNames(`${prefixCls}-iconEle`, `${prefixCls}-icon__customize`)
}, [typeof currentIcon === "function" ? currentIcon(renderArgsData.value) : currentIcon]) : renderIcon2();
} else if (loadData && loading2.value) {
$icon = renderIcon2();
}
let titleNode;
if (typeof title === "function") {
titleNode = title(renderArgsData.value);
} else {
titleNode = title;
}
titleNode = titleNode === void 0 ? defaultTitle : titleNode;
const $title = createVNode("span", {
"class": `${prefixCls}-title`
}, [titleNode]);
return createVNode("span", {
"ref": selectHandle,
"title": typeof title === "string" ? title : "",
"class": classNames(`${wrapClass}`, `${wrapClass}-${nodeState.value || "normal"}`, !disabled && (selected.value || dragNodeHighlight.value) && `${prefixCls}-node-selected`),
"onMouseenter": onMouseEnter,
"onMouseleave": onMouseLeave,
"onContextmenu": onContextmenu,
"onClick": onSelectorClick,
"onDblclick": onSelectorDoubleClick
}, [$icon, $title, renderDropIndicator()]);
};
return () => {
const _a = _extends(_extends({}, props2), attrs), {
eventKey,
isLeaf: isLeaf3,
isStart,
isEnd,
domRef,
active,
data,
onMousemove,
selectable
} = _a, otherProps = __rest$U(_a, ["eventKey", "isLeaf", "isStart", "isEnd", "domRef", "active", "data", "onMousemove", "selectable"]);
const {
prefixCls,
filterTreeNode,
keyEntities: keyEntities2,
dropContainerKey,
dropTargetKey,
draggingNodeKey
} = context2.value;
const disabled = isDisabled.value;
const dataOrAriaAttributeProps = pickAttrs(otherProps, {
aria: true,
data: true
});
const {
level
} = keyEntities2[eventKey] || {};
const isEndNode = isEnd[isEnd.length - 1];
const mergedDraggable = isDraggable();
const draggableWithoutDisabled = !disabled && mergedDraggable;
const dragging = draggingNodeKey === eventKey;
const ariaSelected = selectable !== void 0 ? {
"aria-selected": !!selectable
} : void 0;
return createVNode("div", _objectSpread$W(_objectSpread$W({
"ref": domRef,
"class": classNames(attrs.class, `${prefixCls}-treenode`, {
[`${prefixCls}-treenode-disabled`]: disabled,
[`${prefixCls}-treenode-switcher-${expanded.value ? "open" : "close"}`]: !isLeaf3,
[`${prefixCls}-treenode-checkbox-checked`]: checked.value,
[`${prefixCls}-treenode-checkbox-indeterminate`]: halfChecked.value,
[`${prefixCls}-treenode-selected`]: selected.value,
[`${prefixCls}-treenode-loading`]: loading2.value,
[`${prefixCls}-treenode-active`]: active,
[`${prefixCls}-treenode-leaf-last`]: isEndNode,
[`${prefixCls}-treenode-draggable`]: draggableWithoutDisabled,
dragging,
"drop-target": dropTargetKey === eventKey,
"drop-container": dropContainerKey === eventKey,
"drag-over": !disabled && dragOver.value,
"drag-over-gap-top": !disabled && dragOverGapTop.value,
"drag-over-gap-bottom": !disabled && dragOverGapBottom.value,
"filter-node": filterTreeNode && filterTreeNode(eventData.value)
}),
"style": attrs.style,
"draggable": draggableWithoutDisabled,
"aria-grabbed": dragging,
"onDragstart": draggableWithoutDisabled ? onDragStart : void 0,
"onDragenter": mergedDraggable ? onDragEnter : void 0,
"onDragover": mergedDraggable ? onDragOver : void 0,
"onDragleave": mergedDraggable ? onDragLeave : void 0,
"onDrop": mergedDraggable ? onDrop : void 0,
"onDragend": mergedDraggable ? onDragEnd : void 0,
"onMousemove": onMousemove
}, ariaSelected), dataOrAriaAttributeProps), [createVNode(Indent, {
"prefixCls": prefixCls,
"level": level,
"isStart": isStart,
"isEnd": isEnd
}, null), renderDragHandler(), renderSwitcher(), renderCheckbox(), renderSelector()]);
};
}
});
function arrDel(list, value) {
if (!list) return [];
const clone = list.slice();
const index2 = clone.indexOf(value);
if (index2 >= 0) {
clone.splice(index2, 1);
}
return clone;
}
function arrAdd(list, value) {
const clone = (list || []).slice();
if (clone.indexOf(value) === -1) {
clone.push(value);
}
return clone;
}
function posToArr(pos) {
return pos.split("-");
}
function getPosition(level, index2) {
return `${level}-${index2}`;
}
function isTreeNode(node) {
return node && node.type && node.type.isTreeNode;
}
function getDragChildrenKeys(dragNodeKey, keyEntities) {
const dragChildrenKeys = [];
const entity = keyEntities[dragNodeKey];
function dig() {
let list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
list.forEach((_ref) => {
let {
key: key2,
children
} = _ref;
dragChildrenKeys.push(key2);
dig(children);
});
}
dig(entity.children);
return dragChildrenKeys;
}
function isLastChild(treeNodeEntity) {
if (treeNodeEntity.parent) {
const posArr = posToArr(treeNodeEntity.pos);
return Number(posArr[posArr.length - 1]) === treeNodeEntity.parent.children.length - 1;
}
return false;
}
function isFirstChild(treeNodeEntity) {
const posArr = posToArr(treeNodeEntity.pos);
return Number(posArr[posArr.length - 1]) === 0;
}
function calcDropPosition(event, dragNode, targetNode, indent, startMousePosition, allowDrop, flattenedNodes, keyEntities, expandKeysSet, direction) {
var _a;
const {
clientX,
clientY
} = event;
const {
top,
height
} = event.target.getBoundingClientRect();
const horizontalMouseOffset = (direction === "rtl" ? -1 : 1) * (((startMousePosition === null || startMousePosition === void 0 ? void 0 : startMousePosition.x) || 0) - clientX);
const rawDropLevelOffset = (horizontalMouseOffset - 12) / indent;
let abstractDropNodeEntity = keyEntities[targetNode.eventKey];
if (clientY < top + height / 2) {
const nodeIndex = flattenedNodes.findIndex((flattenedNode) => flattenedNode.key === abstractDropNodeEntity.key);
const prevNodeIndex = nodeIndex <= 0 ? 0 : nodeIndex - 1;
const prevNodeKey = flattenedNodes[prevNodeIndex].key;
abstractDropNodeEntity = keyEntities[prevNodeKey];
}
const initialAbstractDropNodeKey = abstractDropNodeEntity.key;
const abstractDragOverEntity = abstractDropNodeEntity;
const dragOverNodeKey = abstractDropNodeEntity.key;
let dropPosition = 0;
let dropLevelOffset = 0;
if (!expandKeysSet.has(initialAbstractDropNodeKey)) {
for (let i = 0; i < rawDropLevelOffset; i += 1) {
if (isLastChild(abstractDropNodeEntity)) {
abstractDropNodeEntity = abstractDropNodeEntity.parent;
dropLevelOffset += 1;
} else {
break;
}
}
}
const abstractDragDataNode = dragNode.eventData;
const abstractDropDataNode = abstractDropNodeEntity.node;
let dropAllowed = true;
if (isFirstChild(abstractDropNodeEntity) && abstractDropNodeEntity.level === 0 && clientY < top + height / 2 && allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: -1
}) && abstractDropNodeEntity.key === targetNode.eventKey) {
dropPosition = -1;
} else if ((abstractDragOverEntity.children || []).length && expandKeysSet.has(dragOverNodeKey)) {
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 0
})) {
dropPosition = 0;
} else {
dropAllowed = false;
}
} else if (dropLevelOffset === 0) {
if (rawDropLevelOffset > -1.5) {
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 1
})) {
dropPosition = 1;
} else {
dropAllowed = false;
}
} else {
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 0
})) {
dropPosition = 0;
} else if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 1
})) {
dropPosition = 1;
} else {
dropAllowed = false;
}
}
} else {
if (allowDrop({
dragNode: abstractDragDataNode,
dropNode: abstractDropDataNode,
dropPosition: 1
})) {
dropPosition = 1;
} else {
dropAllowed = false;
}
}
return {
dropPosition,
dropLevelOffset,
dropTargetKey: abstractDropNodeEntity.key,
dropTargetPos: abstractDropNodeEntity.pos,
dragOverNodeKey,
dropContainerKey: dropPosition === 0 ? null : ((_a = abstractDropNodeEntity.parent) === null || _a === void 0 ? void 0 : _a.key) || null,
dropAllowed
};
}
function calcSelectedKeys(selectedKeys, props2) {
if (!selectedKeys) return void 0;
const {
multiple
} = props2;
if (multiple) {
return selectedKeys.slice();
}
if (selectedKeys.length) {
return [selectedKeys[0]];
}
return selectedKeys;
}
function parseCheckedKeys(keys) {
if (!keys) {
return null;
}
let keyProps;
if (Array.isArray(keys)) {
keyProps = {
checkedKeys: keys,
halfCheckedKeys: void 0
};
} else if (typeof keys === "object") {
keyProps = {
checkedKeys: keys.checked || void 0,
halfCheckedKeys: keys.halfChecked || void 0
};
} else {
return null;
}
return keyProps;
}
function conductExpandParent(keyList, keyEntities) {
const expandedKeys = /* @__PURE__ */ new Set();
function conductUp(key2) {
if (expandedKeys.has(key2)) return;
const entity = keyEntities[key2];
if (!entity) return;
expandedKeys.add(key2);
const {
parent,
node
} = entity;
if (node.disabled) return;
if (parent) {
conductUp(parent.key);
}
}
(keyList || []).forEach((key2) => {
conductUp(key2);
});
return [...expandedKeys];
}
var __rest$T = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function getKey(key2, pos) {
if (key2 !== null && key2 !== void 0) {
return key2;
}
return pos;
}
function fillFieldNames$1(fieldNames) {
const {
title,
_title,
key: key2,
children
} = fieldNames || {};
const mergedTitle = title || "title";
return {
title: mergedTitle,
_title: _title || [mergedTitle],
key: key2 || "key",
children: children || "children"
};
}
function convertTreeToData(rootNodes) {
function dig() {
let node = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
const treeNodes = filterEmpty(node);
return treeNodes.map((treeNode) => {
var _a, _b, _c, _d;
if (!isTreeNode(treeNode)) {
return null;
}
const slots = treeNode.children || {};
const key2 = treeNode.key;
const props2 = {};
for (const [k, v] of Object.entries(treeNode.props)) {
props2[camelize(k)] = v;
}
const {
isLeaf: isLeaf2,
checkable,
selectable,
disabled,
disableCheckbox
} = props2;
const newProps = {
isLeaf: isLeaf2 || isLeaf2 === "" || void 0,
checkable: checkable || checkable === "" || void 0,
selectable: selectable || selectable === "" || void 0,
disabled: disabled || disabled === "" || void 0,
disableCheckbox: disableCheckbox || disableCheckbox === "" || void 0
};
const slotsProps = _extends(_extends({}, props2), newProps);
const {
title = (_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots, slotsProps),
icon = (_b = slots.icon) === null || _b === void 0 ? void 0 : _b.call(slots, slotsProps),
switcherIcon = (_c = slots.switcherIcon) === null || _c === void 0 ? void 0 : _c.call(slots, slotsProps)
} = props2, rest = __rest$T(props2, ["title", "icon", "switcherIcon"]);
const children = (_d = slots.default) === null || _d === void 0 ? void 0 : _d.call(slots);
const dataNode = _extends(_extends(_extends({}, rest), {
title,
icon,
switcherIcon,
key: key2,
isLeaf: isLeaf2
}), newProps);
const parsedChildren = dig(children);
if (parsedChildren.length) {
dataNode.children = parsedChildren;
}
return dataNode;
});
}
return dig(rootNodes);
}
function flattenTreeData(treeNodeList, expandedKeys, fieldNames) {
const {
_title: fieldTitles,
key: fieldKey,
children: fieldChildren
} = fillFieldNames$1(fieldNames);
const expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);
const flattenList = [];
function dig(list) {
let parent = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
return list.map((treeNode, index2) => {
const pos = getPosition(parent ? parent.pos : "0", index2);
const mergedKey = getKey(treeNode[fieldKey], pos);
let mergedTitle;
for (let i = 0; i < fieldTitles.length; i += 1) {
const fieldTitle = fieldTitles[i];
if (treeNode[fieldTitle] !== void 0) {
mergedTitle = treeNode[fieldTitle];
break;
}
}
const flattenNode = _extends(_extends({}, omit(treeNode, [...fieldTitles, fieldKey, fieldChildren])), {
title: mergedTitle,
key: mergedKey,
parent,
pos,
children: null,
data: treeNode,
isStart: [...parent ? parent.isStart : [], index2 === 0],
isEnd: [...parent ? parent.isEnd : [], index2 === list.length - 1]
});
flattenList.push(flattenNode);
if (expandedKeys === true || expandedKeySet.has(mergedKey)) {
flattenNode.children = dig(treeNode[fieldChildren] || [], flattenNode);
} else {
flattenNode.children = [];
}
return flattenNode;
});
}
dig(treeNodeList);
return flattenList;
}
function traverseDataNodes(dataNodes, callback, config) {
let mergedConfig = {};
if (typeof config === "object") {
mergedConfig = config;
} else {
mergedConfig = {
externalGetKey: config
};
}
mergedConfig = mergedConfig || {};
const {
childrenPropName,
externalGetKey,
fieldNames
} = mergedConfig;
const {
key: fieldKey,
children: fieldChildren
} = fillFieldNames$1(fieldNames);
const mergeChildrenPropName = childrenPropName || fieldChildren;
let syntheticGetKey;
if (externalGetKey) {
if (typeof externalGetKey === "string") {
syntheticGetKey = (node) => node[externalGetKey];
} else if (typeof externalGetKey === "function") {
syntheticGetKey = (node) => externalGetKey(node);
}
} else {
syntheticGetKey = (node, pos) => getKey(node[fieldKey], pos);
}
function processNode(node, index2, parent, pathNodes) {
const children = node ? node[mergeChildrenPropName] : dataNodes;
const pos = node ? getPosition(parent.pos, index2) : "0";
const connectNodes = node ? [...pathNodes, node] : [];
if (node) {
const key2 = syntheticGetKey(node, pos);
const data = {
node,
index: index2,
pos,
key: key2,
parentPos: parent.node ? parent.pos : null,
level: parent.level + 1,
nodes: connectNodes
};
callback(data);
}
if (children) {
children.forEach((subNode, subIndex) => {
processNode(subNode, subIndex, {
node,
pos,
level: parent ? parent.level + 1 : -1
}, connectNodes);
});
}
}
processNode(null);
}
function convertDataToEntities(dataNodes) {
let {
initWrapper,
processEntity,
onProcessFinished,
externalGetKey,
childrenPropName,
fieldNames
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let legacyExternalGetKey = arguments.length > 2 ? arguments[2] : void 0;
const mergedExternalGetKey = externalGetKey || legacyExternalGetKey;
const posEntities = {};
const keyEntities = {};
let wrapper = {
posEntities,
keyEntities
};
if (initWrapper) {
wrapper = initWrapper(wrapper) || wrapper;
}
traverseDataNodes(dataNodes, (item) => {
const {
node,
index: index2,
pos,
key: key2,
parentPos,
level,
nodes
} = item;
const entity = {
node,
nodes,
index: index2,
key: key2,
pos,
level
};
const mergedKey = getKey(key2, pos);
posEntities[pos] = entity;
keyEntities[mergedKey] = entity;
entity.parent = posEntities[parentPos];
if (entity.parent) {
entity.parent.children = entity.parent.children || [];
entity.parent.children.push(entity);
}
if (processEntity) {
processEntity(entity, wrapper);
}
}, {
externalGetKey: mergedExternalGetKey,
childrenPropName,
fieldNames
});
if (onProcessFinished) {
onProcessFinished(wrapper);
}
return wrapper;
}
function getTreeNodeProps(key2, _ref) {
let {
expandedKeysSet,
selectedKeysSet,
loadedKeysSet,
loadingKeysSet,
checkedKeysSet,
halfCheckedKeysSet,
dragOverNodeKey,
dropPosition,
keyEntities
} = _ref;
const entity = keyEntities[key2];
const treeNodeProps2 = {
eventKey: key2,
expanded: expandedKeysSet.has(key2),
selected: selectedKeysSet.has(key2),
loaded: loadedKeysSet.has(key2),
loading: loadingKeysSet.has(key2),
checked: checkedKeysSet.has(key2),
halfChecked: halfCheckedKeysSet.has(key2),
pos: String(entity ? entity.pos : ""),
parent: entity.parent,
// [Legacy] Drag props
// Since the interaction of drag is changed, the semantic of the props are
// not accuracy, I think it should be finally removed
dragOver: dragOverNodeKey === key2 && dropPosition === 0,
dragOverGapTop: dragOverNodeKey === key2 && dropPosition === -1,
dragOverGapBottom: dragOverNodeKey === key2 && dropPosition === 1
};
return treeNodeProps2;
}
function convertNodePropsToEventData(props2) {
const {
data,
expanded,
selected,
checked,
loaded,
loading: loading2,
halfChecked,
dragOver,
dragOverGapTop,
dragOverGapBottom,
pos,
active,
eventKey
} = props2;
const eventData = _extends(_extends({
dataRef: data
}, data), {
expanded,
selected,
checked,
loaded,
loading: loading2,
halfChecked,
dragOver,
dragOverGapTop,
dragOverGapBottom,
pos,
active,
eventKey,
key: eventKey
});
if (!("props" in eventData)) {
Object.defineProperty(eventData, "props", {
get() {
return props2;
}
});
}
return eventData;
}
const useEntities = ((options, fieldNames) => {
const entities = computed(() => {
return convertDataToEntities(options.value, {
fieldNames: fieldNames.value,
initWrapper: (wrapper) => _extends(_extends({}, wrapper), {
pathKeyEntities: {}
}),
processEntity: (entity, wrapper) => {
const pathKey = entity.nodes.map((node) => node[fieldNames.value.value]).join(VALUE_SPLIT);
wrapper.pathKeyEntities[pathKey] = entity;
entity.key = pathKey;
}
}).pathKeyEntities;
});
return entities;
});
function useSearchConfig(showSearch) {
const mergedShowSearch = shallowRef(false);
const mergedSearchConfig = ref({});
watchEffect(() => {
if (!showSearch.value) {
mergedShowSearch.value = false;
mergedSearchConfig.value = {};
return;
}
let searchConfig = {
matchInputWidth: true,
limit: 50
};
if (showSearch.value && typeof showSearch.value === "object") {
searchConfig = _extends(_extends({}, searchConfig), showSearch.value);
}
if (searchConfig.limit <= 0) {
delete searchConfig.limit;
}
mergedShowSearch.value = true;
mergedSearchConfig.value = searchConfig;
return;
});
return {
showSearch: mergedShowSearch,
searchConfig: mergedSearchConfig
};
}
const SEARCH_MARK = "__rc_cascader_search_mark__";
const defaultFilter = (search, options, _ref) => {
let {
label
} = _ref;
return options.some((opt) => String(opt[label]).toLowerCase().includes(search.toLowerCase()));
};
const defaultRender$1 = (_ref2) => {
let {
path: path2,
fieldNames
} = _ref2;
return path2.map((opt) => opt[fieldNames.label]).join(" / ");
};
const useSearchOptions = ((search, options, fieldNames, prefixCls, config, changeOnSelect) => {
return computed(() => {
const {
filter = defaultFilter,
render: render2 = defaultRender$1,
limit = 50,
sort
} = config.value;
const filteredOptions = [];
if (!search.value) {
return [];
}
function dig(list, pathOptions) {
list.forEach((option) => {
if (!sort && limit > 0 && filteredOptions.length >= limit) {
return;
}
const connectedPathOptions = [...pathOptions, option];
const children = option[fieldNames.value.children];
if (
// If is leaf option
!children || children.length === 0 || // If is changeOnSelect
changeOnSelect.value
) {
if (filter(search.value, connectedPathOptions, {
label: fieldNames.value.label
})) {
filteredOptions.push(_extends(_extends({}, option), {
[fieldNames.value.label]: render2({
inputValue: search.value,
path: connectedPathOptions,
prefixCls: prefixCls.value,
fieldNames: fieldNames.value
}),
[SEARCH_MARK]: connectedPathOptions
}));
}
}
if (children) {
dig(option[fieldNames.value.children], connectedPathOptions);
}
});
}
dig(options.value, []);
if (sort) {
filteredOptions.sort((a, b) => {
return sort(a[SEARCH_MARK], b[SEARCH_MARK], search.value, fieldNames.value);
});
}
return limit > 0 ? filteredOptions.slice(0, limit) : filteredOptions;
});
});
function formatStrategyValues$1(pathKeys, keyPathEntities, showCheckedStrategy) {
const valueSet = new Set(pathKeys);
return pathKeys.filter((key2) => {
const entity = keyPathEntities[key2];
const parent = entity ? entity.parent : null;
const children = entity ? entity.children : null;
return showCheckedStrategy === SHOW_CHILD$1 ? !(children && children.some((child) => child.key && valueSet.has(child.key))) : !(parent && !parent.node.disabled && valueSet.has(parent.key));
});
}
function toPathOptions(valueCells, options, fieldNames) {
let stringMode = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
var _a;
let currentList = options;
const valueOptions = [];
for (let i = 0; i < valueCells.length; i += 1) {
const valueCell = valueCells[i];
const foundIndex = currentList === null || currentList === void 0 ? void 0 : currentList.findIndex((option) => {
const val = option[fieldNames.value];
return stringMode ? String(val) === String(valueCell) : val === valueCell;
});
const foundOption = foundIndex !== -1 ? currentList === null || currentList === void 0 ? void 0 : currentList[foundIndex] : null;
valueOptions.push({
value: (_a = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.value]) !== null && _a !== void 0 ? _a : valueCell,
index: foundIndex,
option: foundOption
});
currentList = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.children];
}
return valueOptions;
}
const useMissingValues = ((options, fieldNames, rawValues) => {
return computed(() => {
const missingValues = [];
const existsValues = [];
rawValues.value.forEach((valueCell) => {
const pathOptions = toPathOptions(valueCell, options.value, fieldNames.value);
if (pathOptions.every((opt) => opt.option)) {
existsValues.push(valueCell);
} else {
missingValues.push(valueCell);
}
});
return [existsValues, missingValues];
});
});
function removeFromCheckedKeys(halfCheckedKeys, checkedKeys) {
const filteredKeys = /* @__PURE__ */ new Set();
halfCheckedKeys.forEach((key2) => {
if (!checkedKeys.has(key2)) {
filteredKeys.add(key2);
}
});
return filteredKeys;
}
function isCheckDisabled$1(node) {
const {
disabled,
disableCheckbox,
checkable
} = node || {};
return !!(disabled || disableCheckbox) || checkable === false;
}
function fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
const checkedKeys = new Set(keys);
const halfCheckedKeys = /* @__PURE__ */ new Set();
for (let level = 0; level <= maxLevel; level += 1) {
const entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
entities.forEach((entity) => {
const {
key: key2,
node,
children = []
} = entity;
if (checkedKeys.has(key2) && !syntheticGetCheckDisabled(node)) {
children.filter((childEntity) => !syntheticGetCheckDisabled(childEntity.node)).forEach((childEntity) => {
checkedKeys.add(childEntity.key);
});
}
});
}
const visitedKeys = /* @__PURE__ */ new Set();
for (let level = maxLevel; level >= 0; level -= 1) {
const entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
entities.forEach((entity) => {
const {
parent,
node
} = entity;
if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
return;
}
if (syntheticGetCheckDisabled(entity.parent.node)) {
visitedKeys.add(parent.key);
return;
}
let allChecked = true;
let partialChecked = false;
(parent.children || []).filter((childEntity) => !syntheticGetCheckDisabled(childEntity.node)).forEach((_ref) => {
let {
key: key2
} = _ref;
const checked = checkedKeys.has(key2);
if (allChecked && !checked) {
allChecked = false;
}
if (!partialChecked && (checked || halfCheckedKeys.has(key2))) {
partialChecked = true;
}
});
if (allChecked) {
checkedKeys.add(parent.key);
}
if (partialChecked) {
halfCheckedKeys.add(parent.key);
}
visitedKeys.add(parent.key);
});
}
return {
checkedKeys: Array.from(checkedKeys),
halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
};
}
function cleanConductCheck(keys, halfKeys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
const checkedKeys = new Set(keys);
let halfCheckedKeys = new Set(halfKeys);
for (let level = 0; level <= maxLevel; level += 1) {
const entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
entities.forEach((entity) => {
const {
key: key2,
node,
children = []
} = entity;
if (!checkedKeys.has(key2) && !halfCheckedKeys.has(key2) && !syntheticGetCheckDisabled(node)) {
children.filter((childEntity) => !syntheticGetCheckDisabled(childEntity.node)).forEach((childEntity) => {
checkedKeys.delete(childEntity.key);
});
}
});
}
halfCheckedKeys = /* @__PURE__ */ new Set();
const visitedKeys = /* @__PURE__ */ new Set();
for (let level = maxLevel; level >= 0; level -= 1) {
const entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
entities.forEach((entity) => {
const {
parent,
node
} = entity;
if (syntheticGetCheckDisabled(node) || !entity.parent || visitedKeys.has(entity.parent.key)) {
return;
}
if (syntheticGetCheckDisabled(entity.parent.node)) {
visitedKeys.add(parent.key);
return;
}
let allChecked = true;
let partialChecked = false;
(parent.children || []).filter((childEntity) => !syntheticGetCheckDisabled(childEntity.node)).forEach((_ref2) => {
let {
key: key2
} = _ref2;
const checked = checkedKeys.has(key2);
if (allChecked && !checked) {
allChecked = false;
}
if (!partialChecked && (checked || halfCheckedKeys.has(key2))) {
partialChecked = true;
}
});
if (!allChecked) {
checkedKeys.delete(parent.key);
}
if (partialChecked) {
halfCheckedKeys.add(parent.key);
}
visitedKeys.add(parent.key);
});
}
return {
checkedKeys: Array.from(checkedKeys),
halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
};
}
function conductCheck(keyList, checked, keyEntities, maxLevel, levelEntities, getCheckDisabled) {
let syntheticGetCheckDisabled;
if (getCheckDisabled) {
syntheticGetCheckDisabled = getCheckDisabled;
} else {
syntheticGetCheckDisabled = isCheckDisabled$1;
}
const keys = new Set(keyList.filter((key2) => {
const hasEntity = !!keyEntities[key2];
return hasEntity;
}));
let result;
if (checked === true) {
result = fillConductCheck(keys, levelEntities, maxLevel, syntheticGetCheckDisabled);
} else {
result = cleanConductCheck(keys, checked.halfCheckedKeys, levelEntities, maxLevel, syntheticGetCheckDisabled);
}
return result;
}
const useDisplayValues = ((rawValues, options, fieldNames, multiple, displayRender) => {
return computed(() => {
const mergedDisplayRender = displayRender.value || // Default displayRender
((_ref) => {
let {
labels
} = _ref;
const mergedLabels = multiple.value ? labels.slice(-1) : labels;
const SPLIT2 = " / ";
if (mergedLabels.every((label) => ["string", "number"].includes(typeof label))) {
return mergedLabels.join(SPLIT2);
}
return mergedLabels.reduce((list, label, index2) => {
const keyedLabel = isValidElement(label) ? cloneElement(label, {
key: index2
}) : label;
if (index2 === 0) {
return [keyedLabel];
}
return [...list, SPLIT2, keyedLabel];
}, []);
});
return rawValues.value.map((valueCells) => {
const valueOptions = toPathOptions(valueCells, options.value, fieldNames.value);
const label = mergedDisplayRender({
labels: valueOptions.map((_ref2) => {
let {
option,
value: value2
} = _ref2;
var _a;
return (_a = option === null || option === void 0 ? void 0 : option[fieldNames.value.label]) !== null && _a !== void 0 ? _a : value2;
}),
selectedOptions: valueOptions.map((_ref3) => {
let {
option
} = _ref3;
return option;
})
});
const value = toPathKey(valueCells);
return {
label,
value,
key: value,
valueCells
};
});
});
});
const CascaderContextKey = Symbol("CascaderContextKey");
const useProvideCascader = (props2) => {
provide(CascaderContextKey, props2);
};
const useInjectCascader = () => {
return inject(CascaderContextKey);
};
const useActive = (() => {
const baseProps2 = useBaseProps();
const {
values
} = useInjectCascader();
const [activeValueCells, setActiveValueCells] = useState$1([]);
watch(() => baseProps2.open, () => {
if (baseProps2.open && !baseProps2.multiple) {
const firstValueCells = values.value[0];
setActiveValueCells(firstValueCells || []);
}
}, {
immediate: true
});
return [activeValueCells, setActiveValueCells];
});
const useKeyboard = ((context2, options, fieldNames, activeValueCells, setActiveValueCells, onKeyBoardSelect) => {
const baseProps2 = useBaseProps();
const rtl2 = computed(() => baseProps2.direction === "rtl");
const [validActiveValueCells, lastActiveIndex, lastActiveOptions] = [ref([]), ref(), ref([])];
watchEffect(() => {
let activeIndex = -1;
let currentOptions = options.value;
const mergedActiveIndexes = [];
const mergedActiveValueCells = [];
const len = activeValueCells.value.length;
for (let i = 0; i < len && currentOptions; i += 1) {
const nextActiveIndex = currentOptions.findIndex((option) => option[fieldNames.value.value] === activeValueCells.value[i]);
if (nextActiveIndex === -1) {
break;
}
activeIndex = nextActiveIndex;
mergedActiveIndexes.push(activeIndex);
mergedActiveValueCells.push(activeValueCells.value[i]);
currentOptions = currentOptions[activeIndex][fieldNames.value.children];
}
let activeOptions = options.value;
for (let i = 0; i < mergedActiveIndexes.length - 1; i += 1) {
activeOptions = activeOptions[mergedActiveIndexes[i]][fieldNames.value.children];
}
[validActiveValueCells.value, lastActiveIndex.value, lastActiveOptions.value] = [mergedActiveValueCells, activeIndex, activeOptions];
});
const internalSetActiveValueCells = (next) => {
setActiveValueCells(next);
};
const offsetActiveOption = (offset2) => {
const len = lastActiveOptions.value.length;
let currentIndex = lastActiveIndex.value;
if (currentIndex === -1 && offset2 < 0) {
currentIndex = len;
}
for (let i = 0; i < len; i += 1) {
currentIndex = (currentIndex + offset2 + len) % len;
const option = lastActiveOptions.value[currentIndex];
if (option && !option.disabled) {
const value = option[fieldNames.value.value];
const nextActiveCells = validActiveValueCells.value.slice(0, -1).concat(value);
internalSetActiveValueCells(nextActiveCells);
return;
}
}
};
const prevColumn = () => {
if (validActiveValueCells.value.length > 1) {
const nextActiveCells = validActiveValueCells.value.slice(0, -1);
internalSetActiveValueCells(nextActiveCells);
} else {
baseProps2.toggleOpen(false);
}
};
const nextColumn = () => {
var _a;
const nextOptions = ((_a = lastActiveOptions.value[lastActiveIndex.value]) === null || _a === void 0 ? void 0 : _a[fieldNames.value.children]) || [];
const nextOption = nextOptions.find((option) => !option.disabled);
if (nextOption) {
const nextActiveCells = [...validActiveValueCells.value, nextOption[fieldNames.value.value]];
internalSetActiveValueCells(nextActiveCells);
}
};
context2.expose({
// scrollTo: treeRef.current?.scrollTo,
onKeydown: (event) => {
const {
which
} = event;
switch (which) {
// >>> Arrow keys
case KeyCode.UP:
case KeyCode.DOWN: {
let offset2 = 0;
if (which === KeyCode.UP) {
offset2 = -1;
} else if (which === KeyCode.DOWN) {
offset2 = 1;
}
if (offset2 !== 0) {
offsetActiveOption(offset2);
}
break;
}
case KeyCode.LEFT: {
if (rtl2.value) {
nextColumn();
} else {
prevColumn();
}
break;
}
case KeyCode.RIGHT: {
if (rtl2.value) {
prevColumn();
} else {
nextColumn();
}
break;
}
case KeyCode.BACKSPACE: {
if (!baseProps2.searchValue) {
prevColumn();
}
break;
}
// >>> Select
case KeyCode.ENTER: {
if (validActiveValueCells.value.length) {
const option = lastActiveOptions.value[lastActiveIndex.value];
const originOptions = (option === null || option === void 0 ? void 0 : option[SEARCH_MARK]) || [];
if (originOptions.length) {
onKeyBoardSelect(originOptions.map((opt) => opt[fieldNames.value.value]), originOptions[originOptions.length - 1]);
} else {
onKeyBoardSelect(validActiveValueCells.value, option);
}
}
break;
}
// >>> Close
case KeyCode.ESC: {
baseProps2.toggleOpen(false);
if (open) {
event.stopPropagation();
}
}
}
},
onKeyup: () => {
}
});
});
function Checkbox$1(_ref) {
let {
prefixCls,
checked,
halfChecked,
disabled,
onClick
} = _ref;
const {
customSlots,
checkable
} = useInjectCascader();
const mergedCheckable = checkable.value !== false ? customSlots.value.checkable : checkable.value;
const customCheckbox = typeof mergedCheckable === "function" ? mergedCheckable() : typeof mergedCheckable === "boolean" ? null : mergedCheckable;
return createVNode("span", {
"class": {
[prefixCls]: true,
[`${prefixCls}-checked`]: checked,
[`${prefixCls}-indeterminate`]: !checked && halfChecked,
[`${prefixCls}-disabled`]: disabled
},
"onClick": onClick
}, [customCheckbox]);
}
Checkbox$1.props = ["prefixCls", "checked", "halfChecked", "disabled", "onClick"];
Checkbox$1.displayName = "Checkbox";
Checkbox$1.inheritAttrs = false;
const FIX_LABEL = "__cascader_fix_label__";
function Column$1(_ref) {
let {
prefixCls,
multiple,
options,
activeValue,
prevValuePath,
onToggleOpen,
onSelect,
onActive,
checkedSet,
halfCheckedSet,
loadingKeys,
isSelectable
} = _ref;
var _a, _b, _c, _d, _e, _f;
const menuPrefixCls = `${prefixCls}-menu`;
const menuItemPrefixCls = `${prefixCls}-menu-item`;
const {
fieldNames,
changeOnSelect,
expandTrigger,
expandIcon: expandIconRef,
loadingIcon: loadingIconRef,
dropdownMenuColumnStyle,
customSlots
} = useInjectCascader();
const expandIcon = (_a = expandIconRef.value) !== null && _a !== void 0 ? _a : (_c = (_b = customSlots.value).expandIcon) === null || _c === void 0 ? void 0 : _c.call(_b);
const loadingIcon = (_d = loadingIconRef.value) !== null && _d !== void 0 ? _d : (_f = (_e = customSlots.value).loadingIcon) === null || _f === void 0 ? void 0 : _f.call(_e);
const hoverOpen = expandTrigger.value === "hover";
return createVNode("ul", {
"class": menuPrefixCls,
"role": "menu"
}, [options.map((option) => {
var _a2;
const {
disabled
} = option;
const searchOptions = option[SEARCH_MARK];
const label = (_a2 = option[FIX_LABEL]) !== null && _a2 !== void 0 ? _a2 : option[fieldNames.value.label];
const value = option[fieldNames.value.value];
const isMergedLeaf = isLeaf(option, fieldNames.value);
const fullPath = searchOptions ? searchOptions.map((opt) => opt[fieldNames.value.value]) : [...prevValuePath, value];
const fullPathKey = toPathKey(fullPath);
const isLoading = loadingKeys.includes(fullPathKey);
const checked = checkedSet.has(fullPathKey);
const halfChecked = halfCheckedSet.has(fullPathKey);
const triggerOpenPath = () => {
if (!disabled && (!hoverOpen || !isMergedLeaf)) {
onActive(fullPath);
}
};
const triggerSelect = () => {
if (isSelectable(option)) {
onSelect(fullPath, isMergedLeaf);
}
};
let title;
if (typeof option.title === "string") {
title = option.title;
} else if (typeof label === "string") {
title = label;
}
return createVNode("li", {
"key": fullPathKey,
"class": [menuItemPrefixCls, {
[`${menuItemPrefixCls}-expand`]: !isMergedLeaf,
[`${menuItemPrefixCls}-active`]: activeValue === value,
[`${menuItemPrefixCls}-disabled`]: disabled,
[`${menuItemPrefixCls}-loading`]: isLoading
}],
"style": dropdownMenuColumnStyle.value,
"role": "menuitemcheckbox",
"title": title,
"aria-checked": checked,
"data-path-key": fullPathKey,
"onClick": () => {
triggerOpenPath();
if (!multiple || isMergedLeaf) {
triggerSelect();
}
},
"onDblclick": () => {
if (changeOnSelect.value) {
onToggleOpen(false);
}
},
"onMouseenter": () => {
if (hoverOpen) {
triggerOpenPath();
}
},
"onMousedown": (e) => {
e.preventDefault();
}
}, [multiple && createVNode(Checkbox$1, {
"prefixCls": `${prefixCls}-checkbox`,
"checked": checked,
"halfChecked": halfChecked,
"disabled": disabled,
"onClick": (e) => {
e.stopPropagation();
triggerSelect();
}
}, null), createVNode("div", {
"class": `${menuItemPrefixCls}-content`
}, [label]), !isLoading && expandIcon && !isMergedLeaf && createVNode("div", {
"class": `${menuItemPrefixCls}-expand-icon`
}, [cloneElement(expandIcon)]), isLoading && loadingIcon && createVNode("div", {
"class": `${menuItemPrefixCls}-loading-icon`
}, [cloneElement(loadingIcon)])]);
})]);
}
Column$1.props = ["prefixCls", "multiple", "options", "activeValue", "prevValuePath", "onToggleOpen", "onSelect", "onActive", "checkedSet", "halfCheckedSet", "loadingKeys", "isSelectable"];
Column$1.displayName = "Column";
Column$1.inheritAttrs = false;
const OptionList$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "OptionList",
inheritAttrs: false,
setup(_props, context2) {
const {
attrs,
slots
} = context2;
const baseProps2 = useBaseProps();
const containerRef = ref();
const rtl2 = computed(() => baseProps2.direction === "rtl");
const {
options,
values,
halfValues,
fieldNames,
changeOnSelect,
onSelect,
searchOptions,
dropdownPrefixCls,
loadData,
expandTrigger,
customSlots
} = useInjectCascader();
const mergedPrefixCls = computed(() => dropdownPrefixCls.value || baseProps2.prefixCls);
const loadingKeys = shallowRef([]);
const internalLoadData = (valueCells) => {
if (!loadData.value || baseProps2.searchValue) {
return;
}
const optionList = toPathOptions(valueCells, options.value, fieldNames.value);
const rawOptions = optionList.map((_ref) => {
let {
option
} = _ref;
return option;
});
const lastOption = rawOptions[rawOptions.length - 1];
if (lastOption && !isLeaf(lastOption, fieldNames.value)) {
const pathKey = toPathKey(valueCells);
loadingKeys.value = [...loadingKeys.value, pathKey];
loadData.value(rawOptions);
}
};
watchEffect(() => {
if (loadingKeys.value.length) {
loadingKeys.value.forEach((loadingKey) => {
const valueStrCells = toPathValueStr(loadingKey);
const optionList = toPathOptions(valueStrCells, options.value, fieldNames.value, true).map((_ref2) => {
let {
option
} = _ref2;
return option;
});
const lastOption = optionList[optionList.length - 1];
if (!lastOption || lastOption[fieldNames.value.children] || isLeaf(lastOption, fieldNames.value)) {
loadingKeys.value = loadingKeys.value.filter((key2) => key2 !== loadingKey);
}
});
}
});
const checkedSet = computed(() => new Set(toPathKeys(values.value)));
const halfCheckedSet = computed(() => new Set(toPathKeys(halfValues.value)));
const [activeValueCells, setActiveValueCells] = useActive();
const onPathOpen = (nextValueCells) => {
setActiveValueCells(nextValueCells);
internalLoadData(nextValueCells);
};
const isSelectable = (option) => {
const {
disabled
} = option;
const isMergedLeaf = isLeaf(option, fieldNames.value);
return !disabled && (isMergedLeaf || changeOnSelect.value || baseProps2.multiple);
};
const onPathSelect = function(valuePath, leaf) {
let fromKeyboard = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
onSelect(valuePath);
if (!baseProps2.multiple && (leaf || changeOnSelect.value && (expandTrigger.value === "hover" || fromKeyboard))) {
baseProps2.toggleOpen(false);
}
};
const mergedOptions = computed(() => {
if (baseProps2.searchValue) {
return searchOptions.value;
}
return options.value;
});
const optionColumns = computed(() => {
const optionList = [{
options: mergedOptions.value
}];
let currentList = mergedOptions.value;
for (let i = 0; i < activeValueCells.value.length; i += 1) {
const activeValueCell = activeValueCells.value[i];
const currentOption = currentList.find((option) => option[fieldNames.value.value] === activeValueCell);
const subOptions = currentOption === null || currentOption === void 0 ? void 0 : currentOption[fieldNames.value.children];
if (!(subOptions === null || subOptions === void 0 ? void 0 : subOptions.length)) {
break;
}
currentList = subOptions;
optionList.push({
options: subOptions
});
}
return optionList;
});
const onKeyboardSelect = (selectValueCells, option) => {
if (isSelectable(option)) {
onPathSelect(selectValueCells, isLeaf(option, fieldNames.value), true);
}
};
useKeyboard(context2, mergedOptions, fieldNames, activeValueCells, onPathOpen, onKeyboardSelect);
const onListMouseDown = (event) => {
event.preventDefault();
};
return () => {
var _a, _b, _c, _d, _e;
const {
notFoundContent = ((_a = slots.notFoundContent) === null || _a === void 0 ? void 0 : _a.call(slots)) || ((_c = (_b = customSlots.value).notFoundContent) === null || _c === void 0 ? void 0 : _c.call(_b)),
multiple,
toggleOpen
} = baseProps2;
const isEmpty2 = !((_e = (_d = optionColumns.value[0]) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e.length);
const emptyList = [{
[fieldNames.value.value]: "__EMPTY__",
[FIX_LABEL]: notFoundContent,
disabled: true
}];
const columnProps = _extends(_extends({}, attrs), {
multiple: !isEmpty2 && multiple,
onSelect: onPathSelect,
onActive: onPathOpen,
onToggleOpen: toggleOpen,
checkedSet: checkedSet.value,
halfCheckedSet: halfCheckedSet.value,
loadingKeys: loadingKeys.value,
isSelectable
});
const mergedOptionColumns = isEmpty2 ? [{
options: emptyList
}] : optionColumns.value;
const columnNodes = mergedOptionColumns.map((col, index2) => {
const prevValuePath = activeValueCells.value.slice(0, index2);
const activeValue = activeValueCells.value[index2];
return createVNode(Column$1, _objectSpread$W(_objectSpread$W({
"key": index2
}, columnProps), {}, {
"prefixCls": mergedPrefixCls.value,
"options": col.options,
"prevValuePath": prevValuePath,
"activeValue": activeValue
}), null);
});
return createVNode("div", {
"class": [`${mergedPrefixCls.value}-menus`, {
[`${mergedPrefixCls.value}-menu-empty`]: isEmpty2,
[`${mergedPrefixCls.value}-rtl`]: rtl2.value
}],
"onMousedown": onListMouseDown,
"ref": containerRef
}, [columnNodes]);
};
}
});
function useMaxLevel(keyEntities) {
const maxLevel = ref(0);
const levelEntities = shallowRef();
watchEffect(() => {
const newLevelEntities = /* @__PURE__ */ new Map();
let newMaxLevel = 0;
const keyEntitiesValue = keyEntities.value || {};
for (const key2 in keyEntitiesValue) {
if (Object.prototype.hasOwnProperty.call(keyEntitiesValue, key2)) {
const entity = keyEntitiesValue[key2];
const {
level
} = entity;
let levelSet = newLevelEntities.get(level);
if (!levelSet) {
levelSet = /* @__PURE__ */ new Set();
newLevelEntities.set(level, levelSet);
}
levelSet.add(entity);
newMaxLevel = Math.max(newMaxLevel, level);
}
}
maxLevel.value = newMaxLevel;
levelEntities.value = newLevelEntities;
});
return {
maxLevel,
levelEntities
};
}
function baseCascaderProps() {
return _extends(_extends({}, omit(baseSelectPropsWithoutPrivate(), ["tokenSeparators", "mode", "showSearch"])), {
// MISC
id: String,
prefixCls: String,
fieldNames: objectType(),
children: Array,
// Value
value: {
type: [String, Number, Array]
},
defaultValue: {
type: [String, Number, Array]
},
changeOnSelect: {
type: Boolean,
default: void 0
},
displayRender: Function,
checkable: {
type: Boolean,
default: void 0
},
showCheckedStrategy: {
type: String,
default: SHOW_PARENT$1
},
// Search
showSearch: {
type: [Boolean, Object],
default: void 0
},
searchValue: String,
onSearch: Function,
// Trigger
expandTrigger: String,
// Options
options: Array,
/** @private Internal usage. Do not use in your production. */
dropdownPrefixCls: String,
loadData: Function,
// Open
/** @deprecated Use `open` instead */
popupVisible: {
type: Boolean,
default: void 0
},
dropdownClassName: String,
dropdownMenuColumnStyle: {
type: Object,
default: void 0
},
/** @deprecated Use `dropdownStyle` instead */
popupStyle: {
type: Object,
default: void 0
},
dropdownStyle: {
type: Object,
default: void 0
},
/** @deprecated Use `placement` instead */
popupPlacement: String,
placement: String,
/** @deprecated Use `onDropdownVisibleChange` instead */
onPopupVisibleChange: Function,
onDropdownVisibleChange: Function,
// Icon
expandIcon: PropTypes.any,
loadingIcon: PropTypes.any
});
}
function internalCascaderProps() {
return _extends(_extends({}, baseCascaderProps()), {
onChange: Function,
customSlots: Object
});
}
function isMultipleValue(value) {
return Array.isArray(value) && Array.isArray(value[0]);
}
function toRawValues(value) {
if (!value) {
return [];
}
if (isMultipleValue(value)) {
return value;
}
return (value.length === 0 ? [] : [value]).map((val) => Array.isArray(val) ? val : [val]);
}
const Cascader$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Cascader",
inheritAttrs: false,
props: initDefaultProps(internalCascaderProps(), {}),
setup(props2, _ref) {
let {
attrs,
expose,
slots
} = _ref;
const mergedId = useId$1(toRef(props2, "id"));
const multiple = computed(() => !!props2.checkable);
const [rawValues, setRawValues] = useMergedState(props2.defaultValue, {
value: computed(() => props2.value),
postState: toRawValues
});
const mergedFieldNames = computed(() => fillFieldNames$2(props2.fieldNames));
const mergedOptions = computed(() => props2.options || []);
const pathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
const getValueByKeyPath = (pathKeys) => {
const keyPathEntities = pathKeyEntities.value;
return pathKeys.map((pathKey) => {
const {
nodes
} = keyPathEntities[pathKey];
return nodes.map((node) => node[mergedFieldNames.value.value]);
});
};
const [mergedSearchValue, setSearchValue] = useMergedState("", {
value: computed(() => props2.searchValue),
postState: (search) => search || ""
});
const onInternalSearch = (searchText, info) => {
setSearchValue(searchText);
if (info.source !== "blur" && props2.onSearch) {
props2.onSearch(searchText);
}
};
const {
showSearch: mergedShowSearch,
searchConfig: mergedSearchConfig
} = useSearchConfig(toRef(props2, "showSearch"));
const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, computed(() => props2.dropdownPrefixCls || props2.prefixCls), mergedSearchConfig, toRef(props2, "changeOnSelect"));
const missingValuesInfo = useMissingValues(mergedOptions, mergedFieldNames, rawValues);
const [checkedValues, halfCheckedValues, missingCheckedValues] = [ref([]), ref([]), ref([])];
const {
maxLevel,
levelEntities
} = useMaxLevel(pathKeyEntities);
watchEffect(() => {
const [existValues, missingValues] = missingValuesInfo.value;
if (!multiple.value || !rawValues.value.length) {
[checkedValues.value, halfCheckedValues.value, missingCheckedValues.value] = [existValues, [], missingValues];
return;
}
const keyPathValues = toPathKeys(existValues);
const keyPathEntities = pathKeyEntities.value;
const {
checkedKeys,
halfCheckedKeys
} = conductCheck(keyPathValues, true, keyPathEntities, maxLevel.value, levelEntities.value);
[checkedValues.value, halfCheckedValues.value, missingCheckedValues.value] = [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
});
const deDuplicatedValues = computed(() => {
const checkedKeys = toPathKeys(checkedValues.value);
const deduplicateKeys = formatStrategyValues$1(checkedKeys, pathKeyEntities.value, props2.showCheckedStrategy);
return [...missingCheckedValues.value, ...getValueByKeyPath(deduplicateKeys)];
});
const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, toRef(props2, "displayRender"));
const triggerChange = (nextValues) => {
setRawValues(nextValues);
if (props2.onChange) {
const nextRawValues = toRawValues(nextValues);
const valueOptions = nextRawValues.map((valueCells) => toPathOptions(valueCells, mergedOptions.value, mergedFieldNames.value).map((valueOpt) => valueOpt.option));
const triggerValues = multiple.value ? nextRawValues : nextRawValues[0];
const triggerOptions = multiple.value ? valueOptions : valueOptions[0];
props2.onChange(triggerValues, triggerOptions);
}
};
const onInternalSelect = (valuePath) => {
setSearchValue("");
if (!multiple.value) {
triggerChange(valuePath);
} else {
const pathKey = toPathKey(valuePath);
const checkedPathKeys = toPathKeys(checkedValues.value);
const halfCheckedPathKeys = toPathKeys(halfCheckedValues.value);
const existInChecked = checkedPathKeys.includes(pathKey);
const existInMissing = missingCheckedValues.value.some((valueCells) => toPathKey(valueCells) === pathKey);
let nextCheckedValues = checkedValues.value;
let nextMissingValues = missingCheckedValues.value;
if (existInMissing && !existInChecked) {
nextMissingValues = missingCheckedValues.value.filter((valueCells) => toPathKey(valueCells) !== pathKey);
} else {
const nextRawCheckedKeys = existInChecked ? checkedPathKeys.filter((key2) => key2 !== pathKey) : [...checkedPathKeys, pathKey];
let checkedKeys;
if (existInChecked) {
({
checkedKeys
} = conductCheck(nextRawCheckedKeys, {
halfCheckedKeys: halfCheckedPathKeys
}, pathKeyEntities.value, maxLevel.value, levelEntities.value));
} else {
({
checkedKeys
} = conductCheck(nextRawCheckedKeys, true, pathKeyEntities.value, maxLevel.value, levelEntities.value));
}
const deDuplicatedKeys = formatStrategyValues$1(checkedKeys, pathKeyEntities.value, props2.showCheckedStrategy);
nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);
}
triggerChange([...nextMissingValues, ...nextCheckedValues]);
}
};
const onDisplayValuesChange = (_, info) => {
if (info.type === "clear") {
triggerChange([]);
return;
}
const {
valueCells
} = info.values[0];
onInternalSelect(valueCells);
};
const mergedOpen = computed(() => props2.open !== void 0 ? props2.open : props2.popupVisible);
const mergedDropdownStyle = computed(() => props2.dropdownStyle || props2.popupStyle || {});
const mergedPlacement = computed(() => props2.placement || props2.popupPlacement);
const onInternalDropdownVisibleChange = (nextVisible) => {
var _a, _b;
(_a = props2.onDropdownVisibleChange) === null || _a === void 0 ? void 0 : _a.call(props2, nextVisible);
(_b = props2.onPopupVisibleChange) === null || _b === void 0 ? void 0 : _b.call(props2, nextVisible);
};
const {
changeOnSelect,
checkable,
dropdownPrefixCls,
loadData,
expandTrigger,
expandIcon,
loadingIcon,
dropdownMenuColumnStyle,
customSlots,
dropdownClassName
} = toRefs(props2);
useProvideCascader({
options: mergedOptions,
fieldNames: mergedFieldNames,
values: checkedValues,
halfValues: halfCheckedValues,
changeOnSelect,
onSelect: onInternalSelect,
checkable,
searchOptions,
dropdownPrefixCls,
loadData,
expandTrigger,
expandIcon,
loadingIcon,
dropdownMenuColumnStyle,
customSlots
});
const selectRef = ref();
expose({
focus() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.blur();
},
scrollTo(arg) {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(arg);
}
});
const pickProps = computed(() => {
return omit(props2, [
"id",
"prefixCls",
"fieldNames",
// Value
"defaultValue",
"value",
"changeOnSelect",
"onChange",
"displayRender",
"checkable",
// Search
"searchValue",
"onSearch",
"showSearch",
// Trigger
"expandTrigger",
// Options
"options",
"dropdownPrefixCls",
"loadData",
// Open
"popupVisible",
"open",
"dropdownClassName",
"dropdownMenuColumnStyle",
"popupPlacement",
"placement",
"onDropdownVisibleChange",
"onPopupVisibleChange",
// Icon
"expandIcon",
"loadingIcon",
"customSlots",
"showCheckedStrategy",
// Children
"children"
]);
});
return () => {
const emptyOptions = !(mergedSearchValue.value ? searchOptions.value : mergedOptions.value).length;
const {
dropdownMatchSelectWidth = false
} = props2;
const dropdownStyle = (
// Search to match width
mergedSearchValue.value && mergedSearchConfig.value.matchInputWidth || // Empty keep the width
emptyOptions ? {} : {
minWidth: "auto"
}
);
return createVNode(BaseSelect, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, pickProps.value), attrs), {}, {
"ref": selectRef,
"id": mergedId,
"prefixCls": props2.prefixCls,
"dropdownMatchSelectWidth": dropdownMatchSelectWidth,
"dropdownStyle": _extends(_extends({}, mergedDropdownStyle.value), dropdownStyle),
"displayValues": displayValues.value,
"onDisplayValuesChange": onDisplayValuesChange,
"mode": multiple.value ? "multiple" : void 0,
"searchValue": mergedSearchValue.value,
"onSearch": onInternalSearch,
"showSearch": mergedShowSearch.value,
"OptionList": OptionList$1,
"emptyOptions": emptyOptions,
"open": mergedOpen.value,
"dropdownClassName": dropdownClassName.value,
"placement": mergedPlacement.value,
"onDropdownVisibleChange": onInternalDropdownVisibleChange,
"getRawInputElement": () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
}
}), slots);
};
}
});
const isStyleNameSupport = (styleName) => {
return false;
};
function isStyleSupport(styleName, styleValue) {
return isStyleNameSupport();
}
const useFlexGapSupport = (() => {
const flexible = shallowRef(false);
return flexible;
});
const RowContextKey = Symbol("rowContextKey");
const useProvideRow = (state) => {
provide(RowContextKey, state);
};
const useInjectRow = () => {
return inject(RowContextKey, {
gutter: computed(() => void 0),
wrap: computed(() => void 0),
supportFlexGap: computed(() => void 0)
});
};
const genGridRowStyle = (token) => {
const {
componentCls
} = token;
return {
// Grid system
[componentCls]: {
display: "flex",
flexFlow: "row wrap",
minWidth: 0,
"&::before, &::after": {
display: "flex"
},
"&-no-wrap": {
flexWrap: "nowrap"
},
// The origin of the X-axis
"&-start": {
justifyContent: "flex-start"
},
// The center of the X-axis
"&-center": {
justifyContent: "center"
},
// The opposite of the X-axis
"&-end": {
justifyContent: "flex-end"
},
"&-space-between": {
justifyContent: "space-between"
},
"&-space-around ": {
justifyContent: "space-around"
},
"&-space-evenly ": {
justifyContent: "space-evenly"
},
// Align at the top
"&-top": {
alignItems: "flex-start"
},
// Align at the center
"&-middle": {
alignItems: "center"
},
"&-bottom": {
alignItems: "flex-end"
}
}
};
};
const genGridColStyle = (token) => {
const {
componentCls
} = token;
return {
// Grid system
[componentCls]: {
position: "relative",
maxWidth: "100%",
// Prevent columns from collapsing when empty
minHeight: 1
}
};
};
const genLoopGridColumnsStyle = (token, sizeCls) => {
const {
componentCls,
gridColumns
} = token;
const gridColumnsStyle = {};
for (let i = gridColumns; i >= 0; i--) {
if (i === 0) {
gridColumnsStyle[`${componentCls}${sizeCls}-${i}`] = {
display: "none"
};
gridColumnsStyle[`${componentCls}-push-${i}`] = {
insetInlineStart: "auto"
};
gridColumnsStyle[`${componentCls}-pull-${i}`] = {
insetInlineEnd: "auto"
};
gridColumnsStyle[`${componentCls}${sizeCls}-push-${i}`] = {
insetInlineStart: "auto"
};
gridColumnsStyle[`${componentCls}${sizeCls}-pull-${i}`] = {
insetInlineEnd: "auto"
};
gridColumnsStyle[`${componentCls}${sizeCls}-offset-${i}`] = {
marginInlineEnd: 0
};
gridColumnsStyle[`${componentCls}${sizeCls}-order-${i}`] = {
order: 0
};
} else {
gridColumnsStyle[`${componentCls}${sizeCls}-${i}`] = {
display: "block",
flex: `0 0 ${i / gridColumns * 100}%`,
maxWidth: `${i / gridColumns * 100}%`
};
gridColumnsStyle[`${componentCls}${sizeCls}-push-${i}`] = {
insetInlineStart: `${i / gridColumns * 100}%`
};
gridColumnsStyle[`${componentCls}${sizeCls}-pull-${i}`] = {
insetInlineEnd: `${i / gridColumns * 100}%`
};
gridColumnsStyle[`${componentCls}${sizeCls}-offset-${i}`] = {
marginInlineStart: `${i / gridColumns * 100}%`
};
gridColumnsStyle[`${componentCls}${sizeCls}-order-${i}`] = {
order: i
};
}
}
return gridColumnsStyle;
};
const genGridStyle = (token, sizeCls) => genLoopGridColumnsStyle(token, sizeCls);
const genGridMediaStyle = (token, screenSize, sizeCls) => ({
[`@media (min-width: ${screenSize}px)`]: _extends({}, genGridStyle(token, sizeCls))
});
const useRowStyle = genComponentStyleHook("Grid", (token) => [genGridRowStyle(token)]);
const useColStyle = genComponentStyleHook("Grid", (token) => {
const gridToken = merge(token, {
gridColumns: 24
// Row is divided into 24 parts in Grid
});
const gridMediaSizesMap = {
"-sm": gridToken.screenSMMin,
"-md": gridToken.screenMDMin,
"-lg": gridToken.screenLGMin,
"-xl": gridToken.screenXLMin,
"-xxl": gridToken.screenXXLMin
};
return [genGridColStyle(gridToken), genGridStyle(gridToken, ""), genGridStyle(gridToken, "-xs"), Object.keys(gridMediaSizesMap).map((key2) => genGridMediaStyle(gridToken, gridMediaSizesMap[key2], key2)).reduce((pre, cur) => _extends(_extends({}, pre), cur), {})];
});
const rowProps = () => ({
align: someType([String, Object]),
justify: someType([String, Object]),
prefixCls: String,
gutter: someType([Number, Array, Object], 0),
wrap: {
type: Boolean,
default: void 0
}
});
const ARow = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARow",
inheritAttrs: false,
props: rowProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("row", props2);
const [wrapSSR, hashId] = useRowStyle(prefixCls);
useResponsiveObserver();
const screens = ref({
xs: true,
sm: true,
md: true,
lg: true,
xl: true,
xxl: true
});
const curScreens = ref({
xs: false,
sm: false,
md: false,
lg: false,
xl: false,
xxl: false
});
const mergePropsByScreen = (oriProp) => {
return computed(() => {
if (typeof props2[oriProp] === "string") {
return props2[oriProp];
}
if (typeof props2[oriProp] !== "object") {
return "";
}
for (let i = 0; i < responsiveArray.length; i++) {
const breakpoint = responsiveArray[i];
if (!curScreens.value[breakpoint]) continue;
const curVal = props2[oriProp][breakpoint];
if (curVal !== void 0) {
return curVal;
}
}
return "";
});
};
const mergeAlign = mergePropsByScreen("align");
const mergeJustify = mergePropsByScreen("justify");
const supportFlexGap = useFlexGapSupport();
const gutter = computed(() => {
const results = [void 0, void 0];
const {
gutter: gutter2 = 0
} = props2;
const normalizedGutter = Array.isArray(gutter2) ? gutter2 : [gutter2, void 0];
normalizedGutter.forEach((g, index2) => {
if (typeof g === "object") {
for (let i = 0; i < responsiveArray.length; i++) {
const breakpoint = responsiveArray[i];
if (screens.value[breakpoint] && g[breakpoint] !== void 0) {
results[index2] = g[breakpoint];
break;
}
}
} else {
results[index2] = g;
}
});
return results;
});
useProvideRow({
gutter,
supportFlexGap,
wrap: computed(() => props2.wrap)
});
const classes = computed(() => classNames(prefixCls.value, {
[`${prefixCls.value}-no-wrap`]: props2.wrap === false,
[`${prefixCls.value}-${mergeJustify.value}`]: mergeJustify.value,
[`${prefixCls.value}-${mergeAlign.value}`]: mergeAlign.value,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value));
const rowStyle = computed(() => {
const gt = gutter.value;
const style = {};
const horizontalGutter = gt[0] != null && gt[0] > 0 ? `${gt[0] / -2}px` : void 0;
const verticalGutter = gt[1] != null && gt[1] > 0 ? `${gt[1] / -2}px` : void 0;
if (horizontalGutter) {
style.marginLeft = horizontalGutter;
style.marginRight = horizontalGutter;
}
if (supportFlexGap.value) {
style.rowGap = `${gt[1]}px`;
} else if (verticalGutter) {
style.marginTop = verticalGutter;
style.marginBottom = verticalGutter;
}
return style;
});
return () => {
var _a;
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classes.value,
"style": _extends(_extends({}, rowStyle.value), attrs.style)
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]));
};
}
});
function toArray$5(value) {
if (value === void 0 || value === null) {
return [];
}
return Array.isArray(value) ? value : [value];
}
function get(entity, path2) {
let current = entity;
for (let i = 0; i < path2.length; i += 1) {
if (current === null || current === void 0) {
return void 0;
}
current = current[path2[i]];
}
return current;
}
function internalSet(entity, paths, value, removeIfUndefined) {
if (!paths.length) {
return value;
}
const [path2, ...restPath] = paths;
let clone;
if (!entity && typeof path2 === "number") {
clone = [];
} else if (Array.isArray(entity)) {
clone = [...entity];
} else {
clone = _extends({}, entity);
}
if (removeIfUndefined && value === void 0 && restPath.length === 1) {
delete clone[path2][restPath[0]];
} else {
clone[path2] = internalSet(clone[path2], restPath, value, removeIfUndefined);
}
return clone;
}
function set(entity, paths, value) {
let removeIfUndefined = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
if (paths.length && removeIfUndefined && value === void 0 && !get(entity, paths.slice(0, -1))) {
return entity;
}
return internalSet(entity, paths, value, removeIfUndefined);
}
function getNamePath(path2) {
return toArray$5(path2);
}
function getValue(store, namePath) {
const value = get(store, namePath);
return value;
}
function setValue(store, namePath, value) {
let removeIfUndefined = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
const newStore = set(store, namePath, value, removeIfUndefined);
return newStore;
}
function containsNamePath(namePathList, namePath) {
return namePathList && namePathList.some((path2) => matchNamePath(path2, namePath));
}
function isObject$1(obj) {
return typeof obj === "object" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;
}
function internalSetValues(store, values) {
const newStore = Array.isArray(store) ? [...store] : _extends({}, store);
if (!values) {
return newStore;
}
Object.keys(values).forEach((key2) => {
const prevValue = newStore[key2];
const value = values[key2];
const recursive = isObject$1(prevValue) && isObject$1(value);
newStore[key2] = recursive ? internalSetValues(prevValue, value || {}) : value;
});
return newStore;
}
function setValues(store) {
for (var _len = arguments.length, restValues = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
restValues[_key - 1] = arguments[_key];
}
return restValues.reduce((current, newStore) => internalSetValues(current, newStore), store);
}
function cloneByNamePathList(store, namePathList) {
let newStore = {};
namePathList.forEach((namePath) => {
const value = getValue(store, namePath);
newStore = setValue(newStore, namePath, value);
});
return newStore;
}
function matchNamePath(namePath, changedNamePath) {
if (!namePath || !changedNamePath || namePath.length !== changedNamePath.length) {
return false;
}
return namePath.every((nameUnit, i) => changedNamePath[i] === nameUnit);
}
const typeTemplate = "'${name}' is not a valid ${type}";
const defaultValidateMessages = {
default: "Validation error on field '${name}'",
required: "'${name}' is required",
enum: "'${name}' must be one of [${enum}]",
whitespace: "'${name}' cannot be empty",
date: {
format: "'${name}' is invalid for format date",
parse: "'${name}' could not be parsed as date",
invalid: "'${name}' is invalid date"
},
types: {
string: typeTemplate,
method: typeTemplate,
array: typeTemplate,
object: typeTemplate,
number: typeTemplate,
date: typeTemplate,
boolean: typeTemplate,
integer: typeTemplate,
float: typeTemplate,
regexp: typeTemplate,
email: typeTemplate,
url: typeTemplate,
hex: typeTemplate
},
string: {
len: "'${name}' must be exactly ${len} characters",
min: "'${name}' must be at least ${min} characters",
max: "'${name}' cannot be longer than ${max} characters",
range: "'${name}' must be between ${min} and ${max} characters"
},
number: {
len: "'${name}' must equal ${len}",
min: "'${name}' cannot be less than ${min}",
max: "'${name}' cannot be greater than ${max}",
range: "'${name}' must be between ${min} and ${max}"
},
array: {
len: "'${name}' must be exactly ${len} in length",
min: "'${name}' cannot be less than ${min} in length",
max: "'${name}' cannot be greater than ${max} in length",
range: "'${name}' must be between ${min} and ${max} in length"
},
pattern: {
mismatch: "'${name}' does not match pattern ${pattern}"
}
};
var __awaiter$2 = function(thisArg, _arguments, P, generator2) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator2.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator2["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator2 = generator2.apply(thisArg, [])).next());
});
};
const AsyncValidator = RawAsyncValidator;
function replaceMessage(template, kv) {
return template.replace(/\$\{\w+\}/g, (str) => {
const key2 = str.slice(2, -1);
return kv[key2];
});
}
function validateRule(name, value, rule, options, messageVariables) {
return __awaiter$2(this, void 0, void 0, function* () {
const cloneRule = _extends({}, rule);
delete cloneRule.ruleIndex;
delete cloneRule.trigger;
let subRuleField = null;
if (cloneRule && cloneRule.type === "array" && cloneRule.defaultField) {
subRuleField = cloneRule.defaultField;
delete cloneRule.defaultField;
}
const validator = new AsyncValidator({
[name]: [cloneRule]
});
const messages = setValues({}, defaultValidateMessages, options.validateMessages);
validator.messages(messages);
let result = [];
try {
yield Promise.resolve(validator.validate({
[name]: value
}, _extends({}, options)));
} catch (errObj) {
if (errObj.errors) {
result = errObj.errors.map((_ref, index2) => {
let {
message
} = _ref;
return (
// Wrap VueNode with `key`
isValidElement(message) ? cloneVNode(message, {
key: `error_${index2}`
}) : message
);
});
} else {
console.error(errObj);
result = [messages.default()];
}
}
if (!result.length && subRuleField) {
const subResults = yield Promise.all(value.map((subValue, i) => validateRule(`${name}.${i}`, subValue, subRuleField, options, messageVariables)));
return subResults.reduce((prev, errors) => [...prev, ...errors], []);
}
const kv = _extends(_extends(_extends({}, rule), {
name,
enum: (rule.enum || []).join(", ")
}), messageVariables);
const fillVariableResult = result.map((error) => {
if (typeof error === "string") {
return replaceMessage(error, kv);
}
return error;
});
return fillVariableResult;
});
}
function validateRules(namePath, value, rules, options, validateFirst, messageVariables) {
const name = namePath.join(".");
const filledRules = rules.map((currentRule, ruleIndex) => {
const originValidatorFunc = currentRule.validator;
const cloneRule = _extends(_extends({}, currentRule), {
ruleIndex
});
if (originValidatorFunc) {
cloneRule.validator = (rule, val, callback) => {
let hasPromise = false;
const wrappedCallback = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
Promise.resolve().then(() => {
if (!hasPromise) {
callback(...args);
}
});
};
const promise = originValidatorFunc(rule, val, wrappedCallback);
hasPromise = promise && typeof promise.then === "function" && typeof promise.catch === "function";
if (hasPromise) {
promise.then(() => {
callback();
}).catch((err) => {
callback(err || " ");
});
}
};
}
return cloneRule;
}).sort((_ref2, _ref3) => {
let {
warningOnly: w1,
ruleIndex: i1
} = _ref2;
let {
warningOnly: w2,
ruleIndex: i2
} = _ref3;
if (!!w1 === !!w2) {
return i1 - i2;
}
if (w1) {
return 1;
}
return -1;
});
let summaryPromise;
if (validateFirst === true) {
summaryPromise = new Promise((resolve, reject) => __awaiter$2(this, void 0, void 0, function* () {
for (let i = 0; i < filledRules.length; i += 1) {
const rule = filledRules[i];
const errors = yield validateRule(name, value, rule, options, messageVariables);
if (errors.length) {
reject([{
errors,
rule
}]);
return;
}
}
resolve([]);
}));
} else {
const rulePromises = filledRules.map((rule) => validateRule(name, value, rule, options, messageVariables).then((errors) => ({
errors,
rule
})));
summaryPromise = (validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises)).then((errors) => {
return Promise.reject(errors);
});
}
summaryPromise.catch((e) => e);
return summaryPromise;
}
function finishOnAllFailed(rulePromises) {
return __awaiter$2(this, void 0, void 0, function* () {
return Promise.all(rulePromises).then((errorsList) => {
const errors = [].concat(...errorsList);
return errors;
});
});
}
function finishOnFirstFailed(rulePromises) {
return __awaiter$2(this, void 0, void 0, function* () {
let count = 0;
return new Promise((resolve) => {
rulePromises.forEach((promise) => {
promise.then((ruleError) => {
if (ruleError.errors.length) {
resolve([ruleError]);
}
count += 1;
if (count === rulePromises.length) {
resolve([]);
}
});
});
});
});
}
const FormContextKey = Symbol("formContextKey");
const useProvideForm = (state) => {
provide(FormContextKey, state);
};
const useInjectForm = () => {
return inject(FormContextKey, {
name: computed(() => void 0),
labelAlign: computed(() => "right"),
vertical: computed(() => false),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
addField: (_eventKey, _field) => {
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
removeField: (_eventKey) => {
},
model: computed(() => void 0),
rules: computed(() => void 0),
colon: computed(() => void 0),
labelWrap: computed(() => void 0),
labelCol: computed(() => void 0),
requiredMark: computed(() => false),
validateTrigger: computed(() => void 0),
onValidate: () => {
},
validateMessages: computed(() => defaultValidateMessages)
});
};
const FormItemPrefixContextKey = Symbol("formItemPrefixContextKey");
const useProvideFormItemPrefix = (state) => {
provide(FormItemPrefixContextKey, state);
};
const useInjectFormItemPrefix = () => {
return inject(FormItemPrefixContextKey, {
prefixCls: computed(() => "")
});
};
function parseFlex(flex) {
if (typeof flex === "number") {
return `${flex} ${flex} auto`;
}
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
return `0 0 ${flex}`;
}
return flex;
}
const colProps = () => ({
span: [String, Number],
order: [String, Number],
offset: [String, Number],
push: [String, Number],
pull: [String, Number],
xs: {
type: [String, Number, Object],
default: void 0
},
sm: {
type: [String, Number, Object],
default: void 0
},
md: {
type: [String, Number, Object],
default: void 0
},
lg: {
type: [String, Number, Object],
default: void 0
},
xl: {
type: [String, Number, Object],
default: void 0
},
xxl: {
type: [String, Number, Object],
default: void 0
},
prefixCls: String,
flex: [String, Number]
});
const sizes = ["xs", "sm", "md", "lg", "xl", "xxl"];
const Col = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACol",
inheritAttrs: false,
props: colProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
gutter,
supportFlexGap,
wrap
} = useInjectRow();
const {
prefixCls,
direction
} = useConfigInject("col", props2);
const [wrapSSR, hashId] = useColStyle(prefixCls);
const classes = computed(() => {
const {
span,
order,
offset: offset2,
push,
pull
} = props2;
const pre = prefixCls.value;
let sizeClassObj = {};
sizes.forEach((size) => {
let sizeProps = {};
const propSize = props2[size];
if (typeof propSize === "number") {
sizeProps.span = propSize;
} else if (typeof propSize === "object") {
sizeProps = propSize || {};
}
sizeClassObj = _extends(_extends({}, sizeClassObj), {
[`${pre}-${size}-${sizeProps.span}`]: sizeProps.span !== void 0,
[`${pre}-${size}-order-${sizeProps.order}`]: sizeProps.order || sizeProps.order === 0,
[`${pre}-${size}-offset-${sizeProps.offset}`]: sizeProps.offset || sizeProps.offset === 0,
[`${pre}-${size}-push-${sizeProps.push}`]: sizeProps.push || sizeProps.push === 0,
[`${pre}-${size}-pull-${sizeProps.pull}`]: sizeProps.pull || sizeProps.pull === 0,
[`${pre}-rtl`]: direction.value === "rtl"
});
});
return classNames(pre, {
[`${pre}-${span}`]: span !== void 0,
[`${pre}-order-${order}`]: order,
[`${pre}-offset-${offset2}`]: offset2,
[`${pre}-push-${push}`]: push,
[`${pre}-pull-${pull}`]: pull
}, sizeClassObj, attrs.class, hashId.value);
});
const mergedStyle = computed(() => {
const {
flex
} = props2;
const gutterVal = gutter.value;
const style = {};
if (gutterVal && gutterVal[0] > 0) {
const horizontalGutter = `${gutterVal[0] / 2}px`;
style.paddingLeft = horizontalGutter;
style.paddingRight = horizontalGutter;
}
if (gutterVal && gutterVal[1] > 0 && !supportFlexGap.value) {
const verticalGutter = `${gutterVal[1] / 2}px`;
style.paddingTop = verticalGutter;
style.paddingBottom = verticalGutter;
}
if (flex) {
style.flex = parseFlex(flex);
if (wrap.value === false && !style.minWidth) {
style.minWidth = 0;
}
}
return style;
});
return () => {
var _a;
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classes.value,
"style": [mergedStyle.value, attrs.style]
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]));
};
}
});
const FormItemLabel = (props2, _ref) => {
let {
slots,
emit,
attrs
} = _ref;
var _a, _b, _c, _d, _e;
const {
prefixCls,
htmlFor,
labelCol,
labelAlign,
colon,
required,
requiredMark
} = _extends(_extends({}, props2), attrs);
const [formLocale] = useLocaleReceiver("Form");
const label = (_a = props2.label) !== null && _a !== void 0 ? _a : (_b = slots.label) === null || _b === void 0 ? void 0 : _b.call(slots);
if (!label) return null;
const {
vertical,
labelAlign: contextLabelAlign,
labelCol: contextLabelCol,
labelWrap,
colon: contextColon
} = useInjectForm();
const mergedLabelCol = labelCol || (contextLabelCol === null || contextLabelCol === void 0 ? void 0 : contextLabelCol.value) || {};
const mergedLabelAlign = labelAlign || (contextLabelAlign === null || contextLabelAlign === void 0 ? void 0 : contextLabelAlign.value);
const labelClsBasic = `${prefixCls}-item-label`;
const labelColClassName = classNames(labelClsBasic, mergedLabelAlign === "left" && `${labelClsBasic}-left`, mergedLabelCol.class, {
[`${labelClsBasic}-wrap`]: !!labelWrap.value
});
let labelChildren = label;
const computedColon = colon === true || (contextColon === null || contextColon === void 0 ? void 0 : contextColon.value) !== false && colon !== false;
const haveColon = computedColon && !vertical.value;
if (haveColon && typeof label === "string" && label.trim() !== "") {
labelChildren = label.replace(/[:|:]\s*$/, "");
}
if (props2.tooltip || slots.tooltip) {
const tooltipNode = createVNode("span", {
"class": `${prefixCls}-item-tooltip`
}, [createVNode(__nuxt_component_2$4, {
"title": props2.tooltip
}, {
default: () => [createVNode(QuestionCircleOutlined, null, null)]
})]);
labelChildren = createVNode(Fragment, null, [labelChildren, slots.tooltip ? (_c = slots.tooltip) === null || _c === void 0 ? void 0 : _c.call(slots, {
class: `${prefixCls}-item-tooltip`
}) : tooltipNode]);
}
if (requiredMark === "optional" && !required) {
labelChildren = createVNode(Fragment, null, [labelChildren, createVNode("span", {
"class": `${prefixCls}-item-optional`
}, [((_d = formLocale.value) === null || _d === void 0 ? void 0 : _d.optional) || ((_e = localeValues.Form) === null || _e === void 0 ? void 0 : _e.optional)])]);
}
const labelClassName = classNames({
[`${prefixCls}-item-required`]: required,
[`${prefixCls}-item-required-mark-optional`]: requiredMark === "optional",
[`${prefixCls}-item-no-colon`]: !computedColon
});
return createVNode(Col, _objectSpread$W(_objectSpread$W({}, mergedLabelCol), {}, {
"class": labelColClassName
}), {
default: () => [createVNode("label", {
"for": htmlFor,
"class": labelClassName,
"title": typeof label === "string" ? label : "",
"onClick": (e) => emit("click", e)
}, [labelChildren])]
});
};
FormItemLabel.displayName = "FormItemLabel";
FormItemLabel.inheritAttrs = false;
const genFormValidateMotionStyle = (token) => {
const {
componentCls
} = token;
const helpCls = `${componentCls}-show-help`;
const helpItemCls = `${componentCls}-show-help-item`;
return {
[helpCls]: {
// Explain holder
transition: `opacity ${token.motionDurationSlow} ${token.motionEaseInOut}`,
"&-appear, &-enter": {
opacity: 0,
"&-active": {
opacity: 1
}
},
"&-leave": {
opacity: 1,
"&-active": {
opacity: 0
}
},
// Explain
[helpItemCls]: {
overflow: "hidden",
transition: `height ${token.motionDurationSlow} ${token.motionEaseInOut},
opacity ${token.motionDurationSlow} ${token.motionEaseInOut},
transform ${token.motionDurationSlow} ${token.motionEaseInOut} !important`,
[`&${helpItemCls}-appear, &${helpItemCls}-enter`]: {
transform: `translateY(-5px)`,
opacity: 0,
[`&-active`]: {
transform: "translateY(0)",
opacity: 1
}
},
[`&${helpItemCls}-leave-active`]: {
transform: `translateY(-5px)`
}
}
}
};
};
const resetForm = (token) => ({
legend: {
display: "block",
width: "100%",
marginBottom: token.marginLG,
padding: 0,
color: token.colorTextDescription,
fontSize: token.fontSizeLG,
lineHeight: "inherit",
border: 0,
borderBottom: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`
},
label: {
fontSize: token.fontSize
},
'input[type="search"]': {
boxSizing: "border-box"
},
// Position radios and checkboxes better
'input[type="radio"], input[type="checkbox"]': {
lineHeight: "normal"
},
'input[type="file"]': {
display: "block"
},
// Make range inputs behave like textual form controls
'input[type="range"]': {
display: "block",
width: "100%"
},
// Make multiple select elements height not fixed
"select[multiple], select[size]": {
height: "auto"
},
// Focus for file, radio, and checkbox
[`input[type='file']:focus,
input[type='radio']:focus,
input[type='checkbox']:focus`]: {
outline: 0,
boxShadow: `0 0 0 ${token.controlOutlineWidth}px ${token.controlOutline}`
},
// Adjust output element
output: {
display: "block",
paddingTop: 15,
color: token.colorText,
fontSize: token.fontSize,
lineHeight: token.lineHeight
}
});
const genFormSize = (token, height) => {
const {
formItemCls
} = token;
return {
[formItemCls]: {
[`${formItemCls}-label > label`]: {
height
},
[`${formItemCls}-control-input`]: {
minHeight: height
}
}
};
};
const genFormStyle = (token) => {
const {
componentCls
} = token;
return {
[token.componentCls]: _extends(_extends(_extends({}, resetComponent(token)), resetForm(token)), {
[`${componentCls}-text`]: {
display: "inline-block",
paddingInlineEnd: token.paddingSM
},
// ================================================================
// = Size =
// ================================================================
"&-small": _extends({}, genFormSize(token, token.controlHeightSM)),
"&-large": _extends({}, genFormSize(token, token.controlHeightLG))
})
};
};
const genFormItemStyle = (token) => {
const {
formItemCls,
iconCls,
componentCls,
rootPrefixCls
} = token;
return {
[formItemCls]: _extends(_extends({}, resetComponent(token)), {
marginBottom: token.marginLG,
verticalAlign: "top",
"&-with-help": {
transition: "none"
},
[`&-hidden,
&-hidden.${rootPrefixCls}-row`]: {
// https://github.com/ant-design/ant-design/issues/26141
display: "none"
},
"&-has-warning": {
[`${formItemCls}-split`]: {
color: token.colorError
}
},
"&-has-error": {
[`${formItemCls}-split`]: {
color: token.colorWarning
}
},
// ==============================================================
// = Label =
// ==============================================================
[`${formItemCls}-label`]: {
display: "inline-block",
flexGrow: 0,
overflow: "hidden",
whiteSpace: "nowrap",
textAlign: "end",
verticalAlign: "middle",
"&-left": {
textAlign: "start"
},
"&-wrap": {
overflow: "unset",
lineHeight: `${token.lineHeight} - 0.25em`,
whiteSpace: "unset"
},
"> label": {
position: "relative",
display: "inline-flex",
alignItems: "center",
maxWidth: "100%",
height: token.controlHeight,
color: token.colorTextHeading,
fontSize: token.fontSize,
[`> ${iconCls}`]: {
fontSize: token.fontSize,
verticalAlign: "top"
},
// Required mark
[`&${formItemCls}-required:not(${formItemCls}-required-mark-optional)::before`]: {
display: "inline-block",
marginInlineEnd: token.marginXXS,
color: token.colorError,
fontSize: token.fontSize,
fontFamily: "SimSun, sans-serif",
lineHeight: 1,
content: '"*"',
[`${componentCls}-hide-required-mark &`]: {
display: "none"
}
},
// Optional mark
[`${formItemCls}-optional`]: {
display: "inline-block",
marginInlineStart: token.marginXXS,
color: token.colorTextDescription,
[`${componentCls}-hide-required-mark &`]: {
display: "none"
}
},
// Optional mark
[`${formItemCls}-tooltip`]: {
color: token.colorTextDescription,
cursor: "help",
writingMode: "horizontal-tb",
marginInlineStart: token.marginXXS
},
"&::after": {
content: '":"',
position: "relative",
marginBlock: 0,
marginInlineStart: token.marginXXS / 2,
marginInlineEnd: token.marginXS
},
[`&${formItemCls}-no-colon::after`]: {
content: '" "'
}
}
},
// ==============================================================
// = Input =
// ==============================================================
[`${formItemCls}-control`]: {
display: "flex",
flexDirection: "column",
flexGrow: 1,
[`&:first-child:not([class^="'${rootPrefixCls}-col-'"]):not([class*="' ${rootPrefixCls}-col-'"])`]: {
width: "100%"
},
"&-input": {
position: "relative",
display: "flex",
alignItems: "center",
minHeight: token.controlHeight,
"&-content": {
flex: "auto",
maxWidth: "100%"
}
}
},
// ==============================================================
// = Explain =
// ==============================================================
[formItemCls]: {
"&-explain, &-extra": {
clear: "both",
color: token.colorTextDescription,
fontSize: token.fontSize,
lineHeight: token.lineHeight
},
"&-explain-connected": {
width: "100%"
},
"&-extra": {
minHeight: token.controlHeightSM,
transition: `color ${token.motionDurationMid} ${token.motionEaseOut}`
// sync input color transition
},
"&-explain": {
"&-error": {
color: token.colorError
},
"&-warning": {
color: token.colorWarning
}
}
},
[`&-with-help ${formItemCls}-explain`]: {
height: "auto",
opacity: 1
},
// ==============================================================
// = Feedback Icon =
// ==============================================================
[`${formItemCls}-feedback-icon`]: {
fontSize: token.fontSize,
textAlign: "center",
visibility: "visible",
animationName: zoomIn,
animationDuration: token.motionDurationMid,
animationTimingFunction: token.motionEaseOutBack,
pointerEvents: "none",
"&-success": {
color: token.colorSuccess
},
"&-error": {
color: token.colorError
},
"&-warning": {
color: token.colorWarning
},
"&-validating": {
color: token.colorPrimary
}
}
})
};
};
const genHorizontalStyle$1 = (token) => {
const {
componentCls,
formItemCls,
rootPrefixCls
} = token;
return {
[`${componentCls}-horizontal`]: {
[`${formItemCls}-label`]: {
flexGrow: 0
},
[`${formItemCls}-control`]: {
flex: "1 1 0",
// https://github.com/ant-design/ant-design/issues/32777
// https://github.com/ant-design/ant-design/issues/33773
minWidth: 0
},
// https://github.com/ant-design/ant-design/issues/32980
[`${formItemCls}-label.${rootPrefixCls}-col-24 + ${formItemCls}-control`]: {
minWidth: "unset"
}
}
};
};
const genInlineStyle = (token) => {
const {
componentCls,
formItemCls
} = token;
return {
[`${componentCls}-inline`]: {
display: "flex",
flexWrap: "wrap",
[formItemCls]: {
flex: "none",
flexWrap: "nowrap",
marginInlineEnd: token.margin,
marginBottom: 0,
"&-with-help": {
marginBottom: token.marginLG
},
[`> ${formItemCls}-label,
> ${formItemCls}-control`]: {
display: "inline-block",
verticalAlign: "top"
},
[`> ${formItemCls}-label`]: {
flex: "none"
},
[`${componentCls}-text`]: {
display: "inline-block"
},
[`${formItemCls}-has-feedback`]: {
display: "inline-block"
}
}
}
};
};
const makeVerticalLayoutLabel = (token) => ({
margin: 0,
padding: `0 0 ${token.paddingXS}px`,
whiteSpace: "initial",
textAlign: "start",
"> label": {
margin: 0,
"&::after": {
display: "none"
}
}
});
const makeVerticalLayout = (token) => {
const {
componentCls,
formItemCls
} = token;
return {
[`${formItemCls} ${formItemCls}-label`]: makeVerticalLayoutLabel(token),
[componentCls]: {
[formItemCls]: {
flexWrap: "wrap",
[`${formItemCls}-label,
${formItemCls}-control`]: {
flex: "0 0 100%",
maxWidth: "100%"
}
}
}
};
};
const genVerticalStyle$1 = (token) => {
const {
componentCls,
formItemCls,
rootPrefixCls
} = token;
return {
[`${componentCls}-vertical`]: {
[formItemCls]: {
"&-row": {
flexDirection: "column"
},
"&-label > label": {
height: "auto"
},
[`${componentCls}-item-control`]: {
width: "100%"
}
}
},
[`${componentCls}-vertical ${formItemCls}-label,
.${rootPrefixCls}-col-24${formItemCls}-label,
.${rootPrefixCls}-col-xl-24${formItemCls}-label`]: makeVerticalLayoutLabel(token),
[`@media (max-width: ${token.screenXSMax}px)`]: [makeVerticalLayout(token), {
[componentCls]: {
[`.${rootPrefixCls}-col-xs-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
}],
[`@media (max-width: ${token.screenSMMax}px)`]: {
[componentCls]: {
[`.${rootPrefixCls}-col-sm-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
},
[`@media (max-width: ${token.screenMDMax}px)`]: {
[componentCls]: {
[`.${rootPrefixCls}-col-md-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
},
[`@media (max-width: ${token.screenLGMax}px)`]: {
[componentCls]: {
[`.${rootPrefixCls}-col-lg-24${formItemCls}-label`]: makeVerticalLayoutLabel(token)
}
}
};
};
const useStyle$C = genComponentStyleHook("Form", (token, _ref) => {
let {
rootPrefixCls
} = _ref;
const formToken = merge(token, {
formItemCls: `${token.componentCls}-item`,
rootPrefixCls
});
return [genFormStyle(formToken), genFormItemStyle(formToken), genFormValidateMotionStyle(formToken), genHorizontalStyle$1(formToken), genInlineStyle(formToken), genVerticalStyle$1(formToken), genCollapseMotion(formToken), zoomIn];
});
const ErrorList = defineComponent({
compatConfig: {
MODE: 3
},
name: "ErrorList",
inheritAttrs: false,
props: ["errors", "help", "onErrorVisibleChanged", "helpStatus", "warnings"],
setup(props2, _ref) {
let {
attrs
} = _ref;
const {
prefixCls,
status
} = useInjectFormItemPrefix();
const baseClassName = computed(() => `${prefixCls.value}-item-explain`);
const visible = computed(() => !!(props2.errors && props2.errors.length));
const innerStatus = ref(status.value);
const [, hashId] = useStyle$C(prefixCls);
watch([visible, status], () => {
if (visible.value) {
innerStatus.value = status.value;
}
});
return () => {
var _a, _b;
const colMItem = collapseMotion(`${prefixCls.value}-show-help-item`);
const transitionGroupProps = getTransitionGroupProps(`${prefixCls.value}-show-help-item`, colMItem);
transitionGroupProps.role = "alert";
transitionGroupProps.class = [hashId.value, baseClassName.value, attrs.class, `${prefixCls.value}-show-help`];
return createVNode(Transition, _objectSpread$W(_objectSpread$W({}, getTransitionProps(`${prefixCls.value}-show-help`)), {}, {
"onAfterEnter": () => props2.onErrorVisibleChanged(true),
"onAfterLeave": () => props2.onErrorVisibleChanged(false)
}), {
default: () => [withDirectives(createVNode(TransitionGroup, _objectSpread$W(_objectSpread$W({}, transitionGroupProps), {}, {
"tag": "div"
}), {
default: () => [(_b = props2.errors) === null || _b === void 0 ? void 0 : _b.map((error, index2) => createVNode("div", {
"key": index2,
"class": innerStatus.value ? `${baseClassName.value}-${innerStatus.value}` : ""
}, [error]))]
}), [[vShow, !!((_a = props2.errors) === null || _a === void 0 ? void 0 : _a.length)]])]
});
};
}
});
const FormItemInput = defineComponent({
compatConfig: {
MODE: 3
},
slots: Object,
inheritAttrs: false,
props: ["prefixCls", "errors", "hasFeedback", "onDomErrorVisibleChange", "wrapperCol", "help", "extra", "status", "marginBottom", "onErrorVisibleChanged"],
setup(props2, _ref) {
let {
slots
} = _ref;
const formContext = useInjectForm();
const {
wrapperCol: contextWrapperCol
} = formContext;
const subFormContext = _extends({}, formContext);
delete subFormContext.labelCol;
delete subFormContext.wrapperCol;
useProvideForm(subFormContext);
useProvideFormItemPrefix({
prefixCls: computed(() => props2.prefixCls),
status: computed(() => props2.status)
});
return () => {
var _a, _b, _c;
const {
prefixCls,
wrapperCol,
marginBottom,
onErrorVisibleChanged,
help = (_a = slots.help) === null || _a === void 0 ? void 0 : _a.call(slots),
errors = filterEmpty((_b = slots.errors) === null || _b === void 0 ? void 0 : _b.call(slots)),
// hasFeedback,
// status,
extra = (_c = slots.extra) === null || _c === void 0 ? void 0 : _c.call(slots)
} = props2;
const baseClassName = `${prefixCls}-item`;
const mergedWrapperCol = wrapperCol || (contextWrapperCol === null || contextWrapperCol === void 0 ? void 0 : contextWrapperCol.value) || {};
const className = classNames(`${baseClassName}-control`, mergedWrapperCol.class);
return createVNode(Col, _objectSpread$W(_objectSpread$W({}, mergedWrapperCol), {}, {
"class": className
}), {
default: () => {
var _a2;
return createVNode(Fragment, null, [createVNode("div", {
"class": `${baseClassName}-control-input`
}, [createVNode("div", {
"class": `${baseClassName}-control-input-content`
}, [(_a2 = slots.default) === null || _a2 === void 0 ? void 0 : _a2.call(slots)])]), marginBottom !== null || errors.length ? createVNode("div", {
"style": {
display: "flex",
flexWrap: "nowrap"
}
}, [createVNode(ErrorList, {
"errors": errors,
"help": help,
"class": `${baseClassName}-explain-connected`,
"onErrorVisibleChanged": onErrorVisibleChanged
}, null), !!marginBottom && createVNode("div", {
"style": {
width: 0,
height: `${marginBottom}px`
}
}, null)]) : null, extra ? createVNode("div", {
"class": `${baseClassName}-extra`
}, [extra]) : null]);
}
});
};
}
});
function useDebounce(value) {
const cacheValue = shallowRef(value.value.slice());
let timeout = null;
watchEffect(() => {
clearTimeout(timeout);
timeout = setTimeout(() => {
cacheValue.value = value.value;
}, value.value.length ? 0 : 10);
});
return cacheValue;
}
tuple$1("success", "warning", "error", "validating", "");
const iconMap = {
success: CheckCircleFilled,
warning: ExclamationCircleFilled,
error: CloseCircleFilled,
validating: LoadingOutlined
};
function getPropByPath$1(obj, namePathList, strict) {
let tempObj = obj;
const keyArr = namePathList;
let i = 0;
try {
for (let len = keyArr.length; i < len - 1; ++i) {
if (!tempObj && !strict) break;
const key2 = keyArr[i];
if (key2 in tempObj) {
tempObj = tempObj[key2];
} else {
if (strict) {
throw Error("please transfer a valid name path to form item!");
}
break;
}
}
if (strict && !tempObj) {
throw Error("please transfer a valid name path to form item!");
}
} catch (error) {
console.error("please transfer a valid name path to form item!");
}
return {
o: tempObj,
k: keyArr[i],
v: tempObj ? tempObj[keyArr[i]] : void 0
};
}
const formItemProps = () => ({
htmlFor: String,
prefixCls: String,
label: PropTypes.any,
help: PropTypes.any,
extra: PropTypes.any,
labelCol: {
type: Object
},
wrapperCol: {
type: Object
},
hasFeedback: {
type: Boolean,
default: false
},
colon: {
type: Boolean,
default: void 0
},
labelAlign: String,
prop: {
type: [String, Number, Array]
},
name: {
type: [String, Number, Array]
},
rules: [Array, Object],
autoLink: {
type: Boolean,
default: true
},
required: {
type: Boolean,
default: void 0
},
validateFirst: {
type: Boolean,
default: void 0
},
validateStatus: PropTypes.oneOf(tuple$1("", "success", "warning", "error", "validating")),
validateTrigger: {
type: [String, Array]
},
messageVariables: {
type: Object
},
hidden: Boolean,
noStyle: Boolean,
tooltip: String
});
let indexGuid$1 = 0;
const defaultItemNamePrefixCls = "form_item";
const __nuxt_component_1$3 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AFormItem",
inheritAttrs: false,
__ANT_NEW_FORM_ITEM: true,
props: formItemProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
warning$1(props2.prop === void 0);
const eventKey = `form-item-${++indexGuid$1}`;
const {
prefixCls
} = useConfigInject("form", props2);
const [wrapSSR, hashId] = useStyle$C(prefixCls);
const itemRef = shallowRef();
const formContext = useInjectForm();
const fieldName = computed(() => props2.name || props2.prop);
const errors = shallowRef([]);
const validateDisabled = shallowRef(false);
const inputRef = shallowRef();
const namePath = computed(() => {
const val = fieldName.value;
return getNamePath(val);
});
const fieldId = computed(() => {
if (!namePath.value.length) {
return void 0;
} else {
const formName = formContext.name.value;
const mergedId = namePath.value.join("_");
return formName ? `${formName}_${mergedId}` : `${defaultItemNamePrefixCls}_${mergedId}`;
}
});
const getNewFieldValue = () => {
const model = formContext.model.value;
if (!model || !fieldName.value) {
return;
} else {
return getPropByPath$1(model, namePath.value, true).v;
}
};
const fieldValue = computed(() => getNewFieldValue());
const initialValue = shallowRef(cloneDeep(fieldValue.value));
const mergedValidateTrigger = computed(() => {
let validateTrigger = props2.validateTrigger !== void 0 ? props2.validateTrigger : formContext.validateTrigger.value;
validateTrigger = validateTrigger === void 0 ? "change" : validateTrigger;
return toArray$5(validateTrigger);
});
const rulesRef = computed(() => {
let formRules = formContext.rules.value;
const selfRules = props2.rules;
const requiredRule = props2.required !== void 0 ? {
required: !!props2.required,
trigger: mergedValidateTrigger.value
} : [];
const prop = getPropByPath$1(formRules, namePath.value);
formRules = formRules ? prop.o[prop.k] || prop.v : [];
const rules = [].concat(selfRules || formRules || []);
if (find(rules, (rule) => rule.required)) {
return rules;
} else {
return rules.concat(requiredRule);
}
});
const isRequired2 = computed(() => {
const rules = rulesRef.value;
let isRequired3 = false;
if (rules && rules.length) {
rules.every((rule) => {
if (rule.required) {
isRequired3 = true;
return false;
}
return true;
});
}
return isRequired3 || props2.required;
});
const validateState = shallowRef();
watchEffect(() => {
validateState.value = props2.validateStatus;
});
const messageVariables = computed(() => {
let variables = {};
if (typeof props2.label === "string") {
variables.label = props2.label;
} else if (props2.name) {
variables.label = String(props2.name);
}
if (props2.messageVariables) {
variables = _extends(_extends({}, variables), props2.messageVariables);
}
return variables;
});
const validateRules$1 = (options) => {
if (namePath.value.length === 0) {
return;
}
const {
validateFirst = false
} = props2;
const {
triggerName
} = options || {};
let filteredRules = rulesRef.value;
if (triggerName) {
filteredRules = filteredRules.filter((rule) => {
const {
trigger
} = rule;
if (!trigger && !mergedValidateTrigger.value.length) {
return true;
}
const triggerList = toArray$5(trigger || mergedValidateTrigger.value);
return triggerList.includes(triggerName);
});
}
if (!filteredRules.length) {
return Promise.resolve();
}
const promise = validateRules(namePath.value, fieldValue.value, filteredRules, _extends({
validateMessages: formContext.validateMessages.value
}, options), validateFirst, messageVariables.value);
validateState.value = "validating";
errors.value = [];
promise.catch((e) => e).then(function() {
let results = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
if (validateState.value === "validating") {
const res = results.filter((result) => result && result.errors.length);
validateState.value = res.length ? "error" : "success";
errors.value = res.map((r) => r.errors);
formContext.onValidate(fieldName.value, !errors.value.length, errors.value.length ? toRaw(errors.value[0]) : null);
}
});
return promise;
};
const onFieldBlur = () => {
validateRules$1({
triggerName: "blur"
});
};
const onFieldChange = () => {
if (validateDisabled.value) {
validateDisabled.value = false;
return;
}
validateRules$1({
triggerName: "change"
});
};
const clearValidate = () => {
validateState.value = props2.validateStatus;
validateDisabled.value = false;
errors.value = [];
};
const resetField = () => {
var _a;
validateState.value = props2.validateStatus;
validateDisabled.value = true;
errors.value = [];
const model = formContext.model.value || {};
const value = fieldValue.value;
const prop = getPropByPath$1(model, namePath.value, true);
if (Array.isArray(value)) {
prop.o[prop.k] = [].concat((_a = initialValue.value) !== null && _a !== void 0 ? _a : []);
} else {
prop.o[prop.k] = initialValue.value;
}
nextTick(() => {
validateDisabled.value = false;
});
};
const htmlFor = computed(() => {
return props2.htmlFor === void 0 ? fieldId.value : props2.htmlFor;
});
const onLabelClick = () => {
const id = htmlFor.value;
if (!id || !inputRef.value) {
return;
}
const control = inputRef.value.$el.querySelector(`[id="${id}"]`);
if (control && control.focus) {
control.focus();
}
};
expose({
onFieldBlur,
onFieldChange,
clearValidate,
resetField
});
useProvideFormItemContext({
id: fieldId,
onFieldBlur: () => {
if (props2.autoLink) {
onFieldBlur();
}
},
onFieldChange: () => {
if (props2.autoLink) {
onFieldChange();
}
},
clearValidate
}, computed(() => {
return !!(props2.autoLink && formContext.model.value && fieldName.value);
}));
let registered = false;
watch(fieldName, (val) => {
if (val) {
if (!registered) {
registered = true;
formContext.addField(eventKey, {
fieldValue,
fieldId,
fieldName,
resetField,
clearValidate,
namePath,
validateRules: validateRules$1,
rules: rulesRef
});
}
} else {
registered = false;
formContext.removeField(eventKey);
}
}, {
immediate: true
});
const debounceErrors = useDebounce(errors);
const mergedValidateStatus = computed(() => {
if (props2.validateStatus !== void 0) {
return props2.validateStatus;
} else if (debounceErrors.value.length) {
return "error";
}
return validateState.value;
});
const itemClassName = computed(() => ({
[`${prefixCls.value}-item`]: true,
[hashId.value]: true,
// Status
[`${prefixCls.value}-item-has-feedback`]: mergedValidateStatus.value && props2.hasFeedback,
[`${prefixCls.value}-item-has-success`]: mergedValidateStatus.value === "success",
[`${prefixCls.value}-item-has-warning`]: mergedValidateStatus.value === "warning",
[`${prefixCls.value}-item-has-error`]: mergedValidateStatus.value === "error",
[`${prefixCls.value}-item-is-validating`]: mergedValidateStatus.value === "validating",
[`${prefixCls.value}-item-hidden`]: props2.hidden
}));
const formItemInputContext = reactive({});
FormItemInputContext.useProvide(formItemInputContext);
watchEffect(() => {
let feedbackIcon;
if (props2.hasFeedback) {
const IconNode = mergedValidateStatus.value && iconMap[mergedValidateStatus.value];
feedbackIcon = IconNode ? createVNode("span", {
"class": classNames(`${prefixCls.value}-item-feedback-icon`, `${prefixCls.value}-item-feedback-icon-${mergedValidateStatus.value}`)
}, [createVNode(IconNode, null, null)]) : null;
}
_extends(formItemInputContext, {
status: mergedValidateStatus.value,
hasFeedback: props2.hasFeedback,
feedbackIcon,
isFormItemInput: true
});
});
const marginBottom = shallowRef(null);
const showMarginOffset = shallowRef(false);
const onErrorVisibleChanged = (nextVisible) => {
if (!nextVisible) {
marginBottom.value = null;
}
};
return () => {
var _a, _b;
if (props2.noStyle) return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
const help = (_b = props2.help) !== null && _b !== void 0 ? _b : slots.help ? filterEmpty(slots.help()) : null;
const withHelp = !!(help !== void 0 && help !== null && Array.isArray(help) && help.length || debounceErrors.value.length);
showMarginOffset.value = withHelp;
return wrapSSR(createVNode("div", {
"class": [itemClassName.value, withHelp ? `${prefixCls.value}-item-with-help` : "", attrs.class],
"ref": itemRef
}, [createVNode(ARow, _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": `${prefixCls.value}-item-row`,
"key": "row"
}), {
default: () => {
var _a2, _b2;
return createVNode(Fragment, null, [createVNode(FormItemLabel, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"htmlFor": htmlFor.value,
"required": isRequired2.value,
"requiredMark": formContext.requiredMark.value,
"prefixCls": prefixCls.value,
"onClick": onLabelClick,
"label": props2.label
}), {
label: slots.label,
tooltip: slots.tooltip
}), createVNode(FormItemInput, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"errors": help !== void 0 && help !== null ? toArray$5(help) : debounceErrors.value,
"marginBottom": marginBottom.value,
"prefixCls": prefixCls.value,
"status": mergedValidateStatus.value,
"ref": inputRef,
"help": help,
"extra": (_a2 = props2.extra) !== null && _a2 !== void 0 ? _a2 : (_b2 = slots.extra) === null || _b2 === void 0 ? void 0 : _b2.call(slots),
"onErrorVisibleChanged": onErrorVisibleChanged
}), {
default: slots.default
})]);
}
}), !!marginBottom.value && createVNode("div", {
"class": `${prefixCls.value}-margin-offset`,
"style": {
marginBottom: `-${marginBottom.value}px`
}
}, null)]));
};
}
});
function allPromiseFinish(promiseList) {
let hasError = false;
let count = promiseList.length;
const results = [];
if (!promiseList.length) {
return Promise.resolve([]);
}
return new Promise((resolve, reject) => {
promiseList.forEach((promise, index2) => {
promise.catch((e) => {
hasError = true;
return e;
}).then((result) => {
count -= 1;
results[index2] = result;
if (count > 0) {
return;
}
if (hasError) {
reject(results);
}
resolve(results);
});
});
});
}
function isRequired(rules) {
let isRequired2 = false;
if (rules && rules.length) {
rules.every((rule) => {
if (rule.required) {
isRequired2 = true;
return false;
}
return true;
});
}
return isRequired2;
}
function toArray$4(value) {
if (value === void 0 || value === null) {
return [];
}
return Array.isArray(value) ? value : [value];
}
function getPropByPath(obj, path2, strict) {
let tempObj = obj;
path2 = path2.replace(/\[(\w+)\]/g, ".$1");
path2 = path2.replace(/^\./, "");
const keyArr = path2.split(".");
let i = 0;
for (let len = keyArr.length; i < len - 1; ++i) {
if (!tempObj && !strict) break;
const key2 = keyArr[i];
if (key2 in tempObj) {
tempObj = tempObj[key2];
} else {
if (strict) {
throw new Error("please transfer a valid name path to validate!");
}
break;
}
}
return {
o: tempObj,
k: keyArr[i],
v: tempObj ? tempObj[keyArr[i]] : null,
isValid: tempObj && keyArr[i] in tempObj
};
}
function useForm(modelRef) {
let rulesRef = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ref({});
let options = arguments.length > 2 ? arguments[2] : void 0;
const initialModel = cloneDeep(unref(modelRef));
const validateInfos = reactive({});
const rulesKeys = shallowRef([]);
const resetFields = (newValues) => {
_extends(unref(modelRef), _extends(_extends({}, cloneDeep(initialModel)), newValues));
nextTick(() => {
Object.keys(validateInfos).forEach((key2) => {
validateInfos[key2] = {
autoLink: false,
required: isRequired(unref(rulesRef)[key2])
};
});
});
};
const filterRules = function() {
let rules = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
let trigger = arguments.length > 1 ? arguments[1] : void 0;
if (!trigger.length) {
return rules;
} else {
return rules.filter((rule) => {
const triggerList = toArray$4(rule.trigger || "change");
return intersection(triggerList, trigger).length;
});
}
};
let lastValidatePromise = null;
const validateFields = function(names) {
let option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
let strict = arguments.length > 2 ? arguments[2] : void 0;
const promiseList = [];
const values = {};
for (let i = 0; i < names.length; i++) {
const name = names[i];
const prop = getPropByPath(unref(modelRef), name, strict);
if (!prop.isValid) continue;
values[name] = prop.v;
const rules = filterRules(unref(rulesRef)[name], toArray$4(option && option.trigger));
if (rules.length) {
promiseList.push(validateField(name, prop.v, rules, option || {}).then(() => ({
name,
errors: [],
warnings: []
})).catch((ruleErrors) => {
const mergedErrors = [];
const mergedWarnings = [];
ruleErrors.forEach((_ref) => {
let {
rule: {
warningOnly
},
errors
} = _ref;
if (warningOnly) {
mergedWarnings.push(...errors);
} else {
mergedErrors.push(...errors);
}
});
if (mergedErrors.length) {
return Promise.reject({
name,
errors: mergedErrors,
warnings: mergedWarnings
});
}
return {
name,
errors: mergedErrors,
warnings: mergedWarnings
};
}));
}
}
const summaryPromise = allPromiseFinish(promiseList);
lastValidatePromise = summaryPromise;
const returnPromise = summaryPromise.then(() => {
if (lastValidatePromise === summaryPromise) {
return Promise.resolve(values);
}
return Promise.reject([]);
}).catch((results) => {
const errorList = results.filter((result) => result && result.errors.length);
return errorList.length ? Promise.reject({
values,
errorFields: errorList,
outOfDate: lastValidatePromise !== summaryPromise
}) : Promise.resolve(values);
});
returnPromise.catch((e) => e);
return returnPromise;
};
const validateField = function(name, value, rules) {
let option = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
const promise = validateRules([name], value, rules, _extends({
validateMessages: defaultValidateMessages
}, option), !!option.validateFirst);
if (!validateInfos[name]) {
return promise.catch((e) => e);
}
validateInfos[name].validateStatus = "validating";
promise.catch((e) => e).then(function() {
let results = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
var _a;
if (validateInfos[name].validateStatus === "validating") {
const res = results.filter((result) => result && result.errors.length);
validateInfos[name].validateStatus = res.length ? "error" : "success";
validateInfos[name].help = res.length ? res.map((r) => r.errors) : null;
(_a = options === null || options === void 0 ? void 0 : options.onValidate) === null || _a === void 0 ? void 0 : _a.call(options, name, !res.length, res.length ? toRaw(validateInfos[name].help[0]) : null);
}
});
return promise;
};
const validate2 = (names, option) => {
let keys = [];
let strict = true;
if (!names) {
strict = false;
keys = rulesKeys.value;
} else if (Array.isArray(names)) {
keys = names;
} else {
keys = [names];
}
const promises = validateFields(keys, option || {}, strict);
promises.catch((e) => e);
return promises;
};
const clearValidate = (names) => {
let keys = [];
if (!names) {
keys = rulesKeys.value;
} else if (Array.isArray(names)) {
keys = names;
} else {
keys = [names];
}
keys.forEach((key2) => {
validateInfos[key2] && _extends(validateInfos[key2], {
validateStatus: "",
help: null
});
});
};
const mergeValidateInfo = (items) => {
const info = {
autoLink: false
};
const help = [];
const infos = Array.isArray(items) ? items : [items];
for (let i = 0; i < infos.length; i++) {
const arg = infos[i];
if ((arg === null || arg === void 0 ? void 0 : arg.validateStatus) === "error") {
info.validateStatus = "error";
arg.help && help.push(arg.help);
}
info.required = info.required || (arg === null || arg === void 0 ? void 0 : arg.required);
}
info.help = help;
return info;
};
let oldModel = initialModel;
let isFirstTime = true;
const modelFn = (model) => {
const names = [];
rulesKeys.value.forEach((key2) => {
const prop = getPropByPath(model, key2, false);
const oldProp = getPropByPath(oldModel, key2, false);
const isFirstValidation = isFirstTime && (options === null || options === void 0 ? void 0 : options.immediate) && prop.isValid;
if (isFirstValidation || !isEqual$2(prop.v, oldProp.v)) {
names.push(key2);
}
});
validate2(names, {
trigger: "change"
});
isFirstTime = false;
oldModel = cloneDeep(toRaw(model));
};
const debounceOptions = options === null || options === void 0 ? void 0 : options.debounce;
let first = true;
watch(rulesRef, () => {
rulesKeys.value = rulesRef ? Object.keys(unref(rulesRef)) : [];
if (!first && options && options.validateOnRuleChange) {
validate2();
}
first = false;
}, {
deep: true,
immediate: true
});
watch(rulesKeys, () => {
const newValidateInfos = {};
rulesKeys.value.forEach((key2) => {
newValidateInfos[key2] = _extends({}, validateInfos[key2], {
autoLink: false,
required: isRequired(unref(rulesRef)[key2])
});
delete validateInfos[key2];
});
for (const key2 in validateInfos) {
if (Object.prototype.hasOwnProperty.call(validateInfos, key2)) {
delete validateInfos[key2];
}
}
_extends(validateInfos, newValidateInfos);
}, {
immediate: true
});
watch(modelRef, debounceOptions && debounceOptions.wait ? debounce$1(modelFn, debounceOptions.wait, omit$1(debounceOptions, ["wait"])) : modelFn, {
immediate: options && !!options.immediate,
deep: true
});
return {
modelRef,
rulesRef,
initialModel,
validateInfos,
resetFields,
validate: validate2,
validateField,
mergeValidateInfo,
clearValidate
};
}
const formProps = () => ({
layout: PropTypes.oneOf(tuple$1("horizontal", "inline", "vertical")),
labelCol: objectType(),
wrapperCol: objectType(),
colon: booleanType(),
labelAlign: stringType(),
labelWrap: booleanType(),
prefixCls: String,
requiredMark: someType([String, Boolean]),
/** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */
hideRequiredMark: booleanType(),
model: PropTypes.object,
rules: objectType(),
validateMessages: objectType(),
validateOnRuleChange: booleanType(),
// 提交失败自动滚动到第一个错误字段
scrollToFirstError: anyType(),
onSubmit: functionType(),
name: String,
validateTrigger: someType([String, Array]),
size: stringType(),
disabled: booleanType(),
onValuesChange: functionType(),
onFieldsChange: functionType(),
onFinish: functionType(),
onFinishFailed: functionType(),
onValidate: functionType()
});
function isEqualName(name1, name2) {
return isEqual$2(toArray$5(name1), toArray$5(name2));
}
const Form = defineComponent({
compatConfig: {
MODE: 3
},
name: "AForm",
inheritAttrs: false,
props: initDefaultProps(formProps(), {
layout: "horizontal",
hideRequiredMark: false,
colon: true
}),
Item: __nuxt_component_1$3,
useForm,
// emits: ['finishFailed', 'submit', 'finish', 'validate'],
setup(props2, _ref) {
let {
emit,
slots,
expose,
attrs
} = _ref;
const {
prefixCls,
direction,
form: contextForm,
size,
disabled
} = useConfigInject("form", props2);
const requiredMark = computed(() => props2.requiredMark === "" || props2.requiredMark);
const mergedRequiredMark = computed(() => {
var _a;
if (requiredMark.value !== void 0) {
return requiredMark.value;
}
if (contextForm && ((_a = contextForm.value) === null || _a === void 0 ? void 0 : _a.requiredMark) !== void 0) {
return contextForm.value.requiredMark;
}
if (props2.hideRequiredMark) {
return false;
}
return true;
});
useProviderSize(size);
useProviderDisabled(disabled);
const mergedColon = computed(() => {
var _a, _b;
return (_a = props2.colon) !== null && _a !== void 0 ? _a : (_b = contextForm.value) === null || _b === void 0 ? void 0 : _b.colon;
});
const {
validateMessages: globalValidateMessages
} = useInjectGlobalForm();
const validateMessages = computed(() => {
return _extends(_extends(_extends({}, defaultValidateMessages), globalValidateMessages.value), props2.validateMessages);
});
const [wrapSSR, hashId] = useStyle$C(prefixCls);
const formClassName = computed(() => classNames(prefixCls.value, {
[`${prefixCls.value}-${props2.layout}`]: true,
[`${prefixCls.value}-hide-required-mark`]: mergedRequiredMark.value === false,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-${size.value}`]: size.value
}, hashId.value));
const lastValidatePromise = ref();
const fields = {};
const addField = (eventKey, field) => {
fields[eventKey] = field;
};
const removeField = (eventKey) => {
delete fields[eventKey];
};
const getFieldsByNameList = (nameList) => {
const provideNameList = !!nameList;
const namePathList = provideNameList ? toArray$5(nameList).map(getNamePath) : [];
if (!provideNameList) {
return Object.values(fields);
} else {
return Object.values(fields).filter((field) => namePathList.findIndex((namePath) => isEqualName(namePath, field.fieldName.value)) > -1);
}
};
const resetFields = (name) => {
if (!props2.model) {
return;
}
getFieldsByNameList(name).forEach((field) => {
field.resetField();
});
};
const clearValidate = (name) => {
getFieldsByNameList(name).forEach((field) => {
field.clearValidate();
});
};
const handleFinishFailed = (errorInfo) => {
const {
scrollToFirstError
} = props2;
emit("finishFailed", errorInfo);
if (scrollToFirstError && errorInfo.errorFields.length) {
let scrollToFieldOptions = {};
if (typeof scrollToFirstError === "object") {
scrollToFieldOptions = scrollToFirstError;
}
scrollToField(errorInfo.errorFields[0].name, scrollToFieldOptions);
}
};
const validate2 = function() {
return validateField(...arguments);
};
const scrollToField = function(name) {
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const fields2 = getFieldsByNameList(name ? [name] : void 0);
if (fields2.length) {
const fieldId = fields2[0].fieldId.value;
const node = fieldId ? (void 0).getElementById(fieldId) : null;
if (node) {
scrollIntoView(node, _extends({
scrollMode: "if-needed",
block: "nearest"
}, options));
}
}
};
const getFieldsValue = function() {
let nameList = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
if (nameList === true) {
const allNameList = [];
Object.values(fields).forEach((_ref2) => {
let {
namePath
} = _ref2;
allNameList.push(namePath.value);
});
return cloneByNamePathList(props2.model, allNameList);
} else {
return cloneByNamePathList(props2.model, nameList);
}
};
const validateFields = (nameList, options) => {
if (!props2.model) {
return Promise.reject("Form `model` is required for validateFields to work.");
}
const provideNameList = !!nameList;
const namePathList = provideNameList ? toArray$5(nameList).map(getNamePath) : [];
const promiseList = [];
Object.values(fields).forEach((field) => {
var _a;
if (!provideNameList) {
namePathList.push(field.namePath.value);
}
if (!((_a = field.rules) === null || _a === void 0 ? void 0 : _a.value.length)) {
return;
}
const fieldNamePath = field.namePath.value;
if (!provideNameList || containsNamePath(namePathList, fieldNamePath)) {
const promise = field.validateRules(_extends({
validateMessages: validateMessages.value
}, options));
promiseList.push(promise.then(() => ({
name: fieldNamePath,
errors: [],
warnings: []
})).catch((ruleErrors) => {
const mergedErrors = [];
const mergedWarnings = [];
ruleErrors.forEach((_ref3) => {
let {
rule: {
warningOnly
},
errors
} = _ref3;
if (warningOnly) {
mergedWarnings.push(...errors);
} else {
mergedErrors.push(...errors);
}
});
if (mergedErrors.length) {
return Promise.reject({
name: fieldNamePath,
errors: mergedErrors,
warnings: mergedWarnings
});
}
return {
name: fieldNamePath,
errors: mergedErrors,
warnings: mergedWarnings
};
}));
}
});
const summaryPromise = allPromiseFinish(promiseList);
lastValidatePromise.value = summaryPromise;
const returnPromise = summaryPromise.then(() => {
if (lastValidatePromise.value === summaryPromise) {
return Promise.resolve(getFieldsValue(namePathList));
}
return Promise.reject([]);
}).catch((results) => {
const errorList = results.filter((result) => result && result.errors.length);
return Promise.reject({
values: getFieldsValue(namePathList),
errorFields: errorList,
outOfDate: lastValidatePromise.value !== summaryPromise
});
});
returnPromise.catch((e) => e);
return returnPromise;
};
const validateField = function() {
return validateFields(...arguments);
};
const handleSubmit = (e) => {
e.preventDefault();
e.stopPropagation();
emit("submit", e);
if (props2.model) {
const res = validateFields();
res.then((values) => {
emit("finish", values);
}).catch((errors) => {
handleFinishFailed(errors);
});
}
};
expose({
resetFields,
clearValidate,
validateFields,
getFieldsValue,
validate: validate2,
scrollToField
});
useProvideForm({
model: computed(() => props2.model),
name: computed(() => props2.name),
labelAlign: computed(() => props2.labelAlign),
labelCol: computed(() => props2.labelCol),
labelWrap: computed(() => props2.labelWrap),
wrapperCol: computed(() => props2.wrapperCol),
vertical: computed(() => props2.layout === "vertical"),
colon: mergedColon,
requiredMark: mergedRequiredMark,
validateTrigger: computed(() => props2.validateTrigger),
rules: computed(() => props2.rules),
addField,
removeField,
onValidate: (name, status, errors) => {
emit("validate", name, status, errors);
},
validateMessages
});
watch(() => props2.rules, () => {
if (props2.validateOnRuleChange) {
validateFields();
}
});
return () => {
var _a;
return wrapSSR(createVNode("form", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"onSubmit": handleSubmit,
"class": [formClassName.value, attrs.class]
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]));
};
}
});
Form.useInjectFormItemContext = useInjectFormItemContext;
Form.ItemRest = FormItemRest;
Form.install = function(app) {
app.component(Form.name, Form);
app.component(Form.Item.name, Form.Item);
app.component(FormItemRest.name, FormItemRest);
return app;
};
const antCheckboxEffect = new Keyframe("antCheckboxEffect", {
"0%": {
transform: "scale(1)",
opacity: 0.5
},
"100%": {
transform: "scale(1.6)",
opacity: 0
}
});
const genCheckboxStyle = (token) => {
const {
checkboxCls
} = token;
const wrapperCls = `${checkboxCls}-wrapper`;
return [
// ===================== Basic =====================
{
// Group
[`${checkboxCls}-group`]: _extends(_extends({}, resetComponent(token)), {
display: "inline-flex",
flexWrap: "wrap",
columnGap: token.marginXS,
// Group > Grid
[`> ${token.antCls}-row`]: {
flex: 1
}
}),
// Wrapper
[wrapperCls]: _extends(_extends({}, resetComponent(token)), {
display: "inline-flex",
alignItems: "baseline",
cursor: "pointer",
// Fix checkbox & radio in flex align #30260
"&:after": {
display: "inline-block",
width: 0,
overflow: "hidden",
content: "'\\a0'"
},
// Checkbox near checkbox
[`& + ${wrapperCls}`]: {
marginInlineStart: 0
},
[`&${wrapperCls}-in-form-item`]: {
'input[type="checkbox"]': {
width: 14,
height: 14
// FIXME: magic
}
}
}),
// Wrapper > Checkbox
[checkboxCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
whiteSpace: "nowrap",
lineHeight: 1,
cursor: "pointer",
// To make alignment right when `controlHeight` is changed
// Ref: https://github.com/ant-design/ant-design/issues/41564
alignSelf: "center",
// Wrapper > Checkbox > input
[`${checkboxCls}-input`]: {
position: "absolute",
// Since baseline align will get additional space offset,
// we need to move input to top to make it align with text.
// Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
inset: 0,
zIndex: 1,
cursor: "pointer",
opacity: 0,
margin: 0,
[`&:focus-visible + ${checkboxCls}-inner`]: _extends({}, genFocusOutline(token))
},
// Wrapper > Checkbox > inner
[`${checkboxCls}-inner`]: {
boxSizing: "border-box",
position: "relative",
top: 0,
insetInlineStart: 0,
display: "block",
width: token.checkboxSize,
height: token.checkboxSize,
direction: "ltr",
backgroundColor: token.colorBgContainer,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusSM,
borderCollapse: "separate",
transition: `all ${token.motionDurationSlow}`,
"&:after": {
boxSizing: "border-box",
position: "absolute",
top: "50%",
insetInlineStart: "21.5%",
display: "table",
width: token.checkboxSize / 14 * 5,
height: token.checkboxSize / 14 * 8,
border: `${token.lineWidthBold}px solid ${token.colorWhite}`,
borderTop: 0,
borderInlineStart: 0,
transform: "rotate(45deg) scale(0) translate(-50%,-50%)",
opacity: 0,
content: '""',
transition: `all ${token.motionDurationFast} ${token.motionEaseInBack}, opacity ${token.motionDurationFast}`
}
},
// Wrapper > Checkbox + Text
"& + span": {
paddingInlineStart: token.paddingXS,
paddingInlineEnd: token.paddingXS
}
})
},
// ================= Indeterminate =================
{
[checkboxCls]: {
"&-indeterminate": {
// Wrapper > Checkbox > inner
[`${checkboxCls}-inner`]: {
"&:after": {
top: "50%",
insetInlineStart: "50%",
width: token.fontSizeLG / 2,
height: token.fontSizeLG / 2,
backgroundColor: token.colorPrimary,
border: 0,
transform: "translate(-50%, -50%) scale(1)",
opacity: 1,
content: '""'
}
}
}
}
},
// ===================== Hover =====================
{
// Wrapper
[`${wrapperCls}:hover ${checkboxCls}:after`]: {
visibility: "visible"
},
// Wrapper & Wrapper > Checkbox
[`
${wrapperCls}:not(${wrapperCls}-disabled),
${checkboxCls}:not(${checkboxCls}-disabled)
`]: {
[`&:hover ${checkboxCls}-inner`]: {
borderColor: token.colorPrimary
}
},
[`${wrapperCls}:not(${wrapperCls}-disabled)`]: {
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled) ${checkboxCls}-inner`]: {
backgroundColor: token.colorPrimaryHover,
borderColor: "transparent"
},
[`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled):after`]: {
borderColor: token.colorPrimaryHover
}
}
},
// ==================== Checked ====================
{
// Wrapper > Checkbox
[`${checkboxCls}-checked`]: {
[`${checkboxCls}-inner`]: {
backgroundColor: token.colorPrimary,
borderColor: token.colorPrimary,
"&:after": {
opacity: 1,
transform: "rotate(45deg) scale(1) translate(-50%,-50%)",
transition: `all ${token.motionDurationMid} ${token.motionEaseOutBack} ${token.motionDurationFast}`
}
},
// Checked Effect
"&:after": {
position: "absolute",
top: 0,
insetInlineStart: 0,
width: "100%",
height: "100%",
borderRadius: token.borderRadiusSM,
visibility: "hidden",
border: `${token.lineWidthBold}px solid ${token.colorPrimary}`,
animationName: antCheckboxEffect,
animationDuration: token.motionDurationSlow,
animationTimingFunction: "ease-in-out",
animationFillMode: "backwards",
content: '""',
transition: `all ${token.motionDurationSlow}`
}
},
[`
${wrapperCls}-checked:not(${wrapperCls}-disabled),
${checkboxCls}-checked:not(${checkboxCls}-disabled)
`]: {
[`&:hover ${checkboxCls}-inner`]: {
backgroundColor: token.colorPrimaryHover,
borderColor: "transparent"
},
[`&:hover ${checkboxCls}:after`]: {
borderColor: token.colorPrimaryHover
}
}
},
// ==================== Disable ====================
{
// Wrapper
[`${wrapperCls}-disabled`]: {
cursor: "not-allowed"
},
// Wrapper > Checkbox
[`${checkboxCls}-disabled`]: {
// Wrapper > Checkbox > input
[`&, ${checkboxCls}-input`]: {
cursor: "not-allowed",
// Disabled for native input to enable Tooltip event handler
// ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
pointerEvents: "none"
},
// Wrapper > Checkbox > inner
[`${checkboxCls}-inner`]: {
background: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
"&:after": {
borderColor: token.colorTextDisabled
}
},
"&:after": {
display: "none"
},
"& + span": {
color: token.colorTextDisabled
},
[`&${checkboxCls}-indeterminate ${checkboxCls}-inner::after`]: {
background: token.colorTextDisabled
}
}
}
];
};
function getStyle$2(prefixCls, token) {
const checkboxToken = merge(token, {
checkboxCls: `.${prefixCls}`,
checkboxSize: token.controlInteractiveSize
});
return [genCheckboxStyle(checkboxToken)];
}
const useStyle$B = genComponentStyleHook("Checkbox", (token, _ref) => {
let {
prefixCls
} = _ref;
return [getStyle$2(prefixCls, token)];
});
const genBaseStyle$c = (token) => {
const {
prefixCls,
componentCls,
antCls
} = token;
const cascaderMenuItemCls = `${componentCls}-menu-item`;
const iconCls = `
&${cascaderMenuItemCls}-expand ${cascaderMenuItemCls}-expand-icon,
${cascaderMenuItemCls}-loading-icon
`;
const itemPaddingVertical = Math.round((token.controlHeight - token.fontSize * token.lineHeight) / 2);
return [
// =====================================================
// == Control ==
// =====================================================
{
[componentCls]: {
width: token.controlWidth
}
},
// =====================================================
// == Popup ==
// =====================================================
{
[`${componentCls}-dropdown`]: [
// ==================== Checkbox ====================
getStyle$2(`${prefixCls}-checkbox`, token),
{
[`&${antCls}-select-dropdown`]: {
padding: 0
}
},
{
[componentCls]: {
// ================== Checkbox ==================
"&-checkbox": {
top: 0,
marginInlineEnd: token.paddingXS
},
// ==================== Menu ====================
// >>> Menus
"&-menus": {
display: "flex",
flexWrap: "nowrap",
alignItems: "flex-start",
[`&${componentCls}-menu-empty`]: {
[`${componentCls}-menu`]: {
width: "100%",
height: "auto",
[cascaderMenuItemCls]: {
color: token.colorTextDisabled
}
}
}
},
// >>> Menu
"&-menu": {
flexGrow: 1,
minWidth: token.controlItemWidth,
height: token.dropdownHeight,
margin: 0,
padding: token.paddingXXS,
overflow: "auto",
verticalAlign: "top",
listStyle: "none",
"-ms-overflow-style": "-ms-autohiding-scrollbar",
"&:not(:last-child)": {
borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
},
"&-item": _extends(_extends({}, textEllipsis), {
display: "flex",
flexWrap: "nowrap",
alignItems: "center",
padding: `${itemPaddingVertical}px ${token.paddingSM}px`,
lineHeight: token.lineHeight,
cursor: "pointer",
transition: `all ${token.motionDurationMid}`,
borderRadius: token.borderRadiusSM,
"&:hover": {
background: token.controlItemBgHover
},
"&-disabled": {
color: token.colorTextDisabled,
cursor: "not-allowed",
"&:hover": {
background: "transparent"
},
[iconCls]: {
color: token.colorTextDisabled
}
},
[`&-active:not(${cascaderMenuItemCls}-disabled)`]: {
[`&, &:hover`]: {
fontWeight: token.fontWeightStrong,
backgroundColor: token.controlItemBgActive
}
},
"&-content": {
flex: "auto"
},
[iconCls]: {
marginInlineStart: token.paddingXXS,
color: token.colorTextDescription,
fontSize: token.fontSizeIcon
},
"&-keyword": {
color: token.colorHighlight
}
})
}
}
}
]
},
// =====================================================
// == RTL ==
// =====================================================
{
[`${componentCls}-dropdown-rtl`]: {
direction: "rtl"
}
},
// =====================================================
// == Space Compact ==
// =====================================================
genCompactItemStyle(token)
];
};
const useStyle$A = genComponentStyleHook("Cascader", (token) => [genBaseStyle$c(token)], {
controlWidth: 184,
controlItemWidth: 111,
dropdownHeight: 180
});
var __rest$S = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function highlightKeyword(str, lowerKeyword, prefixCls) {
const cells = str.toLowerCase().split(lowerKeyword).reduce((list, cur, index2) => index2 === 0 ? [cur] : [...list, lowerKeyword, cur], []);
const fillCells = [];
let start = 0;
cells.forEach((cell, index2) => {
const end = start + cell.length;
let originWorld = str.slice(start, end);
start = end;
if (index2 % 2 === 1) {
originWorld = createVNode("span", {
"class": `${prefixCls}-menu-item-keyword`,
"key": "seperator"
}, [originWorld]);
}
fillCells.push(originWorld);
});
return fillCells;
}
const defaultSearchRender = (_ref) => {
let {
inputValue,
path: path2,
prefixCls,
fieldNames
} = _ref;
const optionList = [];
const lower2 = inputValue.toLowerCase();
path2.forEach((node, index2) => {
if (index2 !== 0) {
optionList.push(" / ");
}
let label = node[fieldNames.label];
const type = typeof label;
if (type === "string" || type === "number") {
label = highlightKeyword(String(label), lower2, prefixCls);
}
optionList.push(label);
});
return optionList;
};
function cascaderProps() {
return _extends(_extends({}, omit(internalCascaderProps(), ["customSlots", "checkable", "options"])), {
multiple: {
type: Boolean,
default: void 0
},
size: String,
bordered: {
type: Boolean,
default: void 0
},
placement: {
type: String
},
suffixIcon: PropTypes.any,
status: String,
options: Array,
popupClassName: String,
/** @deprecated Please use `popupClassName` instead */
dropdownClassName: String,
"onUpdate:value": Function
});
}
const Cascader = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACascader",
inheritAttrs: false,
props: initDefaultProps(cascaderProps(), {
bordered: true,
choiceTransitionName: "",
allowClear: true
}),
setup(props2, _ref2) {
let {
attrs,
expose,
slots,
emit
} = _ref2;
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
const {
prefixCls: cascaderPrefixCls,
rootPrefixCls,
getPrefixCls,
direction,
getPopupContainer,
renderEmpty: renderEmpty2,
size: contextSize,
disabled
} = useConfigInject("cascader", props2);
const prefixCls = computed(() => getPrefixCls("select", props2.prefixCls));
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => compactSize.value || contextSize.value);
const contextDisabled = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a;
return (_a = disabled.value) !== null && _a !== void 0 ? _a : contextDisabled.value;
});
const [wrapSelectSSR, hashId] = useSelectStyle(prefixCls);
const [wrapCascaderSSR] = useStyle$A(cascaderPrefixCls);
const isRtl = computed(() => direction.value === "rtl");
const mergedShowSearch = computed(() => {
if (!props2.showSearch) {
return props2.showSearch;
}
let searchConfig = {
render: defaultSearchRender
};
if (typeof props2.showSearch === "object") {
searchConfig = _extends(_extends({}, searchConfig), props2.showSearch);
}
return searchConfig;
});
const mergedDropdownClassName = computed(() => classNames(props2.popupClassName || props2.dropdownClassName, `${cascaderPrefixCls.value}-dropdown`, {
[`${cascaderPrefixCls.value}-dropdown-rtl`]: isRtl.value
}, hashId.value));
const selectRef = ref();
expose({
focus() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.blur();
}
});
const handleChange = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
emit("update:value", args[0]);
emit("change", ...args);
formItemContext.onFieldChange();
};
const handleBlur = function() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
emit("blur", ...args);
formItemContext.onFieldBlur();
};
const mergedShowArrow = computed(() => props2.showArrow !== void 0 ? props2.showArrow : props2.loading || !props2.multiple);
const placement = computed(() => {
if (props2.placement !== void 0) {
return props2.placement;
}
return direction.value === "rtl" ? "bottomRight" : "bottomLeft";
});
return () => {
var _a, _b;
const {
notFoundContent = (_a = slots.notFoundContent) === null || _a === void 0 ? void 0 : _a.call(slots),
expandIcon = (_b = slots.expandIcon) === null || _b === void 0 ? void 0 : _b.call(slots),
multiple,
bordered,
allowClear,
choiceTransitionName,
transitionName: transitionName2,
id = formItemContext.id.value
} = props2, restProps = __rest$S(props2, ["notFoundContent", "expandIcon", "multiple", "bordered", "allowClear", "choiceTransitionName", "transitionName", "id"]);
const mergedNotFoundContent = notFoundContent || renderEmpty2("Cascader");
let mergedExpandIcon = expandIcon;
if (!expandIcon) {
mergedExpandIcon = isRtl.value ? createVNode(LeftOutlined, null, null) : createVNode(RightOutlined, null, null);
}
const loadingIcon = createVNode("span", {
"class": `${prefixCls.value}-menu-item-loading-icon`
}, [createVNode(LoadingOutlined, {
"spin": true
}, null)]);
const {
suffixIcon,
removeIcon,
clearIcon
} = getIcons(_extends(_extends({}, props2), {
hasFeedback: formItemInputContext.hasFeedback,
feedbackIcon: formItemInputContext.feedbackIcon,
multiple,
prefixCls: prefixCls.value,
showArrow: mergedShowArrow.value
}), slots);
return wrapCascaderSSR(wrapSelectSSR(createVNode(Cascader$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, restProps), attrs), {}, {
"id": id,
"prefixCls": prefixCls.value,
"class": [cascaderPrefixCls.value, {
[`${prefixCls.value}-lg`]: mergedSize.value === "large",
[`${prefixCls.value}-sm`]: mergedSize.value === "small",
[`${prefixCls.value}-rtl`]: isRtl.value,
[`${prefixCls.value}-borderless`]: !bordered,
[`${prefixCls.value}-in-form-item`]: formItemInputContext.isFormItemInput
}, getStatusClassNames(prefixCls.value, mergedStatus.value, formItemInputContext.hasFeedback), compactItemClassnames.value, attrs.class, hashId.value],
"disabled": mergedDisabled.value,
"direction": direction.value,
"placement": placement.value,
"notFoundContent": mergedNotFoundContent,
"allowClear": allowClear,
"showSearch": mergedShowSearch.value,
"expandIcon": mergedExpandIcon,
"inputIcon": suffixIcon,
"removeIcon": removeIcon,
"clearIcon": clearIcon,
"loadingIcon": loadingIcon,
"checkable": !!multiple,
"dropdownClassName": mergedDropdownClassName.value,
"dropdownPrefixCls": cascaderPrefixCls.value,
"choiceTransitionName": getTransitionName$1(rootPrefixCls.value, "", choiceTransitionName),
"transitionName": getTransitionName$1(rootPrefixCls.value, getTransitionDirection(placement.value), transitionName2),
"getPopupContainer": getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value,
"customSlots": _extends(_extends({}, slots), {
checkable: () => createVNode("span", {
"class": `${cascaderPrefixCls.value}-checkbox-inner`
}, null)
}),
"tagRender": props2.tagRender || slots.tagRender,
"displayRender": props2.displayRender || slots.displayRender,
"maxTagPlaceholder": props2.maxTagPlaceholder || slots.maxTagPlaceholder,
"showArrow": formItemInputContext.hasFeedback || props2.showArrow,
"onChange": handleChange,
"onBlur": handleBlur,
"ref": selectRef
}), slots)));
};
}
});
const index$k = withInstall(_extends(Cascader, {
SHOW_CHILD: SHOW_CHILD$1,
SHOW_PARENT: SHOW_PARENT$1
}));
const abstractCheckboxGroupProps = () => {
return {
name: String,
prefixCls: String,
options: arrayType([]),
disabled: Boolean,
id: String
};
};
const checkboxGroupProps = () => {
return _extends(_extends({}, abstractCheckboxGroupProps()), {
defaultValue: arrayType(),
value: arrayType(),
onChange: functionType(),
"onUpdate:value": functionType()
});
};
const abstractCheckboxProps = () => {
return {
prefixCls: String,
defaultChecked: booleanType(),
checked: booleanType(),
disabled: booleanType(),
isGroup: booleanType(),
value: PropTypes.any,
name: String,
id: String,
indeterminate: booleanType(),
type: stringType("checkbox"),
autofocus: booleanType(),
onChange: functionType(),
"onUpdate:checked": functionType(),
onClick: functionType(),
skipGroup: booleanType(false)
};
};
const checkboxProps = () => {
return _extends(_extends({}, abstractCheckboxProps()), {
indeterminate: booleanType(false)
});
};
const CheckboxGroupContextKey = Symbol("CheckboxGroupContext");
var __rest$R = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Checkbox = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACheckbox",
inheritAttrs: false,
__ANT_CHECKBOX: true,
props: checkboxProps(),
// emits: ['change', 'update:checked'],
setup(props2, _ref) {
let {
emit,
attrs,
slots,
expose
} = _ref;
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const {
prefixCls,
direction,
disabled
} = useConfigInject("checkbox", props2);
const contextDisabled = useInjectDisabled();
const [wrapSSR, hashId] = useStyle$B(prefixCls);
const checkboxGroup = inject(CheckboxGroupContextKey, void 0);
const uniId = Symbol("checkboxUniId");
const mergedDisabled = computed(() => {
return (checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.disabled.value) || disabled.value;
});
watchEffect(() => {
if (!props2.skipGroup && checkboxGroup) {
checkboxGroup.registerValue(uniId, props2.value);
}
});
const handleChange = (event) => {
const targetChecked = event.target.checked;
emit("update:checked", targetChecked);
emit("change", event);
formItemContext.onFieldChange();
};
const checkboxRef = ref();
const focus = () => {
var _a;
(_a = checkboxRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = checkboxRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
expose({
focus,
blur
});
return () => {
var _a;
const children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
const {
indeterminate,
skipGroup,
id = formItemContext.id.value
} = props2, restProps = __rest$R(props2, ["indeterminate", "skipGroup", "id"]);
const {
onMouseenter,
onMouseleave,
onInput,
class: className,
style
} = attrs, restAttrs = __rest$R(attrs, ["onMouseenter", "onMouseleave", "onInput", "class", "style"]);
const checkboxProps2 = _extends(_extends(_extends(_extends({}, restProps), {
id,
prefixCls: prefixCls.value
}), restAttrs), {
disabled: mergedDisabled.value
});
if (checkboxGroup && !skipGroup) {
checkboxProps2.onChange = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
emit("change", ...args);
checkboxGroup.toggleOption({
label: children,
value: props2.value
});
};
checkboxProps2.name = checkboxGroup.name.value;
checkboxProps2.checked = checkboxGroup.mergedValue.value.includes(props2.value);
checkboxProps2.disabled = mergedDisabled.value || contextDisabled.value;
checkboxProps2.indeterminate = indeterminate;
} else {
checkboxProps2.onChange = handleChange;
}
const classString = classNames({
[`${prefixCls.value}-wrapper`]: true,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-wrapper-checked`]: checkboxProps2.checked,
[`${prefixCls.value}-wrapper-disabled`]: checkboxProps2.disabled,
[`${prefixCls.value}-wrapper-in-form-item`]: formItemInputContext.isFormItemInput
}, className, hashId.value);
const checkboxClass = classNames({
[`${prefixCls.value}-indeterminate`]: indeterminate
}, hashId.value);
const ariaChecked = indeterminate ? "mixed" : void 0;
return wrapSSR(createVNode("label", {
"class": classString,
"style": style,
"onMouseenter": onMouseenter,
"onMouseleave": onMouseleave
}, [createVNode(VcCheckbox, _objectSpread$W(_objectSpread$W({
"aria-checked": ariaChecked
}, checkboxProps2), {}, {
"class": checkboxClass,
"ref": checkboxRef
}), null), children.length ? createVNode("span", null, [children]) : null]));
};
}
});
const CheckboxGroup = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACheckboxGroup",
inheritAttrs: false,
props: checkboxGroupProps(),
// emits: ['change', 'update:value'],
setup(props2, _ref) {
let {
slots,
attrs,
emit,
expose
} = _ref;
const formItemContext = useInjectFormItemContext();
const {
prefixCls,
direction
} = useConfigInject("checkbox", props2);
const groupPrefixCls = computed(() => `${prefixCls.value}-group`);
const [wrapSSR, hashId] = useStyle$B(groupPrefixCls);
const mergedValue = ref((props2.value === void 0 ? props2.defaultValue : props2.value) || []);
watch(() => props2.value, () => {
mergedValue.value = props2.value || [];
});
const options = computed(() => {
return props2.options.map((option) => {
if (typeof option === "string" || typeof option === "number") {
return {
label: option,
value: option
};
}
return option;
});
});
const triggerUpdate = ref(Symbol());
const registeredValuesMap = ref(/* @__PURE__ */ new Map());
const cancelValue = (id) => {
registeredValuesMap.value.delete(id);
triggerUpdate.value = Symbol();
};
const registerValue = (id, value) => {
registeredValuesMap.value.set(id, value);
triggerUpdate.value = Symbol();
};
const registeredValues = ref(/* @__PURE__ */ new Map());
watch(triggerUpdate, () => {
const valuseMap = /* @__PURE__ */ new Map();
for (const value of registeredValuesMap.value.values()) {
valuseMap.set(value, true);
}
registeredValues.value = valuseMap;
});
const toggleOption = (option) => {
const optionIndex = mergedValue.value.indexOf(option.value);
const value = [...mergedValue.value];
if (optionIndex === -1) {
value.push(option.value);
} else {
value.splice(optionIndex, 1);
}
if (props2.value === void 0) {
mergedValue.value = value;
}
const val = value.filter((val2) => registeredValues.value.has(val2)).sort((a, b) => {
const indexA = options.value.findIndex((opt) => opt.value === a);
const indexB = options.value.findIndex((opt) => opt.value === b);
return indexA - indexB;
});
emit("update:value", val);
emit("change", val);
formItemContext.onFieldChange();
};
provide(CheckboxGroupContextKey, {
cancelValue,
registerValue,
toggleOption,
mergedValue,
name: computed(() => props2.name),
disabled: computed(() => props2.disabled)
});
expose({
mergedValue
});
return () => {
var _a;
const {
id = formItemContext.id.value
} = props2;
let children = null;
if (options.value && options.value.length > 0) {
children = options.value.map((option) => {
var _a2;
return createVNode(Checkbox, {
"prefixCls": prefixCls.value,
"key": option.value.toString(),
"disabled": "disabled" in option ? option.disabled : props2.disabled,
"indeterminate": option.indeterminate,
"value": option.value,
"checked": mergedValue.value.indexOf(option.value) !== -1,
"onChange": option.onChange,
"class": `${groupPrefixCls.value}-item`
}, {
default: () => [slots.label !== void 0 ? (_a2 = slots.label) === null || _a2 === void 0 ? void 0 : _a2.call(slots, option) : option.label]
});
});
}
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [groupPrefixCls.value, {
[`${groupPrefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value],
"id": id
}), [children || ((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))]));
};
}
});
Checkbox.Group = CheckboxGroup;
Checkbox.install = function(app) {
app.component(Checkbox.name, Checkbox);
app.component(CheckboxGroup.name, CheckboxGroup);
return app;
};
const index$j = {
useBreakpoint
};
const index$i = withInstall(Col);
const genBaseStyle$b = (token) => {
const {
componentCls,
commentBg,
commentPaddingBase,
commentNestIndent,
commentFontSizeBase,
commentFontSizeSm,
commentAuthorNameColor,
commentAuthorTimeColor,
commentActionColor,
commentActionHoverColor,
commentActionsMarginBottom,
commentActionsMarginTop,
commentContentDetailPMarginBottom
} = token;
return {
[componentCls]: {
position: "relative",
backgroundColor: commentBg,
[`${componentCls}-inner`]: {
display: "flex",
padding: commentPaddingBase
},
[`${componentCls}-avatar`]: {
position: "relative",
flexShrink: 0,
marginRight: token.marginSM,
cursor: "pointer",
[`img`]: {
width: "32px",
height: "32px",
borderRadius: "50%"
}
},
[`${componentCls}-content`]: {
position: "relative",
flex: `1 1 auto`,
minWidth: `1px`,
fontSize: commentFontSizeBase,
wordWrap: "break-word",
[`&-author`]: {
display: "flex",
flexWrap: "wrap",
justifyContent: "flex-start",
marginBottom: token.marginXXS,
fontSize: commentFontSizeBase,
[`& > a,& > span`]: {
paddingRight: token.paddingXS,
fontSize: commentFontSizeSm,
lineHeight: `18px`
},
[`&-name`]: {
color: commentAuthorNameColor,
fontSize: commentFontSizeBase,
transition: `color ${token.motionDurationSlow}`,
[`> *`]: {
color: commentAuthorNameColor,
[`&:hover`]: {
color: commentAuthorNameColor
}
}
},
[`&-time`]: {
color: commentAuthorTimeColor,
whiteSpace: "nowrap",
cursor: "auto"
}
},
[`&-detail p`]: {
marginBottom: commentContentDetailPMarginBottom,
whiteSpace: "pre-wrap"
}
},
[`${componentCls}-actions`]: {
marginTop: commentActionsMarginTop,
marginBottom: commentActionsMarginBottom,
paddingLeft: 0,
[`> li`]: {
display: "inline-block",
color: commentActionColor,
[`> span`]: {
marginRight: "10px",
color: commentActionColor,
fontSize: commentFontSizeSm,
cursor: "pointer",
transition: `color ${token.motionDurationSlow}`,
userSelect: "none",
[`&:hover`]: {
color: commentActionHoverColor
}
}
}
},
[`${componentCls}-nested`]: {
marginLeft: commentNestIndent
},
"&-rtl": {
direction: "rtl"
}
}
};
};
const useStyle$z = genComponentStyleHook("Comment", (token) => {
const commentToken = merge(token, {
commentBg: "inherit",
commentPaddingBase: `${token.paddingMD}px 0`,
commentNestIndent: `44px`,
commentFontSizeBase: token.fontSize,
commentFontSizeSm: token.fontSizeSM,
commentAuthorNameColor: token.colorTextTertiary,
commentAuthorTimeColor: token.colorTextPlaceholder,
commentActionColor: token.colorTextTertiary,
commentActionHoverColor: token.colorTextSecondary,
commentActionsMarginBottom: "inherit",
commentActionsMarginTop: token.marginSM,
commentContentDetailPMarginBottom: "inherit"
});
return [genBaseStyle$b(commentToken)];
});
const commentProps = () => ({
actions: Array,
/** The element to display as the comment author. */
author: PropTypes.any,
/** The element to display as the comment avatar - generally an antd Avatar */
avatar: PropTypes.any,
/** The main content of the comment */
content: PropTypes.any,
/** Comment prefix defaults to '.ant-comment' */
prefixCls: String,
/** A datetime element containing the time to be displayed */
datetime: PropTypes.any
});
const Comment = defineComponent({
compatConfig: {
MODE: 3
},
name: "AComment",
inheritAttrs: false,
props: commentProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("comment", props2);
const [wrapSSR, hashId] = useStyle$z(prefixCls);
const renderNested = (prefixCls2, children) => {
return createVNode("div", {
"class": `${prefixCls2}-nested`
}, [children]);
};
const getAction = (actions) => {
if (!actions || !actions.length) {
return null;
}
const actionList = actions.map((action, index2) => createVNode("li", {
"key": `action-${index2}`
}, [action]));
return actionList;
};
return () => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
const pre = prefixCls.value;
const actions = (_a = props2.actions) !== null && _a !== void 0 ? _a : (_b = slots.actions) === null || _b === void 0 ? void 0 : _b.call(slots);
const author = (_c = props2.author) !== null && _c !== void 0 ? _c : (_d = slots.author) === null || _d === void 0 ? void 0 : _d.call(slots);
const avatar = (_e = props2.avatar) !== null && _e !== void 0 ? _e : (_f = slots.avatar) === null || _f === void 0 ? void 0 : _f.call(slots);
const content = (_g = props2.content) !== null && _g !== void 0 ? _g : (_h = slots.content) === null || _h === void 0 ? void 0 : _h.call(slots);
const datetime = (_j = props2.datetime) !== null && _j !== void 0 ? _j : (_k = slots.datetime) === null || _k === void 0 ? void 0 : _k.call(slots);
const avatarDom = createVNode("div", {
"class": `${pre}-avatar`
}, [typeof avatar === "string" ? createVNode("img", {
"src": avatar,
"alt": "comment-avatar"
}, null) : avatar]);
const actionDom = actions ? createVNode("ul", {
"class": `${pre}-actions`
}, [getAction(Array.isArray(actions) ? actions : [actions])]) : null;
const authorContent = createVNode("div", {
"class": `${pre}-content-author`
}, [author && createVNode("span", {
"class": `${pre}-content-author-name`
}, [author]), datetime && createVNode("span", {
"class": `${pre}-content-author-time`
}, [datetime])]);
const contentDom = createVNode("div", {
"class": `${pre}-content`
}, [authorContent, createVNode("div", {
"class": `${pre}-content-detail`
}, [content]), actionDom]);
const comment = createVNode("div", {
"class": `${pre}-inner`
}, [avatarDom, contentDom]);
const children = flattenChildren((_l = slots.default) === null || _l === void 0 ? void 0 : _l.call(slots));
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [pre, {
[`${pre}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value]
}), [comment, children && children.length ? renderNested(pre, children) : null]));
};
}
});
const index$h = withInstall(Comment);
let runtimeLocale = _extends({}, localeValues.Modal);
function changeConfirmLocale(newLocale) {
if (newLocale) {
runtimeLocale = _extends(_extends({}, runtimeLocale), newLocale);
} else {
runtimeLocale = _extends({}, localeValues.Modal);
}
}
function getConfirmLocale() {
return runtimeLocale;
}
const ANT_MARK = "internalMark";
const LocaleProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "ALocaleProvider",
props: {
locale: {
type: Object
},
ANT_MARK__: String
},
setup(props2, _ref) {
let {
slots
} = _ref;
warning(props2.ANT_MARK__ === ANT_MARK);
const state = reactive({
antLocale: _extends(_extends({}, props2.locale), {
exist: true
}),
ANT_MARK__: ANT_MARK
});
provide("localeData", state);
watch(() => props2.locale, (locale2) => {
changeConfirmLocale(locale2 && locale2.Modal);
state.antLocale = _extends(_extends({}, locale2), {
exist: true
});
}, {
immediate: true
});
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
LocaleProvider.install = function(app) {
app.component(LocaleProvider.name, LocaleProvider);
return app;
};
const locale = withInstall(LocaleProvider);
const Notice = defineComponent({
name: "Notice",
inheritAttrs: false,
props: ["prefixCls", "duration", "updateMark", "noticeKey", "closeIcon", "closable", "props", "onClick", "onClose", "holder", "visible"],
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
let closeTimer;
const duration = computed(() => props2.duration === void 0 ? 4.5 : props2.duration);
const startCloseTimer = () => {
if (duration.value && true) {
closeTimer = setTimeout(() => {
close();
}, duration.value * 1e3);
}
};
const clearCloseTimer = () => {
if (closeTimer) {
clearTimeout(closeTimer);
closeTimer = null;
}
};
const close = (e) => {
if (e) {
e.stopPropagation();
}
clearCloseTimer();
const {
onClose,
noticeKey
} = props2;
if (onClose) {
onClose(noticeKey);
}
};
const restartCloseTimer = () => {
clearCloseTimer();
startCloseTimer();
};
watch([duration, () => props2.updateMark, () => props2.visible], (_ref2, _ref3) => {
let [preDuration, preUpdateMark, preVisible] = _ref2;
let [newDuration, newUpdateMark, newVisible] = _ref3;
if (preDuration !== newDuration || preUpdateMark !== newUpdateMark || preVisible !== newVisible && newVisible) {
restartCloseTimer();
}
}, {
flush: "post"
});
return () => {
var _a, _b;
const {
prefixCls,
closable,
closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots),
onClick,
holder
} = props2;
const {
class: className,
style
} = attrs;
const componentClass = `${prefixCls}-notice`;
const dataOrAriaAttributeProps = Object.keys(attrs).reduce((acc, key2) => {
if (key2.startsWith("data-") || key2.startsWith("aria-") || key2 === "role") {
acc[key2] = attrs[key2];
}
return acc;
}, {});
const node = createVNode("div", _objectSpread$W({
"class": classNames(componentClass, className, {
[`${componentClass}-closable`]: closable
}),
"style": style,
"onMouseenter": clearCloseTimer,
"onMouseleave": startCloseTimer,
"onClick": onClick
}, dataOrAriaAttributeProps), [createVNode("div", {
"class": `${componentClass}-content`
}, [(_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots)]), closable ? createVNode("a", {
"tabindex": 0,
"onClick": close,
"class": `${componentClass}-close`
}, [closeIcon || createVNode("span", {
"class": `${componentClass}-close-x`
}, null)]) : null]);
if (holder) {
return createVNode(Teleport, {
"to": holder
}, {
default: () => node
});
}
return node;
};
}
});
var __rest$Q = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
let seed$1 = 0;
const now$2 = Date.now();
function getUuid$1() {
const id = seed$1;
seed$1 += 1;
return `rcNotification_${now$2}_${id}`;
}
const Notification$2 = defineComponent({
name: "Notification",
inheritAttrs: false,
props: ["prefixCls", "transitionName", "animation", "maxCount", "closeIcon", "hashId"],
setup(props2, _ref) {
let {
attrs,
expose,
slots
} = _ref;
const hookRefs = /* @__PURE__ */ new Map();
const notices = ref([]);
const transitionProps = computed(() => {
const {
prefixCls,
animation = "fade"
} = props2;
let name = props2.transitionName;
if (!name && animation) {
name = `${prefixCls}-${animation}`;
}
return getTransitionGroupProps(name);
});
const add = (originNotice, holderCallback) => {
const key2 = originNotice.key || getUuid$1();
const notice2 = _extends(_extends({}, originNotice), {
key: key2
});
const {
maxCount: maxCount2
} = props2;
const noticeIndex = notices.value.map((v) => v.notice.key).indexOf(key2);
const updatedNotices = notices.value.concat();
if (noticeIndex !== -1) {
updatedNotices.splice(noticeIndex, 1, {
notice: notice2,
holderCallback
});
} else {
if (maxCount2 && notices.value.length >= maxCount2) {
notice2.key = updatedNotices[0].notice.key;
notice2.updateMark = getUuid$1();
notice2.userPassKey = key2;
updatedNotices.shift();
}
updatedNotices.push({
notice: notice2,
holderCallback
});
}
notices.value = updatedNotices;
};
const remove = (removeKey) => {
notices.value = toRaw(notices.value).filter((_ref2) => {
let {
notice: {
key: key2,
userPassKey
}
} = _ref2;
const mergedKey = userPassKey || key2;
return mergedKey !== removeKey;
});
};
expose({
add,
remove,
notices
});
return () => {
var _a;
const {
prefixCls,
closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots, {
prefixCls
})
} = props2;
const noticeNodes = notices.value.map((_ref3, index2) => {
let {
notice: notice2,
holderCallback
} = _ref3;
const updateMark = index2 === notices.value.length - 1 ? notice2.updateMark : void 0;
const {
key: key2,
userPassKey
} = notice2;
const {
content
} = notice2;
const noticeProps = _extends(_extends(_extends({
prefixCls,
closeIcon: typeof closeIcon === "function" ? closeIcon({
prefixCls
}) : closeIcon
}, notice2), notice2.props), {
key: key2,
noticeKey: userPassKey || key2,
updateMark,
onClose: (noticeKey) => {
var _a2;
remove(noticeKey);
(_a2 = notice2.onClose) === null || _a2 === void 0 ? void 0 : _a2.call(notice2);
},
onClick: notice2.onClick
});
if (holderCallback) {
return createVNode("div", {
"key": key2,
"class": `${prefixCls}-hook-holder`,
"ref": (div) => {
if (typeof key2 === "undefined") {
return;
}
if (div) {
hookRefs.set(key2, div);
holderCallback(div, noticeProps);
} else {
hookRefs.delete(key2);
}
}
}, null);
}
return createVNode(Notice, _objectSpread$W(_objectSpread$W({}, noticeProps), {}, {
"class": classNames(noticeProps.class, props2.hashId)
}), {
default: () => [typeof content === "function" ? content({
prefixCls
}) : content]
});
});
const className = {
[prefixCls]: 1,
[attrs.class]: !!attrs.class,
[props2.hashId]: true
};
return createVNode("div", {
"class": className,
"style": attrs.style || {
top: "65px",
left: "50%"
}
}, [createVNode(TransitionGroup, _objectSpread$W({
"tag": "div"
}, transitionProps.value), {
default: () => [noticeNodes]
})]);
};
}
});
Notification$2.newInstance = function newNotificationInstance(properties, callback) {
const _a = properties || {}, {
name = "notification",
getContainer: getContainer2,
appContext,
prefixCls: customizePrefixCls,
rootPrefixCls: customRootPrefixCls,
transitionName: customTransitionName,
hasTransitionName: hasTransitionName2,
useStyle: useStyle2
} = _a, props2 = __rest$Q(_a, ["name", "getContainer", "appContext", "prefixCls", "rootPrefixCls", "transitionName", "hasTransitionName", "useStyle"]);
const div = (void 0).createElement("div");
if (getContainer2) {
const root = getContainer2();
root.appendChild(div);
} else {
(void 0).body.appendChild(div);
}
const Wrapper = defineComponent({
compatConfig: {
MODE: 3
},
name: "NotificationWrapper",
setup(_props, _ref4) {
let {
attrs
} = _ref4;
const notiRef = shallowRef();
const prefixCls = computed(() => globalConfigForApi.getPrefixCls(name, customizePrefixCls));
const [, hashId] = useStyle2(prefixCls);
return () => {
const global = globalConfigForApi;
const rootPrefixCls = global.getRootPrefixCls(customRootPrefixCls, prefixCls.value);
const transitionName2 = hasTransitionName2 ? customTransitionName : `${prefixCls.value}-${customTransitionName}`;
return createVNode(ConfigProvider, _objectSpread$W(_objectSpread$W({}, global), {}, {
"prefixCls": rootPrefixCls
}), {
default: () => [createVNode(Notification$2, _objectSpread$W(_objectSpread$W({
"ref": notiRef
}, attrs), {}, {
"prefixCls": prefixCls.value,
"transitionName": transitionName2,
"hashId": hashId.value
}), null)]
});
};
}
});
const vm = createVNode(Wrapper, props2);
vm.appContext = appContext || vm.appContext;
render(vm, div);
};
let seed = 0;
const now$1 = Date.now();
function getUuid() {
const id = seed;
seed += 1;
return `rcNotification_${now$1}_${id}`;
}
const Notification$1 = defineComponent({
name: "HookNotification",
inheritAttrs: false,
props: ["prefixCls", "transitionName", "animation", "maxCount", "closeIcon", "hashId", "remove", "notices", "getStyles", "getClassName", "onAllRemoved", "getContainer"],
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const hookRefs = /* @__PURE__ */ new Map();
const notices = computed(() => props2.notices);
const transitionProps = computed(() => {
let name = props2.transitionName;
if (!name && props2.animation) {
switch (typeof props2.animation) {
case "string":
name = props2.animation;
break;
case "function":
name = props2.animation().name;
break;
case "object":
name = props2.animation.name;
break;
default:
name = `${props2.prefixCls}-fade`;
break;
}
}
return getTransitionGroupProps(name);
});
const remove = (key2) => props2.remove(key2);
const placements2 = ref({});
watch(notices, () => {
const nextPlacements = {};
Object.keys(placements2.value).forEach((placement) => {
nextPlacements[placement] = [];
});
props2.notices.forEach((config) => {
const {
placement = "topRight"
} = config.notice;
if (placement) {
nextPlacements[placement] = nextPlacements[placement] || [];
nextPlacements[placement].push(config);
}
});
placements2.value = nextPlacements;
});
const placementList = computed(() => Object.keys(placements2.value));
return () => {
var _a;
const {
prefixCls,
closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots, {
prefixCls
})
} = props2;
const noticeNodes = placementList.value.map((placement) => {
var _a2, _b;
const noticesForPlacement = placements2.value[placement];
const classes = (_a2 = props2.getClassName) === null || _a2 === void 0 ? void 0 : _a2.call(props2, placement);
const styles = (_b = props2.getStyles) === null || _b === void 0 ? void 0 : _b.call(props2, placement);
const noticeNodesForPlacement = noticesForPlacement.map((_ref2, index2) => {
let {
notice: notice2,
holderCallback
} = _ref2;
const updateMark = index2 === notices.value.length - 1 ? notice2.updateMark : void 0;
const {
key: key2,
userPassKey
} = notice2;
const {
content
} = notice2;
const noticeProps = _extends(_extends(_extends({
prefixCls,
closeIcon: typeof closeIcon === "function" ? closeIcon({
prefixCls
}) : closeIcon
}, notice2), notice2.props), {
key: key2,
noticeKey: userPassKey || key2,
updateMark,
onClose: (noticeKey) => {
var _a3;
remove(noticeKey);
(_a3 = notice2.onClose) === null || _a3 === void 0 ? void 0 : _a3.call(notice2);
},
onClick: notice2.onClick
});
if (holderCallback) {
return createVNode("div", {
"key": key2,
"class": `${prefixCls}-hook-holder`,
"ref": (div) => {
if (typeof key2 === "undefined") {
return;
}
if (div) {
hookRefs.set(key2, div);
holderCallback(div, noticeProps);
} else {
hookRefs.delete(key2);
}
}
}, null);
}
return createVNode(Notice, _objectSpread$W(_objectSpread$W({}, noticeProps), {}, {
"class": classNames(noticeProps.class, props2.hashId)
}), {
default: () => [typeof content === "function" ? content({
prefixCls
}) : content]
});
});
const className = {
[prefixCls]: 1,
[`${prefixCls}-${placement}`]: 1,
[attrs.class]: !!attrs.class,
[props2.hashId]: true,
[classes]: !!classes
};
function onAfterLeave() {
var _a3;
if (noticesForPlacement.length > 0) {
return;
}
Reflect.deleteProperty(placements2.value, placement);
(_a3 = props2.onAllRemoved) === null || _a3 === void 0 ? void 0 : _a3.call(props2);
}
return createVNode("div", {
"key": placement,
"class": className,
"style": attrs.style || styles || {
top: "65px",
left: "50%"
}
}, [createVNode(TransitionGroup, _objectSpread$W(_objectSpread$W({
"tag": "div"
}, transitionProps.value), {}, {
"onAfterLeave": onAfterLeave
}), {
default: () => [noticeNodesForPlacement]
})]);
});
return createVNode(Portal$1, {
"getContainer": props2.getContainer
}, {
default: () => [noticeNodes]
});
};
}
});
var __rest$P = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const defaultGetContainer$1 = () => (void 0).body;
let uniqueKey = 0;
function mergeConfig() {
const clone = {};
for (var _len = arguments.length, objList = new Array(_len), _key = 0; _key < _len; _key++) {
objList[_key] = arguments[_key];
}
objList.forEach((obj) => {
if (obj) {
Object.keys(obj).forEach((key2) => {
const val = obj[key2];
if (val !== void 0) {
clone[key2] = val;
}
});
}
});
return clone;
}
function useNotification$1() {
let rootConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
const {
getContainer: getContainer2 = defaultGetContainer$1,
motion,
prefixCls,
maxCount: maxCount2,
getClassName,
getStyles,
onAllRemoved
} = rootConfig, shareConfig = __rest$P(rootConfig, ["getContainer", "motion", "prefixCls", "maxCount", "getClassName", "getStyles", "onAllRemoved"]);
const notices = shallowRef([]);
const notificationsRef = shallowRef();
const add = (originNotice, holderCallback) => {
const key2 = originNotice.key || getUuid();
const notice2 = _extends(_extends({}, originNotice), {
key: key2
});
const noticeIndex = notices.value.map((v) => v.notice.key).indexOf(key2);
const updatedNotices = notices.value.concat();
if (noticeIndex !== -1) {
updatedNotices.splice(noticeIndex, 1, {
notice: notice2,
holderCallback
});
} else {
if (maxCount2 && notices.value.length >= maxCount2) {
notice2.key = updatedNotices[0].notice.key;
notice2.updateMark = getUuid();
notice2.userPassKey = key2;
updatedNotices.shift();
}
updatedNotices.push({
notice: notice2,
holderCallback
});
}
notices.value = updatedNotices;
};
const removeNotice = (removeKey) => {
notices.value = notices.value.filter((_ref) => {
let {
notice: {
key: key2,
userPassKey
}
} = _ref;
const mergedKey = userPassKey || key2;
return mergedKey !== removeKey;
});
};
const destroy = () => {
notices.value = [];
};
const contextHolder = () => createVNode(Notification$1, {
"ref": notificationsRef,
"prefixCls": prefixCls,
"maxCount": maxCount2,
"notices": notices.value,
"remove": removeNotice,
"getClassName": getClassName,
"getStyles": getStyles,
"animation": motion,
"hashId": rootConfig.hashId,
"onAllRemoved": onAllRemoved,
"getContainer": getContainer2
}, null);
const taskQueue = shallowRef([]);
const api2 = {
open: (config) => {
const mergedConfig = mergeConfig(shareConfig, config);
if (mergedConfig.key === null || mergedConfig.key === void 0) {
mergedConfig.key = `vc-notification-${uniqueKey}`;
uniqueKey += 1;
}
taskQueue.value = [...taskQueue.value, {
type: "open",
config: mergedConfig
}];
},
close: (key2) => {
taskQueue.value = [...taskQueue.value, {
type: "close",
key: key2
}];
},
destroy: () => {
taskQueue.value = [...taskQueue.value, {
type: "destroy"
}];
}
};
watch(taskQueue, () => {
if (taskQueue.value.length) {
taskQueue.value.forEach((task) => {
switch (task.type) {
case "open":
add(task.config);
break;
case "close":
removeNotice(task.key);
break;
case "destroy":
destroy();
break;
}
});
taskQueue.value = [];
}
});
return [api2, contextHolder];
}
const genMessageStyle = (token) => {
const {
componentCls,
iconCls,
boxShadowSecondary,
colorBgElevated,
colorSuccess,
colorError,
colorWarning,
colorInfo,
fontSizeLG,
motionEaseInOutCirc,
motionDurationSlow,
marginXS,
paddingXS,
borderRadiusLG,
zIndexPopup,
// Custom token
messageNoticeContentPadding
} = token;
const messageMoveIn = new Keyframe("MessageMoveIn", {
"0%": {
padding: 0,
transform: "translateY(-100%)",
opacity: 0
},
"100%": {
padding: paddingXS,
transform: "translateY(0)",
opacity: 1
}
});
const messageMoveOut = new Keyframe("MessageMoveOut", {
"0%": {
maxHeight: token.height,
padding: paddingXS,
opacity: 1
},
"100%": {
maxHeight: 0,
padding: 0,
opacity: 0
}
});
return [
// ============================ Holder ============================
{
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "fixed",
top: marginXS,
left: "50%",
transform: "translateX(-50%)",
width: "100%",
pointerEvents: "none",
zIndex: zIndexPopup,
[`${componentCls}-move-up`]: {
animationFillMode: "forwards"
},
[`
${componentCls}-move-up-appear,
${componentCls}-move-up-enter
`]: {
animationName: messageMoveIn,
animationDuration: motionDurationSlow,
animationPlayState: "paused",
animationTimingFunction: motionEaseInOutCirc
},
[`
${componentCls}-move-up-appear${componentCls}-move-up-appear-active,
${componentCls}-move-up-enter${componentCls}-move-up-enter-active
`]: {
animationPlayState: "running"
},
[`${componentCls}-move-up-leave`]: {
animationName: messageMoveOut,
animationDuration: motionDurationSlow,
animationPlayState: "paused",
animationTimingFunction: motionEaseInOutCirc
},
[`${componentCls}-move-up-leave${componentCls}-move-up-leave-active`]: {
animationPlayState: "running"
},
"&-rtl": {
direction: "rtl",
span: {
direction: "rtl"
}
}
})
},
// ============================ Notice ============================
{
[`${componentCls}-notice`]: {
padding: paddingXS,
textAlign: "center",
[iconCls]: {
verticalAlign: "text-bottom",
marginInlineEnd: marginXS,
fontSize: fontSizeLG
},
[`${componentCls}-notice-content`]: {
display: "inline-block",
padding: messageNoticeContentPadding,
background: colorBgElevated,
borderRadius: borderRadiusLG,
boxShadow: boxShadowSecondary,
pointerEvents: "all"
},
[`${componentCls}-success ${iconCls}`]: {
color: colorSuccess
},
[`${componentCls}-error ${iconCls}`]: {
color: colorError
},
[`${componentCls}-warning ${iconCls}`]: {
color: colorWarning
},
[`
${componentCls}-info ${iconCls},
${componentCls}-loading ${iconCls}`]: {
color: colorInfo
}
}
},
// ============================= Pure =============================
{
[`${componentCls}-notice-pure-panel`]: {
padding: 0,
textAlign: "start"
}
}
];
};
const useStyle$y = genComponentStyleHook("Message", (token) => {
const combinedToken = merge(token, {
messageNoticeContentPadding: `${(token.controlHeightLG - token.fontSize * token.lineHeight) / 2}px ${token.paddingSM}px`
});
return [genMessageStyle(combinedToken)];
}, (token) => ({
height: 150,
zIndexPopup: token.zIndexPopupBase + 10
}));
const TypeIcon = {
info: createVNode(InfoCircleFilled, null, null),
success: createVNode(CheckCircleFilled, null, null),
error: createVNode(CloseCircleFilled, null, null),
warning: createVNode(ExclamationCircleFilled, null, null),
loading: createVNode(LoadingOutlined, null, null)
};
const PureContent$1 = defineComponent({
name: "PureContent",
inheritAttrs: false,
props: ["prefixCls", "type", "icon"],
setup(props2, _ref) {
let {
slots
} = _ref;
return () => {
var _a;
return createVNode("div", {
"class": classNames(`${props2.prefixCls}-custom-content`, `${props2.prefixCls}-${props2.type}`)
}, [props2.icon || TypeIcon[props2.type], createVNode("span", null, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])]);
};
}
});
defineComponent({
name: "PurePanel",
inheritAttrs: false,
props: ["prefixCls", "class", "type", "icon", "content"],
setup(props2, _ref2) {
let {
slots,
attrs
} = _ref2;
var _a;
const {
getPrefixCls
} = useConfigContextInject();
const prefixCls = computed(() => props2.prefixCls || getPrefixCls("message"));
const [, hashId] = useStyle$y(prefixCls);
return createVNode(Notice, _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"prefixCls": prefixCls.value,
"class": classNames(hashId.value, `${prefixCls.value}-notice-pure-panel`),
"noticeKey": "pure",
"duration": null
}), {
default: () => [createVNode(PureContent$1, {
"prefixCls": prefixCls.value,
"type": props2.type,
"icon": props2.icon
}, {
default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
})]
});
}
});
var __rest$O = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const DEFAULT_OFFSET$1 = 8;
const DEFAULT_DURATION$1 = 3;
const Holder$1 = defineComponent({
name: "Holder",
inheritAttrs: false,
props: ["top", "prefixCls", "getContainer", "maxCount", "duration", "rtl", "transitionName", "onAllRemoved", "animation", "staticGetContainer"],
setup(props2, _ref) {
let {
expose
} = _ref;
var _a, _b;
const {
getPrefixCls,
getPopupContainer
} = useConfigInject("message", props2);
const prefixCls = computed(() => getPrefixCls("message", props2.prefixCls));
const [, hashId] = useStyle$y(prefixCls);
const getStyles = () => {
var _a2;
const top = (_a2 = props2.top) !== null && _a2 !== void 0 ? _a2 : DEFAULT_OFFSET$1;
return {
left: "50%",
transform: "translateX(-50%)",
top: typeof top === "number" ? `${top}px` : top
};
};
const getClassName = () => classNames(hashId.value, props2.rtl ? `${prefixCls.value}-rtl` : "");
const getNotificationMotion = () => {
var _a2;
return getMotion$1({
prefixCls: prefixCls.value,
animation: (_a2 = props2.animation) !== null && _a2 !== void 0 ? _a2 : `move-up`,
transitionName: props2.transitionName
});
};
const mergedCloseIcon = createVNode("span", {
"class": `${prefixCls.value}-close-x`
}, [createVNode(CloseOutlined, {
"class": `${prefixCls.value}-close-icon`
}, null)]);
const [api2, holder] = useNotification$1({
//@ts-ignore
getStyles,
prefixCls: prefixCls.value,
getClassName,
motion: getNotificationMotion,
closable: false,
closeIcon: mergedCloseIcon,
duration: (_a = props2.duration) !== null && _a !== void 0 ? _a : DEFAULT_DURATION$1,
getContainer: (_b = props2.staticGetContainer) !== null && _b !== void 0 ? _b : getPopupContainer.value,
maxCount: props2.maxCount,
onAllRemoved: props2.onAllRemoved
});
expose(_extends(_extends({}, api2), {
prefixCls,
hashId
}));
return holder;
}
});
let keyIndex = 0;
function useInternalMessage(messageConfig) {
const holderRef = shallowRef(null);
const holderKey = Symbol("messageHolderKey");
const close = (key2) => {
var _a;
(_a = holderRef.value) === null || _a === void 0 ? void 0 : _a.close(key2);
};
const open2 = (config) => {
if (!holderRef.value) {
const fakeResult = () => {
};
fakeResult.then = () => {
};
return fakeResult;
}
const {
open: originOpen,
prefixCls,
hashId
} = holderRef.value;
const noticePrefixCls = `${prefixCls}-notice`;
const {
content,
icon,
type,
key: key2,
class: className,
onClose
} = config, restConfig = __rest$O(config, ["content", "icon", "type", "key", "class", "onClose"]);
let mergedKey = key2;
if (mergedKey === void 0 || mergedKey === null) {
keyIndex += 1;
mergedKey = `antd-message-${keyIndex}`;
}
return wrapPromiseFn((resolve) => {
originOpen(_extends(_extends({}, restConfig), {
key: mergedKey,
content: () => createVNode(PureContent$1, {
"prefixCls": prefixCls,
"type": type,
"icon": typeof icon === "function" ? icon() : icon
}, {
default: () => [typeof content === "function" ? content() : content]
}),
placement: "top",
// @ts-ignore
class: classNames(type && `${noticePrefixCls}-${type}`, hashId, className),
onClose: () => {
onClose === null || onClose === void 0 ? void 0 : onClose();
resolve();
}
}));
return () => {
close(mergedKey);
};
});
};
const destroy = (key2) => {
var _a;
if (key2 !== void 0) {
close(key2);
} else {
(_a = holderRef.value) === null || _a === void 0 ? void 0 : _a.destroy();
}
};
const wrapAPI = {
open: open2,
destroy
};
const keys = ["info", "success", "warning", "error", "loading"];
keys.forEach((type) => {
const typeOpen = (jointContent, duration, onClose) => {
let config;
if (jointContent && typeof jointContent === "object" && "content" in jointContent) {
config = jointContent;
} else {
config = {
content: jointContent
};
}
let mergedDuration;
let mergedOnClose;
if (typeof duration === "function") {
mergedOnClose = duration;
} else {
mergedDuration = duration;
mergedOnClose = onClose;
}
const mergedConfig = _extends(_extends({
onClose: mergedOnClose,
duration: mergedDuration
}, config), {
type
});
return open2(mergedConfig);
};
wrapAPI[type] = typeOpen;
});
return [wrapAPI, () => createVNode(Holder$1, _objectSpread$W(_objectSpread$W({
"key": holderKey
}, messageConfig), {}, {
"ref": holderRef
}), null)];
}
function useMessage(messageConfig) {
return useInternalMessage(messageConfig);
}
let defaultDuration$1 = 3;
let defaultTop$1;
let messageInstance;
let key = 1;
let localPrefixCls = "";
let transitionName = "move-up";
let hasTransitionName = false;
let getContainer = () => (void 0).body;
let maxCount$1;
let rtl$1 = false;
function getKeyThenIncreaseKey() {
return key++;
}
function setMessageConfig(options) {
if (options.top !== void 0) {
defaultTop$1 = options.top;
messageInstance = null;
}
if (options.duration !== void 0) {
defaultDuration$1 = options.duration;
}
if (options.prefixCls !== void 0) {
localPrefixCls = options.prefixCls;
}
if (options.getContainer !== void 0) {
getContainer = options.getContainer;
messageInstance = null;
}
if (options.transitionName !== void 0) {
transitionName = options.transitionName;
messageInstance = null;
hasTransitionName = true;
}
if (options.maxCount !== void 0) {
maxCount$1 = options.maxCount;
messageInstance = null;
}
if (options.rtl !== void 0) {
rtl$1 = options.rtl;
}
}
function getMessageInstance(args, callback) {
if (messageInstance) {
callback(messageInstance);
return;
}
Notification$2.newInstance({
appContext: args.appContext,
prefixCls: args.prefixCls || localPrefixCls,
rootPrefixCls: args.rootPrefixCls,
transitionName,
hasTransitionName,
style: {
top: defaultTop$1
},
getContainer: getContainer || args.getPopupContainer,
maxCount: maxCount$1,
name: "message",
useStyle: useStyle$y
}, (instance) => {
if (messageInstance) {
callback(messageInstance);
return;
}
messageInstance = instance;
callback(instance);
});
}
const typeToIcon$2 = {
info: InfoCircleFilled,
success: CheckCircleFilled,
error: CloseCircleFilled,
warning: ExclamationCircleFilled,
loading: LoadingOutlined
};
const typeList = Object.keys(typeToIcon$2);
function notice$1(args) {
const duration = args.duration !== void 0 ? args.duration : defaultDuration$1;
const target = args.key || getKeyThenIncreaseKey();
const closePromise = new Promise((resolve) => {
const callback = () => {
if (typeof args.onClose === "function") {
args.onClose();
}
return resolve(true);
};
getMessageInstance(args, (instance) => {
instance.notice({
key: target,
duration,
style: args.style || {},
class: args.class,
content: (_ref) => {
let {
prefixCls
} = _ref;
const Icon = typeToIcon$2[args.type];
const iconNode = Icon ? createVNode(Icon, null, null) : "";
const messageClass = classNames(`${prefixCls}-custom-content`, {
[`${prefixCls}-${args.type}`]: args.type,
[`${prefixCls}-rtl`]: rtl$1 === true
});
return createVNode("div", {
"class": messageClass
}, [typeof args.icon === "function" ? args.icon() : args.icon || iconNode, createVNode("span", null, [typeof args.content === "function" ? args.content() : args.content])]);
},
onClose: callback,
onClick: args.onClick
});
});
});
const result = () => {
if (messageInstance) {
messageInstance.removeNotice(target);
}
};
result.then = (filled, rejected) => closePromise.then(filled, rejected);
result.promise = closePromise;
return result;
}
function isArgsProps(content) {
return Object.prototype.toString.call(content) === "[object Object]" && !!content.content;
}
const api$1 = {
open: notice$1,
config: setMessageConfig,
destroy(messageKey) {
if (messageInstance) {
if (messageKey) {
const {
removeNotice
} = messageInstance;
removeNotice(messageKey);
} else {
const {
destroy
} = messageInstance;
destroy();
messageInstance = null;
}
}
}
};
function attachTypeApi(originalApi, type) {
originalApi[type] = (content, duration, onClose) => {
if (isArgsProps(content)) {
return originalApi.open(_extends(_extends({}, content), {
type
}));
}
if (typeof duration === "function") {
onClose = duration;
duration = void 0;
}
return originalApi.open({
content,
duration,
type,
onClose
});
};
}
typeList.forEach((type) => attachTypeApi(api$1, type));
api$1.warn = api$1.warning;
api$1.useMessage = useMessage;
const genNotificationPlacementStyle = (token) => {
const {
componentCls,
width,
notificationMarginEdge
} = token;
const notificationTopFadeIn = new Keyframe("antNotificationTopFadeIn", {
"0%": {
marginTop: "-100%",
opacity: 0
},
"100%": {
marginTop: 0,
opacity: 1
}
});
const notificationBottomFadeIn = new Keyframe("antNotificationBottomFadeIn", {
"0%": {
marginBottom: "-100%",
opacity: 0
},
"100%": {
marginBottom: 0,
opacity: 1
}
});
const notificationLeftFadeIn = new Keyframe("antNotificationLeftFadeIn", {
"0%": {
right: {
_skip_check_: true,
value: width
},
opacity: 0
},
"100%": {
right: {
_skip_check_: true,
value: 0
},
opacity: 1
}
});
return {
[`&${componentCls}-top, &${componentCls}-bottom`]: {
marginInline: 0
},
[`&${componentCls}-top`]: {
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: notificationTopFadeIn
}
},
[`&${componentCls}-bottom`]: {
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: notificationBottomFadeIn
}
},
[`&${componentCls}-topLeft, &${componentCls}-bottomLeft`]: {
marginInlineEnd: 0,
marginInlineStart: notificationMarginEdge,
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: notificationLeftFadeIn
}
}
};
};
const genNotificationStyle = (token) => {
const {
iconCls,
componentCls,
// .ant-notification
boxShadowSecondary,
fontSizeLG,
notificationMarginBottom,
borderRadiusLG,
colorSuccess,
colorInfo,
colorWarning,
colorError,
colorTextHeading,
notificationBg,
notificationPadding,
notificationMarginEdge,
motionDurationMid,
motionEaseInOut,
fontSize,
lineHeight,
width,
notificationIconSize
} = token;
const noticeCls = `${componentCls}-notice`;
const notificationFadeIn = new Keyframe("antNotificationFadeIn", {
"0%": {
left: {
_skip_check_: true,
value: width
},
opacity: 0
},
"100%": {
left: {
_skip_check_: true,
value: 0
},
opacity: 1
}
});
const notificationFadeOut = new Keyframe("antNotificationFadeOut", {
"0%": {
maxHeight: token.animationMaxHeight,
marginBottom: notificationMarginBottom,
opacity: 1
},
"100%": {
maxHeight: 0,
marginBottom: 0,
paddingTop: 0,
paddingBottom: 0,
opacity: 0
}
});
return [
// ============================ Holder ============================
{
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
position: "fixed",
zIndex: token.zIndexPopup,
marginInlineEnd: notificationMarginEdge,
[`${componentCls}-hook-holder`]: {
position: "relative"
},
[`&${componentCls}-top, &${componentCls}-bottom`]: {
[`${componentCls}-notice`]: {
marginInline: "auto auto"
}
},
[`&${componentCls}-topLeft, &${componentCls}-bottomLeft`]: {
[`${componentCls}-notice`]: {
marginInlineEnd: "auto",
marginInlineStart: 0
}
},
// animation
[`${componentCls}-fade-enter, ${componentCls}-fade-appear`]: {
animationDuration: token.motionDurationMid,
animationTimingFunction: motionEaseInOut,
animationFillMode: "both",
opacity: 0,
animationPlayState: "paused"
},
[`${componentCls}-fade-leave`]: {
animationTimingFunction: motionEaseInOut,
animationFillMode: "both",
animationDuration: motionDurationMid,
animationPlayState: "paused"
},
[`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]: {
animationName: notificationFadeIn,
animationPlayState: "running"
},
[`${componentCls}-fade-leave${componentCls}-fade-leave-active`]: {
animationName: notificationFadeOut,
animationPlayState: "running"
}
}), genNotificationPlacementStyle(token)), {
// RTL
"&-rtl": {
direction: "rtl",
[`${componentCls}-notice-btn`]: {
float: "left"
}
}
})
},
// ============================ Notice ============================
{
[noticeCls]: {
position: "relative",
width,
maxWidth: `calc(100vw - ${notificationMarginEdge * 2}px)`,
marginBottom: notificationMarginBottom,
marginInlineStart: "auto",
padding: notificationPadding,
overflow: "hidden",
lineHeight,
wordWrap: "break-word",
background: notificationBg,
borderRadius: borderRadiusLG,
boxShadow: boxShadowSecondary,
[`${componentCls}-close-icon`]: {
fontSize,
cursor: "pointer"
},
[`${noticeCls}-message`]: {
marginBottom: token.marginXS,
color: colorTextHeading,
fontSize: fontSizeLG,
lineHeight: token.lineHeightLG
},
[`${noticeCls}-description`]: {
fontSize
},
[`&${noticeCls}-closable ${noticeCls}-message`]: {
paddingInlineEnd: token.paddingLG
},
[`${noticeCls}-with-icon ${noticeCls}-message`]: {
marginBottom: token.marginXS,
marginInlineStart: token.marginSM + notificationIconSize,
fontSize: fontSizeLG
},
[`${noticeCls}-with-icon ${noticeCls}-description`]: {
marginInlineStart: token.marginSM + notificationIconSize,
fontSize
},
// Icon & color style in different selector level
// https://github.com/ant-design/ant-design/issues/16503
// https://github.com/ant-design/ant-design/issues/15512
[`${noticeCls}-icon`]: {
position: "absolute",
fontSize: notificationIconSize,
lineHeight: 0,
// icon-font
[`&-success${iconCls}`]: {
color: colorSuccess
},
[`&-info${iconCls}`]: {
color: colorInfo
},
[`&-warning${iconCls}`]: {
color: colorWarning
},
[`&-error${iconCls}`]: {
color: colorError
}
},
[`${noticeCls}-close`]: {
position: "absolute",
top: token.notificationPaddingVertical,
insetInlineEnd: token.notificationPaddingHorizontal,
color: token.colorIcon,
outline: "none",
width: token.notificationCloseButtonSize,
height: token.notificationCloseButtonSize,
borderRadius: token.borderRadiusSM,
transition: `background-color ${token.motionDurationMid}, color ${token.motionDurationMid}`,
display: "flex",
alignItems: "center",
justifyContent: "center",
"&:hover": {
color: token.colorIconHover,
backgroundColor: token.wireframe ? "transparent" : token.colorFillContent
}
},
[`${noticeCls}-btn`]: {
float: "right",
marginTop: token.marginSM
}
}
},
// ============================= Pure =============================
{
[`${noticeCls}-pure-panel`]: {
margin: 0
}
}
];
};
const useStyle$x = genComponentStyleHook("Notification", (token) => {
const notificationPaddingVertical = token.paddingMD;
const notificationPaddingHorizontal = token.paddingLG;
const notificationToken = merge(token, {
// default.less variables
notificationBg: token.colorBgElevated,
notificationPaddingVertical,
notificationPaddingHorizontal,
// index.less variables
notificationPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`,
notificationMarginBottom: token.margin,
notificationMarginEdge: token.marginLG,
animationMaxHeight: 150,
notificationIconSize: token.fontSizeLG * token.lineHeightLG,
notificationCloseButtonSize: token.controlHeightLG * 0.55
});
return [genNotificationStyle(notificationToken)];
}, (token) => ({
zIndexPopup: token.zIndexPopupBase + 50,
width: 384
}));
function getCloseIcon(prefixCls, closeIcon) {
return closeIcon || createVNode("span", {
"class": `${prefixCls}-close-x`
}, [createVNode(CloseOutlined, {
"class": `${prefixCls}-close-icon`
}, null)]);
}
({
info: createVNode(InfoCircleFilled, null, null),
success: createVNode(CheckCircleFilled, null, null),
error: createVNode(CloseCircleFilled, null, null),
warning: createVNode(ExclamationCircleFilled, null, null),
loading: createVNode(LoadingOutlined, null, null)
});
const typeToIcon$1 = {
success: CheckCircleFilled,
info: InfoCircleFilled,
error: CloseCircleFilled,
warning: ExclamationCircleFilled
};
function PureContent(_ref) {
let {
prefixCls,
icon,
type,
message,
description,
btn
} = _ref;
let iconNode = null;
if (icon) {
iconNode = createVNode("span", {
"class": `${prefixCls}-icon`
}, [renderHelper(icon)]);
} else if (type) {
const Icon = typeToIcon$1[type];
iconNode = createVNode(Icon, {
"class": `${prefixCls}-icon ${prefixCls}-icon-${type}`
}, null);
}
return createVNode("div", {
"class": classNames({
[`${prefixCls}-with-icon`]: iconNode
}),
"role": "alert"
}, [iconNode, createVNode("div", {
"class": `${prefixCls}-message`
}, [message]), createVNode("div", {
"class": `${prefixCls}-description`
}, [description]), btn && createVNode("div", {
"class": `${prefixCls}-btn`
}, [btn])]);
}
defineComponent({
name: "PurePanel",
inheritAttrs: false,
props: ["prefixCls", "icon", "type", "message", "description", "btn", "closeIcon"],
setup(props2) {
const {
getPrefixCls
} = useConfigInject("notification", props2);
const prefixCls = computed(() => props2.prefixCls || getPrefixCls("notification"));
const noticePrefixCls = computed(() => `${prefixCls.value}-notice`);
const [, hashId] = useStyle$x(prefixCls);
return () => {
return createVNode(Notice, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls.value,
"class": classNames(hashId.value, `${noticePrefixCls.value}-pure-panel`),
"noticeKey": "pure",
"duration": null,
"closable": props2.closable,
"closeIcon": getCloseIcon(prefixCls.value, props2.closeIcon)
}), {
default: () => [createVNode(PureContent, {
"prefixCls": noticePrefixCls.value,
"icon": props2.icon,
"type": props2.type,
"message": props2.message,
"description": props2.description,
"btn": props2.btn
}, null)]
});
};
}
});
function getPlacementStyle(placement, top, bottom) {
let style;
top = typeof top === "number" ? `${top}px` : top;
bottom = typeof bottom === "number" ? `${bottom}px` : bottom;
switch (placement) {
case "top":
style = {
left: "50%",
transform: "translateX(-50%)",
right: "auto",
top,
bottom: "auto"
};
break;
case "topLeft":
style = {
left: 0,
top,
bottom: "auto"
};
break;
case "topRight":
style = {
right: 0,
top,
bottom: "auto"
};
break;
case "bottom":
style = {
left: "50%",
transform: "translateX(-50%)",
right: "auto",
top: "auto",
bottom
};
break;
case "bottomLeft":
style = {
left: 0,
top: "auto",
bottom
};
break;
default:
style = {
right: 0,
top: "auto",
bottom
};
break;
}
return style;
}
function getMotion(prefixCls) {
return {
name: `${prefixCls}-fade`
};
}
var __rest$N = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const DEFAULT_OFFSET = 24;
const DEFAULT_DURATION = 4.5;
const Holder = defineComponent({
name: "Holder",
inheritAttrs: false,
props: ["prefixCls", "class", "type", "icon", "content", "onAllRemoved"],
setup(props2, _ref) {
let {
expose
} = _ref;
const {
getPrefixCls,
getPopupContainer
} = useConfigInject("notification", props2);
const prefixCls = computed(() => props2.prefixCls || getPrefixCls("notification"));
const getStyles = (placement) => {
var _a, _b;
return getPlacementStyle(placement, (_a = props2.top) !== null && _a !== void 0 ? _a : DEFAULT_OFFSET, (_b = props2.bottom) !== null && _b !== void 0 ? _b : DEFAULT_OFFSET);
};
const [, hashId] = useStyle$x(prefixCls);
const getClassName = () => classNames(hashId.value, {
[`${prefixCls.value}-rtl`]: props2.rtl
});
const getNotificationMotion = () => getMotion(prefixCls.value);
const [api2, holder] = useNotification$1({
prefixCls: prefixCls.value,
getStyles,
getClassName,
motion: getNotificationMotion,
closable: true,
closeIcon: getCloseIcon(prefixCls.value),
duration: DEFAULT_DURATION,
getContainer: () => {
var _a, _b;
return ((_a = props2.getPopupContainer) === null || _a === void 0 ? void 0 : _a.call(props2)) || ((_b = getPopupContainer.value) === null || _b === void 0 ? void 0 : _b.call(getPopupContainer)) || (void 0).body;
},
maxCount: props2.maxCount,
hashId: hashId.value,
onAllRemoved: props2.onAllRemoved
});
expose(_extends(_extends({}, api2), {
prefixCls: prefixCls.value,
hashId
}));
return holder;
}
});
function useInternalNotification(notificationConfig) {
const holderRef = shallowRef(null);
const holderKey = Symbol("notificationHolderKey");
const open2 = (config) => {
if (!holderRef.value) {
return;
}
const {
open: originOpen,
prefixCls,
hashId
} = holderRef.value;
const noticePrefixCls = `${prefixCls}-notice`;
const {
message,
description,
icon,
type,
btn,
class: className
} = config, restConfig = __rest$N(config, ["message", "description", "icon", "type", "btn", "class"]);
return originOpen(_extends(_extends({
placement: "topRight"
}, restConfig), {
content: () => createVNode(PureContent, {
"prefixCls": noticePrefixCls,
"icon": typeof icon === "function" ? icon() : icon,
"type": type,
"message": typeof message === "function" ? message() : message,
"description": typeof description === "function" ? description() : description,
"btn": typeof btn === "function" ? btn() : btn
}, null),
// @ts-ignore
class: classNames(type && `${noticePrefixCls}-${type}`, hashId, className)
}));
};
const destroy = (key2) => {
var _a, _b;
if (key2 !== void 0) {
(_a = holderRef.value) === null || _a === void 0 ? void 0 : _a.close(key2);
} else {
(_b = holderRef.value) === null || _b === void 0 ? void 0 : _b.destroy();
}
};
const wrapAPI = {
open: open2,
destroy
};
const keys = ["success", "info", "warning", "error"];
keys.forEach((type) => {
wrapAPI[type] = (config) => open2(_extends(_extends({}, config), {
type
}));
});
return [wrapAPI, () => createVNode(Holder, _objectSpread$W(_objectSpread$W({
"key": holderKey
}, notificationConfig), {}, {
"ref": holderRef
}), null)];
}
function useNotification(notificationConfig) {
return useInternalNotification(notificationConfig);
}
const notificationInstance = {};
let defaultDuration = 4.5;
let defaultTop = "24px";
let defaultBottom = "24px";
let defaultPrefixCls$1 = "";
let defaultPlacement = "topRight";
let defaultGetContainer = () => (void 0).body;
let defaultCloseIcon = null;
let rtl = false;
let maxCount;
function setNotificationConfig(options) {
const {
duration,
placement,
bottom,
top,
getContainer: getContainer2,
closeIcon,
prefixCls
} = options;
if (prefixCls !== void 0) {
defaultPrefixCls$1 = prefixCls;
}
if (duration !== void 0) {
defaultDuration = duration;
}
if (placement !== void 0) {
defaultPlacement = placement;
}
if (bottom !== void 0) {
defaultBottom = typeof bottom === "number" ? `${bottom}px` : bottom;
}
if (top !== void 0) {
defaultTop = typeof top === "number" ? `${top}px` : top;
}
if (getContainer2 !== void 0) {
defaultGetContainer = getContainer2;
}
if (closeIcon !== void 0) {
defaultCloseIcon = closeIcon;
}
if (options.rtl !== void 0) {
rtl = options.rtl;
}
if (options.maxCount !== void 0) {
maxCount = options.maxCount;
}
}
function getNotificationInstance(_ref, callback) {
let {
prefixCls: customizePrefixCls,
placement = defaultPlacement,
getContainer: getContainer2 = defaultGetContainer,
top,
bottom,
closeIcon = defaultCloseIcon,
appContext
} = _ref;
const {
getPrefixCls
} = globalConfig();
const prefixCls = getPrefixCls("notification", customizePrefixCls || defaultPrefixCls$1);
const cacheKey = `${prefixCls}-${placement}-${rtl}`;
const cacheInstance = notificationInstance[cacheKey];
if (cacheInstance) {
Promise.resolve(cacheInstance).then((instance) => {
callback(instance);
});
return;
}
const notificationClass = classNames(`${prefixCls}-${placement}`, {
[`${prefixCls}-rtl`]: rtl === true
});
Notification$2.newInstance({
name: "notification",
prefixCls: customizePrefixCls || defaultPrefixCls$1,
useStyle: useStyle$x,
class: notificationClass,
style: getPlacementStyle(placement, top !== null && top !== void 0 ? top : defaultTop, bottom !== null && bottom !== void 0 ? bottom : defaultBottom),
appContext,
getContainer: getContainer2,
closeIcon: (_ref2) => {
let {
prefixCls: prefixCls2
} = _ref2;
const closeIconToRender = createVNode("span", {
"class": `${prefixCls2}-close-x`
}, [renderHelper(closeIcon, {}, createVNode(CloseOutlined, {
"class": `${prefixCls2}-close-icon`
}, null))]);
return closeIconToRender;
},
maxCount,
hasTransitionName: true
}, (notification) => {
notificationInstance[cacheKey] = notification;
callback(notification);
});
}
const typeToIcon = {
success: CheckCircleOutlined,
info: InfoCircleOutlined,
error: CloseCircleOutlined,
warning: ExclamationCircleOutlined
};
function notice(args) {
const {
icon,
type,
description,
message,
btn
} = args;
const duration = args.duration === void 0 ? defaultDuration : args.duration;
getNotificationInstance(args, (notification) => {
notification.notice({
content: (_ref3) => {
let {
prefixCls: outerPrefixCls
} = _ref3;
const prefixCls = `${outerPrefixCls}-notice`;
let iconNode = null;
if (icon) {
iconNode = () => createVNode("span", {
"class": `${prefixCls}-icon`
}, [renderHelper(icon)]);
} else if (type) {
const Icon = typeToIcon[type];
iconNode = () => createVNode(Icon, {
"class": `${prefixCls}-icon ${prefixCls}-icon-${type}`
}, null);
}
return createVNode("div", {
"class": iconNode ? `${prefixCls}-with-icon` : ""
}, [iconNode && iconNode(), createVNode("div", {
"class": `${prefixCls}-message`
}, [!description && iconNode ? createVNode("span", {
"class": `${prefixCls}-message-single-line-auto-margin`
}, null) : null, renderHelper(message)]), createVNode("div", {
"class": `${prefixCls}-description`
}, [renderHelper(description)]), btn ? createVNode("span", {
"class": `${prefixCls}-btn`
}, [renderHelper(btn)]) : null]);
},
duration,
closable: true,
onClose: args.onClose,
onClick: args.onClick,
key: args.key,
style: args.style || {},
class: args.class
});
});
}
const api = {
open: notice,
close(key2) {
Object.keys(notificationInstance).forEach((cacheKey) => Promise.resolve(notificationInstance[cacheKey]).then((instance) => {
instance.removeNotice(key2);
}));
},
config: setNotificationConfig,
destroy() {
Object.keys(notificationInstance).forEach((cacheKey) => {
Promise.resolve(notificationInstance[cacheKey]).then((instance) => {
instance.destroy();
});
delete notificationInstance[cacheKey];
});
}
};
const iconTypes = ["success", "info", "warning", "error"];
iconTypes.forEach((type) => {
api[type] = (args) => api.open(_extends(_extends({}, args), {
type
}));
});
api.warn = api.warning;
api.useNotification = useNotification;
function getStyle$1(globalPrefixCls, theme) {
const variables = {};
const formatColor = (color, updater) => {
let clone = color.clone();
clone = (updater === null || updater === void 0 ? void 0 : updater(clone)) || clone;
return clone.toRgbString();
};
const fillColor = (colorVal, type) => {
const baseColor = new TinyColor(colorVal);
const colorPalettes = generate$1(baseColor.toRgbString());
variables[`${type}-color`] = formatColor(baseColor);
variables[`${type}-color-disabled`] = colorPalettes[1];
variables[`${type}-color-hover`] = colorPalettes[4];
variables[`${type}-color-active`] = colorPalettes[6];
variables[`${type}-color-outline`] = baseColor.clone().setAlpha(0.2).toRgbString();
variables[`${type}-color-deprecated-bg`] = colorPalettes[0];
variables[`${type}-color-deprecated-border`] = colorPalettes[2];
};
if (theme.primaryColor) {
fillColor(theme.primaryColor, "primary");
const primaryColor = new TinyColor(theme.primaryColor);
const primaryColors = generate$1(primaryColor.toRgbString());
primaryColors.forEach((color, index2) => {
variables[`primary-${index2 + 1}`] = color;
});
variables["primary-color-deprecated-l-35"] = formatColor(primaryColor, (c) => c.lighten(35));
variables["primary-color-deprecated-l-20"] = formatColor(primaryColor, (c) => c.lighten(20));
variables["primary-color-deprecated-t-20"] = formatColor(primaryColor, (c) => c.tint(20));
variables["primary-color-deprecated-t-50"] = formatColor(primaryColor, (c) => c.tint(50));
variables["primary-color-deprecated-f-12"] = formatColor(primaryColor, (c) => c.setAlpha(c.getAlpha() * 0.12));
const primaryActiveColor = new TinyColor(primaryColors[0]);
variables["primary-color-active-deprecated-f-30"] = formatColor(primaryActiveColor, (c) => c.setAlpha(c.getAlpha() * 0.3));
variables["primary-color-active-deprecated-d-02"] = formatColor(primaryActiveColor, (c) => c.darken(2));
}
if (theme.successColor) {
fillColor(theme.successColor, "success");
}
if (theme.warningColor) {
fillColor(theme.warningColor, "warning");
}
if (theme.errorColor) {
fillColor(theme.errorColor, "error");
}
if (theme.infoColor) {
fillColor(theme.infoColor, "info");
}
const cssList = Object.keys(variables).map((key2) => `--${globalPrefixCls}-${key2}: ${variables[key2]};`);
return `
:root {
${cssList.join("\n")}
}
`.trim();
}
function registerTheme(globalPrefixCls, theme) {
getStyle$1(globalPrefixCls, theme);
}
const useStyle$w = (iconPrefixCls) => {
const [theme, token] = useToken();
return useStyleRegister(computed(() => ({
theme: theme.value,
token: token.value,
hashId: "",
path: ["ant-design-icons", iconPrefixCls.value]
})), () => [{
[`.${iconPrefixCls.value}`]: _extends(_extends({}, resetIcon()), {
[`.${iconPrefixCls.value} .${iconPrefixCls.value}-icon`]: {
display: "block"
}
})
}]);
};
function useTheme(theme, parentTheme) {
const themeConfig = computed(() => (theme === null || theme === void 0 ? void 0 : theme.value) || {});
const parentThemeConfig = computed(() => themeConfig.value.inherit === false || !(parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.value) ? defaultConfig : parentTheme.value);
const mergedTheme = computed(() => {
if (!(theme === null || theme === void 0 ? void 0 : theme.value)) {
return parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.value;
}
const mergedComponents = _extends({}, parentThemeConfig.value.components);
Object.keys(theme.value.components || {}).forEach((componentName) => {
mergedComponents[componentName] = _extends(_extends({}, mergedComponents[componentName]), theme.value.components[componentName]);
});
return _extends(_extends(_extends({}, parentThemeConfig.value), themeConfig.value), {
token: _extends(_extends({}, parentThemeConfig.value.token), themeConfig.value.token),
components: mergedComponents
});
});
return mergedTheme;
}
var __rest$M = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const defaultPrefixCls = "ant";
function getGlobalPrefixCls() {
return globalConfigForApi.prefixCls || defaultPrefixCls;
}
function getGlobalIconPrefixCls() {
return globalConfigForApi.iconPrefixCls || defaultIconPrefixCls;
}
const globalConfigBySet = reactive({});
const globalConfigForApi = reactive({});
watchEffect(() => {
_extends(globalConfigForApi, globalConfigBySet);
globalConfigForApi.prefixCls = getGlobalPrefixCls();
globalConfigForApi.iconPrefixCls = getGlobalIconPrefixCls();
globalConfigForApi.getPrefixCls = (suffixCls, customizePrefixCls) => {
if (customizePrefixCls) return customizePrefixCls;
return suffixCls ? `${globalConfigForApi.prefixCls}-${suffixCls}` : globalConfigForApi.prefixCls;
};
globalConfigForApi.getRootPrefixCls = () => {
if (globalConfigForApi.prefixCls) {
return globalConfigForApi.prefixCls;
}
return getGlobalPrefixCls();
};
});
let stopWatchEffect;
const setGlobalConfig = (params) => {
if (stopWatchEffect) {
stopWatchEffect();
}
stopWatchEffect = watchEffect(() => {
_extends(globalConfigBySet, reactive(params));
_extends(globalConfigForApi, reactive(params));
});
if (params.theme) {
registerTheme(getGlobalPrefixCls(), params.theme);
}
};
const globalConfig = () => ({
getPrefixCls: (suffixCls, customizePrefixCls) => {
if (customizePrefixCls) return customizePrefixCls;
return suffixCls ? `${getGlobalPrefixCls()}-${suffixCls}` : getGlobalPrefixCls();
},
getIconPrefixCls: getGlobalIconPrefixCls,
getRootPrefixCls: () => {
if (globalConfigForApi.prefixCls) {
return globalConfigForApi.prefixCls;
}
return getGlobalPrefixCls();
}
});
const ConfigProvider = defineComponent({
compatConfig: {
MODE: 3
},
name: "AConfigProvider",
inheritAttrs: false,
props: configProviderProps(),
setup(props2, _ref) {
let {
slots
} = _ref;
const parentContext = useConfigContextInject();
const getPrefixCls = (suffixCls, customizePrefixCls) => {
const {
prefixCls = "ant"
} = props2;
if (customizePrefixCls) return customizePrefixCls;
const mergedPrefixCls = prefixCls || parentContext.getPrefixCls("");
return suffixCls ? `${mergedPrefixCls}-${suffixCls}` : mergedPrefixCls;
};
const iconPrefixCls = computed(() => props2.iconPrefixCls || parentContext.iconPrefixCls.value || defaultIconPrefixCls);
const shouldWrapSSR = computed(() => iconPrefixCls.value !== parentContext.iconPrefixCls.value);
const csp = computed(() => {
var _a;
return props2.csp || ((_a = parentContext.csp) === null || _a === void 0 ? void 0 : _a.value);
});
const wrapSSR = useStyle$w(iconPrefixCls);
const mergedTheme = useTheme(computed(() => props2.theme), computed(() => {
var _a;
return (_a = parentContext.theme) === null || _a === void 0 ? void 0 : _a.value;
}));
const renderEmptyComponent = (name) => {
const renderEmpty$1 = props2.renderEmpty || slots.renderEmpty || parentContext.renderEmpty || renderEmpty;
return renderEmpty$1(name);
};
const autoInsertSpaceInButton = computed(() => {
var _a, _b;
return (_a = props2.autoInsertSpaceInButton) !== null && _a !== void 0 ? _a : (_b = parentContext.autoInsertSpaceInButton) === null || _b === void 0 ? void 0 : _b.value;
});
const locale$12 = computed(() => {
var _a;
return props2.locale || ((_a = parentContext.locale) === null || _a === void 0 ? void 0 : _a.value);
});
watch(locale$12, () => {
globalConfigBySet.locale = locale$12.value;
}, {
immediate: true
});
const direction = computed(() => {
var _a;
return props2.direction || ((_a = parentContext.direction) === null || _a === void 0 ? void 0 : _a.value);
});
const space = computed(() => {
var _a, _b;
return (_a = props2.space) !== null && _a !== void 0 ? _a : (_b = parentContext.space) === null || _b === void 0 ? void 0 : _b.value;
});
const virtual = computed(() => {
var _a, _b;
return (_a = props2.virtual) !== null && _a !== void 0 ? _a : (_b = parentContext.virtual) === null || _b === void 0 ? void 0 : _b.value;
});
const dropdownMatchSelectWidth = computed(() => {
var _a, _b;
return (_a = props2.dropdownMatchSelectWidth) !== null && _a !== void 0 ? _a : (_b = parentContext.dropdownMatchSelectWidth) === null || _b === void 0 ? void 0 : _b.value;
});
const getTargetContainer = computed(() => {
var _a;
return props2.getTargetContainer !== void 0 ? props2.getTargetContainer : (_a = parentContext.getTargetContainer) === null || _a === void 0 ? void 0 : _a.value;
});
const getPopupContainer = computed(() => {
var _a;
return props2.getPopupContainer !== void 0 ? props2.getPopupContainer : (_a = parentContext.getPopupContainer) === null || _a === void 0 ? void 0 : _a.value;
});
const pageHeader = computed(() => {
var _a;
return props2.pageHeader !== void 0 ? props2.pageHeader : (_a = parentContext.pageHeader) === null || _a === void 0 ? void 0 : _a.value;
});
const input = computed(() => {
var _a;
return props2.input !== void 0 ? props2.input : (_a = parentContext.input) === null || _a === void 0 ? void 0 : _a.value;
});
const pagination = computed(() => {
var _a;
return props2.pagination !== void 0 ? props2.pagination : (_a = parentContext.pagination) === null || _a === void 0 ? void 0 : _a.value;
});
const form = computed(() => {
var _a;
return props2.form !== void 0 ? props2.form : (_a = parentContext.form) === null || _a === void 0 ? void 0 : _a.value;
});
const select = computed(() => {
var _a;
return props2.select !== void 0 ? props2.select : (_a = parentContext.select) === null || _a === void 0 ? void 0 : _a.value;
});
const componentSize = computed(() => props2.componentSize);
const componentDisabled = computed(() => props2.componentDisabled);
const wave = computed(() => {
var _a, _b;
return (_a = props2.wave) !== null && _a !== void 0 ? _a : (_b = parentContext.wave) === null || _b === void 0 ? void 0 : _b.value;
});
const configProvider = {
csp,
autoInsertSpaceInButton,
locale: locale$12,
direction,
space,
virtual,
dropdownMatchSelectWidth,
getPrefixCls,
iconPrefixCls,
theme: computed(() => {
var _a, _b;
return (_a = mergedTheme.value) !== null && _a !== void 0 ? _a : (_b = parentContext.theme) === null || _b === void 0 ? void 0 : _b.value;
}),
renderEmpty: renderEmptyComponent,
getTargetContainer,
getPopupContainer,
pageHeader,
input,
pagination,
form,
select,
componentSize,
componentDisabled,
transformCellText: computed(() => props2.transformCellText),
wave
};
const memoTheme = computed(() => {
const _a = mergedTheme.value || {}, {
algorithm,
token
} = _a, rest = __rest$M(_a, ["algorithm", "token"]);
const themeObj = algorithm && (!Array.isArray(algorithm) || algorithm.length > 0) ? createTheme(algorithm) : void 0;
return _extends(_extends({}, rest), {
theme: themeObj,
token: _extends(_extends({}, seedToken), token)
});
});
const validateMessagesRef = computed(() => {
var _a, _b;
let validateMessages = {};
if (locale$12.value) {
validateMessages = ((_a = locale$12.value.Form) === null || _a === void 0 ? void 0 : _a.defaultValidateMessages) || ((_b = localeValues.Form) === null || _b === void 0 ? void 0 : _b.defaultValidateMessages) || {};
}
if (props2.form && props2.form.validateMessages) {
validateMessages = _extends(_extends({}, validateMessages), props2.form.validateMessages);
}
return validateMessages;
});
useConfigContextProvider(configProvider);
useProvideGlobalForm({
validateMessages: validateMessagesRef
});
useProviderSize(componentSize);
useProviderDisabled(componentDisabled);
const renderProvider = (legacyLocale) => {
var _a, _b;
let childNode = shouldWrapSSR.value ? wrapSSR((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) : (_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots);
if (props2.theme) {
const _childNode = /* @__PURE__ */ (function() {
return childNode;
})();
childNode = createVNode(DesignTokenProvider, {
"value": memoTheme.value
}, {
default: () => [_childNode]
});
}
return createVNode(locale, {
"locale": locale$12.value || legacyLocale,
"ANT_MARK__": ANT_MARK
}, {
default: () => [childNode]
});
};
watchEffect(() => {
if (direction.value) {
api$1.config({
rtl: direction.value === "rtl"
});
api.config({
rtl: direction.value === "rtl"
});
}
});
return () => createVNode(LocaleReceiver, {
"children": (_, __, legacyLocale) => renderProvider(legacyLocale)
}, null);
}
});
ConfigProvider.config = setGlobalConfig;
ConfigProvider.install = function(app) {
app.component(ConfigProvider.name, ConfigProvider);
};
const PickerButton = (props2, _ref) => {
let {
attrs,
slots
} = _ref;
return createVNode(Button, _objectSpread$W(_objectSpread$W({
"size": "small",
"type": "primary"
}, props2), attrs), slots);
};
const genTagStatusStyle = (token, status, cssVariableType) => {
const capitalizedCssVariableType = capitalize(cssVariableType);
return {
[`${token.componentCls}-${status}`]: {
color: token[`color${cssVariableType}`],
background: token[`color${capitalizedCssVariableType}Bg`],
borderColor: token[`color${capitalizedCssVariableType}Border`],
[`&${token.componentCls}-borderless`]: {
borderColor: "transparent"
}
}
};
};
const genPresetStyle = (token) => genPresetColor(token, (colorKey, _ref) => {
let {
textColor,
lightBorderColor,
lightColor,
darkColor
} = _ref;
return {
[`${token.componentCls}-${colorKey}`]: {
color: textColor,
background: lightColor,
borderColor: lightBorderColor,
// Inverse color
"&-inverse": {
color: token.colorTextLightSolid,
background: darkColor,
borderColor: darkColor
},
[`&${token.componentCls}-borderless`]: {
borderColor: "transparent"
}
}
};
});
const genBaseStyle$a = (token) => {
const {
paddingXXS,
lineWidth,
tagPaddingHorizontal,
componentCls
} = token;
const paddingInline = tagPaddingHorizontal - lineWidth;
const iconMarginInline = paddingXXS - lineWidth;
return {
// Result
[componentCls]: _extends(_extends({}, resetComponent(token)), {
display: "inline-block",
height: "auto",
marginInlineEnd: token.marginXS,
paddingInline,
fontSize: token.tagFontSize,
lineHeight: `${token.tagLineHeight}px`,
whiteSpace: "nowrap",
background: token.tagDefaultBg,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusSM,
opacity: 1,
transition: `all ${token.motionDurationMid}`,
textAlign: "start",
// RTL
[`&${componentCls}-rtl`]: {
direction: "rtl"
},
"&, a, a:hover": {
color: token.tagDefaultColor
},
[`${componentCls}-close-icon`]: {
marginInlineStart: iconMarginInline,
color: token.colorTextDescription,
fontSize: token.tagIconSize,
cursor: "pointer",
transition: `all ${token.motionDurationMid}`,
"&:hover": {
color: token.colorTextHeading
}
},
[`&${componentCls}-has-color`]: {
borderColor: "transparent",
[`&, a, a:hover, ${token.iconCls}-close, ${token.iconCls}-close:hover`]: {
color: token.colorTextLightSolid
}
},
[`&-checkable`]: {
backgroundColor: "transparent",
borderColor: "transparent",
cursor: "pointer",
[`&:not(${componentCls}-checkable-checked):hover`]: {
color: token.colorPrimary,
backgroundColor: token.colorFillSecondary
},
"&:active, &-checked": {
color: token.colorTextLightSolid
},
"&-checked": {
backgroundColor: token.colorPrimary,
"&:hover": {
backgroundColor: token.colorPrimaryHover
}
},
"&:active": {
backgroundColor: token.colorPrimaryActive
}
},
[`&-hidden`]: {
display: "none"
},
// To ensure that a space will be placed between character and `Icon`.
[`> ${token.iconCls} + span, > span + ${token.iconCls}`]: {
marginInlineStart: paddingInline
}
}),
[`${componentCls}-borderless`]: {
borderColor: "transparent",
background: token.tagBorderlessBg
}
};
};
const useStyle$v = genComponentStyleHook("Tag", (token) => {
const {
fontSize,
lineHeight,
lineWidth,
fontSizeIcon
} = token;
const tagHeight = Math.round(fontSize * lineHeight);
const tagFontSize = token.fontSizeSM;
const tagLineHeight = tagHeight - lineWidth * 2;
const tagDefaultBg = token.colorFillAlter;
const tagDefaultColor = token.colorText;
const tagToken = merge(token, {
tagFontSize,
tagLineHeight,
tagDefaultBg,
tagDefaultColor,
tagIconSize: fontSizeIcon - 2 * lineWidth,
tagPaddingHorizontal: 8,
tagBorderlessBg: token.colorFillTertiary
});
return [genBaseStyle$a(tagToken), genPresetStyle(tagToken), genTagStatusStyle(tagToken, "success", "Success"), genTagStatusStyle(tagToken, "processing", "Info"), genTagStatusStyle(tagToken, "error", "Error"), genTagStatusStyle(tagToken, "warning", "Warning")];
});
const checkableTagProps = () => ({
prefixCls: String,
checked: {
type: Boolean,
default: void 0
},
onChange: {
type: Function
},
onClick: {
type: Function
},
"onUpdate:checked": Function
});
const CheckableTag = defineComponent({
compatConfig: {
MODE: 3
},
name: "ACheckableTag",
inheritAttrs: false,
props: checkableTagProps(),
// emits: ['update:checked', 'change', 'click'],
setup(props2, _ref) {
let {
slots,
emit,
attrs
} = _ref;
const {
prefixCls
} = useConfigInject("tag", props2);
const [wrapSSR, hashId] = useStyle$v(prefixCls);
const handleClick = (e) => {
const {
checked
} = props2;
emit("update:checked", !checked);
emit("change", !checked);
emit("click", e);
};
const cls = computed(() => classNames(prefixCls.value, hashId.value, {
[`${prefixCls.value}-checkable`]: true,
[`${prefixCls.value}-checkable-checked`]: props2.checked
}));
return () => {
var _a;
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [cls.value, attrs.class],
"onClick": handleClick
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]));
};
}
});
const tagProps = () => ({
prefixCls: String,
color: {
type: String
},
closable: {
type: Boolean,
default: false
},
closeIcon: PropTypes.any,
/** @deprecated `visible` will be removed in next major version. */
visible: {
type: Boolean,
default: void 0
},
onClose: {
type: Function
},
onClick: eventType(),
"onUpdate:visible": Function,
icon: PropTypes.any,
bordered: {
type: Boolean,
default: true
}
});
const Tag = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATag",
inheritAttrs: false,
props: tagProps(),
// emits: ['update:visible', 'close'],
slots: Object,
setup(props2, _ref) {
let {
slots,
emit,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("tag", props2);
const [wrapSSR, hashId] = useStyle$v(prefixCls);
const visible = shallowRef(true);
watchEffect(() => {
if (props2.visible !== void 0) {
visible.value = props2.visible;
}
});
const handleCloseClick = (e) => {
e.stopPropagation();
emit("update:visible", false);
emit("close", e);
if (e.defaultPrevented) {
return;
}
if (props2.visible === void 0) {
visible.value = false;
}
};
const isInternalColor = computed(() => isPresetColor(props2.color) || isPresetStatusColor(props2.color));
const tagClassName = computed(() => classNames(prefixCls.value, hashId.value, {
[`${prefixCls.value}-${props2.color}`]: isInternalColor.value,
[`${prefixCls.value}-has-color`]: props2.color && !isInternalColor.value,
[`${prefixCls.value}-hidden`]: !visible.value,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-borderless`]: !props2.bordered
}));
const handleClick = (e) => {
emit("click", e);
};
return () => {
var _a, _b, _c;
const {
icon = (_a = slots.icon) === null || _a === void 0 ? void 0 : _a.call(slots),
color,
closeIcon = (_b = slots.closeIcon) === null || _b === void 0 ? void 0 : _b.call(slots),
closable = false
} = props2;
const renderCloseIcon = () => {
if (closable) {
return closeIcon ? createVNode("span", {
"class": `${prefixCls.value}-close-icon`,
"onClick": handleCloseClick
}, [closeIcon]) : createVNode(CloseOutlined, {
"class": `${prefixCls.value}-close-icon`,
"onClick": handleCloseClick
}, null);
}
return null;
};
const tagStyle = {
backgroundColor: color && !isInternalColor.value ? color : void 0
};
const iconNode = icon || null;
const children = (_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots);
const kids = iconNode ? createVNode(Fragment, null, [iconNode, createVNode("span", null, [children])]) : children;
const isNeedWave = props2.onClick !== void 0;
const tagNode = createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"onClick": handleClick,
"class": [tagClassName.value, attrs.class],
"style": [tagStyle, attrs.style]
}), [kids, renderCloseIcon()]);
return wrapSSR(isNeedWave ? createVNode(Wave, null, {
default: () => [tagNode]
}) : tagNode);
};
}
});
Tag.CheckableTag = CheckableTag;
Tag.install = function(app) {
app.component(Tag.name, Tag);
app.component(CheckableTag.name, CheckableTag);
return app;
};
function PickerTag(props2, _ref) {
let {
slots,
attrs
} = _ref;
return createVNode(Tag, _objectSpread$W(_objectSpread$W({
"color": "blue"
}, props2), attrs), slots);
}
function getPlaceholder(locale2, picker, customizePlaceholder) {
if (customizePlaceholder !== void 0) {
return customizePlaceholder;
}
if (picker === "year" && locale2.lang.yearPlaceholder) {
return locale2.lang.yearPlaceholder;
}
if (picker === "quarter" && locale2.lang.quarterPlaceholder) {
return locale2.lang.quarterPlaceholder;
}
if (picker === "month" && locale2.lang.monthPlaceholder) {
return locale2.lang.monthPlaceholder;
}
if (picker === "week" && locale2.lang.weekPlaceholder) {
return locale2.lang.weekPlaceholder;
}
if (picker === "time" && locale2.timePickerLocale.placeholder) {
return locale2.timePickerLocale.placeholder;
}
return locale2.lang.placeholder;
}
function getRangePlaceholder(locale2, picker, customizePlaceholder) {
if (customizePlaceholder !== void 0) {
return customizePlaceholder;
}
if (picker === "year" && locale2.lang.yearPlaceholder) {
return locale2.lang.rangeYearPlaceholder;
}
if (picker === "month" && locale2.lang.monthPlaceholder) {
return locale2.lang.rangeMonthPlaceholder;
}
if (picker === "week" && locale2.lang.weekPlaceholder) {
return locale2.lang.rangeWeekPlaceholder;
}
if (picker === "time" && locale2.timePickerLocale.placeholder) {
return locale2.timePickerLocale.rangePlaceholder;
}
return locale2.lang.rangePlaceholder;
}
function transPlacement2DropdownAlign(direction, placement) {
const overflow = {
adjustX: 1,
adjustY: 1
};
switch (placement) {
case "bottomLeft": {
return {
points: ["tl", "bl"],
offset: [0, 4],
overflow
};
}
case "bottomRight": {
return {
points: ["tr", "br"],
offset: [0, 4],
overflow
};
}
case "topLeft": {
return {
points: ["bl", "tl"],
offset: [0, -4],
overflow
};
}
case "topRight": {
return {
points: ["br", "tr"],
offset: [0, -4],
overflow
};
}
default: {
return {
points: direction === "rtl" ? ["tr", "br"] : ["tl", "bl"],
offset: [0, 4],
overflow
};
}
}
}
function commonProps() {
return {
id: String,
/**
* @deprecated `dropdownClassName` is deprecated which will be removed in next major
* version.Please use `popupClassName` instead.
*/
dropdownClassName: String,
popupClassName: String,
popupStyle: objectType(),
transitionName: String,
placeholder: String,
allowClear: booleanType(),
autofocus: booleanType(),
disabled: booleanType(),
tabindex: Number,
open: booleanType(),
defaultOpen: booleanType(),
/** Make input readOnly to avoid popup keyboard in mobile */
inputReadOnly: booleanType(),
format: someType([String, Function, Array]),
// Value
// format: string | CustomFormat | (string | CustomFormat)[];
// Render
// suffixIcon?: VueNode;
// clearIcon?: VueNode;
// prevIcon?: VueNode;
// nextIcon?: VueNode;
// superPrevIcon?: VueNode;
// superNextIcon?: VueNode;
getPopupContainer: functionType(),
panelRender: functionType(),
// // Events
onChange: functionType(),
"onUpdate:value": functionType(),
onOk: functionType(),
onOpenChange: functionType(),
"onUpdate:open": functionType(),
onFocus: functionType(),
onBlur: functionType(),
onMousedown: functionType(),
onMouseup: functionType(),
onMouseenter: functionType(),
onMouseleave: functionType(),
onClick: functionType(),
onContextmenu: functionType(),
onKeydown: functionType(),
// WAI-ARIA
role: String,
name: String,
autocomplete: String,
direction: stringType(),
showToday: booleanType(),
showTime: someType([Boolean, Object]),
locale: objectType(),
size: stringType(),
bordered: booleanType(),
dateRender: functionType(),
disabledDate: functionType(),
mode: stringType(),
picker: stringType(),
valueFormat: String,
placement: stringType(),
status: stringType(),
/** @deprecated Please use `disabledTime` instead. */
disabledHours: functionType(),
/** @deprecated Please use `disabledTime` instead. */
disabledMinutes: functionType(),
/** @deprecated Please use `disabledTime` instead. */
disabledSeconds: functionType()
};
}
function datePickerProps() {
return {
defaultPickerValue: someType([Object, String]),
defaultValue: someType([Object, String]),
value: someType([Object, String]),
presets: arrayType(),
disabledTime: functionType(),
renderExtraFooter: functionType(),
showNow: booleanType(),
monthCellRender: functionType(),
// deprecated Please use `monthCellRender"` instead.',
monthCellContentRender: functionType()
};
}
function rangePickerProps() {
return {
allowEmpty: arrayType(),
dateRender: functionType(),
defaultPickerValue: arrayType(),
defaultValue: arrayType(),
value: arrayType(),
presets: arrayType(),
disabledTime: functionType(),
disabled: someType([Boolean, Array]),
renderExtraFooter: functionType(),
separator: {
type: String
},
showTime: someType([Boolean, Object]),
ranges: objectType(),
placeholder: arrayType(),
mode: arrayType(),
onChange: functionType(),
"onUpdate:value": functionType(),
onCalendarChange: functionType(),
onPanelChange: functionType(),
onOk: functionType()
};
}
var __rest$L = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function generateSinglePicker(generateConfig2, extraProps) {
function getPicker(picker, displayName) {
const comProps = _extends(_extends(_extends({}, commonProps()), datePickerProps()), extraProps);
return defineComponent({
compatConfig: {
MODE: 3
},
name: displayName,
inheritAttrs: false,
props: comProps,
slots: Object,
setup(_props, _ref) {
let {
slots,
expose,
attrs,
emit
} = _ref;
const props2 = _props;
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const {
prefixCls,
direction,
getPopupContainer,
size,
rootPrefixCls,
disabled
} = useConfigInject("picker", props2);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => compactSize.value || size.value);
const [wrapSSR, hashId] = useStyle$J(prefixCls);
const pickerRef = ref();
expose({
focus: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.blur();
}
});
const maybeToString = (date) => {
return props2.valueFormat ? generateConfig2.toString(date, props2.valueFormat) : date;
};
const onChange = (date, dateString) => {
const value2 = maybeToString(date);
emit("update:value", value2);
emit("change", value2, dateString);
formItemContext.onFieldChange();
};
const onOpenChange = (open2) => {
emit("update:open", open2);
emit("openChange", open2);
};
const onFocus = (e) => {
emit("focus", e);
};
const onBlur = (e) => {
emit("blur", e);
formItemContext.onFieldBlur();
};
const onPanelChange = (date, mode) => {
const value2 = maybeToString(date);
emit("panelChange", value2, mode);
};
const onOk = (date) => {
const value2 = maybeToString(date);
emit("ok", value2);
};
const [contextLocale] = useLocaleReceiver("DatePicker", locale$1);
const value = computed(() => {
if (props2.value) {
return props2.valueFormat ? generateConfig2.toDate(props2.value, props2.valueFormat) : props2.value;
}
return props2.value === "" ? void 0 : props2.value;
});
const defaultValue = computed(() => {
if (props2.defaultValue) {
return props2.valueFormat ? generateConfig2.toDate(props2.defaultValue, props2.valueFormat) : props2.defaultValue;
}
return props2.defaultValue === "" ? void 0 : props2.defaultValue;
});
const defaultPickerValue = computed(() => {
if (props2.defaultPickerValue) {
return props2.valueFormat ? generateConfig2.toDate(props2.defaultPickerValue, props2.valueFormat) : props2.defaultPickerValue;
}
return props2.defaultPickerValue === "" ? void 0 : props2.defaultPickerValue;
});
return () => {
var _a, _b, _c, _d, _e, _f;
const locale2 = _extends(_extends({}, contextLocale.value), props2.locale);
const p = _extends(_extends({}, props2), attrs);
const {
bordered = true,
placeholder,
suffixIcon = (_a = slots.suffixIcon) === null || _a === void 0 ? void 0 : _a.call(slots),
showToday = true,
transitionName: transitionName2,
allowClear = true,
dateRender = slots.dateRender,
renderExtraFooter = slots.renderExtraFooter,
monthCellRender = slots.monthCellRender || props2.monthCellContentRender || slots.monthCellContentRender,
clearIcon = (_b = slots.clearIcon) === null || _b === void 0 ? void 0 : _b.call(slots),
id = formItemContext.id.value
} = p, restProps = __rest$L(p, ["bordered", "placeholder", "suffixIcon", "showToday", "transitionName", "allowClear", "dateRender", "renderExtraFooter", "monthCellRender", "clearIcon", "id"]);
const showTime = p.showTime === "" ? true : p.showTime;
const {
format: format2
} = p;
let additionalOverrideProps = {};
if (picker) {
additionalOverrideProps.picker = picker;
}
const mergedPicker = picker || p.picker || "date";
additionalOverrideProps = _extends(_extends(_extends({}, additionalOverrideProps), showTime ? getTimeProps(_extends({
format: format2,
picker: mergedPicker
}, typeof showTime === "object" ? showTime : {})) : {}), mergedPicker === "time" ? getTimeProps(_extends(_extends({
format: format2
}, restProps), {
picker: mergedPicker
})) : {});
const pre = prefixCls.value;
const suffixNode = createVNode(Fragment, null, [suffixIcon || (picker === "time" ? createVNode(ClockCircleOutlined, null, null) : createVNode(CalendarOutlined, null, null)), formItemInputContext.hasFeedback && formItemInputContext.feedbackIcon]);
return wrapSSR(createVNode(Picker$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"monthCellRender": monthCellRender,
"dateRender": dateRender,
"renderExtraFooter": renderExtraFooter,
"ref": pickerRef,
"placeholder": getPlaceholder(locale2, mergedPicker, placeholder),
"suffixIcon": suffixNode,
"dropdownAlign": transPlacement2DropdownAlign(direction.value, props2.placement),
"clearIcon": clearIcon || createVNode(CloseCircleFilled, null, null),
"allowClear": allowClear,
"transitionName": transitionName2 || `${rootPrefixCls.value}-slide-up`
}, restProps), additionalOverrideProps), {}, {
"id": id,
"picker": mergedPicker,
"value": value.value,
"defaultValue": defaultValue.value,
"defaultPickerValue": defaultPickerValue.value,
"showToday": showToday,
"locale": locale2.lang,
"class": classNames({
[`${pre}-${mergedSize.value}`]: mergedSize.value,
[`${pre}-borderless`]: !bordered
}, getStatusClassNames(pre, getMergedStatus(formItemInputContext.status, props2.status), formItemInputContext.hasFeedback), attrs.class, hashId.value, compactItemClassnames.value),
"disabled": disabled.value,
"prefixCls": pre,
"getPopupContainer": attrs.getCalendarContainer || getPopupContainer.value,
"generateConfig": generateConfig2,
"prevIcon": ((_c = slots.prevIcon) === null || _c === void 0 ? void 0 : _c.call(slots)) || createVNode("span", {
"class": `${pre}-prev-icon`
}, null),
"nextIcon": ((_d = slots.nextIcon) === null || _d === void 0 ? void 0 : _d.call(slots)) || createVNode("span", {
"class": `${pre}-next-icon`
}, null),
"superPrevIcon": ((_e = slots.superPrevIcon) === null || _e === void 0 ? void 0 : _e.call(slots)) || createVNode("span", {
"class": `${pre}-super-prev-icon`
}, null),
"superNextIcon": ((_f = slots.superNextIcon) === null || _f === void 0 ? void 0 : _f.call(slots)) || createVNode("span", {
"class": `${pre}-super-next-icon`
}, null),
"components": Components,
"direction": direction.value,
"dropdownClassName": classNames(hashId.value, props2.popupClassName, props2.dropdownClassName),
"onChange": onChange,
"onOpenChange": onOpenChange,
"onFocus": onFocus,
"onBlur": onBlur,
"onPanelChange": onPanelChange,
"onOk": onOk
}), null));
};
}
});
}
const DatePicker2 = getPicker(void 0, "ADatePicker");
const WeekPicker2 = getPicker("week", "AWeekPicker");
const MonthPicker2 = getPicker("month", "AMonthPicker");
const YearPicker2 = getPicker("year", "AYearPicker");
const TimePicker2 = getPicker("time", "TimePicker");
const QuarterPicker2 = getPicker("quarter", "AQuarterPicker");
return {
DatePicker: DatePicker2,
WeekPicker: WeekPicker2,
MonthPicker: MonthPicker2,
YearPicker: YearPicker2,
TimePicker: TimePicker2,
QuarterPicker: QuarterPicker2
};
}
var __rest$K = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function generateRangePicker(generateConfig2, extraProps) {
const RangePicker2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARangePicker",
inheritAttrs: false,
props: _extends(_extends(_extends({}, commonProps()), rangePickerProps()), extraProps),
slots: Object,
setup(_props, _ref) {
let {
expose,
slots,
attrs,
emit
} = _ref;
const props2 = _props;
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const {
prefixCls,
direction,
getPopupContainer,
size,
rootPrefixCls,
disabled
} = useConfigInject("picker", props2);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => compactSize.value || size.value);
const [wrapSSR, hashId] = useStyle$J(prefixCls);
const pickerRef = ref();
expose({
focus: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.blur();
}
});
const maybeToStrings = (dates) => {
return props2.valueFormat ? generateConfig2.toString(dates, props2.valueFormat) : dates;
};
const onChange = (dates, dateStrings) => {
const values = maybeToStrings(dates);
emit("update:value", values);
emit("change", values, dateStrings);
formItemContext.onFieldChange();
};
const onOpenChange = (open2) => {
emit("update:open", open2);
emit("openChange", open2);
};
const onFocus = (e) => {
emit("focus", e);
};
const onBlur = (e) => {
emit("blur", e);
formItemContext.onFieldBlur();
};
const onPanelChange = (dates, modes) => {
const values = maybeToStrings(dates);
emit("panelChange", values, modes);
};
const onOk = (dates) => {
const value2 = maybeToStrings(dates);
emit("ok", value2);
};
const onCalendarChange = (dates, dateStrings, info) => {
const values = maybeToStrings(dates);
emit("calendarChange", values, dateStrings, info);
};
const [contextLocale] = useLocaleReceiver("DatePicker", locale$1);
const value = computed(() => {
if (props2.value) {
return props2.valueFormat ? generateConfig2.toDate(props2.value, props2.valueFormat) : props2.value;
}
return props2.value;
});
const defaultValue = computed(() => {
if (props2.defaultValue) {
return props2.valueFormat ? generateConfig2.toDate(props2.defaultValue, props2.valueFormat) : props2.defaultValue;
}
return props2.defaultValue;
});
const defaultPickerValue = computed(() => {
if (props2.defaultPickerValue) {
return props2.valueFormat ? generateConfig2.toDate(props2.defaultPickerValue, props2.valueFormat) : props2.defaultPickerValue;
}
return props2.defaultPickerValue;
});
return () => {
var _a, _b, _c, _d, _e, _f, _g;
const locale2 = _extends(_extends({}, contextLocale.value), props2.locale);
const p = _extends(_extends({}, props2), attrs);
const {
prefixCls: customizePrefixCls,
bordered = true,
placeholder,
suffixIcon = (_a = slots.suffixIcon) === null || _a === void 0 ? void 0 : _a.call(slots),
picker = "date",
transitionName: transitionName2,
allowClear = true,
dateRender = slots.dateRender,
renderExtraFooter = slots.renderExtraFooter,
separator = (_b = slots.separator) === null || _b === void 0 ? void 0 : _b.call(slots),
clearIcon = (_c = slots.clearIcon) === null || _c === void 0 ? void 0 : _c.call(slots),
id = formItemContext.id.value
} = p, restProps = __rest$K(p, ["prefixCls", "bordered", "placeholder", "suffixIcon", "picker", "transitionName", "allowClear", "dateRender", "renderExtraFooter", "separator", "clearIcon", "id"]);
delete restProps["onUpdate:value"];
delete restProps["onUpdate:open"];
const {
format: format2,
showTime
} = p;
let additionalOverrideProps = {};
additionalOverrideProps = _extends(_extends(_extends({}, additionalOverrideProps), showTime ? getTimeProps(_extends({
format: format2,
picker
}, showTime)) : {}), picker === "time" ? getTimeProps(_extends(_extends({
format: format2
}, omit(restProps, ["disabledTime"])), {
picker
})) : {});
const pre = prefixCls.value;
const suffixNode = createVNode(Fragment, null, [suffixIcon || (picker === "time" ? createVNode(ClockCircleOutlined, null, null) : createVNode(CalendarOutlined, null, null)), formItemInputContext.hasFeedback && formItemInputContext.feedbackIcon]);
return wrapSSR(createVNode(InterRangerPicker, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"dateRender": dateRender,
"renderExtraFooter": renderExtraFooter,
"separator": separator || createVNode("span", {
"aria-label": "to",
"class": `${pre}-separator`
}, [createVNode(SwapRightOutlined, null, null)]),
"ref": pickerRef,
"dropdownAlign": transPlacement2DropdownAlign(direction.value, props2.placement),
"placeholder": getRangePlaceholder(locale2, picker, placeholder),
"suffixIcon": suffixNode,
"clearIcon": clearIcon || createVNode(CloseCircleFilled, null, null),
"allowClear": allowClear,
"transitionName": transitionName2 || `${rootPrefixCls.value}-slide-up`
}, restProps), additionalOverrideProps), {}, {
"disabled": disabled.value,
"id": id,
"value": value.value,
"defaultValue": defaultValue.value,
"defaultPickerValue": defaultPickerValue.value,
"picker": picker,
"class": classNames({
[`${pre}-${mergedSize.value}`]: mergedSize.value,
[`${pre}-borderless`]: !bordered
}, getStatusClassNames(pre, getMergedStatus(formItemInputContext.status, props2.status), formItemInputContext.hasFeedback), attrs.class, hashId.value, compactItemClassnames.value),
"locale": locale2.lang,
"prefixCls": pre,
"getPopupContainer": attrs.getCalendarContainer || getPopupContainer.value,
"generateConfig": generateConfig2,
"prevIcon": ((_d = slots.prevIcon) === null || _d === void 0 ? void 0 : _d.call(slots)) || createVNode("span", {
"class": `${pre}-prev-icon`
}, null),
"nextIcon": ((_e = slots.nextIcon) === null || _e === void 0 ? void 0 : _e.call(slots)) || createVNode("span", {
"class": `${pre}-next-icon`
}, null),
"superPrevIcon": ((_f = slots.superPrevIcon) === null || _f === void 0 ? void 0 : _f.call(slots)) || createVNode("span", {
"class": `${pre}-super-prev-icon`
}, null),
"superNextIcon": ((_g = slots.superNextIcon) === null || _g === void 0 ? void 0 : _g.call(slots)) || createVNode("span", {
"class": `${pre}-super-next-icon`
}, null),
"components": Components,
"direction": direction.value,
"dropdownClassName": classNames(hashId.value, props2.popupClassName, props2.dropdownClassName),
"onChange": onChange,
"onOpenChange": onOpenChange,
"onFocus": onFocus,
"onBlur": onBlur,
"onPanelChange": onPanelChange,
"onOk": onOk,
"onCalendarChange": onCalendarChange
}), null));
};
}
});
return RangePicker2;
}
const Components = {
button: PickerButton,
rangeItem: PickerTag
};
function toArray$3(list) {
if (!list) {
return [];
}
return Array.isArray(list) ? list : [list];
}
function getTimeProps(props2) {
const {
format: format2,
picker,
showHour,
showMinute,
showSecond,
use12Hours
} = props2;
const firstFormat = toArray$3(format2)[0];
const showTimeObj = _extends({}, props2);
if (firstFormat && typeof firstFormat === "string") {
if (!firstFormat.includes("s") && showSecond === void 0) {
showTimeObj.showSecond = false;
}
if (!firstFormat.includes("m") && showMinute === void 0) {
showTimeObj.showMinute = false;
}
if (!firstFormat.includes("H") && !firstFormat.includes("h") && showHour === void 0) {
showTimeObj.showHour = false;
}
if ((firstFormat.includes("a") || firstFormat.includes("A")) && use12Hours === void 0) {
showTimeObj.use12Hours = true;
}
}
if (picker === "time") {
return showTimeObj;
}
if (typeof firstFormat === "function") {
delete showTimeObj.format;
}
return {
showTime: showTimeObj
};
}
function generatePicker(generateConfig2, extraProps) {
const {
DatePicker: DatePicker2,
WeekPicker: WeekPicker2,
MonthPicker: MonthPicker2,
YearPicker: YearPicker2,
TimePicker: TimePicker2,
QuarterPicker: QuarterPicker2
} = generateSinglePicker(generateConfig2, extraProps);
const RangePicker2 = generateRangePicker(generateConfig2, extraProps);
return {
DatePicker: DatePicker2,
WeekPicker: WeekPicker2,
MonthPicker: MonthPicker2,
YearPicker: YearPicker2,
TimePicker: TimePicker2,
QuarterPicker: QuarterPicker2,
RangePicker: RangePicker2
};
}
const {
DatePicker,
WeekPicker,
MonthPicker,
YearPicker,
TimePicker: TimePicker$2,
QuarterPicker,
RangePicker
} = generatePicker(generateConfig);
const DatePicker$1 = _extends(DatePicker, {
WeekPicker,
MonthPicker,
YearPicker,
RangePicker,
TimePicker: TimePicker$2,
QuarterPicker,
install: (app) => {
app.component(DatePicker.name, DatePicker);
app.component(RangePicker.name, RangePicker);
app.component(MonthPicker.name, MonthPicker);
app.component(WeekPicker.name, WeekPicker);
app.component(QuarterPicker.name, QuarterPicker);
return app;
}
});
function notEmpty(val) {
return val !== void 0 && val !== null;
}
const Cell$1 = (props2) => {
const {
itemPrefixCls,
component,
span,
labelStyle,
contentStyle,
bordered,
label,
content,
colon
} = props2;
const Component = component;
if (bordered) {
return createVNode(Component, {
"class": [{
[`${itemPrefixCls}-item-label`]: notEmpty(label),
[`${itemPrefixCls}-item-content`]: notEmpty(content)
}],
"colSpan": span
}, {
default: () => [notEmpty(label) && createVNode("span", {
"style": labelStyle
}, [label]), notEmpty(content) && createVNode("span", {
"style": contentStyle
}, [content])]
});
}
return createVNode(Component, {
"class": [`${itemPrefixCls}-item`],
"colSpan": span
}, {
default: () => [createVNode("div", {
"class": `${itemPrefixCls}-item-container`
}, [(label || label === 0) && createVNode("span", {
"class": [`${itemPrefixCls}-item-label`, {
[`${itemPrefixCls}-item-no-colon`]: !colon
}],
"style": labelStyle
}, [label]), (content || content === 0) && createVNode("span", {
"class": `${itemPrefixCls}-item-content`,
"style": contentStyle
}, [content])])]
});
};
const Row = (props2) => {
const renderCells = (items, _ref, _ref2) => {
let {
colon,
prefixCls: prefixCls2,
bordered: bordered2
} = _ref;
let {
component,
type,
showLabel,
showContent,
labelStyle: rootLabelStyle,
contentStyle: rootContentStyle
} = _ref2;
return items.map((item, index3) => {
var _a, _b;
const itemProps = item.props || {};
const {
prefixCls: itemPrefixCls = prefixCls2,
span = 1,
labelStyle: labelStyle2 = itemProps["label-style"],
contentStyle: contentStyle2 = itemProps["content-style"],
label = (_b = (_a = item.children) === null || _a === void 0 ? void 0 : _a.label) === null || _b === void 0 ? void 0 : _b.call(_a)
} = itemProps;
const children = getSlot(item);
const className = getClass(item);
const style = getStyle$3(item);
const {
key: key2
} = item;
if (typeof component === "string") {
return createVNode(Cell$1, {
"key": `${type}-${String(key2) || index3}`,
"class": className,
"style": style,
"labelStyle": _extends(_extends({}, rootLabelStyle), labelStyle2),
"contentStyle": _extends(_extends({}, rootContentStyle), contentStyle2),
"span": span,
"colon": colon,
"component": component,
"itemPrefixCls": itemPrefixCls,
"bordered": bordered2,
"label": showLabel ? label : null,
"content": showContent ? children : null
}, null);
}
return [createVNode(Cell$1, {
"key": `label-${String(key2) || index3}`,
"class": className,
"style": _extends(_extends(_extends({}, rootLabelStyle), style), labelStyle2),
"span": 1,
"colon": colon,
"component": component[0],
"itemPrefixCls": itemPrefixCls,
"bordered": bordered2,
"label": label
}, null), createVNode(Cell$1, {
"key": `content-${String(key2) || index3}`,
"class": className,
"style": _extends(_extends(_extends({}, rootContentStyle), style), contentStyle2),
"span": span * 2 - 1,
"component": component[1],
"itemPrefixCls": itemPrefixCls,
"bordered": bordered2,
"content": children
}, null)];
});
};
const {
prefixCls,
vertical,
row,
index: index2,
bordered
} = props2;
const {
labelStyle,
contentStyle
} = inject(descriptionsContext, {
labelStyle: ref({}),
contentStyle: ref({})
});
if (vertical) {
return createVNode(Fragment, null, [createVNode("tr", {
"key": `label-${index2}`,
"class": `${prefixCls}-row`
}, [renderCells(row, props2, {
component: "th",
type: "label",
showLabel: true,
labelStyle: labelStyle.value,
contentStyle: contentStyle.value
})]), createVNode("tr", {
"key": `content-${index2}`,
"class": `${prefixCls}-row`
}, [renderCells(row, props2, {
component: "td",
type: "content",
showContent: true,
labelStyle: labelStyle.value,
contentStyle: contentStyle.value
})])]);
}
return createVNode("tr", {
"key": index2,
"class": `${prefixCls}-row`
}, [renderCells(row, props2, {
component: bordered ? ["th", "td"] : "td",
type: "item",
showLabel: true,
showContent: true,
labelStyle: labelStyle.value,
contentStyle: contentStyle.value
})]);
};
const genBorderedStyle$3 = (token) => {
const {
componentCls,
descriptionsSmallPadding,
descriptionsDefaultPadding,
descriptionsMiddlePadding,
descriptionsBg
} = token;
return {
[`&${componentCls}-bordered`]: {
[`${componentCls}-view`]: {
border: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
"> table": {
tableLayout: "auto",
borderCollapse: "collapse"
}
},
[`${componentCls}-item-label, ${componentCls}-item-content`]: {
padding: descriptionsDefaultPadding,
borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
"&:last-child": {
borderInlineEnd: "none"
}
},
[`${componentCls}-item-label`]: {
backgroundColor: descriptionsBg,
"&::after": {
display: "none"
}
},
[`${componentCls}-row`]: {
borderBottom: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
"&:last-child": {
borderBottom: "none"
}
},
[`&${componentCls}-middle`]: {
[`${componentCls}-item-label, ${componentCls}-item-content`]: {
padding: descriptionsMiddlePadding
}
},
[`&${componentCls}-small`]: {
[`${componentCls}-item-label, ${componentCls}-item-content`]: {
padding: descriptionsSmallPadding
}
}
}
};
};
const genDescriptionStyles = (token) => {
const {
componentCls,
descriptionsExtraColor,
descriptionItemPaddingBottom,
descriptionsItemLabelColonMarginRight,
descriptionsItemLabelColonMarginLeft,
descriptionsTitleMarginBottom
} = token;
return {
[componentCls]: _extends(_extends(_extends({}, resetComponent(token)), genBorderedStyle$3(token)), {
[`&-rtl`]: {
direction: "rtl"
},
[`${componentCls}-header`]: {
display: "flex",
alignItems: "center",
marginBottom: descriptionsTitleMarginBottom
},
[`${componentCls}-title`]: _extends(_extends({}, textEllipsis), {
flex: "auto",
color: token.colorText,
fontWeight: token.fontWeightStrong,
fontSize: token.fontSizeLG,
lineHeight: token.lineHeightLG
}),
[`${componentCls}-extra`]: {
marginInlineStart: "auto",
color: descriptionsExtraColor,
fontSize: token.fontSize
},
[`${componentCls}-view`]: {
width: "100%",
borderRadius: token.borderRadiusLG,
table: {
width: "100%",
tableLayout: "fixed"
}
},
[`${componentCls}-row`]: {
"> th, > td": {
paddingBottom: descriptionItemPaddingBottom
},
"&:last-child": {
borderBottom: "none"
}
},
[`${componentCls}-item-label`]: {
color: token.colorText,
fontWeight: "normal",
fontSize: token.fontSize,
lineHeight: token.lineHeight,
textAlign: `start`,
"&::after": {
content: '":"',
position: "relative",
top: -0.5,
marginInline: `${descriptionsItemLabelColonMarginLeft}px ${descriptionsItemLabelColonMarginRight}px`
},
[`&${componentCls}-item-no-colon::after`]: {
content: '""'
}
},
[`${componentCls}-item-no-label`]: {
"&::after": {
margin: 0,
content: '""'
}
},
[`${componentCls}-item-content`]: {
display: "table-cell",
flex: 1,
color: token.colorText,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
wordBreak: "break-word",
overflowWrap: "break-word"
},
[`${componentCls}-item`]: {
paddingBottom: 0,
verticalAlign: "top",
"&-container": {
display: "flex",
[`${componentCls}-item-label`]: {
display: "inline-flex",
alignItems: "baseline"
},
[`${componentCls}-item-content`]: {
display: "inline-flex",
alignItems: "baseline"
}
}
},
"&-middle": {
[`${componentCls}-row`]: {
"> th, > td": {
paddingBottom: token.paddingSM
}
}
},
"&-small": {
[`${componentCls}-row`]: {
"> th, > td": {
paddingBottom: token.paddingXS
}
}
}
})
};
};
const useStyle$u = genComponentStyleHook("Descriptions", (token) => {
const descriptionsBg = token.colorFillAlter;
const descriptionsTitleMarginBottom = token.fontSizeSM * token.lineHeightSM;
const descriptionsExtraColor = token.colorText;
const descriptionsSmallPadding = `${token.paddingXS}px ${token.padding}px`;
const descriptionsDefaultPadding = `${token.padding}px ${token.paddingLG}px`;
const descriptionsMiddlePadding = `${token.paddingSM}px ${token.paddingLG}px`;
const descriptionItemPaddingBottom = token.padding;
const descriptionsItemLabelColonMarginRight = token.marginXS;
const descriptionsItemLabelColonMarginLeft = token.marginXXS / 2;
const descriptionToken = merge(token, {
descriptionsBg,
descriptionsTitleMarginBottom,
descriptionsExtraColor,
descriptionItemPaddingBottom,
descriptionsSmallPadding,
descriptionsDefaultPadding,
descriptionsMiddlePadding,
descriptionsItemLabelColonMarginRight,
descriptionsItemLabelColonMarginLeft
});
return [genDescriptionStyles(descriptionToken)];
});
({
label: PropTypes.any
});
const descriptionsItemProp = () => ({
prefixCls: String,
label: PropTypes.any,
labelStyle: {
type: Object,
default: void 0
},
contentStyle: {
type: Object,
default: void 0
},
span: {
type: Number,
default: 1
}
});
const DescriptionsItem = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADescriptionsItem",
props: descriptionsItemProp(),
setup(_, _ref) {
let {
slots
} = _ref;
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const DEFAULT_COLUMN_MAP = {
xxxl: 3,
xxl: 3,
xl: 3,
lg: 3,
md: 3,
sm: 2,
xs: 1
};
function getColumn(column, screens) {
if (typeof column === "number") {
return column;
}
if (typeof column === "object") {
for (let i = 0; i < responsiveArray.length; i++) {
const breakpoint = responsiveArray[i];
if (screens[breakpoint] && column[breakpoint] !== void 0) {
return column[breakpoint] || DEFAULT_COLUMN_MAP[breakpoint];
}
}
}
return 3;
}
function getFilledItem(node, rowRestCol, span) {
let clone = node;
if (span === void 0 || span > rowRestCol) {
clone = cloneElement(node, {
span: rowRestCol
});
}
return clone;
}
function getRows(children, column) {
const childNodes = flattenChildren(children);
const rows = [];
let tmpRow = [];
let rowRestCol = column;
childNodes.forEach((node, index2) => {
var _a;
const span = (_a = node.props) === null || _a === void 0 ? void 0 : _a.span;
const mergedSpan = span || 1;
if (index2 === childNodes.length - 1) {
tmpRow.push(getFilledItem(node, rowRestCol, span));
rows.push(tmpRow);
return;
}
if (mergedSpan < rowRestCol) {
rowRestCol -= mergedSpan;
tmpRow.push(node);
} else {
tmpRow.push(getFilledItem(node, rowRestCol, mergedSpan));
rows.push(tmpRow);
rowRestCol = column;
tmpRow = [];
}
});
return rows;
}
const descriptionsProps = () => ({
prefixCls: String,
bordered: {
type: Boolean,
default: void 0
},
size: {
type: String,
default: "default"
},
title: PropTypes.any,
extra: PropTypes.any,
column: {
type: [Number, Object],
default: () => DEFAULT_COLUMN_MAP
},
layout: String,
colon: {
type: Boolean,
default: void 0
},
labelStyle: {
type: Object,
default: void 0
},
contentStyle: {
type: Object,
default: void 0
}
});
const descriptionsContext = Symbol("descriptionsContext");
const Descriptions = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADescriptions",
inheritAttrs: false,
props: descriptionsProps(),
slots: Object,
Item: DescriptionsItem,
setup(props2, _ref2) {
let {
slots,
attrs
} = _ref2;
const {
prefixCls,
direction
} = useConfigInject("descriptions", props2);
const screens = ref({});
const [wrapSSR, hashId] = useStyle$u(prefixCls);
useResponsiveObserver();
provide(descriptionsContext, {
labelStyle: toRef(props2, "labelStyle"),
contentStyle: toRef(props2, "contentStyle")
});
const mergeColumn = computed(() => getColumn(props2.column, screens.value));
return () => {
var _a, _b, _c;
const {
size,
bordered = false,
layout = "horizontal",
colon = true,
title = (_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots),
extra = (_b = slots.extra) === null || _b === void 0 ? void 0 : _b.call(slots)
} = props2;
const children = (_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots);
const rows = getRows(children, mergeColumn.value);
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [prefixCls.value, {
[`${prefixCls.value}-${size}`]: size !== "default",
[`${prefixCls.value}-bordered`]: !!bordered,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value]
}), [(title || extra) && createVNode("div", {
"class": `${prefixCls.value}-header`
}, [title && createVNode("div", {
"class": `${prefixCls.value}-title`
}, [title]), extra && createVNode("div", {
"class": `${prefixCls.value}-extra`
}, [extra])]), createVNode("div", {
"class": `${prefixCls.value}-view`
}, [createVNode("table", null, [createVNode("tbody", null, [rows.map((row, index2) => createVNode(Row, {
"key": index2,
"index": index2,
"colon": colon,
"prefixCls": prefixCls.value,
"vertical": layout === "vertical",
"bordered": bordered,
"row": row
}, null))])])])]));
};
}
});
Descriptions.install = function(app) {
app.component(Descriptions.name, Descriptions);
app.component(Descriptions.Item.name, Descriptions.Item);
return app;
};
const genSharedDividerStyle = (token) => {
const {
componentCls,
sizePaddingEdgeHorizontal,
colorSplit,
lineWidth
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
borderBlockStart: `${lineWidth}px solid ${colorSplit}`,
// vertical
"&-vertical": {
position: "relative",
top: "-0.06em",
display: "inline-block",
height: "0.9em",
margin: `0 ${token.dividerVerticalGutterMargin}px`,
verticalAlign: "middle",
borderTop: 0,
borderInlineStart: `${lineWidth}px solid ${colorSplit}`
},
"&-horizontal": {
display: "flex",
clear: "both",
width: "100%",
minWidth: "100%",
margin: `${token.dividerHorizontalGutterMargin}px 0`
},
[`&-horizontal${componentCls}-with-text`]: {
display: "flex",
alignItems: "center",
margin: `${token.dividerHorizontalWithTextGutterMargin}px 0`,
color: token.colorTextHeading,
fontWeight: 500,
fontSize: token.fontSizeLG,
whiteSpace: "nowrap",
textAlign: "center",
borderBlockStart: `0 ${colorSplit}`,
"&::before, &::after": {
position: "relative",
width: "50%",
borderBlockStart: `${lineWidth}px solid transparent`,
// Chrome not accept `inherit` in `border-top`
borderBlockStartColor: "inherit",
borderBlockEnd: 0,
transform: "translateY(50%)",
content: "''"
}
},
[`&-horizontal${componentCls}-with-text-left`]: {
"&::before": {
width: "5%"
},
"&::after": {
width: "95%"
}
},
[`&-horizontal${componentCls}-with-text-right`]: {
"&::before": {
width: "95%"
},
"&::after": {
width: "5%"
}
},
[`${componentCls}-inner-text`]: {
display: "inline-block",
padding: "0 1em"
},
"&-dashed": {
background: "none",
borderColor: colorSplit,
borderStyle: "dashed",
borderWidth: `${lineWidth}px 0 0`
},
[`&-horizontal${componentCls}-with-text${componentCls}-dashed`]: {
"&::before, &::after": {
borderStyle: "dashed none none"
}
},
[`&-vertical${componentCls}-dashed`]: {
borderInlineStartWidth: lineWidth,
borderInlineEnd: 0,
borderBlockStart: 0,
borderBlockEnd: 0
},
[`&-plain${componentCls}-with-text`]: {
color: token.colorText,
fontWeight: "normal",
fontSize: token.fontSize
},
[`&-horizontal${componentCls}-with-text-left${componentCls}-no-default-orientation-margin-left`]: {
"&::before": {
width: 0
},
"&::after": {
width: "100%"
},
[`${componentCls}-inner-text`]: {
paddingInlineStart: sizePaddingEdgeHorizontal
}
},
[`&-horizontal${componentCls}-with-text-right${componentCls}-no-default-orientation-margin-right`]: {
"&::before": {
width: "100%"
},
"&::after": {
width: 0
},
[`${componentCls}-inner-text`]: {
paddingInlineEnd: sizePaddingEdgeHorizontal
}
}
})
};
};
const useStyle$t = genComponentStyleHook("Divider", (token) => {
const dividerToken = merge(token, {
dividerVerticalGutterMargin: token.marginXS,
dividerHorizontalWithTextGutterMargin: token.margin,
dividerHorizontalGutterMargin: token.marginLG
});
return [genSharedDividerStyle(dividerToken)];
}, {
sizePaddingEdgeHorizontal: 0
});
const dividerProps = () => ({
prefixCls: String,
type: {
type: String,
default: "horizontal"
},
dashed: {
type: Boolean,
default: false
},
orientation: {
type: String,
default: "center"
},
plain: {
type: Boolean,
default: false
},
orientationMargin: [String, Number]
});
const Divider = defineComponent({
name: "ADivider",
inheritAttrs: false,
compatConfig: {
MODE: 3
},
props: dividerProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls: prefixClsRef,
direction
} = useConfigInject("divider", props2);
const [wrapSSR, hashId] = useStyle$t(prefixClsRef);
const hasCustomMarginLeft = computed(() => props2.orientation === "left" && props2.orientationMargin != null);
const hasCustomMarginRight = computed(() => props2.orientation === "right" && props2.orientationMargin != null);
const classString = computed(() => {
const {
type,
dashed,
plain
} = props2;
const prefixCls = prefixClsRef.value;
return {
[prefixCls]: true,
[hashId.value]: !!hashId.value,
[`${prefixCls}-${type}`]: true,
[`${prefixCls}-dashed`]: !!dashed,
[`${prefixCls}-plain`]: !!plain,
[`${prefixCls}-rtl`]: direction.value === "rtl",
[`${prefixCls}-no-default-orientation-margin-left`]: hasCustomMarginLeft.value,
[`${prefixCls}-no-default-orientation-margin-right`]: hasCustomMarginRight.value
};
});
const innerStyle = computed(() => {
const marginValue = typeof props2.orientationMargin === "number" ? `${props2.orientationMargin}px` : props2.orientationMargin;
return _extends(_extends({}, hasCustomMarginLeft.value && {
marginLeft: marginValue
}), hasCustomMarginRight.value && {
marginRight: marginValue
});
});
const orientationPrefix = computed(() => props2.orientation.length > 0 ? "-" + props2.orientation : props2.orientation);
return () => {
var _a;
const children = flattenChildren((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [classString.value, children.length ? `${prefixClsRef.value}-with-text ${prefixClsRef.value}-with-text${orientationPrefix.value}` : "", attrs.class],
"role": "separator"
}), [children.length ? createVNode("span", {
"class": `${prefixClsRef.value}-inner-text`,
"style": innerStyle.value
}, [children]) : null]));
};
}
});
const __nuxt_component_4 = withInstall(Divider);
Dropdown.Button = DropdownButton;
Dropdown.install = function(app) {
app.component(Dropdown.name, Dropdown);
app.component(DropdownButton.name, DropdownButton);
return app;
};
const props = () => ({
prefixCls: String,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
style: {
type: Object,
default: void 0
},
class: String,
rootClassName: String,
rootStyle: objectType(),
placement: {
type: String
},
wrapperClassName: String,
level: {
type: [String, Array]
},
levelMove: {
type: [Number, Function, Array]
},
duration: String,
ease: String,
showMask: {
type: Boolean,
default: void 0
},
maskClosable: {
type: Boolean,
default: void 0
},
maskStyle: {
type: Object,
default: void 0
},
afterVisibleChange: Function,
keyboard: {
type: Boolean,
default: void 0
},
contentWrapperStyle: arrayType(),
autofocus: {
type: Boolean,
default: void 0
},
open: {
type: Boolean,
default: void 0
},
// Motion
motion: functionType(),
maskMotion: objectType()
});
const drawerProps$1 = () => _extends(_extends({}, props()), {
forceRender: {
type: Boolean,
default: void 0
},
getContainer: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.object, PropTypes.looseBool])
});
const drawerChildProps = () => _extends(_extends({}, props()), {
getContainer: Function,
getOpenCount: Function,
scrollLocker: PropTypes.any,
inline: Boolean
});
var __rest$J = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const DrawerChild = defineComponent({
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: drawerChildProps(),
emits: ["close", "handleClick", "change"],
setup(props2, _ref) {
let {
emit,
slots
} = _ref;
const contentWrapper = shallowRef();
const dom = shallowRef();
const maskDom = shallowRef();
const handlerDom = shallowRef();
const contentDom = shallowRef();
`drawer_id_${Number((Date.now() + Math.random()).toString().replace(".", Math.round(Math.random() * 9).toString())).toString(16)}`;
watch(() => props2.level, () => {
getLevelDom(props2);
}, {
flush: "post"
});
watch(() => props2.open, () => {
const {
open: open2,
getContainer: getContainer2,
scrollLocker,
showMask,
autofocus
} = props2;
const container = getContainer2 === null || getContainer2 === void 0 ? void 0 : getContainer2();
if (container && container.parentNode === (void 0).body) ;
if (open2) {
if (autofocus) {
domFocus();
}
if (showMask) {
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.lock();
}
} else {
scrollLocker === null || scrollLocker === void 0 ? void 0 : scrollLocker.unLock();
}
}, {
flush: "post"
});
watch(() => props2.placement, (val) => {
if (val) {
contentDom.value = null;
}
});
const domFocus = () => {
var _a, _b;
(_b = (_a = dom.value) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
};
const onClose = (e) => {
emit("close", e);
};
const onKeyDown2 = (e) => {
if (e.keyCode === KeyCode.ESC) {
e.stopPropagation();
onClose(e);
}
};
const onAfterVisibleChange = () => {
const {
open: open2,
afterVisibleChange
} = props2;
if (afterVisibleChange) {
afterVisibleChange(!!open2);
}
};
const getLevelDom = (_ref2) => {
let {
level,
getContainer: getContainer2
} = _ref2;
{
return;
}
};
const onHandleClick = (e) => {
emit("handleClick", e);
};
const canOpen = shallowRef(false);
watch(dom, () => {
nextTick(() => {
canOpen.value = true;
});
});
return () => {
var _a, _b;
const {
width,
height,
open: $open,
prefixCls,
placement,
level,
levelMove,
ease,
duration,
getContainer: getContainer2,
onChange,
afterVisibleChange,
showMask,
maskClosable,
maskStyle,
keyboard,
getOpenCount,
scrollLocker,
contentWrapperStyle,
style,
class: className,
rootClassName,
rootStyle,
maskMotion,
motion,
inline
} = props2, otherProps = __rest$J(props2, ["width", "height", "open", "prefixCls", "placement", "level", "levelMove", "ease", "duration", "getContainer", "onChange", "afterVisibleChange", "showMask", "maskClosable", "maskStyle", "keyboard", "getOpenCount", "scrollLocker", "contentWrapperStyle", "style", "class", "rootClassName", "rootStyle", "maskMotion", "motion", "inline"]);
const open2 = $open && canOpen.value;
const wrapperClassName = classNames(prefixCls, {
[`${prefixCls}-${placement}`]: true,
[`${prefixCls}-open`]: open2,
[`${prefixCls}-inline`]: inline,
"no-mask": !showMask,
[rootClassName]: true
});
const motionProps = typeof motion === "function" ? motion(placement) : motion;
return createVNode("div", _objectSpread$W(_objectSpread$W({}, omit(otherProps, ["autofocus"])), {}, {
"tabindex": -1,
"class": wrapperClassName,
"style": rootStyle,
"ref": dom,
"onKeydown": open2 && keyboard ? onKeyDown2 : void 0
}), [createVNode(Transition, maskMotion, {
default: () => [showMask && withDirectives(createVNode("div", {
"class": `${prefixCls}-mask`,
"onClick": maskClosable ? onClose : void 0,
"style": maskStyle,
"ref": maskDom
}, null), [[vShow, open2]])]
}), createVNode(Transition, _objectSpread$W(_objectSpread$W({}, motionProps), {}, {
"onAfterEnter": onAfterVisibleChange,
"onAfterLeave": onAfterVisibleChange
}), {
default: () => [withDirectives(createVNode("div", {
"class": `${prefixCls}-content-wrapper`,
"style": [contentWrapperStyle],
"ref": contentWrapper
}, [createVNode("div", {
"class": [`${prefixCls}-content`, className],
"style": style,
"ref": contentDom
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]), slots.handler ? createVNode("div", {
"onClick": onHandleClick,
"ref": handlerDom
}, [(_b = slots.handler) === null || _b === void 0 ? void 0 : _b.call(slots)]) : null]), [[vShow, open2]])]
})]);
};
}
});
var __rest$I = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const DrawerWrapper = defineComponent({
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: initDefaultProps(drawerProps$1(), {
prefixCls: "drawer",
placement: "left",
getContainer: "body",
level: "all",
duration: ".3s",
ease: "cubic-bezier(0.78, 0.14, 0.15, 0.86)",
afterVisibleChange: () => {
},
showMask: true,
maskClosable: true,
maskStyle: {},
wrapperClassName: "",
keyboard: true,
forceRender: false,
autofocus: true
}),
emits: ["handleClick", "close"],
setup(props2, _ref) {
let {
emit,
slots
} = _ref;
const dom = ref(null);
const onHandleClick = (e) => {
emit("handleClick", e);
};
const onClose = (e) => {
emit("close", e);
};
return () => {
const {
getContainer: getContainer2,
wrapperClassName,
rootClassName,
rootStyle,
forceRender
} = props2, otherProps = __rest$I(props2, ["getContainer", "wrapperClassName", "rootClassName", "rootStyle", "forceRender"]);
let portal = null;
if (!getContainer2) {
return createVNode(DrawerChild, _objectSpread$W(_objectSpread$W({}, otherProps), {}, {
"rootClassName": rootClassName,
"rootStyle": rootStyle,
"open": props2.open,
"onClose": onClose,
"onHandleClick": onHandleClick,
"inline": true
}), slots);
}
const $forceRender = !!slots.handler || forceRender;
if ($forceRender || props2.open || dom.value) {
portal = createVNode(Portal, {
"autoLock": true,
"visible": props2.open,
"forceRender": $forceRender,
"getContainer": getContainer2,
"wrapperClassName": wrapperClassName
}, {
default: (_a) => {
var {
visible,
afterClose
} = _a, rest = __rest$I(_a, ["visible", "afterClose"]);
return createVNode(DrawerChild, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": dom
}, otherProps), rest), {}, {
"rootClassName": rootClassName,
"rootStyle": rootStyle,
"open": visible !== void 0 ? visible : props2.open,
"afterVisibleChange": afterClose !== void 0 ? afterClose : props2.afterVisibleChange,
"onClose": onClose,
"onHandleClick": onHandleClick
}), slots);
}
});
}
return portal;
};
}
});
const genMotionStyle$1 = (token) => {
const {
componentCls,
motionDurationSlow
} = token;
const sharedPanelMotion = {
"&-enter, &-appear, &-leave": {
"&-start": {
transition: "none"
},
"&-active": {
transition: `all ${motionDurationSlow}`
}
}
};
return {
[componentCls]: {
// ======================== Mask ========================
[`${componentCls}-mask-motion`]: {
"&-enter, &-appear, &-leave": {
"&-active": {
transition: `all ${motionDurationSlow}`
}
},
"&-enter, &-appear": {
opacity: 0,
"&-active": {
opacity: 1
}
},
"&-leave": {
opacity: 1,
"&-active": {
opacity: 0
}
}
},
// ======================= Panel ========================
[`${componentCls}-panel-motion`]: {
// Left
"&-left": [sharedPanelMotion, {
"&-enter, &-appear": {
"&-start": {
transform: "translateX(-100%) !important"
},
"&-active": {
transform: "translateX(0)"
}
},
"&-leave": {
transform: "translateX(0)",
"&-active": {
transform: "translateX(-100%)"
}
}
}],
// Right
"&-right": [sharedPanelMotion, {
"&-enter, &-appear": {
"&-start": {
transform: "translateX(100%) !important"
},
"&-active": {
transform: "translateX(0)"
}
},
"&-leave": {
transform: "translateX(0)",
"&-active": {
transform: "translateX(100%)"
}
}
}],
// Top
"&-top": [sharedPanelMotion, {
"&-enter, &-appear": {
"&-start": {
transform: "translateY(-100%) !important"
},
"&-active": {
transform: "translateY(0)"
}
},
"&-leave": {
transform: "translateY(0)",
"&-active": {
transform: "translateY(-100%)"
}
}
}],
// Bottom
"&-bottom": [sharedPanelMotion, {
"&-enter, &-appear": {
"&-start": {
transform: "translateY(100%) !important"
},
"&-active": {
transform: "translateY(0)"
}
},
"&-leave": {
transform: "translateY(0)",
"&-active": {
transform: "translateY(100%)"
}
}
}]
}
}
};
};
const genDrawerStyle = (token) => {
const {
componentCls,
zIndexPopup,
colorBgMask,
colorBgElevated,
motionDurationSlow,
motionDurationMid,
padding,
paddingLG,
fontSizeLG,
lineHeightLG,
lineWidth,
lineType,
colorSplit,
marginSM,
colorIcon,
colorIconHover,
colorText,
fontWeightStrong,
drawerFooterPaddingVertical,
drawerFooterPaddingHorizontal
} = token;
const wrapperCls = `${componentCls}-content-wrapper`;
return {
[componentCls]: {
position: "fixed",
inset: 0,
zIndex: zIndexPopup,
pointerEvents: "none",
"&-pure": {
position: "relative",
background: colorBgElevated,
[`&${componentCls}-left`]: {
boxShadow: token.boxShadowDrawerLeft
},
[`&${componentCls}-right`]: {
boxShadow: token.boxShadowDrawerRight
},
[`&${componentCls}-top`]: {
boxShadow: token.boxShadowDrawerUp
},
[`&${componentCls}-bottom`]: {
boxShadow: token.boxShadowDrawerDown
}
},
"&-inline": {
position: "absolute"
},
// ====================== Mask ======================
[`${componentCls}-mask`]: {
position: "absolute",
inset: 0,
zIndex: zIndexPopup,
background: colorBgMask,
pointerEvents: "auto"
},
// ==================== Content =====================
[wrapperCls]: {
position: "absolute",
zIndex: zIndexPopup,
transition: `all ${motionDurationSlow}`,
"&-hidden": {
display: "none"
}
},
// Placement
[`&-left > ${wrapperCls}`]: {
top: 0,
bottom: 0,
left: {
_skip_check_: true,
value: 0
},
boxShadow: token.boxShadowDrawerLeft
},
[`&-right > ${wrapperCls}`]: {
top: 0,
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
boxShadow: token.boxShadowDrawerRight
},
[`&-top > ${wrapperCls}`]: {
top: 0,
insetInline: 0,
boxShadow: token.boxShadowDrawerUp
},
[`&-bottom > ${wrapperCls}`]: {
bottom: 0,
insetInline: 0,
boxShadow: token.boxShadowDrawerDown
},
[`${componentCls}-content`]: {
width: "100%",
height: "100%",
overflow: "auto",
background: colorBgElevated,
pointerEvents: "auto"
},
// ===================== Panel ======================
[`${componentCls}-wrapper-body`]: {
display: "flex",
flexDirection: "column",
width: "100%",
height: "100%"
},
// Header
[`${componentCls}-header`]: {
display: "flex",
flex: 0,
alignItems: "center",
padding: `${padding}px ${paddingLG}px`,
fontSize: fontSizeLG,
lineHeight: lineHeightLG,
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`,
"&-title": {
display: "flex",
flex: 1,
alignItems: "center",
minWidth: 0,
minHeight: 0
}
},
[`${componentCls}-extra`]: {
flex: "none"
},
[`${componentCls}-close`]: {
display: "inline-block",
marginInlineEnd: marginSM,
color: colorIcon,
fontWeight: fontWeightStrong,
fontSize: fontSizeLG,
fontStyle: "normal",
lineHeight: 1,
textAlign: "center",
textTransform: "none",
textDecoration: "none",
background: "transparent",
border: 0,
outline: 0,
cursor: "pointer",
transition: `color ${motionDurationMid}`,
textRendering: "auto",
"&:focus, &:hover": {
color: colorIconHover,
textDecoration: "none"
}
},
[`${componentCls}-title`]: {
flex: 1,
margin: 0,
color: colorText,
fontWeight: token.fontWeightStrong,
fontSize: fontSizeLG,
lineHeight: lineHeightLG
},
// Body
[`${componentCls}-body`]: {
flex: 1,
minWidth: 0,
minHeight: 0,
padding: paddingLG,
overflow: "auto"
},
// Footer
[`${componentCls}-footer`]: {
flexShrink: 0,
padding: `${drawerFooterPaddingVertical}px ${drawerFooterPaddingHorizontal}px`,
borderTop: `${lineWidth}px ${lineType} ${colorSplit}`
},
// ====================== RTL =======================
"&-rtl": {
direction: "rtl"
}
}
};
};
const useStyle$s = genComponentStyleHook("Drawer", (token) => {
const drawerToken = merge(token, {
drawerFooterPaddingVertical: token.paddingXS,
drawerFooterPaddingHorizontal: token.padding
});
return [genDrawerStyle(drawerToken), genMotionStyle$1(drawerToken)];
}, (token) => ({
zIndexPopup: token.zIndexPopupBase
}));
var __rest$H = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const PlacementTypes = ["top", "right", "bottom", "left"];
const defaultPushState = {
distance: 180
};
const drawerProps = () => ({
autofocus: {
type: Boolean,
default: void 0
},
closable: {
type: Boolean,
default: void 0
},
closeIcon: PropTypes.any,
destroyOnClose: {
type: Boolean,
default: void 0
},
forceRender: {
type: Boolean,
default: void 0
},
getContainer: {
type: [String, Function, Boolean, Object],
default: void 0
},
maskClosable: {
type: Boolean,
default: void 0
},
mask: {
type: Boolean,
default: void 0
},
maskStyle: objectType(),
rootClassName: String,
rootStyle: objectType(),
size: {
type: String
},
drawerStyle: objectType(),
headerStyle: objectType(),
bodyStyle: objectType(),
contentWrapperStyle: {
type: Object,
default: void 0
},
title: PropTypes.any,
/** @deprecated Please use `open` instead */
visible: {
type: Boolean,
default: void 0
},
open: {
type: Boolean,
default: void 0
},
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
zIndex: Number,
prefixCls: String,
push: PropTypes.oneOfType([PropTypes.looseBool, {
type: Object
}]),
placement: PropTypes.oneOf(PlacementTypes),
keyboard: {
type: Boolean,
default: void 0
},
extra: PropTypes.any,
footer: PropTypes.any,
footerStyle: objectType(),
level: PropTypes.any,
levelMove: {
type: [Number, Array, Function]
},
handle: PropTypes.any,
/** @deprecated Use `@afterVisibleChange` instead */
afterVisibleChange: Function,
/** @deprecated Please use `@afterOpenChange` instead */
onAfterVisibleChange: Function,
onAfterOpenChange: Function,
/** @deprecated Please use `onUpdate:open` instead */
"onUpdate:visible": Function,
"onUpdate:open": Function,
onClose: Function
});
const Drawer = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADrawer",
inheritAttrs: false,
props: initDefaultProps(drawerProps(), {
closable: true,
placement: "right",
maskClosable: true,
mask: true,
level: null,
keyboard: true,
push: defaultPushState
}),
slots: Object,
// emits: ['update:visible', 'close', 'afterVisibleChange'],
setup(props2, _ref) {
let {
emit,
slots,
attrs
} = _ref;
const sPush = shallowRef(false);
const destroyClose = shallowRef(false);
const vcDrawer = shallowRef(null);
const load = shallowRef(false);
const visible = shallowRef(false);
const mergedOpen = computed(() => {
var _a;
return (_a = props2.open) !== null && _a !== void 0 ? _a : props2.visible;
});
watch(mergedOpen, () => {
if (mergedOpen.value) {
load.value = true;
} else {
visible.value = false;
}
}, {
immediate: true
});
watch([mergedOpen, load], () => {
if (mergedOpen.value && load.value) {
visible.value = true;
}
}, {
immediate: true
});
const parentDrawerOpts = inject("parentDrawerOpts", null);
const {
prefixCls,
getPopupContainer,
direction
} = useConfigInject("drawer", props2);
const [wrapSSR, hashId] = useStyle$s(prefixCls);
const getContainer2 = computed(() => (
// 有可能为 false,所以不能直接判断
props2.getContainer === void 0 && (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value) ? () => getPopupContainer.value((void 0).body) : props2.getContainer
));
devWarning(!props2.afterVisibleChange, "Drawer", "`afterVisibleChange` prop is deprecated, please use `@afterVisibleChange` event instead");
const setPush = () => {
sPush.value = true;
};
const setPull = () => {
sPush.value = false;
nextTick(() => {
domFocus();
});
};
provide("parentDrawerOpts", {
setPush,
setPull
});
watch(visible, () => {
if (parentDrawerOpts) {
if (visible.value) {
parentDrawerOpts.setPush();
} else {
parentDrawerOpts.setPull();
}
}
}, {
flush: "post"
});
const domFocus = () => {
var _a, _b;
(_b = (_a = vcDrawer.value) === null || _a === void 0 ? void 0 : _a.domFocus) === null || _b === void 0 ? void 0 : _b.call(_a);
};
const close = (e) => {
emit("update:visible", false);
emit("update:open", false);
emit("close", e);
};
const afterVisibleChange = (open2) => {
var _a;
if (!open2) {
if (destroyClose.value === false) {
destroyClose.value = true;
}
if (props2.destroyOnClose) {
load.value = false;
}
}
(_a = props2.afterVisibleChange) === null || _a === void 0 ? void 0 : _a.call(props2, open2);
emit("afterVisibleChange", open2);
emit("afterOpenChange", open2);
};
const pushTransform = computed(() => {
const {
push,
placement
} = props2;
let distance;
if (typeof push === "boolean") {
distance = push ? defaultPushState.distance : 0;
} else {
distance = push.distance;
}
distance = parseFloat(String(distance || 0));
if (placement === "left" || placement === "right") {
return `translateX(${placement === "left" ? distance : -distance}px)`;
}
if (placement === "top" || placement === "bottom") {
return `translateY(${placement === "top" ? distance : -distance}px)`;
}
return null;
});
const mergedWidth = computed(() => {
var _a;
return (_a = props2.width) !== null && _a !== void 0 ? _a : props2.size === "large" ? 736 : 378;
});
const mergedHeight = computed(() => {
var _a;
return (_a = props2.height) !== null && _a !== void 0 ? _a : props2.size === "large" ? 736 : 378;
});
const offsetStyle = computed(() => {
const {
mask,
placement
} = props2;
if (!visible.value && !mask) {
return {};
}
const val = {};
if (placement === "left" || placement === "right") {
val.width = isNumeric(mergedWidth.value) ? `${mergedWidth.value}px` : mergedWidth.value;
} else {
val.height = isNumeric(mergedHeight.value) ? `${mergedHeight.value}px` : mergedHeight.value;
}
return val;
});
const wrapperStyle2 = computed(() => {
const {
zIndex,
contentWrapperStyle
} = props2;
const val = offsetStyle.value;
return [{
zIndex,
transform: sPush.value ? pushTransform.value : void 0
}, _extends({}, contentWrapperStyle), val];
});
const renderHeader = (prefixCls2) => {
const {
closable,
headerStyle
} = props2;
const extra = getPropsSlot(slots, props2, "extra");
const title = getPropsSlot(slots, props2, "title");
if (!title && !closable) {
return null;
}
return createVNode("div", {
"class": classNames(`${prefixCls2}-header`, {
[`${prefixCls2}-header-close-only`]: closable && !title && !extra
}),
"style": headerStyle
}, [createVNode("div", {
"class": `${prefixCls2}-header-title`
}, [renderCloseIcon(prefixCls2), title && createVNode("div", {
"class": `${prefixCls2}-title`
}, [title])]), extra && createVNode("div", {
"class": `${prefixCls2}-extra`
}, [extra])]);
};
const renderCloseIcon = (prefixCls2) => {
var _a;
const {
closable
} = props2;
const $closeIcon = slots.closeIcon ? (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots) : props2.closeIcon;
return closable && createVNode("button", {
"key": "closer",
"onClick": close,
"aria-label": "Close",
"class": `${prefixCls2}-close`
}, [$closeIcon === void 0 ? createVNode(CloseOutlined, null, null) : $closeIcon]);
};
const renderBody = (prefixCls2) => {
var _a;
if (destroyClose.value && !props2.forceRender && !load.value) {
return null;
}
const {
bodyStyle,
drawerStyle
} = props2;
return createVNode("div", {
"class": `${prefixCls2}-wrapper-body`,
"style": drawerStyle
}, [renderHeader(prefixCls2), createVNode("div", {
"key": "body",
"class": `${prefixCls2}-body`,
"style": bodyStyle
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]), renderFooter(prefixCls2)]);
};
const renderFooter = (prefixCls2) => {
const footer = getPropsSlot(slots, props2, "footer");
if (!footer) {
return null;
}
const footerClassName = `${prefixCls2}-footer`;
return createVNode("div", {
"class": footerClassName,
"style": props2.footerStyle
}, [footer]);
};
const drawerClassName = computed(() => classNames({
"no-mask": !props2.mask,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, props2.rootClassName, hashId.value));
const maskMotion = computed(() => {
return getTransitionProps(getTransitionName$1(prefixCls.value, "mask-motion"));
});
const panelMotion = (motionPlacement) => {
return getTransitionProps(getTransitionName$1(prefixCls.value, `panel-motion-${motionPlacement}`));
};
return () => {
const {
width,
height,
placement,
mask,
forceRender
} = props2, rest = __rest$H(props2, ["width", "height", "placement", "mask", "forceRender"]);
const vcDrawerProps = _extends(_extends(_extends({}, attrs), omit(rest, ["size", "closeIcon", "closable", "destroyOnClose", "drawerStyle", "headerStyle", "bodyStyle", "title", "push", "onAfterVisibleChange", "onClose", "onUpdate:visible", "onUpdate:open", "visible"])), {
forceRender,
onClose: close,
afterVisibleChange,
handler: false,
prefixCls: prefixCls.value,
open: visible.value,
showMask: mask,
placement,
ref: vcDrawer
});
return wrapSSR(createVNode(NoCompactStyle, null, {
default: () => [createVNode(DrawerWrapper, _objectSpread$W(_objectSpread$W({}, vcDrawerProps), {}, {
"maskMotion": maskMotion.value,
"motion": panelMotion,
"width": mergedWidth.value,
"height": mergedHeight.value,
"getContainer": getContainer2.value,
"rootClassName": drawerClassName.value,
"rootStyle": props2.rootStyle,
"contentWrapperStyle": wrapperStyle2.value
}), {
handler: props2.handle ? () => props2.handle : slots.handle,
default: () => renderBody(prefixCls.value)
})]
}));
};
}
});
const __nuxt_component_2$1 = withInstall(Drawer);
const floatButtonProps = () => {
return {
prefixCls: String,
description: PropTypes.any,
type: stringType("default"),
shape: stringType("circle"),
tooltip: PropTypes.any,
href: String,
target: String,
badge: objectType(),
onClick: functionType()
};
};
const floatButtonContentProps = () => {
return {
prefixCls: stringType()
};
};
const floatButtonGroupProps = () => {
return _extends(_extends({}, floatButtonProps()), {
// 包含的 Float Button
// 触发方式 (有触发方式为菜单模式)
trigger: stringType(),
// 受控展开
open: booleanType(),
// 展开收起的回调
onOpenChange: functionType(),
"onUpdate:open": functionType()
});
};
const backTopProps = () => {
return _extends(_extends({}, floatButtonProps()), {
prefixCls: String,
duration: Number,
target: functionType(),
visibilityHeight: Number,
onClick: functionType()
});
};
const FloatButtonContent = defineComponent({
compatConfig: {
MODE: 3
},
name: "AFloatButtonContent",
inheritAttrs: false,
props: floatButtonContentProps(),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
return () => {
var _a;
const {
prefixCls
} = props2;
const description = filterEmpty((_a = slots.description) === null || _a === void 0 ? void 0 : _a.call(slots));
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [attrs.class, `${prefixCls}-content`]
}), [slots.icon || description.length ? createVNode(Fragment, null, [slots.icon && createVNode("div", {
"class": `${prefixCls}-icon`
}, [slots.icon()]), description.length ? createVNode("div", {
"class": `${prefixCls}-description`
}, [description]) : null]) : createVNode("div", {
"class": `${prefixCls}-icon`
}, [createVNode(FileTextOutlined, null, null)])]);
};
}
});
const contextKey = Symbol("floatButtonGroupContext");
const useProvideFloatButtonGroupContext = (props2) => {
provide(contextKey, props2);
return props2;
};
const useInjectFloatButtonGroupContext = () => {
return inject(contextKey, {
shape: ref()
});
};
const getOffset = (radius) => {
if (radius === 0) {
return 0;
}
return radius - Math.sqrt(Math.pow(radius, 2) / 2);
};
const initFloatButtonGroupMotion = (token) => {
const {
componentCls,
floatButtonSize,
motionDurationSlow,
motionEaseInOutCirc
} = token;
const groupPrefixCls = `${componentCls}-group`;
const moveDownIn2 = new Keyframe("antFloatButtonMoveDownIn", {
"0%": {
transform: `translate3d(0, ${floatButtonSize}px, 0)`,
transformOrigin: "0 0",
opacity: 0
},
"100%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
}
});
const moveDownOut2 = new Keyframe("antFloatButtonMoveDownOut", {
"0%": {
transform: "translate3d(0, 0, 0)",
transformOrigin: "0 0",
opacity: 1
},
"100%": {
transform: `translate3d(0, ${floatButtonSize}px, 0)`,
transformOrigin: "0 0",
opacity: 0
}
});
return [{
[`${groupPrefixCls}-wrap`]: _extends({}, initMotion(`${groupPrefixCls}-wrap`, moveDownIn2, moveDownOut2, motionDurationSlow, true))
}, {
[`${groupPrefixCls}-wrap`]: {
[`
&${groupPrefixCls}-wrap-enter,
&${groupPrefixCls}-wrap-appear
`]: {
opacity: 0,
animationTimingFunction: motionEaseInOutCirc
},
[`&${groupPrefixCls}-wrap-leave`]: {
animationTimingFunction: motionEaseInOutCirc
}
}
}];
};
const floatButtonGroupStyle = (token) => {
const {
antCls,
componentCls,
floatButtonSize,
margin,
borderRadiusLG,
borderRadiusSM,
badgeOffset,
floatButtonBodyPadding
} = token;
const groupPrefixCls = `${componentCls}-group`;
return {
[groupPrefixCls]: _extends(_extends({}, resetComponent(token)), {
zIndex: 99,
display: "block",
border: "none",
position: "fixed",
width: floatButtonSize,
height: "auto",
boxShadow: "none",
minHeight: floatButtonSize,
insetInlineEnd: token.floatButtonInsetInlineEnd,
insetBlockEnd: token.floatButtonInsetBlockEnd,
borderRadius: borderRadiusLG,
[`${groupPrefixCls}-wrap`]: {
zIndex: -1,
display: "block",
position: "relative",
marginBottom: margin
},
[`&${groupPrefixCls}-rtl`]: {
direction: "rtl"
},
[componentCls]: {
position: "static"
}
}),
[`${groupPrefixCls}-circle`]: {
[`${componentCls}-circle:not(:last-child)`]: {
marginBottom: token.margin,
[`${componentCls}-body`]: {
width: floatButtonSize,
height: floatButtonSize,
borderRadius: "50%"
}
}
},
[`${groupPrefixCls}-square`]: {
[`${componentCls}-square`]: {
borderRadius: 0,
padding: 0,
"&:first-child": {
borderStartStartRadius: borderRadiusLG,
borderStartEndRadius: borderRadiusLG
},
"&:last-child": {
borderEndStartRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
},
"&:not(:last-child)": {
borderBottom: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
},
[`${antCls}-badge`]: {
[`${antCls}-badge-count`]: {
top: -(floatButtonBodyPadding + badgeOffset),
insetInlineEnd: -(floatButtonBodyPadding + badgeOffset)
}
}
},
[`${groupPrefixCls}-wrap`]: {
display: "block",
borderRadius: borderRadiusLG,
boxShadow: token.boxShadowSecondary,
[`${componentCls}-square`]: {
boxShadow: "none",
marginTop: 0,
borderRadius: 0,
padding: floatButtonBodyPadding,
"&:first-child": {
borderStartStartRadius: borderRadiusLG,
borderStartEndRadius: borderRadiusLG
},
"&:last-child": {
borderEndStartRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
},
"&:not(:last-child)": {
borderBottom: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
},
[`${componentCls}-body`]: {
width: token.floatButtonBodySize,
height: token.floatButtonBodySize
}
}
}
},
[`${groupPrefixCls}-circle-shadow`]: {
boxShadow: "none"
},
[`${groupPrefixCls}-square-shadow`]: {
boxShadow: token.boxShadowSecondary,
[`${componentCls}-square`]: {
boxShadow: "none",
padding: floatButtonBodyPadding,
[`${componentCls}-body`]: {
width: token.floatButtonBodySize,
height: token.floatButtonBodySize,
borderRadius: borderRadiusSM
}
}
}
};
};
const sharedFloatButtonStyle = (token) => {
const {
antCls,
componentCls,
floatButtonBodyPadding,
floatButtonIconSize,
floatButtonSize,
borderRadiusLG,
badgeOffset,
dotOffsetInSquare,
dotOffsetInCircle
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
border: "none",
position: "fixed",
cursor: "pointer",
zIndex: 99,
display: "block",
justifyContent: "center",
alignItems: "center",
width: floatButtonSize,
height: floatButtonSize,
insetInlineEnd: token.floatButtonInsetInlineEnd,
insetBlockEnd: token.floatButtonInsetBlockEnd,
boxShadow: token.boxShadowSecondary,
// Pure Panel
"&-pure": {
position: "relative",
inset: "auto"
},
"&:empty": {
display: "none"
},
[`${antCls}-badge`]: {
width: "100%",
height: "100%",
[`${antCls}-badge-count`]: {
transform: "translate(0, 0)",
transformOrigin: "center",
top: -badgeOffset,
insetInlineEnd: -badgeOffset
}
},
[`${componentCls}-body`]: {
width: "100%",
height: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
transition: `all ${token.motionDurationMid}`,
[`${componentCls}-content`]: {
overflow: "hidden",
textAlign: "center",
minHeight: floatButtonSize,
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
padding: `${floatButtonBodyPadding / 2}px ${floatButtonBodyPadding}px`,
[`${componentCls}-icon`]: {
textAlign: "center",
margin: "auto",
width: floatButtonIconSize,
fontSize: floatButtonIconSize,
lineHeight: 1
}
}
}
}),
[`${componentCls}-rtl`]: {
direction: "rtl"
},
[`${componentCls}-circle`]: {
height: floatButtonSize,
borderRadius: "50%",
[`${antCls}-badge`]: {
[`${antCls}-badge-dot`]: {
top: dotOffsetInCircle,
insetInlineEnd: dotOffsetInCircle
}
},
[`${componentCls}-body`]: {
borderRadius: "50%"
}
},
[`${componentCls}-square`]: {
height: "auto",
minHeight: floatButtonSize,
borderRadius: borderRadiusLG,
[`${antCls}-badge`]: {
[`${antCls}-badge-dot`]: {
top: dotOffsetInSquare,
insetInlineEnd: dotOffsetInSquare
}
},
[`${componentCls}-body`]: {
height: "auto",
borderRadius: borderRadiusLG
}
},
[`${componentCls}-default`]: {
backgroundColor: token.floatButtonBackgroundColor,
transition: `background-color ${token.motionDurationMid}`,
[`${componentCls}-body`]: {
backgroundColor: token.floatButtonBackgroundColor,
transition: `background-color ${token.motionDurationMid}`,
"&:hover": {
backgroundColor: token.colorFillContent
},
[`${componentCls}-content`]: {
[`${componentCls}-icon`]: {
color: token.colorText
},
[`${componentCls}-description`]: {
display: "flex",
alignItems: "center",
lineHeight: `${token.fontSizeLG}px`,
color: token.colorText,
fontSize: token.fontSizeSM
}
}
}
},
[`${componentCls}-primary`]: {
backgroundColor: token.colorPrimary,
[`${componentCls}-body`]: {
backgroundColor: token.colorPrimary,
transition: `background-color ${token.motionDurationMid}`,
"&:hover": {
backgroundColor: token.colorPrimaryHover
},
[`${componentCls}-content`]: {
[`${componentCls}-icon`]: {
color: token.colorTextLightSolid
},
[`${componentCls}-description`]: {
display: "flex",
alignItems: "center",
lineHeight: `${token.fontSizeLG}px`,
color: token.colorTextLightSolid,
fontSize: token.fontSizeSM
}
}
}
}
};
};
const useStyle$r = genComponentStyleHook("FloatButton", (token) => {
const {
colorTextLightSolid,
colorBgElevated,
controlHeightLG,
marginXXL,
marginLG,
fontSize,
fontSizeIcon,
controlItemBgHover,
paddingXXS,
borderRadiusLG
} = token;
const floatButtonToken = merge(token, {
floatButtonBackgroundColor: colorBgElevated,
floatButtonColor: colorTextLightSolid,
floatButtonHoverBackgroundColor: controlItemBgHover,
floatButtonFontSize: fontSize,
floatButtonIconSize: fontSizeIcon * 1.5,
floatButtonSize: controlHeightLG,
floatButtonInsetBlockEnd: marginXXL,
floatButtonInsetInlineEnd: marginLG,
floatButtonBodySize: controlHeightLG - paddingXXS * 2,
// 这里的 paddingXXS 是简写,完整逻辑是 (controlHeightLG - (controlHeightLG - paddingXXS * 2)) / 2,
floatButtonBodyPadding: paddingXXS,
badgeOffset: paddingXXS * 1.5,
dotOffsetInCircle: getOffset(controlHeightLG / 2),
dotOffsetInSquare: getOffset(borderRadiusLG)
});
return [floatButtonGroupStyle(floatButtonToken), sharedFloatButtonStyle(floatButtonToken), initFadeMotion(token), initFloatButtonGroupMotion(floatButtonToken)];
});
var __rest$G = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const floatButtonPrefixCls = "float-btn";
const FloatButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "AFloatButton",
inheritAttrs: false,
props: initDefaultProps(floatButtonProps(), {
type: "default",
shape: "circle"
}),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const {
prefixCls,
direction
} = useConfigInject(floatButtonPrefixCls, props2);
const [wrapSSR, hashId] = useStyle$r(prefixCls);
const {
shape: groupShape
} = useInjectFloatButtonGroupContext();
const floatButtonRef = ref(null);
const mergeShape = computed(() => {
return (groupShape === null || groupShape === void 0 ? void 0 : groupShape.value) || props2.shape;
});
return () => {
var _a;
const {
prefixCls: customPrefixCls,
type = "default",
shape = "circle",
description = (_a = slots.description) === null || _a === void 0 ? void 0 : _a.call(slots),
tooltip,
badge = {}
} = props2, restProps = __rest$G(props2, ["prefixCls", "type", "shape", "description", "tooltip", "badge"]);
const classString = classNames(prefixCls.value, `${prefixCls.value}-${type}`, `${prefixCls.value}-${mergeShape.value}`, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value);
const buttonNode = createVNode(__nuxt_component_2$4, {
"placement": "left"
}, {
title: slots.tooltip || tooltip ? () => slots.tooltip && slots.tooltip() || tooltip : void 0,
default: () => createVNode(Badge, badge, {
default: () => [createVNode("div", {
"class": `${prefixCls.value}-body`
}, [createVNode(FloatButtonContent, {
"prefixCls": prefixCls.value
}, {
icon: slots.icon,
description: () => description
})])]
})
});
return wrapSSR(props2.href ? createVNode("a", _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": floatButtonRef
}, attrs), restProps), {}, {
"class": classString
}), [buttonNode]) : createVNode("button", _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": floatButtonRef
}, attrs), restProps), {}, {
"class": classString,
"type": "button"
}), [buttonNode]));
};
}
});
const FloatButtonGroup = defineComponent({
compatConfig: {
MODE: 3
},
name: "AFloatButtonGroup",
inheritAttrs: false,
props: initDefaultProps(floatButtonGroupProps(), {
type: "default",
shape: "circle"
}),
setup(props2, _ref) {
let {
attrs,
slots,
emit
} = _ref;
const {
prefixCls,
direction
} = useConfigInject(floatButtonPrefixCls, props2);
const [wrapSSR, hashId] = useStyle$r(prefixCls);
const [open2, setOpen] = useMergedState(false, {
value: computed(() => props2.open)
});
const floatButtonGroupRef = ref(null);
const floatButtonRef = ref(null);
useProvideFloatButtonGroupContext({
shape: computed(() => props2.shape)
});
const hoverTypeAction = {
onMouseenter() {
var _a;
setOpen(true);
emit("update:open", true);
(_a = props2.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(props2, true);
},
onMouseleave() {
var _a;
setOpen(false);
emit("update:open", false);
(_a = props2.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(props2, false);
}
};
const hoverAction = computed(() => {
return props2.trigger === "hover" ? hoverTypeAction : {};
});
watch(computed(() => props2.trigger), (value) => {
{
return;
}
}, {
immediate: true
});
return () => {
var _a;
const {
shape = "circle",
type = "default",
tooltip,
description,
trigger
} = props2;
const groupPrefixCls = `${prefixCls.value}-group`;
const groupCls = classNames(groupPrefixCls, hashId.value, attrs.class, {
[`${groupPrefixCls}-rtl`]: direction.value === "rtl",
[`${groupPrefixCls}-${shape}`]: shape,
[`${groupPrefixCls}-${shape}-shadow`]: !trigger
});
const wrapperCls = classNames(hashId.value, `${groupPrefixCls}-wrap`);
const transitionProps = getTransitionProps(`${groupPrefixCls}-wrap`);
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({
"ref": floatButtonGroupRef
}, attrs), {}, {
"class": groupCls
}, hoverAction.value), [trigger && ["click", "hover"].includes(trigger) ? createVNode(Fragment, null, [createVNode(Transition, transitionProps, {
default: () => [withDirectives(createVNode("div", {
"class": wrapperCls
}, [slots.default && slots.default()]), [[vShow, open2.value]])]
}), createVNode(FloatButton, {
"ref": floatButtonRef,
"type": type,
"shape": shape,
"tooltip": tooltip,
"description": description
}, {
icon: () => {
var _a2, _b;
return open2.value ? ((_a2 = slots.closeIcon) === null || _a2 === void 0 ? void 0 : _a2.call(slots)) || createVNode(CloseOutlined, null, null) : ((_b = slots.icon) === null || _b === void 0 ? void 0 : _b.call(slots)) || createVNode(FileTextOutlined, null, null);
},
tooltip: slots.tooltip,
description: slots.description
})]) : (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]));
};
}
});
const BackTop = defineComponent({
compatConfig: {
MODE: 3
},
name: "ABackTop",
inheritAttrs: false,
props: initDefaultProps(backTopProps(), {
visibilityHeight: 400,
target: () => void 0,
duration: 450,
type: "default",
shape: "circle"
}),
// emits: ['click'],
setup(props2, _ref) {
let {
slots,
attrs,
emit
} = _ref;
const {
prefixCls,
direction
} = useConfigInject(floatButtonPrefixCls, props2);
const [wrapSSR] = useStyle$r(prefixCls);
const domRef = ref();
const state = reactive({
visible: props2.visibilityHeight === 0,
scrollEvent: null
});
const getDefaultTarget2 = () => domRef.value && domRef.value.ownerDocument ? domRef.value.ownerDocument : void 0;
const scrollToTop = (e) => {
const {
target = getDefaultTarget2,
duration
} = props2;
scrollTo$1(0, {
getContainer: target,
duration
});
emit("click", e);
};
const handleScroll = throttleByAnimationFrame((e) => {
const {
visibilityHeight
} = props2;
const scrollTop = getScroll$2(e.target);
state.visible = scrollTop >= visibilityHeight;
});
const bindScrollEvent = () => {
const {
target
} = props2;
const getTarget = target || getDefaultTarget2;
const container = getTarget();
handleScroll({
target: container
});
container === null || container === void 0 ? void 0 : container.addEventListener("scroll", handleScroll);
};
const scrollRemove = () => {
const {
target
} = props2;
const getTarget = target || getDefaultTarget2;
const container = getTarget();
handleScroll.cancel();
container === null || container === void 0 ? void 0 : container.removeEventListener("scroll", handleScroll);
};
watch(() => props2.target, () => {
scrollRemove();
nextTick(() => {
bindScrollEvent();
});
});
const floatButtonGroupContext = useInjectFloatButtonGroupContext();
return () => {
const {
description,
type,
shape,
tooltip,
badge
} = props2;
const floatButtonProps2 = _extends(_extends({}, attrs), {
shape: (floatButtonGroupContext === null || floatButtonGroupContext === void 0 ? void 0 : floatButtonGroupContext.shape.value) || shape,
onClick: scrollToTop,
class: {
[`${prefixCls.value}`]: true,
[`${attrs.class}`]: attrs.class,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
},
description,
type,
tooltip,
badge
});
const transitionProps = getTransitionProps("fade");
return wrapSSR(createVNode(Transition, transitionProps, {
default: () => [withDirectives(createVNode(FloatButton, _objectSpread$W(_objectSpread$W({}, floatButtonProps2), {}, {
"ref": domRef
}), {
icon: () => {
var _a;
return ((_a = slots.icon) === null || _a === void 0 ? void 0 : _a.call(slots)) || createVNode(VerticalAlignTopOutlined, null, null);
}
}), [[vShow, state.visible]])]
}));
};
}
});
FloatButton.Group = FloatButtonGroup;
FloatButton.BackTop = BackTop;
FloatButton.install = function(app) {
app.component(FloatButton.name, FloatButton);
app.component(FloatButtonGroup.name, FloatButtonGroup);
app.component(BackTop.name, BackTop);
return app;
};
const isValid$1 = (value) => {
return value !== void 0 && value !== null && (Array.isArray(value) ? filterEmpty(value).length : true);
};
function hasPrefixSuffix(propsAndSlots) {
return isValid$1(propsAndSlots.prefix) || isValid$1(propsAndSlots.suffix) || isValid$1(propsAndSlots.allowClear);
}
function hasAddon$1(propsAndSlots) {
return isValid$1(propsAndSlots.addonBefore) || isValid$1(propsAndSlots.addonAfter);
}
function fixControlledValue(value) {
if (typeof value === "undefined" || value === null) {
return "";
}
return String(value);
}
function resolveOnChange(target, e, onChange, targetValue) {
if (!onChange) {
return;
}
const event = e;
if (e.type === "click") {
Object.defineProperty(event, "target", {
writable: true
});
Object.defineProperty(event, "currentTarget", {
writable: true
});
const currentTarget = target.cloneNode(true);
event.target = currentTarget;
event.currentTarget = currentTarget;
currentTarget.value = "";
onChange(event);
return;
}
if (targetValue !== void 0) {
Object.defineProperty(event, "target", {
writable: true
});
Object.defineProperty(event, "currentTarget", {
writable: true
});
event.target = target;
event.currentTarget = target;
target.value = targetValue;
onChange(event);
return;
}
onChange(event);
}
function triggerFocus(element, option) {
if (!element) return;
element.focus(option);
const {
cursor
} = option || {};
if (cursor) {
const len = element.value.length;
switch (cursor) {
case "start":
element.setSelectionRange(0, 0);
break;
case "end":
element.setSelectionRange(len, len);
break;
default:
element.setSelectionRange(0, len);
}
}
}
const commonInputProps = () => {
return {
addonBefore: PropTypes.any,
addonAfter: PropTypes.any,
prefix: PropTypes.any,
suffix: PropTypes.any,
clearIcon: PropTypes.any,
affixWrapperClassName: String,
groupClassName: String,
wrapperClassName: String,
inputClassName: String,
allowClear: {
type: Boolean,
default: void 0
}
};
};
const baseInputProps = () => {
return _extends(_extends({}, commonInputProps()), {
value: {
type: [String, Number, Symbol],
default: void 0
},
defaultValue: {
type: [String, Number, Symbol],
default: void 0
},
inputElement: PropTypes.any,
prefixCls: String,
disabled: {
type: Boolean,
default: void 0
},
focused: {
type: Boolean,
default: void 0
},
triggerFocus: Function,
readonly: {
type: Boolean,
default: void 0
},
handleReset: Function,
hidden: {
type: Boolean,
default: void 0
}
});
};
const inputProps$1 = () => _extends(_extends({}, baseInputProps()), {
id: String,
placeholder: {
type: [String, Number]
},
autocomplete: String,
type: stringType("text"),
name: String,
size: {
type: String
},
autofocus: {
type: Boolean,
default: void 0
},
lazy: {
type: Boolean,
default: true
},
maxlength: Number,
loading: {
type: Boolean,
default: void 0
},
bordered: {
type: Boolean,
default: void 0
},
showCount: {
type: [Boolean, Object]
},
htmlSize: Number,
onPressEnter: Function,
onKeydown: Function,
onKeyup: Function,
onFocus: Function,
onBlur: Function,
onChange: Function,
onInput: Function,
"onUpdate:value": Function,
onCompositionstart: Function,
onCompositionend: Function,
valueModifiers: Object,
hidden: {
type: Boolean,
default: void 0
},
status: String
});
const BaseInput = defineComponent({
name: "BaseInput",
inheritAttrs: false,
props: baseInputProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const containerRef = ref();
const onInputMouseDown = (e) => {
var _a;
if ((_a = containerRef.value) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {
const {
triggerFocus: triggerFocus2
} = props2;
triggerFocus2 === null || triggerFocus2 === void 0 ? void 0 : triggerFocus2();
}
};
const getClearIcon = () => {
var _a;
const {
allowClear,
value,
disabled,
readonly,
handleReset,
suffix = slots.suffix,
prefixCls
} = props2;
if (!allowClear) {
return null;
}
const needClear = !disabled && !readonly && value;
const className = `${prefixCls}-clear-icon`;
const iconNode = ((_a = slots.clearIcon) === null || _a === void 0 ? void 0 : _a.call(slots)) || "*";
return createVNode("span", {
"onClick": handleReset,
"onMousedown": (e) => e.preventDefault(),
"class": classNames({
[`${className}-hidden`]: !needClear,
[`${className}-has-suffix`]: !!suffix
}, className),
"role": "button",
"tabindex": -1
}, [iconNode]);
};
return () => {
var _a, _b;
const {
focused,
value,
disabled,
allowClear,
readonly,
hidden,
prefixCls,
prefix = (_a = slots.prefix) === null || _a === void 0 ? void 0 : _a.call(slots),
suffix = (_b = slots.suffix) === null || _b === void 0 ? void 0 : _b.call(slots),
addonAfter = slots.addonAfter,
addonBefore = slots.addonBefore,
inputElement,
affixWrapperClassName,
wrapperClassName,
groupClassName
} = props2;
let element = cloneElement(inputElement, {
value,
hidden
});
if (hasPrefixSuffix({
prefix,
suffix,
allowClear
})) {
const affixWrapperPrefixCls = `${prefixCls}-affix-wrapper`;
const affixWrapperCls = classNames(affixWrapperPrefixCls, {
[`${affixWrapperPrefixCls}-disabled`]: disabled,
[`${affixWrapperPrefixCls}-focused`]: focused,
[`${affixWrapperPrefixCls}-readonly`]: readonly,
[`${affixWrapperPrefixCls}-input-with-clear-btn`]: suffix && allowClear && value
}, !hasAddon$1({
addonAfter,
addonBefore
}) && attrs.class, affixWrapperClassName);
const suffixNode = (suffix || allowClear) && createVNode("span", {
"class": `${prefixCls}-suffix`
}, [getClearIcon(), suffix]);
element = createVNode("span", {
"class": affixWrapperCls,
"style": attrs.style,
"hidden": !hasAddon$1({
addonAfter,
addonBefore
}) && hidden,
"onMousedown": onInputMouseDown,
"ref": containerRef
}, [prefix && createVNode("span", {
"class": `${prefixCls}-prefix`
}, [prefix]), cloneElement(inputElement, {
style: null,
value,
hidden: null
}), suffixNode]);
}
if (hasAddon$1({
addonAfter,
addonBefore
})) {
const wrapperCls = `${prefixCls}-group`;
const addonCls = `${wrapperCls}-addon`;
const mergedWrapperClassName = classNames(`${prefixCls}-wrapper`, wrapperCls, wrapperClassName);
const mergedGroupClassName = classNames(`${prefixCls}-group-wrapper`, attrs.class, groupClassName);
return createVNode("span", {
"class": mergedGroupClassName,
"style": attrs.style,
"hidden": hidden
}, [createVNode("span", {
"class": mergedWrapperClassName
}, [addonBefore && createVNode("span", {
"class": addonCls
}, [addonBefore]), cloneElement(element, {
style: null,
hidden: null
}), addonAfter && createVNode("span", {
"class": addonCls
}, [addonAfter])])]);
}
return element;
};
}
});
var __rest$F = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const VcInput = defineComponent({
name: "VCInput",
inheritAttrs: false,
props: inputProps$1(),
setup(props2, _ref) {
let {
slots,
attrs,
expose,
emit
} = _ref;
const stateValue = shallowRef(props2.value === void 0 ? props2.defaultValue : props2.value);
const focused = shallowRef(false);
const inputRef = shallowRef();
const rootRef = shallowRef();
watch(() => props2.value, () => {
stateValue.value = props2.value;
});
watch(() => props2.disabled, () => {
if (props2.disabled) {
focused.value = false;
}
});
const focus = (option) => {
if (inputRef.value) {
triggerFocus(inputRef.value.input, option);
}
};
const blur = () => {
var _a;
(_a = inputRef.value.input) === null || _a === void 0 ? void 0 : _a.blur();
};
const setSelectionRange = (start, end, direction) => {
var _a;
(_a = inputRef.value.input) === null || _a === void 0 ? void 0 : _a.setSelectionRange(start, end, direction);
};
const select = () => {
var _a;
(_a = inputRef.value.input) === null || _a === void 0 ? void 0 : _a.select();
};
expose({
focus,
blur,
input: computed(() => {
var _a;
return (_a = inputRef.value.input) === null || _a === void 0 ? void 0 : _a.input;
}),
stateValue,
setSelectionRange,
select
});
const triggerChange = (e) => {
emit("change", e);
};
const setValue2 = (value, callback) => {
if (stateValue.value === value) {
return;
}
if (props2.value === void 0) {
stateValue.value = value;
} else {
nextTick(() => {
var _a;
if (inputRef.value.input.value !== stateValue.value) {
(_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.$forceUpdate();
}
});
}
nextTick(() => {
callback && callback();
});
};
const handleChange = (e) => {
const {
value
} = e.target;
if (stateValue.value === value) return;
const newVal = e.target.value;
resolveOnChange(inputRef.value.input, e, triggerChange);
setValue2(newVal);
};
const handleKeyDown = (e) => {
if (e.keyCode === 13) {
emit("pressEnter", e);
}
emit("keydown", e);
};
const handleFocus = (e) => {
focused.value = true;
emit("focus", e);
};
const handleBlur = (e) => {
focused.value = false;
emit("blur", e);
};
const handleReset = (e) => {
resolveOnChange(inputRef.value.input, e, triggerChange);
setValue2("", () => {
focus();
});
};
const getInputElement = () => {
var _a, _b;
const {
addonBefore = slots.addonBefore,
addonAfter = slots.addonAfter,
disabled,
valueModifiers = {},
htmlSize,
autocomplete,
prefixCls,
inputClassName,
prefix = (_a = slots.prefix) === null || _a === void 0 ? void 0 : _a.call(slots),
suffix = (_b = slots.suffix) === null || _b === void 0 ? void 0 : _b.call(slots),
allowClear,
type = "text"
} = props2;
const otherProps = omit(props2, [
"prefixCls",
"onPressEnter",
"addonBefore",
"addonAfter",
"prefix",
"suffix",
"allowClear",
// Input elements must be either controlled or uncontrolled,
// specify either the value prop, or the defaultValue prop, but not both.
"defaultValue",
"size",
"bordered",
"htmlSize",
"lazy",
"showCount",
"valueModifiers",
"showCount",
"affixWrapperClassName",
"groupClassName",
"inputClassName",
"wrapperClassName"
]);
const inputProps2 = _extends(_extends(_extends({}, otherProps), attrs), {
autocomplete,
onChange: handleChange,
onInput: handleChange,
onFocus: handleFocus,
onBlur: handleBlur,
onKeydown: handleKeyDown,
class: classNames(prefixCls, {
[`${prefixCls}-disabled`]: disabled
}, inputClassName, !hasAddon$1({
addonAfter,
addonBefore
}) && !hasPrefixSuffix({
prefix,
suffix,
allowClear
}) && attrs.class),
ref: inputRef,
key: "ant-input",
size: htmlSize,
type,
lazy: props2.lazy
});
if (valueModifiers.lazy) {
delete inputProps2.onInput;
}
if (!inputProps2.autofocus) {
delete inputProps2.autofocus;
}
const inputNode = createVNode(BaseInput$1, omit(inputProps2, ["size"]), null);
return inputNode;
};
const getSuffix = () => {
var _a;
const {
maxlength,
suffix = (_a = slots.suffix) === null || _a === void 0 ? void 0 : _a.call(slots),
showCount,
prefixCls
} = props2;
const hasMaxLength = Number(maxlength) > 0;
if (suffix || showCount) {
const valueLength = [...fixControlledValue(stateValue.value)].length;
const dataCount = typeof showCount === "object" ? showCount.formatter({
count: valueLength,
maxlength
}) : `${valueLength}${hasMaxLength ? ` / ${maxlength}` : ""}`;
return createVNode(Fragment, null, [!!showCount && createVNode("span", {
"class": classNames(`${prefixCls}-show-count-suffix`, {
[`${prefixCls}-show-count-has-suffix`]: !!suffix
})
}, [dataCount]), suffix]);
}
return null;
};
return () => {
const {
prefixCls,
disabled
} = props2, rest = __rest$F(props2, ["prefixCls", "disabled"]);
return createVNode(BaseInput, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, rest), attrs), {}, {
"ref": rootRef,
"prefixCls": prefixCls,
"inputElement": getInputElement(),
"handleReset": handleReset,
"value": fixControlledValue(stateValue.value),
"focused": focused.value,
"triggerFocus": focus,
"suffix": getSuffix(),
"disabled": disabled
}), slots);
};
}
});
const inputProps = () => {
return omit(inputProps$1(), ["wrapperClassName", "groupClassName", "inputClassName", "affixWrapperClassName"]);
};
const textAreaProps = () => _extends(_extends({}, omit(inputProps(), ["prefix", "addonBefore", "addonAfter", "suffix"])), {
rows: Number,
autosize: {
type: [Boolean, Object],
default: void 0
},
autoSize: {
type: [Boolean, Object],
default: void 0
},
onResize: {
type: Function
},
onCompositionstart: eventType(),
onCompositionend: eventType(),
valueModifiers: Object
});
var __rest$E = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Input = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInput",
inheritAttrs: false,
props: inputProps(),
setup(props2, _ref) {
let {
slots,
attrs,
expose,
emit
} = _ref;
const inputRef = ref();
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
const {
direction,
prefixCls,
size,
autocomplete
} = useConfigInject("input", props2);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => {
return compactSize.value || size.value;
});
const [wrapSSR, hashId] = useStyle$K(prefixCls);
const disabled = useInjectDisabled();
const focus = (option) => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.focus(option);
};
const blur = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
const setSelectionRange = (start, end, direction2) => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.setSelectionRange(start, end, direction2);
};
const select = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.select();
};
expose({
focus,
blur,
input: inputRef,
setSelectionRange,
select
});
const removePasswordTimeoutRef = ref([]);
const removePasswordTimeout = () => {
removePasswordTimeoutRef.value.push(setTimeout(() => {
var _a, _b, _c, _d;
if (((_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.input) && ((_b = inputRef.value) === null || _b === void 0 ? void 0 : _b.input.getAttribute("type")) === "password" && ((_c = inputRef.value) === null || _c === void 0 ? void 0 : _c.input.hasAttribute("value"))) {
(_d = inputRef.value) === null || _d === void 0 ? void 0 : _d.input.removeAttribute("value");
}
}));
};
const handleBlur = (e) => {
removePasswordTimeout();
emit("blur", e);
formItemContext.onFieldBlur();
};
const handleFocus = (e) => {
removePasswordTimeout();
emit("focus", e);
};
const triggerChange = (e) => {
emit("update:value", e.target.value);
emit("change", e);
emit("input", e);
formItemContext.onFieldChange();
};
return () => {
var _a, _b, _c, _d, _e, _f;
const {
hasFeedback,
feedbackIcon
} = formItemInputContext;
const {
allowClear,
bordered = true,
prefix = (_a = slots.prefix) === null || _a === void 0 ? void 0 : _a.call(slots),
suffix = (_b = slots.suffix) === null || _b === void 0 ? void 0 : _b.call(slots),
addonAfter = (_c = slots.addonAfter) === null || _c === void 0 ? void 0 : _c.call(slots),
addonBefore = (_d = slots.addonBefore) === null || _d === void 0 ? void 0 : _d.call(slots),
id = (_e = formItemContext.id) === null || _e === void 0 ? void 0 : _e.value
} = props2, rest = __rest$E(props2, ["allowClear", "bordered", "prefix", "suffix", "addonAfter", "addonBefore", "id"]);
const suffixNode = (hasFeedback || suffix) && createVNode(Fragment, null, [suffix, hasFeedback && feedbackIcon]);
const prefixClsValue = prefixCls.value;
const inputHasPrefixSuffix = hasPrefixSuffix({
prefix,
suffix
}) || !!hasFeedback;
const clearIcon = slots.clearIcon || (() => createVNode(CloseCircleFilled, null, null));
return wrapSSR(createVNode(VcInput, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), omit(rest, ["onUpdate:value", "onChange", "onInput"])), {}, {
"onChange": triggerChange,
"id": id,
"disabled": (_f = props2.disabled) !== null && _f !== void 0 ? _f : disabled.value,
"ref": inputRef,
"prefixCls": prefixClsValue,
"autocomplete": autocomplete.value,
"onBlur": handleBlur,
"onFocus": handleFocus,
"prefix": prefix,
"suffix": suffixNode,
"allowClear": allowClear,
"addonAfter": addonAfter && createVNode(NoCompactStyle, null, {
default: () => [createVNode(NoFormStatus, null, {
default: () => [addonAfter]
})]
}),
"addonBefore": addonBefore && createVNode(NoCompactStyle, null, {
default: () => [createVNode(NoFormStatus, null, {
default: () => [addonBefore]
})]
}),
"class": [attrs.class, compactItemClassnames.value],
"inputClassName": classNames({
[`${prefixClsValue}-sm`]: mergedSize.value === "small",
[`${prefixClsValue}-lg`]: mergedSize.value === "large",
[`${prefixClsValue}-rtl`]: direction.value === "rtl",
[`${prefixClsValue}-borderless`]: !bordered
}, !inputHasPrefixSuffix && getStatusClassNames(prefixClsValue, mergedStatus.value), hashId.value),
"affixWrapperClassName": classNames({
[`${prefixClsValue}-affix-wrapper-sm`]: mergedSize.value === "small",
[`${prefixClsValue}-affix-wrapper-lg`]: mergedSize.value === "large",
[`${prefixClsValue}-affix-wrapper-rtl`]: direction.value === "rtl",
[`${prefixClsValue}-affix-wrapper-borderless`]: !bordered
}, getStatusClassNames(`${prefixClsValue}-affix-wrapper`, mergedStatus.value, hasFeedback), hashId.value),
"wrapperClassName": classNames({
[`${prefixClsValue}-group-rtl`]: direction.value === "rtl"
}, hashId.value),
"groupClassName": classNames({
[`${prefixClsValue}-group-wrapper-sm`]: mergedSize.value === "small",
[`${prefixClsValue}-group-wrapper-lg`]: mergedSize.value === "large",
[`${prefixClsValue}-group-wrapper-rtl`]: direction.value === "rtl"
}, getStatusClassNames(`${prefixClsValue}-group-wrapper`, mergedStatus.value, hasFeedback), hashId.value)
}), _extends(_extends({}, slots), {
clearIcon
})));
};
}
});
const Group$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputGroup",
inheritAttrs: false,
props: {
prefixCls: String,
size: {
type: String
},
compact: {
type: Boolean,
default: void 0
}
},
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction,
getPrefixCls
} = useConfigInject("input-group", props2);
const formItemInputContext = FormItemInputContext.useInject();
FormItemInputContext.useProvide(formItemInputContext, {
isFormItemInput: false
});
const inputPrefixCls = computed(() => getPrefixCls("input"));
const [wrapSSR, hashId] = useStyle$K(inputPrefixCls);
const cls = computed(() => {
const pre = prefixCls.value;
return {
[`${pre}`]: true,
[hashId.value]: true,
[`${pre}-lg`]: props2.size === "large",
[`${pre}-sm`]: props2.size === "small",
[`${pre}-compact`]: props2.compact,
[`${pre}-rtl`]: direction.value === "rtl"
};
});
return () => {
var _a;
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(cls.value, attrs.class)
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]));
};
}
});
var __rest$D = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Search$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputSearch",
inheritAttrs: false,
props: _extends(_extends({}, inputProps()), {
inputPrefixCls: String,
// 不能设置默认值 https://github.com/vueComponent/ant-design-vue/issues/1916
enterButton: PropTypes.any,
onSearch: {
type: Function
}
}),
setup(props2, _ref) {
let {
slots,
attrs,
expose,
emit
} = _ref;
const inputRef = shallowRef();
const composedRef = shallowRef(false);
const focus = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
expose({
focus,
blur
});
const onChange = (e) => {
emit("update:value", e.target.value);
if (e && e.target && e.type === "click") {
emit("search", e.target.value, e);
}
emit("change", e);
};
const onMousedown = (e) => {
var _a;
if ((void 0).activeElement === ((_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.input)) {
e.preventDefault();
}
};
const onSearch = (e) => {
var _a, _b;
emit("search", (_b = (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.input) === null || _b === void 0 ? void 0 : _b.stateValue, e);
};
const onPressEnter = (e) => {
if (composedRef.value || props2.loading) {
return;
}
onSearch(e);
};
const handleOnCompositionStart = (e) => {
composedRef.value = true;
emit("compositionstart", e);
};
const handleOnCompositionEnd = (e) => {
composedRef.value = false;
emit("compositionend", e);
};
const {
prefixCls,
getPrefixCls,
direction,
size
} = useConfigInject("input-search", props2);
const inputPrefixCls = computed(() => getPrefixCls("input", props2.inputPrefixCls));
return () => {
var _a, _b, _c, _d;
const {
disabled,
loading: loading2,
addonAfter = (_a = slots.addonAfter) === null || _a === void 0 ? void 0 : _a.call(slots),
suffix = (_b = slots.suffix) === null || _b === void 0 ? void 0 : _b.call(slots)
} = props2, restProps = __rest$D(props2, ["disabled", "loading", "addonAfter", "suffix"]);
let {
enterButton = (_d = (_c = slots.enterButton) === null || _c === void 0 ? void 0 : _c.call(slots)) !== null && _d !== void 0 ? _d : false
} = props2;
enterButton = enterButton || enterButton === "";
const searchIcon = typeof enterButton === "boolean" ? createVNode(SearchOutlined, null, null) : null;
const btnClassName = `${prefixCls.value}-button`;
const enterButtonAsElement = Array.isArray(enterButton) ? enterButton[0] : enterButton;
let button;
const isAntdButton = enterButtonAsElement.type && isPlainObject(enterButtonAsElement.type) && enterButtonAsElement.type.__ANT_BUTTON;
if (isAntdButton || enterButtonAsElement.tagName === "button") {
button = cloneElement(enterButtonAsElement, _extends({
onMousedown,
onClick: onSearch,
key: "enterButton"
}, isAntdButton ? {
class: btnClassName,
size: size.value
} : {}), false);
} else {
const iconOnly = searchIcon && !enterButton;
button = createVNode(Button, {
"class": btnClassName,
"type": enterButton ? "primary" : void 0,
"size": size.value,
"disabled": disabled,
"key": "enterButton",
"onMousedown": onMousedown,
"onClick": onSearch,
"loading": loading2,
"icon": iconOnly ? searchIcon : null
}, {
default: () => [iconOnly ? null : searchIcon || enterButton]
});
}
if (addonAfter) {
button = [button, addonAfter];
}
const cls = classNames(prefixCls.value, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-${size.value}`]: !!size.value,
[`${prefixCls.value}-with-button`]: !!enterButton
}, attrs.class);
return createVNode(Input, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": inputRef
}, omit(restProps, ["onUpdate:value", "onSearch", "enterButton"])), attrs), {}, {
"onPressEnter": onPressEnter,
"onCompositionstart": handleOnCompositionStart,
"onCompositionend": handleOnCompositionEnd,
"size": size.value,
"prefixCls": inputPrefixCls.value,
"addonAfter": button,
"suffix": suffix,
"onChange": onChange,
"class": cls,
"disabled": disabled
}), slots);
};
}
});
const isValid = (value) => {
return value !== void 0 && value !== null && (Array.isArray(value) ? filterEmpty(value).length : true);
};
function hasAddon(propsAndSlots) {
return isValid(propsAndSlots.addonBefore) || isValid(propsAndSlots.addonAfter);
}
const ClearableInputType = ["text", "input"];
const ClearableLabeledInput = defineComponent({
compatConfig: {
MODE: 3
},
name: "ClearableLabeledInput",
inheritAttrs: false,
props: {
prefixCls: String,
inputType: PropTypes.oneOf(tuple$1("text", "input")),
value: anyType(),
defaultValue: anyType(),
allowClear: {
type: Boolean,
default: void 0
},
element: anyType(),
handleReset: Function,
disabled: {
type: Boolean,
default: void 0
},
direction: {
type: String
},
size: {
type: String
},
suffix: anyType(),
prefix: anyType(),
addonBefore: anyType(),
addonAfter: anyType(),
readonly: {
type: Boolean,
default: void 0
},
focused: {
type: Boolean,
default: void 0
},
bordered: {
type: Boolean,
default: true
},
triggerFocus: {
type: Function
},
hidden: Boolean,
status: String,
hashId: String
},
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const statusContext = FormItemInputContext.useInject();
const renderClearIcon = (prefixCls) => {
const {
value,
disabled,
readonly,
handleReset,
suffix = slots.suffix
} = props2;
const needClear = !disabled && !readonly && value;
const className = `${prefixCls}-clear-icon`;
return createVNode(CloseCircleFilled, {
"onClick": handleReset,
"onMousedown": (e) => e.preventDefault(),
"class": classNames({
[`${className}-hidden`]: !needClear,
[`${className}-has-suffix`]: !!suffix
}, className),
"role": "button"
}, null);
};
const renderTextAreaWithClearIcon = (prefixCls, element) => {
const {
value,
allowClear,
direction,
bordered,
hidden,
status: customStatus,
addonAfter = slots.addonAfter,
addonBefore = slots.addonBefore,
hashId
} = props2;
const {
status: contextStatus,
hasFeedback
} = statusContext;
if (!allowClear) {
return cloneElement(element, {
value,
disabled: props2.disabled
});
}
const affixWrapperCls = classNames(`${prefixCls}-affix-wrapper`, `${prefixCls}-affix-wrapper-textarea-with-clear-btn`, getStatusClassNames(`${prefixCls}-affix-wrapper`, getMergedStatus(contextStatus, customStatus), hasFeedback), {
[`${prefixCls}-affix-wrapper-rtl`]: direction === "rtl",
[`${prefixCls}-affix-wrapper-borderless`]: !bordered,
// className will go to addon wrapper
[`${attrs.class}`]: !hasAddon({
addonAfter,
addonBefore
}) && attrs.class
}, hashId);
return createVNode("span", {
"class": affixWrapperCls,
"style": attrs.style,
"hidden": hidden
}, [cloneElement(element, {
style: null,
value,
disabled: props2.disabled
}), renderClearIcon(prefixCls)]);
};
return () => {
var _a;
const {
prefixCls,
inputType,
element = (_a = slots.element) === null || _a === void 0 ? void 0 : _a.call(slots)
} = props2;
if (inputType === ClearableInputType[0]) {
return renderTextAreaWithClearIcon(prefixCls, element);
}
return null;
};
}
});
const HIDDEN_TEXTAREA_STYLE = `
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
pointer-events: none !important;
`;
const SIZING_STYLE = ["letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "font-variant", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing", "word-break", "white-space"];
const computedStyleCache = {};
let hiddenTextarea;
function calculateNodeStyling(node) {
let useCache2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const nodeRef = node.getAttribute("id") || node.getAttribute("data-reactid") || node.getAttribute("name");
if (useCache2 && computedStyleCache[nodeRef]) {
return computedStyleCache[nodeRef];
}
const style = (void 0).getComputedStyle(node);
const boxSizing = style.getPropertyValue("box-sizing") || style.getPropertyValue("-moz-box-sizing") || style.getPropertyValue("-webkit-box-sizing");
const paddingSize = parseFloat(style.getPropertyValue("padding-bottom")) + parseFloat(style.getPropertyValue("padding-top"));
const borderSize = parseFloat(style.getPropertyValue("border-bottom-width")) + parseFloat(style.getPropertyValue("border-top-width"));
const sizingStyle = SIZING_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
const nodeInfo = {
sizingStyle,
paddingSize,
borderSize,
boxSizing
};
if (useCache2 && nodeRef) {
computedStyleCache[nodeRef] = nodeInfo;
}
return nodeInfo;
}
function calculateAutoSizeStyle(uiTextNode) {
let useCache2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
let minRows = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
let maxRows = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
if (!hiddenTextarea) {
hiddenTextarea = (void 0).createElement("textarea");
hiddenTextarea.setAttribute("tab-index", "-1");
hiddenTextarea.setAttribute("aria-hidden", "true");
(void 0).body.appendChild(hiddenTextarea);
}
if (uiTextNode.getAttribute("wrap")) {
hiddenTextarea.setAttribute("wrap", uiTextNode.getAttribute("wrap"));
} else {
hiddenTextarea.removeAttribute("wrap");
}
const {
paddingSize,
borderSize,
boxSizing,
sizingStyle
} = calculateNodeStyling(uiTextNode, useCache2);
hiddenTextarea.setAttribute("style", `${sizingStyle};${HIDDEN_TEXTAREA_STYLE}`);
hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || "";
let minHeight = void 0;
let maxHeight = void 0;
let overflowY;
let height = hiddenTextarea.scrollHeight;
if (boxSizing === "border-box") {
height += borderSize;
} else if (boxSizing === "content-box") {
height -= paddingSize;
}
if (minRows !== null || maxRows !== null) {
hiddenTextarea.value = " ";
const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (minRows !== null) {
minHeight = singleRowHeight * minRows;
if (boxSizing === "border-box") {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
}
if (maxRows !== null) {
maxHeight = singleRowHeight * maxRows;
if (boxSizing === "border-box") {
maxHeight = maxHeight + paddingSize + borderSize;
}
overflowY = height > maxHeight ? "" : "hidden";
height = Math.min(maxHeight, height);
}
}
const style = {
height: `${height}px`,
overflowY,
resize: "none"
};
if (minHeight) {
style.minHeight = `${minHeight}px`;
}
if (maxHeight) {
style.maxHeight = `${maxHeight}px`;
}
return style;
}
const RESIZE_START = 0;
const RESIZE_MEASURING = 1;
const RESIZE_STABLE = 2;
const ResizableTextArea = defineComponent({
compatConfig: {
MODE: 3
},
name: "ResizableTextArea",
inheritAttrs: false,
props: textAreaProps(),
setup(props2, _ref) {
let {
attrs,
emit,
expose
} = _ref;
const textAreaRef = ref();
const textareaStyles = ref({});
const resizeStatus = ref(RESIZE_STABLE);
const fixFirefoxAutoScroll = () => {
try {
if (textAreaRef.value && (void 0).activeElement === textAreaRef.value.input) {
const currentStart = textAreaRef.value.getSelectionStart();
const currentEnd = textAreaRef.value.getSelectionEnd();
const scrollTop = textAreaRef.value.getScrollTop();
textAreaRef.value.setSelectionRange(currentStart, currentEnd);
textAreaRef.value.setScrollTop(scrollTop);
}
} catch (e) {
}
};
const minRows = ref();
const maxRows = ref();
watchEffect(() => {
const autoSize = props2.autoSize || props2.autosize;
if (autoSize) {
minRows.value = autoSize.minRows;
maxRows.value = autoSize.maxRows;
} else {
minRows.value = void 0;
maxRows.value = void 0;
}
});
const needAutoSize = computed(() => !!(props2.autoSize || props2.autosize));
const startResize = () => {
resizeStatus.value = RESIZE_START;
};
watch([() => props2.value, minRows, maxRows, needAutoSize], () => {
if (needAutoSize.value) {
startResize();
}
}, {
immediate: true
});
const autoSizeStyle = ref();
watch([resizeStatus, textAreaRef], () => {
if (!textAreaRef.value) return;
if (resizeStatus.value === RESIZE_START) {
resizeStatus.value = RESIZE_MEASURING;
} else if (resizeStatus.value === RESIZE_MEASURING) {
const textareaStyles2 = calculateAutoSizeStyle(textAreaRef.value.input, false, minRows.value, maxRows.value);
resizeStatus.value = RESIZE_STABLE;
autoSizeStyle.value = textareaStyles2;
} else {
fixFirefoxAutoScroll();
}
}, {
immediate: true,
flush: "post"
});
const instance = getCurrentInstance();
const resizeRafRef = ref();
const cleanRaf = () => {
wrapperRaf.cancel(resizeRafRef.value);
};
const onInternalResize = (size) => {
if (resizeStatus.value === RESIZE_STABLE) {
emit("resize", size);
if (needAutoSize.value) {
cleanRaf();
resizeRafRef.value = wrapperRaf(() => {
startResize();
});
}
}
};
const resizeTextarea = () => {
startResize();
};
expose({
resizeTextarea,
textArea: computed(() => {
var _a;
return (_a = textAreaRef.value) === null || _a === void 0 ? void 0 : _a.input;
}),
instance
});
warning(props2.autosize === void 0);
const renderTextArea = () => {
const {
prefixCls,
disabled
} = props2;
const otherProps = omit(props2, ["prefixCls", "onPressEnter", "autoSize", "autosize", "defaultValue", "allowClear", "type", "maxlength", "valueModifiers"]);
const cls = classNames(prefixCls, attrs.class, {
[`${prefixCls}-disabled`]: disabled
});
const mergedAutoSizeStyle = needAutoSize.value ? autoSizeStyle.value : null;
const style = [attrs.style, textareaStyles.value, mergedAutoSizeStyle];
const textareaProps = _extends(_extends(_extends({}, otherProps), attrs), {
style,
class: cls
});
if (resizeStatus.value === RESIZE_START || resizeStatus.value === RESIZE_MEASURING) {
style.push({
overflowX: "hidden",
overflowY: "hidden"
});
}
if (!textareaProps.autofocus) {
delete textareaProps.autofocus;
}
if (textareaProps.rows === 0) {
delete textareaProps.rows;
}
return createVNode(ResizeObserver$1, {
"onResize": onInternalResize,
"disabled": !needAutoSize.value
}, {
default: () => [createVNode(BaseInput$1, _objectSpread$W(_objectSpread$W({}, textareaProps), {}, {
"ref": textAreaRef,
"tag": "textarea"
}), null)]
});
};
return () => {
return renderTextArea();
};
}
});
function fixEmojiLength(value, maxLength) {
return [...value || ""].slice(0, maxLength).join("");
}
function setTriggerValue(isCursorInEnd, preValue, triggerValue, maxLength) {
let newTriggerValue = triggerValue;
if (isCursorInEnd) {
newTriggerValue = fixEmojiLength(triggerValue, maxLength);
} else if ([...preValue || ""].length < triggerValue.length && [...triggerValue || ""].length > maxLength) {
newTriggerValue = preValue;
}
return newTriggerValue;
}
const __nuxt_component_0$4 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATextarea",
inheritAttrs: false,
props: textAreaProps(),
setup(props2, _ref) {
let {
attrs,
expose,
emit
} = _ref;
var _a;
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
const stateValue = shallowRef((_a = props2.value) !== null && _a !== void 0 ? _a : props2.defaultValue);
const resizableTextArea = shallowRef();
const mergedValue = shallowRef("");
const {
prefixCls,
size,
direction
} = useConfigInject("input", props2);
const [wrapSSR, hashId] = useStyle$K(prefixCls);
const disabled = useInjectDisabled();
const showCount = computed(() => {
return props2.showCount === "" || props2.showCount || false;
});
const hasMaxLength = computed(() => Number(props2.maxlength) > 0);
const compositing = shallowRef(false);
const oldCompositionValueRef = shallowRef();
const oldSelectionStartRef = shallowRef(0);
const onInternalCompositionStart = (e) => {
compositing.value = true;
oldCompositionValueRef.value = mergedValue.value;
oldSelectionStartRef.value = e.currentTarget.selectionStart;
emit("compositionstart", e);
};
const onInternalCompositionEnd = (e) => {
var _a2;
compositing.value = false;
let triggerValue = e.currentTarget.value;
if (hasMaxLength.value) {
const isCursorInEnd = oldSelectionStartRef.value >= props2.maxlength + 1 || oldSelectionStartRef.value === ((_a2 = oldCompositionValueRef.value) === null || _a2 === void 0 ? void 0 : _a2.length);
triggerValue = setTriggerValue(isCursorInEnd, oldCompositionValueRef.value, triggerValue, props2.maxlength);
}
if (triggerValue !== mergedValue.value) {
setValue2(triggerValue);
resolveOnChange(e.currentTarget, e, triggerChange, triggerValue);
}
emit("compositionend", e);
};
const instance = getCurrentInstance();
watch(() => props2.value, () => {
var _a2;
if ("value" in instance.vnode.props || {}) {
stateValue.value = (_a2 = props2.value) !== null && _a2 !== void 0 ? _a2 : "";
}
});
const focus = (option) => {
var _a2;
triggerFocus((_a2 = resizableTextArea.value) === null || _a2 === void 0 ? void 0 : _a2.textArea, option);
};
const blur = () => {
var _a2, _b;
(_b = (_a2 = resizableTextArea.value) === null || _a2 === void 0 ? void 0 : _a2.textArea) === null || _b === void 0 ? void 0 : _b.blur();
};
const setValue2 = (value, callback) => {
if (stateValue.value === value) {
return;
}
if (props2.value === void 0) {
stateValue.value = value;
} else {
nextTick(() => {
var _a2, _b, _c;
if (resizableTextArea.value.textArea.value !== mergedValue.value) {
(_c = (_a2 = resizableTextArea.value) === null || _a2 === void 0 ? void 0 : (_b = _a2.instance).update) === null || _c === void 0 ? void 0 : _c.call(_b);
}
});
}
nextTick(() => {
callback && callback();
});
};
const handleKeyDown = (e) => {
if (e.keyCode === 13) {
emit("pressEnter", e);
}
emit("keydown", e);
};
const onBlur = (e) => {
const {
onBlur: onBlur2
} = props2;
onBlur2 === null || onBlur2 === void 0 ? void 0 : onBlur2(e);
formItemContext.onFieldBlur();
};
const triggerChange = (e) => {
emit("update:value", e.target.value);
emit("change", e);
emit("input", e);
formItemContext.onFieldChange();
};
const handleReset = (e) => {
resolveOnChange(resizableTextArea.value.textArea, e, triggerChange);
setValue2("", () => {
focus();
});
};
const handleChange = (e) => {
let triggerValue = e.target.value;
if (stateValue.value === triggerValue) return;
if (hasMaxLength.value) {
const target = e.target;
const isCursorInEnd = target.selectionStart >= props2.maxlength + 1 || target.selectionStart === triggerValue.length || !target.selectionStart;
triggerValue = setTriggerValue(isCursorInEnd, mergedValue.value, triggerValue, props2.maxlength);
}
resolveOnChange(e.currentTarget, e, triggerChange, triggerValue);
setValue2(triggerValue);
};
const renderTextArea = () => {
var _a2, _b;
const {
class: customClass
} = attrs;
const {
bordered = true
} = props2;
const resizeProps = _extends(_extends(_extends({}, omit(props2, ["allowClear"])), attrs), {
class: [{
[`${prefixCls.value}-borderless`]: !bordered,
[`${customClass}`]: customClass && !showCount.value,
[`${prefixCls.value}-sm`]: size.value === "small",
[`${prefixCls.value}-lg`]: size.value === "large"
}, getStatusClassNames(prefixCls.value, mergedStatus.value), hashId.value],
disabled: disabled.value,
showCount: null,
prefixCls: prefixCls.value,
onInput: handleChange,
onChange: handleChange,
onBlur,
onKeydown: handleKeyDown,
onCompositionstart: onInternalCompositionStart,
onCompositionend: onInternalCompositionEnd
});
if ((_a2 = props2.valueModifiers) === null || _a2 === void 0 ? void 0 : _a2.lazy) {
delete resizeProps.onInput;
}
return createVNode(ResizableTextArea, _objectSpread$W(_objectSpread$W({}, resizeProps), {}, {
"id": (_b = resizeProps === null || resizeProps === void 0 ? void 0 : resizeProps.id) !== null && _b !== void 0 ? _b : formItemContext.id.value,
"ref": resizableTextArea,
"maxlength": props2.maxlength,
"lazy": props2.lazy
}), null);
};
expose({
focus,
blur,
resizableTextArea
});
watchEffect(() => {
let val = fixControlledValue(stateValue.value);
if (!compositing.value && hasMaxLength.value && (props2.value === null || props2.value === void 0)) {
val = fixEmojiLength(val, props2.maxlength);
}
mergedValue.value = val;
});
return () => {
var _a2;
const {
maxlength,
bordered = true,
hidden
} = props2;
const {
style,
class: customClass
} = attrs;
const inputProps2 = _extends(_extends(_extends({}, props2), attrs), {
prefixCls: prefixCls.value,
inputType: "text",
handleReset,
direction: direction.value,
bordered,
style: showCount.value ? void 0 : style,
hashId: hashId.value,
disabled: (_a2 = props2.disabled) !== null && _a2 !== void 0 ? _a2 : disabled.value
});
let textareaNode = createVNode(ClearableLabeledInput, _objectSpread$W(_objectSpread$W({}, inputProps2), {}, {
"value": mergedValue.value,
"status": props2.status
}), {
element: renderTextArea
});
if (showCount.value || formItemInputContext.hasFeedback) {
const valueLength = [...mergedValue.value].length;
let dataCount = "";
if (typeof showCount.value === "object") {
dataCount = showCount.value.formatter({
value: mergedValue.value,
count: valueLength,
maxlength
});
} else {
dataCount = `${valueLength}${hasMaxLength.value ? ` / ${maxlength}` : ""}`;
}
textareaNode = createVNode("div", {
"hidden": hidden,
"class": classNames(`${prefixCls.value}-textarea`, {
[`${prefixCls.value}-textarea-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-textarea-show-count`]: showCount.value,
[`${prefixCls.value}-textarea-in-form-item`]: formItemInputContext.isFormItemInput
}, `${prefixCls.value}-textarea-show-count`, customClass, hashId.value),
"style": style,
"data-count": typeof dataCount !== "object" ? dataCount : void 0
}, [textareaNode, formItemInputContext.hasFeedback && createVNode("span", {
"class": `${prefixCls.value}-textarea-suffix`
}, [formItemInputContext.feedbackIcon])]);
}
return wrapSSR(textareaNode);
};
}
});
var __rest$C = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const ActionMap = {
click: "onClick",
hover: "onMouseover"
};
const defaultIconRender = (visible) => visible ? createVNode(EyeOutlined, null, null) : createVNode(EyeInvisibleOutlined, null, null);
const __nuxt_component_0$3 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputPassword",
inheritAttrs: false,
props: _extends(_extends({}, inputProps()), {
prefixCls: String,
inputPrefixCls: String,
action: {
type: String,
default: "click"
},
visibilityToggle: {
type: Boolean,
default: true
},
visible: {
type: Boolean,
default: void 0
},
"onUpdate:visible": Function,
iconRender: Function
}),
setup(props2, _ref) {
let {
slots,
attrs,
expose,
emit
} = _ref;
const visible = shallowRef(false);
const onVisibleChange = () => {
const {
disabled
} = props2;
if (disabled) {
return;
}
visible.value = !visible.value;
emit("update:visible", visible.value);
};
watchEffect(() => {
if (props2.visible !== void 0) {
visible.value = !!props2.visible;
}
});
const inputRef = shallowRef();
const focus = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
expose({
focus,
blur
});
const getIcon2 = (prefixCls2) => {
const {
action,
iconRender = slots.iconRender || defaultIconRender
} = props2;
const iconTrigger = ActionMap[action] || "";
const icon = iconRender(visible.value);
const iconProps = {
[iconTrigger]: onVisibleChange,
class: `${prefixCls2}-icon`,
key: "passwordIcon",
onMousedown: (e) => {
e.preventDefault();
},
onMouseup: (e) => {
e.preventDefault();
}
};
return cloneElement(isValidElement(icon) ? icon : createVNode("span", null, [icon]), iconProps);
};
const {
prefixCls,
getPrefixCls
} = useConfigInject("input-password", props2);
const inputPrefixCls = computed(() => getPrefixCls("input", props2.inputPrefixCls));
const renderPassword = () => {
const {
size,
visibilityToggle
} = props2, restProps = __rest$C(props2, ["size", "visibilityToggle"]);
const suffixIcon = visibilityToggle && getIcon2(prefixCls.value);
const inputClassName = classNames(prefixCls.value, attrs.class, {
[`${prefixCls.value}-${size}`]: !!size
});
const omittedProps = _extends(_extends(_extends({}, omit(restProps, ["suffix", "iconRender", "action"])), attrs), {
type: visible.value ? "text" : "password",
class: inputClassName,
prefixCls: inputPrefixCls.value,
suffix: suffixIcon
});
if (size) {
omittedProps.size = size;
}
return createVNode(Input, _objectSpread$W({
"ref": inputRef
}, omittedProps), slots);
};
return () => {
return renderPassword();
};
}
});
Input.Group = Group$1;
Input.Search = Search$1;
Input.TextArea = __nuxt_component_0$4;
Input.Password = __nuxt_component_0$3;
Input.install = function(app) {
app.component(Input.name, Input);
app.component(Input.Group.name, Input.Group);
app.component(Input.Search.name, Input.Search);
app.component(Input.TextArea.name, Input.TextArea);
app.component(Input.Password.name, Input.Password);
return app;
};
function dialogPropTypes() {
return {
keyboard: {
type: Boolean,
default: void 0
},
mask: {
type: Boolean,
default: void 0
},
afterClose: Function,
closable: {
type: Boolean,
default: void 0
},
maskClosable: {
type: Boolean,
default: void 0
},
visible: {
type: Boolean,
default: void 0
},
destroyOnClose: {
type: Boolean,
default: void 0
},
mousePosition: PropTypes.shape({
x: Number,
y: Number
}).loose,
title: PropTypes.any,
footer: PropTypes.any,
transitionName: String,
maskTransitionName: String,
animation: PropTypes.any,
maskAnimation: PropTypes.any,
wrapStyle: {
type: Object,
default: void 0
},
bodyStyle: {
type: Object,
default: void 0
},
maskStyle: {
type: Object,
default: void 0
},
prefixCls: String,
wrapClassName: String,
rootClassName: String,
width: [String, Number],
height: [String, Number],
zIndex: Number,
bodyProps: PropTypes.any,
maskProps: PropTypes.any,
wrapProps: PropTypes.any,
getContainer: PropTypes.any,
dialogStyle: {
type: Object,
default: void 0
},
dialogClass: String,
closeIcon: PropTypes.any,
forceRender: {
type: Boolean,
default: void 0
},
getOpenCount: Function,
// https://github.com/ant-design/ant-design/issues/19771
// https://github.com/react-component/dialog/issues/95
focusTriggerAfterClose: {
type: Boolean,
default: void 0
},
onClose: Function,
modalRender: Function
};
}
function getMotionName(prefixCls, transitionName2, animationName) {
let motionName = transitionName2;
if (!motionName && animationName) {
motionName = `${prefixCls}-${animationName}`;
}
return motionName;
}
let uuid$2 = -1;
function getUUID$1() {
uuid$2 += 1;
return uuid$2;
}
function getScroll$1(w, top) {
let ret = w[`page${top ? "Y" : "X"}Offset`];
const method = `scroll${top ? "Top" : "Left"}`;
if (typeof ret !== "number") {
const d = w.document;
ret = d.documentElement[method];
if (typeof ret !== "number") {
ret = d.body[method];
}
}
return ret;
}
function offset$1(el) {
const rect = el.getBoundingClientRect();
const pos = {
left: rect.left,
top: rect.top
};
const doc = el.ownerDocument;
const w = doc.defaultView || doc.parentWindow;
pos.left += getScroll$1(w);
pos.top += getScroll$1(w, true);
return pos;
}
const sentinelStyle = {
width: 0,
height: 0,
overflow: "hidden",
outline: "none"
};
const entityStyle = {
outline: "none"
};
const Content$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "DialogContent",
inheritAttrs: false,
props: _extends(_extends({}, dialogPropTypes()), {
motionName: String,
ariaId: String,
onVisibleChanged: Function,
onMousedown: Function,
onMouseup: Function
}),
setup(props2, _ref) {
let {
expose,
slots,
attrs
} = _ref;
const sentinelStartRef = ref();
const sentinelEndRef = ref();
const dialogRef = ref();
expose({
focus: () => {
var _a;
(_a = sentinelStartRef.value) === null || _a === void 0 ? void 0 : _a.focus({
preventScroll: true
});
},
changeActive: (next) => {
const {
activeElement
} = void 0;
if (next && activeElement === sentinelEndRef.value) {
sentinelStartRef.value.focus({
preventScroll: true
});
} else if (!next && activeElement === sentinelStartRef.value) {
sentinelEndRef.value.focus({
preventScroll: true
});
}
}
});
const transformOrigin = ref();
const contentStyleRef = computed(() => {
const {
width,
height
} = props2;
const contentStyle = {};
if (width !== void 0) {
contentStyle.width = typeof width === "number" ? `${width}px` : width;
}
if (height !== void 0) {
contentStyle.height = typeof height === "number" ? `${height}px` : height;
}
if (transformOrigin.value) {
contentStyle.transformOrigin = transformOrigin.value;
}
return contentStyle;
});
const onPrepare = () => {
nextTick(() => {
if (dialogRef.value) {
const elementOffset = offset$1(dialogRef.value);
transformOrigin.value = props2.mousePosition ? `${props2.mousePosition.x - elementOffset.left}px ${props2.mousePosition.y - elementOffset.top}px` : "";
}
});
};
const onVisibleChanged = (visible) => {
props2.onVisibleChanged(visible);
};
return () => {
var _a, _b, _c, _d;
const {
prefixCls,
footer = (_a = slots.footer) === null || _a === void 0 ? void 0 : _a.call(slots),
title = (_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots),
ariaId,
closable,
closeIcon = (_c = slots.closeIcon) === null || _c === void 0 ? void 0 : _c.call(slots),
onClose,
bodyStyle,
bodyProps,
onMousedown,
onMouseup,
visible,
modalRender = slots.modalRender,
destroyOnClose,
motionName
} = props2;
let footerNode;
if (footer) {
footerNode = createVNode("div", {
"class": `${prefixCls}-footer`
}, [footer]);
}
let headerNode;
if (title) {
headerNode = createVNode("div", {
"class": `${prefixCls}-header`
}, [createVNode("div", {
"class": `${prefixCls}-title`,
"id": ariaId
}, [title])]);
}
let closer;
if (closable) {
closer = createVNode("button", {
"type": "button",
"onClick": onClose,
"aria-label": "Close",
"class": `${prefixCls}-close`
}, [closeIcon || createVNode("span", {
"class": `${prefixCls}-close-x`
}, null)]);
}
const content = createVNode("div", {
"class": `${prefixCls}-content`
}, [closer, headerNode, createVNode("div", _objectSpread$W({
"class": `${prefixCls}-body`,
"style": bodyStyle
}, bodyProps), [(_d = slots.default) === null || _d === void 0 ? void 0 : _d.call(slots)]), footerNode]);
const transitionProps = getTransitionProps(motionName);
return createVNode(Transition, _objectSpread$W(_objectSpread$W({}, transitionProps), {}, {
"onBeforeEnter": onPrepare,
"onAfterEnter": () => onVisibleChanged(true),
"onAfterLeave": () => onVisibleChanged(false)
}), {
default: () => [visible || !destroyOnClose ? withDirectives(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"ref": dialogRef,
"key": "dialog-element",
"role": "document",
"style": [contentStyleRef.value, attrs.style],
"class": [prefixCls, attrs.class],
"onMousedown": onMousedown,
"onMouseup": onMouseup
}), [createVNode("div", {
"tabindex": 0,
"ref": sentinelStartRef,
"style": entityStyle
}, [modalRender ? modalRender({
originVNode: content
}) : content]), createVNode("div", {
"tabindex": 0,
"ref": sentinelEndRef,
"style": sentinelStyle
}, null)]), [[vShow, visible]]) : null]
});
};
}
});
const Mask$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "DialogMask",
props: {
prefixCls: String,
visible: Boolean,
motionName: String,
maskProps: Object
},
setup(props2, _ref) {
return () => {
const {
prefixCls,
visible,
maskProps,
motionName
} = props2;
const transitionProps = getTransitionProps(motionName);
return createVNode(Transition, transitionProps, {
default: () => [withDirectives(createVNode("div", _objectSpread$W({
"class": `${prefixCls}-mask`
}, maskProps), null), [[vShow, visible]])]
});
};
}
});
const Dialog = defineComponent({
compatConfig: {
MODE: 3
},
name: "VcDialog",
inheritAttrs: false,
props: initDefaultProps(_extends(_extends({}, dialogPropTypes()), {
getOpenCount: Function,
scrollLocker: Object
}), {
mask: true,
visible: false,
keyboard: true,
closable: true,
maskClosable: true,
destroyOnClose: false,
prefixCls: "rc-dialog",
getOpenCount: () => null,
focusTriggerAfterClose: true
}),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const lastOutSideActiveElementRef = shallowRef();
const wrapperRef = shallowRef();
const contentRef = shallowRef();
const animatedVisible = shallowRef(props2.visible);
const ariaIdRef = shallowRef(`vcDialogTitle${getUUID$1()}`);
const onDialogVisibleChanged = (newVisible) => {
var _a, _b;
if (newVisible) {
if (!contains(wrapperRef.value, (void 0).activeElement)) {
lastOutSideActiveElementRef.value = (void 0).activeElement;
(_a = contentRef.value) === null || _a === void 0 ? void 0 : _a.focus();
}
} else {
const preAnimatedVisible = animatedVisible.value;
animatedVisible.value = false;
if (props2.mask && lastOutSideActiveElementRef.value && props2.focusTriggerAfterClose) {
try {
lastOutSideActiveElementRef.value.focus({
preventScroll: true
});
} catch (e) {
}
lastOutSideActiveElementRef.value = null;
}
if (preAnimatedVisible) {
(_b = props2.afterClose) === null || _b === void 0 ? void 0 : _b.call(props2);
}
}
};
const onInternalClose = (e) => {
var _a;
(_a = props2.onClose) === null || _a === void 0 ? void 0 : _a.call(props2, e);
};
const contentClickRef = shallowRef(false);
const contentTimeoutRef = shallowRef();
const onContentMouseDown = () => {
clearTimeout(contentTimeoutRef.value);
contentClickRef.value = true;
};
const onContentMouseUp = () => {
contentTimeoutRef.value = setTimeout(() => {
contentClickRef.value = false;
});
};
const onWrapperClick = (e) => {
if (!props2.maskClosable) return null;
if (contentClickRef.value) {
contentClickRef.value = false;
} else if (wrapperRef.value === e.target) {
onInternalClose(e);
}
};
const onWrapperKeyDown = (e) => {
if (props2.keyboard && e.keyCode === KeyCode.ESC) {
e.stopPropagation();
onInternalClose(e);
return;
}
if (props2.visible) {
if (e.keyCode === KeyCode.TAB) {
contentRef.value.changeActive(!e.shiftKey);
}
}
};
watch(() => props2.visible, () => {
if (props2.visible) {
animatedVisible.value = true;
}
}, {
flush: "post"
});
watchEffect(() => {
var _a, _b;
(_a = props2.scrollLocker) === null || _a === void 0 ? void 0 : _a.unLock();
if (animatedVisible.value) {
(_b = props2.scrollLocker) === null || _b === void 0 ? void 0 : _b.lock();
}
});
return () => {
const {
prefixCls,
mask,
visible,
maskTransitionName,
maskAnimation,
zIndex,
wrapClassName,
rootClassName,
wrapStyle,
closable,
maskProps,
maskStyle,
transitionName: transitionName2,
animation,
wrapProps,
title = slots.title
} = props2;
const {
style,
class: className
} = attrs;
return createVNode("div", _objectSpread$W({
"class": [`${prefixCls}-root`, rootClassName]
}, pickAttrs(props2, {
data: true
})), [createVNode(Mask$1, {
"prefixCls": prefixCls,
"visible": mask && visible,
"motionName": getMotionName(prefixCls, maskTransitionName, maskAnimation),
"style": _extends({
zIndex
}, maskStyle),
"maskProps": maskProps
}, null), createVNode("div", _objectSpread$W({
"tabIndex": -1,
"onKeydown": onWrapperKeyDown,
"class": classNames(`${prefixCls}-wrap`, wrapClassName),
"ref": wrapperRef,
"onClick": onWrapperClick,
"role": "dialog",
"aria-labelledby": title ? ariaIdRef.value : null,
"style": _extends(_extends({
zIndex
}, wrapStyle), {
display: !animatedVisible.value ? "none" : null
})
}, wrapProps), [createVNode(Content$1, _objectSpread$W(_objectSpread$W({}, omit(props2, ["scrollLocker"])), {}, {
"style": style,
"class": className,
"onMousedown": onContentMouseDown,
"onMouseup": onContentMouseUp,
"ref": contentRef,
"closable": closable,
"ariaId": ariaIdRef.value,
"prefixCls": prefixCls,
"visible": visible,
"onClose": onInternalClose,
"onVisibleChanged": onDialogVisibleChanged,
"motionName": getMotionName(prefixCls, transitionName2, animation)
}), slots)])]);
};
}
});
const IDialogPropTypes = dialogPropTypes();
const DialogWrap = defineComponent({
compatConfig: {
MODE: 3
},
name: "DialogWrap",
inheritAttrs: false,
props: initDefaultProps(IDialogPropTypes, {
visible: false
}),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const animatedVisible = ref(props2.visible);
useProvidePortal({}, {
inTriggerContext: false
});
watch(() => props2.visible, () => {
if (props2.visible) {
animatedVisible.value = true;
}
}, {
flush: "post"
});
return () => {
const {
visible,
getContainer: getContainer2,
forceRender,
destroyOnClose = false,
afterClose
} = props2;
let dialogProps = _extends(_extends(_extends({}, props2), attrs), {
ref: "_component",
key: "dialog"
});
if (getContainer2 === false) {
return createVNode(Dialog, _objectSpread$W(_objectSpread$W({}, dialogProps), {}, {
"getOpenCount": () => 2
}), slots);
}
if (!forceRender && destroyOnClose && !animatedVisible.value) {
return null;
}
return createVNode(Portal, {
"autoLock": true,
"visible": visible,
"forceRender": forceRender,
"getContainer": getContainer2
}, {
default: (childProps) => {
dialogProps = _extends(_extends(_extends({}, dialogProps), childProps), {
afterClose: () => {
afterClose === null || afterClose === void 0 ? void 0 : afterClose();
animatedVisible.value = false;
}
});
return createVNode(Dialog, dialogProps, slots);
}
});
};
}
});
function useFrameSetState(initial) {
const frame = ref(null);
const state = reactive(_extends({}, initial));
const queue = ref([]);
const setFrameState = (newState) => {
if (frame.value === null) {
queue.value = [];
frame.value = wrapperRaf(() => {
let memoState;
queue.value.forEach((queueState) => {
memoState = _extends(_extends({}, memoState), queueState);
});
_extends(state, memoState);
frame.value = null;
});
}
queue.value.push(newState);
};
return [state, setFrameState];
}
var __rest$B = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const previewGroupContext = Symbol("previewGroupContext");
const context = {
provide: (val) => {
provide(previewGroupContext, val);
},
inject: () => {
return inject(previewGroupContext, {
isPreviewGroup: shallowRef(false),
previewUrls: computed(() => /* @__PURE__ */ new Map()),
setPreviewUrls: () => {
},
current: ref(null),
setCurrent: () => {
},
setShowPreview: () => {
},
setMousePosition: () => {
},
registerImage: null,
rootClassName: ""
});
}
};
const imageGroupProps = () => ({
previewPrefixCls: String,
preview: {
type: [Boolean, Object],
default: true
},
icons: {
type: Object,
default: () => ({})
}
});
const Group = defineComponent({
compatConfig: {
MODE: 3
},
name: "PreviewGroup",
inheritAttrs: false,
props: imageGroupProps(),
setup(props2, _ref) {
let {
slots
} = _ref;
const preview = computed(() => {
const defaultValues = {
visible: void 0,
onVisibleChange: () => {
},
getContainer: void 0,
current: 0
};
return typeof props2.preview === "object" ? mergeDefaultValue(props2.preview, defaultValues) : defaultValues;
});
const previewUrls = reactive(/* @__PURE__ */ new Map());
const current = ref();
const previewVisible = computed(() => preview.value.visible);
const getPreviewContainer = computed(() => preview.value.getContainer);
const onPreviewVisibleChange = (val, preval) => {
var _a, _b;
(_b = (_a = preview.value).onVisibleChange) === null || _b === void 0 ? void 0 : _b.call(_a, val, preval);
};
const [isShowPreview, setShowPreview] = useMergedState(!!previewVisible.value, {
value: previewVisible,
onChange: onPreviewVisibleChange
});
const mousePosition2 = ref(null);
const isControlled = computed(() => previewVisible.value !== void 0);
const previewUrlsKeys = computed(() => Array.from(previewUrls.keys()));
const currentControlledKey = computed(() => previewUrlsKeys.value[preview.value.current]);
const canPreviewUrls = computed(() => new Map(Array.from(previewUrls).filter((_ref2) => {
let [, {
canPreview
}] = _ref2;
return !!canPreview;
}).map((_ref3) => {
let [id, {
url
}] = _ref3;
return [id, url];
})));
const setPreviewUrls = function(id, url) {
let canPreview = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
previewUrls.set(id, {
url,
canPreview
});
};
const setCurrent = (val) => {
current.value = val;
};
const setMousePosition = (val) => {
mousePosition2.value = val;
};
const registerImage = function(id, url) {
let canPreview = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
const unRegister = () => {
previewUrls.delete(id);
};
previewUrls.set(id, {
url,
canPreview
});
return unRegister;
};
const onPreviewClose = (e) => {
e === null || e === void 0 ? void 0 : e.stopPropagation();
setShowPreview(false);
setMousePosition(null);
};
watch(currentControlledKey, (val) => {
setCurrent(val);
}, {
immediate: true,
flush: "post"
});
watchEffect(() => {
if (isShowPreview.value && isControlled.value) {
setCurrent(currentControlledKey.value);
}
}, {
flush: "post"
});
context.provide({
isPreviewGroup: shallowRef(true),
previewUrls: canPreviewUrls,
setPreviewUrls,
current,
setCurrent,
setShowPreview,
setMousePosition,
registerImage
});
return () => {
const dialogProps = __rest$B(preview.value, []);
return createVNode(Fragment, null, [slots.default && slots.default(), createVNode(Preview, _objectSpread$W(_objectSpread$W({}, dialogProps), {}, {
"ria-hidden": !isShowPreview.value,
"visible": isShowPreview.value,
"prefixCls": props2.previewPrefixCls,
"onClose": onPreviewClose,
"mousePosition": mousePosition2.value,
"src": canPreviewUrls.value.get(current.value),
"icons": props2.icons,
"getContainer": getPreviewContainer.value
}), null)]);
};
}
});
const initialPosition = {
x: 0,
y: 0
};
const previewProps = _extends(_extends({}, dialogPropTypes()), {
src: String,
alt: String,
rootClassName: String,
icons: {
type: Object,
default: () => ({})
}
});
const Preview = defineComponent({
compatConfig: {
MODE: 3
},
name: "Preview",
inheritAttrs: false,
props: previewProps,
emits: ["close", "afterClose"],
setup(props2, _ref) {
let {
emit,
attrs
} = _ref;
const {
rotateLeft,
rotateRight,
zoomIn: zoomIn2,
zoomOut: zoomOut2,
close,
left,
right,
flipX,
flipY
} = reactive(props2.icons);
const scale = shallowRef(1);
const rotate = shallowRef(0);
const flip = reactive({
x: 1,
y: 1
});
const [position, setPosition] = useFrameSetState(initialPosition);
const onClose = () => emit("close");
const imgRef = shallowRef();
const originPositionRef = reactive({
originX: 0,
originY: 0,
deltaX: 0,
deltaY: 0
});
const isMoving = shallowRef(false);
const groupContext = context.inject();
const {
previewUrls,
current,
isPreviewGroup,
setCurrent
} = groupContext;
const previewGroupCount = computed(() => previewUrls.value.size);
const previewUrlsKeys = computed(() => Array.from(previewUrls.value.keys()));
const currentPreviewIndex = computed(() => previewUrlsKeys.value.indexOf(current.value));
const combinationSrc = computed(() => {
return isPreviewGroup.value ? previewUrls.value.get(current.value) : props2.src;
});
const showLeftOrRightSwitches = computed(() => isPreviewGroup.value && previewGroupCount.value > 1);
shallowRef({
wheelDirection: 0
});
const onAfterClose = () => {
scale.value = 1;
rotate.value = 0;
flip.x = 1;
flip.y = 1;
setPosition(initialPosition);
emit("afterClose");
};
const onZoomIn = (isWheel) => {
{
scale.value++;
}
setPosition(initialPosition);
};
const onZoomOut = (isWheel) => {
if (scale.value > 1) {
{
scale.value--;
}
}
setPosition(initialPosition);
};
const onRotateRight = () => {
rotate.value += 90;
};
const onRotateLeft = () => {
rotate.value -= 90;
};
const onFlipX = () => {
flip.x = -flip.x;
};
const onFlipY = () => {
flip.y = -flip.y;
};
const onSwitchLeft = (event) => {
event.preventDefault();
event.stopPropagation();
if (currentPreviewIndex.value > 0) {
setCurrent(previewUrlsKeys.value[currentPreviewIndex.value - 1]);
}
};
const onSwitchRight = (event) => {
event.preventDefault();
event.stopPropagation();
if (currentPreviewIndex.value < previewGroupCount.value - 1) {
setCurrent(previewUrlsKeys.value[currentPreviewIndex.value + 1]);
}
};
const wrapClassName = classNames({
[`${props2.prefixCls}-moving`]: isMoving.value
});
const toolClassName = `${props2.prefixCls}-operations-operation`;
const iconClassName = `${props2.prefixCls}-operations-icon`;
const tools = [{
icon: close,
onClick: onClose,
type: "close"
}, {
icon: zoomIn2,
onClick: () => onZoomIn(),
type: "zoomIn"
}, {
icon: zoomOut2,
onClick: () => onZoomOut(),
type: "zoomOut",
disabled: computed(() => scale.value === 1)
}, {
icon: rotateRight,
onClick: onRotateRight,
type: "rotateRight"
}, {
icon: rotateLeft,
onClick: onRotateLeft,
type: "rotateLeft"
}, {
icon: flipX,
onClick: onFlipX,
type: "flipX"
}, {
icon: flipY,
onClick: onFlipY,
type: "flipY"
}];
const onMouseDown = (event) => {
if (event.button !== 0) return;
event.preventDefault();
event.stopPropagation();
originPositionRef.deltaX = event.pageX - position.x;
originPositionRef.deltaY = event.pageY - position.y;
originPositionRef.originX = position.x;
originPositionRef.originY = position.y;
isMoving.value = true;
};
const onDoubleClick = () => {
if (props2.visible) {
if (scale.value !== 1) {
scale.value = 1;
}
if (position.x !== initialPosition.x || position.y !== initialPosition.y) {
setPosition(initialPosition);
}
}
};
return () => {
const {
visible,
prefixCls,
rootClassName
} = props2;
return createVNode(DialogWrap, _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"transitionName": props2.transitionName,
"maskTransitionName": props2.maskTransitionName,
"closable": false,
"keyboard": true,
"prefixCls": prefixCls,
"onClose": onClose,
"afterClose": onAfterClose,
"visible": visible,
"wrapClassName": wrapClassName,
"rootClassName": rootClassName,
"getContainer": props2.getContainer
}), {
default: () => [createVNode("div", {
"class": [`${props2.prefixCls}-operations-wrapper`, rootClassName]
}, [createVNode("ul", {
"class": `${props2.prefixCls}-operations`
}, [tools.map((_ref2) => {
let {
icon: IconType,
onClick,
type,
disabled
} = _ref2;
return createVNode("li", {
"class": classNames(toolClassName, {
[`${props2.prefixCls}-operations-operation-disabled`]: disabled && (disabled === null || disabled === void 0 ? void 0 : disabled.value)
}),
"onClick": onClick,
"key": type
}, [cloneVNode(IconType, {
class: iconClassName
})]);
})])]), createVNode("div", {
"class": `${props2.prefixCls}-img-wrapper`,
"style": {
transform: `translate3d(${position.x}px, ${position.y}px, 0)`
}
}, [createVNode("img", {
"onMousedown": onMouseDown,
"onDblclick": onDoubleClick,
"ref": imgRef,
"class": `${props2.prefixCls}-img`,
"src": combinationSrc.value,
"alt": props2.alt,
"style": {
transform: `scale3d(${flip.x * scale.value}, ${flip.y * scale.value}, 1) rotate(${rotate.value}deg)`
}
}, null)]), showLeftOrRightSwitches.value && createVNode("div", {
"class": classNames(`${props2.prefixCls}-switch-left`, {
[`${props2.prefixCls}-switch-left-disabled`]: currentPreviewIndex.value <= 0
}),
"onClick": onSwitchLeft
}, [left]), showLeftOrRightSwitches.value && createVNode("div", {
"class": classNames(`${props2.prefixCls}-switch-right`, {
[`${props2.prefixCls}-switch-right-disabled`]: currentPreviewIndex.value >= previewGroupCount.value - 1
}),
"onClick": onSwitchRight
}, [right])]
});
};
}
});
var __rest$A = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const imageProps = () => ({
src: String,
wrapperClassName: String,
wrapperStyle: {
type: Object,
default: void 0
},
rootClassName: String,
prefixCls: String,
previewPrefixCls: String,
width: [Number, String],
height: [Number, String],
previewMask: {
type: [Boolean, Function],
default: void 0
},
placeholder: PropTypes.any,
fallback: String,
preview: {
type: [Boolean, Object],
default: true
},
onClick: {
type: Function
},
onError: {
type: Function
}
});
const mergeDefaultValue = (obj, defaultValues) => {
const res = _extends({}, obj);
Object.keys(defaultValues).forEach((key2) => {
if (obj[key2] === void 0) {
res[key2] = defaultValues[key2];
}
});
return res;
};
let uuid$1 = 0;
const ImageInternal = defineComponent({
compatConfig: {
MODE: 3
},
name: "VcImage",
inheritAttrs: false,
props: imageProps(),
emits: ["click", "error"],
setup(props2, _ref) {
let {
attrs,
slots,
emit
} = _ref;
const prefixCls = computed(() => props2.prefixCls);
const previewPrefixCls = computed(() => `${prefixCls.value}-preview`);
const preview = computed(() => {
const defaultValues = {
visible: void 0,
onVisibleChange: () => {
},
getContainer: void 0
};
return typeof props2.preview === "object" ? mergeDefaultValue(props2.preview, defaultValues) : defaultValues;
});
const src = computed(() => {
var _a;
return (_a = preview.value.src) !== null && _a !== void 0 ? _a : props2.src;
});
const isCustomPlaceholder = computed(() => props2.placeholder && props2.placeholder !== true || slots.placeholder);
const previewVisible = computed(() => preview.value.visible);
const getPreviewContainer = computed(() => preview.value.getContainer);
const isControlled = computed(() => previewVisible.value !== void 0);
const onPreviewVisibleChange = (val, preval) => {
var _a, _b;
(_b = (_a = preview.value).onVisibleChange) === null || _b === void 0 ? void 0 : _b.call(_a, val, preval);
};
const [isShowPreview, setShowPreview] = useMergedState(!!previewVisible.value, {
value: previewVisible,
onChange: onPreviewVisibleChange
});
const status = ref(isCustomPlaceholder.value ? "loading" : "normal");
watch(() => props2.src, () => {
status.value = isCustomPlaceholder.value ? "loading" : "normal";
});
const mousePosition2 = ref(null);
const isError = computed(() => status.value === "error");
const groupContext = context.inject();
const {
isPreviewGroup,
setCurrent,
setShowPreview: setGroupShowPreview,
setMousePosition: setGroupMousePosition,
registerImage
} = groupContext;
const currentId = ref(uuid$1++);
const canPreview = computed(() => props2.preview && !isError.value);
const onLoad = () => {
status.value = "normal";
};
const onError = (e) => {
status.value = "error";
emit("error", e);
};
const onPreview = (e) => {
if (!isControlled.value) {
const {
left,
top
} = getOffset$2(e.target);
if (isPreviewGroup.value) {
setCurrent(currentId.value);
setGroupMousePosition({
x: left,
y: top
});
} else {
mousePosition2.value = {
x: left,
y: top
};
}
}
if (isPreviewGroup.value) {
setGroupShowPreview(true);
} else {
setShowPreview(true);
}
emit("click", e);
};
const onPreviewClose = () => {
setShowPreview(false);
if (!isControlled.value) {
mousePosition2.value = null;
}
};
const img = ref(null);
watch(() => img, () => {
if (status.value !== "loading") return;
if (img.value.complete && (img.value.naturalWidth || img.value.naturalHeight)) {
onLoad();
}
});
const toSizePx = (l) => {
if (isNumber(l)) return l + "px";
return l;
};
return () => {
const {
prefixCls: prefixCls2,
wrapperClassName,
fallback,
src: imgSrc,
placeholder,
wrapperStyle: wrapperStyle2,
rootClassName,
width,
height,
crossorigin,
decoding,
alt,
sizes: sizes2,
srcset,
usemap,
class: cls,
style
} = _extends(_extends({}, props2), attrs);
const _a = preview.value, {
icons: icons2,
maskClassName
} = _a, dialogProps = __rest$A(_a, ["icons", "maskClassName"]);
const wrappperClass = classNames(prefixCls2, wrapperClassName, rootClassName, {
[`${prefixCls2}-error`]: isError.value
});
const mergedSrc = isError.value && fallback ? fallback : src.value;
const imgCommonProps = {
crossorigin,
decoding,
alt,
sizes: sizes2,
srcset,
usemap,
width,
height,
class: classNames(`${prefixCls2}-img`, {
[`${prefixCls2}-img-placeholder`]: placeholder === true
}, cls),
style: _extends({
height: toSizePx(height)
}, style)
};
return createVNode(Fragment, null, [createVNode("div", {
"class": wrappperClass,
"onClick": canPreview.value ? onPreview : (e) => {
emit("click", e);
},
"style": _extends({
width: toSizePx(width),
height: toSizePx(height)
}, wrapperStyle2)
}, [createVNode("img", _objectSpread$W(_objectSpread$W(_objectSpread$W({}, imgCommonProps), isError.value && fallback ? {
src: fallback
} : {
onLoad,
onError,
src: imgSrc
}), {}, {
"ref": img
}), null), status.value === "loading" && createVNode("div", {
"aria-hidden": "true",
"class": `${prefixCls2}-placeholder`
}, [placeholder || slots.placeholder && slots.placeholder()]), slots.previewMask && canPreview.value && createVNode("div", {
"class": [`${prefixCls2}-mask`, maskClassName]
}, [slots.previewMask()])]), !isPreviewGroup.value && canPreview.value && createVNode(Preview, _objectSpread$W(_objectSpread$W({}, dialogProps), {}, {
"aria-hidden": !isShowPreview.value,
"visible": isShowPreview.value,
"prefixCls": previewPrefixCls.value,
"onClose": onPreviewClose,
"mousePosition": mousePosition2.value,
"src": mergedSrc,
"alt": alt,
"getContainer": getPreviewContainer.value,
"icons": icons2,
"rootClassName": rootClassName
}), null)]);
};
}
});
ImageInternal.PreviewGroup = Group;
function box(position) {
return {
position,
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0
};
}
const genModalMaskStyle = (token) => {
const {
componentCls
} = token;
return [{
[`${componentCls}-root`]: {
[`${componentCls}${token.antCls}-zoom-enter, ${componentCls}${token.antCls}-zoom-appear`]: {
// reset scale avoid mousePosition bug
transform: "none",
opacity: 0,
animationDuration: token.motionDurationSlow,
// https://github.com/ant-design/ant-design/issues/11777
userSelect: "none"
},
[`${componentCls}${token.antCls}-zoom-leave ${componentCls}-content`]: {
pointerEvents: "none"
},
[`${componentCls}-mask`]: _extends(_extends({}, box("fixed")), {
zIndex: token.zIndexPopupBase,
height: "100%",
backgroundColor: token.colorBgMask,
[`${componentCls}-hidden`]: {
display: "none"
}
}),
[`${componentCls}-wrap`]: _extends(_extends({}, box("fixed")), {
overflow: "auto",
outline: 0,
WebkitOverflowScrolling: "touch"
})
}
}, {
[`${componentCls}-root`]: initFadeMotion(token)
}];
};
const genModalStyle = (token) => {
const {
componentCls
} = token;
return [
// ======================== Root =========================
{
[`${componentCls}-root`]: {
[`${componentCls}-wrap`]: {
zIndex: token.zIndexPopupBase,
position: "fixed",
inset: 0,
overflow: "auto",
outline: 0,
WebkitOverflowScrolling: "touch"
},
[`${componentCls}-wrap-rtl`]: {
direction: "rtl"
},
[`${componentCls}-centered`]: {
textAlign: "center",
"&::before": {
display: "inline-block",
width: 0,
height: "100%",
verticalAlign: "middle",
content: '""'
},
[componentCls]: {
top: 0,
display: "inline-block",
paddingBottom: 0,
textAlign: "start",
verticalAlign: "middle"
}
},
[`@media (max-width: ${token.screenSMMax})`]: {
[componentCls]: {
maxWidth: "calc(100vw - 16px)",
margin: `${token.marginXS} auto`
},
[`${componentCls}-centered`]: {
[componentCls]: {
flex: 1
}
}
}
}
},
// ======================== Modal ========================
{
[componentCls]: _extends(_extends({}, resetComponent(token)), {
pointerEvents: "none",
position: "relative",
top: 100,
width: "auto",
maxWidth: `calc(100vw - ${token.margin * 2}px)`,
margin: "0 auto",
paddingBottom: token.paddingLG,
[`${componentCls}-title`]: {
margin: 0,
color: token.modalHeadingColor,
fontWeight: token.fontWeightStrong,
fontSize: token.modalHeaderTitleFontSize,
lineHeight: token.modalHeaderTitleLineHeight,
wordWrap: "break-word"
},
[`${componentCls}-content`]: {
position: "relative",
backgroundColor: token.modalContentBg,
backgroundClip: "padding-box",
border: 0,
borderRadius: token.borderRadiusLG,
boxShadow: token.boxShadowSecondary,
pointerEvents: "auto",
padding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`
},
[`${componentCls}-close`]: _extends({
position: "absolute",
top: (token.modalHeaderCloseSize - token.modalCloseBtnSize) / 2,
insetInlineEnd: (token.modalHeaderCloseSize - token.modalCloseBtnSize) / 2,
zIndex: token.zIndexPopupBase + 10,
padding: 0,
color: token.modalCloseColor,
fontWeight: token.fontWeightStrong,
lineHeight: 1,
textDecoration: "none",
background: "transparent",
borderRadius: token.borderRadiusSM,
width: token.modalConfirmIconSize,
height: token.modalConfirmIconSize,
border: 0,
outline: 0,
cursor: "pointer",
transition: `color ${token.motionDurationMid}, background-color ${token.motionDurationMid}`,
"&-x": {
display: "block",
fontSize: token.fontSizeLG,
fontStyle: "normal",
lineHeight: `${token.modalCloseBtnSize}px`,
textAlign: "center",
textTransform: "none",
textRendering: "auto"
},
"&:hover": {
color: token.modalIconHoverColor,
backgroundColor: token.wireframe ? "transparent" : token.colorFillContent,
textDecoration: "none"
},
"&:active": {
backgroundColor: token.wireframe ? "transparent" : token.colorFillContentHover
}
}, genFocusStyle(token)),
[`${componentCls}-header`]: {
color: token.colorText,
background: token.modalHeaderBg,
borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`,
marginBottom: token.marginXS
},
[`${componentCls}-body`]: {
fontSize: token.fontSize,
lineHeight: token.lineHeight,
wordWrap: "break-word"
},
[`${componentCls}-footer`]: {
textAlign: "end",
background: token.modalFooterBg,
marginTop: token.marginSM,
[`${token.antCls}-btn + ${token.antCls}-btn:not(${token.antCls}-dropdown-trigger)`]: {
marginBottom: 0,
marginInlineStart: token.marginXS
}
},
[`${componentCls}-open`]: {
overflow: "hidden"
}
})
},
// ======================== Pure =========================
{
[`${componentCls}-pure-panel`]: {
top: "auto",
padding: 0,
display: "flex",
flexDirection: "column",
[`${componentCls}-content,
${componentCls}-body,
${componentCls}-confirm-body-wrapper`]: {
display: "flex",
flexDirection: "column",
flex: "auto"
},
[`${componentCls}-confirm-body`]: {
marginBottom: "auto"
}
}
}
];
};
const genModalConfirmStyle = (token) => {
const {
componentCls
} = token;
const confirmComponentCls = `${componentCls}-confirm`;
return {
[confirmComponentCls]: {
"&-rtl": {
direction: "rtl"
},
[`${token.antCls}-modal-header`]: {
display: "none"
},
[`${confirmComponentCls}-body-wrapper`]: _extends({}, clearFix()),
[`${confirmComponentCls}-body`]: {
display: "flex",
flexWrap: "wrap",
alignItems: "center",
[`${confirmComponentCls}-title`]: {
flex: "0 0 100%",
display: "block",
// create BFC to avoid
// https://user-images.githubusercontent.com/507615/37702510-ba844e06-2d2d-11e8-9b67-8e19be57f445.png
overflow: "hidden",
color: token.colorTextHeading,
fontWeight: token.fontWeightStrong,
fontSize: token.modalHeaderTitleFontSize,
lineHeight: token.modalHeaderTitleLineHeight,
[`+ ${confirmComponentCls}-content`]: {
marginBlockStart: token.marginXS,
flexBasis: "100%",
maxWidth: `calc(100% - ${token.modalConfirmIconSize + token.marginSM}px)`
}
},
[`${confirmComponentCls}-content`]: {
color: token.colorText,
fontSize: token.fontSize
},
[`> ${token.iconCls}`]: {
flex: "none",
marginInlineEnd: token.marginSM,
fontSize: token.modalConfirmIconSize,
[`+ ${confirmComponentCls}-title`]: {
flex: 1
},
// `content` after `icon` should set marginLeft
[`+ ${confirmComponentCls}-title + ${confirmComponentCls}-content`]: {
marginInlineStart: token.modalConfirmIconSize + token.marginSM
}
}
},
[`${confirmComponentCls}-btns`]: {
textAlign: "end",
marginTop: token.marginSM,
[`${token.antCls}-btn + ${token.antCls}-btn`]: {
marginBottom: 0,
marginInlineStart: token.marginXS
}
}
},
[`${confirmComponentCls}-error ${confirmComponentCls}-body > ${token.iconCls}`]: {
color: token.colorError
},
[`${confirmComponentCls}-warning ${confirmComponentCls}-body > ${token.iconCls},
${confirmComponentCls}-confirm ${confirmComponentCls}-body > ${token.iconCls}`]: {
color: token.colorWarning
},
[`${confirmComponentCls}-info ${confirmComponentCls}-body > ${token.iconCls}`]: {
color: token.colorInfo
},
[`${confirmComponentCls}-success ${confirmComponentCls}-body > ${token.iconCls}`]: {
color: token.colorSuccess
},
// https://github.com/ant-design/ant-design/issues/37329
[`${componentCls}-zoom-leave ${componentCls}-btns`]: {
pointerEvents: "none"
}
};
};
const genRTLStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-root`]: {
[`${componentCls}-wrap-rtl`]: {
direction: "rtl",
[`${componentCls}-confirm-body`]: {
direction: "rtl"
}
}
}
};
};
const genWireframeStyle = (token) => {
const {
componentCls,
antCls
} = token;
const confirmComponentCls = `${componentCls}-confirm`;
return {
[componentCls]: {
[`${componentCls}-content`]: {
padding: 0
},
[`${componentCls}-header`]: {
padding: token.modalHeaderPadding,
borderBottom: `${token.modalHeaderBorderWidth}px ${token.modalHeaderBorderStyle} ${token.modalHeaderBorderColorSplit}`,
marginBottom: 0
},
[`${componentCls}-body`]: {
padding: token.modalBodyPadding
},
[`${componentCls}-footer`]: {
padding: `${token.modalFooterPaddingVertical}px ${token.modalFooterPaddingHorizontal}px`,
borderTop: `${token.modalFooterBorderWidth}px ${token.modalFooterBorderStyle} ${token.modalFooterBorderColorSplit}`,
borderRadius: `0 0 ${token.borderRadiusLG}px ${token.borderRadiusLG}px`,
marginTop: 0
}
},
[confirmComponentCls]: {
[`${antCls}-modal-body`]: {
padding: `${token.padding * 2}px ${token.padding * 2}px ${token.paddingLG}px`
},
[`${confirmComponentCls}-body`]: {
[`> ${token.iconCls}`]: {
marginInlineEnd: token.margin,
// `content` after `icon` should set marginLeft
[`+ ${confirmComponentCls}-title + ${confirmComponentCls}-content`]: {
marginInlineStart: token.modalConfirmIconSize + token.margin
}
}
},
[`${confirmComponentCls}-btns`]: {
marginTop: token.marginLG
}
}
};
};
const useStyle$q = genComponentStyleHook("Modal", (token) => {
const headerPaddingVertical = token.padding;
const headerFontSize = token.fontSizeHeading5;
const headerLineHeight = token.lineHeightHeading5;
const modalToken = merge(token, {
modalBodyPadding: token.paddingLG,
modalHeaderBg: token.colorBgElevated,
modalHeaderPadding: `${headerPaddingVertical}px ${token.paddingLG}px`,
modalHeaderBorderWidth: token.lineWidth,
modalHeaderBorderStyle: token.lineType,
modalHeaderTitleLineHeight: headerLineHeight,
modalHeaderTitleFontSize: headerFontSize,
modalHeaderBorderColorSplit: token.colorSplit,
modalHeaderCloseSize: headerLineHeight * headerFontSize + headerPaddingVertical * 2,
modalContentBg: token.colorBgElevated,
modalHeadingColor: token.colorTextHeading,
modalCloseColor: token.colorTextDescription,
modalFooterBg: "transparent",
modalFooterBorderColorSplit: token.colorSplit,
modalFooterBorderStyle: token.lineType,
modalFooterPaddingVertical: token.paddingXS,
modalFooterPaddingHorizontal: token.padding,
modalFooterBorderWidth: token.lineWidth,
modalConfirmTitleFontSize: token.fontSizeLG,
modalIconHoverColor: token.colorIconHover,
modalConfirmIconSize: token.fontSize * token.lineHeight,
modalCloseBtnSize: token.controlHeightLG * 0.55
});
return [genModalStyle(modalToken), genModalConfirmStyle(modalToken), genRTLStyle(modalToken), genModalMaskStyle(modalToken), token.wireframe && genWireframeStyle(modalToken), initZoomMotion(modalToken, "zoom")];
});
const genBoxStyle = (position) => ({
position: position || "absolute",
inset: 0
});
const genImageMaskStyle = (token) => {
const {
iconCls,
motionDurationSlow,
paddingXXS,
marginXXS,
prefixCls
} = token;
return {
position: "absolute",
inset: 0,
display: "flex",
alignItems: "center",
justifyContent: "center",
color: "#fff",
background: new TinyColor("#000").setAlpha(0.5).toRgbString(),
cursor: "pointer",
opacity: 0,
transition: `opacity ${motionDurationSlow}`,
[`.${prefixCls}-mask-info`]: _extends(_extends({}, textEllipsis), {
padding: `0 ${paddingXXS}px`,
[iconCls]: {
marginInlineEnd: marginXXS,
svg: {
verticalAlign: "baseline"
}
}
})
};
};
const genPreviewOperationsStyle = (token) => {
const {
previewCls,
modalMaskBg,
paddingSM,
previewOperationColorDisabled,
motionDurationSlow
} = token;
const operationBg = new TinyColor(modalMaskBg).setAlpha(0.1);
const operationBgHover = operationBg.clone().setAlpha(0.2);
return {
[`${previewCls}-operations`]: _extends(_extends({}, resetComponent(token)), {
display: "flex",
flexDirection: "row-reverse",
alignItems: "center",
color: token.previewOperationColor,
listStyle: "none",
background: operationBg.toRgbString(),
pointerEvents: "auto",
"&-operation": {
marginInlineStart: paddingSM,
padding: paddingSM,
cursor: "pointer",
transition: `all ${motionDurationSlow}`,
userSelect: "none",
"&:hover": {
background: operationBgHover.toRgbString()
},
"&-disabled": {
color: previewOperationColorDisabled,
pointerEvents: "none"
},
"&:last-of-type": {
marginInlineStart: 0
}
},
"&-progress": {
position: "absolute",
left: {
_skip_check_: true,
value: "50%"
},
transform: "translateX(-50%)"
},
"&-icon": {
fontSize: token.previewOperationSize
}
})
};
};
const genPreviewSwitchStyle = (token) => {
const {
modalMaskBg,
iconCls,
previewOperationColorDisabled,
previewCls,
zIndexPopup,
motionDurationSlow
} = token;
const operationBg = new TinyColor(modalMaskBg).setAlpha(0.1);
const operationBgHover = operationBg.clone().setAlpha(0.2);
return {
[`${previewCls}-switch-left, ${previewCls}-switch-right`]: {
position: "fixed",
insetBlockStart: "50%",
zIndex: zIndexPopup + 1,
display: "flex",
alignItems: "center",
justifyContent: "center",
width: token.imagePreviewSwitchSize,
height: token.imagePreviewSwitchSize,
marginTop: -token.imagePreviewSwitchSize / 2,
color: token.previewOperationColor,
background: operationBg.toRgbString(),
borderRadius: "50%",
transform: `translateY(-50%)`,
cursor: "pointer",
transition: `all ${motionDurationSlow}`,
pointerEvents: "auto",
userSelect: "none",
"&:hover": {
background: operationBgHover.toRgbString()
},
[`&-disabled`]: {
"&, &:hover": {
color: previewOperationColorDisabled,
background: "transparent",
cursor: "not-allowed",
[`> ${iconCls}`]: {
cursor: "not-allowed"
}
}
},
[`> ${iconCls}`]: {
fontSize: token.previewOperationSize
}
},
[`${previewCls}-switch-left`]: {
insetInlineStart: token.marginSM
},
[`${previewCls}-switch-right`]: {
insetInlineEnd: token.marginSM
}
};
};
const genImagePreviewStyle = (token) => {
const {
motionEaseOut,
previewCls,
motionDurationSlow,
componentCls
} = token;
return [
{
[`${componentCls}-preview-root`]: {
[previewCls]: {
height: "100%",
textAlign: "center",
pointerEvents: "none"
},
[`${previewCls}-body`]: _extends(_extends({}, genBoxStyle()), {
overflow: "hidden"
}),
[`${previewCls}-img`]: {
maxWidth: "100%",
maxHeight: "100%",
verticalAlign: "middle",
transform: "scale3d(1, 1, 1)",
cursor: "grab",
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
userSelect: "none",
pointerEvents: "auto",
"&-wrapper": _extends(_extends({}, genBoxStyle()), {
transition: `transform ${motionDurationSlow} ${motionEaseOut} 0s`,
// https://github.com/ant-design/ant-design/issues/39913
// TailwindCSS will reset img default style.
// Let's set back.
display: "flex",
justifyContent: "center",
alignItems: "center",
"&::before": {
display: "inline-block",
width: 1,
height: "50%",
marginInlineEnd: -1,
content: '""'
}
})
},
[`${previewCls}-moving`]: {
[`${previewCls}-preview-img`]: {
cursor: "grabbing",
"&-wrapper": {
transitionDuration: "0s"
}
}
}
}
},
// Override
{
[`${componentCls}-preview-root`]: {
[`${previewCls}-wrap`]: {
zIndex: token.zIndexPopup
}
}
},
// Preview operations & switch
{
[`${componentCls}-preview-operations-wrapper`]: {
position: "fixed",
insetBlockStart: 0,
insetInlineEnd: 0,
zIndex: token.zIndexPopup + 1,
width: "100%"
},
"&": [genPreviewOperationsStyle(token), genPreviewSwitchStyle(token)]
}
];
};
const genImageStyle = (token) => {
const {
componentCls
} = token;
return {
// ============================== image ==============================
[componentCls]: {
position: "relative",
display: "inline-block",
[`${componentCls}-img`]: {
width: "100%",
height: "auto",
verticalAlign: "middle"
},
[`${componentCls}-img-placeholder`]: {
backgroundColor: token.colorBgContainerDisabled,
backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
backgroundRepeat: "no-repeat",
backgroundPosition: "center center",
backgroundSize: "30%"
},
[`${componentCls}-mask`]: _extends({}, genImageMaskStyle(token)),
[`${componentCls}-mask:hover`]: {
opacity: 1
},
[`${componentCls}-placeholder`]: _extends({}, genBoxStyle())
}
};
};
const genPreviewMotion = (token) => {
const {
previewCls
} = token;
return {
[`${previewCls}-root`]: initZoomMotion(token, "zoom"),
[`&`]: initFadeMotion(token, true)
};
};
const useStyle$p = genComponentStyleHook("Image", (token) => {
const previewCls = `${token.componentCls}-preview`;
const imageToken = merge(token, {
previewCls,
modalMaskBg: new TinyColor("#000").setAlpha(0.45).toRgbString(),
imagePreviewSwitchSize: token.controlHeightLG
});
return [genImageStyle(imageToken), genImagePreviewStyle(imageToken), genModalMaskStyle(merge(imageToken, {
componentCls: previewCls
})), genPreviewMotion(imageToken)];
}, (token) => ({
zIndexPopup: token.zIndexPopupBase + 80,
previewOperationColor: new TinyColor(token.colorTextLightSolid).toRgbString(),
previewOperationColorDisabled: new TinyColor(token.colorTextLightSolid).setAlpha(0.25).toRgbString(),
previewOperationSize: token.fontSizeIcon * 1.5
// FIXME: fontSizeIconLG
}));
const icons = {
rotateLeft: createVNode(RotateLeftOutlined, null, null),
rotateRight: createVNode(RotateRightOutlined, null, null),
zoomIn: createVNode(ZoomInOutlined, null, null),
zoomOut: createVNode(ZoomOutOutlined, null, null),
close: createVNode(CloseOutlined, null, null),
left: createVNode(LeftOutlined, null, null),
right: createVNode(RightOutlined, null, null),
flipX: createVNode(SwapOutlined, null, null),
flipY: createVNode(SwapOutlined, {
"rotate": 90
}, null)
};
const previewGroupProps = () => ({
previewPrefixCls: String,
preview: anyType()
});
const InternalPreviewGroup = defineComponent({
compatConfig: {
MODE: 3
},
name: "AImagePreviewGroup",
inheritAttrs: false,
props: previewGroupProps(),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const {
prefixCls,
rootPrefixCls
} = useConfigInject("image", props2);
const previewPrefixCls = computed(() => `${prefixCls.value}-preview`);
const [wrapSSR, hashId] = useStyle$p(prefixCls);
const mergedPreview = computed(() => {
const {
preview
} = props2;
if (preview === false) {
return preview;
}
const _preview = typeof preview === "object" ? preview : {};
return _extends(_extends({}, _preview), {
rootClassName: hashId.value,
transitionName: getTransitionName$1(rootPrefixCls.value, "zoom", _preview.transitionName),
maskTransitionName: getTransitionName$1(rootPrefixCls.value, "fade", _preview.maskTransitionName)
});
});
return () => {
return wrapSSR(createVNode(Group, _objectSpread$W(_objectSpread$W({}, _extends(_extends({}, attrs), props2)), {}, {
"preview": mergedPreview.value,
"icons": icons,
"previewPrefixCls": previewPrefixCls.value
}), slots));
};
}
});
const Image$1 = defineComponent({
name: "AImage",
inheritAttrs: false,
props: imageProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
rootPrefixCls,
configProvider
} = useConfigInject("image", props2);
const [wrapSSR, hashId] = useStyle$p(prefixCls);
const mergedPreview = computed(() => {
const {
preview
} = props2;
if (preview === false) {
return preview;
}
const _preview = typeof preview === "object" ? preview : {};
return _extends(_extends({
icons
}, _preview), {
transitionName: getTransitionName$1(rootPrefixCls.value, "zoom", _preview.transitionName),
maskTransitionName: getTransitionName$1(rootPrefixCls.value, "fade", _preview.maskTransitionName)
});
});
return () => {
var _a, _b;
const imageLocale = ((_b = (_a = configProvider.locale) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.Image) || localeValues.Image;
const defaultPreviewMask = () => createVNode("div", {
"class": `${prefixCls.value}-mask-info`
}, [createVNode(EyeOutlined, null, null), imageLocale === null || imageLocale === void 0 ? void 0 : imageLocale.preview]);
const {
previewMask = slots.previewMask || defaultPreviewMask
} = props2;
return wrapSSR(createVNode(ImageInternal, _objectSpread$W(_objectSpread$W({}, _extends(_extends(_extends({}, attrs), props2), {
prefixCls: prefixCls.value
})), {}, {
"preview": mergedPreview.value,
"rootClassName": classNames(props2.rootClassName, hashId.value)
}), _extends(_extends({}, slots), {
previewMask: typeof previewMask === "function" ? previewMask : null
})));
};
}
});
Image$1.PreviewGroup = InternalPreviewGroup;
Image$1.install = function(app) {
app.component(Image$1.name, Image$1);
app.component(Image$1.PreviewGroup.name, Image$1.PreviewGroup);
return app;
};
function supportBigInt() {
return typeof BigInt === "function";
}
function trimNumber(numStr) {
let str = numStr.trim();
let negative = str.startsWith("-");
if (negative) {
str = str.slice(1);
}
str = str.replace(/(\.\d*[^0])0*$/, "$1").replace(/\.0*$/, "").replace(/^0+/, "");
if (str.startsWith(".")) {
str = `0${str}`;
}
const trimStr = str || "0";
const splitNumber = trimStr.split(".");
const integerStr = splitNumber[0] || "0";
const decimalStr = splitNumber[1] || "0";
if (integerStr === "0" && decimalStr === "0") {
negative = false;
}
const negativeStr = negative ? "-" : "";
return {
negative,
negativeStr,
trimStr,
integerStr,
decimalStr,
fullStr: `${negativeStr}${trimStr}`
};
}
function isE(number) {
const str = String(number);
return !Number.isNaN(Number(str)) && str.includes("e");
}
function getNumberPrecision(number) {
const numStr = String(number);
if (isE(number)) {
let precision = Number(numStr.slice(numStr.indexOf("e-") + 2));
const decimalMatch = numStr.match(/\.(\d+)/);
if (decimalMatch === null || decimalMatch === void 0 ? void 0 : decimalMatch[1]) {
precision += decimalMatch[1].length;
}
return precision;
}
return numStr.includes(".") && validateNumber(numStr) ? numStr.length - numStr.indexOf(".") - 1 : 0;
}
function num2str(number) {
let numStr = String(number);
if (isE(number)) {
if (number > Number.MAX_SAFE_INTEGER) {
return String(supportBigInt() ? BigInt(number).toString() : Number.MAX_SAFE_INTEGER);
}
if (number < Number.MIN_SAFE_INTEGER) {
return String(supportBigInt() ? BigInt(number).toString() : Number.MIN_SAFE_INTEGER);
}
numStr = number.toFixed(getNumberPrecision(numStr));
}
return trimNumber(numStr).fullStr;
}
function validateNumber(num) {
if (typeof num === "number") {
return !Number.isNaN(num);
}
if (!num) {
return false;
}
return (
// Normal type: 11.28
/^\s*-?\d+(\.\d+)?\s*$/.test(num) || // Pre-number: 1.
/^\s*-?\d+\.\s*$/.test(num) || // Post-number: .1
/^\s*-?\.\d+\s*$/.test(num)
);
}
function isEmpty(value) {
return !value && value !== 0 && !Number.isNaN(value) || !String(value).trim();
}
class NumberDecimal {
constructor(value) {
this.origin = "";
if (isEmpty(value)) {
this.empty = true;
return;
}
this.origin = String(value);
this.number = Number(value);
}
negate() {
return new NumberDecimal(-this.toNumber());
}
add(value) {
if (this.isInvalidate()) {
return new NumberDecimal(value);
}
const target = Number(value);
if (Number.isNaN(target)) {
return this;
}
const number = this.number + target;
if (number > Number.MAX_SAFE_INTEGER) {
return new NumberDecimal(Number.MAX_SAFE_INTEGER);
}
if (number < Number.MIN_SAFE_INTEGER) {
return new NumberDecimal(Number.MIN_SAFE_INTEGER);
}
const maxPrecision = Math.max(getNumberPrecision(this.number), getNumberPrecision(target));
return new NumberDecimal(number.toFixed(maxPrecision));
}
isEmpty() {
return this.empty;
}
isNaN() {
return Number.isNaN(this.number);
}
isInvalidate() {
return this.isEmpty() || this.isNaN();
}
equals(target) {
return this.toNumber() === (target === null || target === void 0 ? void 0 : target.toNumber());
}
lessEquals(target) {
return this.add(target.negate().toString()).toNumber() <= 0;
}
toNumber() {
return this.number;
}
toString() {
let safe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
if (!safe) {
return this.origin;
}
if (this.isInvalidate()) {
return "";
}
return num2str(this.number);
}
}
class BigIntDecimal {
constructor(value) {
this.origin = "";
if (isEmpty(value)) {
this.empty = true;
return;
}
this.origin = String(value);
if (value === "-" || Number.isNaN(value)) {
this.nan = true;
return;
}
let mergedValue = value;
if (isE(mergedValue)) {
mergedValue = Number(mergedValue);
}
mergedValue = typeof mergedValue === "string" ? mergedValue : num2str(mergedValue);
if (validateNumber(mergedValue)) {
const trimRet = trimNumber(mergedValue);
this.negative = trimRet.negative;
const numbers = trimRet.trimStr.split(".");
this.integer = BigInt(numbers[0]);
const decimalStr = numbers[1] || "0";
this.decimal = BigInt(decimalStr);
this.decimalLen = decimalStr.length;
} else {
this.nan = true;
}
}
getMark() {
return this.negative ? "-" : "";
}
getIntegerStr() {
return this.integer.toString();
}
getDecimalStr() {
return this.decimal.toString().padStart(this.decimalLen, "0");
}
/**
* Align BigIntDecimal with same decimal length. e.g. 12.3 + 5 = 1230000
* This is used for add function only.
*/
alignDecimal(decimalLength) {
const str = `${this.getMark()}${this.getIntegerStr()}${this.getDecimalStr().padEnd(decimalLength, "0")}`;
return BigInt(str);
}
negate() {
const clone = new BigIntDecimal(this.toString());
clone.negative = !clone.negative;
return clone;
}
add(value) {
if (this.isInvalidate()) {
return new BigIntDecimal(value);
}
const offset2 = new BigIntDecimal(value);
if (offset2.isInvalidate()) {
return this;
}
const maxDecimalLength = Math.max(this.getDecimalStr().length, offset2.getDecimalStr().length);
const myAlignedDecimal = this.alignDecimal(maxDecimalLength);
const offsetAlignedDecimal = offset2.alignDecimal(maxDecimalLength);
const valueStr = (myAlignedDecimal + offsetAlignedDecimal).toString();
const {
negativeStr,
trimStr
} = trimNumber(valueStr);
const hydrateValueStr = `${negativeStr}${trimStr.padStart(maxDecimalLength + 1, "0")}`;
return new BigIntDecimal(`${hydrateValueStr.slice(0, -maxDecimalLength)}.${hydrateValueStr.slice(-maxDecimalLength)}`);
}
isEmpty() {
return this.empty;
}
isNaN() {
return this.nan;
}
isInvalidate() {
return this.isEmpty() || this.isNaN();
}
equals(target) {
return this.toString() === (target === null || target === void 0 ? void 0 : target.toString());
}
lessEquals(target) {
return this.add(target.negate().toString()).toNumber() <= 0;
}
toNumber() {
if (this.isNaN()) {
return NaN;
}
return Number(this.toString());
}
toString() {
let safe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
if (!safe) {
return this.origin;
}
if (this.isInvalidate()) {
return "";
}
return trimNumber(`${this.getMark()}${this.getIntegerStr()}.${this.getDecimalStr()}`).fullStr;
}
}
function getMiniDecimal(value) {
if (supportBigInt()) {
return new BigIntDecimal(value);
}
return new NumberDecimal(value);
}
function toFixed(numStr, separatorStr, precision) {
let cutOnly = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
if (numStr === "") {
return "";
}
const {
negativeStr,
integerStr,
decimalStr
} = trimNumber(numStr);
const precisionDecimalStr = `${separatorStr}${decimalStr}`;
const numberWithoutDecimal = `${negativeStr}${integerStr}`;
if (precision >= 0) {
const advancedNum = Number(decimalStr[precision]);
if (advancedNum >= 5 && !cutOnly) {
const advancedDecimal = getMiniDecimal(numStr).add(`${negativeStr}0.${"0".repeat(precision)}${10 - advancedNum}`);
return toFixed(advancedDecimal.toString(), separatorStr, precision, cutOnly);
}
if (precision === 0) {
return numberWithoutDecimal;
}
return `${numberWithoutDecimal}${separatorStr}${decimalStr.padEnd(precision, "0").slice(0, precision)}`;
}
if (precisionDecimalStr === ".0") {
return numberWithoutDecimal;
}
return `${numberWithoutDecimal}${precisionDecimalStr}`;
}
const STEP_INTERVAL = 200;
const STEP_DELAY = 600;
const StepHandler = defineComponent({
compatConfig: {
MODE: 3
},
name: "StepHandler",
inheritAttrs: false,
props: {
prefixCls: String,
upDisabled: Boolean,
downDisabled: Boolean,
onStep: functionType()
},
slots: Object,
setup(props2, _ref) {
let {
slots,
emit
} = _ref;
const stepTimeoutRef = ref();
const onStepMouseDown = (e, up) => {
e.preventDefault();
emit("step", up);
function loopStep() {
emit("step", up);
stepTimeoutRef.value = setTimeout(loopStep, STEP_INTERVAL);
}
stepTimeoutRef.value = setTimeout(loopStep, STEP_DELAY);
};
const onStopStep = () => {
clearTimeout(stepTimeoutRef.value);
};
return () => {
if (isMobile()) {
return null;
}
const {
prefixCls,
upDisabled,
downDisabled
} = props2;
const handlerClassName = `${prefixCls}-handler`;
const upClassName = classNames(handlerClassName, `${handlerClassName}-up`, {
[`${handlerClassName}-up-disabled`]: upDisabled
});
const downClassName = classNames(handlerClassName, `${handlerClassName}-down`, {
[`${handlerClassName}-down-disabled`]: downDisabled
});
const sharedHandlerProps = {
unselectable: "on",
role: "button",
onMouseup: onStopStep,
onMouseleave: onStopStep
};
const {
upNode,
downNode
} = slots;
return createVNode("div", {
"class": `${handlerClassName}-wrap`
}, [createVNode("span", _objectSpread$W(_objectSpread$W({}, sharedHandlerProps), {}, {
"onMousedown": (e) => {
onStepMouseDown(e, true);
},
"aria-label": "Increase Value",
"aria-disabled": upDisabled,
"class": upClassName
}), [(upNode === null || upNode === void 0 ? void 0 : upNode()) || createVNode("span", {
"unselectable": "on",
"class": `${prefixCls}-handler-up-inner`
}, null)]), createVNode("span", _objectSpread$W(_objectSpread$W({}, sharedHandlerProps), {}, {
"onMousedown": (e) => {
onStepMouseDown(e, false);
},
"aria-label": "Decrease Value",
"aria-disabled": downDisabled,
"class": downClassName
}), [(downNode === null || downNode === void 0 ? void 0 : downNode()) || createVNode("span", {
"unselectable": "on",
"class": `${prefixCls}-handler-down-inner`
}, null)])]);
};
}
});
function useCursor(inputRef, focused) {
const selectionRef = ref(null);
function recordCursor() {
try {
const {
selectionStart: start,
selectionEnd: end,
value
} = inputRef.value;
const beforeTxt = value.substring(0, start);
const afterTxt = value.substring(end);
selectionRef.value = {
start,
end,
value,
beforeTxt,
afterTxt
};
} catch (e) {
}
}
function restoreCursor() {
if (inputRef.value && selectionRef.value && focused.value) {
try {
const {
value
} = inputRef.value;
const {
beforeTxt,
afterTxt,
start
} = selectionRef.value;
let startPos = value.length;
if (value.endsWith(afterTxt)) {
startPos = value.length - selectionRef.value.afterTxt.length;
} else if (value.startsWith(beforeTxt)) {
startPos = beforeTxt.length;
} else {
const beforeLastChar = beforeTxt[start - 1];
const newIndex = value.indexOf(beforeLastChar, start - 1);
if (newIndex !== -1) {
startPos = newIndex + 1;
}
}
inputRef.value.setSelectionRange(startPos, startPos);
} catch (e) {
warning$1(false, `Something warning of cursor restore. Please fire issue about this: ${e.message}`);
}
}
}
return [recordCursor, restoreCursor];
}
const useFrame = (() => {
const idRef = shallowRef(0);
const cleanUp = () => {
wrapperRaf.cancel(idRef.value);
};
return (callback) => {
cleanUp();
idRef.value = wrapperRaf(() => {
callback();
});
};
});
var __rest$z = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const getDecimalValue = (stringMode, decimalValue) => {
if (stringMode || decimalValue.isEmpty()) {
return decimalValue.toString();
}
return decimalValue.toNumber();
};
const getDecimalIfValidate = (value) => {
const decimal = getMiniDecimal(value);
return decimal.isInvalidate() ? null : decimal;
};
const inputNumberProps$1 = () => ({
/** value will show as string */
stringMode: booleanType(),
defaultValue: someType([String, Number]),
value: someType([String, Number]),
prefixCls: stringType(),
min: someType([String, Number]),
max: someType([String, Number]),
step: someType([String, Number], 1),
tabindex: Number,
controls: booleanType(true),
readonly: booleanType(),
disabled: booleanType(),
autofocus: booleanType(),
keyboard: booleanType(true),
/** Parse display value to validate number */
parser: functionType(),
/** Transform `value` to display value show in input */
formatter: functionType(),
/** Syntactic sugar of `formatter`. Config precision of display. */
precision: Number,
/** Syntactic sugar of `formatter`. Config decimal separator of display. */
decimalSeparator: String,
onInput: functionType(),
onChange: functionType(),
onPressEnter: functionType(),
onStep: functionType(),
onBlur: functionType(),
onFocus: functionType()
});
const VcInputNumber = defineComponent({
compatConfig: {
MODE: 3
},
name: "InnerInputNumber",
inheritAttrs: false,
props: _extends(_extends({}, inputNumberProps$1()), {
lazy: Boolean
}),
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots,
emit,
expose
} = _ref;
const inputRef = shallowRef();
const focus = shallowRef(false);
const userTypingRef = shallowRef(false);
const compositionRef = shallowRef(false);
const decimalValue = shallowRef(getMiniDecimal(props2.value));
function setUncontrolledDecimalValue(newDecimal) {
if (props2.value === void 0) {
decimalValue.value = newDecimal;
}
}
const getPrecision2 = (numStr, userTyping) => {
if (userTyping) {
return void 0;
}
if (props2.precision >= 0) {
return props2.precision;
}
return Math.max(getNumberPrecision(numStr), getNumberPrecision(props2.step));
};
const mergedParser = (num) => {
const numStr = String(num);
if (props2.parser) {
return props2.parser(numStr);
}
let parsedStr = numStr;
if (props2.decimalSeparator) {
parsedStr = parsedStr.replace(props2.decimalSeparator, ".");
}
return parsedStr.replace(/[^\w.-]+/g, "");
};
const inputValue = shallowRef("");
const mergedFormatter = (number, userTyping) => {
if (props2.formatter) {
return props2.formatter(number, {
userTyping,
input: String(inputValue.value)
});
}
let str = typeof number === "number" ? num2str(number) : number;
if (!userTyping) {
const mergedPrecision = getPrecision2(str, userTyping);
if (validateNumber(str) && (props2.decimalSeparator || mergedPrecision >= 0)) {
const separatorStr = props2.decimalSeparator || ".";
str = toFixed(str, separatorStr, mergedPrecision);
}
}
return str;
};
const initValue = (() => {
const initValue2 = props2.value;
if (decimalValue.value.isInvalidate() && ["string", "number"].includes(typeof initValue2)) {
return Number.isNaN(initValue2) ? "" : initValue2;
}
return mergedFormatter(decimalValue.value.toString(), false);
})();
inputValue.value = initValue;
function setInputValue(newValue, userTyping) {
inputValue.value = mergedFormatter(
// Invalidate number is sometime passed by external control, we should let it go
// Otherwise is controlled by internal interactive logic which check by userTyping
// You can ref 'show limited value when input is not focused' test for more info.
newValue.isInvalidate() ? newValue.toString(false) : newValue.toString(!userTyping),
userTyping
);
}
const maxDecimal = computed(() => getDecimalIfValidate(props2.max));
const minDecimal = computed(() => getDecimalIfValidate(props2.min));
const upDisabled = computed(() => {
if (!maxDecimal.value || !decimalValue.value || decimalValue.value.isInvalidate()) {
return false;
}
return maxDecimal.value.lessEquals(decimalValue.value);
});
const downDisabled = computed(() => {
if (!minDecimal.value || !decimalValue.value || decimalValue.value.isInvalidate()) {
return false;
}
return decimalValue.value.lessEquals(minDecimal.value);
});
const [recordCursor, restoreCursor] = useCursor(inputRef, focus);
const getRangeValue = (target) => {
if (maxDecimal.value && !target.lessEquals(maxDecimal.value)) {
return maxDecimal.value;
}
if (minDecimal.value && !minDecimal.value.lessEquals(target)) {
return minDecimal.value;
}
return null;
};
const isInRange2 = (target) => !getRangeValue(target);
const triggerValueUpdate = (newValue, userTyping) => {
var _a;
let updateValue = newValue;
let isRangeValidate = isInRange2(updateValue) || updateValue.isEmpty();
if (!updateValue.isEmpty() && !userTyping) {
updateValue = getRangeValue(updateValue) || updateValue;
isRangeValidate = true;
}
if (!props2.readonly && !props2.disabled && isRangeValidate) {
const numStr = updateValue.toString();
const mergedPrecision = getPrecision2(numStr, userTyping);
if (mergedPrecision >= 0) {
updateValue = getMiniDecimal(toFixed(numStr, ".", mergedPrecision));
}
if (!updateValue.equals(decimalValue.value)) {
setUncontrolledDecimalValue(updateValue);
(_a = props2.onChange) === null || _a === void 0 ? void 0 : _a.call(props2, updateValue.isEmpty() ? null : getDecimalValue(props2.stringMode, updateValue));
if (props2.value === void 0) {
setInputValue(updateValue, userTyping);
}
}
return updateValue;
}
return decimalValue.value;
};
const onNextPromise = useFrame();
const collectInputValue = (inputStr) => {
var _a;
recordCursor();
inputValue.value = inputStr;
if (!compositionRef.value) {
const finalValue = mergedParser(inputStr);
const finalDecimal = getMiniDecimal(finalValue);
if (!finalDecimal.isNaN()) {
triggerValueUpdate(finalDecimal, true);
}
}
(_a = props2.onInput) === null || _a === void 0 ? void 0 : _a.call(props2, inputStr);
onNextPromise(() => {
let nextInputStr = inputStr;
if (!props2.parser) {
nextInputStr = inputStr.replace(/。/g, ".");
}
if (nextInputStr !== inputStr) {
collectInputValue(nextInputStr);
}
});
};
const onCompositionStart = () => {
compositionRef.value = true;
};
const onCompositionEnd = () => {
compositionRef.value = false;
collectInputValue(inputRef.value.value);
};
const onInternalInput = (e) => {
collectInputValue(e.target.value);
};
const onInternalStep = (up) => {
var _a, _b;
if (up && upDisabled.value || !up && downDisabled.value) {
return;
}
userTypingRef.value = false;
let stepDecimal = getMiniDecimal(props2.step);
if (!up) {
stepDecimal = stepDecimal.negate();
}
const target = (decimalValue.value || getMiniDecimal(0)).add(stepDecimal.toString());
const updatedValue = triggerValueUpdate(target, false);
(_a = props2.onStep) === null || _a === void 0 ? void 0 : _a.call(props2, getDecimalValue(props2.stringMode, updatedValue), {
offset: props2.step,
type: up ? "up" : "down"
});
(_b = inputRef.value) === null || _b === void 0 ? void 0 : _b.focus();
};
const flushInputValue = (userTyping) => {
const parsedValue = getMiniDecimal(mergedParser(inputValue.value));
let formatValue2 = parsedValue;
if (!parsedValue.isNaN()) {
formatValue2 = triggerValueUpdate(parsedValue, userTyping);
} else {
formatValue2 = decimalValue.value;
}
if (props2.value !== void 0) {
setInputValue(decimalValue.value, false);
} else if (!formatValue2.isNaN()) {
setInputValue(formatValue2, false);
}
};
const onBeforeInput = () => {
userTypingRef.value = true;
};
const onKeyDown2 = (event) => {
var _a;
const {
which
} = event;
userTypingRef.value = true;
if (which === KeyCode.ENTER) {
if (!compositionRef.value) {
userTypingRef.value = false;
}
flushInputValue(false);
(_a = props2.onPressEnter) === null || _a === void 0 ? void 0 : _a.call(props2, event);
}
if (props2.keyboard === false) {
return;
}
if (!compositionRef.value && [KeyCode.UP, KeyCode.DOWN].includes(which)) {
onInternalStep(KeyCode.UP === which);
event.preventDefault();
}
};
const onKeyUp = () => {
userTypingRef.value = false;
};
const onBlur = (e) => {
flushInputValue(false);
focus.value = false;
userTypingRef.value = false;
emit("blur", e);
};
watch(() => props2.precision, () => {
if (!decimalValue.value.isInvalidate()) {
setInputValue(decimalValue.value, false);
}
}, {
flush: "post"
});
watch(() => props2.value, () => {
const newValue = getMiniDecimal(props2.value);
decimalValue.value = newValue;
const currentParsedValue = getMiniDecimal(mergedParser(inputValue.value));
if (!newValue.equals(currentParsedValue) || !userTypingRef.value || props2.formatter) {
setInputValue(newValue, userTypingRef.value);
}
}, {
flush: "post"
});
watch(inputValue, () => {
if (props2.formatter) {
restoreCursor();
}
}, {
flush: "post"
});
watch(() => props2.disabled, (val) => {
if (val) {
focus.value = false;
}
});
expose({
focus: () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur: () => {
var _a;
(_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.blur();
}
});
return () => {
const _a = _extends(_extends({}, attrs), props2), {
prefixCls = "rc-input-number",
min,
max,
step = 1,
defaultValue,
value,
disabled,
readonly,
keyboard,
controls = true,
autofocus,
stringMode,
parser,
formatter,
precision,
decimalSeparator,
onChange,
onInput,
onPressEnter,
onStep,
lazy,
class: className,
style
} = _a, inputProps2 = __rest$z(_a, ["prefixCls", "min", "max", "step", "defaultValue", "value", "disabled", "readonly", "keyboard", "controls", "autofocus", "stringMode", "parser", "formatter", "precision", "decimalSeparator", "onChange", "onInput", "onPressEnter", "onStep", "lazy", "class", "style"]);
const {
upHandler,
downHandler
} = slots;
const inputClassName = `${prefixCls}-input`;
const eventProps = {};
if (lazy) {
eventProps.onChange = onInternalInput;
} else {
eventProps.onInput = onInternalInput;
}
return createVNode("div", {
"class": classNames(prefixCls, className, {
[`${prefixCls}-focused`]: focus.value,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-readonly`]: readonly,
[`${prefixCls}-not-a-number`]: decimalValue.value.isNaN(),
[`${prefixCls}-out-of-range`]: !decimalValue.value.isInvalidate() && !isInRange2(decimalValue.value)
}),
"style": style,
"onKeydown": onKeyDown2,
"onKeyup": onKeyUp
}, [controls && createVNode(StepHandler, {
"prefixCls": prefixCls,
"upDisabled": upDisabled.value,
"downDisabled": downDisabled.value,
"onStep": onInternalStep
}, {
upNode: upHandler,
downNode: downHandler
}), createVNode("div", {
"class": `${inputClassName}-wrap`
}, [createVNode("input", _objectSpread$W(_objectSpread$W(_objectSpread$W({
"autofocus": autofocus,
"autocomplete": "off",
"role": "spinbutton",
"aria-valuemin": min,
"aria-valuemax": max,
"aria-valuenow": decimalValue.value.isInvalidate() ? null : decimalValue.value.toString(),
"step": step
}, inputProps2), {}, {
"ref": inputRef,
"class": inputClassName,
"value": inputValue.value,
"disabled": disabled,
"readonly": readonly,
"onFocus": (e) => {
focus.value = true;
emit("focus", e);
}
}, eventProps), {}, {
"onBlur": onBlur,
"onCompositionstart": onCompositionStart,
"onCompositionend": onCompositionEnd,
"onBeforeinput": onBeforeInput
}), null)])]);
};
}
});
function isValidValue(val) {
return val !== void 0 && val !== null;
}
const genInputNumberStyles = (token) => {
const {
componentCls,
lineWidth,
lineType,
colorBorder,
borderRadius,
fontSizeLG,
controlHeightLG,
controlHeightSM,
colorError,
inputPaddingHorizontalSM,
colorTextDescription,
motionDurationMid,
colorPrimary,
controlHeight,
inputPaddingHorizontal,
colorBgContainer,
colorTextDisabled,
borderRadiusSM,
borderRadiusLG,
controlWidth,
handleVisible
} = token;
return [
{
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), genBasicInputStyle(token)), genStatusStyle(token, componentCls)), {
display: "inline-block",
width: controlWidth,
margin: 0,
padding: 0,
border: `${lineWidth}px ${lineType} ${colorBorder}`,
borderRadius,
"&-rtl": {
direction: "rtl",
[`${componentCls}-input`]: {
direction: "rtl"
}
},
"&-lg": {
padding: 0,
fontSize: fontSizeLG,
borderRadius: borderRadiusLG,
[`input${componentCls}-input`]: {
height: controlHeightLG - 2 * lineWidth
}
},
"&-sm": {
padding: 0,
borderRadius: borderRadiusSM,
[`input${componentCls}-input`]: {
height: controlHeightSM - 2 * lineWidth,
padding: `0 ${inputPaddingHorizontalSM}px`
}
},
"&:hover": _extends({}, genHoverStyle(token)),
"&-focused": _extends({}, genActiveStyle(token)),
"&-disabled": _extends(_extends({}, genDisabledStyle(token)), {
[`${componentCls}-input`]: {
cursor: "not-allowed"
}
}),
// ===================== Out Of Range =====================
"&-out-of-range": {
input: {
color: colorError
}
},
// Style for input-group: input with label, with button or dropdown...
"&-group": _extends(_extends(_extends({}, resetComponent(token)), genInputGroupStyle(token)), {
"&-wrapper": {
display: "inline-block",
textAlign: "start",
verticalAlign: "top",
[`${componentCls}-affix-wrapper`]: {
width: "100%"
},
// Size
"&-lg": {
[`${componentCls}-group-addon`]: {
borderRadius: borderRadiusLG
}
},
"&-sm": {
[`${componentCls}-group-addon`]: {
borderRadius: borderRadiusSM
}
}
}
}),
[componentCls]: {
"&-input": _extends(_extends({
width: "100%",
height: controlHeight - 2 * lineWidth,
padding: `0 ${inputPaddingHorizontal}px`,
textAlign: "start",
backgroundColor: "transparent",
border: 0,
borderRadius,
outline: 0,
transition: `all ${motionDurationMid} linear`,
appearance: "textfield",
color: token.colorText,
fontSize: "inherit",
verticalAlign: "top"
}, genPlaceholderStyle(token.colorTextPlaceholder)), {
'&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button': {
margin: 0,
/* stylelint-disable-next-line property-no-vendor-prefix */
webkitAppearance: "none",
appearance: "none"
}
})
}
})
},
// Handler
{
[componentCls]: {
[`&:hover ${componentCls}-handler-wrap, &-focused ${componentCls}-handler-wrap`]: {
opacity: 1
},
[`${componentCls}-handler-wrap`]: {
position: "absolute",
insetBlockStart: 0,
insetInlineEnd: 0,
width: token.handleWidth,
height: "100%",
background: colorBgContainer,
borderStartStartRadius: 0,
borderStartEndRadius: borderRadius,
borderEndEndRadius: borderRadius,
borderEndStartRadius: 0,
opacity: handleVisible === true ? 1 : 0,
display: "flex",
flexDirection: "column",
alignItems: "stretch",
transition: `opacity ${motionDurationMid} linear ${motionDurationMid}`,
// Fix input number inside Menu makes icon too large
// We arise the selector priority by nest selector here
// https://github.com/ant-design/ant-design/issues/14367
[`${componentCls}-handler`]: {
display: "flex",
alignItems: "center",
justifyContent: "center",
flex: "auto",
height: "40%",
[`
${componentCls}-handler-up-inner,
${componentCls}-handler-down-inner
`]: {
marginInlineEnd: 0,
fontSize: token.handleFontSize
}
}
},
[`${componentCls}-handler`]: {
height: "50%",
overflow: "hidden",
color: colorTextDescription,
fontWeight: "bold",
lineHeight: 0,
textAlign: "center",
cursor: "pointer",
borderInlineStart: `${lineWidth}px ${lineType} ${colorBorder}`,
transition: `all ${motionDurationMid} linear`,
"&:active": {
background: token.colorFillAlter
},
// Hover
"&:hover": {
height: `60%`,
[`
${componentCls}-handler-up-inner,
${componentCls}-handler-down-inner
`]: {
color: colorPrimary
}
},
"&-up-inner, &-down-inner": _extends(_extends({}, resetIcon()), {
color: colorTextDescription,
transition: `all ${motionDurationMid} linear`,
userSelect: "none"
})
},
[`${componentCls}-handler-up`]: {
borderStartEndRadius: borderRadius
},
[`${componentCls}-handler-down`]: {
borderBlockStart: `${lineWidth}px ${lineType} ${colorBorder}`,
borderEndEndRadius: borderRadius
},
// Disabled
"&-disabled, &-readonly": {
[`${componentCls}-handler-wrap`]: {
display: "none"
},
[`${componentCls}-input`]: {
color: "inherit"
}
},
[`
${componentCls}-handler-up-disabled,
${componentCls}-handler-down-disabled
`]: {
cursor: "not-allowed"
},
[`
${componentCls}-handler-up-disabled:hover &-handler-up-inner,
${componentCls}-handler-down-disabled:hover &-handler-down-inner
`]: {
color: colorTextDisabled
}
}
},
// Border-less
{
[`${componentCls}-borderless`]: {
borderColor: "transparent",
boxShadow: "none",
[`${componentCls}-handler-down`]: {
borderBlockStartWidth: 0
}
}
}
];
};
const genAffixWrapperStyles = (token) => {
const {
componentCls,
inputPaddingHorizontal,
inputAffixPadding,
controlWidth,
borderRadiusLG,
borderRadiusSM
} = token;
return {
[`${componentCls}-affix-wrapper`]: _extends(_extends(_extends({}, genBasicInputStyle(token)), genStatusStyle(token, `${componentCls}-affix-wrapper`)), {
// or number handler will cover form status
position: "relative",
display: "inline-flex",
width: controlWidth,
padding: 0,
paddingInlineStart: inputPaddingHorizontal,
"&-lg": {
borderRadius: borderRadiusLG
},
"&-sm": {
borderRadius: borderRadiusSM
},
[`&:not(${componentCls}-affix-wrapper-disabled):hover`]: _extends(_extends({}, genHoverStyle(token)), {
zIndex: 1
}),
"&-focused, &:focus": {
zIndex: 1
},
"&-disabled": {
[`${componentCls}[disabled]`]: {
background: "transparent"
}
},
[`> div${componentCls}`]: {
width: "100%",
border: "none",
outline: "none",
[`&${componentCls}-focused`]: {
boxShadow: "none !important"
}
},
[`input${componentCls}-input`]: {
padding: 0
},
"&::before": {
width: 0,
visibility: "hidden",
content: '"\\a0"'
},
[`${componentCls}-handler-wrap`]: {
zIndex: 2
},
[componentCls]: {
"&-prefix, &-suffix": {
display: "flex",
flex: "none",
alignItems: "center",
pointerEvents: "none"
},
"&-prefix": {
marginInlineEnd: inputAffixPadding
},
"&-suffix": {
position: "absolute",
insetBlockStart: 0,
insetInlineEnd: 0,
zIndex: 1,
height: "100%",
marginInlineEnd: inputPaddingHorizontal,
marginInlineStart: inputAffixPadding
}
}
})
};
};
const useStyle$o = genComponentStyleHook("InputNumber", (token) => {
const inputNumberToken = initInputToken(token);
return [
genInputNumberStyles(inputNumberToken),
genAffixWrapperStyles(inputNumberToken),
// =====================================================
// == Space Compact ==
// =====================================================
genCompactItemStyle(inputNumberToken)
];
}, (token) => ({
controlWidth: 90,
handleWidth: token.controlHeightSM - token.lineWidth * 2,
handleFontSize: token.fontSize / 2,
handleVisible: "auto"
}));
var __rest$y = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const baseProps$1 = inputNumberProps$1();
const inputNumberProps = () => _extends(_extends({}, baseProps$1), {
size: stringType(),
bordered: booleanType(true),
placeholder: String,
name: String,
id: String,
type: String,
addonBefore: PropTypes.any,
addonAfter: PropTypes.any,
prefix: PropTypes.any,
"onUpdate:value": baseProps$1.onChange,
valueModifiers: Object,
status: stringType()
});
const InputNumber = defineComponent({
compatConfig: {
MODE: 3
},
name: "AInputNumber",
inheritAttrs: false,
props: inputNumberProps(),
// emits: ['focus', 'blur', 'change', 'input', 'update:value'],
slots: Object,
setup(props2, _ref) {
let {
emit,
expose,
attrs,
slots
} = _ref;
var _a;
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
const {
prefixCls,
size,
direction,
disabled
} = useConfigInject("input-number", props2);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const disabledContext = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a2;
return (_a2 = disabled.value) !== null && _a2 !== void 0 ? _a2 : disabledContext.value;
});
const [wrapSSR, hashId] = useStyle$o(prefixCls);
const mergedSize = computed(() => compactSize.value || size.value);
const mergedValue = shallowRef((_a = props2.value) !== null && _a !== void 0 ? _a : props2.defaultValue);
const focused = shallowRef(false);
watch(() => props2.value, () => {
mergedValue.value = props2.value;
});
const inputNumberRef = shallowRef(null);
const focus = () => {
var _a2;
(_a2 = inputNumberRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus();
};
const blur = () => {
var _a2;
(_a2 = inputNumberRef.value) === null || _a2 === void 0 ? void 0 : _a2.blur();
};
expose({
focus,
blur
});
const handleChange = (val) => {
if (props2.value === void 0) {
mergedValue.value = val;
}
emit("update:value", val);
emit("change", val);
formItemContext.onFieldChange();
};
const handleBlur = (e) => {
focused.value = false;
emit("blur", e);
formItemContext.onFieldBlur();
};
const handleFocus = (e) => {
focused.value = true;
emit("focus", e);
};
return () => {
var _a2, _b, _c, _d;
const {
hasFeedback,
isFormItemInput,
feedbackIcon
} = formItemInputContext;
const id = (_a2 = props2.id) !== null && _a2 !== void 0 ? _a2 : formItemContext.id.value;
const _e = _extends(_extends(_extends({}, attrs), props2), {
id,
disabled: mergedDisabled.value
}), {
class: className,
bordered,
readonly,
style,
addonBefore = (_b = slots.addonBefore) === null || _b === void 0 ? void 0 : _b.call(slots),
addonAfter = (_c = slots.addonAfter) === null || _c === void 0 ? void 0 : _c.call(slots),
prefix = (_d = slots.prefix) === null || _d === void 0 ? void 0 : _d.call(slots),
valueModifiers = {}
} = _e, others = __rest$y(_e, ["class", "bordered", "readonly", "style", "addonBefore", "addonAfter", "prefix", "valueModifiers"]);
const preCls = prefixCls.value;
const inputNumberClass = classNames({
[`${preCls}-lg`]: mergedSize.value === "large",
[`${preCls}-sm`]: mergedSize.value === "small",
[`${preCls}-rtl`]: direction.value === "rtl",
[`${preCls}-readonly`]: readonly,
[`${preCls}-borderless`]: !bordered,
[`${preCls}-in-form-item`]: isFormItemInput
}, getStatusClassNames(preCls, mergedStatus.value), className, compactItemClassnames.value, hashId.value);
let element = createVNode(VcInputNumber, _objectSpread$W(_objectSpread$W({}, omit(others, ["size", "defaultValue"])), {}, {
"ref": inputNumberRef,
"lazy": !!valueModifiers.lazy,
"value": mergedValue.value,
"class": inputNumberClass,
"prefixCls": preCls,
"readonly": readonly,
"onChange": handleChange,
"onBlur": handleBlur,
"onFocus": handleFocus
}), {
upHandler: slots.upIcon ? () => createVNode("span", {
"class": `${preCls}-handler-up-inner`
}, [slots.upIcon()]) : () => createVNode(UpOutlined, {
"class": `${preCls}-handler-up-inner`
}, null),
downHandler: slots.downIcon ? () => createVNode("span", {
"class": `${preCls}-handler-down-inner`
}, [slots.downIcon()]) : () => createVNode(DownOutlined, {
"class": `${preCls}-handler-down-inner`
}, null)
});
const hasAddon2 = isValidValue(addonBefore) || isValidValue(addonAfter);
const hasPrefix = isValidValue(prefix);
if (hasPrefix || hasFeedback) {
const affixWrapperCls = classNames(`${preCls}-affix-wrapper`, getStatusClassNames(`${preCls}-affix-wrapper`, mergedStatus.value, hasFeedback), {
[`${preCls}-affix-wrapper-focused`]: focused.value,
[`${preCls}-affix-wrapper-disabled`]: mergedDisabled.value,
[`${preCls}-affix-wrapper-sm`]: mergedSize.value === "small",
[`${preCls}-affix-wrapper-lg`]: mergedSize.value === "large",
[`${preCls}-affix-wrapper-rtl`]: direction.value === "rtl",
[`${preCls}-affix-wrapper-readonly`]: readonly,
[`${preCls}-affix-wrapper-borderless`]: !bordered,
// className will go to addon wrapper
[`${className}`]: !hasAddon2 && className
}, hashId.value);
element = createVNode("div", {
"class": affixWrapperCls,
"style": style,
"onClick": focus
}, [hasPrefix && createVNode("span", {
"class": `${preCls}-prefix`
}, [prefix]), element, hasFeedback && createVNode("span", {
"class": `${preCls}-suffix`
}, [feedbackIcon])]);
}
if (hasAddon2) {
const wrapperClassName = `${preCls}-group`;
const addonClassName = `${wrapperClassName}-addon`;
const addonBeforeNode = addonBefore ? createVNode("div", {
"class": addonClassName
}, [addonBefore]) : null;
const addonAfterNode = addonAfter ? createVNode("div", {
"class": addonClassName
}, [addonAfter]) : null;
const mergedWrapperClassName = classNames(`${preCls}-wrapper`, wrapperClassName, {
[`${wrapperClassName}-rtl`]: direction.value === "rtl"
}, hashId.value);
const mergedGroupClassName = classNames(`${preCls}-group-wrapper`, {
[`${preCls}-group-wrapper-sm`]: mergedSize.value === "small",
[`${preCls}-group-wrapper-lg`]: mergedSize.value === "large",
[`${preCls}-group-wrapper-rtl`]: direction.value === "rtl"
}, getStatusClassNames(`${prefixCls}-group-wrapper`, mergedStatus.value, hasFeedback), className, hashId.value);
element = createVNode("div", {
"class": mergedGroupClassName,
"style": style
}, [createVNode("div", {
"class": mergedWrapperClassName
}, [addonBeforeNode && createVNode(NoCompactStyle, null, {
default: () => [createVNode(NoFormStatus, null, {
default: () => [addonBeforeNode]
})]
}), element, addonAfterNode && createVNode(NoCompactStyle, null, {
default: () => [createVNode(NoFormStatus, null, {
default: () => [addonAfterNode]
})]
})])]);
}
return wrapSSR(cloneElement(element, {
style
}));
};
}
});
const index$g = _extends(InputNumber, {
install: (app) => {
app.component(InputNumber.name, InputNumber);
return app;
}
});
const genLayoutLightStyle = (token) => {
const {
componentCls,
colorBgContainer,
colorBgBody,
colorText
} = token;
return {
[`${componentCls}-sider-light`]: {
background: colorBgContainer,
[`${componentCls}-sider-trigger`]: {
color: colorText,
background: colorBgContainer
},
[`${componentCls}-sider-zero-width-trigger`]: {
color: colorText,
background: colorBgContainer,
border: `1px solid ${colorBgBody}`,
borderInlineStart: 0
}
}
};
};
const genLayoutStyle = (token) => {
const {
antCls,
// .ant
componentCls,
// .ant-layout
colorText,
colorTextLightSolid,
colorBgHeader,
colorBgBody,
colorBgTrigger,
layoutHeaderHeight,
layoutHeaderPaddingInline,
layoutHeaderColor,
layoutFooterPadding,
layoutTriggerHeight,
layoutZeroTriggerSize,
motionDurationMid,
motionDurationSlow,
fontSize,
borderRadius
} = token;
return {
[componentCls]: _extends(_extends({
display: "flex",
flex: "auto",
flexDirection: "column",
color: colorText,
/* fix firefox can't set height smaller than content on flex item */
minHeight: 0,
background: colorBgBody,
"&, *": {
boxSizing: "border-box"
},
[`&${componentCls}-has-sider`]: {
flexDirection: "row",
[`> ${componentCls}, > ${componentCls}-content`]: {
// https://segmentfault.com/a/1190000019498300
width: 0
}
},
[`${componentCls}-header, &${componentCls}-footer`]: {
flex: "0 0 auto"
},
[`${componentCls}-header`]: {
height: layoutHeaderHeight,
paddingInline: layoutHeaderPaddingInline,
color: layoutHeaderColor,
lineHeight: `${layoutHeaderHeight}px`,
background: colorBgHeader,
// Other components/menu/style/index.less line:686
// Integration with header element so menu items have the same height
[`${antCls}-menu`]: {
lineHeight: "inherit"
}
},
[`${componentCls}-footer`]: {
padding: layoutFooterPadding,
color: colorText,
fontSize,
background: colorBgBody
},
[`${componentCls}-content`]: {
flex: "auto",
// fix firefox can't set height smaller than content on flex item
minHeight: 0
},
[`${componentCls}-sider`]: {
position: "relative",
// fix firefox can't set width smaller than content on flex item
minWidth: 0,
background: colorBgHeader,
transition: `all ${motionDurationMid}, background 0s`,
"&-children": {
height: "100%",
// Hack for fixing margin collapse bug
// https://github.com/ant-design/ant-design/issues/7967
// solution from https://stackoverflow.com/a/33132624/3040605
marginTop: -0.1,
paddingTop: 0.1,
[`${antCls}-menu${antCls}-menu-inline-collapsed`]: {
width: "auto"
}
},
"&-has-trigger": {
paddingBottom: layoutTriggerHeight
},
"&-right": {
order: 1
},
"&-trigger": {
position: "fixed",
bottom: 0,
zIndex: 1,
height: layoutTriggerHeight,
color: colorTextLightSolid,
lineHeight: `${layoutTriggerHeight}px`,
textAlign: "center",
background: colorBgTrigger,
cursor: "pointer",
transition: `all ${motionDurationMid}`
},
"&-zero-width": {
"> *": {
overflow: "hidden"
},
"&-trigger": {
position: "absolute",
top: layoutHeaderHeight,
insetInlineEnd: -layoutZeroTriggerSize,
zIndex: 1,
width: layoutZeroTriggerSize,
height: layoutZeroTriggerSize,
color: colorTextLightSolid,
fontSize: token.fontSizeXL,
display: "flex",
alignItems: "center",
justifyContent: "center",
background: colorBgHeader,
borderStartStartRadius: 0,
borderStartEndRadius: borderRadius,
borderEndEndRadius: borderRadius,
borderEndStartRadius: 0,
cursor: "pointer",
transition: `background ${motionDurationSlow} ease`,
"&::after": {
position: "absolute",
inset: 0,
background: "transparent",
transition: `all ${motionDurationSlow}`,
content: '""'
},
"&:hover::after": {
// FIXME: Hardcode, but seems no need to create a token for this
background: `rgba(255, 255, 255, 0.2)`
},
"&-right": {
insetInlineStart: -layoutZeroTriggerSize,
borderStartStartRadius: borderRadius,
borderStartEndRadius: 0,
borderEndEndRadius: 0,
borderEndStartRadius: borderRadius
}
}
}
}
}, genLayoutLightStyle(token)), {
// RTL
"&-rtl": {
direction: "rtl"
}
})
};
};
const useStyle$n = genComponentStyleHook("Layout", (token) => {
const {
colorText,
controlHeightSM,
controlHeight,
controlHeightLG,
marginXXS
} = token;
const layoutHeaderPaddingInline = controlHeightLG * 1.25;
const layoutToken = merge(token, {
// Layout
layoutHeaderHeight: controlHeight * 2,
layoutHeaderPaddingInline,
layoutHeaderColor: colorText,
layoutFooterPadding: `${controlHeightSM}px ${layoutHeaderPaddingInline}px`,
layoutTriggerHeight: controlHeightLG + marginXXS * 2,
layoutZeroTriggerSize: controlHeightLG
});
return [genLayoutStyle(layoutToken)];
}, (token) => {
const {
colorBgLayout
} = token;
return {
colorBgHeader: "#001529",
colorBgBody: colorBgLayout,
colorBgTrigger: "#002140"
};
});
const basicProps = () => ({
prefixCls: String,
hasSider: {
type: Boolean,
default: void 0
},
tagName: String
});
function generator(_ref) {
let {
suffixCls,
tagName,
name
} = _ref;
return (BasicComponent) => {
const Adapter = defineComponent({
compatConfig: {
MODE: 3
},
name,
props: basicProps(),
setup(props2, _ref2) {
let {
slots
} = _ref2;
const {
prefixCls
} = useConfigInject(suffixCls, props2);
return () => {
const basicComponentProps = _extends(_extends({}, props2), {
prefixCls: prefixCls.value,
tagName
});
return createVNode(BasicComponent, basicComponentProps, slots);
};
}
});
return Adapter;
};
}
const Basic = defineComponent({
compatConfig: {
MODE: 3
},
props: basicProps(),
setup(props2, _ref3) {
let {
slots
} = _ref3;
return () => createVNode(props2.tagName, {
class: props2.prefixCls
}, slots);
}
});
const BasicLayout = defineComponent({
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: basicProps(),
setup(props2, _ref4) {
let {
slots,
attrs
} = _ref4;
const {
prefixCls,
direction
} = useConfigInject("", props2);
const [wrapSSR, hashId] = useStyle$n(prefixCls);
const siders = ref([]);
const siderHookProvider = {
addSider: (id) => {
siders.value = [...siders.value, id];
},
removeSider: (id) => {
siders.value = siders.value.filter((currentId) => currentId !== id);
}
};
provide(SiderHookProviderKey, siderHookProvider);
const divCls = computed(() => {
const {
prefixCls: prefixCls2,
hasSider
} = props2;
return {
[hashId.value]: true,
[`${prefixCls2}`]: true,
[`${prefixCls2}-has-sider`]: typeof hasSider === "boolean" ? hasSider : siders.value.length > 0,
[`${prefixCls2}-rtl`]: direction.value === "rtl"
};
});
return () => {
const {
tagName
} = props2;
return wrapSSR(createVNode(tagName, _extends(_extends({}, attrs), {
class: [divCls.value, attrs.class]
}), slots));
};
}
});
const Layout = generator({
suffixCls: "layout",
tagName: "section",
name: "ALayout"
})(BasicLayout);
const Header$1 = generator({
suffixCls: "layout-header",
tagName: "header",
name: "ALayoutHeader"
})(Basic);
const Footer$1 = generator({
suffixCls: "layout-footer",
tagName: "footer",
name: "ALayoutFooter"
})(Basic);
const Content = generator({
suffixCls: "layout-content",
tagName: "main",
name: "ALayoutContent"
})(Basic);
const siderProps = () => ({
prefixCls: String,
collapsible: {
type: Boolean,
default: void 0
},
collapsed: {
type: Boolean,
default: void 0
},
defaultCollapsed: {
type: Boolean,
default: void 0
},
reverseArrow: {
type: Boolean,
default: void 0
},
zeroWidthTriggerStyle: {
type: Object,
default: void 0
},
trigger: PropTypes.any,
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
collapsedWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
breakpoint: PropTypes.oneOf(tuple$1("xs", "sm", "md", "lg", "xl", "xxl", "xxxl")),
theme: PropTypes.oneOf(tuple$1("light", "dark")).def("dark"),
onBreakpoint: Function,
onCollapse: Function
});
const generateId = /* @__PURE__ */ (() => {
let i = 0;
return function() {
let prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
i += 1;
return `${prefix}${i}`;
};
})();
const Sider = defineComponent({
compatConfig: {
MODE: 3
},
name: "ALayoutSider",
inheritAttrs: false,
props: initDefaultProps(siderProps(), {
collapsible: false,
defaultCollapsed: false,
reverseArrow: false,
width: 200,
collapsedWidth: 80
}),
emits: ["breakpoint", "update:collapsed", "collapse"],
setup(props2, _ref) {
let {
emit,
attrs,
slots
} = _ref;
const {
prefixCls
} = useConfigInject("layout-sider", props2);
const siderHook = inject(SiderHookProviderKey, void 0);
const collapsed = shallowRef(!!(props2.collapsed !== void 0 ? props2.collapsed : props2.defaultCollapsed));
const below = shallowRef(false);
watch(() => props2.collapsed, () => {
collapsed.value = !!props2.collapsed;
});
provide(SiderCollapsedKey, collapsed);
const handleSetCollapsed = (value, type) => {
if (props2.collapsed === void 0) {
collapsed.value = value;
}
emit("update:collapsed", value);
emit("collapse", value, type);
};
shallowRef((mql2) => {
below.value = mql2.matches;
emit("breakpoint", mql2.matches);
if (collapsed.value !== mql2.matches) {
handleSetCollapsed(mql2.matches, "responsive");
}
});
const uniqueId = generateId("ant-sider-");
siderHook && siderHook.addSider(uniqueId);
const toggle = () => {
handleSetCollapsed(!collapsed.value, "clickTrigger");
};
return () => {
var _a, _b;
const pre = prefixCls.value;
const {
collapsedWidth,
width,
reverseArrow,
zeroWidthTriggerStyle,
trigger = (_a = slots.trigger) === null || _a === void 0 ? void 0 : _a.call(slots),
collapsible,
theme
} = props2;
const rawWidth = collapsed.value ? collapsedWidth : width;
const siderWidth = isNumeric(rawWidth) ? `${rawWidth}px` : String(rawWidth);
const zeroWidthTrigger = parseFloat(String(collapsedWidth || 0)) === 0 ? createVNode("span", {
"onClick": toggle,
"class": classNames(`${pre}-zero-width-trigger`, `${pre}-zero-width-trigger-${reverseArrow ? "right" : "left"}`),
"style": zeroWidthTriggerStyle
}, [trigger || createVNode(BarsOutlined, null, null)]) : null;
const iconObj = {
expanded: reverseArrow ? createVNode(RightOutlined, null, null) : createVNode(LeftOutlined, null, null),
collapsed: reverseArrow ? createVNode(LeftOutlined, null, null) : createVNode(RightOutlined, null, null)
};
const status = collapsed.value ? "collapsed" : "expanded";
const defaultTrigger = iconObj[status];
const triggerDom = trigger !== null ? zeroWidthTrigger || createVNode("div", {
"class": `${pre}-trigger`,
"onClick": toggle,
"style": {
width: siderWidth
}
}, [trigger || defaultTrigger]) : null;
const divStyle = [attrs.style, {
flex: `0 0 ${siderWidth}`,
maxWidth: siderWidth,
minWidth: siderWidth,
width: siderWidth
}];
const siderCls = classNames(pre, `${pre}-${theme}`, {
[`${pre}-collapsed`]: !!collapsed.value,
[`${pre}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
[`${pre}-below`]: !!below.value,
[`${pre}-zero-width`]: parseFloat(siderWidth) === 0
}, attrs.class);
return createVNode("aside", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": siderCls,
"style": divStyle
}), [createVNode("div", {
"class": `${pre}-children`
}, [(_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots)]), collapsible || below.value && zeroWidthTrigger ? triggerDom : null]);
};
}
});
const LayoutHeader = Header$1;
const LayoutFooter = Footer$1;
const LayoutSider = Sider;
const LayoutContent = Content;
const index$f = _extends(Layout, {
Header: Header$1,
Footer: Footer$1,
Content,
Sider,
install: (app) => {
app.component(Layout.name, Layout);
app.component(Header$1.name, Header$1);
app.component(Footer$1.name, Footer$1);
app.component(Sider.name, Sider);
app.component(Content.name, Content);
return app;
}
});
const antSpinMove = new Keyframe("antSpinMove", {
to: {
opacity: 1
}
});
const antRotate = new Keyframe("antRotate", {
to: {
transform: "rotate(405deg)"
}
});
const genSpinStyle = (token) => ({
[`${token.componentCls}`]: _extends(_extends({}, resetComponent(token)), {
position: "absolute",
display: "none",
color: token.colorPrimary,
textAlign: "center",
verticalAlign: "middle",
opacity: 0,
transition: `transform ${token.motionDurationSlow} ${token.motionEaseInOutCirc}`,
"&-spinning": {
position: "static",
display: "inline-block",
opacity: 1
},
"&-nested-loading": {
position: "relative",
[`> div > ${token.componentCls}`]: {
position: "absolute",
top: 0,
insetInlineStart: 0,
zIndex: 4,
display: "block",
width: "100%",
height: "100%",
maxHeight: token.contentHeight,
[`${token.componentCls}-dot`]: {
position: "absolute",
top: "50%",
insetInlineStart: "50%",
margin: -token.spinDotSize / 2
},
[`${token.componentCls}-text`]: {
position: "absolute",
top: "50%",
width: "100%",
paddingTop: (token.spinDotSize - token.fontSize) / 2 + 2,
textShadow: `0 1px 2px ${token.colorBgContainer}`
// FIXME: shadow
},
[`&${token.componentCls}-show-text ${token.componentCls}-dot`]: {
marginTop: -(token.spinDotSize / 2) - 10
},
"&-sm": {
[`${token.componentCls}-dot`]: {
margin: -token.spinDotSizeSM / 2
},
[`${token.componentCls}-text`]: {
paddingTop: (token.spinDotSizeSM - token.fontSize) / 2 + 2
},
[`&${token.componentCls}-show-text ${token.componentCls}-dot`]: {
marginTop: -(token.spinDotSizeSM / 2) - 10
}
},
"&-lg": {
[`${token.componentCls}-dot`]: {
margin: -(token.spinDotSizeLG / 2)
},
[`${token.componentCls}-text`]: {
paddingTop: (token.spinDotSizeLG - token.fontSize) / 2 + 2
},
[`&${token.componentCls}-show-text ${token.componentCls}-dot`]: {
marginTop: -(token.spinDotSizeLG / 2) - 10
}
}
},
[`${token.componentCls}-container`]: {
position: "relative",
transition: `opacity ${token.motionDurationSlow}`,
"&::after": {
position: "absolute",
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
zIndex: 10,
width: "100%",
height: "100%",
background: token.colorBgContainer,
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
content: '""',
pointerEvents: "none"
}
},
[`${token.componentCls}-blur`]: {
clear: "both",
opacity: 0.5,
userSelect: "none",
pointerEvents: "none",
[`&::after`]: {
opacity: 0.4,
pointerEvents: "auto"
}
}
},
// tip
// ------------------------------
[`&-tip`]: {
color: token.spinDotDefault
},
// dots
// ------------------------------
[`${token.componentCls}-dot`]: {
position: "relative",
display: "inline-block",
fontSize: token.spinDotSize,
width: "1em",
height: "1em",
"&-item": {
position: "absolute",
display: "block",
width: (token.spinDotSize - token.marginXXS / 2) / 2,
height: (token.spinDotSize - token.marginXXS / 2) / 2,
backgroundColor: token.colorPrimary,
borderRadius: "100%",
transform: "scale(0.75)",
transformOrigin: "50% 50%",
opacity: 0.3,
animationName: antSpinMove,
animationDuration: "1s",
animationIterationCount: "infinite",
animationTimingFunction: "linear",
animationDirection: "alternate",
"&:nth-child(1)": {
top: 0,
insetInlineStart: 0
},
"&:nth-child(2)": {
top: 0,
insetInlineEnd: 0,
animationDelay: "0.4s"
},
"&:nth-child(3)": {
insetInlineEnd: 0,
bottom: 0,
animationDelay: "0.8s"
},
"&:nth-child(4)": {
bottom: 0,
insetInlineStart: 0,
animationDelay: "1.2s"
}
},
"&-spin": {
transform: "rotate(45deg)",
animationName: antRotate,
animationDuration: "1.2s",
animationIterationCount: "infinite",
animationTimingFunction: "linear"
}
},
// Sizes
// ------------------------------
// small
[`&-sm ${token.componentCls}-dot`]: {
fontSize: token.spinDotSizeSM,
i: {
width: (token.spinDotSizeSM - token.marginXXS / 2) / 2,
height: (token.spinDotSizeSM - token.marginXXS / 2) / 2
}
},
// large
[`&-lg ${token.componentCls}-dot`]: {
fontSize: token.spinDotSizeLG,
i: {
width: (token.spinDotSizeLG - token.marginXXS) / 2,
height: (token.spinDotSizeLG - token.marginXXS) / 2
}
},
[`&${token.componentCls}-show-text ${token.componentCls}-text`]: {
display: "block"
}
})
});
const useStyle$m = genComponentStyleHook("Spin", (token) => {
const spinToken = merge(token, {
spinDotDefault: token.colorTextDescription,
spinDotSize: token.controlHeightLG / 2,
spinDotSizeSM: token.controlHeightLG * 0.35,
spinDotSizeLG: token.controlHeight
});
return [genSpinStyle(spinToken)];
}, {
contentHeight: 400
});
var __rest$x = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const spinProps = () => ({
prefixCls: String,
spinning: {
type: Boolean,
default: void 0
},
size: String,
wrapperClassName: String,
tip: PropTypes.any,
delay: Number,
indicator: PropTypes.any
});
let defaultIndicator = null;
function shouldDelay(spinning, delay) {
return !!spinning && !!delay && !isNaN(Number(delay));
}
function setDefaultIndicator(Content2) {
const Indicator = Content2.indicator;
defaultIndicator = typeof Indicator === "function" ? Indicator : () => createVNode(Indicator, null, null);
}
const Spin = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASpin",
inheritAttrs: false,
props: initDefaultProps(spinProps(), {
size: "default",
spinning: true,
wrapperClassName: ""
}),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const {
prefixCls,
size,
direction
} = useConfigInject("spin", props2);
const [wrapSSR, hashId] = useStyle$m(prefixCls);
const sSpinning = shallowRef(props2.spinning && !shouldDelay(props2.spinning, props2.delay));
let updateSpinning;
watch([() => props2.spinning, () => props2.delay], () => {
updateSpinning === null || updateSpinning === void 0 ? void 0 : updateSpinning.cancel();
updateSpinning = debounce(props2.delay, () => {
sSpinning.value = props2.spinning;
});
updateSpinning === null || updateSpinning === void 0 ? void 0 : updateSpinning();
}, {
immediate: true,
flush: "post"
});
return () => {
var _a, _b;
const {
class: cls
} = attrs, divProps = __rest$x(attrs, ["class"]);
const {
tip = (_a = slots.tip) === null || _a === void 0 ? void 0 : _a.call(slots)
} = props2;
const children = (_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots);
const spinClassName = {
[hashId.value]: true,
[prefixCls.value]: true,
[`${prefixCls.value}-sm`]: size.value === "small",
[`${prefixCls.value}-lg`]: size.value === "large",
[`${prefixCls.value}-spinning`]: sSpinning.value,
[`${prefixCls.value}-show-text`]: !!tip,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[cls]: !!cls
};
function renderIndicator(prefixCls2) {
const dotClassName = `${prefixCls2}-dot`;
let indicator = getPropsSlot(slots, props2, "indicator");
if (indicator === null) {
return null;
}
if (Array.isArray(indicator)) {
indicator = indicator.length === 1 ? indicator[0] : indicator;
}
if (isVNode(indicator)) {
return cloneVNode(indicator, {
class: dotClassName
});
}
if (defaultIndicator && isVNode(defaultIndicator())) {
return cloneVNode(defaultIndicator(), {
class: dotClassName
});
}
return createVNode("span", {
"class": `${dotClassName} ${prefixCls2}-dot-spin`
}, [createVNode("i", {
"class": `${prefixCls2}-dot-item`
}, null), createVNode("i", {
"class": `${prefixCls2}-dot-item`
}, null), createVNode("i", {
"class": `${prefixCls2}-dot-item`
}, null), createVNode("i", {
"class": `${prefixCls2}-dot-item`
}, null)]);
}
const spinElement = createVNode("div", _objectSpread$W(_objectSpread$W({}, divProps), {}, {
"class": spinClassName,
"aria-live": "polite",
"aria-busy": sSpinning.value
}), [renderIndicator(prefixCls.value), tip ? createVNode("div", {
"class": `${prefixCls.value}-text`
}, [tip]) : null]);
if (children && filterEmpty(children).length) {
const containerClassName = {
[`${prefixCls.value}-container`]: true,
[`${prefixCls.value}-blur`]: sSpinning.value
};
return wrapSSR(createVNode("div", {
"class": [`${prefixCls.value}-nested-loading`, props2.wrapperClassName, hashId.value]
}, [sSpinning.value && createVNode("div", {
"key": "loading"
}, [spinElement]), createVNode("div", {
"class": containerClassName,
"key": "container"
}, [children])]));
}
return wrapSSR(spinElement);
};
}
});
Spin.setDefaultIndicator = setDefaultIndicator;
Spin.install = function(app) {
app.component(Spin.name, Spin);
return app;
};
const MiniSelect = defineComponent({
name: "MiniSelect",
compatConfig: {
MODE: 3
},
inheritAttrs: false,
props: selectProps(),
Option: Select.Option,
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
return () => {
const selelctProps = _extends(_extends(_extends({}, props2), {
size: "small"
}), attrs);
return createVNode(Select, selelctProps, slots);
};
}
});
const MiddleSelect = defineComponent({
name: "MiddleSelect",
inheritAttrs: false,
props: selectProps(),
Option: Select.Option,
setup(props2, _ref2) {
let {
attrs,
slots
} = _ref2;
return () => {
const selelctProps = _extends(_extends(_extends({}, props2), {
size: "middle"
}), attrs);
return createVNode(Select, selelctProps, slots);
};
}
});
const Pager = defineComponent({
compatConfig: {
MODE: 3
},
name: "Pager",
inheritAttrs: false,
props: {
rootPrefixCls: String,
page: Number,
active: {
type: Boolean,
default: void 0
},
last: {
type: Boolean,
default: void 0
},
locale: PropTypes.object,
showTitle: {
type: Boolean,
default: void 0
},
itemRender: {
type: Function,
default: () => {
}
},
onClick: {
type: Function
},
onKeypress: {
type: Function
}
},
eimt: ["click", "keypress"],
setup(props2, _ref) {
let {
emit,
attrs
} = _ref;
const handleClick = () => {
emit("click", props2.page);
};
const handleKeyPress = (event) => {
emit("keypress", event, handleClick, props2.page);
};
return () => {
const {
showTitle,
page,
itemRender
} = props2;
const {
class: _cls,
style
} = attrs;
const prefixCls = `${props2.rootPrefixCls}-item`;
const cls = classNames(prefixCls, `${prefixCls}-${props2.page}`, {
[`${prefixCls}-active`]: props2.active,
[`${prefixCls}-disabled`]: !props2.page
}, _cls);
return createVNode("li", {
"onClick": handleClick,
"onKeypress": handleKeyPress,
"title": showTitle ? String(page) : null,
"tabindex": "0",
"class": cls,
"style": style
}, [itemRender({
page,
type: "page",
originalElement: createVNode("a", {
"rel": "nofollow"
}, [page])
})]);
};
}
});
const KEYCODE = {
ENTER: 13,
ARROW_UP: 38,
ARROW_DOWN: 40
};
const Options = defineComponent({
compatConfig: {
MODE: 3
},
props: {
disabled: {
type: Boolean,
default: void 0
},
changeSize: Function,
quickGo: Function,
selectComponentClass: PropTypes.any,
current: Number,
pageSizeOptions: PropTypes.array.def(["10", "20", "50", "100"]),
pageSize: Number,
buildOptionText: Function,
locale: PropTypes.object,
rootPrefixCls: String,
selectPrefixCls: String,
goButton: PropTypes.any
},
setup(props2) {
const goInputText = ref("");
const validValue = computed(() => {
return !goInputText.value || isNaN(goInputText.value) ? void 0 : Number(goInputText.value);
});
const defaultBuildOptionText = (opt) => {
return `${opt.value} ${props2.locale.items_per_page}`;
};
const handleChange = (e) => {
const {
value
} = e.target;
if (goInputText.value === value) return;
goInputText.value = value;
};
const handleBlur = (e) => {
const {
goButton,
quickGo,
rootPrefixCls
} = props2;
if (goButton || goInputText.value === "") {
return;
}
if (e.relatedTarget && (e.relatedTarget.className.indexOf(`${rootPrefixCls}-item-link`) >= 0 || e.relatedTarget.className.indexOf(`${rootPrefixCls}-item`) >= 0)) {
goInputText.value = "";
return;
} else {
quickGo(validValue.value);
goInputText.value = "";
}
};
const go = (e) => {
if (goInputText.value === "") {
return;
}
if (e.keyCode === KEYCODE.ENTER || e.type === "click") {
props2.quickGo(validValue.value);
goInputText.value = "";
}
};
const pageSizeOptions = computed(() => {
const {
pageSize,
pageSizeOptions: pageSizeOptions2
} = props2;
if (pageSizeOptions2.some((option) => option.toString() === pageSize.toString())) {
return pageSizeOptions2;
}
return pageSizeOptions2.concat([pageSize.toString()]).sort((a, b) => {
const numberA = isNaN(Number(a)) ? 0 : Number(a);
const numberB = isNaN(Number(b)) ? 0 : Number(b);
return numberA - numberB;
});
});
return () => {
const {
rootPrefixCls,
locale: locale2,
changeSize,
quickGo,
goButton,
selectComponentClass: Select2,
selectPrefixCls,
pageSize,
disabled
} = props2;
const prefixCls = `${rootPrefixCls}-options`;
let changeSelect = null;
let goInput = null;
let gotoButton = null;
if (!changeSize && !quickGo) {
return null;
}
if (changeSize && Select2) {
const buildOptionText = props2.buildOptionText || defaultBuildOptionText;
const options = pageSizeOptions.value.map((opt, i) => createVNode(Select2.Option, {
"key": i,
"value": opt
}, {
default: () => [buildOptionText({
value: opt
})]
}));
changeSelect = createVNode(Select2, {
"disabled": disabled,
"prefixCls": selectPrefixCls,
"showSearch": false,
"class": `${prefixCls}-size-changer`,
"optionLabelProp": "children",
"value": (pageSize || pageSizeOptions.value[0]).toString(),
"onChange": (value) => changeSize(Number(value)),
"getPopupContainer": (triggerNode) => triggerNode.parentNode
}, {
default: () => [options]
});
}
if (quickGo) {
if (goButton) {
gotoButton = typeof goButton === "boolean" ? createVNode("button", {
"type": "button",
"onClick": go,
"onKeyup": go,
"disabled": disabled,
"class": `${prefixCls}-quick-jumper-button`
}, [locale2.jump_to_confirm]) : createVNode("span", {
"onClick": go,
"onKeyup": go
}, [goButton]);
}
goInput = createVNode("div", {
"class": `${prefixCls}-quick-jumper`
}, [locale2.jump_to, createVNode(BaseInput$1, {
"disabled": disabled,
"type": "text",
"value": goInputText.value,
"onInput": handleChange,
"onChange": handleChange,
"onKeyup": go,
"onBlur": handleBlur
}, null), locale2.page, gotoButton]);
}
return createVNode("li", {
"class": `${prefixCls}`
}, [changeSelect, goInput]);
};
}
});
const LOCALE = {
// Options.jsx
items_per_page: "条/页",
jump_to: "跳至",
jump_to_confirm: "确定",
page: "页",
// Pagination.jsx
prev_page: "上一页",
next_page: "下一页",
prev_5: "向前 5 页",
next_5: "向后 5 页",
prev_3: "向前 3 页",
next_3: "向后 3 页"
};
var __rest$w = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function isInteger(value) {
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
}
function defaultItemRender(_ref) {
let {
originalElement
} = _ref;
return originalElement;
}
function calculatePage(p, state, props2) {
const pageSize = typeof p === "undefined" ? state.statePageSize : p;
return Math.floor((props2.total - 1) / pageSize) + 1;
}
const VcPagination = defineComponent({
compatConfig: {
MODE: 3
},
name: "Pagination",
mixins: [BaseMixin],
inheritAttrs: false,
props: {
disabled: {
type: Boolean,
default: void 0
},
prefixCls: PropTypes.string.def("rc-pagination"),
selectPrefixCls: PropTypes.string.def("rc-select"),
current: Number,
defaultCurrent: PropTypes.number.def(1),
total: PropTypes.number.def(0),
pageSize: Number,
defaultPageSize: PropTypes.number.def(10),
hideOnSinglePage: {
type: Boolean,
default: false
},
showSizeChanger: {
type: Boolean,
default: void 0
},
showLessItems: {
type: Boolean,
default: false
},
// showSizeChange: PropTypes.func.def(noop),
selectComponentClass: PropTypes.any,
showPrevNextJumpers: {
type: Boolean,
default: true
},
showQuickJumper: PropTypes.oneOfType([PropTypes.looseBool, PropTypes.object]).def(false),
showTitle: {
type: Boolean,
default: true
},
pageSizeOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
buildOptionText: Function,
showTotal: Function,
simple: {
type: Boolean,
default: void 0
},
locale: PropTypes.object.def(LOCALE),
itemRender: PropTypes.func.def(defaultItemRender),
prevIcon: PropTypes.any,
nextIcon: PropTypes.any,
jumpPrevIcon: PropTypes.any,
jumpNextIcon: PropTypes.any,
totalBoundaryShowSizeChanger: PropTypes.number.def(50)
},
data() {
const props2 = this.$props;
let current = firstNotUndefined([this.current, this.defaultCurrent]);
const pageSize = firstNotUndefined([this.pageSize, this.defaultPageSize]);
current = Math.min(current, calculatePage(pageSize, void 0, props2));
return {
stateCurrent: current,
stateCurrentInputValue: current,
statePageSize: pageSize
};
},
watch: {
current(val) {
this.setState({
stateCurrent: val,
stateCurrentInputValue: val
});
},
pageSize(val) {
const newState = {};
let current = this.stateCurrent;
const newCurrent = calculatePage(val, this.$data, this.$props);
current = current > newCurrent ? newCurrent : current;
if (!hasProp(this, "current")) {
newState.stateCurrent = current;
newState.stateCurrentInputValue = current;
}
newState.statePageSize = val;
this.setState(newState);
},
stateCurrent(_val, oldValue) {
this.$nextTick(() => {
if (this.$refs.paginationNode) {
const lastCurrentNode = this.$refs.paginationNode.querySelector(`.${this.prefixCls}-item-${oldValue}`);
if (lastCurrentNode && (void 0).activeElement === lastCurrentNode) {
lastCurrentNode.blur();
}
}
});
},
total() {
const newState = {};
const newCurrent = calculatePage(this.pageSize, this.$data, this.$props);
if (hasProp(this, "current")) {
const current = Math.min(this.current, newCurrent);
newState.stateCurrent = current;
newState.stateCurrentInputValue = current;
} else {
let current = this.stateCurrent;
if (current === 0 && newCurrent > 0) {
current = 1;
} else {
current = Math.min(this.stateCurrent, newCurrent);
}
newState.stateCurrent = current;
}
this.setState(newState);
}
},
methods: {
getJumpPrevPage() {
return Math.max(1, this.stateCurrent - (this.showLessItems ? 3 : 5));
},
getJumpNextPage() {
return Math.min(calculatePage(void 0, this.$data, this.$props), this.stateCurrent + (this.showLessItems ? 3 : 5));
},
getItemIcon(icon, label) {
const {
prefixCls
} = this.$props;
const iconNode = getComponent(this, icon, this.$props) || createVNode("button", {
"type": "button",
"aria-label": label,
"class": `${prefixCls}-item-link`
}, null);
return iconNode;
},
getValidValue(e) {
const inputValue = e.target.value;
const allPages = calculatePage(void 0, this.$data, this.$props);
const {
stateCurrentInputValue
} = this.$data;
let value;
if (inputValue === "") {
value = inputValue;
} else if (isNaN(Number(inputValue))) {
value = stateCurrentInputValue;
} else if (inputValue >= allPages) {
value = allPages;
} else {
value = Number(inputValue);
}
return value;
},
isValid(page) {
return isInteger(page) && page !== this.stateCurrent;
},
shouldDisplayQuickJumper() {
const {
showQuickJumper,
pageSize,
total
} = this.$props;
if (total <= pageSize) {
return false;
}
return showQuickJumper;
},
// calculatePage (p) {
// let pageSize = p
// if (typeof pageSize === 'undefined') {
// pageSize = this.statePageSize
// }
// return Math.floor((this.total - 1) / pageSize) + 1
// },
handleKeyDown(event) {
if (event.keyCode === KEYCODE.ARROW_UP || event.keyCode === KEYCODE.ARROW_DOWN) {
event.preventDefault();
}
},
handleKeyUp(e) {
const value = this.getValidValue(e);
const stateCurrentInputValue = this.stateCurrentInputValue;
if (value !== stateCurrentInputValue) {
this.setState({
stateCurrentInputValue: value
});
}
if (e.keyCode === KEYCODE.ENTER) {
this.handleChange(value);
} else if (e.keyCode === KEYCODE.ARROW_UP) {
this.handleChange(value - 1);
} else if (e.keyCode === KEYCODE.ARROW_DOWN) {
this.handleChange(value + 1);
}
},
changePageSize(size) {
let current = this.stateCurrent;
const preCurrent = current;
const newCurrent = calculatePage(size, this.$data, this.$props);
current = current > newCurrent ? newCurrent : current;
if (newCurrent === 0) {
current = this.stateCurrent;
}
if (typeof size === "number") {
if (!hasProp(this, "pageSize")) {
this.setState({
statePageSize: size
});
}
if (!hasProp(this, "current")) {
this.setState({
stateCurrent: current,
stateCurrentInputValue: current
});
}
}
this.__emit("update:pageSize", size);
if (current !== preCurrent) {
this.__emit("update:current", current);
}
this.__emit("showSizeChange", current, size);
this.__emit("change", current, size);
},
handleChange(p) {
const {
disabled
} = this.$props;
let page = p;
if (this.isValid(page) && !disabled) {
const currentPage = calculatePage(void 0, this.$data, this.$props);
if (page > currentPage) {
page = currentPage;
} else if (page < 1) {
page = 1;
}
if (!hasProp(this, "current")) {
this.setState({
stateCurrent: page,
stateCurrentInputValue: page
});
}
this.__emit("update:current", page);
this.__emit("change", page, this.statePageSize);
return page;
}
return this.stateCurrent;
},
prev() {
if (this.hasPrev()) {
this.handleChange(this.stateCurrent - 1);
}
},
next() {
if (this.hasNext()) {
this.handleChange(this.stateCurrent + 1);
}
},
jumpPrev() {
this.handleChange(this.getJumpPrevPage());
},
jumpNext() {
this.handleChange(this.getJumpNextPage());
},
hasPrev() {
return this.stateCurrent > 1;
},
hasNext() {
return this.stateCurrent < calculatePage(void 0, this.$data, this.$props);
},
getShowSizeChanger() {
const {
showSizeChanger,
total,
totalBoundaryShowSizeChanger
} = this.$props;
if (typeof showSizeChanger !== "undefined") {
return showSizeChanger;
}
return total > totalBoundaryShowSizeChanger;
},
runIfEnter(event, callback) {
if (event.key === "Enter" || event.charCode === 13) {
event.preventDefault();
for (var _len = arguments.length, restParams = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
restParams[_key - 2] = arguments[_key];
}
callback(...restParams);
}
},
runIfEnterPrev(event) {
this.runIfEnter(event, this.prev);
},
runIfEnterNext(event) {
this.runIfEnter(event, this.next);
},
runIfEnterJumpPrev(event) {
this.runIfEnter(event, this.jumpPrev);
},
runIfEnterJumpNext(event) {
this.runIfEnter(event, this.jumpNext);
},
handleGoTO(event) {
if (event.keyCode === KEYCODE.ENTER || event.type === "click") {
this.handleChange(this.stateCurrentInputValue);
}
},
renderPrev(prevPage) {
const {
itemRender
} = this.$props;
const prevButton = itemRender({
page: prevPage,
type: "prev",
originalElement: this.getItemIcon("prevIcon", "prev page")
});
const disabled = !this.hasPrev();
return isValidElement(prevButton) ? cloneElement(prevButton, disabled ? {
disabled
} : {}) : prevButton;
},
renderNext(nextPage) {
const {
itemRender
} = this.$props;
const nextButton = itemRender({
page: nextPage,
type: "next",
originalElement: this.getItemIcon("nextIcon", "next page")
});
const disabled = !this.hasNext();
return isValidElement(nextButton) ? cloneElement(nextButton, disabled ? {
disabled
} : {}) : nextButton;
}
},
render() {
const {
prefixCls,
disabled,
hideOnSinglePage,
total,
locale: locale2,
showQuickJumper,
showLessItems,
showTitle,
showTotal,
simple,
itemRender,
showPrevNextJumpers,
jumpPrevIcon,
jumpNextIcon,
selectComponentClass,
selectPrefixCls,
pageSizeOptions
} = this.$props;
const {
stateCurrent,
statePageSize
} = this;
const _a = splitAttrs(this.$attrs).extraAttrs, {
class: className
} = _a, restAttrs = __rest$w(_a, ["class"]);
if (hideOnSinglePage === true && this.total <= statePageSize) {
return null;
}
const allPages = calculatePage(void 0, this.$data, this.$props);
const pagerList = [];
let jumpPrev = null;
let jumpNext = null;
let firstPager = null;
let lastPager = null;
let gotoButton = null;
const goButton = showQuickJumper && showQuickJumper.goButton;
const pageBufferSize = showLessItems ? 1 : 2;
const prevPage = stateCurrent - 1 > 0 ? stateCurrent - 1 : 0;
const nextPage = stateCurrent + 1 < allPages ? stateCurrent + 1 : allPages;
const hasPrev = this.hasPrev();
const hasNext = this.hasNext();
if (simple) {
if (goButton) {
if (typeof goButton === "boolean") {
gotoButton = createVNode("button", {
"type": "button",
"onClick": this.handleGoTO,
"onKeyup": this.handleGoTO
}, [locale2.jump_to_confirm]);
} else {
gotoButton = createVNode("span", {
"onClick": this.handleGoTO,
"onKeyup": this.handleGoTO
}, [goButton]);
}
gotoButton = createVNode("li", {
"title": showTitle ? `${locale2.jump_to}${stateCurrent}/${allPages}` : null,
"class": `${prefixCls}-simple-pager`
}, [gotoButton]);
}
return createVNode("ul", _objectSpread$W({
"class": classNames(`${prefixCls} ${prefixCls}-simple`, {
[`${prefixCls}-disabled`]: disabled
}, className)
}, restAttrs), [createVNode("li", {
"title": showTitle ? locale2.prev_page : null,
"onClick": this.prev,
"tabindex": hasPrev ? 0 : null,
"onKeypress": this.runIfEnterPrev,
"class": classNames(`${prefixCls}-prev`, {
[`${prefixCls}-disabled`]: !hasPrev
}),
"aria-disabled": !hasPrev
}, [this.renderPrev(prevPage)]), createVNode("li", {
"title": showTitle ? `${stateCurrent}/${allPages}` : null,
"class": `${prefixCls}-simple-pager`
}, [createVNode(BaseInput$1, {
"type": "text",
"value": this.stateCurrentInputValue,
"disabled": disabled,
"onKeydown": this.handleKeyDown,
"onKeyup": this.handleKeyUp,
"onInput": this.handleKeyUp,
"onChange": this.handleKeyUp,
"size": "3"
}, null), createVNode("span", {
"class": `${prefixCls}-slash`
}, [createTextVNode("/")]), allPages]), createVNode("li", {
"title": showTitle ? locale2.next_page : null,
"onClick": this.next,
"tabindex": hasNext ? 0 : null,
"onKeypress": this.runIfEnterNext,
"class": classNames(`${prefixCls}-next`, {
[`${prefixCls}-disabled`]: !hasNext
}),
"aria-disabled": !hasNext
}, [this.renderNext(nextPage)]), gotoButton]);
}
if (allPages <= 3 + pageBufferSize * 2) {
const pagerProps = {
locale: locale2,
rootPrefixCls: prefixCls,
showTitle,
itemRender,
onClick: this.handleChange,
onKeypress: this.runIfEnter
};
if (!allPages) {
pagerList.push(createVNode(Pager, _objectSpread$W(_objectSpread$W({}, pagerProps), {}, {
"key": "noPager",
"page": 1,
"class": `${prefixCls}-item-disabled`
}), null));
}
for (let i = 1; i <= allPages; i += 1) {
const active = stateCurrent === i;
pagerList.push(createVNode(Pager, _objectSpread$W(_objectSpread$W({}, pagerProps), {}, {
"key": i,
"page": i,
"active": active
}), null));
}
} else {
const prevItemTitle = showLessItems ? locale2.prev_3 : locale2.prev_5;
const nextItemTitle = showLessItems ? locale2.next_3 : locale2.next_5;
if (showPrevNextJumpers) {
jumpPrev = createVNode("li", {
"title": this.showTitle ? prevItemTitle : null,
"key": "prev",
"onClick": this.jumpPrev,
"tabindex": "0",
"onKeypress": this.runIfEnterJumpPrev,
"class": classNames(`${prefixCls}-jump-prev`, {
[`${prefixCls}-jump-prev-custom-icon`]: !!jumpPrevIcon
})
}, [itemRender({
page: this.getJumpPrevPage(),
type: "jump-prev",
originalElement: this.getItemIcon("jumpPrevIcon", "prev page")
})]);
jumpNext = createVNode("li", {
"title": this.showTitle ? nextItemTitle : null,
"key": "next",
"tabindex": "0",
"onClick": this.jumpNext,
"onKeypress": this.runIfEnterJumpNext,
"class": classNames(`${prefixCls}-jump-next`, {
[`${prefixCls}-jump-next-custom-icon`]: !!jumpNextIcon
})
}, [itemRender({
page: this.getJumpNextPage(),
type: "jump-next",
originalElement: this.getItemIcon("jumpNextIcon", "next page")
})]);
}
lastPager = createVNode(Pager, {
"locale": locale2,
"last": true,
"rootPrefixCls": prefixCls,
"onClick": this.handleChange,
"onKeypress": this.runIfEnter,
"key": allPages,
"page": allPages,
"active": false,
"showTitle": showTitle,
"itemRender": itemRender
}, null);
firstPager = createVNode(Pager, {
"locale": locale2,
"rootPrefixCls": prefixCls,
"onClick": this.handleChange,
"onKeypress": this.runIfEnter,
"key": 1,
"page": 1,
"active": false,
"showTitle": showTitle,
"itemRender": itemRender
}, null);
let left = Math.max(1, stateCurrent - pageBufferSize);
let right = Math.min(stateCurrent + pageBufferSize, allPages);
if (stateCurrent - 1 <= pageBufferSize) {
right = 1 + pageBufferSize * 2;
}
if (allPages - stateCurrent <= pageBufferSize) {
left = allPages - pageBufferSize * 2;
}
for (let i = left; i <= right; i += 1) {
const active = stateCurrent === i;
pagerList.push(createVNode(Pager, {
"locale": locale2,
"rootPrefixCls": prefixCls,
"onClick": this.handleChange,
"onKeypress": this.runIfEnter,
"key": i,
"page": i,
"active": active,
"showTitle": showTitle,
"itemRender": itemRender
}, null));
}
if (stateCurrent - 1 >= pageBufferSize * 2 && stateCurrent !== 1 + 2) {
pagerList[0] = createVNode(Pager, {
"locale": locale2,
"rootPrefixCls": prefixCls,
"onClick": this.handleChange,
"onKeypress": this.runIfEnter,
"key": left,
"page": left,
"class": `${prefixCls}-item-after-jump-prev`,
"active": false,
"showTitle": this.showTitle,
"itemRender": itemRender
}, null);
pagerList.unshift(jumpPrev);
}
if (allPages - stateCurrent >= pageBufferSize * 2 && stateCurrent !== allPages - 2) {
pagerList[pagerList.length - 1] = createVNode(Pager, {
"locale": locale2,
"rootPrefixCls": prefixCls,
"onClick": this.handleChange,
"onKeypress": this.runIfEnter,
"key": right,
"page": right,
"class": `${prefixCls}-item-before-jump-next`,
"active": false,
"showTitle": this.showTitle,
"itemRender": itemRender
}, null);
pagerList.push(jumpNext);
}
if (left !== 1) {
pagerList.unshift(firstPager);
}
if (right !== allPages) {
pagerList.push(lastPager);
}
}
let totalText = null;
if (showTotal) {
totalText = createVNode("li", {
"class": `${prefixCls}-total-text`
}, [showTotal(total, [total === 0 ? 0 : (stateCurrent - 1) * statePageSize + 1, stateCurrent * statePageSize > total ? total : stateCurrent * statePageSize])]);
}
const prevDisabled = !hasPrev || !allPages;
const nextDisabled = !hasNext || !allPages;
const buildOptionText = this.buildOptionText || this.$slots.buildOptionText;
return createVNode("ul", _objectSpread$W(_objectSpread$W({
"unselectable": "on",
"ref": "paginationNode"
}, restAttrs), {}, {
"class": classNames({
[`${prefixCls}`]: true,
[`${prefixCls}-disabled`]: disabled
}, className)
}), [totalText, createVNode("li", {
"title": showTitle ? locale2.prev_page : null,
"onClick": this.prev,
"tabindex": prevDisabled ? null : 0,
"onKeypress": this.runIfEnterPrev,
"class": classNames(`${prefixCls}-prev`, {
[`${prefixCls}-disabled`]: prevDisabled
}),
"aria-disabled": prevDisabled
}, [this.renderPrev(prevPage)]), pagerList, createVNode("li", {
"title": showTitle ? locale2.next_page : null,
"onClick": this.next,
"tabindex": nextDisabled ? null : 0,
"onKeypress": this.runIfEnterNext,
"class": classNames(`${prefixCls}-next`, {
[`${prefixCls}-disabled`]: nextDisabled
}),
"aria-disabled": nextDisabled
}, [this.renderNext(nextPage)]), createVNode(Options, {
"disabled": disabled,
"locale": locale2,
"rootPrefixCls": prefixCls,
"selectComponentClass": selectComponentClass,
"selectPrefixCls": selectPrefixCls,
"changeSize": this.getShowSizeChanger() ? this.changePageSize : null,
"current": stateCurrent,
"pageSize": statePageSize,
"pageSizeOptions": pageSizeOptions,
"buildOptionText": buildOptionText || null,
"quickGo": this.shouldDisplayQuickJumper() ? this.handleChange : null,
"goButton": goButton
}, null)]);
}
});
const genPaginationDisabledStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-disabled`]: {
"&, &:hover": {
cursor: "not-allowed",
[`${componentCls}-item-link`]: {
color: token.colorTextDisabled,
cursor: "not-allowed"
}
},
"&:focus-visible": {
cursor: "not-allowed",
[`${componentCls}-item-link`]: {
color: token.colorTextDisabled,
cursor: "not-allowed"
}
}
},
[`&${componentCls}-disabled`]: {
cursor: "not-allowed",
[`&${componentCls}-mini`]: {
[`
&:hover ${componentCls}-item:not(${componentCls}-item-active),
&:active ${componentCls}-item:not(${componentCls}-item-active),
&:hover ${componentCls}-item-link,
&:active ${componentCls}-item-link
`]: {
backgroundColor: "transparent"
}
},
[`${componentCls}-item`]: {
cursor: "not-allowed",
"&:hover, &:active": {
backgroundColor: "transparent"
},
a: {
color: token.colorTextDisabled,
backgroundColor: "transparent",
border: "none",
cursor: "not-allowed"
},
"&-active": {
borderColor: token.colorBorder,
backgroundColor: token.paginationItemDisabledBgActive,
"&:hover, &:active": {
backgroundColor: token.paginationItemDisabledBgActive
},
a: {
color: token.paginationItemDisabledColorActive
}
}
},
[`${componentCls}-item-link`]: {
color: token.colorTextDisabled,
cursor: "not-allowed",
"&:hover, &:active": {
backgroundColor: "transparent"
},
[`${componentCls}-simple&`]: {
backgroundColor: "transparent",
"&:hover, &:active": {
backgroundColor: "transparent"
}
}
},
[`${componentCls}-simple-pager`]: {
color: token.colorTextDisabled
},
[`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
[`${componentCls}-item-link-icon`]: {
opacity: 0
},
[`${componentCls}-item-ellipsis`]: {
opacity: 1
}
}
},
[`&${componentCls}-simple`]: {
[`${componentCls}-prev, ${componentCls}-next`]: {
[`&${componentCls}-disabled ${componentCls}-item-link`]: {
"&:hover, &:active": {
backgroundColor: "transparent"
}
}
}
}
};
};
const genPaginationMiniStyle = (token) => {
const {
componentCls
} = token;
return {
[`&${componentCls}-mini ${componentCls}-total-text, &${componentCls}-mini ${componentCls}-simple-pager`]: {
height: token.paginationItemSizeSM,
lineHeight: `${token.paginationItemSizeSM}px`
},
[`&${componentCls}-mini ${componentCls}-item`]: {
minWidth: token.paginationItemSizeSM,
height: token.paginationItemSizeSM,
margin: 0,
lineHeight: `${token.paginationItemSizeSM - 2}px`
},
[`&${componentCls}-mini ${componentCls}-item:not(${componentCls}-item-active)`]: {
backgroundColor: "transparent",
borderColor: "transparent",
"&:hover": {
backgroundColor: token.colorBgTextHover
},
"&:active": {
backgroundColor: token.colorBgTextActive
}
},
[`&${componentCls}-mini ${componentCls}-prev, &${componentCls}-mini ${componentCls}-next`]: {
minWidth: token.paginationItemSizeSM,
height: token.paginationItemSizeSM,
margin: 0,
lineHeight: `${token.paginationItemSizeSM}px`,
[`&:hover ${componentCls}-item-link`]: {
backgroundColor: token.colorBgTextHover
},
[`&:active ${componentCls}-item-link`]: {
backgroundColor: token.colorBgTextActive
},
[`&${componentCls}-disabled:hover ${componentCls}-item-link`]: {
backgroundColor: "transparent"
}
},
[`
&${componentCls}-mini ${componentCls}-prev ${componentCls}-item-link,
&${componentCls}-mini ${componentCls}-next ${componentCls}-item-link
`]: {
backgroundColor: "transparent",
borderColor: "transparent",
"&::after": {
height: token.paginationItemSizeSM,
lineHeight: `${token.paginationItemSizeSM}px`
}
},
[`&${componentCls}-mini ${componentCls}-jump-prev, &${componentCls}-mini ${componentCls}-jump-next`]: {
height: token.paginationItemSizeSM,
marginInlineEnd: 0,
lineHeight: `${token.paginationItemSizeSM}px`
},
[`&${componentCls}-mini ${componentCls}-options`]: {
marginInlineStart: token.paginationMiniOptionsMarginInlineStart,
[`&-size-changer`]: {
top: token.paginationMiniOptionsSizeChangerTop
},
[`&-quick-jumper`]: {
height: token.paginationItemSizeSM,
lineHeight: `${token.paginationItemSizeSM}px`,
input: _extends(_extends({}, genInputSmallStyle(token)), {
width: token.paginationMiniQuickJumperInputWidth,
height: token.controlHeightSM
})
}
}
};
};
const genPaginationSimpleStyle = (token) => {
const {
componentCls
} = token;
return {
[`
&${componentCls}-simple ${componentCls}-prev,
&${componentCls}-simple ${componentCls}-next
`]: {
height: token.paginationItemSizeSM,
lineHeight: `${token.paginationItemSizeSM}px`,
verticalAlign: "top",
[`${componentCls}-item-link`]: {
height: token.paginationItemSizeSM,
backgroundColor: "transparent",
border: 0,
"&:hover": {
backgroundColor: token.colorBgTextHover
},
"&:active": {
backgroundColor: token.colorBgTextActive
},
"&::after": {
height: token.paginationItemSizeSM,
lineHeight: `${token.paginationItemSizeSM}px`
}
}
},
[`&${componentCls}-simple ${componentCls}-simple-pager`]: {
display: "inline-block",
height: token.paginationItemSizeSM,
marginInlineEnd: token.marginXS,
input: {
boxSizing: "border-box",
height: "100%",
marginInlineEnd: token.marginXS,
padding: `0 ${token.paginationItemPaddingInline}px`,
textAlign: "center",
backgroundColor: token.paginationItemInputBg,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadius,
outline: "none",
transition: `border-color ${token.motionDurationMid}`,
color: "inherit",
"&:hover": {
borderColor: token.colorPrimary
},
"&:focus": {
borderColor: token.colorPrimaryHover,
boxShadow: `${token.inputOutlineOffset}px 0 ${token.controlOutlineWidth}px ${token.controlOutline}`
},
"&[disabled]": {
color: token.colorTextDisabled,
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
cursor: "not-allowed"
}
}
}
};
};
const genPaginationJumpStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
outline: 0,
[`${componentCls}-item-container`]: {
position: "relative",
[`${componentCls}-item-link-icon`]: {
color: token.colorPrimary,
fontSize: token.fontSizeSM,
opacity: 0,
transition: `all ${token.motionDurationMid}`,
"&-svg": {
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
margin: "auto"
}
},
[`${componentCls}-item-ellipsis`]: {
position: "absolute",
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
display: "block",
margin: "auto",
color: token.colorTextDisabled,
fontFamily: "Arial, Helvetica, sans-serif",
letterSpacing: token.paginationEllipsisLetterSpacing,
textAlign: "center",
textIndent: token.paginationEllipsisTextIndent,
opacity: 1,
transition: `all ${token.motionDurationMid}`
}
},
"&:hover": {
[`${componentCls}-item-link-icon`]: {
opacity: 1
},
[`${componentCls}-item-ellipsis`]: {
opacity: 0
}
},
"&:focus-visible": _extends({
[`${componentCls}-item-link-icon`]: {
opacity: 1
},
[`${componentCls}-item-ellipsis`]: {
opacity: 0
}
}, genFocusOutline(token))
},
[`
${componentCls}-prev,
${componentCls}-jump-prev,
${componentCls}-jump-next
`]: {
marginInlineEnd: token.marginXS
},
[`
${componentCls}-prev,
${componentCls}-next,
${componentCls}-jump-prev,
${componentCls}-jump-next
`]: {
display: "inline-block",
minWidth: token.paginationItemSize,
height: token.paginationItemSize,
color: token.colorText,
fontFamily: token.paginationFontFamily,
lineHeight: `${token.paginationItemSize}px`,
textAlign: "center",
verticalAlign: "middle",
listStyle: "none",
borderRadius: token.borderRadius,
cursor: "pointer",
transition: `all ${token.motionDurationMid}`
},
[`${componentCls}-prev, ${componentCls}-next`]: {
fontFamily: "Arial, Helvetica, sans-serif",
outline: 0,
button: {
color: token.colorText,
cursor: "pointer",
userSelect: "none"
},
[`${componentCls}-item-link`]: {
display: "block",
width: "100%",
height: "100%",
padding: 0,
fontSize: token.fontSizeSM,
textAlign: "center",
backgroundColor: "transparent",
border: `${token.lineWidth}px ${token.lineType} transparent`,
borderRadius: token.borderRadius,
outline: "none",
transition: `all ${token.motionDurationMid}`
},
[`&:focus-visible ${componentCls}-item-link`]: _extends({}, genFocusOutline(token)),
[`&:hover ${componentCls}-item-link`]: {
backgroundColor: token.colorBgTextHover
},
[`&:active ${componentCls}-item-link`]: {
backgroundColor: token.colorBgTextActive
},
[`&${componentCls}-disabled:hover`]: {
[`${componentCls}-item-link`]: {
backgroundColor: "transparent"
}
}
},
[`${componentCls}-slash`]: {
marginInlineEnd: token.paginationSlashMarginInlineEnd,
marginInlineStart: token.paginationSlashMarginInlineStart
},
[`${componentCls}-options`]: {
display: "inline-block",
marginInlineStart: token.margin,
verticalAlign: "middle",
"&-size-changer.-select": {
display: "inline-block",
width: "auto"
},
"&-quick-jumper": {
display: "inline-block",
height: token.controlHeight,
marginInlineStart: token.marginXS,
lineHeight: `${token.controlHeight}px`,
verticalAlign: "top",
input: _extends(_extends({}, genBasicInputStyle(token)), {
width: token.controlHeightLG * 1.25,
height: token.controlHeight,
boxSizing: "border-box",
margin: 0,
marginInlineStart: token.marginXS,
marginInlineEnd: token.marginXS
})
}
}
};
};
const genPaginationItemStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-item`]: _extends(_extends({
display: "inline-block",
minWidth: token.paginationItemSize,
height: token.paginationItemSize,
marginInlineEnd: token.marginXS,
fontFamily: token.paginationFontFamily,
lineHeight: `${token.paginationItemSize - 2}px`,
textAlign: "center",
verticalAlign: "middle",
listStyle: "none",
backgroundColor: "transparent",
border: `${token.lineWidth}px ${token.lineType} transparent`,
borderRadius: token.borderRadius,
outline: 0,
cursor: "pointer",
userSelect: "none",
a: {
display: "block",
padding: `0 ${token.paginationItemPaddingInline}px`,
color: token.colorText,
transition: "none",
"&:hover": {
textDecoration: "none"
}
},
[`&:not(${componentCls}-item-active)`]: {
"&:hover": {
transition: `all ${token.motionDurationMid}`,
backgroundColor: token.colorBgTextHover
},
"&:active": {
backgroundColor: token.colorBgTextActive
}
}
}, genFocusStyle(token)), {
"&-active": {
fontWeight: token.paginationFontWeightActive,
backgroundColor: token.paginationItemBgActive,
borderColor: token.colorPrimary,
a: {
color: token.colorPrimary
},
"&:hover": {
borderColor: token.colorPrimaryHover
},
"&:hover a": {
color: token.colorPrimaryHover
}
}
})
};
};
const genPaginationStyle$1 = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, resetComponent(token)), {
"ul, ol": {
margin: 0,
padding: 0,
listStyle: "none"
},
"&::after": {
display: "block",
clear: "both",
height: 0,
overflow: "hidden",
visibility: "hidden",
content: '""'
},
[`${componentCls}-total-text`]: {
display: "inline-block",
height: token.paginationItemSize,
marginInlineEnd: token.marginXS,
lineHeight: `${token.paginationItemSize - 2}px`,
verticalAlign: "middle"
}
}), genPaginationItemStyle(token)), genPaginationJumpStyle(token)), genPaginationSimpleStyle(token)), genPaginationMiniStyle(token)), genPaginationDisabledStyle(token)), {
// media query style
[`@media only screen and (max-width: ${token.screenLG}px)`]: {
[`${componentCls}-item`]: {
"&-after-jump-prev, &-before-jump-next": {
display: "none"
}
}
},
[`@media only screen and (max-width: ${token.screenSM}px)`]: {
[`${componentCls}-options`]: {
display: "none"
}
}
}),
// rtl style
[`&${token.componentCls}-rtl`]: {
direction: "rtl"
}
};
};
const genBorderedStyle$2 = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}${componentCls}-disabled`]: {
"&, &:hover": {
[`${componentCls}-item-link`]: {
borderColor: token.colorBorder
}
},
"&:focus-visible": {
[`${componentCls}-item-link`]: {
borderColor: token.colorBorder
}
},
[`${componentCls}-item, ${componentCls}-item-link`]: {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
[`&:hover:not(${componentCls}-item-active)`]: {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
a: {
color: token.colorTextDisabled
}
},
[`&${componentCls}-item-active`]: {
backgroundColor: token.paginationItemDisabledBgActive
}
},
[`${componentCls}-prev, ${componentCls}-next`]: {
"&:hover button": {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder,
color: token.colorTextDisabled
},
[`${componentCls}-item-link`]: {
backgroundColor: token.colorBgContainerDisabled,
borderColor: token.colorBorder
}
}
},
[componentCls]: {
[`${componentCls}-prev, ${componentCls}-next`]: {
"&:hover button": {
borderColor: token.colorPrimaryHover,
backgroundColor: token.paginationItemBg
},
[`${componentCls}-item-link`]: {
backgroundColor: token.paginationItemLinkBg,
borderColor: token.colorBorder
},
[`&:hover ${componentCls}-item-link`]: {
borderColor: token.colorPrimary,
backgroundColor: token.paginationItemBg,
color: token.colorPrimary
},
[`&${componentCls}-disabled`]: {
[`${componentCls}-item-link`]: {
borderColor: token.colorBorder,
color: token.colorTextDisabled
}
}
},
[`${componentCls}-item`]: {
backgroundColor: token.paginationItemBg,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
[`&:hover:not(${componentCls}-item-active)`]: {
borderColor: token.colorPrimary,
backgroundColor: token.paginationItemBg,
a: {
color: token.colorPrimary
}
},
"&-active": {
borderColor: token.colorPrimary
}
}
}
};
};
const useStyle$l = genComponentStyleHook("Pagination", (token) => {
const paginationToken = merge(token, {
paginationItemSize: token.controlHeight,
paginationFontFamily: token.fontFamily,
paginationItemBg: token.colorBgContainer,
paginationItemBgActive: token.colorBgContainer,
paginationFontWeightActive: token.fontWeightStrong,
paginationItemSizeSM: token.controlHeightSM,
paginationItemInputBg: token.colorBgContainer,
paginationMiniOptionsSizeChangerTop: 0,
paginationItemDisabledBgActive: token.controlItemBgActiveDisabled,
paginationItemDisabledColorActive: token.colorTextDisabled,
paginationItemLinkBg: token.colorBgContainer,
inputOutlineOffset: "0 0",
paginationMiniOptionsMarginInlineStart: token.marginXXS / 2,
paginationMiniQuickJumperInputWidth: token.controlHeightLG * 1.1,
paginationItemPaddingInline: token.marginXXS * 1.5,
paginationEllipsisLetterSpacing: token.marginXXS / 2,
paginationSlashMarginInlineStart: token.marginXXS,
paginationSlashMarginInlineEnd: token.marginSM,
paginationEllipsisTextIndent: "0.13em"
// magic for ui experience
}, initInputToken(token));
return [genPaginationStyle$1(paginationToken), token.wireframe && genBorderedStyle$2(paginationToken)];
});
var __rest$v = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const paginationProps = () => ({
total: Number,
defaultCurrent: Number,
disabled: booleanType(),
current: Number,
defaultPageSize: Number,
pageSize: Number,
hideOnSinglePage: booleanType(),
showSizeChanger: booleanType(),
pageSizeOptions: arrayType(),
buildOptionText: functionType(),
showQuickJumper: someType([Boolean, Object]),
showTotal: functionType(),
size: stringType(),
simple: booleanType(),
locale: Object,
prefixCls: String,
selectPrefixCls: String,
totalBoundaryShowSizeChanger: Number,
selectComponentClass: String,
itemRender: functionType(),
role: String,
responsive: Boolean,
showLessItems: booleanType(),
onChange: functionType(),
onShowSizeChange: functionType(),
"onUpdate:current": functionType(),
"onUpdate:pageSize": functionType()
});
const Pagination$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "APagination",
inheritAttrs: false,
props: paginationProps(),
// emits: ['change', 'showSizeChange', 'update:current', 'update:pageSize'],
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
configProvider,
direction,
size
} = useConfigInject("pagination", props2);
const [wrapSSR, hashId] = useStyle$l(prefixCls);
const selectPrefixCls = computed(() => configProvider.getPrefixCls("select", props2.selectPrefixCls));
const breakpoint = useBreakpoint();
const [locale2] = useLocaleReceiver("Pagination", enUS, toRef(props2, "locale"));
const getIconsProps = (pre) => {
const ellipsis = createVNode("span", {
"class": `${pre}-item-ellipsis`
}, [createTextVNode("•••")]);
const prevIcon = createVNode("button", {
"class": `${pre}-item-link`,
"type": "button",
"tabindex": -1
}, [direction.value === "rtl" ? createVNode(RightOutlined, null, null) : createVNode(LeftOutlined, null, null)]);
const nextIcon = createVNode("button", {
"class": `${pre}-item-link`,
"type": "button",
"tabindex": -1
}, [direction.value === "rtl" ? createVNode(LeftOutlined, null, null) : createVNode(RightOutlined, null, null)]);
const jumpPrevIcon = createVNode("a", {
"rel": "nofollow",
"class": `${pre}-item-link`
}, [createVNode("div", {
"class": `${pre}-item-container`
}, [direction.value === "rtl" ? createVNode(DoubleRightOutlined, {
"class": `${pre}-item-link-icon`
}, null) : createVNode(DoubleLeftOutlined, {
"class": `${pre}-item-link-icon`
}, null), ellipsis])]);
const jumpNextIcon = createVNode("a", {
"rel": "nofollow",
"class": `${pre}-item-link`
}, [createVNode("div", {
"class": `${pre}-item-container`
}, [direction.value === "rtl" ? createVNode(DoubleLeftOutlined, {
"class": `${pre}-item-link-icon`
}, null) : createVNode(DoubleRightOutlined, {
"class": `${pre}-item-link-icon`
}, null), ellipsis])]);
return {
prevIcon,
nextIcon,
jumpPrevIcon,
jumpNextIcon
};
};
return () => {
var _a;
const {
itemRender = slots.itemRender,
buildOptionText = slots.buildOptionText,
selectComponentClass,
responsive
} = props2, restProps = __rest$v(props2, ["itemRender", "buildOptionText", "selectComponentClass", "responsive"]);
const isSmall = size.value === "small" || !!(((_a = breakpoint.value) === null || _a === void 0 ? void 0 : _a.xs) && !size.value && responsive);
const paginationProps2 = _extends(_extends(_extends(_extends(_extends({}, restProps), getIconsProps(prefixCls.value)), {
prefixCls: prefixCls.value,
selectPrefixCls: selectPrefixCls.value,
selectComponentClass: selectComponentClass || (isSmall ? MiniSelect : MiddleSelect),
locale: locale2.value,
buildOptionText
}), attrs), {
class: classNames({
[`${prefixCls.value}-mini`]: isSmall,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value),
itemRender
});
return wrapSSR(createVNode(VcPagination, paginationProps2, null));
};
}
});
const Pagination = withInstall(Pagination$1);
const listItemMetaProps = () => ({
avatar: PropTypes.any,
description: PropTypes.any,
prefixCls: String,
title: PropTypes.any
});
const ItemMeta = defineComponent({
compatConfig: {
MODE: 3
},
name: "AListItemMeta",
props: listItemMetaProps(),
displayName: "AListItemMeta",
__ANT_LIST_ITEM_META: true,
slots: Object,
setup(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls
} = useConfigInject("list", props2);
return () => {
var _a, _b, _c, _d, _e, _f;
const classString = `${prefixCls.value}-item-meta`;
const title = (_a = props2.title) !== null && _a !== void 0 ? _a : (_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots);
const description = (_c = props2.description) !== null && _c !== void 0 ? _c : (_d = slots.description) === null || _d === void 0 ? void 0 : _d.call(slots);
const avatar = (_e = props2.avatar) !== null && _e !== void 0 ? _e : (_f = slots.avatar) === null || _f === void 0 ? void 0 : _f.call(slots);
const content = createVNode("div", {
"class": `${prefixCls.value}-item-meta-content`
}, [title && createVNode("h4", {
"class": `${prefixCls.value}-item-meta-title`
}, [title]), description && createVNode("div", {
"class": `${prefixCls.value}-item-meta-description`
}, [description])]);
return createVNode("div", {
"class": classString
}, [avatar && createVNode("div", {
"class": `${prefixCls.value}-item-meta-avatar`
}, [avatar]), (title || description) && content]);
};
}
});
const ListContextKey = Symbol("ListContextKey");
var __rest$u = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const listItemProps$1 = () => ({
prefixCls: String,
extra: PropTypes.any,
actions: PropTypes.array,
grid: Object,
colStyle: {
type: Object,
default: void 0
}
});
const Item = defineComponent({
compatConfig: {
MODE: 3
},
name: "AListItem",
inheritAttrs: false,
Meta: ItemMeta,
props: listItemProps$1(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
itemLayout,
grid
} = inject(ListContextKey, {
grid: ref(),
itemLayout: ref()
});
const {
prefixCls
} = useConfigInject("list", props2);
const isItemContainsTextNodeAndNotSingular = () => {
var _a;
const children = ((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) || [];
let result;
children.forEach((element) => {
if (isStringElement(element) && !isEmptyElement(element)) {
result = true;
}
});
return result && children.length > 1;
};
const isFlexMode = () => {
var _a, _b;
const extra = (_a = props2.extra) !== null && _a !== void 0 ? _a : (_b = slots.extra) === null || _b === void 0 ? void 0 : _b.call(slots);
if (itemLayout.value === "vertical") {
return !!extra;
}
return !isItemContainsTextNodeAndNotSingular();
};
return () => {
var _a, _b, _c, _d, _e;
const {
class: className
} = attrs, restAttrs = __rest$u(attrs, ["class"]);
const pre = prefixCls.value;
const extra = (_a = props2.extra) !== null && _a !== void 0 ? _a : (_b = slots.extra) === null || _b === void 0 ? void 0 : _b.call(slots);
const children = (_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots);
let actions = (_d = props2.actions) !== null && _d !== void 0 ? _d : flattenChildren((_e = slots.actions) === null || _e === void 0 ? void 0 : _e.call(slots));
actions = actions && !Array.isArray(actions) ? [actions] : actions;
const actionsContent = actions && actions.length > 0 && createVNode("ul", {
"class": `${pre}-item-action`,
"key": "actions"
}, [actions.map((action, i) => createVNode("li", {
"key": `${pre}-item-action-${i}`
}, [action, i !== actions.length - 1 && createVNode("em", {
"class": `${pre}-item-action-split`
}, null)]))]);
const Element2 = grid.value ? "div" : "li";
const itemChildren = createVNode(Element2, _objectSpread$W(_objectSpread$W({}, restAttrs), {}, {
"class": classNames(`${pre}-item`, {
[`${pre}-item-no-flex`]: !isFlexMode()
}, className)
}), {
default: () => [itemLayout.value === "vertical" && extra ? [createVNode("div", {
"class": `${pre}-item-main`,
"key": "content"
}, [children, actionsContent]), createVNode("div", {
"class": `${pre}-item-extra`,
"key": "extra"
}, [extra])] : [children, actionsContent, cloneElement(extra, {
key: "extra"
})]]
});
return grid.value ? createVNode(Col, {
"flex": 1,
"style": props2.colStyle
}, {
default: () => [itemChildren]
}) : itemChildren;
};
}
});
const genBorderedStyle$1 = (token) => {
const {
listBorderedCls,
componentCls,
paddingLG,
margin,
padding,
listItemPaddingSM,
marginLG,
borderRadiusLG
} = token;
return {
[`${listBorderedCls}`]: {
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
borderRadius: borderRadiusLG,
[`${componentCls}-header,${componentCls}-footer,${componentCls}-item`]: {
paddingInline: paddingLG
},
[`${componentCls}-pagination`]: {
margin: `${margin}px ${marginLG}px`
}
},
[`${listBorderedCls}${componentCls}-sm`]: {
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
padding: listItemPaddingSM
}
},
[`${listBorderedCls}${componentCls}-lg`]: {
[`${componentCls}-item,${componentCls}-header,${componentCls}-footer`]: {
padding: `${padding}px ${paddingLG}px`
}
}
};
};
const genResponsiveStyle = (token) => {
const {
componentCls,
screenSM,
screenMD,
marginLG,
marginSM,
margin
} = token;
return {
[`@media screen and (max-width:${screenMD})`]: {
[`${componentCls}`]: {
[`${componentCls}-item`]: {
[`${componentCls}-item-action`]: {
marginInlineStart: marginLG
}
}
},
[`${componentCls}-vertical`]: {
[`${componentCls}-item`]: {
[`${componentCls}-item-extra`]: {
marginInlineStart: marginLG
}
}
}
},
[`@media screen and (max-width: ${screenSM})`]: {
[`${componentCls}`]: {
[`${componentCls}-item`]: {
flexWrap: "wrap",
[`${componentCls}-action`]: {
marginInlineStart: marginSM
}
}
},
[`${componentCls}-vertical`]: {
[`${componentCls}-item`]: {
flexWrap: "wrap-reverse",
[`${componentCls}-item-main`]: {
minWidth: token.contentWidth
},
[`${componentCls}-item-extra`]: {
margin: `auto auto ${margin}px`
}
}
}
}
};
};
const genBaseStyle$9 = (token) => {
const {
componentCls,
antCls,
controlHeight,
minHeight,
paddingSM,
marginLG,
padding,
listItemPadding,
colorPrimary,
listItemPaddingSM,
listItemPaddingLG,
paddingXS,
margin,
colorText,
colorTextDescription,
motionDurationSlow,
lineWidth
} = token;
return {
[`${componentCls}`]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
"*": {
outline: "none"
},
[`${componentCls}-header, ${componentCls}-footer`]: {
background: "transparent",
paddingBlock: paddingSM
},
[`${componentCls}-pagination`]: {
marginBlockStart: marginLG,
textAlign: "end",
// https://github.com/ant-design/ant-design/issues/20037
[`${antCls}-pagination-options`]: {
textAlign: "start"
}
},
[`${componentCls}-spin`]: {
minHeight,
textAlign: "center"
},
[`${componentCls}-items`]: {
margin: 0,
padding: 0,
listStyle: "none"
},
[`${componentCls}-item`]: {
display: "flex",
alignItems: "center",
justifyContent: "space-between",
padding: listItemPadding,
color: colorText,
[`${componentCls}-item-meta`]: {
display: "flex",
flex: 1,
alignItems: "flex-start",
maxWidth: "100%",
[`${componentCls}-item-meta-avatar`]: {
marginInlineEnd: padding
},
[`${componentCls}-item-meta-content`]: {
flex: "1 0",
width: 0,
color: colorText
},
[`${componentCls}-item-meta-title`]: {
marginBottom: token.marginXXS,
color: colorText,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
"> a": {
color: colorText,
transition: `all ${motionDurationSlow}`,
[`&:hover`]: {
color: colorPrimary
}
}
},
[`${componentCls}-item-meta-description`]: {
color: colorTextDescription,
fontSize: token.fontSize,
lineHeight: token.lineHeight
}
},
[`${componentCls}-item-action`]: {
flex: "0 0 auto",
marginInlineStart: token.marginXXL,
padding: 0,
fontSize: 0,
listStyle: "none",
[`& > li`]: {
position: "relative",
display: "inline-block",
padding: `0 ${paddingXS}px`,
color: colorTextDescription,
fontSize: token.fontSize,
lineHeight: token.lineHeight,
textAlign: "center",
[`&:first-child`]: {
paddingInlineStart: 0
}
},
[`${componentCls}-item-action-split`]: {
position: "absolute",
insetBlockStart: "50%",
insetInlineEnd: 0,
width: lineWidth,
height: Math.ceil(token.fontSize * token.lineHeight) - token.marginXXS * 2,
transform: "translateY(-50%)",
backgroundColor: token.colorSplit
}
}
},
[`${componentCls}-empty`]: {
padding: `${padding}px 0`,
color: colorTextDescription,
fontSize: token.fontSizeSM,
textAlign: "center"
},
[`${componentCls}-empty-text`]: {
padding,
color: token.colorTextDisabled,
fontSize: token.fontSize,
textAlign: "center"
},
// ============================ without flex ============================
[`${componentCls}-item-no-flex`]: {
display: "block"
}
}),
[`${componentCls}-grid ${antCls}-col > ${componentCls}-item`]: {
display: "block",
maxWidth: "100%",
marginBlockEnd: margin,
paddingBlock: 0,
borderBlockEnd: "none"
},
[`${componentCls}-vertical ${componentCls}-item`]: {
alignItems: "initial",
[`${componentCls}-item-main`]: {
display: "block",
flex: 1
},
[`${componentCls}-item-extra`]: {
marginInlineStart: marginLG
},
[`${componentCls}-item-meta`]: {
marginBlockEnd: padding,
[`${componentCls}-item-meta-title`]: {
marginBlockEnd: paddingSM,
color: colorText,
fontSize: token.fontSizeLG,
lineHeight: token.lineHeightLG
}
},
[`${componentCls}-item-action`]: {
marginBlockStart: padding,
marginInlineStart: "auto",
"> li": {
padding: `0 ${padding}px`,
[`&:first-child`]: {
paddingInlineStart: 0
}
}
}
},
[`${componentCls}-split ${componentCls}-item`]: {
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
[`&:last-child`]: {
borderBlockEnd: "none"
}
},
[`${componentCls}-split ${componentCls}-header`]: {
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
},
[`${componentCls}-split${componentCls}-empty ${componentCls}-footer`]: {
borderTop: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
},
[`${componentCls}-loading ${componentCls}-spin-nested-loading`]: {
minHeight: controlHeight
},
[`${componentCls}-split${componentCls}-something-after-last-item ${antCls}-spin-container > ${componentCls}-items > ${componentCls}-item:last-child`]: {
borderBlockEnd: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`
},
[`${componentCls}-lg ${componentCls}-item`]: {
padding: listItemPaddingLG
},
[`${componentCls}-sm ${componentCls}-item`]: {
padding: listItemPaddingSM
},
// Horizontal
[`${componentCls}:not(${componentCls}-vertical)`]: {
[`${componentCls}-item-no-flex`]: {
[`${componentCls}-item-action`]: {
float: "right"
}
}
}
};
};
const useStyle$k = genComponentStyleHook("List", (token) => {
const listToken = merge(token, {
listBorderedCls: `${token.componentCls}-bordered`,
minHeight: token.controlHeightLG,
listItemPadding: `${token.paddingContentVertical}px ${token.paddingContentHorizontalLG}px`,
listItemPaddingSM: `${token.paddingContentVerticalSM}px ${token.paddingContentHorizontal}px`,
listItemPaddingLG: `${token.paddingContentVerticalLG}px ${token.paddingContentHorizontalLG}px`
});
return [genBaseStyle$9(listToken), genBorderedStyle$1(listToken), genResponsiveStyle(listToken)];
}, {
contentWidth: 220
});
const listProps = () => ({
bordered: booleanType(),
dataSource: arrayType(),
extra: vNodeType(),
grid: objectType(),
itemLayout: String,
loading: someType([Boolean, Object]),
loadMore: vNodeType(),
pagination: someType([Boolean, Object]),
prefixCls: String,
rowKey: someType([String, Number, Function]),
renderItem: functionType(),
size: String,
split: booleanType(),
header: vNodeType(),
footer: vNodeType(),
locale: objectType()
});
const List$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "AList",
inheritAttrs: false,
Item,
props: initDefaultProps(listProps(), {
dataSource: [],
bordered: false,
split: true,
loading: false,
pagination: false
}),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
var _a, _b;
provide(ListContextKey, {
grid: toRef(props2, "grid"),
itemLayout: toRef(props2, "itemLayout")
});
const defaultPaginationProps = {
current: 1,
total: 0
};
const {
prefixCls,
direction,
renderEmpty: renderEmpty2
} = useConfigInject("list", props2);
const [wrapSSR, hashId] = useStyle$k(prefixCls);
const paginationObj = computed(() => props2.pagination && typeof props2.pagination === "object" ? props2.pagination : {});
const paginationCurrent = ref((_a = paginationObj.value.defaultCurrent) !== null && _a !== void 0 ? _a : 1);
const paginationSize = ref((_b = paginationObj.value.defaultPageSize) !== null && _b !== void 0 ? _b : 10);
watch(paginationObj, () => {
if ("current" in paginationObj.value) {
paginationCurrent.value = paginationObj.value.current;
}
if ("pageSize" in paginationObj.value) {
paginationSize.value = paginationObj.value.pageSize;
}
});
const listItemsKeys = [];
const triggerPaginationEvent = (eventName) => (page, pageSize) => {
paginationCurrent.value = page;
paginationSize.value = pageSize;
if (paginationObj.value[eventName]) {
paginationObj.value[eventName](page, pageSize);
}
};
const onPaginationChange = triggerPaginationEvent("onChange");
const onPaginationShowSizeChange = triggerPaginationEvent("onShowSizeChange");
const loadingProp = computed(() => {
if (typeof props2.loading === "boolean") {
return {
spinning: props2.loading
};
} else {
return props2.loading;
}
});
const isLoading = computed(() => loadingProp.value && loadingProp.value.spinning);
const sizeCls = computed(() => {
let size = "";
switch (props2.size) {
case "large":
size = "lg";
break;
case "small":
size = "sm";
break;
}
return size;
});
const classObj = computed(() => ({
[`${prefixCls.value}`]: true,
[`${prefixCls.value}-vertical`]: props2.itemLayout === "vertical",
[`${prefixCls.value}-${sizeCls.value}`]: sizeCls.value,
[`${prefixCls.value}-split`]: props2.split,
[`${prefixCls.value}-bordered`]: props2.bordered,
[`${prefixCls.value}-loading`]: isLoading.value,
[`${prefixCls.value}-grid`]: !!props2.grid,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}));
const paginationProps2 = computed(() => {
const pp = _extends(_extends(_extends({}, defaultPaginationProps), {
total: props2.dataSource.length,
current: paginationCurrent.value,
pageSize: paginationSize.value
}), props2.pagination || {});
const largestPage = Math.ceil(pp.total / pp.pageSize);
if (pp.current > largestPage) {
pp.current = largestPage;
}
return pp;
});
const splitDataSource = computed(() => {
let dd = [...props2.dataSource];
if (props2.pagination) {
if (props2.dataSource.length > (paginationProps2.value.current - 1) * paginationProps2.value.pageSize) {
dd = [...props2.dataSource].splice((paginationProps2.value.current - 1) * paginationProps2.value.pageSize, paginationProps2.value.pageSize);
}
}
return dd;
});
const screens = useBreakpoint();
const currentBreakpoint = eagerComputed(() => {
for (let i = 0; i < responsiveArray.length; i += 1) {
const breakpoint = responsiveArray[i];
if (screens.value[breakpoint]) {
return breakpoint;
}
}
return void 0;
});
const colStyle = computed(() => {
if (!props2.grid) {
return void 0;
}
const columnCount = currentBreakpoint.value && props2.grid[currentBreakpoint.value] ? props2.grid[currentBreakpoint.value] : props2.grid.column;
if (columnCount) {
return {
width: `${100 / columnCount}%`,
maxWidth: `${100 / columnCount}%`
};
}
return void 0;
});
const renderInnerItem = (item, index2) => {
var _a2;
const renderItem = (_a2 = props2.renderItem) !== null && _a2 !== void 0 ? _a2 : slots.renderItem;
if (!renderItem) return null;
let key2;
const rowKeyType = typeof props2.rowKey;
if (rowKeyType === "function") {
key2 = props2.rowKey(item);
} else if (rowKeyType === "string" || rowKeyType === "number") {
key2 = item[props2.rowKey];
} else {
key2 = item.key;
}
if (!key2) {
key2 = `list-item-${index2}`;
}
listItemsKeys[index2] = key2;
return renderItem({
item,
index: index2
});
};
return () => {
var _a2, _b2, _c, _d, _e, _f, _g, _h;
const loadMore = (_a2 = props2.loadMore) !== null && _a2 !== void 0 ? _a2 : (_b2 = slots.loadMore) === null || _b2 === void 0 ? void 0 : _b2.call(slots);
const footer = (_c = props2.footer) !== null && _c !== void 0 ? _c : (_d = slots.footer) === null || _d === void 0 ? void 0 : _d.call(slots);
const header = (_e = props2.header) !== null && _e !== void 0 ? _e : (_f = slots.header) === null || _f === void 0 ? void 0 : _f.call(slots);
const children = flattenChildren((_g = slots.default) === null || _g === void 0 ? void 0 : _g.call(slots));
const isSomethingAfterLastItem = !!(loadMore || props2.pagination || footer);
const classString = classNames(_extends(_extends({}, classObj.value), {
[`${prefixCls.value}-something-after-last-item`]: isSomethingAfterLastItem
}), attrs.class, hashId.value);
const paginationContent = props2.pagination ? createVNode("div", {
"class": `${prefixCls.value}-pagination`
}, [createVNode(Pagination, _objectSpread$W(_objectSpread$W({}, paginationProps2.value), {}, {
"onChange": onPaginationChange,
"onShowSizeChange": onPaginationShowSizeChange
}), null)]) : null;
let childrenContent = isLoading.value && createVNode("div", {
"style": {
minHeight: "53px"
}
}, null);
if (splitDataSource.value.length > 0) {
listItemsKeys.length = 0;
const items = splitDataSource.value.map((item, index2) => renderInnerItem(item, index2));
const childrenList = items.map((child, index2) => createVNode("div", {
"key": listItemsKeys[index2],
"style": colStyle.value
}, [child]));
childrenContent = props2.grid ? createVNode(ARow, {
"gutter": props2.grid.gutter
}, {
default: () => [childrenList]
}) : createVNode("ul", {
"class": `${prefixCls.value}-items`
}, [items]);
} else if (!children.length && !isLoading.value) {
childrenContent = createVNode("div", {
"class": `${prefixCls.value}-empty-text`
}, [((_h = props2.locale) === null || _h === void 0 ? void 0 : _h.emptyText) || renderEmpty2("List")]);
}
const paginationPosition = paginationProps2.value.position || "bottom";
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classString
}), [(paginationPosition === "top" || paginationPosition === "both") && paginationContent, header && createVNode("div", {
"class": `${prefixCls.value}-header`
}, [header]), createVNode(Spin, loadingProp.value, {
default: () => [childrenContent, children]
}), footer && createVNode("div", {
"class": `${prefixCls.value}-footer`
}, [footer]), loadMore || (paginationPosition === "bottom" || paginationPosition === "both") && paginationContent]));
};
}
});
List$1.install = function(app) {
app.component(List$1.name, List$1);
app.component(List$1.Item.name, List$1.Item);
app.component(List$1.Item.Meta.name, List$1.Item.Meta);
return app;
};
function getBeforeSelectionText(input) {
const {
selectionStart
} = input;
return input.value.slice(0, selectionStart);
}
function getLastMeasureIndex(text) {
let prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
const prefixList = Array.isArray(prefix) ? prefix : [prefix];
return prefixList.reduce((lastMatch, prefixStr) => {
const lastIndex = text.lastIndexOf(prefixStr);
if (lastIndex > lastMatch.location) {
return {
location: lastIndex,
prefix: prefixStr
};
}
return lastMatch;
}, {
location: -1,
prefix: ""
});
}
function lower(char) {
return (char || "").toLowerCase();
}
function reduceText(text, targetText, split) {
const firstChar = text[0];
if (!firstChar || firstChar === split) {
return text;
}
let restText = text;
const targetTextLen = targetText.length;
for (let i = 0; i < targetTextLen; i += 1) {
if (lower(restText[i]) !== lower(targetText[i])) {
restText = restText.slice(i);
break;
} else if (i === targetTextLen - 1) {
restText = restText.slice(targetTextLen);
}
}
return restText;
}
function replaceWithMeasure(text, measureConfig) {
const {
measureLocation,
prefix,
targetText,
selectionStart,
split
} = measureConfig;
let beforeMeasureText = text.slice(0, measureLocation);
if (beforeMeasureText[beforeMeasureText.length - split.length] === split) {
beforeMeasureText = beforeMeasureText.slice(0, beforeMeasureText.length - split.length);
}
if (beforeMeasureText) {
beforeMeasureText = `${beforeMeasureText}${split}`;
}
let restText = reduceText(text.slice(selectionStart), targetText.slice(selectionStart - measureLocation - prefix.length), split);
if (restText.slice(0, split.length) === split) {
restText = restText.slice(split.length);
}
const connectedStartText = `${beforeMeasureText}${prefix}${targetText}${split}`;
return {
text: `${connectedStartText}${restText}`,
selectionLocation: connectedStartText.length
};
}
function setInputSelection(input, location) {
input.setSelectionRange(location, location);
input.blur();
input.focus();
}
function validateSearch(text, props2) {
const {
split
} = props2;
return !split || text.indexOf(split) === -1;
}
function filterOption(input, _ref) {
let {
value = ""
} = _ref;
const lowerCase = input.toLowerCase();
return value.toLowerCase().indexOf(lowerCase) !== -1;
}
const MentionsContextKey = Symbol("MentionsContextKey");
function noop$6() {
}
const DropdownMenu = defineComponent({
compatConfig: {
MODE: 3
},
name: "DropdownMenu",
props: {
prefixCls: String,
options: {
type: Array,
default: () => []
}
},
setup(props2, _ref) {
let {
slots
} = _ref;
const {
activeIndex,
setActiveIndex,
selectOption,
onFocus = noop$6,
loading: loading2
} = inject(MentionsContextKey, {
activeIndex: shallowRef(),
loading: shallowRef(false)
});
let timeoutId;
const onMousedown = (e) => {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
onFocus(e);
});
};
return () => {
var _a;
const {
prefixCls,
options
} = props2;
const activeOption = options[activeIndex.value] || {};
return createVNode(Menu, {
"prefixCls": `${prefixCls}-menu`,
"activeKey": activeOption.value,
"onSelect": (_ref2) => {
let {
key: key2
} = _ref2;
const option = options.find((_ref3) => {
let {
value
} = _ref3;
return value === key2;
});
selectOption(option);
},
"onMousedown": onMousedown
}, {
default: () => [!loading2.value && options.map((option, index2) => {
var _a2, _b;
const {
value,
disabled,
label = option.value,
class: className,
style
} = option;
return createVNode(__nuxt_component_1$5, {
"key": value,
"disabled": disabled,
"onMouseenter": () => {
setActiveIndex(index2);
},
"class": className,
"style": style
}, {
default: () => [(_b = (_a2 = slots.option) === null || _a2 === void 0 ? void 0 : _a2.call(slots, option)) !== null && _b !== void 0 ? _b : typeof label === "function" ? label(option) : label]
});
}), !loading2.value && options.length === 0 ? createVNode(__nuxt_component_1$5, {
"key": "notFoundContent",
"disabled": true
}, {
default: () => [(_a = slots.notFoundContent) === null || _a === void 0 ? void 0 : _a.call(slots)]
}) : null, loading2.value && createVNode(__nuxt_component_1$5, {
"key": "loading",
"disabled": true
}, {
default: () => [createVNode(Spin, {
"size": "small"
}, null)]
})]
});
};
}
});
const BUILT_IN_PLACEMENTS = {
bottomRight: {
points: ["tl", "br"],
offset: [0, 4],
overflow: {
adjustX: 0,
adjustY: 1
}
},
bottomLeft: {
points: ["tr", "bl"],
offset: [0, 4],
overflow: {
adjustX: 0,
adjustY: 1
}
},
topRight: {
points: ["bl", "tr"],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
},
topLeft: {
points: ["br", "tl"],
offset: [0, -4],
overflow: {
adjustX: 0,
adjustY: 1
}
}
};
const KeywordTrigger = defineComponent({
compatConfig: {
MODE: 3
},
name: "KeywordTrigger",
props: {
loading: {
type: Boolean,
default: void 0
},
options: {
type: Array,
default: () => []
},
prefixCls: String,
placement: String,
visible: {
type: Boolean,
default: void 0
},
transitionName: String,
getPopupContainer: Function,
direction: String,
dropdownClassName: String
},
setup(props2, _ref) {
let {
slots
} = _ref;
const getDropdownPrefix = () => {
return `${props2.prefixCls}-dropdown`;
};
const getDropdownElement = () => {
const {
options
} = props2;
return createVNode(DropdownMenu, {
"prefixCls": getDropdownPrefix(),
"options": options
}, {
notFoundContent: slots.notFoundContent,
option: slots.option
});
};
const popupPlacement = computed(() => {
const {
placement,
direction
} = props2;
let popupPlacement2 = "topRight";
if (direction === "rtl") {
popupPlacement2 = placement === "top" ? "topLeft" : "bottomLeft";
} else {
popupPlacement2 = placement === "top" ? "topRight" : "bottomRight";
}
return popupPlacement2;
});
return () => {
const {
visible,
transitionName: transitionName2,
getPopupContainer
} = props2;
return createVNode(Trigger, {
"prefixCls": getDropdownPrefix(),
"popupVisible": visible,
"popup": getDropdownElement(),
"popupClassName": props2.dropdownClassName,
"popupPlacement": popupPlacement.value,
"popupTransitionName": transitionName2,
"builtinPlacements": BUILT_IN_PLACEMENTS,
"getPopupContainer": getPopupContainer
}, {
default: slots.default
});
};
}
});
const PlaceMent = tuple$1("top", "bottom");
const mentionsProps$1 = {
autofocus: {
type: Boolean,
default: void 0
},
prefix: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
prefixCls: String,
value: String,
disabled: {
type: Boolean,
default: void 0
},
split: String,
transitionName: String,
placement: PropTypes.oneOf(PlaceMent),
character: PropTypes.any,
characterRender: Function,
filterOption: {
type: [Boolean, Function]
},
validateSearch: Function,
getPopupContainer: {
type: Function
},
options: arrayType(),
loading: {
type: Boolean,
default: void 0
},
rows: [Number, String],
direction: {
type: String
}
};
const vcMentionsProps = _extends(_extends({}, mentionsProps$1), {
dropdownClassName: String
});
const defaultProps$1 = {
prefix: "@",
split: " ",
rows: 1,
validateSearch,
filterOption: () => filterOption
};
initDefaultProps(vcMentionsProps, defaultProps$1);
var __rest$t = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function noop$5() {
}
const Mentions$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Mentions",
inheritAttrs: false,
props: initDefaultProps(vcMentionsProps, defaultProps$1),
emits: ["change", "select", "search", "focus", "blur", "pressenter"],
setup(props2, _ref) {
let {
emit,
attrs,
expose,
slots
} = _ref;
const measure2 = ref(null);
const textarea = ref(null);
const focusId = ref();
const state = reactive({
value: props2.value || "",
measuring: false,
measureLocation: 0,
measureText: null,
measurePrefix: "",
activeIndex: 0,
isFocus: false
});
watchEffect(() => {
state.value = props2.value;
});
const triggerChange = (val) => {
emit("change", val);
};
const onChange = (_ref2) => {
let {
target: {
value
}
} = _ref2;
triggerChange(value);
};
const startMeasure = (measureText, measurePrefix, measureLocation) => {
_extends(state, {
measuring: true,
measureText,
measurePrefix,
measureLocation,
activeIndex: 0
});
};
const stopMeasure = (callback) => {
_extends(state, {
measuring: false,
measureLocation: 0,
measureText: null
});
callback === null || callback === void 0 ? void 0 : callback();
};
const onKeyDown2 = (event) => {
const {
which
} = event;
if (!state.measuring) {
return;
}
if (which === KeyCode.UP || which === KeyCode.DOWN) {
const optionLen = options.value.length;
const offset2 = which === KeyCode.UP ? -1 : 1;
const newActiveIndex = (state.activeIndex + offset2 + optionLen) % optionLen;
state.activeIndex = newActiveIndex;
event.preventDefault();
} else if (which === KeyCode.ESC) {
stopMeasure();
} else if (which === KeyCode.ENTER) {
event.preventDefault();
if (!options.value.length) {
stopMeasure();
return;
}
const option = options.value[state.activeIndex];
selectOption(option);
}
};
const onKeyUp = (event) => {
const {
key: key2,
which
} = event;
const {
measureText: prevMeasureText,
measuring
} = state;
const {
prefix,
validateSearch: validateSearch2
} = props2;
const target = event.target;
if (target.composing) {
return;
}
const selectionStartText = getBeforeSelectionText(target);
const {
location: measureIndex,
prefix: measurePrefix
} = getLastMeasureIndex(selectionStartText, prefix);
if ([KeyCode.ESC, KeyCode.UP, KeyCode.DOWN, KeyCode.ENTER].indexOf(which) !== -1) {
return;
}
if (measureIndex !== -1) {
const measureText = selectionStartText.slice(measureIndex + measurePrefix.length);
const validateMeasure = validateSearch2(measureText, props2);
const matchOption = !!getOptions(measureText).length;
if (validateMeasure) {
if (key2 === measurePrefix || key2 === "Shift" || measuring || measureText !== prevMeasureText && matchOption) {
startMeasure(measureText, measurePrefix, measureIndex);
}
} else if (measuring) {
stopMeasure();
}
if (validateMeasure) {
emit("search", measureText, measurePrefix);
}
} else if (measuring) {
stopMeasure();
}
};
const onPressEnter = (event) => {
if (!state.measuring) {
emit("pressenter", event);
}
};
const onInputFocus = (event) => {
onFocus(event);
};
const onInputBlur = (event) => {
onBlur(event);
};
const onFocus = (event) => {
clearTimeout(focusId.value);
const {
isFocus
} = state;
if (!isFocus && event) {
emit("focus", event);
}
state.isFocus = true;
};
const onBlur = (event) => {
focusId.value = setTimeout(() => {
state.isFocus = false;
stopMeasure();
emit("blur", event);
}, 100);
};
const selectOption = (option) => {
const {
split
} = props2;
const {
value: mentionValue = ""
} = option;
const {
text,
selectionLocation
} = replaceWithMeasure(state.value, {
measureLocation: state.measureLocation,
targetText: mentionValue,
prefix: state.measurePrefix,
selectionStart: textarea.value.getSelectionStart(),
split
});
triggerChange(text);
stopMeasure(() => {
setInputSelection(textarea.value.input, selectionLocation);
});
emit("select", option, state.measurePrefix);
};
const setActiveIndex = (activeIndex) => {
state.activeIndex = activeIndex;
};
const getOptions = (measureText) => {
const targetMeasureText = measureText || state.measureText || "";
const {
filterOption: filterOption2
} = props2;
const list = props2.options.filter((option) => {
if (!!filterOption2 === false) {
return true;
}
return filterOption2(targetMeasureText, option);
});
return list;
};
const options = computed(() => {
return getOptions();
});
const focus = () => {
textarea.value.focus();
};
const blur = () => {
textarea.value.blur();
};
expose({
blur,
focus
});
provide(MentionsContextKey, {
activeIndex: toRef(state, "activeIndex"),
setActiveIndex,
selectOption,
onFocus,
onBlur,
loading: toRef(props2, "loading")
});
return () => {
const {
measureLocation,
measurePrefix,
measuring
} = state;
const {
prefixCls,
placement,
transitionName: transitionName2,
getPopupContainer,
direction
} = props2, restProps = __rest$t(props2, ["prefixCls", "placement", "transitionName", "getPopupContainer", "direction"]);
const {
class: className,
style
} = attrs, otherAttrs = __rest$t(attrs, ["class", "style"]);
const inputProps2 = omit(restProps, ["value", "prefix", "split", "validateSearch", "filterOption", "options", "loading"]);
const textareaProps = _extends(_extends(_extends({}, inputProps2), otherAttrs), {
onChange: noop$5,
onSelect: noop$5,
value: state.value,
onInput: onChange,
onBlur: onInputBlur,
onKeydown: onKeyDown2,
onKeyup: onKeyUp,
onFocus: onInputFocus,
onPressenter: onPressEnter
});
return createVNode("div", {
"class": classNames(prefixCls, className),
"style": style
}, [createVNode(BaseInput$1, _objectSpread$W(_objectSpread$W({}, textareaProps), {}, {
"ref": textarea,
"tag": "textarea"
}), null), measuring && createVNode("div", {
"ref": measure2,
"class": `${prefixCls}-measure`
}, [state.value.slice(0, measureLocation), createVNode(KeywordTrigger, {
"prefixCls": prefixCls,
"transitionName": transitionName2,
"dropdownClassName": props2.dropdownClassName,
"placement": placement,
"options": measuring ? options.value : [],
"visible": true,
"direction": direction,
"getPopupContainer": getPopupContainer
}, {
default: () => [createVNode("span", null, [measurePrefix])],
notFoundContent: slots.notFoundContent,
option: slots.option
}), state.value.slice(measureLocation + measurePrefix.length)])]);
};
}
});
const baseOptionsProps = {
value: String,
disabled: Boolean,
payload: objectType()
};
const optionProps = _extends(_extends({}, baseOptionsProps), {
label: anyType([])
});
const optionOptions = {
name: "Option",
props: optionProps,
render(_props, _ref) {
let {
slots
} = _ref;
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
}
};
defineComponent(_extends({
compatConfig: {
MODE: 3
}
}, optionOptions));
const genMentionsStyle = (token) => {
const {
componentCls,
colorTextDisabled,
controlItemBgHover,
controlPaddingHorizontal,
colorText,
motionDurationSlow,
lineHeight,
controlHeight,
inputPaddingHorizontal,
inputPaddingVertical,
fontSize,
colorBgElevated,
borderRadiusLG,
boxShadowSecondary
} = token;
const itemPaddingVertical = Math.round((token.controlHeight - token.fontSize * token.lineHeight) / 2);
return {
[componentCls]: _extends(_extends(_extends(_extends(_extends({}, resetComponent(token)), genBasicInputStyle(token)), {
position: "relative",
display: "inline-block",
height: "auto",
padding: 0,
overflow: "hidden",
lineHeight,
whiteSpace: "pre-wrap",
verticalAlign: "bottom"
}), genStatusStyle(token, componentCls)), {
"&-disabled": {
"> textarea": _extends({}, genDisabledStyle(token))
},
"&-focused": _extends({}, genActiveStyle(token)),
[`&-affix-wrapper ${componentCls}-suffix`]: {
position: "absolute",
top: 0,
insetInlineEnd: inputPaddingHorizontal,
bottom: 0,
zIndex: 1,
display: "inline-flex",
alignItems: "center",
margin: "auto"
},
// ================= Input Area =================
[`> textarea, ${componentCls}-measure`]: {
color: colorText,
boxSizing: "border-box",
minHeight: controlHeight - 2,
margin: 0,
padding: `${inputPaddingVertical}px ${inputPaddingHorizontal}px`,
overflow: "inherit",
overflowX: "hidden",
overflowY: "auto",
fontWeight: "inherit",
fontSize: "inherit",
fontFamily: "inherit",
fontStyle: "inherit",
fontVariant: "inherit",
fontSizeAdjust: "inherit",
fontStretch: "inherit",
lineHeight: "inherit",
direction: "inherit",
letterSpacing: "inherit",
whiteSpace: "inherit",
textAlign: "inherit",
verticalAlign: "top",
wordWrap: "break-word",
wordBreak: "inherit",
tabSize: "inherit"
},
"> textarea": _extends({
width: "100%",
border: "none",
outline: "none",
resize: "none",
backgroundColor: "inherit"
}, genPlaceholderStyle(token.colorTextPlaceholder)),
[`${componentCls}-measure`]: {
position: "absolute",
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
zIndex: -1,
color: "transparent",
pointerEvents: "none",
"> span": {
display: "inline-block",
minHeight: "1em"
}
},
// ================== Dropdown ==================
"&-dropdown": _extends(_extends({}, resetComponent(token)), {
position: "absolute",
top: -9999,
insetInlineStart: -9999,
zIndex: token.zIndexPopup,
boxSizing: "border-box",
fontSize,
fontVariant: "initial",
backgroundColor: colorBgElevated,
borderRadius: borderRadiusLG,
outline: "none",
boxShadow: boxShadowSecondary,
"&-hidden": {
display: "none"
},
[`${componentCls}-dropdown-menu`]: {
maxHeight: token.dropdownHeight,
marginBottom: 0,
paddingInlineStart: 0,
overflow: "auto",
listStyle: "none",
outline: "none",
"&-item": _extends(_extends({}, textEllipsis), {
position: "relative",
display: "block",
minWidth: token.controlItemWidth,
padding: `${itemPaddingVertical}px ${controlPaddingHorizontal}px`,
color: colorText,
fontWeight: "normal",
lineHeight,
cursor: "pointer",
transition: `background ${motionDurationSlow} ease`,
"&:hover": {
backgroundColor: controlItemBgHover
},
"&:first-child": {
borderStartStartRadius: borderRadiusLG,
borderStartEndRadius: borderRadiusLG,
borderEndStartRadius: 0,
borderEndEndRadius: 0
},
"&:last-child": {
borderStartStartRadius: 0,
borderStartEndRadius: 0,
borderEndStartRadius: borderRadiusLG,
borderEndEndRadius: borderRadiusLG
},
"&-disabled": {
color: colorTextDisabled,
cursor: "not-allowed",
"&:hover": {
color: colorTextDisabled,
backgroundColor: controlItemBgHover,
cursor: "not-allowed"
}
},
"&-selected": {
color: colorText,
fontWeight: token.fontWeightStrong,
backgroundColor: controlItemBgHover
},
"&-active": {
backgroundColor: controlItemBgHover
}
})
}
})
})
};
};
const useStyle$j = genComponentStyleHook("Mentions", (token) => {
const mentionsToken = initInputToken(token);
return [genMentionsStyle(mentionsToken)];
}, (token) => ({
dropdownHeight: 250,
controlItemWidth: 100,
zIndexPopup: token.zIndexPopupBase + 50
}));
var __rest$s = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function loadingFilterOption() {
return true;
}
const getMentions = function() {
let value = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
let config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
const {
prefix = "@",
split = " "
} = config;
const prefixList = Array.isArray(prefix) ? prefix : [prefix];
return value.split(split).map(function() {
let str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
let hitPrefix = null;
prefixList.some((prefixStr) => {
const startStr = str.slice(0, prefixStr.length);
if (startStr === prefixStr) {
hitPrefix = prefixStr;
return true;
}
return false;
});
if (hitPrefix !== null) {
return {
prefix: hitPrefix,
value: str.slice(hitPrefix.length)
};
}
return null;
}).filter((entity) => !!entity && !!entity.value);
};
const mentionsProps = () => _extends(_extends({}, mentionsProps$1), {
loading: {
type: Boolean,
default: void 0
},
onFocus: {
type: Function
},
onBlur: {
type: Function
},
onSelect: {
type: Function
},
onChange: {
type: Function
},
onPressenter: {
type: Function
},
"onUpdate:value": {
type: Function
},
notFoundContent: PropTypes.any,
defaultValue: String,
id: String,
status: String
});
const Mentions = defineComponent({
compatConfig: {
MODE: 3
},
name: "AMentions",
inheritAttrs: false,
props: mentionsProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
emit,
attrs,
expose
} = _ref;
var _b, _c;
const {
prefixCls,
renderEmpty: renderEmpty2,
direction
} = useConfigInject("mentions", props2);
const [wrapSSR, hashId] = useStyle$j(prefixCls);
const focused = shallowRef(false);
const vcMentions = shallowRef(null);
const value = shallowRef((_c = (_b = props2.value) !== null && _b !== void 0 ? _b : props2.defaultValue) !== null && _c !== void 0 ? _c : "");
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
useProvideOverride({
prefixCls: computed(() => `${prefixCls.value}-menu`),
mode: computed(() => "vertical"),
selectable: computed(() => false),
onClick: () => {
},
validator: (_ref2) => {
let {
mode
} = _ref2;
}
});
watch(() => props2.value, (val) => {
value.value = val;
});
const handleFocus = (e) => {
focused.value = true;
emit("focus", e);
};
const handleBlur = (e) => {
focused.value = false;
emit("blur", e);
formItemContext.onFieldBlur();
};
const handleSelect = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
emit("select", ...args);
focused.value = true;
};
const handleChange = (val) => {
if (props2.value === void 0) {
value.value = val;
}
emit("update:value", val);
emit("change", val);
formItemContext.onFieldChange();
};
const getNotFoundContent = () => {
const notFoundContent = props2.notFoundContent;
if (notFoundContent !== void 0) {
return notFoundContent;
}
if (slots.notFoundContent) {
return slots.notFoundContent();
}
return renderEmpty2("Select");
};
const getOptions = () => {
var _a2;
return flattenChildren(((_a2 = slots.default) === null || _a2 === void 0 ? void 0 : _a2.call(slots)) || []).map((item) => {
var _a3, _b2;
return _extends(_extends({}, getOptionProps(item)), {
label: (_b2 = (_a3 = item.children) === null || _a3 === void 0 ? void 0 : _a3.default) === null || _b2 === void 0 ? void 0 : _b2.call(_a3)
});
});
};
const focus = () => {
vcMentions.value.focus();
};
const blur = () => {
vcMentions.value.blur();
};
expose({
focus,
blur
});
const mentionsfilterOption = computed(() => props2.loading ? loadingFilterOption : props2.filterOption);
return () => {
const {
disabled,
getPopupContainer,
rows = 1,
id = formItemContext.id.value
} = props2, restProps = __rest$s(props2, ["disabled", "getPopupContainer", "rows", "id"]);
const {
hasFeedback,
feedbackIcon
} = formItemInputContext;
const {
class: className
} = attrs, otherAttrs = __rest$s(attrs, ["class"]);
const otherProps = omit(restProps, ["defaultValue", "onUpdate:value", "prefixCls"]);
const mergedClassName = classNames({
[`${prefixCls.value}-disabled`]: disabled,
[`${prefixCls.value}-focused`]: focused.value,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, getStatusClassNames(prefixCls.value, mergedStatus.value), !hasFeedback && className, hashId.value);
const mentionsProps2 = _extends(_extends(_extends(_extends({
prefixCls: prefixCls.value
}, otherProps), {
disabled,
direction: direction.value,
filterOption: mentionsfilterOption.value,
getPopupContainer,
options: props2.loading ? [{
value: "ANTDV_SEARCHING",
disabled: true,
label: createVNode(Spin, {
"size": "small"
}, null)
}] : props2.options || getOptions(),
class: mergedClassName
}), otherAttrs), {
rows,
onChange: handleChange,
onSelect: handleSelect,
onFocus: handleFocus,
onBlur: handleBlur,
ref: vcMentions,
value: value.value,
id
});
const mentions = createVNode(Mentions$1, _objectSpread$W(_objectSpread$W({}, mentionsProps2), {}, {
"dropdownClassName": hashId.value
}), {
notFoundContent: getNotFoundContent,
option: slots.option
});
if (hasFeedback) {
return wrapSSR(createVNode("div", {
"class": classNames(`${prefixCls.value}-affix-wrapper`, getStatusClassNames(`${prefixCls.value}-affix-wrapper`, mergedStatus.value, hasFeedback), className, hashId.value)
}, [mentions, createVNode("span", {
"class": `${prefixCls.value}-suffix`
}, [feedbackIcon])]));
}
return wrapSSR(mentions);
};
}
});
const MentionsOption = defineComponent(_extends(_extends({
compatConfig: {
MODE: 3
}
}, optionOptions), {
name: "AMentionsOption",
props: optionProps
}));
const __nuxt_component_0$2 = _extends(Mentions, {
Option: MentionsOption,
getMentions,
install: (app) => {
app.component(Mentions.name, Mentions);
app.component(MentionsOption.name, MentionsOption);
return app;
}
});
var __rest$r = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
let mousePosition;
const modalProps = () => ({
prefixCls: String,
/** @deprecated Please use `open` instead. */
visible: {
type: Boolean,
default: void 0
},
open: {
type: Boolean,
default: void 0
},
confirmLoading: {
type: Boolean,
default: void 0
},
title: PropTypes.any,
closable: {
type: Boolean,
default: void 0
},
closeIcon: PropTypes.any,
onOk: Function,
onCancel: Function,
"onUpdate:visible": Function,
"onUpdate:open": Function,
onChange: Function,
afterClose: Function,
centered: {
type: Boolean,
default: void 0
},
width: [String, Number],
footer: PropTypes.any,
okText: PropTypes.any,
okType: String,
cancelText: PropTypes.any,
icon: PropTypes.any,
maskClosable: {
type: Boolean,
default: void 0
},
forceRender: {
type: Boolean,
default: void 0
},
okButtonProps: objectType(),
cancelButtonProps: objectType(),
destroyOnClose: {
type: Boolean,
default: void 0
},
wrapClassName: String,
maskTransitionName: String,
transitionName: String,
getContainer: {
type: [String, Function, Boolean, Object],
default: void 0
},
zIndex: Number,
bodyStyle: objectType(),
maskStyle: objectType(),
mask: {
type: Boolean,
default: void 0
},
keyboard: {
type: Boolean,
default: void 0
},
wrapProps: Object,
focusTriggerAfterClose: {
type: Boolean,
default: void 0
},
modalRender: Function,
mousePosition: objectType()
});
const Modal = defineComponent({
compatConfig: {
MODE: 3
},
name: "AModal",
inheritAttrs: false,
props: initDefaultProps(modalProps(), {
width: 520,
confirmLoading: false,
okType: "primary"
}),
setup(props2, _ref) {
let {
emit,
slots,
attrs
} = _ref;
const [locale2] = useLocaleReceiver("Modal");
const {
prefixCls,
rootPrefixCls,
direction,
getPopupContainer
} = useConfigInject("modal", props2);
const [wrapSSR, hashId] = useStyle$q(prefixCls);
warning(props2.visible === void 0);
const handleCancel = (e) => {
emit("update:visible", false);
emit("update:open", false);
emit("cancel", e);
emit("change", false);
};
const handleOk = (e) => {
emit("ok", e);
};
const renderFooter = () => {
var _a, _b;
const {
okText = (_a = slots.okText) === null || _a === void 0 ? void 0 : _a.call(slots),
okType,
cancelText = (_b = slots.cancelText) === null || _b === void 0 ? void 0 : _b.call(slots),
confirmLoading
} = props2;
return createVNode(Fragment, null, [createVNode(Button, _objectSpread$W({
"onClick": handleCancel
}, props2.cancelButtonProps), {
default: () => [cancelText || locale2.value.cancelText]
}), createVNode(Button, _objectSpread$W(_objectSpread$W({}, convertLegacyProps(okType)), {}, {
"loading": confirmLoading,
"onClick": handleOk
}, props2.okButtonProps), {
default: () => [okText || locale2.value.okText]
})]);
};
return () => {
var _a, _b;
const {
prefixCls: customizePrefixCls,
visible,
open: open2,
wrapClassName,
centered,
getContainer: getContainer2,
closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots),
focusTriggerAfterClose = true
} = props2, restProps = __rest$r(props2, ["prefixCls", "visible", "open", "wrapClassName", "centered", "getContainer", "closeIcon", "focusTriggerAfterClose"]);
const wrapClassNameExtended = classNames(wrapClassName, {
[`${prefixCls.value}-centered`]: !!centered,
[`${prefixCls.value}-wrap-rtl`]: direction.value === "rtl"
});
return wrapSSR(createVNode(DialogWrap, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, restProps), attrs), {}, {
"rootClassName": hashId.value,
"class": classNames(hashId.value, attrs.class),
"getContainer": getContainer2 || (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value),
"prefixCls": prefixCls.value,
"wrapClassName": wrapClassNameExtended,
"visible": open2 !== null && open2 !== void 0 ? open2 : visible,
"onClose": handleCancel,
"focusTriggerAfterClose": focusTriggerAfterClose,
"transitionName": getTransitionName$1(rootPrefixCls.value, "zoom", props2.transitionName),
"maskTransitionName": getTransitionName$1(rootPrefixCls.value, "fade", props2.maskTransitionName),
"mousePosition": (_b = restProps.mousePosition) !== null && _b !== void 0 ? _b : mousePosition
}), _extends(_extends({}, slots), {
footer: slots.footer || renderFooter,
closeIcon: () => {
return createVNode("span", {
"class": `${prefixCls.value}-close-x`
}, [closeIcon || createVNode(CloseOutlined, {
"class": `${prefixCls.value}-close-icon`
}, null)]);
}
})));
};
}
});
const useDestroyed = () => {
const destroyed = shallowRef(false);
return destroyed;
};
const actionButtonProps = {
type: {
type: String
},
actionFn: Function,
close: Function,
autofocus: Boolean,
prefixCls: String,
buttonProps: objectType(),
emitEvent: Boolean,
quitOnNullishReturnValue: Boolean
};
function isThenable(thing) {
return !!(thing && thing.then);
}
const ActionButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "ActionButton",
props: actionButtonProps,
setup(props2, _ref) {
let {
slots
} = _ref;
const clickedRef = shallowRef(false);
const buttonRef = shallowRef();
const loading2 = shallowRef(false);
const isDestroyed = useDestroyed();
const onInternalClose = function() {
var _a;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
(_a = props2.close) === null || _a === void 0 ? void 0 : _a.call(props2, ...args);
};
const handlePromiseOnOk = (returnValueOfOnOk) => {
if (!isThenable(returnValueOfOnOk)) {
return;
}
loading2.value = true;
returnValueOfOnOk.then(function() {
if (!isDestroyed.value) {
loading2.value = false;
}
onInternalClose(...arguments);
clickedRef.value = false;
}, (e) => {
if (!isDestroyed.value) {
loading2.value = false;
}
clickedRef.value = false;
return Promise.reject(e);
});
};
const onClick = (e) => {
const {
actionFn
} = props2;
if (clickedRef.value) {
return;
}
clickedRef.value = true;
if (!actionFn) {
onInternalClose();
return;
}
let returnValueOfOnOk;
if (props2.emitEvent) {
returnValueOfOnOk = actionFn(e);
if (props2.quitOnNullishReturnValue && !isThenable(returnValueOfOnOk)) {
clickedRef.value = false;
onInternalClose(e);
return;
}
} else if (actionFn.length) {
returnValueOfOnOk = actionFn(props2.close);
clickedRef.value = false;
} else {
returnValueOfOnOk = actionFn();
if (!returnValueOfOnOk) {
onInternalClose();
return;
}
}
handlePromiseOnOk(returnValueOfOnOk);
};
return () => {
const {
type,
prefixCls,
buttonProps: buttonProps2
} = props2;
return createVNode(Button, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, convertLegacyProps(type)), {}, {
"onClick": onClick,
"loading": loading2.value,
"prefixCls": prefixCls
}, buttonProps2), {}, {
"ref": buttonRef
}), slots);
};
}
});
function renderSomeContent(someContent) {
if (typeof someContent === "function") {
return someContent();
}
return someContent;
}
const ConfirmDialog = defineComponent({
name: "ConfirmDialog",
inheritAttrs: false,
props: ["icon", "onCancel", "onOk", "close", "closable", "zIndex", "afterClose", "visible", "open", "keyboard", "centered", "getContainer", "maskStyle", "okButtonProps", "cancelButtonProps", "okType", "prefixCls", "okCancel", "width", "mask", "maskClosable", "okText", "cancelText", "autoFocusButton", "transitionName", "maskTransitionName", "type", "title", "content", "direction", "rootPrefixCls", "bodyStyle", "closeIcon", "modalRender", "focusTriggerAfterClose", "wrapClassName", "confirmPrefixCls", "footer"],
setup(props2, _ref) {
let {
attrs
} = _ref;
const [locale2] = useLocaleReceiver("Modal");
return () => {
const {
icon,
onCancel,
onOk,
close,
okText,
closable = false,
zIndex,
afterClose,
keyboard,
centered,
getContainer: getContainer2,
maskStyle,
okButtonProps,
cancelButtonProps,
okCancel,
width = 416,
mask = true,
maskClosable = false,
type,
open: open2,
title,
content,
direction,
closeIcon,
modalRender,
focusTriggerAfterClose,
rootPrefixCls,
bodyStyle,
wrapClassName,
footer
} = props2;
let mergedIcon = icon;
if (!icon && icon !== null) {
switch (type) {
case "info":
mergedIcon = createVNode(InfoCircleFilled, null, null);
break;
case "success":
mergedIcon = createVNode(CheckCircleFilled, null, null);
break;
case "error":
mergedIcon = createVNode(CloseCircleFilled, null, null);
break;
default:
mergedIcon = createVNode(ExclamationCircleFilled, null, null);
}
}
const okType = props2.okType || "primary";
const prefixCls = props2.prefixCls || "ant-modal";
const contentPrefixCls = `${prefixCls}-confirm`;
const style = attrs.style || {};
const mergedOkCancel = okCancel !== null && okCancel !== void 0 ? okCancel : type === "confirm";
const autoFocusButton = props2.autoFocusButton === null ? false : props2.autoFocusButton || "ok";
const confirmPrefixCls = `${prefixCls}-confirm`;
const classString = classNames(confirmPrefixCls, `${confirmPrefixCls}-${props2.type}`, {
[`${confirmPrefixCls}-rtl`]: direction === "rtl"
}, attrs.class);
const mergedLocal = locale2.value;
const cancelButton = mergedOkCancel && createVNode(ActionButton, {
"actionFn": onCancel,
"close": close,
"autofocus": autoFocusButton === "cancel",
"buttonProps": cancelButtonProps,
"prefixCls": `${rootPrefixCls}-btn`
}, {
default: () => [renderSomeContent(props2.cancelText) || mergedLocal.cancelText]
});
return createVNode(Modal, {
"prefixCls": prefixCls,
"class": classString,
"wrapClassName": classNames({
[`${confirmPrefixCls}-centered`]: !!centered
}, wrapClassName),
"onCancel": (e) => close === null || close === void 0 ? void 0 : close({
triggerCancel: true
}, e),
"open": open2,
"title": "",
"footer": "",
"transitionName": getTransitionName$1(rootPrefixCls, "zoom", props2.transitionName),
"maskTransitionName": getTransitionName$1(rootPrefixCls, "fade", props2.maskTransitionName),
"mask": mask,
"maskClosable": maskClosable,
"maskStyle": maskStyle,
"style": style,
"bodyStyle": bodyStyle,
"width": width,
"zIndex": zIndex,
"afterClose": afterClose,
"keyboard": keyboard,
"centered": centered,
"getContainer": getContainer2,
"closable": closable,
"closeIcon": closeIcon,
"modalRender": modalRender,
"focusTriggerAfterClose": focusTriggerAfterClose
}, {
default: () => [createVNode("div", {
"class": `${contentPrefixCls}-body-wrapper`
}, [createVNode("div", {
"class": `${contentPrefixCls}-body`
}, [renderSomeContent(mergedIcon), title === void 0 ? null : createVNode("span", {
"class": `${contentPrefixCls}-title`
}, [renderSomeContent(title)]), createVNode("div", {
"class": `${contentPrefixCls}-content`
}, [renderSomeContent(content)])]), footer !== void 0 ? renderSomeContent(footer) : createVNode("div", {
"class": `${contentPrefixCls}-btns`
}, [cancelButton, createVNode(ActionButton, {
"type": okType,
"actionFn": onOk,
"close": close,
"autofocus": autoFocusButton === "ok",
"buttonProps": okButtonProps,
"prefixCls": `${rootPrefixCls}-btn`
}, {
default: () => [renderSomeContent(okText) || (mergedOkCancel ? mergedLocal.okText : mergedLocal.justOkText)]
})])])]
});
};
}
});
const destroyFns = [];
const confirm = (config) => {
const container = (void 0).createDocumentFragment();
let currentConfig = _extends(_extends({}, omit(config, ["parentContext", "appContext"])), {
close,
open: true
});
let confirmDialogInstance = null;
function destroy() {
if (confirmDialogInstance) {
render(null, container);
confirmDialogInstance = null;
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
const triggerCancel = args.some((param) => param && param.triggerCancel);
if (config.onCancel && triggerCancel) {
config.onCancel(() => {
}, ...args.slice(1));
}
for (let i = 0; i < destroyFns.length; i++) {
const fn = destroyFns[i];
if (fn === close) {
destroyFns.splice(i, 1);
break;
}
}
}
function close() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
currentConfig = _extends(_extends({}, currentConfig), {
open: false,
afterClose: () => {
if (typeof config.afterClose === "function") {
config.afterClose();
}
destroy.apply(this, args);
}
});
if (currentConfig.visible) {
delete currentConfig.visible;
}
update(currentConfig);
}
function update(configUpdate) {
if (typeof configUpdate === "function") {
currentConfig = configUpdate(currentConfig);
} else {
currentConfig = _extends(_extends({}, currentConfig), configUpdate);
}
if (confirmDialogInstance) {
triggerVNodeUpdate(confirmDialogInstance, currentConfig, container);
}
}
const Wrapper = (p) => {
const global = globalConfigForApi;
const rootPrefixCls = global.prefixCls;
const prefixCls = p.prefixCls || `${rootPrefixCls}-modal`;
const iconPrefixCls = global.iconPrefixCls;
const runtimeLocale2 = getConfirmLocale();
return createVNode(ConfigProvider, _objectSpread$W(_objectSpread$W({}, global), {}, {
"prefixCls": rootPrefixCls
}), {
default: () => [createVNode(ConfirmDialog, _objectSpread$W(_objectSpread$W({}, p), {}, {
"rootPrefixCls": rootPrefixCls,
"prefixCls": prefixCls,
"iconPrefixCls": iconPrefixCls,
"locale": runtimeLocale2,
"cancelText": p.cancelText || runtimeLocale2.cancelText
}), null)]
});
};
function render$1(props2) {
const vm = createVNode(Wrapper, _extends({}, props2));
vm.appContext = config.parentContext || config.appContext || vm.appContext;
render(vm, container);
return vm;
}
confirmDialogInstance = render$1(currentConfig);
destroyFns.push(close);
return {
destroy: close,
update
};
};
function withWarn(props2) {
return _extends(_extends({}, props2), {
type: "warning"
});
}
function withInfo(props2) {
return _extends(_extends({}, props2), {
type: "info"
});
}
function withSuccess(props2) {
return _extends(_extends({}, props2), {
type: "success"
});
}
function withError(props2) {
return _extends(_extends({}, props2), {
type: "error"
});
}
function withConfirm(props2) {
return _extends(_extends({}, props2), {
type: "confirm"
});
}
const comfirmFuncProps = () => ({
config: Object,
afterClose: Function,
destroyAction: Function,
open: Boolean
});
const HookModal = defineComponent({
name: "HookModal",
inheritAttrs: false,
props: initDefaultProps(comfirmFuncProps(), {
config: {
width: 520,
okType: "primary"
}
}),
setup(props2, _ref) {
let {
expose
} = _ref;
var _a;
const open2 = computed(() => props2.open);
const innerConfig = computed(() => props2.config);
const {
direction,
getPrefixCls
} = useConfigContextInject();
const prefixCls = getPrefixCls("modal");
const rootPrefixCls = getPrefixCls();
const afterClose = () => {
var _a2, _b;
props2 === null || props2 === void 0 ? void 0 : props2.afterClose();
(_b = (_a2 = innerConfig.value).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a2);
};
const close = function() {
props2.destroyAction(...arguments);
};
expose({
destroy: close
});
const mergedOkCancel = (_a = innerConfig.value.okCancel) !== null && _a !== void 0 ? _a : innerConfig.value.type === "confirm";
const [contextLocale] = useLocaleReceiver("Modal", localeValues.Modal);
return () => createVNode(ConfirmDialog, _objectSpread$W(_objectSpread$W({
"prefixCls": prefixCls,
"rootPrefixCls": rootPrefixCls
}, innerConfig.value), {}, {
"close": close,
"open": open2.value,
"afterClose": afterClose,
"okText": innerConfig.value.okText || (mergedOkCancel ? contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.value.okText : contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.value.justOkText),
"direction": innerConfig.value.direction || direction.value,
"cancelText": innerConfig.value.cancelText || (contextLocale === null || contextLocale === void 0 ? void 0 : contextLocale.value.cancelText)
}), null);
}
});
let uuid = 0;
const ElementsHolder = defineComponent({
name: "ElementsHolder",
inheritAttrs: false,
setup(_, _ref) {
let {
expose
} = _ref;
const modals = shallowRef([]);
const addModal = (modal) => {
modals.value.push(modal);
modals.value = modals.value.slice();
return () => {
modals.value = modals.value.filter((currentModal) => currentModal !== modal);
};
};
expose({
addModal
});
return () => {
return modals.value.map((modal) => modal());
};
}
});
function useModal() {
const holderRef = shallowRef(null);
const actionQueue = shallowRef([]);
watch(actionQueue, () => {
if (actionQueue.value.length) {
const cloneQueue = [...actionQueue.value];
cloneQueue.forEach((action) => {
action();
});
actionQueue.value = [];
}
}, {
immediate: true
});
const getConfirmFunc = (withFunc) => function hookConfirm(config) {
var _a;
uuid += 1;
const open2 = shallowRef(true);
const modalRef = shallowRef(null);
const configRef = shallowRef(unref(config));
const updateConfig = shallowRef({});
watch(() => config, (val) => {
updateAction(_extends(_extends({}, isRef(val) ? val.value : val), updateConfig.value));
});
const destroyAction = function() {
open2.value = false;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
const triggerCancel = args.some((param) => param && param.triggerCancel);
if (configRef.value.onCancel && triggerCancel) {
configRef.value.onCancel(() => {
}, ...args.slice(1));
}
};
let closeFunc;
const modal = () => createVNode(HookModal, {
"key": `modal-${uuid}`,
"config": withFunc(configRef.value),
"ref": modalRef,
"open": open2.value,
"destroyAction": destroyAction,
"afterClose": () => {
closeFunc === null || closeFunc === void 0 ? void 0 : closeFunc();
}
}, null);
closeFunc = (_a = holderRef.value) === null || _a === void 0 ? void 0 : _a.addModal(modal);
if (closeFunc) {
destroyFns.push(closeFunc);
}
const updateAction = (newConfig) => {
configRef.value = _extends(_extends({}, configRef.value), newConfig);
};
const destroy = () => {
if (modalRef.value) {
destroyAction();
} else {
actionQueue.value = [...actionQueue.value, destroyAction];
}
};
const update = (newConfig) => {
updateConfig.value = newConfig;
if (modalRef.value) {
updateAction(newConfig);
} else {
actionQueue.value = [...actionQueue.value, () => updateAction(newConfig)];
}
};
return {
destroy,
update
};
};
const fns = computed(() => ({
info: getConfirmFunc(withInfo),
success: getConfirmFunc(withSuccess),
error: getConfirmFunc(withError),
warning: getConfirmFunc(withWarn),
confirm: getConfirmFunc(withConfirm)
}));
const holderKey = Symbol("modalHolderKey");
return [fns.value, () => createVNode(ElementsHolder, {
"key": holderKey,
"ref": holderRef
}, null)];
}
function modalWarn(props2) {
return confirm(withWarn(props2));
}
Modal.useModal = useModal;
Modal.info = function infoFn(props2) {
return confirm(withInfo(props2));
};
Modal.success = function successFn(props2) {
return confirm(withSuccess(props2));
};
Modal.error = function errorFn(props2) {
return confirm(withError(props2));
};
Modal.warning = modalWarn;
Modal.warn = modalWarn;
Modal.confirm = function confirmFn(props2) {
return confirm(withConfirm(props2));
};
Modal.destroyAll = function destroyAllFn() {
while (destroyFns.length) {
const close = destroyFns.pop();
if (close) {
close();
}
}
};
Modal.install = function(app) {
app.component(Modal.name, Modal);
return app;
};
const StatisticNumber = (props2) => {
const {
value,
formatter,
precision,
decimalSeparator,
groupSeparator = "",
prefixCls
} = props2;
let valueNode;
if (typeof formatter === "function") {
valueNode = formatter({
value
});
} else {
const val = String(value);
const cells = val.match(/^(-?)(\d*)(\.(\d+))?$/);
if (!cells) {
valueNode = val;
} else {
const negative = cells[1];
let int = cells[2] || "0";
let decimal = cells[4] || "";
int = int.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
if (typeof precision === "number") {
decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
}
if (decimal) {
decimal = `${decimalSeparator}${decimal}`;
}
valueNode = [createVNode("span", {
"key": "int",
"class": `${prefixCls}-content-value-int`
}, [negative, int]), decimal && createVNode("span", {
"key": "decimal",
"class": `${prefixCls}-content-value-decimal`
}, [decimal])];
}
}
return createVNode("span", {
"class": `${prefixCls}-content-value`
}, [valueNode]);
};
StatisticNumber.displayName = "StatisticNumber";
const genStatisticStyle = (token) => {
const {
componentCls,
marginXXS,
padding,
colorTextDescription,
statisticTitleFontSize,
colorTextHeading,
statisticContentFontSize,
statisticFontFamily
} = token;
return {
[`${componentCls}`]: _extends(_extends({}, resetComponent(token)), {
[`${componentCls}-title`]: {
marginBottom: marginXXS,
color: colorTextDescription,
fontSize: statisticTitleFontSize
},
[`${componentCls}-skeleton`]: {
paddingTop: padding
},
[`${componentCls}-content`]: {
color: colorTextHeading,
fontSize: statisticContentFontSize,
fontFamily: statisticFontFamily,
[`${componentCls}-content-value`]: {
display: "inline-block",
direction: "ltr"
},
[`${componentCls}-content-prefix, ${componentCls}-content-suffix`]: {
display: "inline-block"
},
[`${componentCls}-content-prefix`]: {
marginInlineEnd: marginXXS
},
[`${componentCls}-content-suffix`]: {
marginInlineStart: marginXXS
}
}
})
};
};
const useStyle$i = genComponentStyleHook("Statistic", (token) => {
const {
fontSizeHeading3,
fontSize,
fontFamily
} = token;
const statisticToken2 = merge(token, {
statisticTitleFontSize: fontSize,
statisticContentFontSize: fontSizeHeading3,
statisticFontFamily: fontFamily
});
return [genStatisticStyle(statisticToken2)];
});
const statisticProps = () => ({
prefixCls: String,
decimalSeparator: String,
groupSeparator: String,
format: String,
value: someType([Number, String, Object]),
valueStyle: {
type: Object,
default: void 0
},
valueRender: functionType(),
formatter: anyType(),
precision: Number,
prefix: vNodeType(),
suffix: vNodeType(),
title: vNodeType(),
loading: booleanType()
});
const Statistic = defineComponent({
compatConfig: {
MODE: 3
},
name: "AStatistic",
inheritAttrs: false,
props: initDefaultProps(statisticProps(), {
decimalSeparator: ".",
groupSeparator: ",",
loading: false
}),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("statistic", props2);
const [wrapSSR, hashId] = useStyle$i(prefixCls);
return () => {
var _a, _b, _c, _d, _e, _f, _g;
const {
value = 0,
valueStyle,
valueRender
} = props2;
const pre = prefixCls.value;
const title = (_a = props2.title) !== null && _a !== void 0 ? _a : (_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots);
const prefix = (_c = props2.prefix) !== null && _c !== void 0 ? _c : (_d = slots.prefix) === null || _d === void 0 ? void 0 : _d.call(slots);
const suffix = (_e = props2.suffix) !== null && _e !== void 0 ? _e : (_f = slots.suffix) === null || _f === void 0 ? void 0 : _f.call(slots);
const formatter = (_g = props2.formatter) !== null && _g !== void 0 ? _g : slots.formatter;
let valueNode = createVNode(StatisticNumber, _objectSpread$W({
"data-for-update": Date.now()
}, _extends(_extends({}, props2), {
prefixCls: pre,
value,
formatter
})), null);
if (valueRender) {
valueNode = valueRender(valueNode);
}
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [pre, {
[`${pre}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value]
}), [title && createVNode("div", {
"class": `${pre}-title`
}, [title]), createVNode(Skeleton, {
"paragraph": false,
"loading": props2.loading
}, {
default: () => [createVNode("div", {
"style": valueStyle,
"class": `${pre}-content`
}, [prefix && createVNode("span", {
"class": `${pre}-content-prefix`
}, [prefix]), valueNode, suffix && createVNode("span", {
"class": `${pre}-content-suffix`
}, [suffix])])]
})]));
};
}
});
const timeUnits = [
["Y", 1e3 * 60 * 60 * 24 * 365],
["M", 1e3 * 60 * 60 * 24 * 30],
["D", 1e3 * 60 * 60 * 24],
["H", 1e3 * 60 * 60],
["m", 1e3 * 60],
["s", 1e3],
["S", 1]
// million seconds
];
function formatTimeStr(duration, format2) {
let leftDuration = duration;
const escapeRegex = /\[[^\]]*]/g;
const keepList = (format2.match(escapeRegex) || []).map((str) => str.slice(1, -1));
const templateText = format2.replace(escapeRegex, "[]");
const replacedText = timeUnits.reduce((current, _ref) => {
let [name, unit] = _ref;
if (current.includes(name)) {
const value = Math.floor(leftDuration / unit);
leftDuration -= value * unit;
return current.replace(new RegExp(`${name}+`, "g"), (match2) => {
const len = match2.length;
return value.toString().padStart(len, "0");
});
}
return current;
}, templateText);
let index2 = 0;
return replacedText.replace(escapeRegex, () => {
const match2 = keepList[index2];
index2 += 1;
return match2;
});
}
function formatCountdown(value, config) {
const {
format: format2 = ""
} = config;
const target = new Date(value).getTime();
const current = Date.now();
const diff = Math.max(target - current, 0);
return formatTimeStr(diff, format2);
}
const countdownProps = () => {
return _extends(_extends({}, statisticProps()), {
value: someType([Number, String, Object]),
format: String,
onFinish: Function,
onChange: Function
});
};
const Countdown = defineComponent({
compatConfig: {
MODE: 3
},
name: "AStatisticCountdown",
props: initDefaultProps(countdownProps(), {
format: "HH:mm:ss"
}),
// emits: ['finish', 'change'],
setup(props2, _ref) {
let {
emit,
slots
} = _ref;
ref();
const statistic = ref();
const formatCountdown$1 = (_ref2) => {
let {
value,
config
} = _ref2;
const {
format: format2
} = props2;
return formatCountdown(value, _extends(_extends({}, config), {
format: format2
}));
};
const valueRenderHtml = (node) => node;
return () => {
const value = props2.value;
return createVNode(Statistic, _objectSpread$W({
"ref": statistic
}, _extends(_extends({}, omit(props2, ["onFinish", "onChange"])), {
value,
valueRender: valueRenderHtml,
formatter: formatCountdown$1
})), slots);
};
}
});
Statistic.Countdown = Countdown;
Statistic.install = function(app) {
app.component(Statistic.name, Statistic);
app.component(Statistic.Countdown.name, Statistic.Countdown);
return app;
};
const StatisticCountdown = Statistic.Countdown;
var __rest$q = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const inlineStyle = {
border: 0,
background: "transparent",
padding: 0,
lineHeight: "inherit",
display: "inline-block"
};
const TransButton = defineComponent({
compatConfig: {
MODE: 3
},
name: "TransButton",
inheritAttrs: false,
props: {
noStyle: {
type: Boolean,
default: void 0
},
onClick: Function,
disabled: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
}
},
setup(props2, _ref) {
let {
slots,
emit,
attrs,
expose
} = _ref;
const domRef = shallowRef();
const onKeyDown2 = (event) => {
const {
keyCode
} = event;
if (keyCode === KeyCode.ENTER) {
event.preventDefault();
}
};
const onKeyUp = (event) => {
const {
keyCode
} = event;
if (keyCode === KeyCode.ENTER) {
emit("click", event);
}
};
const onClick = (e) => {
emit("click", e);
};
const focus = () => {
if (domRef.value) {
domRef.value.focus();
}
};
const blur = () => {
if (domRef.value) {
domRef.value.blur();
}
};
expose({
focus,
blur
});
return () => {
var _a;
const {
noStyle,
disabled
} = props2, restProps = __rest$q(props2, ["noStyle", "disabled"]);
let mergedStyle = {};
if (!noStyle) {
mergedStyle = _extends({}, inlineStyle);
}
if (disabled) {
mergedStyle.pointerEvents = "none";
}
return createVNode("div", _objectSpread$W(_objectSpread$W(_objectSpread$W({
"role": "button",
"tabindex": 0,
"ref": domRef
}, restProps), attrs), {}, {
"onClick": onClick,
"onKeydown": onKeyDown2,
"onKeyup": onKeyUp,
"style": _extends(_extends({}, mergedStyle), attrs.style || {})
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
const spaceSize = {
small: 8,
middle: 16,
large: 24
};
const spaceProps = () => ({
prefixCls: String,
size: {
type: [String, Number, Array]
},
direction: PropTypes.oneOf(tuple$1("horizontal", "vertical")).def("horizontal"),
align: PropTypes.oneOf(tuple$1("start", "end", "center", "baseline")),
wrap: booleanType()
});
function getNumberSize(size) {
return typeof size === "string" ? spaceSize[size] : size || 0;
}
const Space = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASpace",
inheritAttrs: false,
props: spaceProps(),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
space,
direction: directionConfig
} = useConfigInject("space", props2);
const [wrapSSR, hashId] = useStyle$W(prefixCls);
const supportFlexGap = useFlexGapSupport();
const size = computed(() => {
var _a, _b, _c;
return (_c = (_a = props2.size) !== null && _a !== void 0 ? _a : (_b = space === null || space === void 0 ? void 0 : space.value) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : "small";
});
const horizontalSize = ref();
const verticalSize = ref();
watch(size, () => {
[horizontalSize.value, verticalSize.value] = (Array.isArray(size.value) ? size.value : [size.value, size.value]).map((item) => getNumberSize(item));
}, {
immediate: true
});
const mergedAlign = computed(() => props2.align === void 0 && props2.direction === "horizontal" ? "center" : props2.align);
const cn = computed(() => {
return classNames(prefixCls.value, hashId.value, `${prefixCls.value}-${props2.direction}`, {
[`${prefixCls.value}-rtl`]: directionConfig.value === "rtl",
[`${prefixCls.value}-align-${mergedAlign.value}`]: mergedAlign.value
});
});
const marginDirection = computed(() => directionConfig.value === "rtl" ? "marginLeft" : "marginRight");
const style = computed(() => {
const gapStyle = {};
if (supportFlexGap.value) {
gapStyle.columnGap = `${horizontalSize.value}px`;
gapStyle.rowGap = `${verticalSize.value}px`;
}
return _extends(_extends({}, gapStyle), props2.wrap && {
flexWrap: "wrap",
marginBottom: `${-verticalSize.value}px`
});
});
return () => {
var _a, _b;
const {
wrap,
direction = "horizontal"
} = props2;
const children = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
const items = filterEmpty(children);
const len = items.length;
if (len === 0) {
return null;
}
const split = (_b = slots.split) === null || _b === void 0 ? void 0 : _b.call(slots);
const itemClassName = `${prefixCls.value}-item`;
const horizontalSizeVal = horizontalSize.value;
const latestIndex = len - 1;
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [cn.value, attrs.class],
"style": [style.value, attrs.style]
}), [items.map((child, index2) => {
let originIndex = children.indexOf(child);
if (originIndex === -1) {
originIndex = `$$space-${index2}`;
}
let itemStyle = {};
if (!supportFlexGap.value) {
if (direction === "vertical") {
if (index2 < latestIndex) {
itemStyle = {
marginBottom: `${horizontalSizeVal / (split ? 2 : 1)}px`
};
}
} else {
itemStyle = _extends(_extends({}, index2 < latestIndex && {
[marginDirection.value]: `${horizontalSizeVal / (split ? 2 : 1)}px`
}), wrap && {
paddingBottom: `${verticalSize.value}px`
});
}
}
return wrapSSR(createVNode(Fragment, {
"key": originIndex
}, [createVNode("div", {
"class": itemClassName,
"style": itemStyle
}, [child]), index2 < latestIndex && split && createVNode("span", {
"class": `${itemClassName}-split`,
"style": itemStyle
}, [split])]));
})]);
};
}
});
Space.Compact = Compact;
Space.install = function(app) {
app.component(Space.name, Space);
app.component(Compact.name, Compact);
return app;
};
const genPageHeaderStyle = (token) => {
const {
componentCls,
antCls
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
padding: `${token.pageHeaderPaddingVertical}px ${token.pageHeaderPadding}px`,
backgroundColor: token.colorBgContainer,
[`&${componentCls}-ghost`]: {
backgroundColor: token.pageHeaderGhostBg
},
[`&.has-footer`]: {
paddingBottom: 0
},
[`${componentCls}-back`]: {
marginRight: token.marginMD,
fontSize: token.fontSizeLG,
lineHeight: 1,
[`&-button`]: _extends(_extends({}, operationUnit(token)), {
color: token.pageHeaderBackColor,
cursor: "pointer"
})
},
[`${antCls}-divider-vertical`]: {
height: "14px",
margin: `0 ${token.marginSM}`,
verticalAlign: "middle"
},
[`${antCls}-breadcrumb + &-heading`]: {
marginTop: token.marginXS
},
[`${componentCls}-heading`]: {
display: "flex",
justifyContent: "space-between",
[`&-left`]: {
display: "flex",
alignItems: "center",
margin: `${token.marginXS / 2}px 0`,
overflow: "hidden"
},
[`&-title`]: _extends({
marginRight: token.marginSM,
marginBottom: 0,
color: token.colorTextHeading,
fontWeight: 600,
fontSize: token.pageHeaderHeadingTitle,
lineHeight: `${token.controlHeight}px`
}, textEllipsis),
[`${antCls}-avatar`]: {
marginRight: token.marginSM
},
[`&-sub-title`]: _extends({
marginRight: token.marginSM,
color: token.colorTextDescription,
fontSize: token.pageHeaderHeadingSubTitle,
lineHeight: token.lineHeight
}, textEllipsis),
[`&-extra`]: {
margin: `${token.marginXS / 2}px 0`,
whiteSpace: "nowrap",
[`> *`]: {
marginLeft: token.marginSM,
whiteSpace: "unset"
},
[`> *:first-child`]: {
marginLeft: 0
}
}
},
[`${componentCls}-content`]: {
paddingTop: token.pageHeaderContentPaddingVertical
},
[`${componentCls}-footer`]: {
marginTop: token.marginMD,
[`${antCls}-tabs`]: {
[`> ${antCls}-tabs-nav`]: {
margin: 0,
[`&::before`]: {
border: "none"
}
},
[`${antCls}-tabs-tab`]: {
paddingTop: token.paddingXS,
paddingBottom: token.paddingXS,
fontSize: token.pageHeaderTabFontSize
}
}
},
[`${componentCls}-compact ${componentCls}-heading`]: {
flexWrap: "wrap"
},
// rtl style
[`&${token.componentCls}-rtl`]: {
direction: "rtl"
}
})
};
};
const useStyle$h = genComponentStyleHook("PageHeader", (token) => {
const PageHeaderToken = merge(token, {
pageHeaderPadding: token.paddingLG,
pageHeaderPaddingVertical: token.paddingMD,
pageHeaderPaddingBreadcrumb: token.paddingSM,
pageHeaderContentPaddingVertical: token.paddingSM,
pageHeaderBackColor: token.colorTextBase,
pageHeaderGhostBg: "transparent",
pageHeaderHeadingTitle: token.fontSizeHeading4,
pageHeaderHeadingSubTitle: token.fontSize,
pageHeaderTabFontSize: token.fontSizeLG
});
return [genPageHeaderStyle(PageHeaderToken)];
});
const pageHeaderProps = () => ({
backIcon: vNodeType(),
prefixCls: String,
title: vNodeType(),
subTitle: vNodeType(),
breadcrumb: PropTypes.object,
tags: vNodeType(),
footer: vNodeType(),
extra: vNodeType(),
avatar: objectType(),
ghost: {
type: Boolean,
default: void 0
},
onBack: Function
});
const PageHeader = defineComponent({
compatConfig: {
MODE: 3
},
name: "APageHeader",
inheritAttrs: false,
props: pageHeaderProps(),
// emits: ['back'],
slots: Object,
setup(props2, _ref) {
let {
emit,
slots,
attrs
} = _ref;
const {
prefixCls,
direction,
pageHeader
} = useConfigInject("page-header", props2);
const [wrapSSR, hashId] = useStyle$h(prefixCls);
const compact = shallowRef(false);
const isDestroyed = useDestroyed();
const onResize = (_ref2) => {
let {
width
} = _ref2;
if (!isDestroyed.value) {
compact.value = width < 768;
}
};
const ghost = computed(() => {
var _a, _b, _c;
return (_c = (_a = props2.ghost) !== null && _a !== void 0 ? _a : (_b = pageHeader === null || pageHeader === void 0 ? void 0 : pageHeader.value) === null || _b === void 0 ? void 0 : _b.ghost) !== null && _c !== void 0 ? _c : true;
});
const getBackIcon = () => {
var _a, _b, _c;
return (_c = (_a = props2.backIcon) !== null && _a !== void 0 ? _a : (_b = slots.backIcon) === null || _b === void 0 ? void 0 : _b.call(slots)) !== null && _c !== void 0 ? _c : direction.value === "rtl" ? createVNode(ArrowRightOutlined, null, null) : createVNode(ArrowLeftOutlined, null, null);
};
const renderBack = (backIcon) => {
if (!backIcon || !props2.onBack) {
return null;
}
return createVNode(LocaleReceiver, {
"componentName": "PageHeader",
"children": (_ref3) => {
let {
back
} = _ref3;
return createVNode("div", {
"class": `${prefixCls.value}-back`
}, [createVNode(TransButton, {
"onClick": (e) => {
emit("back", e);
},
"class": `${prefixCls.value}-back-button`,
"aria-label": back
}, {
default: () => [backIcon]
})]);
}
}, null);
};
const renderBreadcrumb = () => {
var _a;
return props2.breadcrumb ? createVNode(Breadcrumb, props2.breadcrumb, null) : (_a = slots.breadcrumb) === null || _a === void 0 ? void 0 : _a.call(slots);
};
const renderTitle = () => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
const {
avatar
} = props2;
const title = (_a = props2.title) !== null && _a !== void 0 ? _a : (_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots);
const subTitle = (_c = props2.subTitle) !== null && _c !== void 0 ? _c : (_d = slots.subTitle) === null || _d === void 0 ? void 0 : _d.call(slots);
const tags = (_e = props2.tags) !== null && _e !== void 0 ? _e : (_f = slots.tags) === null || _f === void 0 ? void 0 : _f.call(slots);
const extra = (_g = props2.extra) !== null && _g !== void 0 ? _g : (_h = slots.extra) === null || _h === void 0 ? void 0 : _h.call(slots);
const headingPrefixCls = `${prefixCls.value}-heading`;
const hasHeading = title || subTitle || tags || extra;
if (!hasHeading) {
return null;
}
const backIcon = getBackIcon();
const backIconDom = renderBack(backIcon);
const hasTitle = backIconDom || avatar || hasHeading;
return createVNode("div", {
"class": headingPrefixCls
}, [hasTitle && createVNode("div", {
"class": `${headingPrefixCls}-left`
}, [backIconDom, avatar ? createVNode(Avatar, avatar, null) : (_j = slots.avatar) === null || _j === void 0 ? void 0 : _j.call(slots), title && createVNode("span", {
"class": `${headingPrefixCls}-title`,
"title": typeof title === "string" ? title : void 0
}, [title]), subTitle && createVNode("span", {
"class": `${headingPrefixCls}-sub-title`,
"title": typeof subTitle === "string" ? subTitle : void 0
}, [subTitle]), tags && createVNode("span", {
"class": `${headingPrefixCls}-tags`
}, [tags])]), extra && createVNode("span", {
"class": `${headingPrefixCls}-extra`
}, [createVNode(Space, null, {
default: () => [extra]
})])]);
};
const renderFooter = () => {
var _a, _b;
const footer = (_a = props2.footer) !== null && _a !== void 0 ? _a : filterEmpty((_b = slots.footer) === null || _b === void 0 ? void 0 : _b.call(slots));
return isEmptyContent(footer) ? null : createVNode("div", {
"class": `${prefixCls.value}-footer`
}, [footer]);
};
const renderChildren2 = (children) => {
return createVNode("div", {
"class": `${prefixCls.value}-content`
}, [children]);
};
return () => {
var _a, _b;
const hasBreadcrumb = ((_a = props2.breadcrumb) === null || _a === void 0 ? void 0 : _a.routes) || slots.breadcrumb;
const hasFooter = props2.footer || slots.footer;
const children = flattenChildren((_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots));
const className = classNames(prefixCls.value, {
"has-breadcrumb": hasBreadcrumb,
"has-footer": hasFooter,
[`${prefixCls.value}-ghost`]: ghost.value,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-compact`]: compact.value
}, attrs.class, hashId.value);
return wrapSSR(createVNode(ResizeObserver$1, {
"onResize": onResize
}, {
default: () => [createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": className
}), [renderBreadcrumb(), renderTitle(), children.length ? renderChildren2(children) : null, renderFooter()])]
}));
};
}
});
const index$e = withInstall(PageHeader);
const genBaseStyle$8 = (token) => {
const {
componentCls,
iconCls,
zIndexPopup,
colorText,
colorWarning,
marginXS,
fontSize,
fontWeightStrong,
lineHeight
} = token;
return {
[componentCls]: {
zIndex: zIndexPopup,
[`${componentCls}-inner-content`]: {
color: colorText
},
[`${componentCls}-message`]: {
position: "relative",
marginBottom: marginXS,
color: colorText,
fontSize,
display: "flex",
flexWrap: "nowrap",
alignItems: "start",
[`> ${componentCls}-message-icon ${iconCls}`]: {
color: colorWarning,
fontSize,
flex: "none",
lineHeight: 1,
paddingTop: (Math.round(fontSize * lineHeight) - fontSize) / 2
},
"&-title": {
flex: "auto",
marginInlineStart: marginXS
},
"&-title-only": {
fontWeight: fontWeightStrong
}
},
[`${componentCls}-description`]: {
position: "relative",
marginInlineStart: fontSize + marginXS,
marginBottom: marginXS,
color: colorText,
fontSize
},
[`${componentCls}-buttons`]: {
textAlign: "end",
button: {
marginInlineStart: marginXS
}
}
}
};
};
const usePopconfirmStyle = genComponentStyleHook("Popconfirm", (token) => genBaseStyle$8(token), (token) => {
const {
zIndexPopupBase
} = token;
return {
zIndexPopup: zIndexPopupBase + 60
};
});
var __rest$p = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const popconfirmProps = () => _extends(_extends({}, abstractTooltipProps()), {
prefixCls: String,
content: anyType(),
title: anyType(),
description: anyType(),
okType: stringType("primary"),
disabled: {
type: Boolean,
default: false
},
okText: anyType(),
cancelText: anyType(),
icon: anyType(),
okButtonProps: objectType(),
cancelButtonProps: objectType(),
showCancel: {
type: Boolean,
default: true
},
onConfirm: Function,
onCancel: Function
});
const Popconfirm = defineComponent({
compatConfig: {
MODE: 3
},
name: "APopconfirm",
inheritAttrs: false,
props: initDefaultProps(popconfirmProps(), _extends(_extends({}, tooltipDefaultProps()), {
trigger: "click",
placement: "top",
mouseEnterDelay: 0.1,
mouseLeaveDelay: 0.1,
arrowPointAtCenter: false,
autoAdjustOverflow: true,
okType: "primary",
disabled: false
})),
slots: Object,
// emits: ['update:open', 'visibleChange'],
setup(props2, _ref) {
let {
slots,
emit,
expose,
attrs
} = _ref;
const rootRef = ref();
warning(props2.visible === void 0);
expose({
getPopupDomNode: () => {
var _a, _b;
return (_b = (_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.getPopupDomNode) === null || _b === void 0 ? void 0 : _b.call(_a);
}
});
const [open2, setOpen] = useMergedState(false, {
value: toRef(props2, "open")
});
const settingOpen = (value, e) => {
if (props2.open === void 0) {
setOpen(value);
}
emit("update:open", value);
emit("openChange", value, e);
};
const close = (e) => {
settingOpen(false, e);
};
const onConfirm = (e) => {
var _a;
return (_a = props2.onConfirm) === null || _a === void 0 ? void 0 : _a.call(props2, e);
};
const onCancel = (e) => {
var _a;
settingOpen(false, e);
(_a = props2.onCancel) === null || _a === void 0 ? void 0 : _a.call(props2, e);
};
const onKeyDown2 = (e) => {
if (e.keyCode === KeyCode.ESC && open2) {
settingOpen(false, e);
}
};
const onOpenChange = (value) => {
const {
disabled
} = props2;
if (disabled) {
return;
}
settingOpen(value);
};
const {
prefixCls: prefixClsConfirm,
getPrefixCls
} = useConfigInject("popconfirm", props2);
const rootPrefixCls = computed(() => getPrefixCls());
const btnPrefixCls = computed(() => getPrefixCls("btn"));
const [wrapSSR] = usePopconfirmStyle(prefixClsConfirm);
const [popconfirmLocale] = useLocaleReceiver("Popconfirm", localeValues.Popconfirm);
const renderOverlay = () => {
var _a, _b, _c, _d, _e;
const {
okButtonProps,
cancelButtonProps,
title = (_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots),
description = (_b = slots.description) === null || _b === void 0 ? void 0 : _b.call(slots),
cancelText = (_c = slots.cancel) === null || _c === void 0 ? void 0 : _c.call(slots),
okText = (_d = slots.okText) === null || _d === void 0 ? void 0 : _d.call(slots),
okType,
icon = ((_e = slots.icon) === null || _e === void 0 ? void 0 : _e.call(slots)) || createVNode(ExclamationCircleFilled, null, null),
showCancel = true
} = props2;
const {
cancelButton,
okButton
} = slots;
const cancelProps = _extends({
onClick: onCancel,
size: "small"
}, cancelButtonProps);
const okProps = _extends(_extends(_extends({
onClick: onConfirm
}, convertLegacyProps(okType)), {
size: "small"
}), okButtonProps);
return createVNode("div", {
"class": `${prefixClsConfirm.value}-inner-content`
}, [createVNode("div", {
"class": `${prefixClsConfirm.value}-message`
}, [icon && createVNode("span", {
"class": `${prefixClsConfirm.value}-message-icon`
}, [icon]), createVNode("div", {
"class": [`${prefixClsConfirm.value}-message-title`, {
[`${prefixClsConfirm.value}-message-title-only`]: !!description
}]
}, [title])]), description && createVNode("div", {
"class": `${prefixClsConfirm.value}-description`
}, [description]), createVNode("div", {
"class": `${prefixClsConfirm.value}-buttons`
}, [showCancel ? cancelButton ? cancelButton(cancelProps) : createVNode(Button, cancelProps, {
default: () => [cancelText || popconfirmLocale.value.cancelText]
}) : null, okButton ? okButton(okProps) : createVNode(ActionButton, {
"buttonProps": _extends(_extends({
size: "small"
}, convertLegacyProps(okType)), okButtonProps),
"actionFn": onConfirm,
"close": close,
"prefixCls": btnPrefixCls.value,
"quitOnNullishReturnValue": true,
"emitEvent": true
}, {
default: () => [okText || popconfirmLocale.value.okText]
})])]);
};
return () => {
var _a;
const {
placement,
overlayClassName,
trigger = "click"
} = props2, restProps = __rest$p(props2, ["placement", "overlayClassName", "trigger"]);
const otherProps = omit(restProps, ["title", "content", "cancelText", "okText", "onUpdate:open", "onConfirm", "onCancel", "prefixCls"]);
const overlayClassNames = classNames(prefixClsConfirm.value, overlayClassName);
return wrapSSR(createVNode(__nuxt_component_1$6, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, otherProps), attrs), {}, {
"trigger": trigger,
"placement": placement,
"onOpenChange": onOpenChange,
"open": open2.value,
"overlayClassName": overlayClassNames,
"transitionName": getTransitionName$1(rootPrefixCls.value, "zoom-big", props2.transitionName),
"ref": rootRef,
"data-popover-inject": true
}), {
default: () => [cloneVNodes(((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) || [], {
onKeydown: (e) => {
onKeyDown2(e);
}
}, false)],
content: renderOverlay
}));
};
}
});
const index$d = withInstall(Popconfirm);
const progressStatuses = ["normal", "exception", "active", "success"];
const progressProps = () => ({
prefixCls: String,
type: stringType(),
percent: Number,
format: functionType(),
status: stringType(),
showInfo: booleanType(),
strokeWidth: Number,
strokeLinecap: stringType(),
strokeColor: anyType(),
trailColor: String,
/** @deprecated Use `size` instead */
width: Number,
success: objectType(),
gapDegree: Number,
gapPosition: stringType(),
size: someType([String, Number, Array]),
steps: Number,
/** @deprecated Use `success` instead */
successPercent: Number,
title: String,
progressStatus: stringType()
});
function validProgress(progress) {
if (!progress || progress < 0) {
return 0;
}
if (progress > 100) {
return 100;
}
return progress;
}
function getSuccessPercent(_ref) {
let {
success,
successPercent
} = _ref;
let percent = successPercent;
if (success && "progress" in success) {
devWarning(false, "Progress", "`success.progress` is deprecated. Please use `success.percent` instead.");
percent = success.progress;
}
if (success && "percent" in success) {
percent = success.percent;
}
return percent;
}
function getPercentage(_ref2) {
let {
percent,
success,
successPercent
} = _ref2;
const realSuccessPercent = validProgress(getSuccessPercent({
success,
successPercent
}));
return [realSuccessPercent, validProgress(validProgress(percent) - realSuccessPercent)];
}
function getStrokeColor(_ref3) {
let {
success = {},
strokeColor
} = _ref3;
const {
strokeColor: successColor
} = success;
return [successColor || presetPrimaryColors.green, strokeColor || null];
}
const getSize = (size, type, extra) => {
var _a, _b, _c, _d;
let width = -1;
let height = -1;
if (type === "step") {
const steps = extra.steps;
const strokeWidth = extra.strokeWidth;
if (typeof size === "string" || typeof size === "undefined") {
width = size === "small" ? 2 : 14;
height = strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : 8;
} else if (typeof size === "number") {
[width, height] = [size, size];
} else {
[width = 14, height = 8] = size;
}
width *= steps;
} else if (type === "line") {
const strokeWidth = extra === null || extra === void 0 ? void 0 : extra.strokeWidth;
if (typeof size === "string" || typeof size === "undefined") {
height = strokeWidth || (size === "small" ? 6 : 8);
} else if (typeof size === "number") {
[width, height] = [size, size];
} else {
[width = -1, height = 8] = size;
}
} else if (type === "circle" || type === "dashboard") {
if (typeof size === "string" || typeof size === "undefined") {
[width, height] = size === "small" ? [60, 60] : [120, 120];
} else if (typeof size === "number") {
[width, height] = [size, size];
} else {
width = (_b = (_a = size[0]) !== null && _a !== void 0 ? _a : size[1]) !== null && _b !== void 0 ? _b : 120;
height = (_d = (_c = size[0]) !== null && _c !== void 0 ? _c : size[1]) !== null && _d !== void 0 ? _d : 120;
}
}
return {
width,
height
};
};
var __rest$o = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const lineProps = () => _extends(_extends({}, progressProps()), {
strokeColor: anyType(),
direction: stringType()
});
const sortGradient = (gradients) => {
let tempArr = [];
Object.keys(gradients).forEach((key2) => {
const formattedKey = parseFloat(key2.replace(/%/g, ""));
if (!isNaN(formattedKey)) {
tempArr.push({
key: formattedKey,
value: gradients[key2]
});
}
});
tempArr = tempArr.sort((a, b) => a.key - b.key);
return tempArr.map((_ref) => {
let {
key: key2,
value
} = _ref;
return `${value} ${key2}%`;
}).join(", ");
};
const handleGradient = (strokeColor, directionConfig) => {
const {
from = presetPrimaryColors.blue,
to = presetPrimaryColors.blue,
direction = directionConfig === "rtl" ? "to left" : "to right"
} = strokeColor, rest = __rest$o(strokeColor, ["from", "to", "direction"]);
if (Object.keys(rest).length !== 0) {
const sortedGradients = sortGradient(rest);
return {
backgroundImage: `linear-gradient(${direction}, ${sortedGradients})`
};
}
return {
backgroundImage: `linear-gradient(${direction}, ${from}, ${to})`
};
};
const Line = defineComponent({
compatConfig: {
MODE: 3
},
name: "ProgressLine",
inheritAttrs: false,
props: lineProps(),
setup(props2, _ref2) {
let {
slots,
attrs
} = _ref2;
const backgroundProps = computed(() => {
const {
strokeColor,
direction
} = props2;
return strokeColor && typeof strokeColor !== "string" ? handleGradient(strokeColor, direction) : {
backgroundColor: strokeColor
};
});
const borderRadius = computed(() => props2.strokeLinecap === "square" || props2.strokeLinecap === "butt" ? 0 : void 0);
const trailStyle = computed(() => props2.trailColor ? {
backgroundColor: props2.trailColor
} : void 0);
const mergedSize = computed(() => {
var _a;
return (_a = props2.size) !== null && _a !== void 0 ? _a : [-1, props2.strokeWidth || (props2.size === "small" ? 6 : 8)];
});
const sizeRef = computed(() => getSize(mergedSize.value, "line", {
strokeWidth: props2.strokeWidth
}));
const percentStyle = computed(() => {
const {
percent
} = props2;
return _extends({
width: `${validProgress(percent)}%`,
height: `${sizeRef.value.height}px`,
borderRadius: borderRadius.value
}, backgroundProps.value);
});
const successPercent = computed(() => {
return getSuccessPercent(props2);
});
const successPercentStyle = computed(() => {
const {
success
} = props2;
return {
width: `${validProgress(successPercent.value)}%`,
height: `${sizeRef.value.height}px`,
borderRadius: borderRadius.value,
backgroundColor: success === null || success === void 0 ? void 0 : success.strokeColor
};
});
const outerStyle = {
width: sizeRef.value.width < 0 ? "100%" : sizeRef.value.width,
height: `${sizeRef.value.height}px`
};
return () => {
var _a;
return createVNode(Fragment, null, [createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [`${props2.prefixCls}-outer`, attrs.class],
"style": [attrs.style, outerStyle]
}), [createVNode("div", {
"class": `${props2.prefixCls}-inner`,
"style": trailStyle.value
}, [createVNode("div", {
"class": `${props2.prefixCls}-bg`,
"style": percentStyle.value
}, null), successPercent.value !== void 0 ? createVNode("div", {
"class": `${props2.prefixCls}-success-bg`,
"style": successPercentStyle.value
}, null) : null])]), (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
const defaultProps = {
percent: 0,
prefixCls: "vc-progress",
strokeColor: "#2db7f5",
strokeLinecap: "round",
strokeWidth: 1,
trailColor: "#D9D9D9",
trailWidth: 1
};
const useTransitionDuration = (paths) => {
ref(null);
return paths;
};
const propTypes = {
gapDegree: Number,
gapPosition: {
type: String
},
percent: {
type: [Array, Number]
},
prefixCls: String,
strokeColor: {
type: [Object, String, Array]
},
strokeLinecap: {
type: String
},
strokeWidth: Number,
trailColor: String,
trailWidth: Number,
transition: String
};
var __rest$n = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
let gradientSeed = 0;
function stripPercentToNumber(percent) {
return +percent.replace("%", "");
}
function toArray$2(value) {
return Array.isArray(value) ? value : [value];
}
function getPathStyles(offset2, percent, strokeColor, strokeWidth) {
let gapDegree = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
let gapPosition = arguments.length > 5 ? arguments[5] : void 0;
const radius = 50 - strokeWidth / 2;
let beginPositionX = 0;
let beginPositionY = -radius;
let endPositionX = 0;
let endPositionY = -2 * radius;
switch (gapPosition) {
case "left":
beginPositionX = -radius;
beginPositionY = 0;
endPositionX = 2 * radius;
endPositionY = 0;
break;
case "right":
beginPositionX = radius;
beginPositionY = 0;
endPositionX = -2 * radius;
endPositionY = 0;
break;
case "bottom":
beginPositionY = radius;
endPositionY = 2 * radius;
break;
}
const pathString = `M 50,50 m ${beginPositionX},${beginPositionY}
a ${radius},${radius} 0 1 1 ${endPositionX},${-endPositionY}
a ${radius},${radius} 0 1 1 ${-endPositionX},${endPositionY}`;
const len = Math.PI * 2 * radius;
const pathStyle = {
stroke: strokeColor,
strokeDasharray: `${percent / 100 * (len - gapDegree)}px ${len}px`,
strokeDashoffset: `-${gapDegree / 2 + offset2 / 100 * (len - gapDegree)}px`,
transition: "stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s"
// eslint-disable-line
};
return {
pathString,
pathStyle
};
}
const VCCircle = defineComponent({
compatConfig: {
MODE: 3
},
name: "VCCircle",
props: initDefaultProps(propTypes, defaultProps),
setup(props2) {
gradientSeed += 1;
const gradientId = ref(gradientSeed);
const percentList = computed(() => toArray$2(props2.percent));
const strokeColorList = computed(() => toArray$2(props2.strokeColor));
const [setRef, paths] = useRefs();
useTransitionDuration(paths);
const getStokeList = () => {
const {
prefixCls,
strokeWidth,
strokeLinecap,
gapDegree,
gapPosition
} = props2;
let stackPtg = 0;
return percentList.value.map((ptg, index2) => {
const color = strokeColorList.value[index2] || strokeColorList.value[strokeColorList.value.length - 1];
const stroke = Object.prototype.toString.call(color) === "[object Object]" ? `url(#${prefixCls}-gradient-${gradientId.value})` : "";
const {
pathString,
pathStyle
} = getPathStyles(stackPtg, ptg, color, strokeWidth, gapDegree, gapPosition);
stackPtg += ptg;
const pathProps = {
key: index2,
d: pathString,
stroke,
"stroke-linecap": strokeLinecap,
"stroke-width": strokeWidth,
opacity: ptg === 0 ? 0 : 1,
"fill-opacity": "0",
class: `${prefixCls}-circle-path`,
style: pathStyle
};
return createVNode("path", _objectSpread$W({
"ref": setRef(index2)
}, pathProps), null);
});
};
return () => {
const {
prefixCls,
strokeWidth,
trailWidth,
gapDegree,
gapPosition,
trailColor,
strokeLinecap,
strokeColor
} = props2, restProps = __rest$n(props2, ["prefixCls", "strokeWidth", "trailWidth", "gapDegree", "gapPosition", "trailColor", "strokeLinecap", "strokeColor"]);
const {
pathString,
pathStyle
} = getPathStyles(0, 100, trailColor, strokeWidth, gapDegree, gapPosition);
delete restProps.percent;
const gradient = strokeColorList.value.find((color) => Object.prototype.toString.call(color) === "[object Object]");
const pathFirst = {
d: pathString,
stroke: trailColor,
"stroke-linecap": strokeLinecap,
"stroke-width": trailWidth || strokeWidth,
"fill-opacity": "0",
class: `${prefixCls}-circle-trail`,
style: pathStyle
};
return createVNode("svg", _objectSpread$W({
"class": `${prefixCls}-circle`,
"viewBox": "0 0 100 100"
}, restProps), [gradient && createVNode("defs", null, [createVNode("linearGradient", {
"id": `${prefixCls}-gradient-${gradientId.value}`,
"x1": "100%",
"y1": "0%",
"x2": "0%",
"y2": "0%"
}, [Object.keys(gradient).sort((a, b) => stripPercentToNumber(a) - stripPercentToNumber(b)).map((key2, index2) => createVNode("stop", {
"key": index2,
"offset": key2,
"stop-color": gradient[key2]
}, null))])]), createVNode("path", pathFirst, null), getStokeList().reverse()]);
};
}
});
const circleProps = () => _extends(_extends({}, progressProps()), {
strokeColor: anyType()
});
const CIRCLE_MIN_STROKE_WIDTH = 3;
const getMinPercent = (width) => CIRCLE_MIN_STROKE_WIDTH / width * 100;
const Circle = defineComponent({
compatConfig: {
MODE: 3
},
name: "ProgressCircle",
inheritAttrs: false,
props: initDefaultProps(circleProps(), {
trailColor: null
}),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const originWidth = computed(() => {
var _a;
return (_a = props2.width) !== null && _a !== void 0 ? _a : 120;
});
const mergedSize = computed(() => {
var _a;
return (_a = props2.size) !== null && _a !== void 0 ? _a : [originWidth.value, originWidth.value];
});
const sizeRef = computed(() => getSize(mergedSize.value, "circle"));
const gapDeg = computed(() => {
if (props2.gapDegree || props2.gapDegree === 0) {
return props2.gapDegree;
}
if (props2.type === "dashboard") {
return 75;
}
return void 0;
});
const circleStyle = computed(() => {
return {
width: `${sizeRef.value.width}px`,
height: `${sizeRef.value.height}px`,
fontSize: `${sizeRef.value.width * 0.15 + 6}px`
};
});
const circleWidth = computed(() => {
var _a;
return (_a = props2.strokeWidth) !== null && _a !== void 0 ? _a : Math.max(getMinPercent(sizeRef.value.width), 6);
});
const gapPos = computed(() => props2.gapPosition || props2.type === "dashboard" && "bottom" || void 0);
const percent = computed(() => getPercentage(props2));
const isGradient = computed(() => Object.prototype.toString.call(props2.strokeColor) === "[object Object]");
const strokeColor = computed(() => getStrokeColor({
success: props2.success,
strokeColor: props2.strokeColor
}));
const wrapperClassName = computed(() => ({
[`${props2.prefixCls}-inner`]: true,
[`${props2.prefixCls}-circle-gradient`]: isGradient.value
}));
return () => {
var _a;
const circleContent = createVNode(VCCircle, {
"percent": percent.value,
"strokeWidth": circleWidth.value,
"trailWidth": circleWidth.value,
"strokeColor": strokeColor.value,
"strokeLinecap": props2.strokeLinecap,
"trailColor": props2.trailColor,
"prefixCls": props2.prefixCls,
"gapDegree": gapDeg.value,
"gapPosition": gapPos.value
}, null);
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [wrapperClassName.value, attrs.class],
"style": [attrs.style, circleStyle.value]
}), [sizeRef.value.width <= 20 ? createVNode(__nuxt_component_2$4, null, {
default: () => [createVNode("span", null, [circleContent])],
title: slots.default
}) : createVNode(Fragment, null, [circleContent, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)])]);
};
}
});
const stepsProps$1 = () => _extends(_extends({}, progressProps()), {
steps: Number,
strokeColor: someType(),
trailColor: String
});
const Steps$3 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Steps",
props: stepsProps$1(),
setup(props2, _ref) {
let {
slots
} = _ref;
const current = computed(() => Math.round(props2.steps * ((props2.percent || 0) / 100)));
const mergedSize = computed(() => {
var _a;
return (_a = props2.size) !== null && _a !== void 0 ? _a : [props2.size === "small" ? 2 : 14, props2.strokeWidth || 8];
});
const sizeRef = computed(() => getSize(mergedSize.value, "step", {
steps: props2.steps,
strokeWidth: props2.strokeWidth || 8
}));
const styledSteps = computed(() => {
const {
steps,
strokeColor,
trailColor,
prefixCls
} = props2;
const temp = [];
for (let i = 0; i < steps; i += 1) {
const color = Array.isArray(strokeColor) ? strokeColor[i] : strokeColor;
const cls = {
[`${prefixCls}-steps-item`]: true,
[`${prefixCls}-steps-item-active`]: i <= current.value - 1
};
temp.push(createVNode("div", {
"key": i,
"class": cls,
"style": {
backgroundColor: i <= current.value - 1 ? color : trailColor,
width: `${sizeRef.value.width / steps}px`,
height: `${sizeRef.value.height}px`
}
}, null));
}
return temp;
});
return () => {
var _a;
return createVNode("div", {
"class": `${props2.prefixCls}-steps-outer`
}, [styledSteps.value, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
const antProgressActive = new Keyframe("antProgressActive", {
"0%": {
transform: "translateX(-100%) scaleX(0)",
opacity: 0.1
},
"20%": {
transform: "translateX(-100%) scaleX(0)",
opacity: 0.5
},
to: {
transform: "translateX(0) scaleX(1)",
opacity: 0
}
});
const genBaseStyle$7 = (token) => {
const {
componentCls: progressCls,
iconCls: iconPrefixCls
} = token;
return {
[progressCls]: _extends(_extends({}, resetComponent(token)), {
display: "inline-block",
"&-rtl": {
direction: "rtl"
},
"&-line": {
position: "relative",
width: "100%",
fontSize: token.fontSize,
marginInlineEnd: token.marginXS,
marginBottom: token.marginXS
},
[`${progressCls}-outer`]: {
display: "inline-block",
width: "100%"
},
[`&${progressCls}-show-info`]: {
[`${progressCls}-outer`]: {
marginInlineEnd: `calc(-2em - ${token.marginXS}px)`,
paddingInlineEnd: `calc(2em + ${token.paddingXS}px)`
}
},
[`${progressCls}-inner`]: {
position: "relative",
display: "inline-block",
width: "100%",
overflow: "hidden",
verticalAlign: "middle",
backgroundColor: token.progressRemainingColor,
borderRadius: token.progressLineRadius
},
[`${progressCls}-inner:not(${progressCls}-circle-gradient)`]: {
[`${progressCls}-circle-path`]: {
stroke: token.colorInfo
}
},
[`${progressCls}-success-bg, ${progressCls}-bg`]: {
position: "relative",
backgroundColor: token.colorInfo,
borderRadius: token.progressLineRadius,
transition: `all ${token.motionDurationSlow} ${token.motionEaseInOutCirc}`
},
[`${progressCls}-success-bg`]: {
position: "absolute",
insetBlockStart: 0,
insetInlineStart: 0,
backgroundColor: token.colorSuccess
},
[`${progressCls}-text`]: {
display: "inline-block",
width: "2em",
marginInlineStart: token.marginXS,
color: token.progressInfoTextColor,
lineHeight: 1,
whiteSpace: "nowrap",
textAlign: "start",
verticalAlign: "middle",
wordBreak: "normal",
[iconPrefixCls]: {
fontSize: token.fontSize
}
},
[`&${progressCls}-status-active`]: {
[`${progressCls}-bg::before`]: {
position: "absolute",
inset: 0,
backgroundColor: token.colorBgContainer,
borderRadius: token.progressLineRadius,
opacity: 0,
animationName: antProgressActive,
animationDuration: token.progressActiveMotionDuration,
animationTimingFunction: token.motionEaseOutQuint,
animationIterationCount: "infinite",
content: '""'
}
},
[`&${progressCls}-status-exception`]: {
[`${progressCls}-bg`]: {
backgroundColor: token.colorError
},
[`${progressCls}-text`]: {
color: token.colorError
}
},
[`&${progressCls}-status-exception ${progressCls}-inner:not(${progressCls}-circle-gradient)`]: {
[`${progressCls}-circle-path`]: {
stroke: token.colorError
}
},
[`&${progressCls}-status-success`]: {
[`${progressCls}-bg`]: {
backgroundColor: token.colorSuccess
},
[`${progressCls}-text`]: {
color: token.colorSuccess
}
},
[`&${progressCls}-status-success ${progressCls}-inner:not(${progressCls}-circle-gradient)`]: {
[`${progressCls}-circle-path`]: {
stroke: token.colorSuccess
}
}
})
};
};
const genCircleStyle = (token) => {
const {
componentCls: progressCls,
iconCls: iconPrefixCls
} = token;
return {
[progressCls]: {
[`${progressCls}-circle-trail`]: {
stroke: token.progressRemainingColor
},
[`&${progressCls}-circle ${progressCls}-inner`]: {
position: "relative",
lineHeight: 1,
backgroundColor: "transparent"
},
[`&${progressCls}-circle ${progressCls}-text`]: {
position: "absolute",
insetBlockStart: "50%",
insetInlineStart: 0,
width: "100%",
margin: 0,
padding: 0,
color: token.colorText,
lineHeight: 1,
whiteSpace: "normal",
textAlign: "center",
transform: "translateY(-50%)",
[iconPrefixCls]: {
fontSize: `${token.fontSize / token.fontSizeSM}em`
}
},
[`${progressCls}-circle&-status-exception`]: {
[`${progressCls}-text`]: {
color: token.colorError
}
},
[`${progressCls}-circle&-status-success`]: {
[`${progressCls}-text`]: {
color: token.colorSuccess
}
}
},
[`${progressCls}-inline-circle`]: {
lineHeight: 1,
[`${progressCls}-inner`]: {
verticalAlign: "bottom"
}
}
};
};
const genStepStyle = (token) => {
const {
componentCls: progressCls
} = token;
return {
[progressCls]: {
[`${progressCls}-steps`]: {
display: "inline-block",
"&-outer": {
display: "flex",
flexDirection: "row",
alignItems: "center"
},
"&-item": {
flexShrink: 0,
minWidth: token.progressStepMinWidth,
marginInlineEnd: token.progressStepMarginInlineEnd,
backgroundColor: token.progressRemainingColor,
transition: `all ${token.motionDurationSlow}`,
"&-active": {
backgroundColor: token.colorInfo
}
}
}
}
};
};
const genSmallLine = (token) => {
const {
componentCls: progressCls,
iconCls: iconPrefixCls
} = token;
return {
[progressCls]: {
[`${progressCls}-small&-line, ${progressCls}-small&-line ${progressCls}-text ${iconPrefixCls}`]: {
fontSize: token.fontSizeSM
}
}
};
};
const useStyle$g = genComponentStyleHook("Progress", (token) => {
const progressStepMarginInlineEnd = token.marginXXS / 2;
const progressToken = merge(token, {
progressLineRadius: 100,
progressInfoTextColor: token.colorText,
progressDefaultColor: token.colorInfo,
progressRemainingColor: token.colorFillSecondary,
progressStepMarginInlineEnd,
progressStepMinWidth: progressStepMarginInlineEnd,
progressActiveMotionDuration: "2.4s"
});
return [genBaseStyle$7(progressToken), genCircleStyle(progressToken), genStepStyle(progressToken), genSmallLine(progressToken)];
});
var __rest$m = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Progress = defineComponent({
compatConfig: {
MODE: 3
},
name: "AProgress",
inheritAttrs: false,
props: initDefaultProps(progressProps(), {
type: "line",
percent: 0,
showInfo: true,
// null for different theme definition
trailColor: null,
size: "default",
strokeLinecap: "round"
}),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("progress", props2);
const [wrapSSR, hashId] = useStyle$g(prefixCls);
const strokeColorNotArray = computed(() => Array.isArray(props2.strokeColor) ? props2.strokeColor[0] : props2.strokeColor);
const percentNumber = computed(() => {
const {
percent = 0
} = props2;
const successPercent = getSuccessPercent(props2);
return parseInt(successPercent !== void 0 ? successPercent.toString() : percent.toString(), 10);
});
const progressStatus = computed(() => {
const {
status
} = props2;
if (!progressStatuses.includes(status) && percentNumber.value >= 100) {
return "success";
}
return status || "normal";
});
const classString = computed(() => {
const {
type,
showInfo,
size
} = props2;
const pre = prefixCls.value;
return {
[pre]: true,
[`${pre}-inline-circle`]: type === "circle" && getSize(size, "circle").width <= 20,
[`${pre}-${type === "dashboard" && "circle" || type}`]: true,
[`${pre}-status-${progressStatus.value}`]: true,
[`${pre}-show-info`]: showInfo,
[`${pre}-${size}`]: size,
[`${pre}-rtl`]: direction.value === "rtl",
[hashId.value]: true
};
});
const strokeColorNotGradient = computed(() => typeof props2.strokeColor === "string" || Array.isArray(props2.strokeColor) ? props2.strokeColor : void 0);
const renderProcessInfo = () => {
const {
showInfo,
format: format2,
type,
percent,
title
} = props2;
const successPercent = getSuccessPercent(props2);
if (!showInfo) return null;
let text;
const textFormatter = format2 || (slots === null || slots === void 0 ? void 0 : slots.format) || ((val) => `${val}%`);
const isLineType = type === "line";
if (format2 || (slots === null || slots === void 0 ? void 0 : slots.format) || progressStatus.value !== "exception" && progressStatus.value !== "success") {
text = textFormatter(validProgress(percent), validProgress(successPercent));
} else if (progressStatus.value === "exception") {
text = isLineType ? createVNode(CloseCircleFilled, null, null) : createVNode(CloseOutlined, null, null);
} else if (progressStatus.value === "success") {
text = isLineType ? createVNode(CheckCircleFilled, null, null) : createVNode(CheckOutlined, null, null);
}
return createVNode("span", {
"class": `${prefixCls.value}-text`,
"title": title === void 0 && typeof text === "string" ? text : void 0
}, [text]);
};
return () => {
const {
type,
steps,
title
} = props2;
const {
class: cls
} = attrs, restAttrs = __rest$m(attrs, ["class"]);
const progressInfo = renderProcessInfo();
let progress;
if (type === "line") {
progress = steps ? createVNode(Steps$3, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"strokeColor": strokeColorNotGradient.value,
"prefixCls": prefixCls.value,
"steps": steps
}), {
default: () => [progressInfo]
}) : createVNode(Line, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"strokeColor": strokeColorNotArray.value,
"prefixCls": prefixCls.value,
"direction": direction.value
}), {
default: () => [progressInfo]
});
} else if (type === "circle" || type === "dashboard") {
progress = createVNode(Circle, _objectSpread$W(_objectSpread$W({}, props2), {}, {
"prefixCls": prefixCls.value,
"strokeColor": strokeColorNotArray.value,
"progressStatus": progressStatus.value
}), {
default: () => [progressInfo]
});
}
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({
"role": "progressbar"
}, restAttrs), {}, {
"class": [classString.value, cls],
"title": title
}), [progress]));
};
}
});
const __nuxt_component_1$2 = withInstall(Progress);
function getScroll(w) {
let ret = w.scrollX;
const method = "scrollLeft";
if (typeof ret !== "number") {
const d = w.document;
ret = d.documentElement[method];
if (typeof ret !== "number") {
ret = d.body[method];
}
}
return ret;
}
function getClientPosition(elem) {
let x;
let y;
const doc = elem.ownerDocument;
const {
body
} = doc;
const docElem = doc && doc.documentElement;
const box2 = elem.getBoundingClientRect();
x = box2.left;
y = box2.top;
x -= docElem.clientLeft || body.clientLeft || 0;
y -= docElem.clientTop || body.clientTop || 0;
return {
left: x,
top: y
};
}
function getOffsetLeft(el) {
const pos = getClientPosition(el);
const doc = el.ownerDocument;
const w = doc.defaultView || doc.parentWindow;
pos.left += getScroll(w);
return pos.left;
}
const starProps = {
value: Number,
index: Number,
prefixCls: String,
allowHalf: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
character: PropTypes.any,
characterRender: Function,
focused: {
type: Boolean,
default: void 0
},
count: Number,
onClick: Function,
onHover: Function
};
const Star = defineComponent({
compatConfig: {
MODE: 3
},
name: "Star",
inheritAttrs: false,
props: starProps,
emits: ["hover", "click"],
setup(props2, _ref) {
let {
emit
} = _ref;
const onHover = (e) => {
const {
index: index2
} = props2;
emit("hover", e, index2);
};
const onClick = (e) => {
const {
index: index2
} = props2;
emit("click", e, index2);
};
const onKeyDown2 = (e) => {
const {
index: index2
} = props2;
if (e.keyCode === 13) {
emit("click", e, index2);
}
};
const cls = computed(() => {
const {
prefixCls,
index: index2,
value,
allowHalf,
focused
} = props2;
const starValue = index2 + 1;
let className = prefixCls;
if (value === 0 && index2 === 0 && focused) {
className += ` ${prefixCls}-focused`;
} else if (allowHalf && value + 0.5 >= starValue && value < starValue) {
className += ` ${prefixCls}-half ${prefixCls}-active`;
if (focused) {
className += ` ${prefixCls}-focused`;
}
} else {
className += starValue <= value ? ` ${prefixCls}-full` : ` ${prefixCls}-zero`;
if (starValue === value && focused) {
className += ` ${prefixCls}-focused`;
}
}
return className;
});
return () => {
const {
disabled,
prefixCls,
characterRender,
character,
index: index2,
count,
value
} = props2;
const characterNode = typeof character === "function" ? character({
disabled,
prefixCls,
index: index2,
count,
value
}) : character;
let star = createVNode("li", {
"class": cls.value
}, [createVNode("div", {
"onClick": disabled ? null : onClick,
"onKeydown": disabled ? null : onKeyDown2,
"onMousemove": disabled ? null : onHover,
"role": "radio",
"aria-checked": value > index2 ? "true" : "false",
"aria-posinset": index2 + 1,
"aria-setsize": count,
"tabindex": disabled ? -1 : 0
}, [createVNode("div", {
"class": `${prefixCls}-first`
}, [characterNode]), createVNode("div", {
"class": `${prefixCls}-second`
}, [characterNode])])]);
if (characterRender) {
star = characterRender(star, props2);
}
return star;
};
}
});
const genRateStarStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-star`]: {
position: "relative",
display: "inline-block",
color: "inherit",
cursor: "pointer",
"&:not(:last-child)": {
marginInlineEnd: token.marginXS
},
"> div": {
transition: `all ${token.motionDurationMid}, outline 0s`,
"&:hover": {
transform: token.rateStarHoverScale
},
"&:focus": {
outline: 0
},
"&:focus-visible": {
outline: `${token.lineWidth}px dashed ${token.rateStarColor}`,
transform: token.rateStarHoverScale
}
},
"&-first, &-second": {
color: token.defaultColor,
transition: `all ${token.motionDurationMid}`,
userSelect: "none",
[token.iconCls]: {
verticalAlign: "middle"
}
},
"&-first": {
position: "absolute",
top: 0,
insetInlineStart: 0,
width: "50%",
height: "100%",
overflow: "hidden",
opacity: 0
},
[`&-half ${componentCls}-star-first, &-half ${componentCls}-star-second`]: {
opacity: 1
},
[`&-half ${componentCls}-star-first, &-full ${componentCls}-star-second`]: {
color: "inherit"
}
}
};
};
const genRateRtlStyle = (token) => ({
[`&-rtl${token.componentCls}`]: {
direction: "rtl"
}
});
const genRateStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: _extends(_extends(_extends(_extends(_extends({}, resetComponent(token)), {
display: "inline-block",
margin: 0,
padding: 0,
color: token.rateStarColor,
fontSize: token.rateStarSize,
lineHeight: "unset",
listStyle: "none",
outline: "none",
// disable styles
[`&-disabled${componentCls} ${componentCls}-star`]: {
cursor: "default",
"&:hover": {
transform: "scale(1)"
}
}
}), genRateStarStyle(token)), {
// text styles
[`+ ${componentCls}-text`]: {
display: "inline-block",
marginInlineStart: token.marginXS,
fontSize: token.fontSize
}
}), genRateRtlStyle(token))
};
};
const useStyle$f = genComponentStyleHook("Rate", (token) => {
const {
colorFillContent
} = token;
const rateToken = merge(token, {
rateStarColor: token["yellow-6"],
rateStarSize: token.controlHeightLG * 0.5,
rateStarHoverScale: "scale(1.1)",
defaultColor: colorFillContent
});
return [genRateStyle(rateToken)];
});
const rateProps = () => ({
prefixCls: String,
count: Number,
value: Number,
allowHalf: {
type: Boolean,
default: void 0
},
allowClear: {
type: Boolean,
default: void 0
},
tooltips: Array,
disabled: {
type: Boolean,
default: void 0
},
character: PropTypes.any,
autofocus: {
type: Boolean,
default: void 0
},
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
direction: String,
id: String,
onChange: Function,
onHoverChange: Function,
"onUpdate:value": Function,
onFocus: Function,
onBlur: Function,
onKeydown: Function
});
const Rate = defineComponent({
compatConfig: {
MODE: 3
},
name: "ARate",
inheritAttrs: false,
props: initDefaultProps(rateProps(), {
value: 0,
count: 5,
allowHalf: false,
allowClear: true,
tabindex: 0,
direction: "ltr"
}),
// emits: ['hoverChange', 'update:value', 'change', 'focus', 'blur', 'keydown'],
setup(props2, _ref) {
let {
slots,
attrs,
emit,
expose
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("rate", props2);
const [wrapSSR, hashId] = useStyle$f(prefixCls);
const formItemContext = useInjectFormItemContext();
const rateRef = ref();
const [setRef, starRefs] = useRefs();
const state = reactive({
value: props2.value,
focused: false,
cleanedValue: null,
hoverValue: void 0
});
watch(() => props2.value, () => {
state.value = props2.value;
});
const getStarDOM = (index2) => {
return findDOMNode(starRefs.value.get(index2));
};
const getStarValue = (index2, x) => {
const reverse = direction.value === "rtl";
let value = index2 + 1;
if (props2.allowHalf) {
const starEle = getStarDOM(index2);
const leftDis = getOffsetLeft(starEle);
const width = starEle.clientWidth;
if (reverse && x - leftDis > width / 2) {
value -= 0.5;
} else if (!reverse && x - leftDis < width / 2) {
value -= 0.5;
}
}
return value;
};
const changeValue = (value) => {
if (props2.value === void 0) {
state.value = value;
}
emit("update:value", value);
emit("change", value);
formItemContext.onFieldChange();
};
const onHover = (e, index2) => {
const hoverValue = getStarValue(index2, e.pageX);
if (hoverValue !== state.cleanedValue) {
state.hoverValue = hoverValue;
state.cleanedValue = null;
}
emit("hoverChange", hoverValue);
};
const onMouseLeave = () => {
state.hoverValue = void 0;
state.cleanedValue = null;
emit("hoverChange", void 0);
};
const onClick = (event, index2) => {
const {
allowClear
} = props2;
const newValue = getStarValue(index2, event.pageX);
let isReset = false;
if (allowClear) {
isReset = newValue === state.value;
}
onMouseLeave();
changeValue(isReset ? 0 : newValue);
state.cleanedValue = isReset ? newValue : null;
};
const onFocus = (e) => {
state.focused = true;
emit("focus", e);
};
const onBlur = (e) => {
state.focused = false;
emit("blur", e);
formItemContext.onFieldBlur();
};
const onKeyDown2 = (event) => {
const {
keyCode
} = event;
const {
count,
allowHalf
} = props2;
const reverse = direction.value === "rtl";
if (keyCode === KeyCode.RIGHT && state.value < count && !reverse) {
if (allowHalf) {
state.value += 0.5;
} else {
state.value += 1;
}
changeValue(state.value);
event.preventDefault();
} else if (keyCode === KeyCode.LEFT && state.value > 0 && !reverse) {
if (allowHalf) {
state.value -= 0.5;
} else {
state.value -= 1;
}
changeValue(state.value);
event.preventDefault();
} else if (keyCode === KeyCode.RIGHT && state.value > 0 && reverse) {
if (allowHalf) {
state.value -= 0.5;
} else {
state.value -= 1;
}
changeValue(state.value);
event.preventDefault();
} else if (keyCode === KeyCode.LEFT && state.value < count && reverse) {
if (allowHalf) {
state.value += 0.5;
} else {
state.value += 1;
}
changeValue(state.value);
event.preventDefault();
}
emit("keydown", event);
};
const focus = () => {
if (!props2.disabled) {
rateRef.value.focus();
}
};
const blur = () => {
if (!props2.disabled) {
rateRef.value.blur();
}
};
expose({
focus,
blur
});
const characterRender = (node, _ref2) => {
let {
index: index2
} = _ref2;
const {
tooltips
} = props2;
if (!tooltips) return node;
return createVNode(__nuxt_component_2$4, {
"title": tooltips[index2]
}, {
default: () => [node]
});
};
return () => {
const {
count,
allowHalf,
disabled,
tabindex,
id = formItemContext.id.value
} = props2;
const {
class: className,
style
} = attrs;
const stars = [];
const disabledClass = disabled ? `${prefixCls.value}-disabled` : "";
const character = props2.character || slots.character || (() => createVNode(StarFilled, null, null));
for (let index2 = 0; index2 < count; index2++) {
stars.push(createVNode(Star, {
"ref": setRef(index2),
"key": index2,
"index": index2,
"count": count,
"disabled": disabled,
"prefixCls": `${prefixCls.value}-star`,
"allowHalf": allowHalf,
"value": state.hoverValue === void 0 ? state.value : state.hoverValue,
"onClick": onClick,
"onHover": onHover,
"character": character,
"characterRender": characterRender,
"focused": state.focused
}, null));
}
const rateClassName = classNames(prefixCls.value, disabledClass, className, {
[hashId.value]: true,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
});
return wrapSSR(createVNode("ul", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"id": id,
"class": rateClassName,
"style": style,
"onMouseleave": disabled ? null : onMouseLeave,
"tabindex": disabled ? -1 : tabindex,
"onFocus": disabled ? null : onFocus,
"onBlur": disabled ? null : onBlur,
"onKeydown": disabled ? null : onKeyDown2,
"ref": rateRef,
"role": "radiogroup"
}), [stars]));
};
}
});
const index$c = withInstall(Rate);
const NoFound = () => {
return createVNode("svg", {
"width": "252",
"height": "294"
}, [createVNode("defs", null, [createVNode("path", {
"d": "M0 .387h251.772v251.772H0z"
}, null)]), createVNode("g", {
"fill": "none",
"fill-rule": "evenodd"
}, [createVNode("g", {
"transform": "translate(0 .012)"
}, [createVNode("mask", {
"fill": "#fff"
}, null), createVNode("path", {
"d": "M0 127.32v-2.095C0 56.279 55.892.387 124.838.387h2.096c68.946 0 124.838 55.892 124.838 124.838v2.096c0 68.946-55.892 124.838-124.838 124.838h-2.096C55.892 252.16 0 196.267 0 127.321",
"fill": "#E4EBF7",
"mask": "url(#b)"
}, null)]), createVNode("path", {
"d": "M39.755 130.84a8.276 8.276 0 1 1-16.468-1.66 8.276 8.276 0 0 1 16.468 1.66",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M36.975 134.297l10.482 5.943M48.373 146.508l-12.648 10.788",
"stroke": "#FFF",
"stroke-width": "2"
}, null), createVNode("path", {
"d": "M39.875 159.352a5.667 5.667 0 1 1-11.277-1.136 5.667 5.667 0 0 1 11.277 1.136M57.588 143.247a5.708 5.708 0 1 1-11.358-1.145 5.708 5.708 0 0 1 11.358 1.145M99.018 26.875l29.82-.014a4.587 4.587 0 1 0-.003-9.175l-29.82.013a4.587 4.587 0 1 0 .003 9.176M110.424 45.211l29.82-.013a4.588 4.588 0 0 0-.004-9.175l-29.82.013a4.587 4.587 0 1 0 .004 9.175",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M112.798 26.861v-.002l15.784-.006a4.588 4.588 0 1 0 .003 9.175l-15.783.007v-.002a4.586 4.586 0 0 0-.004-9.172M184.523 135.668c-.553 5.485-5.447 9.483-10.931 8.93-5.485-.553-9.483-5.448-8.93-10.932.552-5.485 5.447-9.483 10.932-8.93 5.485.553 9.483 5.447 8.93 10.932",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M179.26 141.75l12.64 7.167M193.006 156.477l-15.255 13.011",
"stroke": "#FFF",
"stroke-width": "2"
}, null), createVNode("path", {
"d": "M184.668 170.057a6.835 6.835 0 1 1-13.6-1.372 6.835 6.835 0 0 1 13.6 1.372M203.34 153.325a6.885 6.885 0 1 1-13.7-1.382 6.885 6.885 0 0 1 13.7 1.382",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M151.931 192.324a2.222 2.222 0 1 1-4.444 0 2.222 2.222 0 0 1 4.444 0zM225.27 116.056a2.222 2.222 0 1 1-4.445 0 2.222 2.222 0 0 1 4.444 0zM216.38 151.08a2.223 2.223 0 1 1-4.446-.001 2.223 2.223 0 0 1 4.446 0zM176.917 107.636a2.223 2.223 0 1 1-4.445 0 2.223 2.223 0 0 1 4.445 0zM195.291 92.165a2.223 2.223 0 1 1-4.445 0 2.223 2.223 0 0 1 4.445 0zM202.058 180.711a2.223 2.223 0 1 1-4.446 0 2.223 2.223 0 0 1 4.446 0z",
"stroke": "#FFF",
"stroke-width": "2"
}, null), createVNode("path", {
"stroke": "#FFF",
"stroke-width": "2",
"d": "M214.404 153.302l-1.912 20.184-10.928 5.99M173.661 174.792l-6.356 9.814h-11.36l-4.508 6.484M174.941 125.168v-15.804M220.824 117.25l-12.84 7.901-15.31-7.902V94.39"
}, null), createVNode("path", {
"d": "M166.588 65.936h-3.951a4.756 4.756 0 0 1-4.743-4.742 4.756 4.756 0 0 1 4.743-4.743h3.951a4.756 4.756 0 0 1 4.743 4.743 4.756 4.756 0 0 1-4.743 4.742",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M174.823 30.03c0-16.281 13.198-29.48 29.48-29.48 16.28 0 29.48 13.199 29.48 29.48 0 16.28-13.2 29.48-29.48 29.48-16.282 0-29.48-13.2-29.48-29.48",
"fill": "#1890FF"
}, null), createVNode("path", {
"d": "M205.952 38.387c.5.5.785 1.142.785 1.928s-.286 1.465-.785 1.964c-.572.5-1.214.75-2 .75-.785 0-1.429-.285-1.929-.785-.572-.5-.82-1.143-.82-1.929s.248-1.428.82-1.928c.5-.5 1.144-.75 1.93-.75.785 0 1.462.25 1.999.75m4.285-19.463c1.428 1.249 2.143 2.963 2.143 5.142 0 1.712-.427 3.13-1.219 4.25-.067.096-.137.18-.218.265-.416.429-1.41 1.346-2.956 2.699a5.07 5.07 0 0 0-1.428 1.75 5.207 5.207 0 0 0-.536 2.357v.5h-4.107v-.5c0-1.357.215-2.536.714-3.5.464-.964 1.857-2.464 4.178-4.536l.43-.5c.643-.785.964-1.643.964-2.535 0-1.18-.358-2.108-1-2.785-.678-.68-1.643-1.001-2.858-1.001-1.536 0-2.642.464-3.357 1.43-.37.5-.621 1.135-.76 1.904a1.999 1.999 0 0 1-1.971 1.63h-.004c-1.277 0-2.257-1.183-1.98-2.43.337-1.518 1.02-2.78 2.073-3.784 1.536-1.5 3.607-2.25 6.25-2.25 2.32 0 4.214.607 5.642 1.894",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M52.04 76.131s21.81 5.36 27.307 15.945c5.575 10.74-6.352 9.26-15.73 4.935-10.86-5.008-24.7-11.822-11.577-20.88",
"fill": "#FFB594"
}, null), createVNode("path", {
"d": "M90.483 67.504l-.449 2.893c-.753.49-4.748-2.663-4.748-2.663l-1.645.748-1.346-5.684s6.815-4.589 8.917-5.018c2.452-.501 9.884.94 10.7 2.278 0 0 1.32.486-2.227.69-3.548.203-5.043.447-6.79 3.132-1.747 2.686-2.412 3.624-2.412 3.624",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M128.055 111.367c-2.627-7.724-6.15-13.18-8.917-15.478-3.5-2.906-9.34-2.225-11.366-4.187-1.27-1.231-3.215-1.197-3.215-1.197s-14.98-3.158-16.828-3.479c-2.37-.41-2.124-.714-6.054-1.405-1.57-1.907-2.917-1.122-2.917-1.122l-7.11-1.383c-.853-1.472-2.423-1.023-2.423-1.023l-2.468-.897c-1.645 9.976-7.74 13.796-7.74 13.796 1.795 1.122 15.703 8.3 15.703 8.3l5.107 37.11s-3.321 5.694 1.346 9.109c0 0 19.883-3.743 34.921-.329 0 0 3.047-2.546.972-8.806.523-3.01 1.394-8.263 1.736-11.622.385.772 2.019 1.918 3.14 3.477 0 0 9.407-7.365 11.052-14.012-.832-.723-1.598-1.585-2.267-2.453-.567-.736-.358-2.056-.765-2.717-.669-1.084-1.804-1.378-1.907-1.682",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M101.09 289.998s4.295 2.041 7.354 1.021c2.821-.94 4.53.668 7.08 1.178 2.55.51 6.874 1.1 11.686-1.26-.103-5.51-6.889-3.98-11.96-6.713-2.563-1.38-3.784-4.722-3.598-8.799h-9.402s-1.392 10.52-1.16 14.573",
"fill": "#CBD1D1"
}, null), createVNode("path", {
"d": "M101.067 289.826s2.428 1.271 6.759.653c3.058-.437 3.712.481 7.423 1.031 3.712.55 10.724-.069 11.823-.894.413 1.1-.343 2.063-.343 2.063s-1.512.603-4.812.824c-2.03.136-5.8.291-7.607-.503-1.787-1.375-5.247-1.903-5.728-.241-3.918.95-7.355-.286-7.355-.286l-.16-2.647z",
"fill": "#2B0849"
}, null), createVNode("path", {
"d": "M108.341 276.044h3.094s-.103 6.702 4.536 8.558c-4.64.618-8.558-2.303-7.63-8.558",
"fill": "#A4AABA"
}, null), createVNode("path", {
"d": "M57.542 272.401s-2.107 7.416-4.485 12.306c-1.798 3.695-4.225 7.492 5.465 7.492 6.648 0 8.953-.48 7.423-6.599-1.53-6.12.266-13.199.266-13.199h-8.669z",
"fill": "#CBD1D1"
}, null), createVNode("path", {
"d": "M51.476 289.793s2.097 1.169 6.633 1.169c6.083 0 8.249-1.65 8.249-1.65s.602 1.114-.619 2.165c-.993.855-3.597 1.591-7.39 1.546-4.145-.048-5.832-.566-6.736-1.168-.825-.55-.687-1.58-.137-2.062",
"fill": "#2B0849"
}, null), createVNode("path", {
"d": "M58.419 274.304s.033 1.519-.314 2.93c-.349 1.42-1.078 3.104-1.13 4.139-.058 1.151 4.537 1.58 5.155.034.62-1.547 1.294-6.427 1.913-7.252.619-.825-4.903-2.119-5.624.15",
"fill": "#A4AABA"
}, null), createVNode("path", {
"d": "M99.66 278.514l13.378.092s1.298-54.52 1.853-64.403c.554-9.882 3.776-43.364 1.002-63.128l-12.547-.644-22.849.78s-.434 3.966-1.195 9.976c-.063.496-.682.843-.749 1.365-.075.585.423 1.354.32 1.966-2.364 14.08-6.377 33.104-8.744 46.677-.116.666-1.234 1.009-1.458 2.691-.04.302.211 1.525.112 1.795-6.873 18.744-10.949 47.842-14.277 61.885l14.607-.014s2.197-8.57 4.03-16.97c2.811-12.886 23.111-85.01 23.111-85.01l3.016-.521 1.043 46.35s-.224 1.234.337 2.02c.56.785-.56 1.123-.392 2.244l.392 1.794s-.449 7.178-.898 11.89c-.448 4.71-.092 39.165-.092 39.165",
"fill": "#7BB2F9"
}, null), createVNode("path", {
"d": "M76.085 221.626c1.153.094 4.038-2.019 6.955-4.935M106.36 225.142s2.774-1.11 6.103-3.883",
"stroke": "#648BD8",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M107.275 222.1s2.773-1.11 6.102-3.884",
"stroke": "#648BD8",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M74.74 224.767s2.622-.591 6.505-3.365M86.03 151.634c-.27 3.106.3 8.525-4.336 9.123M103.625 149.88s.11 14.012-1.293 15.065c-2.219 1.664-2.99 1.944-2.99 1.944M99.79 150.438s.035 12.88-1.196 24.377M93.673 175.911s7.212-1.664 9.431-1.664M74.31 205.861a212.013 212.013 0 0 1-.979 4.56s-1.458 1.832-1.009 3.776c.449 1.944-.947 2.045-4.985 15.355-1.696 5.59-4.49 18.591-6.348 27.597l-.231 1.12M75.689 197.807a320.934 320.934 0 0 1-.882 4.754M82.591 152.233L81.395 162.7s-1.097.15-.5 2.244c.113 1.346-2.674 15.775-5.18 30.43M56.12 274.418h13.31",
"stroke": "#648BD8",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M116.241 148.22s-17.047-3.104-35.893.2c.158 2.514-.003 4.15-.003 4.15s14.687-2.818 35.67-.312c.252-2.355.226-4.038.226-4.038",
"fill": "#192064"
}, null), createVNode("path", {
"d": "M106.322 151.165l.003-4.911a.81.81 0 0 0-.778-.815c-2.44-.091-5.066-.108-7.836-.014a.818.818 0 0 0-.789.815l-.003 4.906a.81.81 0 0 0 .831.813c2.385-.06 4.973-.064 7.73.017a.815.815 0 0 0 .842-.81",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M105.207 150.233l.002-3.076a.642.642 0 0 0-.619-.646 94.321 94.321 0 0 0-5.866-.01.65.65 0 0 0-.63.647v3.072a.64.64 0 0 0 .654.644 121.12 121.12 0 0 1 5.794.011c.362.01.665-.28.665-.642",
"fill": "#192064"
}, null), createVNode("path", {
"d": "M100.263 275.415h12.338M101.436 270.53c.006 3.387.042 5.79.111 6.506M101.451 264.548a915.75 915.75 0 0 0-.015 4.337M100.986 174.965l.898 44.642s.673 1.57-.225 2.692c-.897 1.122 2.468.673.898 2.243-1.57 1.57.897 1.122 0 3.365-.596 1.489-.994 21.1-1.096 35.146",
"stroke": "#648BD8",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M46.876 83.427s-.516 6.045 7.223 5.552c11.2-.712 9.218-9.345 31.54-21.655-.786-2.708-2.447-4.744-2.447-4.744s-11.068 3.11-22.584 8.046c-6.766 2.9-13.395 6.352-13.732 12.801M104.46 91.057l.941-5.372-8.884-11.43-5.037 5.372-1.74 7.834a.321.321 0 0 0 .108.32c.965.8 6.5 5.013 14.347 3.544a.332.332 0 0 0 .264-.268",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M93.942 79.387s-4.533-2.853-2.432-6.855c1.623-3.09 4.513 1.133 4.513 1.133s.52-3.642 3.121-3.642c.52-1.04 1.561-4.162 1.561-4.162s11.445 2.601 13.526 3.121c0 5.203-2.304 19.424-7.84 19.861-8.892.703-12.449-9.456-12.449-9.456",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M113.874 73.446c2.601-2.081 3.47-9.722 3.47-9.722s-2.479-.49-6.64-2.05c-4.683-2.081-12.798-4.747-17.48.976-9.668 3.223-2.05 19.823-2.05 19.823l2.713-3.021s-3.935-3.287-2.08-6.243c2.17-3.462 3.92 1.073 3.92 1.073s.637-2.387 3.581-3.342c.355-.71 1.036-2.674 1.432-3.85a1.073 1.073 0 0 1 1.263-.704c2.4.558 8.677 2.019 11.356 2.662.522.125.871.615.82 1.15l-.305 3.248z",
"fill": "#520038"
}, null), createVNode("path", {
"d": "M104.977 76.064c-.103.61-.582 1.038-1.07.956-.489-.083-.801-.644-.698-1.254.103-.61.582-1.038 1.07-.956.488.082.8.644.698 1.254M112.132 77.694c-.103.61-.582 1.038-1.07.956-.488-.083-.8-.644-.698-1.254.103-.61.582-1.038 1.07-.956.488.082.8.643.698 1.254",
"fill": "#552950"
}, null), createVNode("path", {
"stroke": "#DB836E",
"stroke-width": "1.118",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"d": "M110.13 74.84l-.896 1.61-.298 4.357h-2.228"
}, null), createVNode("path", {
"d": "M110.846 74.481s1.79-.716 2.506.537",
"stroke": "#5C2552",
"stroke-width": "1.118",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M92.386 74.282s.477-1.114 1.113-.716c.637.398 1.274 1.433.558 1.99-.717.556.159 1.67.159 1.67",
"stroke": "#DB836E",
"stroke-width": "1.118",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M103.287 72.93s1.83 1.113 4.137.954",
"stroke": "#5C2552",
"stroke-width": "1.118",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M103.685 81.762s2.227 1.193 4.376 1.193M104.64 84.308s.954.398 1.511.318M94.693 81.205s2.308 7.4 10.424 7.639",
"stroke": "#DB836E",
"stroke-width": "1.118",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M81.45 89.384s.45 5.647-4.935 12.787M69 82.654s-.726 9.282-8.204 14.206",
"stroke": "#E4EBF7",
"stroke-width": "1.101",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M129.405 122.865s-5.272 7.403-9.422 10.768",
"stroke": "#E4EBF7",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M119.306 107.329s.452 4.366-2.127 32.062",
"stroke": "#E4EBF7",
"stroke-width": "1.101",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M150.028 151.232h-49.837a1.01 1.01 0 0 1-1.01-1.01v-31.688c0-.557.452-1.01 1.01-1.01h49.837c.558 0 1.01.453 1.01 1.01v31.688a1.01 1.01 0 0 1-1.01 1.01",
"fill": "#F2D7AD"
}, null), createVNode("path", {
"d": "M150.29 151.232h-19.863v-33.707h20.784v32.786a.92.92 0 0 1-.92.92",
"fill": "#F4D19D"
}, null), createVNode("path", {
"d": "M123.554 127.896H92.917a.518.518 0 0 1-.425-.816l6.38-9.113c.193-.277.51-.442.85-.442h31.092l-7.26 10.371z",
"fill": "#F2D7AD"
}, null), createVNode("path", {
"fill": "#CC9B6E",
"d": "M123.689 128.447H99.25v-.519h24.169l7.183-10.26.424.298z"
}, null), createVNode("path", {
"d": "M158.298 127.896h-18.669a2.073 2.073 0 0 1-1.659-.83l-7.156-9.541h19.965c.49 0 .95.23 1.244.622l6.69 8.92a.519.519 0 0 1-.415.83",
"fill": "#F4D19D"
}, null), createVNode("path", {
"fill": "#CC9B6E",
"d": "M157.847 128.479h-19.384l-7.857-10.475.415-.31 7.7 10.266h19.126zM130.554 150.685l-.032-8.177.519-.002.032 8.177z"
}, null), createVNode("path", {
"fill": "#CC9B6E",
"d": "M130.511 139.783l-.08-21.414.519-.002.08 21.414zM111.876 140.932l-.498-.143 1.479-5.167.498.143zM108.437 141.06l-2.679-2.935 2.665-3.434.41.318-2.397 3.089 2.384 2.612zM116.607 141.06l-.383-.35 2.383-2.612-2.397-3.089.41-.318 2.665 3.434z"
}, null), createVNode("path", {
"d": "M154.316 131.892l-3.114-1.96.038 3.514-1.043.092c-1.682.115-3.634.23-4.789.23-1.902 0-2.693 2.258 2.23 2.648l-2.645-.596s-2.168 1.317.504 2.3c0 0-1.58 1.217.561 2.58-.584 3.504 5.247 4.058 7.122 3.59 1.876-.47 4.233-2.359 4.487-5.16.28-3.085-.89-5.432-3.35-7.238",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M153.686 133.577s-6.522.47-8.36.372c-1.836-.098-1.904 2.19 2.359 2.264 3.739.15 5.451-.044 5.451-.044",
"stroke": "#DB836E",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M145.16 135.877c-1.85 1.346.561 2.355.561 2.355s3.478.898 6.73.617",
"stroke": "#DB836E",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M151.89 141.71s-6.28.111-6.73-2.132c-.223-1.346.45-1.402.45-1.402M146.114 140.868s-1.103 3.16 5.44 3.533M151.202 129.932v3.477M52.838 89.286c3.533-.337 8.423-1.248 13.582-7.754",
"stroke": "#DB836E",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M168.567 248.318a6.647 6.647 0 0 1-6.647-6.647v-66.466a6.647 6.647 0 1 1 13.294 0v66.466a6.647 6.647 0 0 1-6.647 6.647",
"fill": "#5BA02E"
}, null), createVNode("path", {
"d": "M176.543 247.653a6.647 6.647 0 0 1-6.646-6.647v-33.232a6.647 6.647 0 1 1 13.293 0v33.232a6.647 6.647 0 0 1-6.647 6.647",
"fill": "#92C110"
}, null), createVNode("path", {
"d": "M186.443 293.613H158.92a3.187 3.187 0 0 1-3.187-3.187v-46.134a3.187 3.187 0 0 1 3.187-3.187h27.524a3.187 3.187 0 0 1 3.187 3.187v46.134a3.187 3.187 0 0 1-3.187 3.187",
"fill": "#F2D7AD"
}, null), createVNode("path", {
"d": "M88.979 89.48s7.776 5.384 16.6 2.842",
"stroke": "#E4EBF7",
"stroke-width": "1.101",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null)])]);
};
const ServerError = () => {
return createVNode("svg", {
"width": "254",
"height": "294"
}, [createVNode("defs", null, [createVNode("path", {
"d": "M0 .335h253.49v253.49H0z"
}, null), createVNode("path", {
"d": "M0 293.665h253.49V.401H0z"
}, null)]), createVNode("g", {
"fill": "none",
"fill-rule": "evenodd"
}, [createVNode("g", {
"transform": "translate(0 .067)"
}, [createVNode("mask", {
"fill": "#fff"
}, null), createVNode("path", {
"d": "M0 128.134v-2.11C0 56.608 56.273.334 125.69.334h2.11c69.416 0 125.69 56.274 125.69 125.69v2.11c0 69.417-56.274 125.69-125.69 125.69h-2.11C56.273 253.824 0 197.551 0 128.134",
"fill": "#E4EBF7",
"mask": "url(#b)"
}, null)]), createVNode("path", {
"d": "M39.989 132.108a8.332 8.332 0 1 1-16.581-1.671 8.332 8.332 0 0 1 16.58 1.671",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M37.19 135.59l10.553 5.983M48.665 147.884l-12.734 10.861",
"stroke": "#FFF",
"stroke-width": "2"
}, null), createVNode("path", {
"d": "M40.11 160.816a5.706 5.706 0 1 1-11.354-1.145 5.706 5.706 0 0 1 11.354 1.145M57.943 144.6a5.747 5.747 0 1 1-11.436-1.152 5.747 5.747 0 0 1 11.436 1.153M99.656 27.434l30.024-.013a4.619 4.619 0 1 0-.004-9.238l-30.024.013a4.62 4.62 0 0 0 .004 9.238M111.14 45.896l30.023-.013a4.62 4.62 0 1 0-.004-9.238l-30.024.013a4.619 4.619 0 1 0 .004 9.238",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M113.53 27.421v-.002l15.89-.007a4.619 4.619 0 1 0 .005 9.238l-15.892.007v-.002a4.618 4.618 0 0 0-.004-9.234M150.167 70.091h-3.979a4.789 4.789 0 0 1-4.774-4.775 4.788 4.788 0 0 1 4.774-4.774h3.979a4.789 4.789 0 0 1 4.775 4.774 4.789 4.789 0 0 1-4.775 4.775",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M171.687 30.234c0-16.392 13.289-29.68 29.681-29.68 16.392 0 29.68 13.288 29.68 29.68 0 16.393-13.288 29.681-29.68 29.681s-29.68-13.288-29.68-29.68",
"fill": "#FF603B"
}, null), createVNode("path", {
"d": "M203.557 19.435l-.676 15.035a1.514 1.514 0 0 1-3.026 0l-.675-15.035a2.19 2.19 0 1 1 4.377 0m-.264 19.378c.513.477.77 1.1.77 1.87s-.257 1.393-.77 1.907c-.55.476-1.21.733-1.943.733a2.545 2.545 0 0 1-1.87-.77c-.55-.514-.806-1.136-.806-1.87 0-.77.256-1.393.806-1.87.513-.513 1.137-.733 1.87-.733.77 0 1.43.22 1.943.733",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M119.3 133.275c4.426-.598 3.612-1.204 4.079-4.778.675-5.18-3.108-16.935-8.262-25.118-1.088-10.72-12.598-11.24-12.598-11.24s4.312 4.895 4.196 16.199c1.398 5.243.804 14.45.804 14.45s5.255 11.369 11.78 10.487",
"fill": "#FFB594"
}, null), createVNode("path", {
"d": "M100.944 91.61s1.463-.583 3.211.582c8.08 1.398 10.368 6.706 11.3 11.368 1.864 1.282 1.864 2.33 1.864 3.496.365.777 1.515 3.03 1.515 3.03s-7.225 1.748-10.954 6.758c-1.399-6.41-6.936-25.235-6.936-25.235",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M94.008 90.5l1.019-5.815-9.23-11.874-5.233 5.581-2.593 9.863s8.39 5.128 16.037 2.246",
"fill": "#FFB594"
}, null), createVNode("path", {
"d": "M82.931 78.216s-4.557-2.868-2.445-6.892c1.632-3.107 4.537 1.139 4.537 1.139s.524-3.662 3.139-3.662c.523-1.046 1.569-4.184 1.569-4.184s11.507 2.615 13.6 3.138c-.001 5.23-2.317 19.529-7.884 19.969-8.94.706-12.516-9.508-12.516-9.508",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M102.971 72.243c2.616-2.093 3.489-9.775 3.489-9.775s-2.492-.492-6.676-2.062c-4.708-2.092-12.867-4.771-17.575.982-9.54 4.41-2.062 19.93-2.062 19.93l2.729-3.037s-3.956-3.304-2.092-6.277c2.183-3.48 3.943 1.08 3.943 1.08s.64-2.4 3.6-3.36c.356-.714 1.04-2.69 1.44-3.872a1.08 1.08 0 0 1 1.27-.707c2.41.56 8.723 2.03 11.417 2.676.524.126.876.619.825 1.156l-.308 3.266z",
"fill": "#520038"
}, null), createVNode("path", {
"d": "M101.22 76.514c-.104.613-.585 1.044-1.076.96-.49-.082-.805-.646-.702-1.26.104-.613.585-1.044 1.076-.961.491.083.805.647.702 1.26M94.26 75.074c-.104.613-.585 1.044-1.076.96-.49-.082-.805-.646-.702-1.26.104-.613.585-1.044 1.076-.96.491.082.805.646.702 1.26",
"fill": "#552950"
}, null), createVNode("path", {
"stroke": "#DB836E",
"stroke-width": "1.063",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"d": "M99.206 73.644l-.9 1.62-.3 4.38h-2.24"
}, null), createVNode("path", {
"d": "M99.926 73.284s1.8-.72 2.52.54",
"stroke": "#5C2552",
"stroke-width": "1.117",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M81.367 73.084s.48-1.12 1.12-.72c.64.4 1.28 1.44.56 2s.16 1.68.16 1.68",
"stroke": "#DB836E",
"stroke-width": "1.117",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M92.326 71.724s1.84 1.12 4.16.96",
"stroke": "#5C2552",
"stroke-width": "1.117",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M92.726 80.604s2.24 1.2 4.4 1.2M93.686 83.164s.96.4 1.52.32M83.687 80.044s1.786 6.547 9.262 7.954",
"stroke": "#DB836E",
"stroke-width": "1.063",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M95.548 91.663s-1.068 2.821-8.298 2.105c-7.23-.717-10.29-5.044-10.29-5.044",
"stroke": "#E4EBF7",
"stroke-width": "1.136",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M78.126 87.478s6.526 4.972 16.47 2.486c0 0 9.577 1.02 11.536 5.322 5.36 11.77.543 36.835 0 39.962 3.496 4.055-.466 8.483-.466 8.483-15.624-3.548-35.81-.6-35.81-.6-4.849-3.546-1.223-9.044-1.223-9.044L62.38 110.32c-2.485-15.227.833-19.803 3.549-20.743 3.03-1.049 8.04-1.282 8.04-1.282.496-.058 1.08-.076 1.37-.233 2.36-1.282 2.787-.583 2.787-.583",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M65.828 89.81s-6.875.465-7.59 8.156c-.466 8.857 3.03 10.954 3.03 10.954s6.075 22.102 16.796 22.957c8.39-2.176 4.758-6.702 4.661-11.42-.233-11.304-7.108-16.897-7.108-16.897s-4.212-13.75-9.789-13.75",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M71.716 124.225s.855 11.264 9.828 6.486c4.765-2.536 7.581-13.828 9.789-22.568 1.456-5.768 2.58-12.197 2.58-12.197l-4.973-1.709s-2.408 5.516-7.769 12.275c-4.335 5.467-9.144 11.11-9.455 17.713",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M108.463 105.191s1.747 2.724-2.331 30.535c2.376 2.216 1.053 6.012-.233 7.51",
"stroke": "#E4EBF7",
"stroke-width": "1.085",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M123.262 131.527s-.427 2.732-11.77 1.981c-15.187-1.006-25.326-3.25-25.326-3.25l.933-5.8s.723.215 9.71-.068c11.887-.373 18.714-6.07 24.964-1.022 4.039 3.263 1.489 8.16 1.489 8.16",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M70.24 90.974s-5.593-4.739-11.054 2.68c-3.318 7.223.517 15.284 2.664 19.578-.31 3.729 2.33 4.311 2.33 4.311s.108.895 1.516 2.68c4.078-7.03 6.72-9.166 13.711-12.546-.328-.656-1.877-3.265-1.825-3.767.175-1.69-1.282-2.623-1.282-2.623s-.286-.156-1.165-2.738c-.788-2.313-2.036-5.177-4.895-7.575",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M90.232 288.027s4.855 2.308 8.313 1.155c3.188-1.063 5.12.755 8.002 1.331 2.881.577 7.769 1.243 13.207-1.424-.117-6.228-7.786-4.499-13.518-7.588-2.895-1.56-4.276-5.336-4.066-9.944H91.544s-1.573 11.89-1.312 16.47",
"fill": "#CBD1D1"
}, null), createVNode("path", {
"d": "M90.207 287.833s2.745 1.437 7.639.738c3.456-.494 3.223.66 7.418 1.282 4.195.621 13.092-.194 14.334-1.126.466 1.242-.388 2.33-.388 2.33s-1.709.682-5.438.932c-2.295.154-8.098.276-10.14-.621-2.02-1.554-4.894-1.515-6.06-.234-4.427 1.075-7.184-.31-7.184-.31l-.181-2.991z",
"fill": "#2B0849"
}, null), createVNode("path", {
"d": "M98.429 272.257h3.496s-.117 7.574 5.127 9.671c-5.244.7-9.672-2.602-8.623-9.671",
"fill": "#A4AABA"
}, null), createVNode("path", {
"d": "M44.425 272.046s-2.208 7.774-4.702 12.899c-1.884 3.874-4.428 7.854 5.729 7.854 6.97 0 9.385-.503 7.782-6.917-1.604-6.415.279-13.836.279-13.836h-9.088z",
"fill": "#CBD1D1"
}, null), createVNode("path", {
"d": "M38.066 290.277s2.198 1.225 6.954 1.225c6.376 0 8.646-1.73 8.646-1.73s.63 1.168-.649 2.27c-1.04.897-3.77 1.668-7.745 1.621-4.347-.05-6.115-.593-7.062-1.224-.864-.577-.72-1.657-.144-2.162",
"fill": "#2B0849"
}, null), createVNode("path", {
"d": "M45.344 274.041s.035 1.592-.329 3.07c-.365 1.49-1.13 3.255-1.184 4.34-.061 1.206 4.755 1.657 5.403.036.65-1.622 1.357-6.737 2.006-7.602.648-.865-5.14-2.222-5.896.156",
"fill": "#A4AABA"
}, null), createVNode("path", {
"d": "M89.476 277.57l13.899.095s1.349-56.643 1.925-66.909c.576-10.267 3.923-45.052 1.042-65.585l-13.037-.669-23.737.81s-.452 4.12-1.243 10.365c-.065.515-.708.874-.777 1.417-.078.608.439 1.407.332 2.044-2.455 14.627-5.797 32.736-8.256 46.837-.121.693-1.282 1.048-1.515 2.796-.042.314.22 1.584.116 1.865-7.14 19.473-12.202 52.601-15.66 67.19l15.176-.015s2.282-10.145 4.185-18.871c2.922-13.389 24.012-88.32 24.012-88.32l3.133-.954-.158 48.568s-.233 1.282.35 2.098c.583.815-.581 1.167-.408 2.331l.408 1.864s-.466 7.458-.932 12.352c-.467 4.895 1.145 40.69 1.145 40.69",
"fill": "#7BB2F9"
}, null), createVNode("path", {
"d": "M64.57 218.881c1.197.099 4.195-2.097 7.225-5.127M96.024 222.534s2.881-1.152 6.34-4.034",
"stroke": "#648BD8",
"stroke-width": "1.085",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M96.973 219.373s2.882-1.153 6.34-4.034",
"stroke": "#648BD8",
"stroke-width": "1.032",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M63.172 222.144s2.724-.614 6.759-3.496M74.903 146.166c-.281 3.226.31 8.856-4.506 9.478M93.182 144.344s.115 14.557-1.344 15.65c-2.305 1.73-3.107 2.02-3.107 2.02M89.197 144.923s.269 13.144-1.01 25.088M83.525 170.71s6.81-1.051 9.116-1.051M46.026 270.045l-.892 4.538M46.937 263.289l-.815 4.157M62.725 202.503c-.33 1.618-.102 1.904-.449 3.438 0 0-2.756 1.903-2.29 3.923.466 2.02-.31 3.424-4.505 17.252-1.762 5.807-4.233 18.922-6.165 28.278-.03.144-.521 2.646-1.14 5.8M64.158 194.136c-.295 1.658-.6 3.31-.917 4.938M71.33 146.787l-1.244 10.877s-1.14.155-.519 2.33c.117 1.399-2.778 16.39-5.382 31.615M44.242 273.727H58.07",
"stroke": "#648BD8",
"stroke-width": "1.085",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M106.18 142.117c-3.028-.489-18.825-2.744-36.219.2a.625.625 0 0 0-.518.644c.063 1.307.044 2.343.015 2.995a.617.617 0 0 0 .716.636c3.303-.534 17.037-2.412 35.664-.266.347.04.66-.214.692-.56.124-1.347.16-2.425.17-3.029a.616.616 0 0 0-.52-.62",
"fill": "#192064"
}, null), createVNode("path", {
"d": "M96.398 145.264l.003-5.102a.843.843 0 0 0-.809-.847 114.104 114.104 0 0 0-8.141-.014.85.85 0 0 0-.82.847l-.003 5.097c0 .476.388.857.864.845 2.478-.064 5.166-.067 8.03.017a.848.848 0 0 0 .876-.843",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M95.239 144.296l.002-3.195a.667.667 0 0 0-.643-.672c-1.9-.061-3.941-.073-6.094-.01a.675.675 0 0 0-.654.672l-.002 3.192c0 .376.305.677.68.669 1.859-.042 3.874-.043 6.02.012.376.01.69-.291.691-.668",
"fill": "#192064"
}, null), createVNode("path", {
"d": "M90.102 273.522h12.819M91.216 269.761c.006 3.519-.072 5.55 0 6.292M90.923 263.474c-.009 1.599-.016 2.558-.016 4.505M90.44 170.404l.932 46.38s.7 1.631-.233 2.796c-.932 1.166 2.564.7.932 2.33-1.63 1.633.933 1.166 0 3.497-.618 1.546-1.031 21.921-1.138 36.513",
"stroke": "#648BD8",
"stroke-width": "1.085",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M73.736 98.665l2.214 4.312s2.098.816 1.865 2.68l.816 2.214M64.297 116.611c.233-.932 2.176-7.147 12.585-10.488M77.598 90.042s7.691 6.137 16.547 2.72",
"stroke": "#E4EBF7",
"stroke-width": "1.085",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M91.974 86.954s5.476-.816 7.574-4.545c1.297-.345.72 2.212-.33 3.671-.7.971-1.01 1.554-1.01 1.554s.194.31.155.816c-.053.697-.175.653-.272 1.048-.081.335.108.657 0 1.049-.046.17-.198.5-.382.878-.12.249-.072.687-.2.948-.231.469-1.562 1.87-2.622 2.855-3.826 3.554-5.018 1.644-6.001-.408-.894-1.865-.661-5.127-.874-6.875-.35-2.914-2.622-3.03-1.923-4.429.343-.685 2.87.69 3.263 1.748.757 2.04 2.952 1.807 2.622 1.69",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M99.8 82.429c-.465.077-.35.272-.97 1.243-.622.971-4.817 2.932-6.39 3.224-2.589.48-2.278-1.56-4.254-2.855-1.69-1.107-3.562-.638-1.398 1.398.99.932.932 1.107 1.398 3.205.335 1.506-.64 3.67.7 5.593",
"stroke": "#DB836E",
"stroke-width": ".774",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M79.543 108.673c-2.1 2.926-4.266 6.175-5.557 8.762",
"stroke": "#E59788",
"stroke-width": ".774",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M87.72 124.768s-2.098-1.942-5.127-2.719c-3.03-.777-3.574-.155-5.516.078-1.942.233-3.885-.932-3.652.7.233 1.63 5.05 1.01 5.206 2.097.155 1.087-6.37 2.796-8.313 2.175-.777.777.466 1.864 2.02 2.175.233 1.554 2.253 1.554 2.253 1.554s.699 1.01 2.641 1.088c2.486 1.32 8.934-.7 10.954-1.554 2.02-.855-.466-5.594-.466-5.594",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M73.425 122.826s.66 1.127 3.167 1.418c2.315.27 2.563.583 2.563.583s-2.545 2.894-9.07 2.272M72.416 129.274s3.826.097 4.933-.718M74.98 130.75s1.961.136 3.36-.505M77.232 131.916s1.748.019 2.914-.505M73.328 122.321s-.595-1.032 1.262-.427c1.671.544 2.833.055 5.128.155 1.389.061 3.067-.297 3.982.15 1.606.784 3.632 2.181 3.632 2.181s10.526 1.204 19.033-1.127M78.864 108.104s-8.39 2.758-13.168 12.12",
"stroke": "#E59788",
"stroke-width": ".774",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M109.278 112.533s3.38-3.613 7.575-4.662",
"stroke": "#E4EBF7",
"stroke-width": "1.085",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M107.375 123.006s9.697-2.745 11.445-.88",
"stroke": "#E59788",
"stroke-width": ".774",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M194.605 83.656l3.971-3.886M187.166 90.933l3.736-3.655M191.752 84.207l-4.462-4.56M198.453 91.057l-4.133-4.225M129.256 163.074l3.718-3.718M122.291 170.039l3.498-3.498M126.561 163.626l-4.27-4.27M132.975 170.039l-3.955-3.955",
"stroke": "#BFCDDD",
"stroke-width": "2",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M190.156 211.779h-1.604a4.023 4.023 0 0 1-4.011-4.011V175.68a4.023 4.023 0 0 1 4.01-4.01h1.605a4.023 4.023 0 0 1 4.011 4.01v32.088a4.023 4.023 0 0 1-4.01 4.01",
"fill": "#A3B4C6"
}, null), createVNode("path", {
"d": "M237.824 212.977a4.813 4.813 0 0 1-4.813 4.813h-86.636a4.813 4.813 0 0 1 0-9.626h86.636a4.813 4.813 0 0 1 4.813 4.813",
"fill": "#A3B4C6"
}, null), createVNode("mask", {
"fill": "#fff"
}, null), createVNode("path", {
"fill": "#A3B4C6",
"mask": "url(#d)",
"d": "M154.098 190.096h70.513v-84.617h-70.513z"
}, null), createVNode("path", {
"d": "M224.928 190.096H153.78a3.219 3.219 0 0 1-3.208-3.209V167.92a3.219 3.219 0 0 1 3.208-3.21h71.148a3.219 3.219 0 0 1 3.209 3.21v18.967a3.219 3.219 0 0 1-3.21 3.209M224.928 130.832H153.78a3.218 3.218 0 0 1-3.208-3.208v-18.968a3.219 3.219 0 0 1 3.208-3.209h71.148a3.219 3.219 0 0 1 3.209 3.21v18.967a3.218 3.218 0 0 1-3.21 3.208",
"fill": "#BFCDDD",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M159.563 120.546a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M166.98 120.546a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M174.397 120.546a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M222.539 120.546h-22.461a.802.802 0 0 1-.802-.802v-3.208c0-.443.359-.803.802-.803h22.46c.444 0 .803.36.803.803v3.208c0 .443-.36.802-.802.802",
"fill": "#FFF",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M224.928 160.464H153.78a3.218 3.218 0 0 1-3.208-3.209v-18.967a3.219 3.219 0 0 1 3.208-3.209h71.148a3.219 3.219 0 0 1 3.209 3.209v18.967a3.218 3.218 0 0 1-3.21 3.209",
"fill": "#BFCDDD",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M173.455 130.832h49.301M164.984 130.832h6.089M155.952 130.832h6.75M173.837 160.613h49.3M165.365 160.613h6.089M155.57 160.613h6.751",
"stroke": "#7C90A5",
"stroke-width": "1.124",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M159.563 151.038a2.407 2.407 0 1 1 0-4.814 2.407 2.407 0 0 1 0 4.814M166.98 151.038a2.407 2.407 0 1 1 0-4.814 2.407 2.407 0 0 1 0 4.814M174.397 151.038a2.407 2.407 0 1 1 .001-4.814 2.407 2.407 0 0 1 0 4.814M222.539 151.038h-22.461a.802.802 0 0 1-.802-.802v-3.209c0-.443.359-.802.802-.802h22.46c.444 0 .803.36.803.802v3.209c0 .443-.36.802-.802.802M159.563 179.987a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M166.98 179.987a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M174.397 179.987a2.407 2.407 0 1 1 0-4.813 2.407 2.407 0 0 1 0 4.813M222.539 179.987h-22.461a.802.802 0 0 1-.802-.802v-3.209c0-.443.359-.802.802-.802h22.46c.444 0 .803.36.803.802v3.209c0 .443-.36.802-.802.802",
"fill": "#FFF",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M203.04 221.108h-27.372a2.413 2.413 0 0 1-2.406-2.407v-11.448a2.414 2.414 0 0 1 2.406-2.407h27.372a2.414 2.414 0 0 1 2.407 2.407V218.7a2.413 2.413 0 0 1-2.407 2.407",
"fill": "#BFCDDD",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M177.259 207.217v11.52M201.05 207.217v11.52",
"stroke": "#A3B4C6",
"stroke-width": "1.124",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M162.873 267.894a9.422 9.422 0 0 1-9.422-9.422v-14.82a9.423 9.423 0 0 1 18.845 0v14.82a9.423 9.423 0 0 1-9.423 9.422",
"fill": "#5BA02E",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M171.22 267.83a9.422 9.422 0 0 1-9.422-9.423v-3.438a9.423 9.423 0 0 1 18.845 0v3.438a9.423 9.423 0 0 1-9.422 9.423",
"fill": "#92C110",
"mask": "url(#d)"
}, null), createVNode("path", {
"d": "M181.31 293.666h-27.712a3.209 3.209 0 0 1-3.209-3.21V269.79a3.209 3.209 0 0 1 3.209-3.21h27.711a3.209 3.209 0 0 1 3.209 3.21v20.668a3.209 3.209 0 0 1-3.209 3.209",
"fill": "#F2D7AD",
"mask": "url(#d)"
}, null)])]);
};
const Unauthorized = () => {
return createVNode("svg", {
"width": "251",
"height": "294"
}, [createVNode("g", {
"fill": "none",
"fill-rule": "evenodd"
}, [createVNode("path", {
"d": "M0 129.023v-2.084C0 58.364 55.591 2.774 124.165 2.774h2.085c68.574 0 124.165 55.59 124.165 124.165v2.084c0 68.575-55.59 124.166-124.165 124.166h-2.085C55.591 253.189 0 197.598 0 129.023",
"fill": "#E4EBF7"
}, null), createVNode("path", {
"d": "M41.417 132.92a8.231 8.231 0 1 1-16.38-1.65 8.231 8.231 0 0 1 16.38 1.65",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M38.652 136.36l10.425 5.91M49.989 148.505l-12.58 10.73",
"stroke": "#FFF",
"stroke-width": "2"
}, null), createVNode("path", {
"d": "M41.536 161.28a5.636 5.636 0 1 1-11.216-1.13 5.636 5.636 0 0 1 11.216 1.13M59.154 145.261a5.677 5.677 0 1 1-11.297-1.138 5.677 5.677 0 0 1 11.297 1.138M100.36 29.516l29.66-.013a4.562 4.562 0 1 0-.004-9.126l-29.66.013a4.563 4.563 0 0 0 .005 9.126M111.705 47.754l29.659-.013a4.563 4.563 0 1 0-.004-9.126l-29.66.013a4.563 4.563 0 1 0 .005 9.126",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M114.066 29.503V29.5l15.698-.007a4.563 4.563 0 1 0 .004 9.126l-15.698.007v-.002a4.562 4.562 0 0 0-.004-9.122M185.405 137.723c-.55 5.455-5.418 9.432-10.873 8.882-5.456-.55-9.432-5.418-8.882-10.873.55-5.455 5.418-9.432 10.873-8.882 5.455.55 9.432 5.418 8.882 10.873",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M180.17 143.772l12.572 7.129M193.841 158.42L178.67 171.36",
"stroke": "#FFF",
"stroke-width": "2"
}, null), createVNode("path", {
"d": "M185.55 171.926a6.798 6.798 0 1 1-13.528-1.363 6.798 6.798 0 0 1 13.527 1.363M204.12 155.285a6.848 6.848 0 1 1-13.627-1.375 6.848 6.848 0 0 1 13.626 1.375",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M152.988 194.074a2.21 2.21 0 1 1-4.42 0 2.21 2.21 0 0 1 4.42 0zM225.931 118.217a2.21 2.21 0 1 1-4.421 0 2.21 2.21 0 0 1 4.421 0zM217.09 153.051a2.21 2.21 0 1 1-4.421 0 2.21 2.21 0 0 1 4.42 0zM177.84 109.842a2.21 2.21 0 1 1-4.422 0 2.21 2.21 0 0 1 4.421 0zM196.114 94.454a2.21 2.21 0 1 1-4.421 0 2.21 2.21 0 0 1 4.421 0zM202.844 182.523a2.21 2.21 0 1 1-4.42 0 2.21 2.21 0 0 1 4.42 0z",
"stroke": "#FFF",
"stroke-width": "2"
}, null), createVNode("path", {
"stroke": "#FFF",
"stroke-width": "2",
"d": "M215.125 155.262l-1.902 20.075-10.87 5.958M174.601 176.636l-6.322 9.761H156.98l-4.484 6.449M175.874 127.28V111.56M221.51 119.404l-12.77 7.859-15.228-7.86V96.668"
}, null), createVNode("path", {
"d": "M180.68 29.32C180.68 13.128 193.806 0 210 0c16.193 0 29.32 13.127 29.32 29.32 0 16.194-13.127 29.322-29.32 29.322-16.193 0-29.32-13.128-29.32-29.321",
"fill": "#A26EF4"
}, null), createVNode("path", {
"d": "M221.45 41.706l-21.563-.125a1.744 1.744 0 0 1-1.734-1.754l.071-12.23a1.744 1.744 0 0 1 1.754-1.734l21.562.125c.964.006 1.74.791 1.735 1.755l-.071 12.229a1.744 1.744 0 0 1-1.754 1.734",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M215.106 29.192c-.015 2.577-2.049 4.654-4.543 4.64-2.494-.014-4.504-2.115-4.489-4.693l.04-6.925c.016-2.577 2.05-4.654 4.543-4.64 2.494.015 4.504 2.116 4.49 4.693l-.04 6.925zm-4.53-14.074a6.877 6.877 0 0 0-6.916 6.837l-.043 7.368a6.877 6.877 0 0 0 13.754.08l.042-7.368a6.878 6.878 0 0 0-6.837-6.917zM167.566 68.367h-3.93a4.73 4.73 0 0 1-4.717-4.717 4.73 4.73 0 0 1 4.717-4.717h3.93a4.73 4.73 0 0 1 4.717 4.717 4.73 4.73 0 0 1-4.717 4.717",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M168.214 248.838a6.611 6.611 0 0 1-6.61-6.611v-66.108a6.611 6.611 0 0 1 13.221 0v66.108a6.611 6.611 0 0 1-6.61 6.61",
"fill": "#5BA02E"
}, null), createVNode("path", {
"d": "M176.147 248.176a6.611 6.611 0 0 1-6.61-6.61v-33.054a6.611 6.611 0 1 1 13.221 0v33.053a6.611 6.611 0 0 1-6.61 6.611",
"fill": "#92C110"
}, null), createVNode("path", {
"d": "M185.994 293.89h-27.376a3.17 3.17 0 0 1-3.17-3.17v-45.887a3.17 3.17 0 0 1 3.17-3.17h27.376a3.17 3.17 0 0 1 3.17 3.17v45.886a3.17 3.17 0 0 1-3.17 3.17",
"fill": "#F2D7AD"
}, null), createVNode("path", {
"d": "M81.972 147.673s6.377-.927 17.566-1.28c11.729-.371 17.57 1.086 17.57 1.086s3.697-3.855.968-8.424c1.278-12.077 5.982-32.827.335-48.273-1.116-1.339-3.743-1.512-7.536-.62-1.337.315-7.147-.149-7.983-.1l-15.311-.347s-3.487-.17-8.035-.508c-1.512-.113-4.227-1.683-5.458-.338-.406.443-2.425 5.669-1.97 16.077l8.635 35.642s-3.141 3.61 1.219 7.085",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M75.768 73.325l-.9-6.397 11.982-6.52s7.302-.118 8.038 1.205c.737 1.324-5.616.993-5.616.993s-1.836 1.388-2.615 2.5c-1.654 2.363-.986 6.471-8.318 5.986-1.708.284-2.57 2.233-2.57 2.233",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M52.44 77.672s14.217 9.406 24.973 14.444c1.061.497-2.094 16.183-11.892 11.811-7.436-3.318-20.162-8.44-21.482-14.496-.71-3.258 2.543-7.643 8.401-11.76M141.862 80.113s-6.693 2.999-13.844 6.876c-3.894 2.11-10.137 4.704-12.33 7.988-6.224 9.314 3.536 11.22 12.947 7.503 6.71-2.651 28.999-12.127 13.227-22.367",
"fill": "#FFB594"
}, null), createVNode("path", {
"d": "M76.166 66.36l3.06 3.881s-2.783 2.67-6.31 5.747c-7.103 6.195-12.803 14.296-15.995 16.44-3.966 2.662-9.754 3.314-12.177-.118-3.553-5.032.464-14.628 31.422-25.95",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M64.674 85.116s-2.34 8.413-8.912 14.447c.652.548 18.586 10.51 22.144 10.056 5.238-.669 6.417-18.968 1.145-20.531-.702-.208-5.901-1.286-8.853-2.167-.87-.26-1.611-1.71-3.545-.936l-1.98-.869zM128.362 85.826s5.318 1.956 7.325 13.734c-.546.274-17.55 12.35-21.829 7.805-6.534-6.94-.766-17.393 4.275-18.61 4.646-1.121 5.03-1.37 10.23-2.929",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M78.18 94.656s.911 7.41-4.914 13.078",
"stroke": "#E4EBF7",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M87.397 94.68s3.124 2.572 10.263 2.572c7.14 0 9.074-3.437 9.074-3.437",
"stroke": "#E4EBF7",
"stroke-width": ".932",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M117.184 68.639l-6.781-6.177s-5.355-4.314-9.223-.893c-3.867 3.422 4.463 2.083 5.653 4.165 1.19 2.082.848 1.143-2.083.446-5.603-1.331-2.082.893 2.975 5.355 2.091 1.845 6.992.955 6.992.955l2.467-3.851z",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M105.282 91.315l-.297-10.937-15.918-.027-.53 10.45c-.026.403.17.788.515.999 2.049 1.251 9.387 5.093 15.799.424.287-.21.443-.554.431-.91",
"fill": "#FFB594"
}, null), createVNode("path", {
"d": "M107.573 74.24c.817-1.147.982-9.118 1.015-11.928a1.046 1.046 0 0 0-.965-1.055l-4.62-.365c-7.71-1.044-17.071.624-18.253 6.346-5.482 5.813-.421 13.244-.421 13.244s1.963 3.566 4.305 6.791c.756 1.041.398-3.731 3.04-5.929 5.524-4.594 15.899-7.103 15.899-7.103",
"fill": "#5C2552"
}, null), createVNode("path", {
"d": "M88.426 83.206s2.685 6.202 11.602 6.522c7.82.28 8.973-7.008 7.434-17.505l-.909-5.483c-6.118-2.897-15.478.54-15.478.54s-.576 2.044-.19 5.504c-2.276 2.066-1.824 5.618-1.824 5.618s-.905-1.922-1.98-2.321c-.86-.32-1.897.089-2.322 1.98-1.04 4.632 3.667 5.145 3.667 5.145",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"stroke": "#DB836E",
"stroke-width": "1.145",
"stroke-linecap": "round",
"stroke-linejoin": "round",
"d": "M100.843 77.099l1.701-.928-1.015-4.324.674-1.406"
}, null), createVNode("path", {
"d": "M105.546 74.092c-.022.713-.452 1.279-.96 1.263-.51-.016-.904-.607-.882-1.32.021-.713.452-1.278.96-1.263.51.016.904.607.882 1.32M97.592 74.349c-.022.713-.452 1.278-.961 1.263-.509-.016-.904-.607-.882-1.32.022-.713.452-1.279.961-1.263.51.016.904.606.882 1.32",
"fill": "#552950"
}, null), createVNode("path", {
"d": "M91.132 86.786s5.269 4.957 12.679 2.327",
"stroke": "#DB836E",
"stroke-width": "1.145",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M99.776 81.903s-3.592.232-1.44-2.79c1.59-1.496 4.897-.46 4.897-.46s1.156 3.906-3.457 3.25",
"fill": "#DB836E"
}, null), createVNode("path", {
"d": "M102.88 70.6s2.483.84 3.402.715M93.883 71.975s2.492-1.144 4.778-1.073",
"stroke": "#5C2552",
"stroke-width": "1.526",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M86.32 77.374s.961.879 1.458 2.106c-.377.48-1.033 1.152-.236 1.809M99.337 83.719s1.911.151 2.509-.254",
"stroke": "#DB836E",
"stroke-width": "1.145",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M87.782 115.821l15.73-3.012M100.165 115.821l10.04-2.008",
"stroke": "#E4EBF7",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M66.508 86.763s-1.598 8.83-6.697 14.078",
"stroke": "#E4EBF7",
"stroke-width": "1.114",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M128.31 87.934s3.013 4.121 4.06 11.785",
"stroke": "#E4EBF7",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M64.09 84.816s-6.03 9.912-13.607 9.903",
"stroke": "#DB836E",
"stroke-width": ".795",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M112.366 65.909l-.142 5.32s5.993 4.472 11.945 9.202c4.482 3.562 8.888 7.455 10.985 8.662 4.804 2.766 8.9 3.355 11.076 1.808 4.071-2.894 4.373-9.878-8.136-15.263-4.271-1.838-16.144-6.36-25.728-9.73",
"fill": "#FFC6A0"
}, null), createVNode("path", {
"d": "M130.532 85.488s4.588 5.757 11.619 6.214",
"stroke": "#DB836E",
"stroke-width": ".75",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M121.708 105.73s-.393 8.564-1.34 13.612",
"stroke": "#E4EBF7",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M115.784 161.512s-3.57-1.488-2.678-7.14",
"stroke": "#648BD8",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M101.52 290.246s4.326 2.057 7.408 1.03c2.842-.948 4.564.673 7.132 1.186 2.57.514 6.925 1.108 11.772-1.269-.104-5.551-6.939-4.01-12.048-6.763-2.582-1.39-3.812-4.757-3.625-8.863h-9.471s-1.402 10.596-1.169 14.68",
"fill": "#CBD1D1"
}, null), createVNode("path", {
"d": "M101.496 290.073s2.447 1.281 6.809.658c3.081-.44 3.74.485 7.479 1.039 3.739.554 10.802-.07 11.91-.9.415 1.108-.347 2.077-.347 2.077s-1.523.608-4.847.831c-2.045.137-5.843.293-7.663-.507-1.8-1.385-5.286-1.917-5.77-.243-3.947.958-7.41-.288-7.41-.288l-.16-2.667z",
"fill": "#2B0849"
}, null), createVNode("path", {
"d": "M108.824 276.19h3.116s-.103 6.751 4.57 8.62c-4.673.624-8.62-2.32-7.686-8.62",
"fill": "#A4AABA"
}, null), createVNode("path", {
"d": "M57.65 272.52s-2.122 7.47-4.518 12.396c-1.811 3.724-4.255 7.548 5.505 7.548 6.698 0 9.02-.483 7.479-6.648-1.541-6.164.268-13.296.268-13.296H57.65z",
"fill": "#CBD1D1"
}, null), createVNode("path", {
"d": "M51.54 290.04s2.111 1.178 6.682 1.178c6.128 0 8.31-1.662 8.31-1.662s.605 1.122-.624 2.18c-1 .862-3.624 1.603-7.444 1.559-4.177-.049-5.876-.57-6.786-1.177-.831-.554-.692-1.593-.138-2.078",
"fill": "#2B0849"
}, null), createVNode("path", {
"d": "M58.533 274.438s.034 1.529-.315 2.95c-.352 1.431-1.087 3.127-1.139 4.17-.058 1.16 4.57 1.592 5.194.035.623-1.559 1.303-6.475 1.927-7.306.622-.831-4.94-2.135-5.667.15",
"fill": "#A4AABA"
}, null), createVNode("path", {
"d": "M100.885 277.015l13.306.092s1.291-54.228 1.843-64.056c.552-9.828 3.756-43.13.997-62.788l-12.48-.64-22.725.776s-.433 3.944-1.19 9.921c-.062.493-.677.838-.744 1.358-.075.582.42 1.347.318 1.956-2.35 14.003-6.343 32.926-8.697 46.425-.116.663-1.227 1.004-1.45 2.677-.04.3.21 1.516.112 1.785-6.836 18.643-10.89 47.584-14.2 61.551l14.528-.014s2.185-8.524 4.008-16.878c2.796-12.817 22.987-84.553 22.987-84.553l3-.517 1.037 46.1s-.223 1.228.334 2.008c.558.782-.556 1.117-.39 2.233l.39 1.784s-.446 7.14-.892 11.826c-.446 4.685-.092 38.954-.092 38.954",
"fill": "#7BB2F9"
}, null), createVNode("path", {
"d": "M77.438 220.434c1.146.094 4.016-2.008 6.916-4.91M107.55 223.931s2.758-1.103 6.069-3.862",
"stroke": "#648BD8",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M108.459 220.905s2.759-1.104 6.07-3.863",
"stroke": "#648BD8",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M76.099 223.557s2.608-.587 6.47-3.346M87.33 150.82c-.27 3.088.297 8.478-4.315 9.073M104.829 149.075s.11 13.936-1.286 14.983c-2.207 1.655-2.975 1.934-2.975 1.934M101.014 149.63s.035 12.81-1.19 24.245M94.93 174.965s7.174-1.655 9.38-1.655M75.671 204.754c-.316 1.55-.64 3.067-.973 4.535 0 0-1.45 1.822-1.003 3.756.446 1.934-.943 2.034-4.96 15.273-1.686 5.559-4.464 18.49-6.313 27.447-.078.38-4.018 18.06-4.093 18.423M77.043 196.743a313.269 313.269 0 0 1-.877 4.729M83.908 151.414l-1.19 10.413s-1.091.148-.496 2.23c.111 1.34-2.66 15.692-5.153 30.267M57.58 272.94h13.238",
"stroke": "#648BD8",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null), createVNode("path", {
"d": "M117.377 147.423s-16.955-3.087-35.7.199c.157 2.501-.002 4.128-.002 4.128s14.607-2.802 35.476-.31c.251-2.342.226-4.017.226-4.017",
"fill": "#192064"
}, null), createVNode("path", {
"d": "M107.511 150.353l.004-4.885a.807.807 0 0 0-.774-.81c-2.428-.092-5.04-.108-7.795-.014a.814.814 0 0 0-.784.81l-.003 4.88c0 .456.371.82.827.808a140.76 140.76 0 0 1 7.688.017.81.81 0 0 0 .837-.806",
"fill": "#FFF"
}, null), createVNode("path", {
"d": "M106.402 149.426l.002-3.06a.64.64 0 0 0-.616-.643 94.135 94.135 0 0 0-5.834-.009.647.647 0 0 0-.626.643l-.001 3.056c0 .36.291.648.651.64 1.78-.04 3.708-.041 5.762.012.36.009.662-.279.662-.64",
"fill": "#192064"
}, null), createVNode("path", {
"d": "M101.485 273.933h12.272M102.652 269.075c.006 3.368.04 5.759.11 6.47M102.667 263.125c-.009 1.53-.015 2.98-.016 4.313M102.204 174.024l.893 44.402s.669 1.561-.224 2.677c-.892 1.116 2.455.67.893 2.231-1.562 1.562.893 1.116 0 3.347-.592 1.48-.988 20.987-1.09 34.956",
"stroke": "#648BD8",
"stroke-width": "1.051",
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null)])]);
};
const genBaseStyle$6 = (token) => {
const {
componentCls,
lineHeightHeading3,
iconCls,
padding,
paddingXL,
paddingXS,
paddingLG,
marginXS,
lineHeight
} = token;
return {
// Result
[componentCls]: {
padding: `${paddingLG * 2}px ${paddingXL}px`,
// RTL
"&-rtl": {
direction: "rtl"
}
},
// Exception Status image
[`${componentCls} ${componentCls}-image`]: {
width: token.imageWidth,
height: token.imageHeight,
margin: "auto"
},
[`${componentCls} ${componentCls}-icon`]: {
marginBottom: paddingLG,
textAlign: "center",
[`& > ${iconCls}`]: {
fontSize: token.resultIconFontSize
}
},
[`${componentCls} ${componentCls}-title`]: {
color: token.colorTextHeading,
fontSize: token.resultTitleFontSize,
lineHeight: lineHeightHeading3,
marginBlock: marginXS,
textAlign: "center"
},
[`${componentCls} ${componentCls}-subtitle`]: {
color: token.colorTextDescription,
fontSize: token.resultSubtitleFontSize,
lineHeight,
textAlign: "center"
},
[`${componentCls} ${componentCls}-content`]: {
marginTop: paddingLG,
padding: `${paddingLG}px ${padding * 2.5}px`,
backgroundColor: token.colorFillAlter
},
[`${componentCls} ${componentCls}-extra`]: {
margin: token.resultExtraMargin,
textAlign: "center",
"& > *": {
marginInlineEnd: paddingXS,
"&:last-child": {
marginInlineEnd: 0
}
}
}
};
};
const genStatusIconStyle = (token) => {
const {
componentCls,
iconCls
} = token;
return {
[`${componentCls}-success ${componentCls}-icon > ${iconCls}`]: {
color: token.resultSuccessIconColor
},
[`${componentCls}-error ${componentCls}-icon > ${iconCls}`]: {
color: token.resultErrorIconColor
},
[`${componentCls}-info ${componentCls}-icon > ${iconCls}`]: {
color: token.resultInfoIconColor
},
[`${componentCls}-warning ${componentCls}-icon > ${iconCls}`]: {
color: token.resultWarningIconColor
}
};
};
const genResultStyle = (token) => [genBaseStyle$6(token), genStatusIconStyle(token)];
const getStyle = (token) => genResultStyle(token);
const useStyle$e = genComponentStyleHook("Result", (token) => {
const {
paddingLG,
fontSizeHeading3
} = token;
const resultSubtitleFontSize = token.fontSize;
const resultExtraMargin = `${paddingLG}px 0 0 0`;
const resultInfoIconColor = token.colorInfo;
const resultErrorIconColor = token.colorError;
const resultSuccessIconColor = token.colorSuccess;
const resultWarningIconColor = token.colorWarning;
const resultToken = merge(token, {
resultTitleFontSize: fontSizeHeading3,
resultSubtitleFontSize,
resultIconFontSize: fontSizeHeading3 * 3,
resultExtraMargin,
resultInfoIconColor,
resultErrorIconColor,
resultSuccessIconColor,
resultWarningIconColor
});
return [getStyle(resultToken)];
}, {
imageWidth: 250,
imageHeight: 295
});
const IconMap = {
success: CheckCircleFilled,
error: CloseCircleFilled,
info: ExclamationCircleFilled,
warning: WarningFilled
};
const ExceptionMap = {
"404": NoFound,
"500": ServerError,
"403": Unauthorized
};
const ExceptionStatus = Object.keys(ExceptionMap);
const resultProps = () => ({
prefixCls: String,
icon: PropTypes.any,
status: {
type: [Number, String],
default: "info"
},
title: PropTypes.any,
subTitle: PropTypes.any,
extra: PropTypes.any
});
const renderIcon = (prefixCls, _ref) => {
let {
status,
icon
} = _ref;
if (ExceptionStatus.includes(`${status}`)) {
const SVGComponent = ExceptionMap[status];
return createVNode("div", {
"class": `${prefixCls}-icon ${prefixCls}-image`
}, [createVNode(SVGComponent, null, null)]);
}
const IconComponent = IconMap[status];
const iconNode = icon || createVNode(IconComponent, null, null);
return createVNode("div", {
"class": `${prefixCls}-icon`
}, [iconNode]);
};
const renderExtra = (prefixCls, extra) => extra && createVNode("div", {
"class": `${prefixCls}-extra`
}, [extra]);
const Result = defineComponent({
compatConfig: {
MODE: 3
},
name: "AResult",
inheritAttrs: false,
props: resultProps(),
slots: Object,
setup(props2, _ref2) {
let {
slots,
attrs
} = _ref2;
const {
prefixCls,
direction
} = useConfigInject("result", props2);
const [wrapSSR, hashId] = useStyle$e(prefixCls);
const className = computed(() => classNames(prefixCls.value, hashId.value, `${prefixCls.value}-${props2.status}`, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}));
return () => {
var _a, _b, _c, _d, _e, _f, _g, _h;
const title = (_a = props2.title) !== null && _a !== void 0 ? _a : (_b = slots.title) === null || _b === void 0 ? void 0 : _b.call(slots);
const subTitle = (_c = props2.subTitle) !== null && _c !== void 0 ? _c : (_d = slots.subTitle) === null || _d === void 0 ? void 0 : _d.call(slots);
const icon = (_e = props2.icon) !== null && _e !== void 0 ? _e : (_f = slots.icon) === null || _f === void 0 ? void 0 : _f.call(slots);
const extra = (_g = props2.extra) !== null && _g !== void 0 ? _g : (_h = slots.extra) === null || _h === void 0 ? void 0 : _h.call(slots);
const pre = prefixCls.value;
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": [className.value, attrs.class]
}), [renderIcon(pre, {
status: props2.status,
icon
}), createVNode("div", {
"class": `${pre}-title`
}, [title]), subTitle && createVNode("div", {
"class": `${pre}-subtitle`
}, [subTitle]), renderExtra(pre, extra), slots.default && createVNode("div", {
"class": `${pre}-content`
}, [slots.default()])]));
};
}
});
Result.PRESENTED_IMAGE_403 = ExceptionMap[403];
Result.PRESENTED_IMAGE_404 = ExceptionMap[404];
Result.PRESENTED_IMAGE_500 = ExceptionMap[500];
Result.install = function(app) {
app.component(Result.name, Result);
return app;
};
const index$b = withInstall(ARow);
const Track = (_, _ref) => {
let {
attrs
} = _ref;
const {
included,
vertical,
style,
class: className
} = attrs;
let {
length,
offset: offset2,
reverse
} = attrs;
if (length < 0) {
reverse = !reverse;
length = Math.abs(length);
offset2 = 100 - offset2;
}
const positionStyle = vertical ? {
[reverse ? "top" : "bottom"]: `${offset2}%`,
[reverse ? "bottom" : "top"]: "auto",
height: `${length}%`
} : {
[reverse ? "right" : "left"]: `${offset2}%`,
[reverse ? "left" : "right"]: "auto",
width: `${length}%`
};
const elStyle = _extends(_extends({}, style), positionStyle);
return included ? createVNode("div", {
"class": className,
"style": elStyle
}, null) : null;
};
Track.inheritAttrs = false;
const calcPoints = (_vertical, marks, dots, step, min, max) => {
const points = Object.keys(marks).map(parseFloat).sort((a, b) => a - b);
if (dots && step) {
for (let i = min; i <= max; i += step) {
if (points.indexOf(i) === -1) {
points.push(i);
}
}
}
return points;
};
const Steps$2 = (_, _ref) => {
let {
attrs
} = _ref;
const {
prefixCls,
vertical,
reverse,
marks,
dots,
step,
included,
lowerBound,
upperBound,
max,
min,
dotStyle,
activeDotStyle
} = attrs;
const range = max - min;
const elements = calcPoints(vertical, marks, dots, step, min, max).map((point) => {
const offset2 = `${Math.abs(point - min) / range * 100}%`;
const isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
let style = vertical ? _extends(_extends({}, dotStyle), {
[reverse ? "top" : "bottom"]: offset2
}) : _extends(_extends({}, dotStyle), {
[reverse ? "right" : "left"]: offset2
});
if (isActived) {
style = _extends(_extends({}, style), activeDotStyle);
}
const pointClassName = classNames({
[`${prefixCls}-dot`]: true,
[`${prefixCls}-dot-active`]: isActived,
[`${prefixCls}-dot-reverse`]: reverse
});
return createVNode("span", {
"class": pointClassName,
"style": style,
"key": point
}, null);
});
return createVNode("div", {
"class": `${prefixCls}-step`
}, [elements]);
};
Steps$2.inheritAttrs = false;
const Marks = (_, _ref) => {
let {
attrs,
slots
} = _ref;
const {
class: className,
vertical,
reverse,
marks,
included,
upperBound,
lowerBound,
max,
min,
onClickLabel
} = attrs;
const marksKeys = Object.keys(marks);
const customMark = slots.mark;
const range = max - min;
const elements = marksKeys.map(parseFloat).sort((a, b) => a - b).map((point) => {
const markPoint = typeof marks[point] === "function" ? marks[point]() : marks[point];
const markPointIsObject = typeof markPoint === "object" && !isValidElement(markPoint);
let markLabel = markPointIsObject ? markPoint.label : markPoint;
if (!markLabel && markLabel !== 0) {
return null;
}
if (customMark) {
markLabel = customMark({
point,
label: markLabel
});
}
const isActive = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
const markClassName = classNames({
[`${className}-text`]: true,
[`${className}-text-active`]: isActive
});
const bottomStyle = {
marginBottom: "-50%",
[reverse ? "top" : "bottom"]: `${(point - min) / range * 100}%`
};
const leftStyle = {
transform: `translateX(${reverse ? `50%` : `-50%`})`,
msTransform: `translateX(${reverse ? `50%` : `-50%`})`,
[reverse ? "right" : "left"]: `${(point - min) / range * 100}%`
};
const style = vertical ? bottomStyle : leftStyle;
const markStyle = markPointIsObject ? _extends(_extends({}, style), markPoint.style) : style;
const touchEvents = {
[supportsPassive ? "onTouchstartPassive" : "onTouchstart"]: (e) => onClickLabel(e, point)
};
return createVNode("span", _objectSpread$W({
"class": markClassName,
"style": markStyle,
"key": point,
"onMousedown": (e) => onClickLabel(e, point)
}, touchEvents), [markLabel]);
});
return createVNode("div", {
"class": className
}, [elements]);
};
Marks.inheritAttrs = false;
const VcHandle = defineComponent({
compatConfig: {
MODE: 3
},
name: "Handle",
inheritAttrs: false,
props: {
prefixCls: String,
vertical: {
type: Boolean,
default: void 0
},
offset: Number,
disabled: {
type: Boolean,
default: void 0
},
min: Number,
max: Number,
value: Number,
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
reverse: {
type: Boolean,
default: void 0
},
ariaLabel: String,
ariaLabelledBy: String,
ariaValueTextFormatter: Function,
onMouseenter: {
type: Function
},
onMouseleave: {
type: Function
},
onMousedown: {
type: Function
}
},
setup(props2, _ref) {
let {
attrs,
emit,
expose
} = _ref;
const clickFocused = shallowRef(false);
const handle = shallowRef();
const handleBlur = (e) => {
clickFocused.value = false;
emit("blur", e);
};
const handleKeyDown = () => {
clickFocused.value = false;
};
const focus = () => {
var _a;
(_a = handle.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = handle.value) === null || _a === void 0 ? void 0 : _a.blur();
};
const clickFocus = () => {
clickFocused.value = true;
focus();
};
const handleMousedown = (e) => {
e.preventDefault();
focus();
emit("mousedown", e);
};
expose({
focus,
blur,
clickFocus,
ref: handle
});
const positionStyle = computed(() => {
const {
vertical,
offset: offset2,
reverse
} = props2;
return vertical ? {
[reverse ? "top" : "bottom"]: `${offset2}%`,
[reverse ? "bottom" : "top"]: "auto",
transform: reverse ? null : `translateY(+50%)`
} : {
[reverse ? "right" : "left"]: `${offset2}%`,
[reverse ? "left" : "right"]: "auto",
transform: `translateX(${reverse ? "+" : "-"}50%)`
};
});
return () => {
const {
prefixCls,
disabled,
min,
max,
value,
tabindex,
ariaLabel,
ariaLabelledBy,
ariaValueTextFormatter,
onMouseenter,
onMouseleave
} = props2;
const className = classNames(attrs.class, {
[`${prefixCls}-handle-click-focused`]: clickFocused.value
});
const ariaProps = {
"aria-valuemin": min,
"aria-valuemax": max,
"aria-valuenow": value,
"aria-disabled": !!disabled
};
const elStyle = [attrs.style, positionStyle.value];
let mergedTabIndex = tabindex || 0;
if (disabled || tabindex === null) {
mergedTabIndex = null;
}
let ariaValueText;
if (ariaValueTextFormatter) {
ariaValueText = ariaValueTextFormatter(value);
}
const handleProps = _extends(_extends(_extends(_extends({}, attrs), {
role: "slider",
tabindex: mergedTabIndex
}), ariaProps), {
class: className,
onBlur: handleBlur,
onKeydown: handleKeyDown,
onMousedown: handleMousedown,
onMouseenter,
onMouseleave,
ref: handle,
style: elStyle
});
return createVNode("div", _objectSpread$W(_objectSpread$W({}, handleProps), {}, {
"aria-label": ariaLabel,
"aria-labelledby": ariaLabelledBy,
"aria-valuetext": ariaValueText
}), null);
};
}
});
function isEventFromHandle(e, handles) {
try {
return Object.keys(handles).some((key2) => e.target === handles[key2].ref);
} catch (error) {
return false;
}
}
function isValueOutOfRange(value, _ref) {
let {
min,
max
} = _ref;
return value < min || value > max;
}
function isNotTouchEvent(e) {
return e.touches.length > 1 || e.type.toLowerCase() === "touchend" && e.touches.length > 0;
}
function getClosestPoint(val, _ref2) {
let {
marks,
step,
min,
max
} = _ref2;
const points = Object.keys(marks).map(parseFloat);
if (step !== null) {
const baseNum = Math.pow(10, getPrecision(step));
const maxSteps = Math.floor((max * baseNum - min * baseNum) / (step * baseNum));
const steps = Math.min((val - min) / step, maxSteps);
const closestStep = Math.round(steps) * step + min;
points.push(closestStep);
}
const diffs = points.map((point) => Math.abs(val - point));
return points[diffs.indexOf(Math.min(...diffs))];
}
function getPrecision(step) {
const stepString = step.toString();
let precision = 0;
if (stepString.indexOf(".") >= 0) {
precision = stepString.length - stepString.indexOf(".") - 1;
}
return precision;
}
function getMousePosition(vertical, e) {
let zoom = 1;
if ((void 0).visualViewport) {
zoom = +((void 0).visualViewport.width / (void 0).body.getBoundingClientRect().width).toFixed(2);
}
return (vertical ? e.clientY : e.pageX) / zoom;
}
function getTouchPosition(vertical, e) {
let zoom = 1;
if ((void 0).visualViewport) {
zoom = +((void 0).visualViewport.width / (void 0).body.getBoundingClientRect().width).toFixed(2);
}
return (vertical ? e.touches[0].clientY : e.touches[0].pageX) / zoom;
}
function getHandleCenterPosition(vertical, handle) {
const coords = handle.getBoundingClientRect();
return vertical ? coords.top + coords.height * 0.5 : (void 0).scrollX + coords.left + coords.width * 0.5;
}
function ensureValueInRange(val, _ref3) {
let {
max,
min
} = _ref3;
if (val <= min) {
return min;
}
if (val >= max) {
return max;
}
return val;
}
function ensureValuePrecision(val, props2) {
const {
step
} = props2;
const closestPoint = isFinite(getClosestPoint(val, props2)) ? getClosestPoint(val, props2) : 0;
return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step)));
}
function pauseEvent(e) {
e.stopPropagation();
e.preventDefault();
}
function calculateNextValue(func, value, props2) {
const operations = {
increase: (a, b) => a + b,
decrease: (a, b) => a - b
};
const indexToGet = operations[func](Object.keys(props2.marks).indexOf(JSON.stringify(value)), 1);
const keyToGet = Object.keys(props2.marks)[indexToGet];
if (props2.step) {
return operations[func](value, props2.step);
}
if (!!Object.keys(props2.marks).length && !!props2.marks[keyToGet]) {
return props2.marks[keyToGet];
}
return value;
}
function getKeyboardValueMutator(e, vertical, reverse) {
const increase = "increase";
const decrease = "decrease";
let method = increase;
switch (e.keyCode) {
case KeyCode.UP:
method = vertical && reverse ? decrease : increase;
break;
case KeyCode.RIGHT:
method = !vertical && reverse ? decrease : increase;
break;
case KeyCode.DOWN:
method = vertical && reverse ? increase : decrease;
break;
case KeyCode.LEFT:
method = !vertical && reverse ? increase : decrease;
break;
case KeyCode.END:
return (_value, props2) => props2.max;
case KeyCode.HOME:
return (_value, props2) => props2.min;
case KeyCode.PAGE_UP:
return (value, props2) => value + props2.step * 2;
case KeyCode.PAGE_DOWN:
return (value, props2) => value - props2.step * 2;
default:
return void 0;
}
return (value, props2) => calculateNextValue(method, value, props2);
}
var __rest$l = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function noop$4() {
}
function createSlider(Component) {
const propTypes2 = {
id: String,
min: Number,
max: Number,
step: Number,
marks: PropTypes.object,
included: {
type: Boolean,
default: void 0
},
prefixCls: String,
disabled: {
type: Boolean,
default: void 0
},
handle: Function,
dots: {
type: Boolean,
default: void 0
},
vertical: {
type: Boolean,
default: void 0
},
reverse: {
type: Boolean,
default: void 0
},
minimumTrackStyle: PropTypes.object,
maximumTrackStyle: PropTypes.object,
handleStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]),
trackStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]),
railStyle: PropTypes.object,
dotStyle: PropTypes.object,
activeDotStyle: PropTypes.object,
autofocus: {
type: Boolean,
default: void 0
},
draggableTrack: {
type: Boolean,
default: void 0
}
};
return defineComponent({
compatConfig: {
MODE: 3
},
name: "CreateSlider",
mixins: [BaseMixin, Component],
inheritAttrs: false,
props: initDefaultProps(propTypes2, {
prefixCls: "rc-slider",
min: 0,
max: 100,
step: 1,
marks: {},
included: true,
disabled: false,
dots: false,
vertical: false,
reverse: false,
trackStyle: [{}],
handleStyle: [{}],
railStyle: {},
dotStyle: {},
activeDotStyle: {}
}),
emits: ["change", "blur", "focus"],
data() {
const {
step,
max,
min
} = this;
this.handlesRefs = {};
return {};
},
mounted() {
this.$nextTick(() => {
this.document = this.sliderRef && this.sliderRef.ownerDocument;
const {
autofocus,
disabled
} = this;
if (autofocus && !disabled) {
this.focus();
}
});
},
beforeUnmount() {
this.$nextTick(() => {
this.removeDocumentEvents();
});
},
methods: {
defaultHandle(_a) {
var {
index: index2,
directives,
className,
style
} = _a, restProps = __rest$l(_a, ["index", "directives", "className", "style"]);
delete restProps.dragging;
if (restProps.value === null) {
return null;
}
const handleProps = _extends(_extends({}, restProps), {
class: className,
style,
key: index2
});
return createVNode(VcHandle, handleProps, null);
},
onDown(e, position) {
let p = position;
const {
draggableTrack,
vertical: isVertical
} = this.$props;
const {
bounds
} = this.$data;
const value = draggableTrack && this.positionGetValue ? this.positionGetValue(p) || [] : [];
const inPoint = isEventFromHandle(e, this.handlesRefs);
this.dragTrack = draggableTrack && bounds.length >= 2 && !inPoint && !value.map((n, i) => {
const v = !i ? n >= bounds[i] : true;
return i === value.length - 1 ? n <= bounds[i] : v;
}).some((c) => !c);
if (this.dragTrack) {
this.dragOffset = p;
this.startBounds = [...bounds];
} else {
if (!inPoint) {
this.dragOffset = 0;
} else {
const handlePosition = getHandleCenterPosition(isVertical, e.target);
this.dragOffset = p - handlePosition;
p = handlePosition;
}
this.onStart(p);
}
},
onMouseDown(e) {
if (e.button !== 0) {
return;
}
this.removeDocumentEvents();
const isVertical = this.$props.vertical;
const position = getMousePosition(isVertical, e);
this.onDown(e, position);
this.addDocumentMouseEvents();
},
onTouchStart(e) {
if (isNotTouchEvent(e)) return;
const isVertical = this.vertical;
const position = getTouchPosition(isVertical, e);
this.onDown(e, position);
this.addDocumentTouchEvents();
pauseEvent(e);
},
onFocus(e) {
const {
vertical
} = this;
if (isEventFromHandle(e, this.handlesRefs) && !this.dragTrack) {
const handlePosition = getHandleCenterPosition(vertical, e.target);
this.dragOffset = 0;
this.onStart(handlePosition);
pauseEvent(e);
this.$emit("focus", e);
}
},
onBlur(e) {
if (!this.dragTrack) {
this.onEnd();
}
this.$emit("blur", e);
},
onMouseUp() {
if (this.handlesRefs[this.prevMovedHandleIndex]) {
this.handlesRefs[this.prevMovedHandleIndex].clickFocus();
}
},
onMouseMove(e) {
if (!this.sliderRef) {
this.onEnd();
return;
}
const position = getMousePosition(this.vertical, e);
this.onMove(e, position - this.dragOffset, this.dragTrack, this.startBounds);
},
onTouchMove(e) {
if (isNotTouchEvent(e) || !this.sliderRef) {
this.onEnd();
return;
}
const position = getTouchPosition(this.vertical, e);
this.onMove(e, position - this.dragOffset, this.dragTrack, this.startBounds);
},
onKeyDown(e) {
if (this.sliderRef && isEventFromHandle(e, this.handlesRefs)) {
this.onKeyboard(e);
}
},
onClickMarkLabel(e, value) {
e.stopPropagation();
this.onChange({
sValue: value
});
this.setState({
sValue: value
}, () => this.onEnd(true));
},
getSliderStart() {
const slider = this.sliderRef;
const {
vertical,
reverse
} = this;
const rect = slider.getBoundingClientRect();
if (vertical) {
return reverse ? rect.bottom : rect.top;
}
return (void 0).scrollX + (reverse ? rect.right : rect.left);
},
getSliderLength() {
const slider = this.sliderRef;
if (!slider) {
return 0;
}
const coords = slider.getBoundingClientRect();
return this.vertical ? coords.height : coords.width;
},
addDocumentTouchEvents() {
this.onTouchMoveListener = addEventListenerWrap(this.document, "touchmove", this.onTouchMove);
this.onTouchUpListener = addEventListenerWrap(this.document, "touchend", this.onEnd);
},
addDocumentMouseEvents() {
this.onMouseMoveListener = addEventListenerWrap(this.document, "mousemove", this.onMouseMove);
this.onMouseUpListener = addEventListenerWrap(this.document, "mouseup", this.onEnd);
},
removeDocumentEvents() {
this.onTouchMoveListener && this.onTouchMoveListener.remove();
this.onTouchUpListener && this.onTouchUpListener.remove();
this.onMouseMoveListener && this.onMouseMoveListener.remove();
this.onMouseUpListener && this.onMouseUpListener.remove();
},
focus() {
var _a;
if (this.$props.disabled) {
return;
}
(_a = this.handlesRefs[0]) === null || _a === void 0 ? void 0 : _a.focus();
},
blur() {
if (this.$props.disabled) {
return;
}
Object.keys(this.handlesRefs).forEach((key2) => {
var _a, _b;
(_b = (_a = this.handlesRefs[key2]) === null || _a === void 0 ? void 0 : _a.blur) === null || _b === void 0 ? void 0 : _b.call(_a);
});
},
calcValue(offset2) {
const {
vertical,
min,
max
} = this;
const ratio = Math.abs(Math.max(offset2, 0) / this.getSliderLength());
const value = vertical ? (1 - ratio) * (max - min) + min : ratio * (max - min) + min;
return value;
},
calcValueByPos(position) {
const sign = this.reverse ? -1 : 1;
const pixelOffset = sign * (position - this.getSliderStart());
const nextValue = this.trimAlignValue(this.calcValue(pixelOffset));
return nextValue;
},
calcOffset(value) {
const {
min,
max
} = this;
const ratio = (value - min) / (max - min);
return Math.max(0, ratio * 100);
},
saveSlider(slider) {
this.sliderRef = slider;
},
saveHandle(index2, handle) {
this.handlesRefs[index2] = handle;
}
},
render() {
const {
prefixCls,
marks,
dots,
step,
included,
disabled,
vertical,
reverse,
min,
max,
maximumTrackStyle,
railStyle,
dotStyle,
activeDotStyle,
id
} = this;
const {
class: className,
style
} = this.$attrs;
const {
tracks,
handles
} = this.renderSlider();
const sliderClassName = classNames(prefixCls, className, {
[`${prefixCls}-with-marks`]: Object.keys(marks).length,
[`${prefixCls}-disabled`]: disabled,
[`${prefixCls}-vertical`]: vertical,
[`${prefixCls}-horizontal`]: !vertical
});
const markProps = {
vertical,
marks,
included,
lowerBound: this.getLowerBound(),
upperBound: this.getUpperBound(),
max,
min,
reverse,
class: `${prefixCls}-mark`,
onClickLabel: disabled ? noop$4 : this.onClickMarkLabel
};
const touchEvents = {
[supportsPassive ? "onTouchstartPassive" : "onTouchstart"]: disabled ? noop$4 : this.onTouchStart
};
return createVNode("div", _objectSpread$W(_objectSpread$W({
"id": id,
"ref": this.saveSlider,
"tabindex": "-1",
"class": sliderClassName
}, touchEvents), {}, {
"onMousedown": disabled ? noop$4 : this.onMouseDown,
"onMouseup": disabled ? noop$4 : this.onMouseUp,
"onKeydown": disabled ? noop$4 : this.onKeyDown,
"onFocus": disabled ? noop$4 : this.onFocus,
"onBlur": disabled ? noop$4 : this.onBlur,
"style": style
}), [createVNode("div", {
"class": `${prefixCls}-rail`,
"style": _extends(_extends({}, maximumTrackStyle), railStyle)
}, null), tracks, createVNode(Steps$2, {
"prefixCls": prefixCls,
"vertical": vertical,
"reverse": reverse,
"marks": marks,
"dots": dots,
"step": step,
"included": included,
"lowerBound": this.getLowerBound(),
"upperBound": this.getUpperBound(),
"max": max,
"min": min,
"dotStyle": dotStyle,
"activeDotStyle": activeDotStyle
}, null), handles, createVNode(Marks, markProps, {
mark: this.$slots.mark
}), getSlot(this)]);
}
});
}
const Slider$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Slider",
mixins: [BaseMixin],
inheritAttrs: false,
props: {
defaultValue: Number,
value: Number,
disabled: {
type: Boolean,
default: void 0
},
autofocus: {
type: Boolean,
default: void 0
},
tabindex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
reverse: {
type: Boolean,
default: void 0
},
min: Number,
max: Number,
ariaLabelForHandle: String,
ariaLabelledByForHandle: String,
ariaValueTextFormatterForHandle: String,
startPoint: Number
},
emits: ["beforeChange", "afterChange", "change"],
data() {
const defaultValue = this.defaultValue !== void 0 ? this.defaultValue : this.min;
const value = this.value !== void 0 ? this.value : defaultValue;
return {
sValue: this.trimAlignValue(value),
dragging: false
};
},
watch: {
value: {
handler(val) {
this.setChangeValue(val);
},
deep: true
},
min() {
const {
sValue
} = this;
this.setChangeValue(sValue);
},
max() {
const {
sValue
} = this;
this.setChangeValue(sValue);
}
},
methods: {
setChangeValue(value) {
const newValue = value !== void 0 ? value : this.sValue;
const nextValue = this.trimAlignValue(newValue, this.$props);
if (nextValue === this.sValue) return;
this.setState({
sValue: nextValue
});
if (isValueOutOfRange(newValue, this.$props)) {
this.$emit("change", nextValue);
}
},
onChange(state) {
const isNotControlled = !hasProp(this, "value");
const nextState = state.sValue > this.max ? _extends(_extends({}, state), {
sValue: this.max
}) : state;
if (isNotControlled) {
this.setState(nextState);
}
const changedValue = nextState.sValue;
this.$emit("change", changedValue);
},
onStart(position) {
this.setState({
dragging: true
});
const {
sValue
} = this;
this.$emit("beforeChange", sValue);
const value = this.calcValueByPos(position);
this.startValue = value;
this.startPosition = position;
if (value === sValue) return;
this.prevMovedHandleIndex = 0;
this.onChange({
sValue: value
});
},
onEnd(force) {
const {
dragging
} = this;
this.removeDocumentEvents();
if (dragging || force) {
this.$emit("afterChange", this.sValue);
}
this.setState({
dragging: false
});
},
onMove(e, position) {
pauseEvent(e);
const {
sValue
} = this;
const value = this.calcValueByPos(position);
if (value === sValue) return;
this.onChange({
sValue: value
});
},
onKeyboard(e) {
const {
reverse,
vertical
} = this.$props;
const valueMutator = getKeyboardValueMutator(e, vertical, reverse);
if (valueMutator) {
pauseEvent(e);
const {
sValue
} = this;
const mutatedValue = valueMutator(sValue, this.$props);
const value = this.trimAlignValue(mutatedValue);
if (value === sValue) return;
this.onChange({
sValue: value
});
this.$emit("afterChange", value);
this.onEnd();
}
},
getLowerBound() {
const minPoint = this.$props.startPoint || this.$props.min;
return this.$data.sValue > minPoint ? minPoint : this.$data.sValue;
},
getUpperBound() {
if (this.$data.sValue < this.$props.startPoint) {
return this.$props.startPoint;
}
return this.$data.sValue;
},
trimAlignValue(v) {
let nextProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
if (v === null) {
return null;
}
const mergedProps = _extends(_extends({}, this.$props), nextProps);
const val = ensureValueInRange(v, mergedProps);
return ensureValuePrecision(val, mergedProps);
},
getTrack(_ref) {
let {
prefixCls,
reverse,
vertical,
included,
minimumTrackStyle,
mergedTrackStyle,
length,
offset: offset2
} = _ref;
return createVNode(Track, {
"class": `${prefixCls}-track`,
"vertical": vertical,
"included": included,
"offset": offset2,
"reverse": reverse,
"length": length,
"style": _extends(_extends({}, minimumTrackStyle), mergedTrackStyle)
}, null);
},
renderSlider() {
const {
prefixCls,
vertical,
included,
disabled,
minimumTrackStyle,
trackStyle,
handleStyle,
tabindex,
ariaLabelForHandle,
ariaLabelledByForHandle,
ariaValueTextFormatterForHandle,
min,
max,
startPoint,
reverse,
handle,
defaultHandle
} = this;
const handleGenerator = handle || defaultHandle;
const {
sValue,
dragging
} = this;
const offset2 = this.calcOffset(sValue);
const handles = handleGenerator({
class: `${prefixCls}-handle`,
prefixCls,
vertical,
offset: offset2,
value: sValue,
dragging,
disabled,
min,
max,
reverse,
index: 0,
tabindex,
ariaLabel: ariaLabelForHandle,
ariaLabelledBy: ariaLabelledByForHandle,
ariaValueTextFormatter: ariaValueTextFormatterForHandle,
style: handleStyle[0] || handleStyle,
ref: (h2) => this.saveHandle(0, h2),
onFocus: this.onFocus,
onBlur: this.onBlur
});
const trackOffset = startPoint !== void 0 ? this.calcOffset(startPoint) : 0;
const mergedTrackStyle = trackStyle[0] || trackStyle;
return {
tracks: this.getTrack({
prefixCls,
reverse,
vertical,
included,
offset: trackOffset,
minimumTrackStyle,
mergedTrackStyle,
length: offset2 - trackOffset
}),
handles
};
}
}
});
const VcSlider = createSlider(Slider$2);
const trimAlignValue = (_ref) => {
let {
value,
handle,
bounds,
props: props2
} = _ref;
const {
allowCross,
pushable
} = props2;
const thershold = Number(pushable);
const valInRange = ensureValueInRange(value, props2);
let valNotConflict = valInRange;
if (!allowCross && handle != null && bounds !== void 0) {
if (handle > 0 && valInRange <= bounds[handle - 1] + thershold) {
valNotConflict = bounds[handle - 1] + thershold;
}
if (handle < bounds.length - 1 && valInRange >= bounds[handle + 1] - thershold) {
valNotConflict = bounds[handle + 1] - thershold;
}
}
return ensureValuePrecision(valNotConflict, props2);
};
const rangeProps = {
defaultValue: PropTypes.arrayOf(PropTypes.number),
value: PropTypes.arrayOf(PropTypes.number),
count: Number,
pushable: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, PropTypes.number])),
allowCross: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
reverse: {
type: Boolean,
default: void 0
},
tabindex: PropTypes.arrayOf(PropTypes.number),
prefixCls: String,
min: Number,
max: Number,
autofocus: {
type: Boolean,
default: void 0
},
ariaLabelGroupForHandles: Array,
ariaLabelledByGroupForHandles: Array,
ariaValueTextFormatterGroupForHandles: Array,
draggableTrack: {
type: Boolean,
default: void 0
}
};
const Range = defineComponent({
compatConfig: {
MODE: 3
},
name: "Range",
mixins: [BaseMixin],
inheritAttrs: false,
props: initDefaultProps(rangeProps, {
count: 1,
allowCross: true,
pushable: false,
tabindex: [],
draggableTrack: false,
ariaLabelGroupForHandles: [],
ariaLabelledByGroupForHandles: [],
ariaValueTextFormatterGroupForHandles: []
}),
emits: ["beforeChange", "afterChange", "change"],
displayName: "Range",
data() {
const {
count,
min,
max
} = this;
const initialValue = Array(...Array(count + 1)).map(() => min);
const defaultValue = hasProp(this, "defaultValue") ? this.defaultValue : initialValue;
let {
value
} = this;
if (value === void 0) {
value = defaultValue;
}
const bounds = value.map((v, i) => trimAlignValue({
value: v,
handle: i,
props: this.$props
}));
const recent = bounds[0] === max ? 0 : bounds.length - 1;
return {
sHandle: null,
recent,
bounds
};
},
watch: {
value: {
handler(val) {
const {
bounds
} = this;
this.setChangeValue(val || bounds);
},
deep: true
},
min() {
const {
value
} = this;
this.setChangeValue(value || this.bounds);
},
max() {
const {
value
} = this;
this.setChangeValue(value || this.bounds);
}
},
methods: {
setChangeValue(value) {
const {
bounds
} = this;
let nextBounds = value.map((v, i) => trimAlignValue({
value: v,
handle: i,
bounds,
props: this.$props
}));
if (bounds.length === nextBounds.length) {
if (nextBounds.every((v, i) => v === bounds[i])) {
return null;
}
} else {
nextBounds = value.map((v, i) => trimAlignValue({
value: v,
handle: i,
props: this.$props
}));
}
this.setState({
bounds: nextBounds
});
if (value.some((v) => isValueOutOfRange(v, this.$props))) {
const newValues = value.map((v) => {
return ensureValueInRange(v, this.$props);
});
this.$emit("change", newValues);
}
},
onChange(state) {
const isNotControlled = !hasProp(this, "value");
if (isNotControlled) {
this.setState(state);
} else {
const controlledState = {};
["sHandle", "recent"].forEach((item) => {
if (state[item] !== void 0) {
controlledState[item] = state[item];
}
});
if (Object.keys(controlledState).length) {
this.setState(controlledState);
}
}
const data = _extends(_extends({}, this.$data), state);
const changedValue = data.bounds;
this.$emit("change", changedValue);
},
positionGetValue(position) {
const bounds = this.getValue();
const value = this.calcValueByPos(position);
const closestBound = this.getClosestBound(value);
const index2 = this.getBoundNeedMoving(value, closestBound);
const prevValue = bounds[index2];
if (value === prevValue) return null;
const nextBounds = [...bounds];
nextBounds[index2] = value;
return nextBounds;
},
onStart(position) {
const {
bounds
} = this;
this.$emit("beforeChange", bounds);
const value = this.calcValueByPos(position);
this.startValue = value;
this.startPosition = position;
const closestBound = this.getClosestBound(value);
this.prevMovedHandleIndex = this.getBoundNeedMoving(value, closestBound);
this.setState({
sHandle: this.prevMovedHandleIndex,
recent: this.prevMovedHandleIndex
});
const prevValue = bounds[this.prevMovedHandleIndex];
if (value === prevValue) return;
const nextBounds = [...bounds];
nextBounds[this.prevMovedHandleIndex] = value;
this.onChange({
bounds: nextBounds
});
},
onEnd(force) {
const {
sHandle
} = this;
this.removeDocumentEvents();
if (!sHandle) {
this.dragTrack = false;
}
if (sHandle !== null || force) {
this.$emit("afterChange", this.bounds);
}
this.setState({
sHandle: null
});
},
onMove(e, position, dragTrack, startBounds) {
pauseEvent(e);
const {
$data: state,
$props: props2
} = this;
const maxValue = props2.max || 100;
const minValue = props2.min || 0;
if (dragTrack) {
let pos = props2.vertical ? -position : position;
pos = props2.reverse ? -pos : pos;
const max = maxValue - Math.max(...startBounds);
const min = minValue - Math.min(...startBounds);
const ratio = Math.min(Math.max(pos / (this.getSliderLength() / 100), min), max);
const nextBounds = startBounds.map((v) => Math.floor(Math.max(Math.min(v + ratio, maxValue), minValue)));
if (state.bounds.map((c, i) => c === nextBounds[i]).some((c) => !c)) {
this.onChange({
bounds: nextBounds
});
}
return;
}
const {
bounds,
sHandle
} = this;
const value = this.calcValueByPos(position);
const oldValue = bounds[sHandle];
if (value === oldValue) return;
this.moveTo(value);
},
onKeyboard(e) {
const {
reverse,
vertical
} = this.$props;
const valueMutator = getKeyboardValueMutator(e, vertical, reverse);
if (valueMutator) {
pauseEvent(e);
const {
bounds,
sHandle
} = this;
const oldValue = bounds[sHandle === null ? this.recent : sHandle];
const mutatedValue = valueMutator(oldValue, this.$props);
const value = trimAlignValue({
value: mutatedValue,
handle: sHandle,
bounds,
props: this.$props
});
if (value === oldValue) return;
const isFromKeyboardEvent = true;
this.moveTo(value, isFromKeyboardEvent);
}
},
getClosestBound(value) {
const {
bounds
} = this;
let closestBound = 0;
for (let i = 1; i < bounds.length - 1; i += 1) {
if (value >= bounds[i]) {
closestBound = i;
}
}
if (Math.abs(bounds[closestBound + 1] - value) < Math.abs(bounds[closestBound] - value)) {
closestBound += 1;
}
return closestBound;
},
getBoundNeedMoving(value, closestBound) {
const {
bounds,
recent
} = this;
let boundNeedMoving = closestBound;
const isAtTheSamePoint = bounds[closestBound + 1] === bounds[closestBound];
if (isAtTheSamePoint && bounds[recent] === bounds[closestBound]) {
boundNeedMoving = recent;
}
if (isAtTheSamePoint && value !== bounds[closestBound + 1]) {
boundNeedMoving = value < bounds[closestBound + 1] ? closestBound : closestBound + 1;
}
return boundNeedMoving;
},
getLowerBound() {
return this.bounds[0];
},
getUpperBound() {
const {
bounds
} = this;
return bounds[bounds.length - 1];
},
/**
* Returns an array of possible slider points, taking into account both
* `marks` and `step`. The result is cached.
*/
getPoints() {
const {
marks,
step,
min,
max
} = this;
const cache = this.internalPointsCache;
if (!cache || cache.marks !== marks || cache.step !== step) {
const pointsObject = _extends({}, marks);
if (step !== null) {
for (let point = min; point <= max; point += step) {
pointsObject[point] = point;
}
}
const points = Object.keys(pointsObject).map(parseFloat);
points.sort((a, b) => a - b);
this.internalPointsCache = {
marks,
step,
points
};
}
return this.internalPointsCache.points;
},
moveTo(value, isFromKeyboardEvent) {
const nextBounds = [...this.bounds];
const {
sHandle,
recent
} = this;
const handle = sHandle === null ? recent : sHandle;
nextBounds[handle] = value;
let nextHandle = handle;
if (this.$props.pushable !== false) {
this.pushSurroundingHandles(nextBounds, nextHandle);
} else if (this.$props.allowCross) {
nextBounds.sort((a, b) => a - b);
nextHandle = nextBounds.indexOf(value);
}
this.onChange({
recent: nextHandle,
sHandle: nextHandle,
bounds: nextBounds
});
if (isFromKeyboardEvent) {
this.$emit("afterChange", nextBounds);
this.setState({}, () => {
this.handlesRefs[nextHandle].focus();
});
this.onEnd();
}
},
pushSurroundingHandles(bounds, handle) {
const value = bounds[handle];
const {
pushable
} = this;
const threshold = Number(pushable);
let direction = 0;
if (bounds[handle + 1] - value < threshold) {
direction = 1;
}
if (value - bounds[handle - 1] < threshold) {
direction = -1;
}
if (direction === 0) {
return;
}
const nextHandle = handle + direction;
const diffToNext = direction * (bounds[nextHandle] - value);
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
bounds[handle] = bounds[nextHandle] - direction * threshold;
}
},
pushHandle(bounds, handle, direction, amount) {
const originalValue = bounds[handle];
let currentValue = bounds[handle];
while (direction * (currentValue - originalValue) < amount) {
if (!this.pushHandleOnePoint(bounds, handle, direction)) {
bounds[handle] = originalValue;
return false;
}
currentValue = bounds[handle];
}
return true;
},
pushHandleOnePoint(bounds, handle, direction) {
const points = this.getPoints();
const pointIndex = points.indexOf(bounds[handle]);
const nextPointIndex = pointIndex + direction;
if (nextPointIndex >= points.length || nextPointIndex < 0) {
return false;
}
const nextHandle = handle + direction;
const nextValue = points[nextPointIndex];
const {
pushable
} = this;
const threshold = Number(pushable);
const diffToNext = direction * (bounds[nextHandle] - nextValue);
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
return false;
}
bounds[handle] = nextValue;
return true;
},
trimAlignValue(value) {
const {
sHandle,
bounds
} = this;
return trimAlignValue({
value,
handle: sHandle,
bounds,
props: this.$props
});
},
ensureValueNotConflict(handle, val, _ref2) {
let {
allowCross,
pushable: thershold
} = _ref2;
const state = this.$data || {};
const {
bounds
} = state;
handle = handle === void 0 ? state.sHandle : handle;
thershold = Number(thershold);
if (!allowCross && handle != null && bounds !== void 0) {
if (handle > 0 && val <= bounds[handle - 1] + thershold) {
return bounds[handle - 1] + thershold;
}
if (handle < bounds.length - 1 && val >= bounds[handle + 1] - thershold) {
return bounds[handle + 1] - thershold;
}
}
return val;
},
getTrack(_ref3) {
let {
bounds,
prefixCls,
reverse,
vertical,
included,
offsets,
trackStyle
} = _ref3;
return bounds.slice(0, -1).map((_, index2) => {
const i = index2 + 1;
const trackClassName = classNames({
[`${prefixCls}-track`]: true,
[`${prefixCls}-track-${i}`]: true
});
return createVNode(Track, {
"class": trackClassName,
"vertical": vertical,
"reverse": reverse,
"included": included,
"offset": offsets[i - 1],
"length": offsets[i] - offsets[i - 1],
"style": trackStyle[index2],
"key": i
}, null);
});
},
renderSlider() {
const {
sHandle,
bounds,
prefixCls,
vertical,
included,
disabled,
min,
max,
reverse,
handle,
defaultHandle,
trackStyle,
handleStyle,
tabindex,
ariaLabelGroupForHandles,
ariaLabelledByGroupForHandles,
ariaValueTextFormatterGroupForHandles
} = this;
const handleGenerator = handle || defaultHandle;
const offsets = bounds.map((v) => this.calcOffset(v));
const handleClassName = `${prefixCls}-handle`;
const handles = bounds.map((v, i) => {
let mergedTabIndex = tabindex[i] || 0;
if (disabled || tabindex[i] === null) {
mergedTabIndex = null;
}
const dragging = sHandle === i;
return handleGenerator({
class: classNames({
[handleClassName]: true,
[`${handleClassName}-${i + 1}`]: true,
[`${handleClassName}-dragging`]: dragging
}),
prefixCls,
vertical,
dragging,
offset: offsets[i],
value: v,
index: i,
tabindex: mergedTabIndex,
min,
max,
reverse,
disabled,
style: handleStyle[i],
ref: (h2) => this.saveHandle(i, h2),
onFocus: this.onFocus,
onBlur: this.onBlur,
ariaLabel: ariaLabelGroupForHandles[i],
ariaLabelledBy: ariaLabelledByGroupForHandles[i],
ariaValueTextFormatter: ariaValueTextFormatterGroupForHandles[i]
});
});
return {
tracks: this.getTrack({
bounds,
prefixCls,
reverse,
vertical,
included,
offsets,
trackStyle
}),
handles
};
}
}
});
const VcRange = createSlider(Range);
const SliderTooltip = defineComponent({
compatConfig: {
MODE: 3
},
name: "SliderTooltip",
inheritAttrs: false,
props: tooltipProps(),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const innerRef = ref(null);
const rafRef = ref(null);
function cancelKeepAlign() {
wrapperRaf.cancel(rafRef.value);
rafRef.value = null;
}
function keepAlign() {
rafRef.value = wrapperRaf(() => {
var _a;
(_a = innerRef.value) === null || _a === void 0 ? void 0 : _a.forcePopupAlign();
rafRef.value = null;
});
}
const align = () => {
cancelKeepAlign();
if (props2.open) {
keepAlign();
}
};
watch([() => props2.open, () => props2.title], () => {
align();
}, {
flush: "post",
immediate: true
});
return () => {
return createVNode(__nuxt_component_2$4, _objectSpread$W(_objectSpread$W({
"ref": innerRef
}, props2), attrs), slots);
};
}
});
const genBaseStyle$5 = (token) => {
const {
componentCls,
controlSize,
dotSize,
marginFull,
marginPart,
colorFillContentHover
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
height: controlSize,
margin: `${marginPart}px ${marginFull}px`,
padding: 0,
cursor: "pointer",
touchAction: "none",
[`&-vertical`]: {
margin: `${marginFull}px ${marginPart}px`
},
[`${componentCls}-rail`]: {
position: "absolute",
backgroundColor: token.colorFillTertiary,
borderRadius: token.borderRadiusXS,
transition: `background-color ${token.motionDurationMid}`
},
[`${componentCls}-track`]: {
position: "absolute",
backgroundColor: token.colorPrimaryBorder,
borderRadius: token.borderRadiusXS,
transition: `background-color ${token.motionDurationMid}`
},
"&:hover": {
[`${componentCls}-rail`]: {
backgroundColor: token.colorFillSecondary
},
[`${componentCls}-track`]: {
backgroundColor: token.colorPrimaryBorderHover
},
[`${componentCls}-dot`]: {
borderColor: colorFillContentHover
},
[`${componentCls}-handle::after`]: {
boxShadow: `0 0 0 ${token.handleLineWidth}px ${token.colorPrimaryBorderHover}`
},
[`${componentCls}-dot-active`]: {
borderColor: token.colorPrimary
}
},
[`${componentCls}-handle`]: {
position: "absolute",
width: token.handleSize,
height: token.handleSize,
outline: "none",
[`${componentCls}-dragging`]: {
zIndex: 1
},
// 扩大选区
"&::before": {
content: '""',
position: "absolute",
insetInlineStart: -token.handleLineWidth,
insetBlockStart: -token.handleLineWidth,
width: token.handleSize + token.handleLineWidth * 2,
height: token.handleSize + token.handleLineWidth * 2,
backgroundColor: "transparent"
},
"&::after": {
content: '""',
position: "absolute",
insetBlockStart: 0,
insetInlineStart: 0,
width: token.handleSize,
height: token.handleSize,
backgroundColor: token.colorBgElevated,
boxShadow: `0 0 0 ${token.handleLineWidth}px ${token.colorPrimaryBorder}`,
borderRadius: "50%",
cursor: "pointer",
transition: `
inset-inline-start ${token.motionDurationMid},
inset-block-start ${token.motionDurationMid},
width ${token.motionDurationMid},
height ${token.motionDurationMid},
box-shadow ${token.motionDurationMid}
`
},
"&:hover, &:active, &:focus": {
"&::before": {
insetInlineStart: -((token.handleSizeHover - token.handleSize) / 2 + token.handleLineWidthHover),
insetBlockStart: -((token.handleSizeHover - token.handleSize) / 2 + token.handleLineWidthHover),
width: token.handleSizeHover + token.handleLineWidthHover * 2,
height: token.handleSizeHover + token.handleLineWidthHover * 2
},
"&::after": {
boxShadow: `0 0 0 ${token.handleLineWidthHover}px ${token.colorPrimary}`,
width: token.handleSizeHover,
height: token.handleSizeHover,
insetInlineStart: (token.handleSize - token.handleSizeHover) / 2,
insetBlockStart: (token.handleSize - token.handleSizeHover) / 2
}
}
},
[`${componentCls}-mark`]: {
position: "absolute",
fontSize: token.fontSize
},
[`${componentCls}-mark-text`]: {
position: "absolute",
display: "inline-block",
color: token.colorTextDescription,
textAlign: "center",
wordBreak: "keep-all",
cursor: "pointer",
userSelect: "none",
"&-active": {
color: token.colorText
}
},
[`${componentCls}-step`]: {
position: "absolute",
background: "transparent",
pointerEvents: "none"
},
[`${componentCls}-dot`]: {
position: "absolute",
width: dotSize,
height: dotSize,
backgroundColor: token.colorBgElevated,
border: `${token.handleLineWidth}px solid ${token.colorBorderSecondary}`,
borderRadius: "50%",
cursor: "pointer",
transition: `border-color ${token.motionDurationSlow}`,
"&-active": {
borderColor: token.colorPrimaryBorder
}
},
[`&${componentCls}-disabled`]: {
cursor: "not-allowed",
[`${componentCls}-rail`]: {
backgroundColor: `${token.colorFillSecondary} !important`
},
[`${componentCls}-track`]: {
backgroundColor: `${token.colorTextDisabled} !important`
},
[`
${componentCls}-dot
`]: {
backgroundColor: token.colorBgElevated,
borderColor: token.colorTextDisabled,
boxShadow: "none",
cursor: "not-allowed"
},
[`${componentCls}-handle::after`]: {
backgroundColor: token.colorBgElevated,
cursor: "not-allowed",
width: token.handleSize,
height: token.handleSize,
boxShadow: `0 0 0 ${token.handleLineWidth}px ${new TinyColor(token.colorTextDisabled).onBackground(token.colorBgContainer).toHexString()}`,
insetInlineStart: 0,
insetBlockStart: 0
},
[`
${componentCls}-mark-text,
${componentCls}-dot
`]: {
cursor: `not-allowed !important`
}
}
})
};
};
const genDirectionStyle = (token, horizontal) => {
const {
componentCls,
railSize,
handleSize,
dotSize
} = token;
const railPadding = horizontal ? "paddingBlock" : "paddingInline";
const full = horizontal ? "width" : "height";
const part = horizontal ? "height" : "width";
const handlePos = horizontal ? "insetBlockStart" : "insetInlineStart";
const markInset = horizontal ? "top" : "insetInlineStart";
return {
[railPadding]: railSize,
[part]: railSize * 3,
[`${componentCls}-rail`]: {
[full]: "100%",
[part]: railSize
},
[`${componentCls}-track`]: {
[part]: railSize
},
[`${componentCls}-handle`]: {
[handlePos]: (railSize * 3 - handleSize) / 2
},
[`${componentCls}-mark`]: {
// Reset all
insetInlineStart: 0,
top: 0,
[markInset]: handleSize,
[full]: "100%"
},
[`${componentCls}-step`]: {
// Reset all
insetInlineStart: 0,
top: 0,
[markInset]: railSize,
[full]: "100%",
[part]: railSize
},
[`${componentCls}-dot`]: {
position: "absolute",
[handlePos]: (railSize - dotSize) / 2
}
};
};
const genHorizontalStyle = (token) => {
const {
componentCls,
marginPartWithMark
} = token;
return {
[`${componentCls}-horizontal`]: _extends(_extends({}, genDirectionStyle(token, true)), {
[`&${componentCls}-with-marks`]: {
marginBottom: marginPartWithMark
}
})
};
};
const genVerticalStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-vertical`]: _extends(_extends({}, genDirectionStyle(token, false)), {
height: "100%"
})
};
};
const useStyle$d = genComponentStyleHook("Slider", (token) => {
const sliderToken = merge(token, {
marginPart: (token.controlHeight - token.controlSize) / 2,
marginFull: token.controlSize / 2,
marginPartWithMark: token.controlHeightLG - token.controlSize
});
return [genBaseStyle$5(sliderToken), genHorizontalStyle(sliderToken), genVerticalStyle(sliderToken)];
}, (token) => {
const increaseHandleWidth = 1;
const controlSize = token.controlHeightLG / 4;
const controlSizeHover = token.controlHeightSM / 2;
const handleLineWidth = token.lineWidth + increaseHandleWidth;
const handleLineWidthHover = token.lineWidth + increaseHandleWidth * 3;
return {
controlSize,
railSize: 4,
handleSize: controlSize,
handleSizeHover: controlSizeHover,
dotSize: 8,
handleLineWidth,
handleLineWidthHover
};
});
var __rest$k = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const defaultTipFormatter = (value) => typeof value === "number" ? value.toString() : "";
const sliderProps = () => ({
id: String,
prefixCls: String,
tooltipPrefixCls: String,
range: someType([Boolean, Object]),
reverse: booleanType(),
min: Number,
max: Number,
step: someType([Object, Number]),
marks: objectType(),
dots: booleanType(),
value: someType([Array, Number]),
defaultValue: someType([Array, Number]),
included: booleanType(),
disabled: booleanType(),
vertical: booleanType(),
tipFormatter: someType([Function, Object], () => defaultTipFormatter),
tooltipOpen: booleanType(),
/** @deprecated `tooltipVisible` is deprecated. Please use `tooltipOpen` instead. */
tooltipVisible: booleanType(),
tooltipPlacement: stringType(),
getTooltipPopupContainer: functionType(),
autofocus: booleanType(),
handleStyle: someType([Array, Object]),
trackStyle: someType([Array, Object]),
onChange: functionType(),
onAfterChange: functionType(),
onFocus: functionType(),
onBlur: functionType(),
"onUpdate:value": functionType()
});
const Slider = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASlider",
inheritAttrs: false,
props: sliderProps(),
// emits: ['update:value', 'change', 'afterChange', 'blur'],
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots,
emit,
expose
} = _ref;
const {
prefixCls,
rootPrefixCls,
direction,
getPopupContainer,
configProvider
} = useConfigInject("slider", props2);
const [wrapSSR, hashId] = useStyle$d(prefixCls);
const formItemContext = useInjectFormItemContext();
const sliderRef = ref();
const visibles = ref({});
const toggleTooltipOpen = (index2, visible) => {
visibles.value[index2] = visible;
};
const tooltipPlacement = computed(() => {
if (props2.tooltipPlacement) {
return props2.tooltipPlacement;
}
if (!props2.vertical) {
return "top";
}
return direction.value === "rtl" ? "left" : "right";
});
const focus = () => {
var _a;
(_a = sliderRef.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = sliderRef.value) === null || _a === void 0 ? void 0 : _a.blur();
};
const handleChange = (val) => {
emit("update:value", val);
emit("change", val);
formItemContext.onFieldChange();
};
const handleBlur = (e) => {
emit("blur", e);
};
expose({
focus,
blur
});
const handleWithTooltip = (_a) => {
var {
tooltipPrefixCls
} = _a, _b = _a.info, {
value,
dragging,
index: index2
} = _b, restProps = __rest$k(_b, ["value", "dragging", "index"]);
const {
tipFormatter,
tooltipOpen = props2.tooltipVisible,
getTooltipPopupContainer
} = props2;
const isTipFormatter = tipFormatter ? visibles.value[index2] || dragging : false;
const open2 = tooltipOpen || tooltipOpen === void 0 && isTipFormatter;
return createVNode(SliderTooltip, {
"prefixCls": tooltipPrefixCls,
"title": tipFormatter ? tipFormatter(value) : "",
"open": open2,
"placement": tooltipPlacement.value,
"transitionName": `${rootPrefixCls.value}-zoom-down`,
"key": index2,
"overlayClassName": `${prefixCls.value}-tooltip`,
"getPopupContainer": getTooltipPopupContainer || (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value)
}, {
default: () => [createVNode(VcHandle, _objectSpread$W(_objectSpread$W({}, restProps), {}, {
"value": value,
"onMouseenter": () => toggleTooltipOpen(index2, true),
"onMouseleave": () => toggleTooltipOpen(index2, false)
}), null)]
});
};
return () => {
const {
tooltipPrefixCls: customizeTooltipPrefixCls,
range,
id = formItemContext.id.value
} = props2, restProps = __rest$k(props2, ["tooltipPrefixCls", "range", "id"]);
const tooltipPrefixCls = configProvider.getPrefixCls("tooltip", customizeTooltipPrefixCls);
const cls = classNames(attrs.class, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, hashId.value);
if (direction.value === "rtl" && !restProps.vertical) {
restProps.reverse = !restProps.reverse;
}
let draggableTrack;
if (typeof range === "object") {
draggableTrack = range.draggableTrack;
}
if (range) {
return wrapSSR(createVNode(VcRange, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), restProps), {}, {
"step": restProps.step,
"draggableTrack": draggableTrack,
"class": cls,
"ref": sliderRef,
"handle": (info) => handleWithTooltip({
tooltipPrefixCls,
prefixCls: prefixCls.value,
info
}),
"prefixCls": prefixCls.value,
"onChange": handleChange,
"onBlur": handleBlur
}), {
mark: slots.mark
}));
}
return wrapSSR(createVNode(VcSlider, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), restProps), {}, {
"id": id,
"step": restProps.step,
"class": cls,
"ref": sliderRef,
"handle": (info) => handleWithTooltip({
tooltipPrefixCls,
prefixCls: prefixCls.value,
info
}),
"prefixCls": prefixCls.value,
"onChange": handleChange,
"onBlur": handleBlur
}), {
mark: slots.mark
}));
};
}
});
const Slider$1 = withInstall(Slider);
function isString(str) {
return typeof str === "string";
}
function noop$3() {
}
const VcStepProps = () => ({
prefixCls: String,
itemWidth: String,
active: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
status: stringType(),
iconPrefix: String,
icon: PropTypes.any,
adjustMarginRight: String,
stepNumber: Number,
stepIndex: Number,
description: PropTypes.any,
title: PropTypes.any,
subTitle: PropTypes.any,
progressDot: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, PropTypes.func])),
tailContent: PropTypes.any,
icons: PropTypes.shape({
finish: PropTypes.any,
error: PropTypes.any
}).loose,
onClick: functionType(),
onStepClick: functionType(),
stepIcon: functionType(),
itemRender: functionType(),
__legacy: booleanType()
});
const VcStep = defineComponent({
compatConfig: {
MODE: 3
},
name: "Step",
inheritAttrs: false,
props: VcStepProps(),
setup(props2, _ref) {
let {
slots,
emit,
attrs
} = _ref;
const onItemClick = (e) => {
emit("click", e);
emit("stepClick", props2.stepIndex);
};
const renderIconNode = (_ref2) => {
let {
icon,
title,
description
} = _ref2;
const {
prefixCls,
stepNumber,
status,
iconPrefix,
icons: icons2,
progressDot = slots.progressDot,
stepIcon = slots.stepIcon
} = props2;
let iconNode;
const iconClassName = classNames(`${prefixCls}-icon`, `${iconPrefix}icon`, {
[`${iconPrefix}icon-${icon}`]: icon && isString(icon),
[`${iconPrefix}icon-check`]: !icon && status === "finish" && (icons2 && !icons2.finish || !icons2),
[`${iconPrefix}icon-cross`]: !icon && status === "error" && (icons2 && !icons2.error || !icons2)
});
const iconDot = createVNode("span", {
"class": `${prefixCls}-icon-dot`
}, null);
if (progressDot) {
if (typeof progressDot === "function") {
iconNode = createVNode("span", {
"class": `${prefixCls}-icon`
}, [progressDot({
iconDot,
index: stepNumber - 1,
status,
title,
description,
prefixCls
})]);
} else {
iconNode = createVNode("span", {
"class": `${prefixCls}-icon`
}, [iconDot]);
}
} else if (icon && !isString(icon)) {
iconNode = createVNode("span", {
"class": `${prefixCls}-icon`
}, [icon]);
} else if (icons2 && icons2.finish && status === "finish") {
iconNode = createVNode("span", {
"class": `${prefixCls}-icon`
}, [icons2.finish]);
} else if (icons2 && icons2.error && status === "error") {
iconNode = createVNode("span", {
"class": `${prefixCls}-icon`
}, [icons2.error]);
} else if (icon || status === "finish" || status === "error") {
iconNode = createVNode("span", {
"class": iconClassName
}, null);
} else {
iconNode = createVNode("span", {
"class": `${prefixCls}-icon`
}, [stepNumber]);
}
if (stepIcon) {
iconNode = stepIcon({
index: stepNumber - 1,
status,
title,
description,
node: iconNode
});
}
return iconNode;
};
return () => {
var _a, _b, _c, _d;
const {
prefixCls,
itemWidth,
active,
status = "wait",
tailContent,
adjustMarginRight,
disabled,
title = (_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots),
description = (_b = slots.description) === null || _b === void 0 ? void 0 : _b.call(slots),
subTitle = (_c = slots.subTitle) === null || _c === void 0 ? void 0 : _c.call(slots),
icon = (_d = slots.icon) === null || _d === void 0 ? void 0 : _d.call(slots),
onClick,
onStepClick
} = props2;
const mergedStatus = status || "wait";
const classString = classNames(`${prefixCls}-item`, `${prefixCls}-item-${mergedStatus}`, {
[`${prefixCls}-item-custom`]: icon,
[`${prefixCls}-item-active`]: active,
[`${prefixCls}-item-disabled`]: disabled === true
});
const stepItemStyle = {};
if (itemWidth) {
stepItemStyle.width = itemWidth;
}
if (adjustMarginRight) {
stepItemStyle.marginRight = adjustMarginRight;
}
const accessibilityProps = {
onClick: onClick || noop$3
};
if (onStepClick && !disabled) {
accessibilityProps.role = "button";
accessibilityProps.tabindex = 0;
accessibilityProps.onClick = onItemClick;
}
const stepNode = createVNode("div", _objectSpread$W(_objectSpread$W({}, omit(attrs, ["__legacy"])), {}, {
"class": [classString, attrs.class],
"style": [attrs.style, stepItemStyle]
}), [createVNode("div", _objectSpread$W(_objectSpread$W({}, accessibilityProps), {}, {
"class": `${prefixCls}-item-container`
}), [createVNode("div", {
"class": `${prefixCls}-item-tail`
}, [tailContent]), createVNode("div", {
"class": `${prefixCls}-item-icon`
}, [renderIconNode({
icon,
title,
description
})]), createVNode("div", {
"class": `${prefixCls}-item-content`
}, [createVNode("div", {
"class": `${prefixCls}-item-title`
}, [title, subTitle && createVNode("div", {
"title": typeof subTitle === "string" ? subTitle : void 0,
"class": `${prefixCls}-item-subtitle`
}, [subTitle])]), description && createVNode("div", {
"class": `${prefixCls}-item-description`
}, [description])])])]);
if (props2.itemRender) {
return props2.itemRender(stepNode);
}
return stepNode;
};
}
});
var __rest$j = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Steps$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Steps",
props: {
type: PropTypes.string.def("default"),
prefixCls: PropTypes.string.def("vc-steps"),
iconPrefix: PropTypes.string.def("vc"),
direction: PropTypes.string.def("horizontal"),
labelPlacement: PropTypes.string.def("horizontal"),
status: stringType("process"),
size: PropTypes.string.def(""),
progressDot: PropTypes.oneOfType([PropTypes.looseBool, PropTypes.func]).def(void 0),
initial: PropTypes.number.def(0),
current: PropTypes.number.def(0),
items: PropTypes.array.def(() => []),
icons: PropTypes.shape({
finish: PropTypes.any,
error: PropTypes.any
}).loose,
stepIcon: functionType(),
isInline: PropTypes.looseBool,
itemRender: functionType()
},
emits: ["change"],
setup(props2, _ref) {
let {
slots,
emit
} = _ref;
const onStepClick = (next) => {
const {
current
} = props2;
if (current !== next) {
emit("change", next);
}
};
const renderStep = (item, index2, legacyRender) => {
const {
prefixCls,
iconPrefix,
status,
current,
initial,
icons: icons2,
stepIcon = slots.stepIcon,
isInline,
itemRender,
progressDot = slots.progressDot
} = props2;
const mergedProgressDot = isInline || progressDot;
const mergedItem = _extends(_extends({}, item), {
class: ""
});
const stepNumber = initial + index2;
const commonProps2 = {
active: stepNumber === current,
stepNumber: stepNumber + 1,
stepIndex: stepNumber,
key: stepNumber,
prefixCls,
iconPrefix,
progressDot: mergedProgressDot,
stepIcon,
icons: icons2,
onStepClick
};
if (status === "error" && index2 === current - 1) {
mergedItem.class = `${prefixCls}-next-error`;
}
if (!mergedItem.status) {
if (stepNumber === current) {
mergedItem.status = status;
} else if (stepNumber < current) {
mergedItem.status = "finish";
} else {
mergedItem.status = "wait";
}
}
if (isInline) {
mergedItem.icon = void 0;
mergedItem.subTitle = void 0;
}
if (legacyRender) {
return legacyRender(_extends(_extends({}, mergedItem), commonProps2));
}
if (itemRender) {
mergedItem.itemRender = (stepItem) => itemRender(mergedItem, stepItem);
}
return createVNode(VcStep, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, mergedItem), commonProps2), {}, {
"__legacy": false
}), null);
};
const renderStepWithNode = (node, index2) => {
return renderStep(_extends({}, node.props), index2, (stepProps) => {
const stepNode = cloneElement(node, stepProps);
return stepNode;
});
};
return () => {
var _a;
const {
prefixCls,
direction,
type,
labelPlacement,
iconPrefix,
status,
size,
current,
progressDot = slots.progressDot,
initial,
icons: icons2,
items,
isInline,
itemRender
} = props2, restProps = __rest$j(props2, ["prefixCls", "direction", "type", "labelPlacement", "iconPrefix", "status", "size", "current", "progressDot", "initial", "icons", "items", "isInline", "itemRender"]);
const isNav = type === "navigation";
const mergedProgressDot = isInline || progressDot;
const mergedDirection = isInline ? "horizontal" : direction;
const mergedSize = isInline ? void 0 : size;
const adjustedLabelPlacement = mergedProgressDot ? "vertical" : labelPlacement;
const classString = classNames(prefixCls, `${prefixCls}-${direction}`, {
[`${prefixCls}-${mergedSize}`]: mergedSize,
[`${prefixCls}-label-${adjustedLabelPlacement}`]: mergedDirection === "horizontal",
[`${prefixCls}-dot`]: !!mergedProgressDot,
[`${prefixCls}-navigation`]: isNav,
[`${prefixCls}-inline`]: isInline
});
return createVNode("div", _objectSpread$W({
"class": classString
}, restProps), [items.filter((item) => item).map((item, index2) => renderStep(item, index2)), filterEmpty((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)).map(renderStepWithNode)]);
};
}
});
const genStepsCustomIconStyle = (token) => {
const {
componentCls,
stepsIconCustomTop,
stepsIconCustomSize,
stepsIconCustomFontSize
} = token;
return {
[`${componentCls}-item-custom`]: {
[`> ${componentCls}-item-container > ${componentCls}-item-icon`]: {
height: "auto",
background: "none",
border: 0,
[`> ${componentCls}-icon`]: {
top: stepsIconCustomTop,
width: stepsIconCustomSize,
height: stepsIconCustomSize,
fontSize: stepsIconCustomFontSize,
lineHeight: `${stepsIconCustomSize}px`
}
}
},
// Only adjust horizontal customize icon width
[`&:not(${componentCls}-vertical)`]: {
[`${componentCls}-item-custom`]: {
[`${componentCls}-item-icon`]: {
width: "auto",
background: "none"
}
}
}
};
};
const genStepsLabelPlacementStyle = (token) => {
const {
componentCls,
stepsIconSize,
lineHeight,
stepsSmallIconSize
} = token;
return {
[`&${componentCls}-label-vertical`]: {
[`${componentCls}-item`]: {
overflow: "visible",
"&-tail": {
marginInlineStart: stepsIconSize / 2 + token.controlHeightLG,
padding: `${token.paddingXXS}px ${token.paddingLG}px`
},
"&-content": {
display: "block",
width: (stepsIconSize / 2 + token.controlHeightLG) * 2,
marginTop: token.marginSM,
textAlign: "center"
},
"&-icon": {
display: "inline-block",
marginInlineStart: token.controlHeightLG
},
"&-title": {
paddingInlineEnd: 0,
paddingInlineStart: 0,
"&::after": {
display: "none"
}
},
"&-subtitle": {
display: "block",
marginBottom: token.marginXXS,
marginInlineStart: 0,
lineHeight
}
},
[`&${componentCls}-small:not(${componentCls}-dot)`]: {
[`${componentCls}-item`]: {
"&-icon": {
marginInlineStart: token.controlHeightLG + (stepsIconSize - stepsSmallIconSize) / 2
}
}
}
}
};
};
const genStepsNavStyle = (token) => {
const {
componentCls,
stepsNavContentMaxWidth,
stepsNavArrowColor,
stepsNavActiveColor,
motionDurationSlow
} = token;
return {
[`&${componentCls}-navigation`]: {
paddingTop: token.paddingSM,
[`&${componentCls}-small`]: {
[`${componentCls}-item`]: {
"&-container": {
marginInlineStart: -token.marginSM
}
}
},
[`${componentCls}-item`]: {
overflow: "visible",
textAlign: "center",
"&-container": {
display: "inline-block",
height: "100%",
marginInlineStart: -token.margin,
paddingBottom: token.paddingSM,
textAlign: "start",
transition: `opacity ${motionDurationSlow}`,
[`${componentCls}-item-content`]: {
maxWidth: stepsNavContentMaxWidth
},
[`${componentCls}-item-title`]: _extends(_extends({
maxWidth: "100%",
paddingInlineEnd: 0
}, textEllipsis), {
"&::after": {
display: "none"
}
})
},
[`&:not(${componentCls}-item-active)`]: {
[`${componentCls}-item-container[role='button']`]: {
cursor: "pointer",
"&:hover": {
opacity: 0.85
}
}
},
"&:last-child": {
flex: 1,
"&::after": {
display: "none"
}
},
"&::after": {
position: "absolute",
top: `calc(50% - ${token.paddingSM / 2}px)`,
insetInlineStart: "100%",
display: "inline-block",
width: token.fontSizeIcon,
height: token.fontSizeIcon,
borderTop: `${token.lineWidth}px ${token.lineType} ${stepsNavArrowColor}`,
borderBottom: "none",
borderInlineStart: "none",
borderInlineEnd: `${token.lineWidth}px ${token.lineType} ${stepsNavArrowColor}`,
transform: "translateY(-50%) translateX(-50%) rotate(45deg)",
content: '""'
},
"&::before": {
position: "absolute",
bottom: 0,
insetInlineStart: "50%",
display: "inline-block",
width: 0,
height: token.lineWidthBold,
backgroundColor: stepsNavActiveColor,
transition: `width ${motionDurationSlow}, inset-inline-start ${motionDurationSlow}`,
transitionTimingFunction: "ease-out",
content: '""'
}
},
[`${componentCls}-item${componentCls}-item-active::before`]: {
insetInlineStart: 0,
width: "100%"
}
},
[`&${componentCls}-navigation${componentCls}-vertical`]: {
[`> ${componentCls}-item`]: {
marginInlineEnd: 0,
"&::before": {
display: "none"
},
[`&${componentCls}-item-active::before`]: {
top: 0,
insetInlineEnd: 0,
insetInlineStart: "unset",
display: "block",
width: token.lineWidth * 3,
height: `calc(100% - ${token.marginLG}px)`
},
"&::after": {
position: "relative",
insetInlineStart: "50%",
display: "block",
width: token.controlHeight * 0.25,
height: token.controlHeight * 0.25,
marginBottom: token.marginXS,
textAlign: "center",
transform: "translateY(-50%) translateX(-50%) rotate(135deg)"
},
[`> ${componentCls}-item-container > ${componentCls}-item-tail`]: {
visibility: "hidden"
}
}
},
[`&${componentCls}-navigation${componentCls}-horizontal`]: {
[`> ${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
visibility: "hidden"
}
}
};
};
const genStepsProgressStyle = (token) => {
const {
antCls,
componentCls
} = token;
return {
[`&${componentCls}-with-progress`]: {
[`${componentCls}-item`]: {
paddingTop: token.paddingXXS,
[`&-process ${componentCls}-item-container ${componentCls}-item-icon ${componentCls}-icon`]: {
color: token.processIconColor
}
},
[`&${componentCls}-vertical > ${componentCls}-item `]: {
paddingInlineStart: token.paddingXXS,
[`> ${componentCls}-item-container > ${componentCls}-item-tail`]: {
top: token.marginXXS,
insetInlineStart: token.stepsIconSize / 2 - token.lineWidth + token.paddingXXS
}
},
[`&, &${componentCls}-small`]: {
[`&${componentCls}-horizontal ${componentCls}-item:first-child`]: {
paddingBottom: token.paddingXXS,
paddingInlineStart: token.paddingXXS
}
},
[`&${componentCls}-small${componentCls}-vertical > ${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
insetInlineStart: token.stepsSmallIconSize / 2 - token.lineWidth + token.paddingXXS
},
[`&${componentCls}-label-vertical`]: {
[`${componentCls}-item ${componentCls}-item-tail`]: {
top: token.margin - 2 * token.lineWidth
}
},
[`${componentCls}-item-icon`]: {
position: "relative",
[`${antCls}-progress`]: {
position: "absolute",
insetBlockStart: (token.stepsIconSize - token.stepsProgressSize - token.lineWidth * 2) / 2,
insetInlineStart: (token.stepsIconSize - token.stepsProgressSize - token.lineWidth * 2) / 2
}
}
}
};
};
const genStepsProgressDotStyle = (token) => {
const {
componentCls,
descriptionWidth,
lineHeight,
stepsCurrentDotSize,
stepsDotSize,
motionDurationSlow
} = token;
return {
[`&${componentCls}-dot, &${componentCls}-dot${componentCls}-small`]: {
[`${componentCls}-item`]: {
"&-title": {
lineHeight
},
"&-tail": {
top: Math.floor((token.stepsDotSize - token.lineWidth * 3) / 2),
width: "100%",
marginTop: 0,
marginBottom: 0,
marginInline: `${descriptionWidth / 2}px 0`,
padding: 0,
"&::after": {
width: `calc(100% - ${token.marginSM * 2}px)`,
height: token.lineWidth * 3,
marginInlineStart: token.marginSM
}
},
"&-icon": {
width: stepsDotSize,
height: stepsDotSize,
marginInlineStart: (token.descriptionWidth - stepsDotSize) / 2,
paddingInlineEnd: 0,
lineHeight: `${stepsDotSize}px`,
background: "transparent",
border: 0,
[`${componentCls}-icon-dot`]: {
position: "relative",
float: "left",
width: "100%",
height: "100%",
borderRadius: 100,
transition: `all ${motionDurationSlow}`,
/* expand hover area */
"&::after": {
position: "absolute",
top: -token.marginSM,
insetInlineStart: (stepsDotSize - token.controlHeightLG * 1.5) / 2,
width: token.controlHeightLG * 1.5,
height: token.controlHeight,
background: "transparent",
content: '""'
}
}
},
"&-content": {
width: descriptionWidth
},
[`&-process ${componentCls}-item-icon`]: {
position: "relative",
top: (stepsDotSize - stepsCurrentDotSize) / 2,
width: stepsCurrentDotSize,
height: stepsCurrentDotSize,
lineHeight: `${stepsCurrentDotSize}px`,
background: "none",
marginInlineStart: (token.descriptionWidth - stepsCurrentDotSize) / 2
},
[`&-process ${componentCls}-icon`]: {
[`&:first-child ${componentCls}-icon-dot`]: {
insetInlineStart: 0
}
}
}
},
[`&${componentCls}-vertical${componentCls}-dot`]: {
[`${componentCls}-item-icon`]: {
marginTop: (token.controlHeight - stepsDotSize) / 2,
marginInlineStart: 0,
background: "none"
},
[`${componentCls}-item-process ${componentCls}-item-icon`]: {
marginTop: (token.controlHeight - stepsCurrentDotSize) / 2,
top: 0,
insetInlineStart: (stepsDotSize - stepsCurrentDotSize) / 2,
marginInlineStart: 0
},
// https://github.com/ant-design/ant-design/issues/18354
[`${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
top: (token.controlHeight - stepsDotSize) / 2,
insetInlineStart: 0,
margin: 0,
padding: `${stepsDotSize + token.paddingXS}px 0 ${token.paddingXS}px`,
"&::after": {
marginInlineStart: (stepsDotSize - token.lineWidth) / 2
}
},
[`&${componentCls}-small`]: {
[`${componentCls}-item-icon`]: {
marginTop: (token.controlHeightSM - stepsDotSize) / 2
},
[`${componentCls}-item-process ${componentCls}-item-icon`]: {
marginTop: (token.controlHeightSM - stepsCurrentDotSize) / 2
},
[`${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
top: (token.controlHeightSM - stepsDotSize) / 2
}
},
[`${componentCls}-item:first-child ${componentCls}-icon-dot`]: {
insetInlineStart: 0
},
[`${componentCls}-item-content`]: {
width: "inherit"
}
}
};
};
const genStepsRTLStyle = (token) => {
const {
componentCls
} = token;
return {
[`&${componentCls}-rtl`]: {
direction: "rtl",
[`${componentCls}-item`]: {
"&-subtitle": {
float: "left"
}
},
// nav
[`&${componentCls}-navigation`]: {
[`${componentCls}-item::after`]: {
transform: "rotate(-45deg)"
}
},
// vertical
[`&${componentCls}-vertical`]: {
[`> ${componentCls}-item`]: {
"&::after": {
transform: "rotate(225deg)"
},
[`${componentCls}-item-icon`]: {
float: "right"
}
}
},
// progress-dot
[`&${componentCls}-dot`]: {
[`${componentCls}-item-icon ${componentCls}-icon-dot, &${componentCls}-small ${componentCls}-item-icon ${componentCls}-icon-dot`]: {
float: "right"
}
}
}
};
};
const genStepsSmallStyle = (token) => {
const {
componentCls,
stepsSmallIconSize,
// stepsSmallIconMargin,
fontSizeSM,
fontSize,
colorTextDescription
} = token;
return {
[`&${componentCls}-small`]: {
[`&${componentCls}-horizontal:not(${componentCls}-label-vertical) ${componentCls}-item`]: {
paddingInlineStart: token.paddingSM,
"&:first-child": {
paddingInlineStart: 0
}
},
[`${componentCls}-item-icon`]: {
width: stepsSmallIconSize,
height: stepsSmallIconSize,
// margin: stepsSmallIconMargin,
marginTop: 0,
marginBottom: 0,
marginInline: `0 ${token.marginXS}px`,
fontSize: fontSizeSM,
lineHeight: `${stepsSmallIconSize}px`,
textAlign: "center",
borderRadius: stepsSmallIconSize
},
[`${componentCls}-item-title`]: {
paddingInlineEnd: token.paddingSM,
fontSize,
lineHeight: `${stepsSmallIconSize}px`,
"&::after": {
top: stepsSmallIconSize / 2
}
},
[`${componentCls}-item-description`]: {
color: colorTextDescription,
fontSize
},
[`${componentCls}-item-tail`]: {
top: stepsSmallIconSize / 2 - token.paddingXXS
},
[`${componentCls}-item-custom ${componentCls}-item-icon`]: {
width: "inherit",
height: "inherit",
lineHeight: "inherit",
background: "none",
border: 0,
borderRadius: 0,
[`> ${componentCls}-icon`]: {
fontSize: stepsSmallIconSize,
lineHeight: `${stepsSmallIconSize}px`,
transform: "none"
}
}
}
};
};
const genStepsVerticalStyle = (token) => {
const {
componentCls,
stepsSmallIconSize,
stepsIconSize
} = token;
return {
[`&${componentCls}-vertical`]: {
display: "flex",
flexDirection: "column",
[`> ${componentCls}-item`]: {
display: "block",
flex: "1 0 auto",
paddingInlineStart: 0,
overflow: "visible",
[`${componentCls}-item-icon`]: {
float: "left",
marginInlineEnd: token.margin
},
[`${componentCls}-item-content`]: {
display: "block",
minHeight: token.controlHeight * 1.5,
overflow: "hidden"
},
[`${componentCls}-item-title`]: {
lineHeight: `${stepsIconSize}px`
},
[`${componentCls}-item-description`]: {
paddingBottom: token.paddingSM
}
},
[`> ${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
position: "absolute",
top: 0,
insetInlineStart: token.stepsIconSize / 2 - token.lineWidth,
width: token.lineWidth,
height: "100%",
padding: `${stepsIconSize + token.marginXXS * 1.5}px 0 ${token.marginXXS * 1.5}px`,
"&::after": {
width: token.lineWidth,
height: "100%"
}
},
[`> ${componentCls}-item:not(:last-child) > ${componentCls}-item-container > ${componentCls}-item-tail`]: {
display: "block"
},
[` > ${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-content > ${componentCls}-item-title`]: {
"&::after": {
display: "none"
}
},
[`&${componentCls}-small ${componentCls}-item-container`]: {
[`${componentCls}-item-tail`]: {
position: "absolute",
top: 0,
insetInlineStart: token.stepsSmallIconSize / 2 - token.lineWidth,
padding: `${stepsSmallIconSize + token.marginXXS * 1.5}px 0 ${token.marginXXS * 1.5}px`
},
[`${componentCls}-item-title`]: {
lineHeight: `${stepsSmallIconSize}px`
}
}
}
};
};
const genStepsInlineStyle = (token) => {
const {
componentCls,
inlineDotSize,
inlineTitleColor,
inlineTailColor
} = token;
const containerPaddingTop = token.paddingXS + token.lineWidth;
const titleStyle = {
[`${componentCls}-item-container ${componentCls}-item-content ${componentCls}-item-title`]: {
color: inlineTitleColor
}
};
return {
[`&${componentCls}-inline`]: {
width: "auto",
display: "inline-flex",
[`${componentCls}-item`]: {
flex: "none",
"&-container": {
padding: `${containerPaddingTop}px ${token.paddingXXS}px 0`,
margin: `0 ${token.marginXXS / 2}px`,
borderRadius: token.borderRadiusSM,
cursor: "pointer",
transition: `background-color ${token.motionDurationMid}`,
"&:hover": {
background: token.controlItemBgHover
},
[`&[role='button']:hover`]: {
opacity: 1
}
},
"&-icon": {
width: inlineDotSize,
height: inlineDotSize,
marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
[`> ${componentCls}-icon`]: {
top: 0
},
[`${componentCls}-icon-dot`]: {
borderRadius: token.fontSizeSM / 4
}
},
"&-content": {
width: "auto",
marginTop: token.marginXS - token.lineWidth
},
"&-title": {
color: inlineTitleColor,
fontSize: token.fontSizeSM,
lineHeight: token.lineHeightSM,
fontWeight: "normal",
marginBottom: token.marginXXS / 2
},
"&-description": {
display: "none"
},
"&-tail": {
marginInlineStart: 0,
top: containerPaddingTop + inlineDotSize / 2,
transform: `translateY(-50%)`,
"&:after": {
width: "100%",
height: token.lineWidth,
borderRadius: 0,
marginInlineStart: 0,
background: inlineTailColor
}
},
[`&:first-child ${componentCls}-item-tail`]: {
width: "50%",
marginInlineStart: "50%"
},
[`&:last-child ${componentCls}-item-tail`]: {
display: "block",
width: "50%"
},
"&-wait": _extends({
[`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
backgroundColor: token.colorBorderBg,
border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`
}
}, titleStyle),
"&-finish": _extends({
[`${componentCls}-item-tail::after`]: {
backgroundColor: inlineTailColor
},
[`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
backgroundColor: inlineTailColor,
border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`
}
}, titleStyle),
"&-error": titleStyle,
"&-active, &-process": _extends({
[`${componentCls}-item-icon`]: {
width: inlineDotSize,
height: inlineDotSize,
marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
top: 0
}
}, titleStyle),
[`&:not(${componentCls}-item-active) > ${componentCls}-item-container[role='button']:hover`]: {
[`${componentCls}-item-title`]: {
color: inlineTitleColor
}
}
}
}
};
};
var StepItemStatusEnum;
(function(StepItemStatusEnum2) {
StepItemStatusEnum2["wait"] = "wait";
StepItemStatusEnum2["process"] = "process";
StepItemStatusEnum2["finish"] = "finish";
StepItemStatusEnum2["error"] = "error";
})(StepItemStatusEnum || (StepItemStatusEnum = {}));
const genStepsItemStatusStyle = (status, token) => {
const prefix = `${token.componentCls}-item`;
const iconColorKey = `${status}IconColor`;
const titleColorKey = `${status}TitleColor`;
const descriptionColorKey = `${status}DescriptionColor`;
const tailColorKey = `${status}TailColor`;
const iconBgColorKey = `${status}IconBgColor`;
const iconBorderColorKey = `${status}IconBorderColor`;
const dotColorKey = `${status}DotColor`;
return {
[`${prefix}-${status} ${prefix}-icon`]: {
backgroundColor: token[iconBgColorKey],
borderColor: token[iconBorderColorKey],
[`> ${token.componentCls}-icon`]: {
color: token[iconColorKey],
[`${token.componentCls}-icon-dot`]: {
background: token[dotColorKey]
}
}
},
[`${prefix}-${status}${prefix}-custom ${prefix}-icon`]: {
[`> ${token.componentCls}-icon`]: {
color: token[dotColorKey]
}
},
[`${prefix}-${status} > ${prefix}-container > ${prefix}-content > ${prefix}-title`]: {
color: token[titleColorKey],
"&::after": {
backgroundColor: token[tailColorKey]
}
},
[`${prefix}-${status} > ${prefix}-container > ${prefix}-content > ${prefix}-description`]: {
color: token[descriptionColorKey]
},
[`${prefix}-${status} > ${prefix}-container > ${prefix}-tail::after`]: {
backgroundColor: token[tailColorKey]
}
};
};
const genStepsItemStyle = (token) => {
const {
componentCls,
motionDurationSlow
} = token;
const stepsItemCls = `${componentCls}-item`;
return _extends(_extends(_extends(_extends(_extends(_extends({
[stepsItemCls]: {
position: "relative",
display: "inline-block",
flex: 1,
overflow: "hidden",
verticalAlign: "top",
"&:last-child": {
flex: "none",
[`> ${stepsItemCls}-container > ${stepsItemCls}-tail, > ${stepsItemCls}-container > ${stepsItemCls}-content > ${stepsItemCls}-title::after`]: {
display: "none"
}
}
},
[`${stepsItemCls}-container`]: {
outline: "none"
},
[`${stepsItemCls}-icon, ${stepsItemCls}-content`]: {
display: "inline-block",
verticalAlign: "top"
},
[`${stepsItemCls}-icon`]: {
width: token.stepsIconSize,
height: token.stepsIconSize,
marginTop: 0,
marginBottom: 0,
marginInlineStart: 0,
marginInlineEnd: token.marginXS,
fontSize: token.stepsIconFontSize,
fontFamily: token.fontFamily,
lineHeight: `${token.stepsIconSize}px`,
textAlign: "center",
borderRadius: token.stepsIconSize,
border: `${token.lineWidth}px ${token.lineType} transparent`,
transition: `background-color ${motionDurationSlow}, border-color ${motionDurationSlow}`,
[`${componentCls}-icon`]: {
position: "relative",
top: token.stepsIconTop,
color: token.colorPrimary,
lineHeight: 1
}
},
[`${stepsItemCls}-tail`]: {
position: "absolute",
top: token.stepsIconSize / 2 - token.paddingXXS,
insetInlineStart: 0,
width: "100%",
"&::after": {
display: "inline-block",
width: "100%",
height: token.lineWidth,
background: token.colorSplit,
borderRadius: token.lineWidth,
transition: `background ${motionDurationSlow}`,
content: '""'
}
},
[`${stepsItemCls}-title`]: {
position: "relative",
display: "inline-block",
paddingInlineEnd: token.padding,
color: token.colorText,
fontSize: token.fontSizeLG,
lineHeight: `${token.stepsTitleLineHeight}px`,
"&::after": {
position: "absolute",
top: token.stepsTitleLineHeight / 2,
insetInlineStart: "100%",
display: "block",
width: 9999,
height: token.lineWidth,
background: token.processTailColor,
content: '""'
}
},
[`${stepsItemCls}-subtitle`]: {
display: "inline",
marginInlineStart: token.marginXS,
color: token.colorTextDescription,
fontWeight: "normal",
fontSize: token.fontSize
},
[`${stepsItemCls}-description`]: {
color: token.colorTextDescription,
fontSize: token.fontSize
}
}, genStepsItemStatusStyle(StepItemStatusEnum.wait, token)), genStepsItemStatusStyle(StepItemStatusEnum.process, token)), {
[`${stepsItemCls}-process > ${stepsItemCls}-container > ${stepsItemCls}-title`]: {
fontWeight: token.fontWeightStrong
}
}), genStepsItemStatusStyle(StepItemStatusEnum.finish, token)), genStepsItemStatusStyle(StepItemStatusEnum.error, token)), {
[`${stepsItemCls}${componentCls}-next-error > ${componentCls}-item-title::after`]: {
background: token.colorError
},
[`${stepsItemCls}-disabled`]: {
cursor: "not-allowed"
}
});
};
const genStepsClickableStyle = (token) => {
const {
componentCls,
motionDurationSlow
} = token;
return {
[`& ${componentCls}-item`]: {
[`&:not(${componentCls}-item-active)`]: {
[`& > ${componentCls}-item-container[role='button']`]: {
cursor: "pointer",
[`${componentCls}-item`]: {
[`&-title, &-subtitle, &-description, &-icon ${componentCls}-icon`]: {
transition: `color ${motionDurationSlow}`
}
},
"&:hover": {
[`${componentCls}-item`]: {
[`&-title, &-subtitle, &-description`]: {
color: token.colorPrimary
}
}
}
},
[`&:not(${componentCls}-item-process)`]: {
[`& > ${componentCls}-item-container[role='button']:hover`]: {
[`${componentCls}-item`]: {
"&-icon": {
borderColor: token.colorPrimary,
[`${componentCls}-icon`]: {
color: token.colorPrimary
}
}
}
}
}
}
},
[`&${componentCls}-horizontal:not(${componentCls}-label-vertical)`]: {
[`${componentCls}-item`]: {
paddingInlineStart: token.padding,
whiteSpace: "nowrap",
"&:first-child": {
paddingInlineStart: 0
},
[`&:last-child ${componentCls}-item-title`]: {
paddingInlineEnd: 0
},
"&-tail": {
display: "none"
},
"&-description": {
maxWidth: token.descriptionWidth,
whiteSpace: "normal"
}
}
}
};
};
const genStepsStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({}, resetComponent(token)), {
display: "flex",
width: "100%",
fontSize: 0,
textAlign: "initial"
}), genStepsItemStyle(token)), genStepsClickableStyle(token)), genStepsCustomIconStyle(token)), genStepsSmallStyle(token)), genStepsVerticalStyle(token)), genStepsLabelPlacementStyle(token)), genStepsProgressDotStyle(token)), genStepsNavStyle(token)), genStepsRTLStyle(token)), genStepsProgressStyle(token)), genStepsInlineStyle(token))
};
};
const useStyle$c = genComponentStyleHook("Steps", (token) => {
const {
wireframe,
colorTextDisabled,
fontSizeHeading3,
fontSize,
controlHeight,
controlHeightLG,
colorTextLightSolid,
colorText,
colorPrimary,
colorTextLabel,
colorTextDescription,
colorTextQuaternary,
colorFillContent,
controlItemBgActive,
colorError,
colorBgContainer,
colorBorderSecondary
} = token;
const stepsIconSize = token.controlHeight;
const processTailColor = token.colorSplit;
const stepsToken = merge(token, {
// Steps variable default.less
processTailColor,
stepsNavArrowColor: colorTextDisabled,
stepsIconSize,
stepsIconCustomSize: stepsIconSize,
stepsIconCustomTop: 0,
stepsIconCustomFontSize: controlHeightLG / 2,
stepsIconTop: -0.5,
stepsIconFontSize: fontSize,
stepsTitleLineHeight: controlHeight,
stepsSmallIconSize: fontSizeHeading3,
stepsDotSize: controlHeight / 4,
stepsCurrentDotSize: controlHeightLG / 4,
stepsNavContentMaxWidth: "auto",
// Steps component less variable
processIconColor: colorTextLightSolid,
processTitleColor: colorText,
processDescriptionColor: colorText,
processIconBgColor: colorPrimary,
processIconBorderColor: colorPrimary,
processDotColor: colorPrimary,
waitIconColor: wireframe ? colorTextDisabled : colorTextLabel,
waitTitleColor: colorTextDescription,
waitDescriptionColor: colorTextDescription,
waitTailColor: processTailColor,
waitIconBgColor: wireframe ? colorBgContainer : colorFillContent,
waitIconBorderColor: wireframe ? colorTextDisabled : "transparent",
waitDotColor: colorTextDisabled,
finishIconColor: colorPrimary,
finishTitleColor: colorText,
finishDescriptionColor: colorTextDescription,
finishTailColor: colorPrimary,
finishIconBgColor: wireframe ? colorBgContainer : controlItemBgActive,
finishIconBorderColor: wireframe ? colorPrimary : controlItemBgActive,
finishDotColor: colorPrimary,
errorIconColor: colorTextLightSolid,
errorTitleColor: colorError,
errorDescriptionColor: colorError,
errorTailColor: processTailColor,
errorIconBgColor: colorError,
errorIconBorderColor: colorError,
errorDotColor: colorError,
stepsNavActiveColor: colorPrimary,
stepsProgressSize: controlHeightLG,
// Steps inline variable
inlineDotSize: 6,
inlineTitleColor: colorTextQuaternary,
inlineTailColor: colorBorderSecondary
});
return [genStepsStyle(stepsToken)];
}, {
descriptionWidth: 140
});
const stepsProps = () => ({
prefixCls: String,
iconPrefix: String,
current: Number,
initial: Number,
percent: Number,
responsive: booleanType(),
items: arrayType(),
labelPlacement: stringType(),
status: stringType(),
size: stringType(),
direction: stringType(),
progressDot: someType([Boolean, Function]),
type: stringType(),
onChange: functionType(),
"onUpdate:current": functionType()
});
const Steps = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASteps",
inheritAttrs: false,
props: initDefaultProps(stepsProps(), {
current: 0,
responsive: true,
labelPlacement: "horizontal"
}),
slots: Object,
// emits: ['update:current', 'change'],
setup(props2, _ref) {
let {
attrs,
slots,
emit
} = _ref;
const {
prefixCls,
direction: rtlDirection,
configProvider
} = useConfigInject("steps", props2);
const [wrapSSR, hashId] = useStyle$c(prefixCls);
const [, token] = useToken();
const screens = useBreakpoint();
const direction = computed(() => props2.responsive && screens.value.xs ? "vertical" : props2.direction);
const iconPrefix = computed(() => configProvider.getPrefixCls("", props2.iconPrefix));
const handleChange = (current) => {
emit("update:current", current);
emit("change", current);
};
const isInline = computed(() => props2.type === "inline");
const mergedPercent = computed(() => isInline.value ? void 0 : props2.percent);
const stepIconRender = (_ref2) => {
let {
node,
status
} = _ref2;
if (status === "process" && props2.percent !== void 0) {
const progressWidth = props2.size === "small" ? token.value.controlHeight : token.value.controlHeightLG;
const iconWithProgress = createVNode("div", {
"class": `${prefixCls.value}-progress-icon`
}, [createVNode(__nuxt_component_1$2, {
"type": "circle",
"percent": mergedPercent.value,
"size": progressWidth,
"strokeWidth": 4,
"format": () => null
}, null), node]);
return iconWithProgress;
}
return node;
};
const icons2 = computed(() => ({
finish: createVNode(CheckOutlined, {
"class": `${prefixCls.value}-finish-icon`
}, null),
error: createVNode(CloseOutlined, {
"class": `${prefixCls.value}-error-icon`
}, null)
}));
return () => {
const stepsClassName = classNames({
[`${prefixCls.value}-rtl`]: rtlDirection.value === "rtl",
[`${prefixCls.value}-with-progress`]: mergedPercent.value !== void 0
}, attrs.class, hashId.value);
const itemRender = (item, stepItem) => item.description ? createVNode(__nuxt_component_2$4, {
"title": item.description
}, {
default: () => [stepItem]
}) : stepItem;
return wrapSSR(createVNode(Steps$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"icons": icons2.value
}, attrs), omit(props2, ["percent", "responsive"])), {}, {
"items": props2.items,
"direction": direction.value,
"prefixCls": prefixCls.value,
"iconPrefix": iconPrefix.value,
"class": stepsClassName,
"onChange": handleChange,
"isInline": isInline.value,
"itemRender": isInline.value ? itemRender : void 0
}), _extends({
stepIcon: stepIconRender
}, slots)));
};
}
});
const Step = defineComponent(_extends(_extends({
compatConfig: {
MODE: 3
}
}, VcStep), {
name: "AStep",
props: VcStepProps()
}));
const __nuxt_component_1$1 = _extends(Steps, {
Step,
install: (app) => {
app.component(Steps.name, Steps);
app.component(Step.name, Step);
return app;
}
});
const genSwitchSmallStyle = (token) => {
const {
componentCls
} = token;
const switchInnerCls = `${componentCls}-inner`;
return {
[componentCls]: {
[`&${componentCls}-small`]: {
minWidth: token.switchMinWidthSM,
height: token.switchHeightSM,
lineHeight: `${token.switchHeightSM}px`,
[`${componentCls}-inner`]: {
paddingInlineStart: token.switchInnerMarginMaxSM,
paddingInlineEnd: token.switchInnerMarginMinSM,
[`${switchInnerCls}-checked`]: {
marginInlineStart: `calc(-100% + ${token.switchPinSizeSM + token.switchPadding * 2}px - ${token.switchInnerMarginMaxSM * 2}px)`,
marginInlineEnd: `calc(100% - ${token.switchPinSizeSM + token.switchPadding * 2}px + ${token.switchInnerMarginMaxSM * 2}px)`
},
[`${switchInnerCls}-unchecked`]: {
marginTop: -token.switchHeightSM,
marginInlineStart: 0,
marginInlineEnd: 0
}
},
[`${componentCls}-handle`]: {
width: token.switchPinSizeSM,
height: token.switchPinSizeSM
},
[`${componentCls}-loading-icon`]: {
top: (token.switchPinSizeSM - token.switchLoadingIconSize) / 2,
fontSize: token.switchLoadingIconSize
},
[`&${componentCls}-checked`]: {
[`${componentCls}-inner`]: {
paddingInlineStart: token.switchInnerMarginMinSM,
paddingInlineEnd: token.switchInnerMarginMaxSM,
[`${switchInnerCls}-checked`]: {
marginInlineStart: 0,
marginInlineEnd: 0
},
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: `calc(100% - ${token.switchPinSizeSM + token.switchPadding * 2}px + ${token.switchInnerMarginMaxSM * 2}px)`,
marginInlineEnd: `calc(-100% + ${token.switchPinSizeSM + token.switchPadding * 2}px - ${token.switchInnerMarginMaxSM * 2}px)`
}
},
[`${componentCls}-handle`]: {
insetInlineStart: `calc(100% - ${token.switchPinSizeSM + token.switchPadding}px)`
}
},
[`&:not(${componentCls}-disabled):active`]: {
[`&:not(${componentCls}-checked) ${switchInnerCls}`]: {
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: token.marginXXS / 2,
marginInlineEnd: -token.marginXXS / 2
}
},
[`&${componentCls}-checked ${switchInnerCls}`]: {
[`${switchInnerCls}-checked`]: {
marginInlineStart: -token.marginXXS / 2,
marginInlineEnd: token.marginXXS / 2
}
}
}
}
}
};
};
const genSwitchLoadingStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: {
[`${componentCls}-loading-icon${token.iconCls}`]: {
position: "relative",
top: (token.switchPinSize - token.fontSize) / 2,
color: token.switchLoadingIconColor,
verticalAlign: "top"
},
[`&${componentCls}-checked ${componentCls}-loading-icon`]: {
color: token.switchColor
}
}
};
};
const genSwitchHandleStyle = (token) => {
const {
componentCls
} = token;
const switchHandleCls = `${componentCls}-handle`;
return {
[componentCls]: {
[switchHandleCls]: {
position: "absolute",
top: token.switchPadding,
insetInlineStart: token.switchPadding,
width: token.switchPinSize,
height: token.switchPinSize,
transition: `all ${token.switchDuration} ease-in-out`,
"&::before": {
position: "absolute",
top: 0,
insetInlineEnd: 0,
bottom: 0,
insetInlineStart: 0,
backgroundColor: token.colorWhite,
borderRadius: token.switchPinSize / 2,
boxShadow: token.switchHandleShadow,
transition: `all ${token.switchDuration} ease-in-out`,
content: '""'
}
},
[`&${componentCls}-checked ${switchHandleCls}`]: {
insetInlineStart: `calc(100% - ${token.switchPinSize + token.switchPadding}px)`
},
[`&:not(${componentCls}-disabled):active`]: {
[`${switchHandleCls}::before`]: {
insetInlineEnd: token.switchHandleActiveInset,
insetInlineStart: 0
},
[`&${componentCls}-checked ${switchHandleCls}::before`]: {
insetInlineEnd: 0,
insetInlineStart: token.switchHandleActiveInset
}
}
}
};
};
const genSwitchInnerStyle = (token) => {
const {
componentCls
} = token;
const switchInnerCls = `${componentCls}-inner`;
return {
[componentCls]: {
[switchInnerCls]: {
display: "block",
overflow: "hidden",
borderRadius: 100,
height: "100%",
paddingInlineStart: token.switchInnerMarginMax,
paddingInlineEnd: token.switchInnerMarginMin,
transition: `padding-inline-start ${token.switchDuration} ease-in-out, padding-inline-end ${token.switchDuration} ease-in-out`,
[`${switchInnerCls}-checked, ${switchInnerCls}-unchecked`]: {
display: "block",
color: token.colorTextLightSolid,
fontSize: token.fontSizeSM,
transition: `margin-inline-start ${token.switchDuration} ease-in-out, margin-inline-end ${token.switchDuration} ease-in-out`,
pointerEvents: "none"
},
[`${switchInnerCls}-checked`]: {
marginInlineStart: `calc(-100% + ${token.switchPinSize + token.switchPadding * 2}px - ${token.switchInnerMarginMax * 2}px)`,
marginInlineEnd: `calc(100% - ${token.switchPinSize + token.switchPadding * 2}px + ${token.switchInnerMarginMax * 2}px)`
},
[`${switchInnerCls}-unchecked`]: {
marginTop: -token.switchHeight,
marginInlineStart: 0,
marginInlineEnd: 0
}
},
[`&${componentCls}-checked ${switchInnerCls}`]: {
paddingInlineStart: token.switchInnerMarginMin,
paddingInlineEnd: token.switchInnerMarginMax,
[`${switchInnerCls}-checked`]: {
marginInlineStart: 0,
marginInlineEnd: 0
},
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: `calc(100% - ${token.switchPinSize + token.switchPadding * 2}px + ${token.switchInnerMarginMax * 2}px)`,
marginInlineEnd: `calc(-100% + ${token.switchPinSize + token.switchPadding * 2}px - ${token.switchInnerMarginMax * 2}px)`
}
},
[`&:not(${componentCls}-disabled):active`]: {
[`&:not(${componentCls}-checked) ${switchInnerCls}`]: {
[`${switchInnerCls}-unchecked`]: {
marginInlineStart: token.switchPadding * 2,
marginInlineEnd: -token.switchPadding * 2
}
},
[`&${componentCls}-checked ${switchInnerCls}`]: {
[`${switchInnerCls}-checked`]: {
marginInlineStart: -token.switchPadding * 2,
marginInlineEnd: token.switchPadding * 2
}
}
}
}
};
};
const genSwitchStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: _extends(_extends(_extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "inline-block",
boxSizing: "border-box",
minWidth: token.switchMinWidth,
height: token.switchHeight,
lineHeight: `${token.switchHeight}px`,
verticalAlign: "middle",
background: token.colorTextQuaternary,
border: "0",
borderRadius: 100,
cursor: "pointer",
transition: `all ${token.motionDurationMid}`,
userSelect: "none",
[`&:hover:not(${componentCls}-disabled)`]: {
background: token.colorTextTertiary
}
}), genFocusStyle(token)), {
[`&${componentCls}-checked`]: {
background: token.switchColor,
[`&:hover:not(${componentCls}-disabled)`]: {
background: token.colorPrimaryHover
}
},
[`&${componentCls}-loading, &${componentCls}-disabled`]: {
cursor: "not-allowed",
opacity: token.switchDisabledOpacity,
"*": {
boxShadow: "none",
cursor: "not-allowed"
}
},
// rtl style
[`&${componentCls}-rtl`]: {
direction: "rtl"
}
})
};
};
const useStyle$b = genComponentStyleHook("Switch", (token) => {
const switchHeight = token.fontSize * token.lineHeight;
const switchHeightSM = token.controlHeight / 2;
const switchPadding = 2;
const switchPinSize = switchHeight - switchPadding * 2;
const switchPinSizeSM = switchHeightSM - switchPadding * 2;
const switchToken = merge(token, {
switchMinWidth: switchPinSize * 2 + switchPadding * 4,
switchHeight,
switchDuration: token.motionDurationMid,
switchColor: token.colorPrimary,
switchDisabledOpacity: token.opacityLoading,
switchInnerMarginMin: switchPinSize / 2,
switchInnerMarginMax: switchPinSize + switchPadding + switchPadding * 2,
switchPadding,
switchPinSize,
switchBg: token.colorBgContainer,
switchMinWidthSM: switchPinSizeSM * 2 + switchPadding * 2,
switchHeightSM,
switchInnerMarginMinSM: switchPinSizeSM / 2,
switchInnerMarginMaxSM: switchPinSizeSM + switchPadding + switchPadding * 2,
switchPinSizeSM,
switchHandleShadow: `0 2px 4px 0 ${new TinyColor("#00230b").setAlpha(0.2).toRgbString()}`,
switchLoadingIconSize: token.fontSizeIcon * 0.75,
switchLoadingIconColor: `rgba(0, 0, 0, ${token.opacityLoading})`,
switchHandleActiveInset: "-30%"
});
return [
genSwitchStyle(switchToken),
// inner style
genSwitchInnerStyle(switchToken),
// handle style
genSwitchHandleStyle(switchToken),
// loading style
genSwitchLoadingStyle(switchToken),
// small style
genSwitchSmallStyle(switchToken)
];
});
const SwitchSizes = tuple$1("small", "default");
const switchProps = () => ({
id: String,
prefixCls: String,
size: PropTypes.oneOf(SwitchSizes),
disabled: {
type: Boolean,
default: void 0
},
checkedChildren: PropTypes.any,
unCheckedChildren: PropTypes.any,
tabindex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
autofocus: {
type: Boolean,
default: void 0
},
loading: {
type: Boolean,
default: void 0
},
checked: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.looseBool]),
checkedValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.looseBool]).def(true),
unCheckedValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.looseBool]).def(false),
onChange: {
type: Function
},
onClick: {
type: Function
},
onKeydown: {
type: Function
},
onMouseup: {
type: Function
},
"onUpdate:checked": {
type: Function
},
onBlur: Function,
onFocus: Function
});
const Switch = defineComponent({
compatConfig: {
MODE: 3
},
name: "ASwitch",
__ANT_SWITCH: true,
inheritAttrs: false,
props: switchProps(),
slots: Object,
// emits: ['update:checked', 'mouseup', 'change', 'click', 'keydown', 'blur'],
setup(props2, _ref) {
let {
attrs,
slots,
expose,
emit
} = _ref;
const formItemContext = useInjectFormItemContext();
const disabledContext = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a;
return (_a = props2.disabled) !== null && _a !== void 0 ? _a : disabledContext.value;
});
const checked = ref(props2.checked !== void 0 ? props2.checked : attrs.defaultChecked);
const checkedStatus = computed(() => checked.value === props2.checkedValue);
watch(() => props2.checked, () => {
checked.value = props2.checked;
});
const {
prefixCls,
direction,
size
} = useConfigInject("switch", props2);
const [wrapSSR, hashId] = useStyle$b(prefixCls);
const refSwitchNode = ref();
const focus = () => {
var _a;
(_a = refSwitchNode.value) === null || _a === void 0 ? void 0 : _a.focus();
};
const blur = () => {
var _a;
(_a = refSwitchNode.value) === null || _a === void 0 ? void 0 : _a.blur();
};
expose({
focus,
blur
});
const setChecked = (check, e) => {
if (mergedDisabled.value) {
return;
}
emit("update:checked", check);
emit("change", check, e);
formItemContext.onFieldChange();
};
const handleBlur = (e) => {
emit("blur", e);
};
const handleClick = (e) => {
focus();
const newChecked = checkedStatus.value ? props2.unCheckedValue : props2.checkedValue;
setChecked(newChecked, e);
emit("click", newChecked, e);
};
const handleKeyDown = (e) => {
if (e.keyCode === KeyCode.LEFT) {
setChecked(props2.unCheckedValue, e);
} else if (e.keyCode === KeyCode.RIGHT) {
setChecked(props2.checkedValue, e);
}
emit("keydown", e);
};
const handleMouseUp = (e) => {
var _a;
(_a = refSwitchNode.value) === null || _a === void 0 ? void 0 : _a.blur();
emit("mouseup", e);
};
const classNames2 = computed(() => ({
[`${prefixCls.value}-small`]: size.value === "small",
[`${prefixCls.value}-loading`]: props2.loading,
[`${prefixCls.value}-checked`]: checkedStatus.value,
[`${prefixCls.value}-disabled`]: mergedDisabled.value,
[prefixCls.value]: true,
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[hashId.value]: true
}));
return () => {
var _a;
return wrapSSR(createVNode(Wave, null, {
default: () => [createVNode("button", _objectSpread$W(_objectSpread$W(_objectSpread$W({}, omit(props2, ["prefixCls", "checkedChildren", "unCheckedChildren", "checked", "autofocus", "checkedValue", "unCheckedValue", "id", "onChange", "onUpdate:checked"])), attrs), {}, {
"id": (_a = props2.id) !== null && _a !== void 0 ? _a : formItemContext.id.value,
"onKeydown": handleKeyDown,
"onClick": handleClick,
"onBlur": handleBlur,
"onMouseup": handleMouseUp,
"type": "button",
"role": "switch",
"aria-checked": checked.value,
"disabled": mergedDisabled.value || props2.loading,
"class": [attrs.class, classNames2.value],
"ref": refSwitchNode
}), [createVNode("div", {
"class": `${prefixCls.value}-handle`
}, [props2.loading ? createVNode(LoadingOutlined, {
"class": `${prefixCls.value}-loading-icon`
}, null) : null]), createVNode("span", {
"class": `${prefixCls.value}-inner`
}, [createVNode("span", {
"class": `${prefixCls.value}-inner-checked`
}, [getPropsSlot(slots, props2, "checkedChildren")]), createVNode("span", {
"class": `${prefixCls.value}-inner-unchecked`
}, [getPropsSlot(slots, props2, "unCheckedChildren")])])])]
}));
};
}
});
const index$a = withInstall(Switch);
const TableContextKey = Symbol("TableContextProps");
const useProvideTable = (props2) => {
provide(TableContextKey, props2);
};
const useInjectTable = () => {
return inject(TableContextKey, {});
};
const INTERNAL_KEY_PREFIX = "RC_TABLE_KEY";
function toArray$1(arr) {
if (arr === void 0 || arr === null) {
return [];
}
return Array.isArray(arr) ? arr : [arr];
}
function getPathValue(record, path2) {
if (!path2 && typeof path2 !== "number") {
return record;
}
const pathList = toArray$1(path2);
let current = record;
for (let i = 0; i < pathList.length; i += 1) {
if (!current) {
return null;
}
const prop = pathList[i];
current = current[prop];
}
return current;
}
function getColumnsKey(columns) {
const columnKeys = [];
const keys = {};
columns.forEach((column) => {
const {
key: key2,
dataIndex
} = column || {};
let mergedKey = key2 || toArray$1(dataIndex).join("-") || INTERNAL_KEY_PREFIX;
while (keys[mergedKey]) {
mergedKey = `${mergedKey}_next`;
}
keys[mergedKey] = true;
columnKeys.push(mergedKey);
});
return columnKeys;
}
function mergeObject() {
const merged = {};
function fillProps(obj, clone) {
if (clone) {
Object.keys(clone).forEach((key2) => {
const value = clone[key2];
if (value && typeof value === "object") {
obj[key2] = obj[key2] || {};
fillProps(obj[key2], value);
} else {
obj[key2] = value;
}
});
}
}
for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
objects[_key] = arguments[_key];
}
objects.forEach((clone) => {
fillProps(merged, clone);
});
return merged;
}
function validateValue(val) {
return val !== null && val !== void 0;
}
const SlotsContextKey = Symbol("SlotsContextProps");
const useProvideSlots = (props2) => {
provide(SlotsContextKey, props2);
};
const useInjectSlots = () => {
return inject(SlotsContextKey, computed(() => ({})));
};
const ContextKey = Symbol("ContextProps");
const useProvideTableContext = (props2) => {
provide(ContextKey, props2);
};
const useInjectTableContext = () => {
return inject(ContextKey, {
onResizeColumn: () => {
}
});
};
const INTERNAL_COL_DEFINE = "RC_TABLE_INTERNAL_COL_DEFINE";
const HoverContextKey = Symbol("HoverContextProps");
const useProvideHover = (props2) => {
provide(HoverContextKey, props2);
};
const useInjectHover = () => {
return inject(HoverContextKey, {
startRow: shallowRef(-1),
endRow: shallowRef(-1),
onHover() {
}
});
};
const supportSticky = shallowRef(false);
const useInjectSticky = () => {
return supportSticky;
};
var __rest$i = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function inHoverRange(cellStartRow, cellRowSpan, startRow, endRow) {
const cellEndRow = cellStartRow + cellRowSpan - 1;
return cellStartRow <= endRow && cellEndRow >= startRow;
}
function isRenderCell(data) {
return data && typeof data === "object" && !Array.isArray(data) && !isVNode(data);
}
const Cell = defineComponent({
name: "Cell",
props: ["prefixCls", "record", "index", "renderIndex", "dataIndex", "customRender", "component", "colSpan", "rowSpan", "fixLeft", "fixRight", "firstFixLeft", "lastFixLeft", "firstFixRight", "lastFixRight", "appendNode", "additionalProps", "ellipsis", "align", "rowType", "isSticky", "column", "cellType", "transformCellText"],
setup(props2, _ref) {
let {
slots
} = _ref;
const contextSlots = useInjectSlots();
const {
onHover,
startRow,
endRow
} = useInjectHover();
const colSpan = computed(() => {
var _a, _b, _c, _d;
return (_c = (_a = props2.colSpan) !== null && _a !== void 0 ? _a : (_b = props2.additionalProps) === null || _b === void 0 ? void 0 : _b.colSpan) !== null && _c !== void 0 ? _c : (_d = props2.additionalProps) === null || _d === void 0 ? void 0 : _d.colspan;
});
const rowSpan = computed(() => {
var _a, _b, _c, _d;
return (_c = (_a = props2.rowSpan) !== null && _a !== void 0 ? _a : (_b = props2.additionalProps) === null || _b === void 0 ? void 0 : _b.rowSpan) !== null && _c !== void 0 ? _c : (_d = props2.additionalProps) === null || _d === void 0 ? void 0 : _d.rowspan;
});
const hovering = eagerComputed(() => {
const {
index: index2
} = props2;
return inHoverRange(index2, rowSpan.value || 1, startRow.value, endRow.value);
});
const supportSticky2 = useInjectSticky();
const onMouseenter = (event, mergedRowSpan) => {
var _a;
const {
record,
index: index2,
additionalProps
} = props2;
if (record) {
onHover(index2, index2 + mergedRowSpan - 1);
}
(_a = additionalProps === null || additionalProps === void 0 ? void 0 : additionalProps.onMouseenter) === null || _a === void 0 ? void 0 : _a.call(additionalProps, event);
};
const onMouseleave = (event) => {
var _a;
const {
record,
additionalProps
} = props2;
if (record) {
onHover(-1, -1);
}
(_a = additionalProps === null || additionalProps === void 0 ? void 0 : additionalProps.onMouseleave) === null || _a === void 0 ? void 0 : _a.call(additionalProps, event);
};
const getTitle = (vnodes) => {
const vnode = filterEmpty(vnodes)[0];
if (isVNode(vnode)) {
if (vnode.type === Text$1) {
return vnode.children;
} else {
return Array.isArray(vnode.children) ? getTitle(vnode.children) : void 0;
}
} else {
return vnode;
}
};
const hoverRef = shallowRef(null);
watch([hovering, () => props2.prefixCls, hoverRef], () => {
const cellDom = findDOMNode(hoverRef.value);
if (!cellDom) return;
if (hovering.value) {
addClass(cellDom, `${props2.prefixCls}-cell-row-hover`);
} else {
removeClass(cellDom, `${props2.prefixCls}-cell-row-hover`);
}
});
return () => {
var _a, _b, _c, _d, _e, _f;
const {
prefixCls,
record,
index: index2,
renderIndex,
dataIndex,
customRender,
component: Component = "td",
fixLeft,
fixRight,
firstFixLeft,
lastFixLeft,
firstFixRight,
lastFixRight,
appendNode = (_a = slots.appendNode) === null || _a === void 0 ? void 0 : _a.call(slots),
additionalProps = {},
ellipsis,
align,
rowType,
isSticky,
column = {},
cellType
} = props2;
const cellPrefixCls = `${prefixCls}-cell`;
let cellProps;
let childNode;
const children = (_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots);
if (validateValue(children) || cellType === "header") {
childNode = children;
} else {
const value = getPathValue(record, dataIndex);
childNode = value;
if (customRender) {
const renderData = customRender({
text: value,
value,
record,
index: index2,
renderIndex,
column: column.__originColumn__
});
if (isRenderCell(renderData)) {
childNode = renderData.children;
cellProps = renderData.props;
} else {
childNode = renderData;
}
}
if (!(INTERNAL_COL_DEFINE in column) && cellType === "body" && contextSlots.value.bodyCell && !((_c = column.slots) === null || _c === void 0 ? void 0 : _c.customRender)) {
const child = customRenderSlot(contextSlots.value, "bodyCell", {
text: value,
value,
record,
index: index2,
column: column.__originColumn__
}, () => {
const fallback = childNode === void 0 ? value : childNode;
return [typeof fallback === "object" && isValidElement(fallback) || typeof fallback !== "object" ? fallback : null];
});
childNode = flattenChildren(child);
}
if (props2.transformCellText) {
childNode = props2.transformCellText({
text: childNode,
record,
index: index2,
column: column.__originColumn__
});
}
}
if (typeof childNode === "object" && !Array.isArray(childNode) && !isVNode(childNode)) {
childNode = null;
}
if (ellipsis && (lastFixLeft || firstFixRight)) {
childNode = createVNode("span", {
"class": `${cellPrefixCls}-content`
}, [childNode]);
}
if (Array.isArray(childNode) && childNode.length === 1) {
childNode = childNode[0];
}
const _g = cellProps || {}, {
colSpan: cellColSpan,
rowSpan: cellRowSpan,
style: cellStyle,
class: cellClassName
} = _g, restCellProps = __rest$i(_g, ["colSpan", "rowSpan", "style", "class"]);
const mergedColSpan = (_d = cellColSpan !== void 0 ? cellColSpan : colSpan.value) !== null && _d !== void 0 ? _d : 1;
const mergedRowSpan = (_e = cellRowSpan !== void 0 ? cellRowSpan : rowSpan.value) !== null && _e !== void 0 ? _e : 1;
if (mergedColSpan === 0 || mergedRowSpan === 0) {
return null;
}
const fixedStyle = {};
const isFixLeft = typeof fixLeft === "number" && supportSticky2.value;
const isFixRight = typeof fixRight === "number" && supportSticky2.value;
if (isFixLeft) {
fixedStyle.position = "sticky";
fixedStyle.left = `${fixLeft}px`;
}
if (isFixRight) {
fixedStyle.position = "sticky";
fixedStyle.right = `${fixRight}px`;
}
const alignStyle = {};
if (align) {
alignStyle.textAlign = align;
}
let title;
const ellipsisConfig = ellipsis === true ? {
showTitle: true
} : ellipsis;
if (ellipsisConfig && (ellipsisConfig.showTitle || rowType === "header")) {
if (typeof childNode === "string" || typeof childNode === "number") {
title = childNode.toString();
} else if (isVNode(childNode)) {
title = getTitle([childNode]);
}
}
const componentProps = _extends(_extends(_extends({
title
}, restCellProps), additionalProps), {
colSpan: mergedColSpan !== 1 ? mergedColSpan : null,
rowSpan: mergedRowSpan !== 1 ? mergedRowSpan : null,
class: classNames(cellPrefixCls, {
[`${cellPrefixCls}-fix-left`]: isFixLeft && supportSticky2.value,
[`${cellPrefixCls}-fix-left-first`]: firstFixLeft && supportSticky2.value,
[`${cellPrefixCls}-fix-left-last`]: lastFixLeft && supportSticky2.value,
[`${cellPrefixCls}-fix-right`]: isFixRight && supportSticky2.value,
[`${cellPrefixCls}-fix-right-first`]: firstFixRight && supportSticky2.value,
[`${cellPrefixCls}-fix-right-last`]: lastFixRight && supportSticky2.value,
[`${cellPrefixCls}-ellipsis`]: ellipsis,
[`${cellPrefixCls}-with-append`]: appendNode,
[`${cellPrefixCls}-fix-sticky`]: (isFixLeft || isFixRight) && isSticky && supportSticky2.value
}, additionalProps.class, cellClassName),
onMouseenter: (e) => {
onMouseenter(e, mergedRowSpan);
},
onMouseleave,
style: [additionalProps.style, alignStyle, fixedStyle, cellStyle]
});
return createVNode(Component, _objectSpread$W(_objectSpread$W({}, componentProps), {}, {
"ref": hoverRef
}), {
default: () => [appendNode, childNode, (_f = slots.dragHandle) === null || _f === void 0 ? void 0 : _f.call(slots)]
});
};
}
});
function getCellFixedInfo(colStart, colEnd, columns, stickyOffsets, direction) {
const startColumn = columns[colStart] || {};
const endColumn = columns[colEnd] || {};
let fixLeft;
let fixRight;
if (startColumn.fixed === "left") {
fixLeft = stickyOffsets.left[colStart];
} else if (endColumn.fixed === "right") {
fixRight = stickyOffsets.right[colEnd];
}
let lastFixLeft = false;
let firstFixRight = false;
let lastFixRight = false;
let firstFixLeft = false;
const nextColumn = columns[colEnd + 1];
const prevColumn = columns[colStart - 1];
if (direction === "rtl") {
if (fixLeft !== void 0) {
const prevFixLeft = prevColumn && prevColumn.fixed === "left";
firstFixLeft = !prevFixLeft;
} else if (fixRight !== void 0) {
const nextFixRight = nextColumn && nextColumn.fixed === "right";
lastFixRight = !nextFixRight;
}
} else if (fixLeft !== void 0) {
const nextFixLeft = nextColumn && nextColumn.fixed === "left";
lastFixLeft = !nextFixLeft;
} else if (fixRight !== void 0) {
const prevFixRight = prevColumn && prevColumn.fixed === "right";
firstFixRight = !prevFixRight;
}
return {
fixLeft,
fixRight,
lastFixLeft,
firstFixRight,
lastFixRight,
firstFixLeft,
isSticky: stickyOffsets.isSticky
};
}
const events = {
mouse: {
move: "mousemove",
stop: "mouseup"
},
touch: {
move: "touchmove",
stop: "touchend"
}
};
const defaultMinWidth = 50;
const DragHandleVue = defineComponent({
compatConfig: {
MODE: 3
},
name: "DragHandle",
props: {
prefixCls: String,
width: {
type: Number,
required: true
},
minWidth: {
type: Number,
default: defaultMinWidth
},
maxWidth: {
type: Number,
default: Infinity
},
column: {
type: Object,
default: void 0
}
},
setup(props2) {
let startX = 0;
let moveEvent = {
remove: () => {
}
};
let stopEvent = {
remove: () => {
}
};
const removeEvents = () => {
moveEvent.remove();
stopEvent.remove();
};
watchEffect(() => {
devWarning(!isNaN(props2.width), "Table", "width must be a number when use resizable");
});
const {
onResizeColumn
} = useInjectTableContext();
const minWidth = computed(() => {
return typeof props2.minWidth === "number" && !isNaN(props2.minWidth) ? props2.minWidth : defaultMinWidth;
});
const maxWidth = computed(() => {
return typeof props2.maxWidth === "number" && !isNaN(props2.maxWidth) ? props2.maxWidth : Infinity;
});
const instance = getCurrentInstance();
let baseWidth = 0;
const dragging = shallowRef(false);
let rafId;
const updateWidth = (e) => {
let pageX = 0;
if (e.touches) {
if (e.touches.length) {
pageX = e.touches[0].pageX;
} else {
pageX = e.changedTouches[0].pageX;
}
} else {
pageX = e.pageX;
}
const tmpDeltaX = startX - pageX;
let w = Math.max(baseWidth - tmpDeltaX, minWidth.value);
w = Math.min(w, maxWidth.value);
wrapperRaf.cancel(rafId);
rafId = wrapperRaf(() => {
onResizeColumn(w, props2.column.__originColumn__);
});
};
const handleMove = (e) => {
updateWidth(e);
};
const handleStop = (e) => {
dragging.value = false;
updateWidth(e);
removeEvents();
};
const handleStart = (e, eventsFor) => {
dragging.value = true;
removeEvents();
baseWidth = instance.vnode.el.parentNode.getBoundingClientRect().width;
if (e instanceof MouseEvent && e.which !== 1) {
return;
}
if (e.stopPropagation) e.stopPropagation();
startX = e.touches ? e.touches[0].pageX : e.pageX;
moveEvent = addEventListenerWrap((void 0).documentElement, eventsFor.move, handleMove);
stopEvent = addEventListenerWrap((void 0).documentElement, eventsFor.stop, handleStop);
};
const handleDown = (e) => {
e.stopPropagation();
e.preventDefault();
handleStart(e, events.mouse);
};
const handleTouchDown = (e) => {
e.stopPropagation();
e.preventDefault();
handleStart(e, events.touch);
};
const handleClick = (e) => {
e.stopPropagation();
e.preventDefault();
};
return () => {
const {
prefixCls
} = props2;
const touchEvents = {
[supportsPassive ? "onTouchstartPassive" : "onTouchstart"]: (e) => handleTouchDown(e)
};
return createVNode("div", _objectSpread$W(_objectSpread$W({
"class": `${prefixCls}-resize-handle ${dragging.value ? "dragging" : ""}`,
"onMousedown": handleDown
}, touchEvents), {}, {
"onClick": handleClick
}), [createVNode("div", {
"class": `${prefixCls}-resize-handle-line`
}, null)]);
};
}
});
const HeaderRow = defineComponent({
name: "HeaderRow",
props: ["cells", "stickyOffsets", "flattenColumns", "rowComponent", "cellComponent", "index", "customHeaderRow"],
setup(props2) {
const tableContext = useInjectTable();
return () => {
const {
prefixCls,
direction
} = tableContext;
const {
cells,
stickyOffsets,
flattenColumns,
rowComponent: RowComponent,
cellComponent: CellComponent,
customHeaderRow,
index: index2
} = props2;
let rowProps2;
if (customHeaderRow) {
rowProps2 = customHeaderRow(cells.map((cell) => cell.column), index2);
}
const columnsKey = getColumnsKey(cells.map((cell) => cell.column));
return createVNode(RowComponent, rowProps2, {
default: () => [cells.map((cell, cellIndex) => {
const {
column
} = cell;
const fixedInfo = getCellFixedInfo(cell.colStart, cell.colEnd, flattenColumns, stickyOffsets, direction);
let additionalProps;
if (column && column.customHeaderCell) {
additionalProps = cell.column.customHeaderCell(column);
}
const col = column;
return createVNode(Cell, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, cell), {}, {
"cellType": "header",
"ellipsis": column.ellipsis,
"align": column.align,
"component": CellComponent,
"prefixCls": prefixCls,
"key": columnsKey[cellIndex]
}, fixedInfo), {}, {
"additionalProps": additionalProps,
"rowType": "header",
"column": column
}), {
default: () => column.title,
dragHandle: () => col.resizable ? createVNode(DragHandleVue, {
"prefixCls": prefixCls,
"width": col.width,
"minWidth": col.minWidth,
"maxWidth": col.maxWidth,
"column": col
}, null) : null
});
})]
});
};
}
});
function parseHeaderRows(rootColumns) {
const rows = [];
function fillRowCells(columns, colIndex) {
let rowIndex = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
rows[rowIndex] = rows[rowIndex] || [];
let currentColIndex = colIndex;
const colSpans = columns.filter(Boolean).map((column) => {
const cell = {
key: column.key,
class: classNames(column.className, column.class),
// children: column.title,
column,
colStart: currentColIndex
};
let colSpan = 1;
const subColumns = column.children;
if (subColumns && subColumns.length > 0) {
colSpan = fillRowCells(subColumns, currentColIndex, rowIndex + 1).reduce((total, count) => total + count, 0);
cell.hasSubColumns = true;
}
if ("colSpan" in column) {
({
colSpan
} = column);
}
if ("rowSpan" in column) {
cell.rowSpan = column.rowSpan;
}
cell.colSpan = colSpan;
cell.colEnd = cell.colStart + colSpan - 1;
rows[rowIndex].push(cell);
currentColIndex += colSpan;
return colSpan;
});
return colSpans;
}
fillRowCells(rootColumns, 0);
const rowCount = rows.length;
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
rows[rowIndex].forEach((cell) => {
if (!("rowSpan" in cell) && !cell.hasSubColumns) {
cell.rowSpan = rowCount - rowIndex;
}
});
}
return rows;
}
const Header = defineComponent({
name: "TableHeader",
inheritAttrs: false,
props: ["columns", "flattenColumns", "stickyOffsets", "customHeaderRow"],
setup(props2) {
const tableContext = useInjectTable();
const rows = computed(() => parseHeaderRows(props2.columns));
return () => {
const {
prefixCls,
getComponent: getComponent2
} = tableContext;
const {
stickyOffsets,
flattenColumns,
customHeaderRow
} = props2;
const WrapperComponent = getComponent2(["header", "wrapper"], "thead");
const trComponent = getComponent2(["header", "row"], "tr");
const thComponent = getComponent2(["header", "cell"], "th");
return createVNode(WrapperComponent, {
"class": `${prefixCls}-thead`
}, {
default: () => [rows.value.map((row, rowIndex) => {
const rowNode = createVNode(HeaderRow, {
"key": rowIndex,
"flattenColumns": flattenColumns,
"cells": row,
"stickyOffsets": stickyOffsets,
"rowComponent": trComponent,
"cellComponent": thComponent,
"customHeaderRow": customHeaderRow,
"index": rowIndex
}, null);
return rowNode;
})]
});
};
}
});
const ExpandedRowContextKey = Symbol("ExpandedRowProps");
const useProvideExpandedRow = (props2) => {
provide(ExpandedRowContextKey, props2);
};
const useInjectExpandedRow = () => {
return inject(ExpandedRowContextKey, {});
};
const ExpandedRow = defineComponent({
name: "ExpandedRow",
inheritAttrs: false,
props: ["prefixCls", "component", "cellComponent", "expanded", "colSpan", "isEmpty"],
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const tableContext = useInjectTable();
const expandedRowContext = useInjectExpandedRow();
const {
fixHeader,
fixColumn,
componentWidth,
horizonScroll
} = expandedRowContext;
return () => {
const {
prefixCls,
component: Component,
cellComponent,
expanded,
colSpan,
isEmpty: isEmpty2
} = props2;
return createVNode(Component, {
"class": attrs.class,
"style": {
display: expanded ? null : "none"
}
}, {
default: () => [createVNode(Cell, {
"component": cellComponent,
"prefixCls": prefixCls,
"colSpan": colSpan
}, {
default: () => {
var _a;
let contentNode = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
if (isEmpty2 ? horizonScroll.value : fixColumn.value) {
contentNode = createVNode("div", {
"style": {
width: `${componentWidth.value - (fixHeader.value ? tableContext.scrollbarSize : 0)}px`,
position: "sticky",
left: 0,
overflow: "hidden"
},
"class": `${prefixCls}-expanded-row-fixed`
}, [contentNode]);
}
return contentNode;
}
})]
});
};
}
});
const MeasureCell = defineComponent({
name: "MeasureCell",
props: ["columnKey"],
setup(props2, _ref) {
let {
emit
} = _ref;
const tdRef = ref();
return () => {
return createVNode(ResizeObserver$1, {
"onResize": (_ref2) => {
let {
offsetWidth
} = _ref2;
emit("columnResize", props2.columnKey, offsetWidth);
}
}, {
default: () => [createVNode("td", {
"ref": tdRef,
"style": {
padding: 0,
border: 0,
height: 0
}
}, [createVNode("div", {
"style": {
height: 0,
overflow: "hidden"
}
}, [createTextVNode(" ")])])]
});
};
}
});
const BodyContextKey = Symbol("BodyContextProps");
const useProvideBody = (props2) => {
provide(BodyContextKey, props2);
};
const useInjectBody = () => {
return inject(BodyContextKey, {});
};
const BodyRow = defineComponent({
name: "BodyRow",
inheritAttrs: false,
props: ["record", "index", "renderIndex", "recordKey", "expandedKeys", "rowComponent", "cellComponent", "customRow", "rowExpandable", "indent", "rowKey", "getRowKey", "childrenColumnName"],
setup(props2, _ref) {
let {
attrs
} = _ref;
const tableContext = useInjectTable();
const bodyContext = useInjectBody();
const expandRended = shallowRef(false);
const expanded = computed(() => props2.expandedKeys && props2.expandedKeys.has(props2.recordKey));
watchEffect(() => {
if (expanded.value) {
expandRended.value = true;
}
});
const rowSupportExpand = computed(() => bodyContext.expandableType === "row" && (!props2.rowExpandable || props2.rowExpandable(props2.record)));
const nestExpandable = computed(() => bodyContext.expandableType === "nest");
const hasNestChildren = computed(() => props2.childrenColumnName && props2.record && props2.record[props2.childrenColumnName]);
const mergedExpandable = computed(() => rowSupportExpand.value || nestExpandable.value);
const onInternalTriggerExpand = (record, event) => {
bodyContext.onTriggerExpand(record, event);
};
const additionalProps = computed(() => {
var _a;
return ((_a = props2.customRow) === null || _a === void 0 ? void 0 : _a.call(props2, props2.record, props2.index)) || {};
});
const onClick = function(event) {
var _a, _b;
if (bodyContext.expandRowByClick && mergedExpandable.value) {
onInternalTriggerExpand(props2.record, event);
}
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_b = (_a = additionalProps.value) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event, ...args);
};
const computeRowClassName = computed(() => {
const {
record,
index: index2,
indent
} = props2;
const {
rowClassName
} = bodyContext;
if (typeof rowClassName === "string") {
return rowClassName;
} else if (typeof rowClassName === "function") {
return rowClassName(record, index2, indent);
}
return "";
});
const columnsKey = computed(() => getColumnsKey(bodyContext.flattenColumns));
return () => {
const {
class: className,
style
} = attrs;
const {
record,
index: index2,
rowKey,
indent = 0,
rowComponent: RowComponent,
cellComponent
} = props2;
const {
prefixCls,
fixedInfoList,
transformCellText
} = tableContext;
const {
flattenColumns,
expandedRowClassName,
indentSize,
expandIcon,
expandedRowRender,
expandIconColumnIndex
} = bodyContext;
const baseRowNode = createVNode(RowComponent, _objectSpread$W(_objectSpread$W({}, additionalProps.value), {}, {
"data-row-key": rowKey,
"class": classNames(className, `${prefixCls}-row`, `${prefixCls}-row-level-${indent}`, computeRowClassName.value, additionalProps.value.class),
"style": [style, additionalProps.value.style],
"onClick": onClick
}), {
default: () => [flattenColumns.map((column, colIndex) => {
const {
customRender,
dataIndex,
className: columnClassName
} = column;
const key2 = columnsKey[colIndex];
const fixedInfo = fixedInfoList[colIndex];
let additionalCellProps;
if (column.customCell) {
additionalCellProps = column.customCell(record, index2, column);
}
const appendNode = colIndex === (expandIconColumnIndex || 0) && nestExpandable.value ? createVNode(Fragment, null, [createVNode("span", {
"style": {
paddingLeft: `${indentSize * indent}px`
},
"class": `${prefixCls}-row-indent indent-level-${indent}`
}, null), expandIcon({
prefixCls,
expanded: expanded.value,
expandable: hasNestChildren.value,
record,
onExpand: onInternalTriggerExpand
})]) : null;
return createVNode(Cell, _objectSpread$W(_objectSpread$W({
"cellType": "body",
"class": columnClassName,
"ellipsis": column.ellipsis,
"align": column.align,
"component": cellComponent,
"prefixCls": prefixCls,
"key": key2,
"record": record,
"index": index2,
"renderIndex": props2.renderIndex,
"dataIndex": dataIndex,
"customRender": customRender
}, fixedInfo), {}, {
"additionalProps": additionalCellProps,
"column": column,
"transformCellText": transformCellText,
"appendNode": appendNode
}), null);
})]
});
let expandRowNode;
if (rowSupportExpand.value && (expandRended.value || expanded.value)) {
const expandContent = expandedRowRender({
record,
index: index2,
indent: indent + 1,
expanded: expanded.value
});
const computedExpandedRowClassName = expandedRowClassName && expandedRowClassName(record, index2, indent);
expandRowNode = createVNode(ExpandedRow, {
"expanded": expanded.value,
"class": classNames(`${prefixCls}-expanded-row`, `${prefixCls}-expanded-row-level-${indent + 1}`, computedExpandedRowClassName),
"prefixCls": prefixCls,
"component": RowComponent,
"cellComponent": cellComponent,
"colSpan": flattenColumns.length,
"isEmpty": false
}, {
default: () => [expandContent]
});
}
return createVNode(Fragment, null, [baseRowNode, expandRowNode]);
};
}
});
function flatRecord(record, indent, childrenColumnName, expandedKeys, getRowKey, index2) {
const arr = [];
arr.push({
record,
indent,
index: index2
});
const key2 = getRowKey(record);
const expanded = expandedKeys === null || expandedKeys === void 0 ? void 0 : expandedKeys.has(key2);
if (record && Array.isArray(record[childrenColumnName]) && expanded) {
for (let i = 0; i < record[childrenColumnName].length; i += 1) {
const tempArr = flatRecord(record[childrenColumnName][i], indent + 1, childrenColumnName, expandedKeys, getRowKey, i);
arr.push(...tempArr);
}
}
return arr;
}
function useFlattenRecords(dataRef, childrenColumnNameRef, expandedKeysRef, getRowKey) {
const arr = computed(() => {
const childrenColumnName = childrenColumnNameRef.value;
const expandedKeys = expandedKeysRef.value;
const data = dataRef.value;
if (expandedKeys === null || expandedKeys === void 0 ? void 0 : expandedKeys.size) {
const temp = [];
for (let i = 0; i < (data === null || data === void 0 ? void 0 : data.length); i += 1) {
const record = data[i];
temp.push(...flatRecord(record, 0, childrenColumnName, expandedKeys, getRowKey.value, i));
}
return temp;
}
return data === null || data === void 0 ? void 0 : data.map((item, index2) => {
return {
record: item,
indent: 0,
index: index2
};
});
});
return arr;
}
const ResizeContextKey = Symbol("ResizeContextProps");
const useProvideResize = (props2) => {
provide(ResizeContextKey, props2);
};
const useInjectResize = () => {
return inject(ResizeContextKey, {
onColumnResize: () => {
}
});
};
const Body = defineComponent({
name: "TableBody",
props: ["data", "getRowKey", "measureColumnWidth", "expandedKeys", "customRow", "rowExpandable", "childrenColumnName"],
setup(props2, _ref) {
let {
slots
} = _ref;
const resizeContext = useInjectResize();
const tableContext = useInjectTable();
const bodyContext = useInjectBody();
const flattenData2 = useFlattenRecords(toRef(props2, "data"), toRef(props2, "childrenColumnName"), toRef(props2, "expandedKeys"), toRef(props2, "getRowKey"));
const startRow = shallowRef(-1);
const endRow = shallowRef(-1);
let timeoutId;
useProvideHover({
startRow,
endRow,
onHover: (start, end) => {
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
startRow.value = start;
endRow.value = end;
}, 100);
}
});
return () => {
var _a;
const {
data,
getRowKey,
measureColumnWidth,
expandedKeys,
customRow,
rowExpandable,
childrenColumnName
} = props2;
const {
onColumnResize
} = resizeContext;
const {
prefixCls,
getComponent: getComponent2
} = tableContext;
const {
flattenColumns
} = bodyContext;
const WrapperComponent = getComponent2(["body", "wrapper"], "tbody");
const trComponent = getComponent2(["body", "row"], "tr");
const tdComponent = getComponent2(["body", "cell"], "td");
let rows;
if (data.length) {
rows = flattenData2.value.map((item, idx) => {
const {
record,
indent,
index: renderIndex
} = item;
const key2 = getRowKey(record, idx);
return createVNode(BodyRow, {
"key": key2,
"rowKey": key2,
"record": record,
"recordKey": key2,
"index": idx,
"renderIndex": renderIndex,
"rowComponent": trComponent,
"cellComponent": tdComponent,
"expandedKeys": expandedKeys,
"customRow": customRow,
"getRowKey": getRowKey,
"rowExpandable": rowExpandable,
"childrenColumnName": childrenColumnName,
"indent": indent
}, null);
});
} else {
rows = createVNode(ExpandedRow, {
"expanded": true,
"class": `${prefixCls}-placeholder`,
"prefixCls": prefixCls,
"component": trComponent,
"cellComponent": tdComponent,
"colSpan": flattenColumns.length,
"isEmpty": true
}, {
default: () => [(_a = slots.emptyNode) === null || _a === void 0 ? void 0 : _a.call(slots)]
});
}
const columnsKey = getColumnsKey(flattenColumns);
return createVNode(WrapperComponent, {
"class": `${prefixCls}-tbody`
}, {
default: () => [measureColumnWidth && createVNode("tr", {
"aria-hidden": "true",
"class": `${prefixCls}-measure-row`,
"style": {
height: 0,
fontSize: 0
}
}, [columnsKey.map((columnKey) => createVNode(MeasureCell, {
"key": columnKey,
"columnKey": columnKey,
"onColumnResize": onColumnResize
}, null))]), rows]
});
};
}
});
const EXPAND_COLUMN = {};
var __rest$h = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function flatColumns(columns) {
return columns.reduce((list, column) => {
const {
fixed
} = column;
const parsedFixed = fixed === true ? "left" : fixed;
const subColumns = column.children;
if (subColumns && subColumns.length > 0) {
return [...list, ...flatColumns(subColumns).map((subColum) => _extends({
fixed: parsedFixed
}, subColum))];
}
return [...list, _extends(_extends({}, column), {
fixed: parsedFixed
})];
}, []);
}
function revertForRtl(columns) {
return columns.map((column) => {
const {
fixed
} = column, restProps = __rest$h(column, ["fixed"]);
let parsedFixed = fixed;
if (fixed === "left") {
parsedFixed = "right";
} else if (fixed === "right") {
parsedFixed = "left";
}
return _extends({
fixed: parsedFixed
}, restProps);
});
}
function useColumns$1(_ref, transformColumns) {
let {
prefixCls,
columns: baseColumns,
// children,
expandable,
expandedKeys,
getRowKey,
onTriggerExpand,
expandIcon,
rowExpandable,
expandIconColumnIndex,
direction,
expandRowByClick,
expandColumnWidth,
expandFixed
} = _ref;
const contextSlots = useInjectSlots();
const withExpandColumns = computed(() => {
if (expandable.value) {
let cloneColumns = baseColumns.value.slice();
if (!cloneColumns.includes(EXPAND_COLUMN)) {
const expandColIndex = expandIconColumnIndex.value || 0;
if (expandColIndex >= 0) {
cloneColumns.splice(expandColIndex, 0, EXPAND_COLUMN);
}
}
const expandColumnIndex = cloneColumns.indexOf(EXPAND_COLUMN);
cloneColumns = cloneColumns.filter((column, index2) => column !== EXPAND_COLUMN || index2 === expandColumnIndex);
const prevColumn = baseColumns.value[expandColumnIndex];
let fixedColumn;
if ((expandFixed.value === "left" || expandFixed.value) && !expandIconColumnIndex.value) {
fixedColumn = "left";
} else if ((expandFixed.value === "right" || expandFixed.value) && expandIconColumnIndex.value === baseColumns.value.length) {
fixedColumn = "right";
} else {
fixedColumn = prevColumn ? prevColumn.fixed : null;
}
const expandedKeysValue = expandedKeys.value;
const rowExpandableValue = rowExpandable.value;
const expandIconValue = expandIcon.value;
const prefixClsValue = prefixCls.value;
const expandRowByClickValue = expandRowByClick.value;
const expandColumn = {
[INTERNAL_COL_DEFINE]: {
class: `${prefixCls.value}-expand-icon-col`,
columnType: "EXPAND_COLUMN"
},
title: customRenderSlot(contextSlots.value, "expandColumnTitle", {}, () => [""]),
fixed: fixedColumn,
class: `${prefixCls.value}-row-expand-icon-cell`,
width: expandColumnWidth.value,
customRender: (_ref2) => {
let {
record,
index: index2
} = _ref2;
const rowKey = getRowKey.value(record, index2);
const expanded = expandedKeysValue.has(rowKey);
const recordExpandable = rowExpandableValue ? rowExpandableValue(record) : true;
const icon = expandIconValue({
prefixCls: prefixClsValue,
expanded,
expandable: recordExpandable,
record,
onExpand: onTriggerExpand
});
if (expandRowByClickValue) {
return createVNode("span", {
"onClick": (e) => e.stopPropagation()
}, [icon]);
}
return icon;
}
};
return cloneColumns.map((col) => col === EXPAND_COLUMN ? expandColumn : col);
}
return baseColumns.value.filter((col) => col !== EXPAND_COLUMN);
});
const mergedColumns = computed(() => {
let finalColumns = withExpandColumns.value;
if (transformColumns.value) {
finalColumns = transformColumns.value(finalColumns);
}
if (!finalColumns.length) {
finalColumns = [{
customRender: () => null
}];
}
return finalColumns;
});
const flattenColumns = computed(() => {
if (direction.value === "rtl") {
return revertForRtl(flatColumns(mergedColumns.value));
}
return flatColumns(mergedColumns.value);
});
return [mergedColumns, flattenColumns];
}
function useLayoutState(defaultState) {
const stateRef = shallowRef(defaultState);
let rafId;
const updateBatchRef = shallowRef([]);
function setFrameState(updater) {
updateBatchRef.value.push(updater);
wrapperRaf.cancel(rafId);
rafId = wrapperRaf(() => {
const prevBatch = updateBatchRef.value;
updateBatchRef.value = [];
prevBatch.forEach((batchUpdater) => {
stateRef.value = batchUpdater(stateRef.value);
});
});
}
return [stateRef, setFrameState];
}
function useTimeoutLock(defaultState) {
const frameRef = ref(null);
const timeoutRef = ref();
function cleanUp() {
clearTimeout(timeoutRef.value);
}
function setState(newState) {
frameRef.value = newState;
cleanUp();
timeoutRef.value = setTimeout(() => {
frameRef.value = null;
timeoutRef.value = void 0;
}, 100);
}
function getState() {
return frameRef.value;
}
return [setState, getState];
}
function useStickyOffsets(colWidthsRef, columnCountRef, directionRef) {
const stickyOffsets = computed(() => {
const leftOffsets = [];
const rightOffsets = [];
let left = 0;
let right = 0;
const colWidths = colWidthsRef.value;
const columnCount = columnCountRef.value;
const direction = directionRef.value;
for (let start = 0; start < columnCount; start += 1) {
if (direction === "rtl") {
rightOffsets[start] = right;
right += colWidths[start] || 0;
const end = columnCount - start - 1;
leftOffsets[end] = left;
left += colWidths[end] || 0;
} else {
leftOffsets[start] = left;
left += colWidths[start] || 0;
const end = columnCount - start - 1;
rightOffsets[end] = right;
right += colWidths[end] || 0;
}
}
return {
left: leftOffsets,
right: rightOffsets
};
});
return stickyOffsets;
}
var __rest$g = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function ColGroup(_ref) {
let {
colWidths,
columns,
columCount
} = _ref;
const cols = [];
const len = columCount || columns.length;
let mustInsert = false;
for (let i = len - 1; i >= 0; i -= 1) {
const width = colWidths[i];
const column = columns && columns[i];
const additionalProps = column && column[INTERNAL_COL_DEFINE];
if (width || additionalProps || mustInsert) {
const _a = additionalProps || {}, {
columnType
} = _a, restAdditionalProps = __rest$g(_a, ["columnType"]);
cols.unshift(createVNode("col", _objectSpread$W({
"key": i,
"style": {
width: typeof width === "number" ? `${width}px` : width
}
}, restAdditionalProps), null));
mustInsert = true;
}
}
return createVNode("colgroup", null, [cols]);
}
function Panel(_, _ref) {
let {
slots
} = _ref;
var _a;
return createVNode("div", null, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
}
Panel.displayName = "Panel";
let indexGuid = 0;
const Summary = defineComponent({
name: "TableSummary",
props: ["fixed"],
setup(props2, _ref) {
let {
slots
} = _ref;
const tableContext = useInjectTable();
const uniKey = `table-summary-uni-key-${++indexGuid}`;
const fixed = computed(() => props2.fixed === "" || props2.fixed);
watchEffect(() => {
tableContext.summaryCollect(uniKey, fixed.value);
});
return () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
};
}
});
const SummaryRow = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATableSummaryRow",
setup(_props, _ref) {
let {
slots
} = _ref;
return () => {
var _a;
return createVNode("tr", null, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
const SummaryContextKey = Symbol("SummaryContextProps");
const useProvideSummary = (props2) => {
provide(SummaryContextKey, props2);
};
const useInjectSummary = () => {
return inject(SummaryContextKey, {});
};
const SummaryCell = defineComponent({
name: "ATableSummaryCell",
props: ["index", "colSpan", "rowSpan", "align"],
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const tableContext = useInjectTable();
const summaryContext = useInjectSummary();
return () => {
const {
index: index2,
colSpan = 1,
rowSpan,
align
} = props2;
const {
prefixCls,
direction
} = tableContext;
const {
scrollColumnIndex,
stickyOffsets,
flattenColumns
} = summaryContext;
const lastIndex = index2 + colSpan - 1;
const mergedColSpan = lastIndex + 1 === scrollColumnIndex ? colSpan + 1 : colSpan;
const fixedInfo = getCellFixedInfo(index2, index2 + mergedColSpan - 1, flattenColumns, stickyOffsets, direction);
return createVNode(Cell, _objectSpread$W({
"class": attrs.class,
"index": index2,
"component": "td",
"prefixCls": prefixCls,
"record": null,
"dataIndex": null,
"align": align,
"colSpan": mergedColSpan,
"rowSpan": rowSpan,
"customRender": () => {
var _a;
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
}
}, fixedInfo), null);
};
}
});
const Footer = defineComponent({
name: "TableFooter",
inheritAttrs: false,
props: ["stickyOffsets", "flattenColumns"],
setup(props2, _ref) {
let {
slots
} = _ref;
const tableContext = useInjectTable();
useProvideSummary(reactive({
stickyOffsets: toRef(props2, "stickyOffsets"),
flattenColumns: toRef(props2, "flattenColumns"),
scrollColumnIndex: computed(() => {
const lastColumnIndex = props2.flattenColumns.length - 1;
const scrollColumn = props2.flattenColumns[lastColumnIndex];
return (scrollColumn === null || scrollColumn === void 0 ? void 0 : scrollColumn.scrollbar) ? lastColumnIndex : null;
})
}));
return () => {
var _a;
const {
prefixCls
} = tableContext;
return createVNode("tfoot", {
"class": `${prefixCls}-summary`
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
const FooterComponents = Summary;
function renderExpandIcon$1(_ref) {
let {
prefixCls,
record,
onExpand,
expanded,
expandable
} = _ref;
const expandClassName = `${prefixCls}-row-expand-icon`;
if (!expandable) {
return createVNode("span", {
"class": [expandClassName, `${prefixCls}-row-spaced`]
}, null);
}
const onClick = (event) => {
onExpand(record, event);
event.stopPropagation();
};
return createVNode("span", {
"class": {
[expandClassName]: true,
[`${prefixCls}-row-expanded`]: expanded,
[`${prefixCls}-row-collapsed`]: !expanded
},
"onClick": onClick
}, null);
}
function findAllChildrenKeys(data, getRowKey, childrenColumnName) {
const keys = [];
function dig(list) {
(list || []).forEach((item, index2) => {
keys.push(getRowKey(item, index2));
dig(item[childrenColumnName]);
});
}
dig(data);
return keys;
}
const StickyScrollBar = defineComponent({
name: "StickyScrollBar",
inheritAttrs: false,
props: ["offsetScroll", "container", "scrollBodyRef", "scrollBodySizeInfo"],
emits: ["scroll"],
setup(props2, _ref) {
let {
emit,
expose
} = _ref;
const tableContext = useInjectTable();
const bodyScrollWidth = shallowRef(0);
const bodyWidth = shallowRef(0);
const scrollBarWidth = shallowRef(0);
watchEffect(() => {
bodyScrollWidth.value = props2.scrollBodySizeInfo.scrollWidth || 0;
bodyWidth.value = props2.scrollBodySizeInfo.clientWidth || 0;
scrollBarWidth.value = bodyScrollWidth.value && bodyWidth.value * (bodyWidth.value / bodyScrollWidth.value);
}, {
flush: "post"
});
const scrollBarRef = shallowRef();
const [scrollState, setScrollState] = useLayoutState({
scrollLeft: 0,
isHiddenScrollBar: true
});
const refState = ref({
delta: 0,
x: 0
});
const isActive = shallowRef(false);
const onMouseDown = (event) => {
refState.value = {
delta: event.pageX - scrollState.value.scrollLeft,
x: 0
};
isActive.value = true;
event.preventDefault();
};
const onContainerScroll = () => {
if (!props2.scrollBodyRef.value) {
return;
}
const tableOffsetTop = getOffset$2(props2.scrollBodyRef.value).top;
const tableBottomOffset = tableOffsetTop + props2.scrollBodyRef.value.offsetHeight;
const currentClientOffset = props2.container === void 0 ? (void 0).documentElement.scrollTop + (void 0).innerHeight : getOffset$2(props2.container).top + props2.container.clientHeight;
if (tableBottomOffset - getScrollBarSize() <= currentClientOffset || tableOffsetTop >= currentClientOffset - props2.offsetScroll) {
setScrollState((state) => _extends(_extends({}, state), {
isHiddenScrollBar: true
}));
} else {
setScrollState((state) => _extends(_extends({}, state), {
isHiddenScrollBar: false
}));
}
};
const setScrollLeft = (left) => {
setScrollState((state) => {
return _extends(_extends({}, state), {
scrollLeft: left / bodyScrollWidth.value * bodyWidth.value || 0
});
});
};
expose({
setScrollLeft
});
let onScrollListener = null;
watch(() => props2.container, () => {
onScrollListener === null || onScrollListener === void 0 ? void 0 : onScrollListener.remove();
onScrollListener = addEventListenerWrap(props2.container, "scroll", onContainerScroll, false);
}, {
immediate: true,
flush: "post"
});
watch(() => _extends({}, scrollState.value), (newState, preState) => {
if (newState.isHiddenScrollBar !== (preState === null || preState === void 0 ? void 0 : preState.isHiddenScrollBar) && !newState.isHiddenScrollBar) {
setScrollState((state) => {
const bodyNode = props2.scrollBodyRef.value;
if (!bodyNode) {
return state;
}
return _extends(_extends({}, state), {
scrollLeft: bodyNode.scrollLeft / bodyNode.scrollWidth * bodyNode.clientWidth
});
});
}
}, {
immediate: true
});
const scrollbarSize = getScrollBarSize();
return () => {
if (bodyScrollWidth.value <= bodyWidth.value || !scrollBarWidth.value || scrollState.value.isHiddenScrollBar) {
return null;
}
const {
prefixCls
} = tableContext;
return createVNode("div", {
"style": {
height: `${scrollbarSize}px`,
width: `${bodyWidth.value}px`,
bottom: `${props2.offsetScroll}px`
},
"class": `${prefixCls}-sticky-scroll`
}, [createVNode("div", {
"onMousedown": onMouseDown,
"ref": scrollBarRef,
"class": classNames(`${prefixCls}-sticky-scroll-bar`, {
[`${prefixCls}-sticky-scroll-bar-active`]: isActive.value
}),
"style": {
width: `${scrollBarWidth.value}px`,
transform: `translate3d(${scrollState.value.scrollLeft}px, 0, 0)`
}
}, null)]);
};
}
});
const defaultContainer = null;
function useSticky(stickyRef, prefixClsRef) {
return computed(() => {
const {
offsetHeader = 0,
offsetSummary = 0,
offsetScroll = 0,
getContainer: getContainer2 = () => defaultContainer
} = typeof stickyRef.value === "object" ? stickyRef.value : {};
const container = getContainer2() || defaultContainer;
const isSticky = !!stickyRef.value;
return {
isSticky,
stickyClassName: isSticky ? `${prefixClsRef.value}-sticky-holder` : "",
offsetHeader,
offsetSummary,
offsetScroll,
container
};
});
}
function useColumnWidth(colWidthsRef, columCountRef) {
return computed(() => {
const cloneColumns = [];
const colWidths = colWidthsRef.value;
const columCount = columCountRef.value;
for (let i = 0; i < columCount; i += 1) {
const val = colWidths[i];
if (val !== void 0) {
cloneColumns[i] = val;
} else {
return null;
}
}
return cloneColumns;
});
}
const FixedHolder = defineComponent({
name: "FixedHolder",
inheritAttrs: false,
props: ["columns", "flattenColumns", "stickyOffsets", "customHeaderRow", "noData", "maxContentScroll", "colWidths", "columCount", "direction", "fixHeader", "stickyTopOffset", "stickyBottomOffset", "stickyClassName"],
emits: ["scroll"],
setup(props2, _ref) {
let {
attrs,
slots,
emit
} = _ref;
const tableContext = useInjectTable();
const combinationScrollBarSize = computed(() => tableContext.isSticky && !props2.fixHeader ? 0 : tableContext.scrollbarSize);
const scrollRef = ref();
ref();
const allFlattenColumnsWithWidth = computed(() => props2.flattenColumns.every((column) => column.width && column.width !== 0 && column.width !== "0px"));
const columnsWithScrollbar = ref([]);
const flattenColumnsWithScrollbar = ref([]);
watchEffect(() => {
const lastColumn = props2.flattenColumns[props2.flattenColumns.length - 1];
const ScrollBarColumn = {
fixed: lastColumn ? lastColumn.fixed : null,
scrollbar: true,
customHeaderCell: () => ({
class: `${tableContext.prefixCls}-cell-scrollbar`
})
};
columnsWithScrollbar.value = combinationScrollBarSize.value ? [...props2.columns, ScrollBarColumn] : props2.columns;
flattenColumnsWithScrollbar.value = combinationScrollBarSize.value ? [...props2.flattenColumns, ScrollBarColumn] : props2.flattenColumns;
});
const headerStickyOffsets = computed(() => {
const {
stickyOffsets,
direction
} = props2;
const {
right,
left
} = stickyOffsets;
return _extends(_extends({}, stickyOffsets), {
left: direction === "rtl" ? [...left.map((width) => width + combinationScrollBarSize.value), 0] : left,
right: direction === "rtl" ? right : [...right.map((width) => width + combinationScrollBarSize.value), 0],
isSticky: tableContext.isSticky
});
});
const mergedColumnWidth = useColumnWidth(toRef(props2, "colWidths"), toRef(props2, "columCount"));
return () => {
var _a;
const {
noData,
columCount,
stickyTopOffset,
stickyBottomOffset,
stickyClassName,
maxContentScroll
} = props2;
const {
isSticky
} = tableContext;
return createVNode("div", {
"style": _extends({
overflow: "hidden"
}, isSticky ? {
top: `${stickyTopOffset}px`,
bottom: `${stickyBottomOffset}px`
} : {}),
"ref": scrollRef,
"class": classNames(attrs.class, {
[stickyClassName]: !!stickyClassName
})
}, [createVNode("table", {
"style": {
tableLayout: "fixed",
visibility: noData || mergedColumnWidth.value ? null : "hidden"
}
}, [(!noData || !maxContentScroll || allFlattenColumnsWithWidth.value) && createVNode(ColGroup, {
"colWidths": mergedColumnWidth.value ? [...mergedColumnWidth.value, combinationScrollBarSize.value] : [],
"columCount": columCount + 1,
"columns": flattenColumnsWithScrollbar.value
}, null), (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, _extends(_extends({}, props2), {
stickyOffsets: headerStickyOffsets.value,
columns: columnsWithScrollbar.value,
flattenColumns: flattenColumnsWithScrollbar.value
}))])]);
};
}
});
function reactivePick(obj) {
for (var _len = arguments.length, keys = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
keys[_key - 1] = arguments[_key];
}
return reactive(fromPairs(keys.map((k) => [k, toRef(obj, k)])));
}
const EMPTY_DATA = [];
const EMPTY_SCROLL_TARGET = {};
const INTERNAL_HOOKS = "rc-table-internal-hook";
const Table$1 = defineComponent({
name: "VcTable",
inheritAttrs: false,
props: ["prefixCls", "data", "columns", "rowKey", "tableLayout", "scroll", "rowClassName", "title", "footer", "id", "showHeader", "components", "customRow", "customHeaderRow", "direction", "expandFixed", "expandColumnWidth", "expandedRowKeys", "defaultExpandedRowKeys", "expandedRowRender", "expandRowByClick", "expandIcon", "onExpand", "onExpandedRowsChange", "onUpdate:expandedRowKeys", "defaultExpandAllRows", "indentSize", "expandIconColumnIndex", "expandedRowClassName", "childrenColumnName", "rowExpandable", "sticky", "transformColumns", "internalHooks", "internalRefs", "canExpandable", "onUpdateInternalRefs", "transformCellText"],
emits: ["expand", "expandedRowsChange", "updateInternalRefs", "update:expandedRowKeys"],
setup(props2, _ref) {
let {
attrs,
slots,
emit
} = _ref;
const mergedData = computed(() => props2.data || EMPTY_DATA);
const hasData = computed(() => !!mergedData.value.length);
const mergedComponents = computed(() => mergeObject(props2.components, {}));
const getComponent2 = (path2, defaultComponent) => getPathValue(mergedComponents.value, path2) || defaultComponent;
const getRowKey = computed(() => {
const rowKey = props2.rowKey;
if (typeof rowKey === "function") {
return rowKey;
}
return (record) => {
const key2 = record && record[rowKey];
return key2;
};
});
const mergedExpandIcon = computed(() => props2.expandIcon || renderExpandIcon$1);
const mergedChildrenColumnName = computed(() => props2.childrenColumnName || "children");
const expandableType = computed(() => {
if (props2.expandedRowRender) {
return "row";
}
if (props2.canExpandable || mergedData.value.some((record) => record && typeof record === "object" && record[mergedChildrenColumnName.value])) {
return "nest";
}
return false;
});
const innerExpandedKeys = shallowRef([]);
const stop = watchEffect(() => {
if (props2.defaultExpandedRowKeys) {
innerExpandedKeys.value = props2.defaultExpandedRowKeys;
}
if (props2.defaultExpandAllRows) {
innerExpandedKeys.value = findAllChildrenKeys(mergedData.value, getRowKey.value, mergedChildrenColumnName.value);
}
});
stop();
const mergedExpandedKeys = computed(() => new Set(props2.expandedRowKeys || innerExpandedKeys.value || []));
const onTriggerExpand = (record) => {
const key2 = getRowKey.value(record, mergedData.value.indexOf(record));
let newExpandedKeys;
const hasKey = mergedExpandedKeys.value.has(key2);
if (hasKey) {
mergedExpandedKeys.value.delete(key2);
newExpandedKeys = [...mergedExpandedKeys.value];
} else {
newExpandedKeys = [...mergedExpandedKeys.value, key2];
}
innerExpandedKeys.value = newExpandedKeys;
emit("expand", !hasKey, record);
emit("update:expandedRowKeys", newExpandedKeys);
emit("expandedRowsChange", newExpandedKeys);
};
const componentWidth = ref(0);
const [columns, flattenColumns] = useColumns$1(_extends(_extends({}, toRefs(props2)), {
// children,
expandable: computed(() => !!props2.expandedRowRender),
expandedKeys: mergedExpandedKeys,
getRowKey,
onTriggerExpand,
expandIcon: mergedExpandIcon
}), computed(() => props2.internalHooks === INTERNAL_HOOKS ? props2.transformColumns : null));
const columnContext = computed(() => ({
columns: columns.value,
flattenColumns: flattenColumns.value
}));
const fullTableRef = ref();
const scrollHeaderRef = ref();
const scrollBodyRef = ref();
const scrollBodySizeInfo = ref({
scrollWidth: 0,
clientWidth: 0
});
const scrollSummaryRef = ref();
const [pingedLeft, setPingedLeft] = useState$1(false);
const [pingedRight, setPingedRight] = useState$1(false);
const [colsWidths, updateColsWidths] = useLayoutState(/* @__PURE__ */ new Map());
const colsKeys = computed(() => getColumnsKey(flattenColumns.value));
const colWidths = computed(() => colsKeys.value.map((columnKey) => colsWidths.value.get(columnKey)));
const columnCount = computed(() => flattenColumns.value.length);
const stickyOffsets = useStickyOffsets(colWidths, columnCount, toRef(props2, "direction"));
const fixHeader = computed(() => props2.scroll && validateValue(props2.scroll.y));
const horizonScroll = computed(() => props2.scroll && validateValue(props2.scroll.x) || Boolean(props2.expandFixed));
const fixColumn = computed(() => horizonScroll.value && flattenColumns.value.some((_ref2) => {
let {
fixed
} = _ref2;
return fixed;
}));
const stickyRef = ref();
const stickyState = useSticky(toRef(props2, "sticky"), toRef(props2, "prefixCls"));
const summaryFixedInfos = reactive({});
const fixFooter = computed(() => {
const info = Object.values(summaryFixedInfos)[0];
return (fixHeader.value || stickyState.value.isSticky) && info;
});
const summaryCollect = (uniKey, fixed) => {
if (fixed) {
summaryFixedInfos[uniKey] = fixed;
} else {
delete summaryFixedInfos[uniKey];
}
};
const scrollXStyle = ref({});
const scrollYStyle = ref({});
const scrollTableStyle = ref({});
watchEffect(() => {
if (fixHeader.value) {
scrollYStyle.value = {
overflowY: "scroll",
maxHeight: toPx(props2.scroll.y)
};
}
if (horizonScroll.value) {
scrollXStyle.value = {
overflowX: "auto"
};
if (!fixHeader.value) {
scrollYStyle.value = {
overflowY: "hidden"
};
}
scrollTableStyle.value = {
width: props2.scroll.x === true ? "auto" : toPx(props2.scroll.x),
minWidth: "100%"
};
}
});
const onColumnResize = (columnKey, width) => {
if (isVisible(fullTableRef.value)) {
updateColsWidths((widths) => {
if (widths.get(columnKey) !== width) {
const newWidths = new Map(widths);
newWidths.set(columnKey, width);
return newWidths;
}
return widths;
});
}
};
const [setScrollTarget, getScrollTarget] = useTimeoutLock();
function forceScroll(scrollLeft, target) {
if (!target) {
return;
}
if (typeof target === "function") {
target(scrollLeft);
return;
}
const domTarget = target.$el || target;
if (domTarget.scrollLeft !== scrollLeft) {
domTarget.scrollLeft = scrollLeft;
}
}
const onScroll = (_ref3) => {
let {
currentTarget,
scrollLeft
} = _ref3;
var _a;
const isRTL = props2.direction === "rtl";
const mergedScrollLeft = typeof scrollLeft === "number" ? scrollLeft : currentTarget.scrollLeft;
const compareTarget = currentTarget || EMPTY_SCROLL_TARGET;
if (!getScrollTarget() || getScrollTarget() === compareTarget) {
setScrollTarget(compareTarget);
forceScroll(mergedScrollLeft, scrollHeaderRef.value);
forceScroll(mergedScrollLeft, scrollBodyRef.value);
forceScroll(mergedScrollLeft, scrollSummaryRef.value);
forceScroll(mergedScrollLeft, (_a = stickyRef.value) === null || _a === void 0 ? void 0 : _a.setScrollLeft);
}
if (currentTarget) {
const {
scrollWidth,
clientWidth
} = currentTarget;
if (isRTL) {
setPingedLeft(-mergedScrollLeft < scrollWidth - clientWidth);
setPingedRight(-mergedScrollLeft > 0);
} else {
setPingedLeft(mergedScrollLeft > 0);
setPingedRight(mergedScrollLeft < scrollWidth - clientWidth);
}
}
};
const triggerOnScroll = () => {
if (horizonScroll.value && scrollBodyRef.value) {
onScroll({
currentTarget: scrollBodyRef.value
});
} else {
setPingedLeft(false);
setPingedRight(false);
}
};
let timtout;
const updateWidth = (width) => {
if (width !== componentWidth.value) {
triggerOnScroll();
componentWidth.value = fullTableRef.value ? fullTableRef.value.offsetWidth : width;
}
};
const onFullTableResize = (_ref4) => {
let {
width
} = _ref4;
clearTimeout(timtout);
if (componentWidth.value === 0) {
updateWidth(width);
return;
}
timtout = setTimeout(() => {
updateWidth(width);
}, 100);
};
watch([horizonScroll, () => props2.data, () => props2.columns], () => {
if (horizonScroll.value) {
triggerOnScroll();
}
}, {
flush: "post"
});
const [scrollbarSize, setScrollbarSize] = useState$1(0);
watchEffect(() => {
if (props2.internalHooks === INTERNAL_HOOKS && props2.internalRefs) {
props2.onUpdateInternalRefs({
body: scrollBodyRef.value ? scrollBodyRef.value.$el || scrollBodyRef.value : null
});
}
}, {
flush: "post"
});
const mergedTableLayout = computed(() => {
if (props2.tableLayout) {
return props2.tableLayout;
}
if (fixColumn.value) {
return props2.scroll.x === "max-content" ? "auto" : "fixed";
}
if (fixHeader.value || stickyState.value.isSticky || flattenColumns.value.some((_ref5) => {
let {
ellipsis
} = _ref5;
return ellipsis;
})) {
return "fixed";
}
return "auto";
});
const emptyNode = () => {
var _a;
return hasData.value ? null : ((_a = slots.emptyText) === null || _a === void 0 ? void 0 : _a.call(slots)) || "No Data";
};
useProvideTable(reactive(_extends(_extends({}, toRefs(reactivePick(props2, "prefixCls", "direction", "transformCellText"))), {
getComponent: getComponent2,
scrollbarSize,
fixedInfoList: computed(() => flattenColumns.value.map((_, colIndex) => getCellFixedInfo(colIndex, colIndex, flattenColumns.value, stickyOffsets.value, props2.direction))),
isSticky: computed(() => stickyState.value.isSticky),
summaryCollect
})));
useProvideBody(reactive(_extends(_extends({}, toRefs(reactivePick(props2, "rowClassName", "expandedRowClassName", "expandRowByClick", "expandedRowRender", "expandIconColumnIndex", "indentSize"))), {
columns,
flattenColumns,
tableLayout: mergedTableLayout,
expandIcon: mergedExpandIcon,
expandableType,
onTriggerExpand
})));
useProvideResize({
onColumnResize
});
useProvideExpandedRow({
componentWidth,
fixHeader,
fixColumn,
horizonScroll
});
const bodyTable = () => createVNode(Body, {
"data": mergedData.value,
"measureColumnWidth": fixHeader.value || horizonScroll.value || stickyState.value.isSticky,
"expandedKeys": mergedExpandedKeys.value,
"rowExpandable": props2.rowExpandable,
"getRowKey": getRowKey.value,
"customRow": props2.customRow,
"childrenColumnName": mergedChildrenColumnName.value
}, {
emptyNode
});
const bodyColGroup = () => createVNode(ColGroup, {
"colWidths": flattenColumns.value.map((_ref6) => {
let {
width
} = _ref6;
return width;
}),
"columns": flattenColumns.value
}, null);
return () => {
var _a;
const {
prefixCls,
scroll,
tableLayout,
direction,
// Additional Part
title = slots.title,
footer = slots.footer,
// Customize
id,
showHeader,
customHeaderRow
} = props2;
const {
isSticky,
offsetHeader,
offsetSummary,
offsetScroll,
stickyClassName,
container
} = stickyState.value;
const TableComponent = getComponent2(["table"], "table");
const customizeScrollBody = getComponent2(["body"]);
const summaryNode = (_a = slots.summary) === null || _a === void 0 ? void 0 : _a.call(slots, {
pageData: mergedData.value
});
let groupTableNode = () => null;
const headerProps = {
colWidths: colWidths.value,
columCount: flattenColumns.value.length,
stickyOffsets: stickyOffsets.value,
customHeaderRow,
fixHeader: fixHeader.value,
scroll
};
if (fixHeader.value || isSticky) {
let bodyContent = () => null;
if (typeof customizeScrollBody === "function") {
bodyContent = () => customizeScrollBody(mergedData.value, {
scrollbarSize: scrollbarSize.value,
ref: scrollBodyRef,
onScroll
});
headerProps.colWidths = flattenColumns.value.map((_ref7, index2) => {
let {
width
} = _ref7;
const colWidth = index2 === columns.value.length - 1 ? width - scrollbarSize.value : width;
if (typeof colWidth === "number" && !Number.isNaN(colWidth)) {
return colWidth;
}
return 0;
});
} else {
bodyContent = () => createVNode("div", {
"style": _extends(_extends({}, scrollXStyle.value), scrollYStyle.value),
"onScroll": onScroll,
"ref": scrollBodyRef,
"class": classNames(`${prefixCls}-body`)
}, [createVNode(TableComponent, {
"style": _extends(_extends({}, scrollTableStyle.value), {
tableLayout: mergedTableLayout.value
})
}, {
default: () => [bodyColGroup(), bodyTable(), !fixFooter.value && summaryNode && createVNode(Footer, {
"stickyOffsets": stickyOffsets.value,
"flattenColumns": flattenColumns.value
}, {
default: () => [summaryNode]
})]
})]);
}
const fixedHolderProps = _extends(_extends(_extends({
noData: !mergedData.value.length,
maxContentScroll: horizonScroll.value && scroll.x === "max-content"
}, headerProps), columnContext.value), {
direction,
stickyClassName,
onScroll
});
groupTableNode = () => createVNode(Fragment, null, [showHeader !== false && createVNode(FixedHolder, _objectSpread$W(_objectSpread$W({}, fixedHolderProps), {}, {
"stickyTopOffset": offsetHeader,
"class": `${prefixCls}-header`,
"ref": scrollHeaderRef
}), {
default: (fixedHolderPassProps) => createVNode(Fragment, null, [createVNode(Header, fixedHolderPassProps, null), fixFooter.value === "top" && createVNode(Footer, fixedHolderPassProps, {
default: () => [summaryNode]
})])
}), bodyContent(), fixFooter.value && fixFooter.value !== "top" && createVNode(FixedHolder, _objectSpread$W(_objectSpread$W({}, fixedHolderProps), {}, {
"stickyBottomOffset": offsetSummary,
"class": `${prefixCls}-summary`,
"ref": scrollSummaryRef
}), {
default: (fixedHolderPassProps) => createVNode(Footer, fixedHolderPassProps, {
default: () => [summaryNode]
})
}), isSticky && scrollBodyRef.value && createVNode(StickyScrollBar, {
"ref": stickyRef,
"offsetScroll": offsetScroll,
"scrollBodyRef": scrollBodyRef,
"onScroll": onScroll,
"container": container,
"scrollBodySizeInfo": scrollBodySizeInfo.value
}, null)]);
} else {
groupTableNode = () => createVNode("div", {
"style": _extends(_extends({}, scrollXStyle.value), scrollYStyle.value),
"class": classNames(`${prefixCls}-content`),
"onScroll": onScroll,
"ref": scrollBodyRef
}, [createVNode(TableComponent, {
"style": _extends(_extends({}, scrollTableStyle.value), {
tableLayout: mergedTableLayout.value
})
}, {
default: () => [bodyColGroup(), showHeader !== false && createVNode(Header, _objectSpread$W(_objectSpread$W({}, headerProps), columnContext.value), null), bodyTable(), summaryNode && createVNode(Footer, {
"stickyOffsets": stickyOffsets.value,
"flattenColumns": flattenColumns.value
}, {
default: () => [summaryNode]
})]
})]);
}
const ariaProps = pickAttrs(attrs, {
aria: true,
data: true
});
const fullTable = () => createVNode("div", _objectSpread$W(_objectSpread$W({}, ariaProps), {}, {
"class": classNames(prefixCls, {
[`${prefixCls}-rtl`]: direction === "rtl",
[`${prefixCls}-ping-left`]: pingedLeft.value,
[`${prefixCls}-ping-right`]: pingedRight.value,
[`${prefixCls}-layout-fixed`]: tableLayout === "fixed",
[`${prefixCls}-fixed-header`]: fixHeader.value,
/** No used but for compatible */
[`${prefixCls}-fixed-column`]: fixColumn.value,
[`${prefixCls}-scroll-horizontal`]: horizonScroll.value,
[`${prefixCls}-has-fix-left`]: flattenColumns.value[0] && flattenColumns.value[0].fixed,
[`${prefixCls}-has-fix-right`]: flattenColumns.value[columnCount.value - 1] && flattenColumns.value[columnCount.value - 1].fixed === "right",
[attrs.class]: attrs.class
}),
"style": attrs.style,
"id": id,
"ref": fullTableRef
}), [title && createVNode(Panel, {
"class": `${prefixCls}-title`
}, {
default: () => [title(mergedData.value)]
}), createVNode("div", {
"class": `${prefixCls}-container`
}, [groupTableNode()]), footer && createVNode(Panel, {
"class": `${prefixCls}-footer`
}, {
default: () => [footer(mergedData.value)]
})]);
if (horizonScroll.value) {
return createVNode(ResizeObserver$1, {
"onResize": onFullTableResize
}, {
default: fullTable
});
}
return fullTable();
};
}
});
function extendsObject() {
const result = _extends({}, arguments.length <= 0 ? void 0 : arguments[0]);
for (let i = 1; i < arguments.length; i++) {
const obj = i < 0 || arguments.length <= i ? void 0 : arguments[i];
if (obj) {
Object.keys(obj).forEach((key2) => {
const val = obj[key2];
if (val !== void 0) {
result[key2] = val;
}
});
}
}
return result;
}
const DEFAULT_PAGE_SIZE = 10;
function getPaginationParam(mergedPagination, pagination) {
const param = {
current: mergedPagination.current,
pageSize: mergedPagination.pageSize
};
const paginationObj = pagination && typeof pagination === "object" ? pagination : {};
Object.keys(paginationObj).forEach((pageProp) => {
const value = mergedPagination[pageProp];
if (typeof value !== "function") {
param[pageProp] = value;
}
});
return param;
}
function usePagination(totalRef, paginationRef, onChange) {
const pagination = computed(() => paginationRef.value && typeof paginationRef.value === "object" ? paginationRef.value : {});
const paginationTotal = computed(() => pagination.value.total || 0);
const [innerPagination, setInnerPagination] = useState$1(() => ({
current: "defaultCurrent" in pagination.value ? pagination.value.defaultCurrent : 1,
pageSize: "defaultPageSize" in pagination.value ? pagination.value.defaultPageSize : DEFAULT_PAGE_SIZE
}));
const mergedPagination = computed(() => {
const mP = extendsObject(innerPagination.value, pagination.value, {
total: paginationTotal.value > 0 ? paginationTotal.value : totalRef.value
});
const maxPage = Math.ceil((paginationTotal.value || totalRef.value) / mP.pageSize);
if (mP.current > maxPage) {
mP.current = maxPage || 1;
}
return mP;
});
const refreshPagination = (current, pageSize) => {
if (paginationRef.value === false) return;
setInnerPagination({
current: current !== null && current !== void 0 ? current : 1,
pageSize: pageSize || mergedPagination.value.pageSize
});
};
const onInternalChange = (current, pageSize) => {
var _a, _b;
if (paginationRef.value) {
(_b = (_a = pagination.value).onChange) === null || _b === void 0 ? void 0 : _b.call(_a, current, pageSize);
}
refreshPagination(current, pageSize);
onChange(current, pageSize || mergedPagination.value.pageSize);
};
return [computed(() => {
return paginationRef.value === false ? {} : _extends(_extends({}, mergedPagination.value), {
onChange: onInternalChange
});
}), refreshPagination];
}
function useLazyKVMap(dataRef, childrenColumnNameRef, getRowKeyRef) {
const mapCacheRef = shallowRef({});
watch([dataRef, childrenColumnNameRef, getRowKeyRef], () => {
const kvMap = /* @__PURE__ */ new Map();
const getRowKey = getRowKeyRef.value;
const childrenColumnName = childrenColumnNameRef.value;
function dig(records) {
records.forEach((record, index2) => {
const rowKey = getRowKey(record, index2);
kvMap.set(rowKey, record);
if (record && typeof record === "object" && childrenColumnName in record) {
dig(record[childrenColumnName] || []);
}
});
}
dig(dataRef.value);
mapCacheRef.value = {
kvMap
};
}, {
deep: true,
immediate: true
});
function getRecordByKey(key2) {
return mapCacheRef.value.kvMap.get(key2);
}
return [getRecordByKey];
}
const SELECTION_COLUMN = {};
const SELECTION_ALL = "SELECT_ALL";
const SELECTION_INVERT = "SELECT_INVERT";
const SELECTION_NONE = "SELECT_NONE";
const EMPTY_LIST$1 = [];
function flattenData(childrenColumnName, data) {
let list = [];
(data || []).forEach((record) => {
list.push(record);
if (record && typeof record === "object" && childrenColumnName in record) {
list = [...list, ...flattenData(childrenColumnName, record[childrenColumnName])];
}
});
return list;
}
function useSelection(rowSelectionRef, configRef) {
const mergedRowSelection = computed(() => {
const temp = rowSelectionRef.value || {};
const {
checkStrictly = true
} = temp;
return _extends(_extends({}, temp), {
checkStrictly
});
});
const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(mergedRowSelection.value.selectedRowKeys || mergedRowSelection.value.defaultSelectedRowKeys || EMPTY_LIST$1, {
value: computed(() => mergedRowSelection.value.selectedRowKeys)
});
const preserveRecordsRef = shallowRef(/* @__PURE__ */ new Map());
const updatePreserveRecordsCache = (keys) => {
if (mergedRowSelection.value.preserveSelectedRowKeys) {
const newCache = /* @__PURE__ */ new Map();
keys.forEach((key2) => {
let record = configRef.getRecordByKey(key2);
if (!record && preserveRecordsRef.value.has(key2)) {
record = preserveRecordsRef.value.get(key2);
}
newCache.set(key2, record);
});
preserveRecordsRef.value = newCache;
}
};
watchEffect(() => {
updatePreserveRecordsCache(mergedSelectedKeys.value);
});
const keyEntities = computed(() => mergedRowSelection.value.checkStrictly ? null : convertDataToEntities(configRef.data.value, {
externalGetKey: configRef.getRowKey.value,
childrenPropName: configRef.childrenColumnName.value
}).keyEntities);
const flattedData = computed(() => flattenData(configRef.childrenColumnName.value, configRef.pageData.value));
const checkboxPropsMap = computed(() => {
const map = /* @__PURE__ */ new Map();
const getRowKey = configRef.getRowKey.value;
const getCheckboxProps = mergedRowSelection.value.getCheckboxProps;
flattedData.value.forEach((record, index2) => {
const key2 = getRowKey(record, index2);
const checkboxProps2 = (getCheckboxProps ? getCheckboxProps(record) : null) || {};
map.set(key2, checkboxProps2);
});
return map;
});
const {
maxLevel,
levelEntities
} = useMaxLevel(keyEntities);
const isCheckboxDisabled = (r) => {
var _a;
return !!((_a = checkboxPropsMap.value.get(configRef.getRowKey.value(r))) === null || _a === void 0 ? void 0 : _a.disabled);
};
const selectKeysState = computed(() => {
if (mergedRowSelection.value.checkStrictly) {
return [mergedSelectedKeys.value || [], []];
}
const {
checkedKeys,
halfCheckedKeys
} = conductCheck(mergedSelectedKeys.value, true, keyEntities.value, maxLevel.value, levelEntities.value, isCheckboxDisabled);
return [checkedKeys || [], halfCheckedKeys];
});
const derivedSelectedKeys = computed(() => selectKeysState.value[0]);
const derivedHalfSelectedKeys = computed(() => selectKeysState.value[1]);
const derivedSelectedKeySet = computed(() => {
const keys = mergedRowSelection.value.type === "radio" ? derivedSelectedKeys.value.slice(0, 1) : derivedSelectedKeys.value;
return new Set(keys);
});
const derivedHalfSelectedKeySet = computed(() => mergedRowSelection.value.type === "radio" ? /* @__PURE__ */ new Set() : new Set(derivedHalfSelectedKeys.value));
const [lastSelectedKey, setLastSelectedKey] = useState$1(null);
const setSelectedKeys = (keys) => {
let availableKeys;
let records;
updatePreserveRecordsCache(keys);
const {
preserveSelectedRowKeys,
onChange: onSelectionChange
} = mergedRowSelection.value;
const {
getRecordByKey
} = configRef;
if (preserveSelectedRowKeys) {
availableKeys = keys;
records = keys.map((key2) => preserveRecordsRef.value.get(key2));
} else {
availableKeys = [];
records = [];
keys.forEach((key2) => {
const record = getRecordByKey(key2);
if (record !== void 0) {
availableKeys.push(key2);
records.push(record);
}
});
}
setMergedSelectedKeys(availableKeys);
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(availableKeys, records);
};
const triggerSingleSelection = (key2, selected, keys, event) => {
const {
onSelect
} = mergedRowSelection.value;
const {
getRecordByKey
} = configRef || {};
if (onSelect) {
const rows = keys.map((k) => getRecordByKey(k));
onSelect(getRecordByKey(key2), selected, rows, event);
}
setSelectedKeys(keys);
};
const mergedSelections = computed(() => {
const {
onSelectInvert,
onSelectNone,
selections,
hideSelectAll
} = mergedRowSelection.value;
const {
data,
pageData,
getRowKey,
locale: tableLocale
} = configRef;
if (!selections || hideSelectAll) {
return null;
}
const selectionList = selections === true ? [SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE] : selections;
return selectionList.map((selection) => {
if (selection === SELECTION_ALL) {
return {
key: "all",
text: tableLocale.value.selectionAll,
onSelect() {
setSelectedKeys(data.value.map((record, index2) => getRowKey.value(record, index2)).filter((key2) => {
const checkProps = checkboxPropsMap.value.get(key2);
return !(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled) || derivedSelectedKeySet.value.has(key2);
}));
}
};
}
if (selection === SELECTION_INVERT) {
return {
key: "invert",
text: tableLocale.value.selectInvert,
onSelect() {
const keySet = new Set(derivedSelectedKeySet.value);
pageData.value.forEach((record, index2) => {
const key2 = getRowKey.value(record, index2);
const checkProps = checkboxPropsMap.value.get(key2);
if (!(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled)) {
if (keySet.has(key2)) {
keySet.delete(key2);
} else {
keySet.add(key2);
}
}
});
const keys = Array.from(keySet);
if (onSelectInvert) {
devWarning(false, "Table", "`onSelectInvert` will be removed in future. Please use `onChange` instead.");
onSelectInvert(keys);
}
setSelectedKeys(keys);
}
};
}
if (selection === SELECTION_NONE) {
return {
key: "none",
text: tableLocale.value.selectNone,
onSelect() {
onSelectNone === null || onSelectNone === void 0 ? void 0 : onSelectNone();
setSelectedKeys(Array.from(derivedSelectedKeySet.value).filter((key2) => {
const checkProps = checkboxPropsMap.value.get(key2);
return checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled;
}));
}
};
}
return selection;
});
});
const flattedDataLength = computed(() => flattedData.value.length);
const transformColumns = (columns) => {
var _a;
const {
onSelectAll,
onSelectMultiple,
columnWidth: selectionColWidth,
type: selectionType,
fixed,
renderCell: customizeRenderCell,
hideSelectAll,
checkStrictly
} = mergedRowSelection.value;
const {
prefixCls,
getRecordByKey,
getRowKey,
expandType,
getPopupContainer
} = configRef;
if (!rowSelectionRef.value) {
return columns.filter((col) => col !== SELECTION_COLUMN);
}
let cloneColumns = columns.slice();
const keySet = new Set(derivedSelectedKeySet.value);
const recordKeys = flattedData.value.map(getRowKey.value).filter((key2) => !checkboxPropsMap.value.get(key2).disabled);
const checkedCurrentAll = recordKeys.every((key2) => keySet.has(key2));
const checkedCurrentSome = recordKeys.some((key2) => keySet.has(key2));
const onSelectAllChange = () => {
const changeKeys = [];
if (checkedCurrentAll) {
recordKeys.forEach((key2) => {
keySet.delete(key2);
changeKeys.push(key2);
});
} else {
recordKeys.forEach((key2) => {
if (!keySet.has(key2)) {
keySet.add(key2);
changeKeys.push(key2);
}
});
}
const keys = Array.from(keySet);
onSelectAll === null || onSelectAll === void 0 ? void 0 : onSelectAll(!checkedCurrentAll, keys.map((k) => getRecordByKey(k)), changeKeys.map((k) => getRecordByKey(k)));
setSelectedKeys(keys);
};
let title;
if (selectionType !== "radio") {
let customizeSelections;
if (mergedSelections.value) {
const menu = createVNode(Menu, {
"getPopupContainer": getPopupContainer.value
}, {
default: () => [mergedSelections.value.map((selection, index2) => {
const {
key: key2,
text,
onSelect: onSelectionClick
} = selection;
return createVNode(Menu.Item, {
"key": key2 || index2,
"onClick": () => {
onSelectionClick === null || onSelectionClick === void 0 ? void 0 : onSelectionClick(recordKeys);
}
}, {
default: () => [text]
});
})]
});
customizeSelections = createVNode("div", {
"class": `${prefixCls.value}-selection-extra`
}, [createVNode(Dropdown, {
"overlay": menu,
"getPopupContainer": getPopupContainer.value
}, {
default: () => [createVNode("span", null, [createVNode(DownOutlined, null, null)])]
})]);
}
const allDisabledData = flattedData.value.map((record, index2) => {
const key2 = getRowKey.value(record, index2);
const checkboxProps2 = checkboxPropsMap.value.get(key2) || {};
return _extends({
checked: keySet.has(key2)
}, checkboxProps2);
}).filter((_ref) => {
let {
disabled
} = _ref;
return disabled;
});
const allDisabled = !!allDisabledData.length && allDisabledData.length === flattedDataLength.value;
const allDisabledAndChecked = allDisabled && allDisabledData.every((_ref2) => {
let {
checked
} = _ref2;
return checked;
});
const allDisabledSomeChecked = allDisabled && allDisabledData.some((_ref3) => {
let {
checked
} = _ref3;
return checked;
});
title = !hideSelectAll && createVNode("div", {
"class": `${prefixCls.value}-selection`
}, [createVNode(Checkbox, {
"checked": !allDisabled ? !!flattedDataLength.value && checkedCurrentAll : allDisabledAndChecked,
"indeterminate": !allDisabled ? !checkedCurrentAll && checkedCurrentSome : !allDisabledAndChecked && allDisabledSomeChecked,
"onChange": onSelectAllChange,
"disabled": flattedDataLength.value === 0 || allDisabled,
"aria-label": customizeSelections ? "Custom selection" : "Select all",
"skipGroup": true
}, null), customizeSelections]);
}
let renderCell;
if (selectionType === "radio") {
renderCell = (_ref4) => {
let {
record,
index: index2
} = _ref4;
const key2 = getRowKey.value(record, index2);
const checked = keySet.has(key2);
return {
node: createVNode(Radio, _objectSpread$W(_objectSpread$W({}, checkboxPropsMap.value.get(key2)), {}, {
"checked": checked,
"onClick": (e) => e.stopPropagation(),
"onChange": (event) => {
if (!keySet.has(key2)) {
triggerSingleSelection(key2, true, [key2], event.nativeEvent);
}
}
}), null),
checked
};
};
} else {
renderCell = (_ref5) => {
let {
record,
index: index2
} = _ref5;
var _a2;
const key2 = getRowKey.value(record, index2);
const checked = keySet.has(key2);
const indeterminate = derivedHalfSelectedKeySet.value.has(key2);
const checkboxProps2 = checkboxPropsMap.value.get(key2);
let mergedIndeterminate;
if (expandType.value === "nest") {
mergedIndeterminate = indeterminate;
devWarning(typeof (checkboxProps2 === null || checkboxProps2 === void 0 ? void 0 : checkboxProps2.indeterminate) !== "boolean", "Table", "set `indeterminate` using `rowSelection.getCheckboxProps` is not allowed with tree structured dataSource.");
} else {
mergedIndeterminate = (_a2 = checkboxProps2 === null || checkboxProps2 === void 0 ? void 0 : checkboxProps2.indeterminate) !== null && _a2 !== void 0 ? _a2 : indeterminate;
}
return {
node: createVNode(Checkbox, _objectSpread$W(_objectSpread$W({}, checkboxProps2), {}, {
"indeterminate": mergedIndeterminate,
"checked": checked,
"skipGroup": true,
"onClick": (e) => e.stopPropagation(),
"onChange": (_ref6) => {
let {
nativeEvent
} = _ref6;
const {
shiftKey
} = nativeEvent;
let startIndex = -1;
let endIndex = -1;
if (shiftKey && checkStrictly) {
const pointKeys = /* @__PURE__ */ new Set([lastSelectedKey.value, key2]);
recordKeys.some((recordKey, recordIndex) => {
if (pointKeys.has(recordKey)) {
if (startIndex === -1) {
startIndex = recordIndex;
} else {
endIndex = recordIndex;
return true;
}
}
return false;
});
}
if (endIndex !== -1 && startIndex !== endIndex && checkStrictly) {
const rangeKeys = recordKeys.slice(startIndex, endIndex + 1);
const changedKeys = [];
if (checked) {
rangeKeys.forEach((recordKey) => {
if (keySet.has(recordKey)) {
changedKeys.push(recordKey);
keySet.delete(recordKey);
}
});
} else {
rangeKeys.forEach((recordKey) => {
if (!keySet.has(recordKey)) {
changedKeys.push(recordKey);
keySet.add(recordKey);
}
});
}
const keys = Array.from(keySet);
onSelectMultiple === null || onSelectMultiple === void 0 ? void 0 : onSelectMultiple(!checked, keys.map((recordKey) => getRecordByKey(recordKey)), changedKeys.map((recordKey) => getRecordByKey(recordKey)));
setSelectedKeys(keys);
} else {
const originCheckedKeys = derivedSelectedKeys.value;
if (checkStrictly) {
const checkedKeys = checked ? arrDel(originCheckedKeys, key2) : arrAdd(originCheckedKeys, key2);
triggerSingleSelection(key2, !checked, checkedKeys, nativeEvent);
} else {
const result = conductCheck([...originCheckedKeys, key2], true, keyEntities.value, maxLevel.value, levelEntities.value, isCheckboxDisabled);
const {
checkedKeys,
halfCheckedKeys
} = result;
let nextCheckedKeys = checkedKeys;
if (checked) {
const tempKeySet = new Set(checkedKeys);
tempKeySet.delete(key2);
nextCheckedKeys = conductCheck(Array.from(tempKeySet), {
halfCheckedKeys
}, keyEntities.value, maxLevel.value, levelEntities.value, isCheckboxDisabled).checkedKeys;
}
triggerSingleSelection(key2, !checked, nextCheckedKeys, nativeEvent);
}
}
setLastSelectedKey(key2);
}
}), null),
checked
};
};
}
const renderSelectionCell = (_ref7) => {
let {
record,
index: index2
} = _ref7;
const {
node,
checked
} = renderCell({
record,
index: index2
});
if (customizeRenderCell) {
return customizeRenderCell(checked, record, index2, node);
}
return node;
};
if (!cloneColumns.includes(SELECTION_COLUMN)) {
if (cloneColumns.findIndex((col) => {
var _a2;
return ((_a2 = col[INTERNAL_COL_DEFINE]) === null || _a2 === void 0 ? void 0 : _a2.columnType) === "EXPAND_COLUMN";
}) === 0) {
const [expandColumn, ...restColumns] = cloneColumns;
cloneColumns = [expandColumn, SELECTION_COLUMN, ...restColumns];
} else {
cloneColumns = [SELECTION_COLUMN, ...cloneColumns];
}
}
const selectionColumnIndex = cloneColumns.indexOf(SELECTION_COLUMN);
cloneColumns = cloneColumns.filter((column, index2) => column !== SELECTION_COLUMN || index2 === selectionColumnIndex);
const prevCol = cloneColumns[selectionColumnIndex - 1];
const nextCol = cloneColumns[selectionColumnIndex + 1];
let mergedFixed = fixed;
if (mergedFixed === void 0) {
if ((nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed) !== void 0) {
mergedFixed = nextCol.fixed;
} else if ((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) !== void 0) {
mergedFixed = prevCol.fixed;
}
}
if (mergedFixed && prevCol && ((_a = prevCol[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === "EXPAND_COLUMN" && prevCol.fixed === void 0) {
prevCol.fixed = mergedFixed;
}
const selectionColumn = {
fixed: mergedFixed,
width: selectionColWidth,
className: `${prefixCls.value}-selection-column`,
title: mergedRowSelection.value.columnTitle || title,
customRender: renderSelectionCell,
[INTERNAL_COL_DEFINE]: {
class: `${prefixCls.value}-selection-col`
}
};
return cloneColumns.map((col) => col === SELECTION_COLUMN ? selectionColumn : col);
};
return [transformColumns, derivedSelectedKeySet];
}
var __rest$f = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function getColumnKey(column, defaultKey) {
if ("key" in column && column.key !== void 0 && column.key !== null) {
return column.key;
}
if (column.dataIndex) {
return Array.isArray(column.dataIndex) ? column.dataIndex.join(".") : column.dataIndex;
}
return defaultKey;
}
function getColumnPos(index2, pos) {
return pos ? `${pos}-${index2}` : `${index2}`;
}
function renderColumnTitle(title, props2) {
if (typeof title === "function") {
return title(props2);
}
return title;
}
function convertChildrenToColumns() {
let elements = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
const flattenElements = flattenChildren(elements);
const columns = [];
flattenElements.forEach((element) => {
var _a, _b, _c, _d;
if (!element) {
return;
}
const key2 = element.key;
const style = ((_a = element.props) === null || _a === void 0 ? void 0 : _a.style) || {};
const cls = ((_b = element.props) === null || _b === void 0 ? void 0 : _b.class) || "";
const props2 = element.props || {};
for (const [k, v] of Object.entries(props2)) {
props2[camelize(k)] = v;
}
const _e = element.children || {}, {
default: children
} = _e, restSlots = __rest$f(_e, ["default"]);
const column = _extends(_extends(_extends({}, restSlots), props2), {
style,
class: cls
});
if (key2) {
column.key = key2;
}
if ((_c = element.type) === null || _c === void 0 ? void 0 : _c.__ANT_TABLE_COLUMN_GROUP) {
column.children = convertChildrenToColumns(typeof children === "function" ? children() : children);
} else {
const customRender = (_d = element.children) === null || _d === void 0 ? void 0 : _d.default;
column.customRender = column.customRender || customRender;
}
columns.push(column);
});
return columns;
}
const ASCEND = "ascend";
const DESCEND = "descend";
function getMultiplePriority(column) {
if (typeof column.sorter === "object" && typeof column.sorter.multiple === "number") {
return column.sorter.multiple;
}
return false;
}
function getSortFunction(sorter) {
if (typeof sorter === "function") {
return sorter;
}
if (sorter && typeof sorter === "object" && sorter.compare) {
return sorter.compare;
}
return false;
}
function nextSortDirection(sortDirections, current) {
if (!current) {
return sortDirections[0];
}
return sortDirections[sortDirections.indexOf(current) + 1];
}
function collectSortStates(columns, init, pos) {
let sortStates = [];
function pushState(column, columnPos) {
sortStates.push({
column,
key: getColumnKey(column, columnPos),
multiplePriority: getMultiplePriority(column),
sortOrder: column.sortOrder
});
}
(columns || []).forEach((column, index2) => {
const columnPos = getColumnPos(index2, pos);
if (column.children) {
if ("sortOrder" in column) {
pushState(column, columnPos);
}
sortStates = [...sortStates, ...collectSortStates(column.children, init, columnPos)];
} else if (column.sorter) {
if ("sortOrder" in column) {
pushState(column, columnPos);
} else if (init && column.defaultSortOrder) {
sortStates.push({
column,
key: getColumnKey(column, columnPos),
multiplePriority: getMultiplePriority(column),
sortOrder: column.defaultSortOrder
});
}
}
});
return sortStates;
}
function injectSorter(prefixCls, columns, sorterStates, triggerSorter, defaultSortDirections, tableLocale, tableShowSorterTooltip, pos) {
return (columns || []).map((column, index2) => {
const columnPos = getColumnPos(index2, pos);
let newColumn = column;
if (newColumn.sorter) {
const sortDirections = newColumn.sortDirections || defaultSortDirections;
const showSorterTooltip = newColumn.showSorterTooltip === void 0 ? tableShowSorterTooltip : newColumn.showSorterTooltip;
const columnKey = getColumnKey(newColumn, columnPos);
const sorterState = sorterStates.find((_ref) => {
let {
key: key2
} = _ref;
return key2 === columnKey;
});
const sorterOrder = sorterState ? sorterState.sortOrder : null;
const nextSortOrder = nextSortDirection(sortDirections, sorterOrder);
const upNode = sortDirections.includes(ASCEND) && createVNode(CaretUpOutlined, {
"class": classNames(`${prefixCls}-column-sorter-up`, {
active: sorterOrder === ASCEND
}),
"role": "presentation"
}, null);
const downNode = sortDirections.includes(DESCEND) && createVNode(CaretDownOutlined, {
"role": "presentation",
"class": classNames(`${prefixCls}-column-sorter-down`, {
active: sorterOrder === DESCEND
})
}, null);
const {
cancelSort,
triggerAsc,
triggerDesc
} = tableLocale || {};
let sortTip = cancelSort;
if (nextSortOrder === DESCEND) {
sortTip = triggerDesc;
} else if (nextSortOrder === ASCEND) {
sortTip = triggerAsc;
}
const tooltipProps2 = typeof showSorterTooltip === "object" ? showSorterTooltip : {
title: sortTip
};
newColumn = _extends(_extends({}, newColumn), {
className: classNames(newColumn.className, {
[`${prefixCls}-column-sort`]: sorterOrder
}),
title: (renderProps) => {
const renderSortTitle = createVNode("div", {
"class": `${prefixCls}-column-sorters`
}, [createVNode("span", {
"class": `${prefixCls}-column-title`
}, [renderColumnTitle(column.title, renderProps)]), createVNode("span", {
"class": classNames(`${prefixCls}-column-sorter`, {
[`${prefixCls}-column-sorter-full`]: !!(upNode && downNode)
})
}, [createVNode("span", {
"class": `${prefixCls}-column-sorter-inner`
}, [upNode, downNode])])]);
return showSorterTooltip ? createVNode(__nuxt_component_2$4, tooltipProps2, {
default: () => [renderSortTitle]
}) : renderSortTitle;
},
customHeaderCell: (col) => {
const cell = column.customHeaderCell && column.customHeaderCell(col) || {};
const originOnClick = cell.onClick;
const originOKeyDown = cell.onKeydown;
cell.onClick = (event) => {
triggerSorter({
column,
key: columnKey,
sortOrder: nextSortOrder,
multiplePriority: getMultiplePriority(column)
});
if (originOnClick) {
originOnClick(event);
}
};
cell.onKeydown = (event) => {
if (event.keyCode === KeyCode.ENTER) {
triggerSorter({
column,
key: columnKey,
sortOrder: nextSortOrder,
multiplePriority: getMultiplePriority(column)
});
originOKeyDown === null || originOKeyDown === void 0 ? void 0 : originOKeyDown(event);
}
};
if (sorterOrder) {
cell["aria-sort"] = sorterOrder === "ascend" ? "ascending" : "descending";
}
cell.class = classNames(cell.class, `${prefixCls}-column-has-sorters`);
cell.tabindex = 0;
return cell;
}
});
}
if ("children" in newColumn) {
newColumn = _extends(_extends({}, newColumn), {
children: injectSorter(prefixCls, newColumn.children, sorterStates, triggerSorter, defaultSortDirections, tableLocale, tableShowSorterTooltip, columnPos)
});
}
return newColumn;
});
}
function stateToInfo(sorterStates) {
const {
column,
sortOrder
} = sorterStates;
return {
column,
order: sortOrder,
field: column.dataIndex,
columnKey: column.key
};
}
function generateSorterInfo(sorterStates) {
const list = sorterStates.filter((_ref2) => {
let {
sortOrder
} = _ref2;
return sortOrder;
}).map(stateToInfo);
if (list.length === 0 && sorterStates.length) {
return _extends(_extends({}, stateToInfo(sorterStates[sorterStates.length - 1])), {
column: void 0
});
}
if (list.length <= 1) {
return list[0] || {};
}
return list;
}
function getSortData(data, sortStates, childrenColumnName) {
const innerSorterStates = sortStates.slice().sort((a, b) => b.multiplePriority - a.multiplePriority);
const cloneData = data.slice();
const runningSorters = innerSorterStates.filter((_ref3) => {
let {
column: {
sorter
},
sortOrder
} = _ref3;
return getSortFunction(sorter) && sortOrder;
});
if (!runningSorters.length) {
return cloneData;
}
return cloneData.sort((record1, record2) => {
for (let i = 0; i < runningSorters.length; i += 1) {
const sorterState = runningSorters[i];
const {
column: {
sorter
},
sortOrder
} = sorterState;
const compareFn = getSortFunction(sorter);
if (compareFn && sortOrder) {
const compareResult = compareFn(record1, record2, sortOrder);
if (compareResult !== 0) {
return sortOrder === ASCEND ? compareResult : -compareResult;
}
}
}
return 0;
}).map((record) => {
const subRecords = record[childrenColumnName];
if (subRecords) {
return _extends(_extends({}, record), {
[childrenColumnName]: getSortData(subRecords, sortStates, childrenColumnName)
});
}
return record;
});
}
function useFilterSorter(_ref4) {
let {
prefixCls,
mergedColumns,
onSorterChange,
sortDirections,
tableLocale,
showSorterTooltip
} = _ref4;
const [sortStates, setSortStates] = useState$1(collectSortStates(mergedColumns.value, true));
const mergedSorterStates = computed(() => {
let validate2 = true;
const collectedStates = collectSortStates(mergedColumns.value, false);
if (!collectedStates.length) {
return sortStates.value;
}
const validateStates = [];
function patchStates(state) {
if (validate2) {
validateStates.push(state);
} else {
validateStates.push(_extends(_extends({}, state), {
sortOrder: null
}));
}
}
let multipleMode = null;
collectedStates.forEach((state) => {
if (multipleMode === null) {
patchStates(state);
if (state.sortOrder) {
if (state.multiplePriority === false) {
validate2 = false;
} else {
multipleMode = true;
}
}
} else if (multipleMode && state.multiplePriority !== false) {
patchStates(state);
} else {
validate2 = false;
patchStates(state);
}
});
return validateStates;
});
const columnTitleSorterProps = computed(() => {
const sortColumns = mergedSorterStates.value.map((_ref5) => {
let {
column,
sortOrder
} = _ref5;
return {
column,
order: sortOrder
};
});
return {
sortColumns,
// Legacy
sortColumn: sortColumns[0] && sortColumns[0].column,
sortOrder: sortColumns[0] && sortColumns[0].order
};
});
function triggerSorter(sortState) {
let newSorterStates;
if (sortState.multiplePriority === false || !mergedSorterStates.value.length || mergedSorterStates.value[0].multiplePriority === false) {
newSorterStates = [sortState];
} else {
newSorterStates = [...mergedSorterStates.value.filter((_ref6) => {
let {
key: key2
} = _ref6;
return key2 !== sortState.key;
}), sortState];
}
setSortStates(newSorterStates);
onSorterChange(generateSorterInfo(newSorterStates), newSorterStates);
}
const transformColumns = (innerColumns) => injectSorter(prefixCls.value, innerColumns, mergedSorterStates.value, triggerSorter, sortDirections.value, tableLocale.value, showSorterTooltip.value);
const sorters = computed(() => generateSorterInfo(mergedSorterStates.value));
return [transformColumns, mergedSorterStates, columnTitleSorterProps, sorters];
}
const onKeyDown = (event) => {
const {
keyCode
} = event;
if (keyCode === KeyCode.ENTER) {
event.stopPropagation();
}
};
const FilterDropdownMenuWrapper = (_props, _ref) => {
let {
slots
} = _ref;
var _a;
return createVNode("div", {
"onClick": (e) => e.stopPropagation(),
"onKeydown": onKeyDown
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
const FilterSearch = defineComponent({
compatConfig: {
MODE: 3
},
name: "FilterSearch",
inheritAttrs: false,
props: {
value: stringType(),
onChange: functionType(),
filterSearch: someType([Boolean, Function]),
tablePrefixCls: stringType(),
locale: objectType()
},
setup(props2) {
return () => {
const {
value,
onChange,
filterSearch,
tablePrefixCls,
locale: locale2
} = props2;
if (!filterSearch) {
return null;
}
return createVNode("div", {
"class": `${tablePrefixCls}-filter-dropdown-search`
}, [createVNode(Input, {
"placeholder": locale2.filterSearchPlaceholder,
"onChange": onChange,
"value": value,
"htmlSize": 1,
"class": `${tablePrefixCls}-filter-dropdown-search-input`
}, {
prefix: () => createVNode(SearchOutlined, null, null)
})]);
};
}
});
var __rest$e = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const MotionTreeNode = defineComponent({
compatConfig: {
MODE: 3
},
name: "MotionTreeNode",
inheritAttrs: false,
props: _extends(_extends({}, treeNodeProps), {
active: Boolean,
motion: Object,
motionNodes: {
type: Array
},
onMotionStart: Function,
onMotionEnd: Function,
motionType: String
}),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const visible = shallowRef(true);
const context2 = useInjectTreeContext();
const motionedRef = shallowRef(false);
const transitionProps = computed(() => {
if (props2.motion) {
return props2.motion;
} else {
return collapseMotion();
}
});
const onMotionEnd = (node, type) => {
var _a, _b, _c, _d;
if (type === "appear") {
(_b = (_a = transitionProps.value) === null || _a === void 0 ? void 0 : _a.onAfterEnter) === null || _b === void 0 ? void 0 : _b.call(_a, node);
} else if (type === "leave") {
(_d = (_c = transitionProps.value) === null || _c === void 0 ? void 0 : _c.onAfterLeave) === null || _d === void 0 ? void 0 : _d.call(_c, node);
}
if (!motionedRef.value) {
props2.onMotionEnd();
}
motionedRef.value = true;
};
watch(() => props2.motionNodes, () => {
if (props2.motionNodes && props2.motionType === "hide" && visible.value) {
nextTick(() => {
visible.value = false;
});
}
}, {
immediate: true,
flush: "post"
});
return () => {
const {
motion,
motionNodes,
motionType,
active,
eventKey
} = props2, otherProps = __rest$e(props2, ["motion", "motionNodes", "motionType", "active", "eventKey"]);
if (motionNodes) {
return createVNode(Transition, _objectSpread$W(_objectSpread$W({}, transitionProps.value), {}, {
"appear": motionType === "show",
"onAfterAppear": (node) => onMotionEnd(node, "appear"),
"onAfterLeave": (node) => onMotionEnd(node, "leave")
}), {
default: () => [withDirectives(createVNode("div", {
"class": `${context2.value.prefixCls}-treenode-motion`
}, [motionNodes.map((treeNode) => {
const restProps = __rest$e(treeNode.data, []), {
title,
key: key2,
isStart,
isEnd
} = treeNode;
delete restProps.children;
return createVNode(VcTreeNode, _objectSpread$W(_objectSpread$W({}, restProps), {}, {
"title": title,
"active": active,
"data": treeNode.data,
"key": key2,
"eventKey": key2,
"isStart": isStart,
"isEnd": isEnd
}), slots);
})]), [[vShow, visible.value]])]
});
}
return createVNode(VcTreeNode, _objectSpread$W(_objectSpread$W({
"class": attrs.class,
"style": attrs.style
}, otherProps), {}, {
"active": active,
"eventKey": eventKey
}), slots);
};
}
});
function findExpandedKeys() {
let prev = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
let next = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
const prevLen = prev.length;
const nextLen = next.length;
if (Math.abs(prevLen - nextLen) !== 1) {
return {
add: false,
key: null
};
}
function find2(shorter, longer) {
const cache = /* @__PURE__ */ new Map();
shorter.forEach((key2) => {
cache.set(key2, true);
});
const keys = longer.filter((key2) => !cache.has(key2));
return keys.length === 1 ? keys[0] : null;
}
if (prevLen < nextLen) {
return {
add: true,
key: find2(prev, next)
};
}
return {
add: false,
key: find2(next, prev)
};
}
function getExpandRange(shorter, longer, key2) {
const shorterStartIndex = shorter.findIndex((item) => item.key === key2);
const shorterEndNode = shorter[shorterStartIndex + 1];
const longerStartIndex = longer.findIndex((item) => item.key === key2);
if (shorterEndNode) {
const longerEndIndex = longer.findIndex((item) => item.key === shorterEndNode.key);
return longer.slice(longerStartIndex + 1, longerEndIndex);
}
return longer.slice(longerStartIndex + 1);
}
var __rest$d = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const HIDDEN_STYLE$1 = {
width: 0,
height: 0,
display: "flex",
overflow: "hidden",
opacity: 0,
border: 0,
padding: 0,
margin: 0
};
const noop$2 = () => {
};
const MOTION_KEY = `RC_TREE_MOTION_${Math.random()}`;
const MotionNode = {
key: MOTION_KEY
};
const MotionEntity = {
key: MOTION_KEY,
level: 0,
index: 0,
pos: "0",
node: MotionNode,
nodes: [MotionNode]
};
const MotionFlattenData = {
parent: null,
children: [],
pos: MotionEntity.pos,
data: MotionNode,
title: null,
key: MOTION_KEY,
/** Hold empty list here since we do not use it */
isStart: [],
isEnd: []
};
function getMinimumRangeTransitionRange(list, virtual, height, itemHeight) {
if (virtual === false || !height) {
return list;
}
return list.slice(0, Math.ceil(height / itemHeight) + 1);
}
function itemKey(item) {
const {
key: key2,
pos
} = item;
return getKey(key2, pos);
}
function getAccessibilityPath(item) {
let path2 = String(item.key);
let current = item;
while (current.parent) {
current = current.parent;
path2 = `${current.key} > ${path2}`;
}
return path2;
}
const NodeList = defineComponent({
compatConfig: {
MODE: 3
},
name: "NodeList",
inheritAttrs: false,
props: nodeListProps,
setup(props2, _ref) {
let {
expose,
attrs
} = _ref;
const listRef = ref();
const indentMeasurerRef = ref();
const {
expandedKeys,
flattenNodes
} = useInjectKeysState();
expose({
scrollTo: (scroll) => {
listRef.value.scrollTo(scroll);
},
getIndentWidth: () => indentMeasurerRef.value.offsetWidth
});
const transitionData = shallowRef(flattenNodes.value);
const transitionRange = shallowRef([]);
const motionType = ref(null);
function onMotionEnd() {
transitionData.value = flattenNodes.value;
transitionRange.value = [];
motionType.value = null;
props2.onListChangeEnd();
}
const context2 = useInjectTreeContext();
watch([() => expandedKeys.value.slice(), flattenNodes], (_ref2, _ref3) => {
let [expandedKeys2, data] = _ref2;
let [prevExpandedKeys, prevData] = _ref3;
const diffExpanded = findExpandedKeys(prevExpandedKeys, expandedKeys2);
if (diffExpanded.key !== null) {
const {
virtual,
height,
itemHeight
} = props2;
if (diffExpanded.add) {
const keyIndex2 = prevData.findIndex((_ref4) => {
let {
key: key2
} = _ref4;
return key2 === diffExpanded.key;
});
const rangeNodes = getMinimumRangeTransitionRange(getExpandRange(prevData, data, diffExpanded.key), virtual, height, itemHeight);
const newTransitionData = prevData.slice();
newTransitionData.splice(keyIndex2 + 1, 0, MotionFlattenData);
transitionData.value = newTransitionData;
transitionRange.value = rangeNodes;
motionType.value = "show";
} else {
const keyIndex2 = data.findIndex((_ref5) => {
let {
key: key2
} = _ref5;
return key2 === diffExpanded.key;
});
const rangeNodes = getMinimumRangeTransitionRange(getExpandRange(data, prevData, diffExpanded.key), virtual, height, itemHeight);
const newTransitionData = data.slice();
newTransitionData.splice(keyIndex2 + 1, 0, MotionFlattenData);
transitionData.value = newTransitionData;
transitionRange.value = rangeNodes;
motionType.value = "hide";
}
} else if (prevData !== data) {
transitionData.value = data;
}
});
watch(() => context2.value.dragging, (dragging) => {
if (!dragging) {
onMotionEnd();
}
});
const mergedData = computed(() => props2.motion === void 0 ? transitionData.value : flattenNodes.value);
const onActiveChange = () => {
props2.onActiveChange(null);
};
return () => {
const _a = _extends(_extends({}, props2), attrs), {
prefixCls,
selectable,
checkable,
disabled,
motion,
height,
itemHeight,
virtual,
focusable,
activeItem,
focused,
tabindex,
onKeydown,
onFocus,
onBlur,
onListChangeStart,
onListChangeEnd
} = _a, domProps = __rest$d(_a, ["prefixCls", "selectable", "checkable", "disabled", "motion", "height", "itemHeight", "virtual", "focusable", "activeItem", "focused", "tabindex", "onKeydown", "onFocus", "onBlur", "onListChangeStart", "onListChangeEnd"]);
return createVNode(Fragment, null, [focused && activeItem && createVNode("span", {
"style": HIDDEN_STYLE$1,
"aria-live": "assertive"
}, [getAccessibilityPath(activeItem)]), createVNode("div", null, [createVNode("input", {
"style": HIDDEN_STYLE$1,
"disabled": focusable === false || disabled,
"tabindex": focusable !== false ? tabindex : null,
"onKeydown": onKeydown,
"onFocus": onFocus,
"onBlur": onBlur,
"value": "",
"onChange": noop$2,
"aria-label": "for screen reader"
}, null)]), createVNode("div", {
"class": `${prefixCls}-treenode`,
"aria-hidden": true,
"style": {
position: "absolute",
pointerEvents: "none",
visibility: "hidden",
height: 0,
overflow: "hidden"
}
}, [createVNode("div", {
"class": `${prefixCls}-indent`
}, [createVNode("div", {
"ref": indentMeasurerRef,
"class": `${prefixCls}-indent-unit`
}, null)])]), createVNode(List$2, _objectSpread$W(_objectSpread$W({}, omit(domProps, ["onActiveChange"])), {}, {
"data": mergedData.value,
"itemKey": itemKey,
"height": height,
"fullHeight": false,
"virtual": virtual,
"itemHeight": itemHeight,
"prefixCls": `${prefixCls}-list`,
"ref": listRef,
"onVisibleChange": (originList, fullList) => {
const originSet = new Set(originList);
const restList = fullList.filter((item) => !originSet.has(item));
if (restList.some((item) => itemKey(item) === MOTION_KEY)) {
onMotionEnd();
}
}
}), {
default: (treeNode) => {
const {
pos
} = treeNode, restProps = __rest$d(treeNode.data, []), {
title,
key: key2,
isStart,
isEnd
} = treeNode;
const mergedKey = getKey(key2, pos);
delete restProps.key;
delete restProps.children;
return createVNode(MotionTreeNode, _objectSpread$W(_objectSpread$W({}, restProps), {}, {
"eventKey": mergedKey,
"title": title,
"active": !!activeItem && key2 === activeItem.key,
"data": treeNode.data,
"isStart": isStart,
"isEnd": isEnd,
"motion": motion,
"motionNodes": key2 === MOTION_KEY ? transitionRange.value : null,
"motionType": motionType.value,
"onMotionStart": onListChangeStart,
"onMotionEnd": onMotionEnd,
"onMousemove": onActiveChange
}), null);
}
})]);
};
}
});
function DropIndicator(_ref) {
let {
dropPosition,
dropLevelOffset,
indent
} = _ref;
const style = {
pointerEvents: "none",
position: "absolute",
right: 0,
backgroundColor: "red",
height: `${2}px`
};
switch (dropPosition) {
case -1:
style.top = 0;
style.left = `${-dropLevelOffset * indent}px`;
break;
case 1:
style.bottom = 0;
style.left = `${-dropLevelOffset * indent}px`;
break;
case 0:
style.bottom = 0;
style.left = `${indent}`;
break;
}
return createVNode("div", {
"style": style
}, null);
}
const MAX_RETRY_TIMES = 10;
const Tree$2 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Tree",
inheritAttrs: false,
props: initDefaultProps(treeProps$1(), {
prefixCls: "vc-tree",
showLine: false,
showIcon: true,
selectable: true,
multiple: false,
checkable: false,
disabled: false,
checkStrictly: false,
draggable: false,
expandAction: false,
defaultExpandParent: true,
autoExpandParent: false,
defaultExpandAll: false,
defaultExpandedKeys: [],
defaultCheckedKeys: [],
defaultSelectedKeys: [],
dropIndicatorRender: DropIndicator,
allowDrop: () => true
}),
setup(props2, _ref) {
let {
attrs,
slots,
expose
} = _ref;
shallowRef(false);
let delayedDragEnterLogic = {};
const indent = shallowRef();
const selectedKeys = shallowRef([]);
const checkedKeys = shallowRef([]);
const halfCheckedKeys = shallowRef([]);
const loadedKeys = shallowRef([]);
const loadingKeys = shallowRef([]);
const expandedKeys = shallowRef([]);
const loadingRetryTimes = {};
const dragState = reactive({
draggingNodeKey: null,
dragChildrenKeys: [],
// dropTargetKey is the key of abstract-drop-node
// the abstract-drop-node is the real drop node when drag and drop
// not the DOM drag over node
dropTargetKey: null,
dropPosition: null,
dropContainerKey: null,
dropLevelOffset: null,
dropTargetPos: null,
dropAllowed: true,
// the abstract-drag-over-node
// if mouse is on the bottom of top dom node or no the top of the bottom dom node
// abstract-drag-over-node is the top node
dragOverNodeKey: null
});
const treeData = shallowRef([]);
watch([() => props2.treeData, () => props2.children], () => {
treeData.value = props2.treeData !== void 0 ? props2.treeData.slice() : convertTreeToData(toRaw(props2.children));
}, {
immediate: true,
deep: true
});
const keyEntities = shallowRef({});
const focused = shallowRef(false);
const activeKey = shallowRef(null);
const listChanging = shallowRef(false);
const fieldNames = computed(() => fillFieldNames$1(props2.fieldNames));
const listRef = shallowRef();
let dragStartMousePosition = null;
let dragNode = null;
let currentMouseOverDroppableNodeKey = null;
const treeNodeRequiredProps = computed(() => {
return {
expandedKeysSet: expandedKeysSet.value,
selectedKeysSet: selectedKeysSet.value,
loadedKeysSet: loadedKeysSet.value,
loadingKeysSet: loadingKeysSet.value,
checkedKeysSet: checkedKeysSet.value,
halfCheckedKeysSet: halfCheckedKeysSet.value,
dragOverNodeKey: dragState.dragOverNodeKey,
dropPosition: dragState.dropPosition,
keyEntities: keyEntities.value
};
});
const expandedKeysSet = computed(() => {
return new Set(expandedKeys.value);
});
const selectedKeysSet = computed(() => {
return new Set(selectedKeys.value);
});
const loadedKeysSet = computed(() => {
return new Set(loadedKeys.value);
});
const loadingKeysSet = computed(() => {
return new Set(loadingKeys.value);
});
const checkedKeysSet = computed(() => {
return new Set(checkedKeys.value);
});
const halfCheckedKeysSet = computed(() => {
return new Set(halfCheckedKeys.value);
});
watchEffect(() => {
if (treeData.value) {
const entitiesMap = convertDataToEntities(treeData.value, {
fieldNames: fieldNames.value
});
keyEntities.value = _extends({
[MOTION_KEY]: MotionEntity
}, entitiesMap.keyEntities);
}
});
let init = false;
watch(
[() => props2.expandedKeys, () => props2.autoExpandParent, keyEntities],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(_ref2, _ref3) => {
let [_newKeys, newAutoExpandParent] = _ref2;
let [_oldKeys, oldAutoExpandParent] = _ref3;
let keys = expandedKeys.value;
if (props2.expandedKeys !== void 0 || init && newAutoExpandParent !== oldAutoExpandParent) {
keys = props2.autoExpandParent || !init && props2.defaultExpandParent ? conductExpandParent(props2.expandedKeys, keyEntities.value) : props2.expandedKeys;
} else if (!init && props2.defaultExpandAll) {
const cloneKeyEntities = _extends({}, keyEntities.value);
delete cloneKeyEntities[MOTION_KEY];
keys = Object.keys(cloneKeyEntities).map((key2) => cloneKeyEntities[key2].key);
} else if (!init && props2.defaultExpandedKeys) {
keys = props2.autoExpandParent || props2.defaultExpandParent ? conductExpandParent(props2.defaultExpandedKeys, keyEntities.value) : props2.defaultExpandedKeys;
}
if (keys) {
expandedKeys.value = keys;
}
init = true;
},
{
immediate: true
}
);
const flattenNodes = shallowRef([]);
watchEffect(() => {
flattenNodes.value = flattenTreeData(treeData.value, expandedKeys.value, fieldNames.value);
});
watchEffect(() => {
if (props2.selectable) {
if (props2.selectedKeys !== void 0) {
selectedKeys.value = calcSelectedKeys(props2.selectedKeys, props2);
} else if (!init && props2.defaultSelectedKeys) {
selectedKeys.value = calcSelectedKeys(props2.defaultSelectedKeys, props2);
}
}
});
const {
maxLevel,
levelEntities
} = useMaxLevel(keyEntities);
watchEffect(() => {
if (props2.checkable) {
let checkedKeyEntity;
if (props2.checkedKeys !== void 0) {
checkedKeyEntity = parseCheckedKeys(props2.checkedKeys) || {};
} else if (!init && props2.defaultCheckedKeys) {
checkedKeyEntity = parseCheckedKeys(props2.defaultCheckedKeys) || {};
} else if (treeData.value) {
checkedKeyEntity = parseCheckedKeys(props2.checkedKeys) || {
checkedKeys: checkedKeys.value,
halfCheckedKeys: halfCheckedKeys.value
};
}
if (checkedKeyEntity) {
let {
checkedKeys: newCheckedKeys = [],
halfCheckedKeys: newHalfCheckedKeys = []
} = checkedKeyEntity;
if (!props2.checkStrictly) {
const conductKeys = conductCheck(newCheckedKeys, true, keyEntities.value, maxLevel.value, levelEntities.value);
({
checkedKeys: newCheckedKeys,
halfCheckedKeys: newHalfCheckedKeys
} = conductKeys);
}
checkedKeys.value = newCheckedKeys;
halfCheckedKeys.value = newHalfCheckedKeys;
}
}
});
watchEffect(() => {
if (props2.loadedKeys) {
loadedKeys.value = props2.loadedKeys;
}
});
const resetDragState = () => {
_extends(dragState, {
dragOverNodeKey: null,
dropPosition: null,
dropLevelOffset: null,
dropTargetKey: null,
dropContainerKey: null,
dropTargetPos: null,
dropAllowed: false
});
};
const scrollTo2 = (scroll) => {
listRef.value.scrollTo(scroll);
};
watch(() => props2.activeKey, () => {
if (props2.activeKey !== void 0) {
activeKey.value = props2.activeKey;
}
}, {
immediate: true
});
watch(activeKey, (val) => {
nextTick(() => {
if (val !== null) {
scrollTo2({
key: val
});
}
});
}, {
immediate: true,
flush: "post"
});
const setExpandedKeys = (keys) => {
if (props2.expandedKeys === void 0) {
expandedKeys.value = keys;
}
};
const cleanDragState = () => {
if (dragState.draggingNodeKey !== null) {
_extends(dragState, {
draggingNodeKey: null,
dropPosition: null,
dropContainerKey: null,
dropTargetKey: null,
dropLevelOffset: null,
dropAllowed: true,
dragOverNodeKey: null
});
}
dragStartMousePosition = null;
currentMouseOverDroppableNodeKey = null;
};
const onNodeDragEnd = (event, node) => {
const {
onDragend
} = props2;
dragState.dragOverNodeKey = null;
cleanDragState();
onDragend === null || onDragend === void 0 ? void 0 : onDragend({
event,
node: node.eventData
});
dragNode = null;
};
const onWindowDragEnd = (event) => {
onNodeDragEnd(event, null);
(void 0).removeEventListener("dragend", onWindowDragEnd);
};
const onNodeDragStart = (event, node) => {
const {
onDragstart
} = props2;
const {
eventKey,
eventData
} = node;
dragNode = node;
dragStartMousePosition = {
x: event.clientX,
y: event.clientY
};
const newExpandedKeys = arrDel(expandedKeys.value, eventKey);
dragState.draggingNodeKey = eventKey;
dragState.dragChildrenKeys = getDragChildrenKeys(eventKey, keyEntities.value);
indent.value = listRef.value.getIndentWidth();
setExpandedKeys(newExpandedKeys);
(void 0).addEventListener("dragend", onWindowDragEnd);
if (onDragstart) {
onDragstart({
event,
node: eventData
});
}
};
const onNodeDragEnter = (event, node) => {
const {
onDragenter,
onExpand,
allowDrop,
direction
} = props2;
const {
pos,
eventKey
} = node;
if (currentMouseOverDroppableNodeKey !== eventKey) {
currentMouseOverDroppableNodeKey = eventKey;
}
if (!dragNode) {
resetDragState();
return;
}
const {
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropTargetPos,
dropAllowed,
dragOverNodeKey
} = calcDropPosition(event, dragNode, node, indent.value, dragStartMousePosition, allowDrop, flattenNodes.value, keyEntities.value, expandedKeysSet.value, direction);
if (
// don't allow drop inside its children
dragState.dragChildrenKeys.indexOf(dropTargetKey) !== -1 || // don't allow drop when drop is not allowed caculated by calcDropPosition
!dropAllowed
) {
resetDragState();
return;
}
if (!delayedDragEnterLogic) {
delayedDragEnterLogic = {};
}
Object.keys(delayedDragEnterLogic).forEach((key2) => {
clearTimeout(delayedDragEnterLogic[key2]);
});
if (dragNode.eventKey !== node.eventKey) {
delayedDragEnterLogic[pos] = (void 0).setTimeout(() => {
if (dragState.draggingNodeKey === null) return;
let newExpandedKeys = expandedKeys.value.slice();
const entity = keyEntities.value[node.eventKey];
if (entity && (entity.children || []).length) {
newExpandedKeys = arrAdd(expandedKeys.value, node.eventKey);
}
setExpandedKeys(newExpandedKeys);
if (onExpand) {
onExpand(newExpandedKeys, {
node: node.eventData,
expanded: true,
nativeEvent: event
});
}
}, 800);
}
if (dragNode.eventKey === dropTargetKey && dropLevelOffset === 0) {
resetDragState();
return;
}
_extends(dragState, {
dragOverNodeKey,
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropTargetPos,
dropAllowed
});
if (onDragenter) {
onDragenter({
event,
node: node.eventData,
expandedKeys: expandedKeys.value
});
}
};
const onNodeDragOver = (event, node) => {
const {
onDragover,
allowDrop,
direction
} = props2;
if (!dragNode) {
return;
}
const {
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropAllowed,
dropTargetPos,
dragOverNodeKey
} = calcDropPosition(event, dragNode, node, indent.value, dragStartMousePosition, allowDrop, flattenNodes.value, keyEntities.value, expandedKeysSet.value, direction);
if (dragState.dragChildrenKeys.indexOf(dropTargetKey) !== -1 || !dropAllowed) {
return;
}
if (dragNode.eventKey === dropTargetKey && dropLevelOffset === 0) {
if (!(dragState.dropPosition === null && dragState.dropLevelOffset === null && dragState.dropTargetKey === null && dragState.dropContainerKey === null && dragState.dropTargetPos === null && dragState.dropAllowed === false && dragState.dragOverNodeKey === null)) {
resetDragState();
}
} else if (!(dropPosition === dragState.dropPosition && dropLevelOffset === dragState.dropLevelOffset && dropTargetKey === dragState.dropTargetKey && dropContainerKey === dragState.dropContainerKey && dropTargetPos === dragState.dropTargetPos && dropAllowed === dragState.dropAllowed && dragOverNodeKey === dragState.dragOverNodeKey)) {
_extends(dragState, {
dropPosition,
dropLevelOffset,
dropTargetKey,
dropContainerKey,
dropTargetPos,
dropAllowed,
dragOverNodeKey
});
}
if (onDragover) {
onDragover({
event,
node: node.eventData
});
}
};
const onNodeDragLeave = (event, node) => {
if (currentMouseOverDroppableNodeKey === node.eventKey && !event.currentTarget.contains(event.relatedTarget)) {
resetDragState();
currentMouseOverDroppableNodeKey = null;
}
const {
onDragleave
} = props2;
if (onDragleave) {
onDragleave({
event,
node: node.eventData
});
}
};
const onNodeDrop = function(event, _node) {
let outsideTree = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
var _a;
const {
dragChildrenKeys,
dropPosition,
dropTargetKey,
dropTargetPos,
dropAllowed
} = dragState;
if (!dropAllowed) return;
const {
onDrop
} = props2;
dragState.dragOverNodeKey = null;
cleanDragState();
if (dropTargetKey === null) return;
const abstractDropNodeProps = _extends(_extends({}, getTreeNodeProps(dropTargetKey, toRaw(treeNodeRequiredProps.value))), {
active: ((_a = activeItem.value) === null || _a === void 0 ? void 0 : _a.key) === dropTargetKey,
data: keyEntities.value[dropTargetKey].node
});
dragChildrenKeys.indexOf(dropTargetKey) !== -1;
const posArr = posToArr(dropTargetPos);
const dropResult = {
event,
node: convertNodePropsToEventData(abstractDropNodeProps),
dragNode: dragNode ? dragNode.eventData : null,
dragNodesKeys: [dragNode.eventKey].concat(dragChildrenKeys),
dropToGap: dropPosition !== 0,
dropPosition: dropPosition + Number(posArr[posArr.length - 1])
};
if (!outsideTree) {
onDrop === null || onDrop === void 0 ? void 0 : onDrop(dropResult);
}
dragNode = null;
};
const triggerExpandActionExpand = (e, treeNode) => {
const {
expanded,
key: key2
} = treeNode;
const node = flattenNodes.value.filter((nodeItem) => nodeItem.key === key2)[0];
const eventNode = convertNodePropsToEventData(_extends(_extends({}, getTreeNodeProps(key2, treeNodeRequiredProps.value)), {
data: node.data
}));
setExpandedKeys(expanded ? arrDel(expandedKeys.value, key2) : arrAdd(expandedKeys.value, key2));
onNodeExpand(e, eventNode);
};
const onNodeClick = (e, treeNode) => {
const {
onClick,
expandAction
} = props2;
if (expandAction === "click") {
triggerExpandActionExpand(e, treeNode);
}
if (onClick) {
onClick(e, treeNode);
}
};
const onNodeDoubleClick = (e, treeNode) => {
const {
onDblclick,
expandAction
} = props2;
if (expandAction === "doubleclick" || expandAction === "dblclick") {
triggerExpandActionExpand(e, treeNode);
}
if (onDblclick) {
onDblclick(e, treeNode);
}
};
const onNodeSelect = (e, treeNode) => {
let newSelectedKeys = selectedKeys.value;
const {
onSelect,
multiple
} = props2;
const {
selected
} = treeNode;
const key2 = treeNode[fieldNames.value.key];
const targetSelected = !selected;
if (!targetSelected) {
newSelectedKeys = arrDel(newSelectedKeys, key2);
} else if (!multiple) {
newSelectedKeys = [key2];
} else {
newSelectedKeys = arrAdd(newSelectedKeys, key2);
}
const keyEntitiesValue = keyEntities.value;
const selectedNodes = newSelectedKeys.map((selectedKey) => {
const entity = keyEntitiesValue[selectedKey];
if (!entity) return null;
return entity.node;
}).filter((node) => node);
if (props2.selectedKeys === void 0) {
selectedKeys.value = newSelectedKeys;
}
if (onSelect) {
onSelect(newSelectedKeys, {
event: "select",
selected: targetSelected,
node: treeNode,
selectedNodes,
nativeEvent: e
});
}
};
const onNodeCheck = (e, treeNode, checked) => {
const {
checkStrictly,
onCheck
} = props2;
const key2 = treeNode[fieldNames.value.key];
let checkedObj;
const eventObj = {
event: "check",
node: treeNode,
checked,
nativeEvent: e
};
const keyEntitiesValue = keyEntities.value;
if (checkStrictly) {
const newCheckedKeys = checked ? arrAdd(checkedKeys.value, key2) : arrDel(checkedKeys.value, key2);
const newHalfCheckedKeys = arrDel(halfCheckedKeys.value, key2);
checkedObj = {
checked: newCheckedKeys,
halfChecked: newHalfCheckedKeys
};
eventObj.checkedNodes = newCheckedKeys.map((checkedKey) => keyEntitiesValue[checkedKey]).filter((entity) => entity).map((entity) => entity.node);
if (props2.checkedKeys === void 0) {
checkedKeys.value = newCheckedKeys;
}
} else {
let {
checkedKeys: newCheckedKeys,
halfCheckedKeys: newHalfCheckedKeys
} = conductCheck([...checkedKeys.value, key2], true, keyEntitiesValue, maxLevel.value, levelEntities.value);
if (!checked) {
const keySet = new Set(newCheckedKeys);
keySet.delete(key2);
({
checkedKeys: newCheckedKeys,
halfCheckedKeys: newHalfCheckedKeys
} = conductCheck(Array.from(keySet), {
halfCheckedKeys: newHalfCheckedKeys
}, keyEntitiesValue, maxLevel.value, levelEntities.value));
}
checkedObj = newCheckedKeys;
eventObj.checkedNodes = [];
eventObj.checkedNodesPositions = [];
eventObj.halfCheckedKeys = newHalfCheckedKeys;
newCheckedKeys.forEach((checkedKey) => {
const entity = keyEntitiesValue[checkedKey];
if (!entity) return;
const {
node,
pos
} = entity;
eventObj.checkedNodes.push(node);
eventObj.checkedNodesPositions.push({
node,
pos
});
});
if (props2.checkedKeys === void 0) {
checkedKeys.value = newCheckedKeys;
halfCheckedKeys.value = newHalfCheckedKeys;
}
}
if (onCheck) {
onCheck(checkedObj, eventObj);
}
};
const onNodeLoad = (treeNode) => {
const key2 = treeNode[fieldNames.value.key];
const loadPromise = new Promise((resolve, reject) => {
const {
loadData,
onLoad
} = props2;
if (!loadData || loadedKeysSet.value.has(key2) || loadingKeysSet.value.has(key2)) {
return null;
}
const promise = loadData(treeNode);
promise.then(() => {
const newLoadedKeys = arrAdd(loadedKeys.value, key2);
const newLoadingKeys = arrDel(loadingKeys.value, key2);
if (onLoad) {
onLoad(newLoadedKeys, {
event: "load",
node: treeNode
});
}
if (props2.loadedKeys === void 0) {
loadedKeys.value = newLoadedKeys;
}
loadingKeys.value = newLoadingKeys;
resolve();
}).catch((e) => {
const newLoadingKeys = arrDel(loadingKeys.value, key2);
loadingKeys.value = newLoadingKeys;
loadingRetryTimes[key2] = (loadingRetryTimes[key2] || 0) + 1;
if (loadingRetryTimes[key2] >= MAX_RETRY_TIMES) {
const newLoadedKeys = arrAdd(loadedKeys.value, key2);
if (props2.loadedKeys === void 0) {
loadedKeys.value = newLoadedKeys;
}
resolve();
}
reject(e);
});
loadingKeys.value = arrAdd(loadingKeys.value, key2);
});
loadPromise.catch(() => {
});
return loadPromise;
};
const onNodeMouseEnter = (event, node) => {
const {
onMouseenter
} = props2;
if (onMouseenter) {
onMouseenter({
event,
node
});
}
};
const onNodeMouseLeave = (event, node) => {
const {
onMouseleave
} = props2;
if (onMouseleave) {
onMouseleave({
event,
node
});
}
};
const onNodeContextMenu = (event, node) => {
const {
onRightClick
} = props2;
if (onRightClick) {
event.preventDefault();
onRightClick({
event,
node
});
}
};
const onFocus = (e) => {
const {
onFocus: onFocus2
} = props2;
focused.value = true;
if (onFocus2) {
onFocus2(e);
}
};
const onBlur = (e) => {
const {
onBlur: onBlur2
} = props2;
focused.value = false;
onActiveChange(null);
if (onBlur2) {
onBlur2(e);
}
};
const onNodeExpand = (e, treeNode) => {
let newExpandedKeys = expandedKeys.value;
const {
onExpand,
loadData
} = props2;
const {
expanded
} = treeNode;
const key2 = treeNode[fieldNames.value.key];
if (listChanging.value) {
return;
}
newExpandedKeys.indexOf(key2);
const targetExpanded = !expanded;
if (targetExpanded) {
newExpandedKeys = arrAdd(newExpandedKeys, key2);
} else {
newExpandedKeys = arrDel(newExpandedKeys, key2);
}
setExpandedKeys(newExpandedKeys);
if (onExpand) {
onExpand(newExpandedKeys, {
node: treeNode,
expanded: targetExpanded,
nativeEvent: e
});
}
if (targetExpanded && loadData) {
const loadPromise = onNodeLoad(treeNode);
if (loadPromise) {
loadPromise.then(() => {
}).catch((e2) => {
const expandedKeysToRestore = arrDel(expandedKeys.value, key2);
setExpandedKeys(expandedKeysToRestore);
Promise.reject(e2);
});
}
}
};
const onListChangeStart = () => {
listChanging.value = true;
};
const onListChangeEnd = () => {
setTimeout(() => {
listChanging.value = false;
});
};
const onActiveChange = (newActiveKey) => {
const {
onActiveChange: onActiveChange2
} = props2;
if (activeKey.value === newActiveKey) {
return;
}
if (props2.activeKey !== void 0) {
activeKey.value = newActiveKey;
}
if (newActiveKey !== null) {
scrollTo2({
key: newActiveKey
});
}
if (onActiveChange2) {
onActiveChange2(newActiveKey);
}
};
const activeItem = computed(() => {
if (activeKey.value === null) {
return null;
}
return flattenNodes.value.find((_ref4) => {
let {
key: key2
} = _ref4;
return key2 === activeKey.value;
}) || null;
});
const offsetActiveKey = (offset2) => {
let index2 = flattenNodes.value.findIndex((_ref5) => {
let {
key: key2
} = _ref5;
return key2 === activeKey.value;
});
if (index2 === -1 && offset2 < 0) {
index2 = flattenNodes.value.length;
}
index2 = (index2 + offset2 + flattenNodes.value.length) % flattenNodes.value.length;
const item = flattenNodes.value[index2];
if (item) {
const {
key: key2
} = item;
onActiveChange(key2);
} else {
onActiveChange(null);
}
};
const activeItemEventNode = computed(() => {
return convertNodePropsToEventData(_extends(_extends({}, getTreeNodeProps(activeKey.value, treeNodeRequiredProps.value)), {
data: activeItem.value.data,
active: true
}));
});
const onKeydown = (event) => {
const {
onKeydown: onKeydown2,
checkable,
selectable
} = props2;
switch (event.which) {
case KeyCode.UP: {
offsetActiveKey(-1);
event.preventDefault();
break;
}
case KeyCode.DOWN: {
offsetActiveKey(1);
event.preventDefault();
break;
}
}
const item = activeItem.value;
if (item && item.data) {
const expandable = item.data.isLeaf === false || !!(item.data.children || []).length;
const eventNode = activeItemEventNode.value;
switch (event.which) {
// >>> Expand
case KeyCode.LEFT: {
if (expandable && expandedKeysSet.value.has(activeKey.value)) {
onNodeExpand({}, eventNode);
} else if (item.parent) {
onActiveChange(item.parent.key);
}
event.preventDefault();
break;
}
case KeyCode.RIGHT: {
if (expandable && !expandedKeysSet.value.has(activeKey.value)) {
onNodeExpand({}, eventNode);
} else if (item.children && item.children.length) {
onActiveChange(item.children[0].key);
}
event.preventDefault();
break;
}
// Selection
case KeyCode.ENTER:
case KeyCode.SPACE: {
if (checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox) {
onNodeCheck({}, eventNode, !checkedKeysSet.value.has(activeKey.value));
} else if (!checkable && selectable && !eventNode.disabled && eventNode.selectable !== false) {
onNodeSelect({}, eventNode);
}
break;
}
}
}
if (onKeydown2) {
onKeydown2(event);
}
};
expose({
onNodeExpand,
scrollTo: scrollTo2,
onKeydown,
selectedKeys: computed(() => selectedKeys.value),
checkedKeys: computed(() => checkedKeys.value),
halfCheckedKeys: computed(() => halfCheckedKeys.value),
loadedKeys: computed(() => loadedKeys.value),
loadingKeys: computed(() => loadingKeys.value),
expandedKeys: computed(() => expandedKeys.value)
});
useProvideKeysState({
expandedKeys,
selectedKeys,
loadedKeys,
loadingKeys,
checkedKeys,
halfCheckedKeys,
expandedKeysSet,
selectedKeysSet,
loadedKeysSet,
loadingKeysSet,
checkedKeysSet,
halfCheckedKeysSet,
flattenNodes
});
return () => {
const {
// focused,
// flattenNodes,
// keyEntities,
draggingNodeKey,
// activeKey,
dropLevelOffset,
dropContainerKey,
dropTargetKey,
dropPosition,
dragOverNodeKey
// indent,
} = dragState;
const {
prefixCls,
showLine,
focusable,
tabindex = 0,
selectable,
showIcon,
icon = slots.icon,
switcherIcon,
draggable,
checkable,
checkStrictly,
disabled,
motion,
loadData,
filterTreeNode,
height,
itemHeight,
virtual,
dropIndicatorRender: dropIndicatorRender2,
onContextmenu,
onScroll,
direction,
rootClassName,
rootStyle
} = props2;
const {
class: className,
style
} = attrs;
const domProps = pickAttrs(_extends(_extends({}, props2), attrs), {
aria: true,
data: true
});
let draggableConfig;
if (draggable) {
if (typeof draggable === "object") {
draggableConfig = draggable;
} else if (typeof draggable === "function") {
draggableConfig = {
nodeDraggable: draggable
};
} else {
draggableConfig = {};
}
} else {
draggableConfig = false;
}
return createVNode(TreeContext, {
"value": {
prefixCls,
selectable,
showIcon,
icon,
switcherIcon,
draggable: draggableConfig,
draggingNodeKey,
checkable,
customCheckable: slots.checkable,
checkStrictly,
disabled,
keyEntities: keyEntities.value,
dropLevelOffset,
dropContainerKey,
dropTargetKey,
dropPosition,
dragOverNodeKey,
dragging: draggingNodeKey !== null,
indent: indent.value,
direction,
dropIndicatorRender: dropIndicatorRender2,
loadData,
filterTreeNode,
onNodeClick,
onNodeDoubleClick,
onNodeExpand,
onNodeSelect,
onNodeCheck,
onNodeLoad,
onNodeMouseEnter,
onNodeMouseLeave,
onNodeContextMenu,
onNodeDragStart,
onNodeDragEnter,
onNodeDragOver,
onNodeDragLeave,
onNodeDragEnd,
onNodeDrop,
slots
}
}, {
default: () => [createVNode("div", {
"role": "tree",
"class": classNames(prefixCls, className, rootClassName, {
[`${prefixCls}-show-line`]: showLine,
[`${prefixCls}-focused`]: focused.value,
[`${prefixCls}-active-focused`]: activeKey.value !== null
}),
"style": rootStyle
}, [createVNode(NodeList, _objectSpread$W({
"ref": listRef,
"prefixCls": prefixCls,
"style": style,
"disabled": disabled,
"selectable": selectable,
"checkable": !!checkable,
"motion": motion,
"height": height,
"itemHeight": itemHeight,
"virtual": virtual,
"focusable": focusable,
"focused": focused.value,
"tabindex": tabindex,
"activeItem": activeItem.value,
"onFocus": onFocus,
"onBlur": onBlur,
"onKeydown": onKeydown,
"onActiveChange": onActiveChange,
"onListChangeStart": onListChangeStart,
"onListChangeEnd": onListChangeEnd,
"onContextmenu": onContextmenu,
"onScroll": onScroll
}, domProps), null)])]
});
};
}
});
function renderSwitcherIcon(prefixCls, switcherIcon, props2, leafIcon, showLine) {
const {
isLeaf: isLeaf2,
expanded,
loading: loading2
} = props2;
let icon = switcherIcon;
if (loading2) {
return createVNode(LoadingOutlined, {
"class": `${prefixCls}-switcher-loading-icon`
}, null);
}
let showLeafIcon;
if (showLine && typeof showLine === "object") {
showLeafIcon = showLine.showLeafIcon;
}
let defaultIcon = null;
const switcherCls = `${prefixCls}-switcher-icon`;
if (isLeaf2) {
if (!showLine) {
return null;
}
if (showLeafIcon && leafIcon) {
return leafIcon(props2);
}
if (typeof showLine === "object" && !showLeafIcon) {
defaultIcon = createVNode("span", {
"class": `${prefixCls}-switcher-leaf-line`
}, null);
} else {
defaultIcon = createVNode(FileOutlined, {
"class": `${prefixCls}-switcher-line-icon`
}, null);
}
return defaultIcon;
} else {
defaultIcon = createVNode(CaretDownFilled, {
"class": switcherCls
}, null);
if (showLine) {
defaultIcon = expanded ? createVNode(MinusSquareOutlined, {
"class": `${prefixCls}-switcher-line-icon`
}, null) : createVNode(PlusSquareOutlined, {
"class": `${prefixCls}-switcher-line-icon`
}, null);
}
}
if (typeof switcherIcon === "function") {
icon = switcherIcon(_extends(_extends({}, props2), {
defaultIcon,
switcherCls
}));
} else if (isValidElement(icon)) {
icon = cloneVNode(icon, {
class: switcherCls
});
}
return icon || defaultIcon;
}
const offset = 4;
function dropIndicatorRender(props2) {
const {
dropPosition,
dropLevelOffset,
prefixCls,
indent,
direction = "ltr"
} = props2;
const startPosition = direction === "ltr" ? "left" : "right";
const endPosition = direction === "ltr" ? "right" : "left";
const style = {
[startPosition]: `${-dropLevelOffset * indent + offset}px`,
[endPosition]: 0
};
switch (dropPosition) {
case -1:
style.top = `${ -3}px`;
break;
case 1:
style.bottom = `${ -3}px`;
break;
default:
style.bottom = `${ -3}px`;
style[startPosition] = `${indent + offset}px`;
break;
}
return createVNode("div", {
"style": style,
"class": `${prefixCls}-drop-indicator`
}, null);
}
const treeNodeFX = new Keyframe("ant-tree-node-fx-do-not-use", {
"0%": {
opacity: 0
},
"100%": {
opacity: 1
}
});
const getSwitchStyle = (prefixCls, token) => ({
[`.${prefixCls}-switcher-icon`]: {
display: "inline-block",
fontSize: 10,
verticalAlign: "baseline",
svg: {
transition: `transform ${token.motionDurationSlow}`
}
}
});
const getDropIndicatorStyle = (prefixCls, token) => ({
[`.${prefixCls}-drop-indicator`]: {
position: "absolute",
// it should displayed over the following node
zIndex: 1,
height: 2,
backgroundColor: token.colorPrimary,
borderRadius: 1,
pointerEvents: "none",
"&:after": {
position: "absolute",
top: -3,
insetInlineStart: -6,
width: 8,
height: 8,
backgroundColor: "transparent",
border: `${token.lineWidthBold}px solid ${token.colorPrimary}`,
borderRadius: "50%",
content: '""'
}
}
});
const genBaseStyle$4 = (prefixCls, token) => {
const {
treeCls,
treeNodeCls,
treeNodePadding,
treeTitleHeight
} = token;
const treeCheckBoxMarginVertical = (treeTitleHeight - token.fontSizeLG) / 2;
const treeCheckBoxMarginHorizontal = token.paddingXS;
return {
[treeCls]: _extends(_extends({}, resetComponent(token)), {
background: token.colorBgContainer,
borderRadius: token.borderRadius,
transition: `background-color ${token.motionDurationSlow}`,
[`&${treeCls}-rtl`]: {
// >>> Switcher
[`${treeCls}-switcher`]: {
"&_close": {
[`${treeCls}-switcher-icon`]: {
svg: {
transform: "rotate(90deg)"
}
}
}
}
},
[`&-focused:not(:hover):not(${treeCls}-active-focused)`]: _extends({}, genFocusOutline(token)),
// =================== Virtual List ===================
[`${treeCls}-list-holder-inner`]: {
alignItems: "flex-start"
},
[`&${treeCls}-block-node`]: {
[`${treeCls}-list-holder-inner`]: {
alignItems: "stretch",
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
flex: "auto"
},
// >>> Drag
[`${treeNodeCls}.dragging`]: {
position: "relative",
"&:after": {
position: "absolute",
top: 0,
insetInlineEnd: 0,
bottom: treeNodePadding,
insetInlineStart: 0,
border: `1px solid ${token.colorPrimary}`,
opacity: 0,
animationName: treeNodeFX,
animationDuration: token.motionDurationSlow,
animationPlayState: "running",
animationFillMode: "forwards",
content: '""',
pointerEvents: "none"
}
}
}
},
// ===================== TreeNode =====================
[`${treeNodeCls}`]: {
display: "flex",
alignItems: "flex-start",
padding: `0 0 ${treeNodePadding}px 0`,
outline: "none",
"&-rtl": {
direction: "rtl"
},
// Disabled
"&-disabled": {
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
color: token.colorTextDisabled,
cursor: "not-allowed",
"&:hover": {
background: "transparent"
}
}
},
[`&-active ${treeCls}-node-content-wrapper`]: _extends({}, genFocusOutline(token)),
[`&:not(${treeNodeCls}-disabled).filter-node ${treeCls}-title`]: {
color: "inherit",
fontWeight: 500
},
"&-draggable": {
[`${treeCls}-draggable-icon`]: {
width: treeTitleHeight,
lineHeight: `${treeTitleHeight}px`,
textAlign: "center",
visibility: "visible",
opacity: 0.2,
transition: `opacity ${token.motionDurationSlow}`,
[`${treeNodeCls}:hover &`]: {
opacity: 0.45
}
},
[`&${treeNodeCls}-disabled`]: {
[`${treeCls}-draggable-icon`]: {
visibility: "hidden"
}
}
}
},
// >>> Indent
[`${treeCls}-indent`]: {
alignSelf: "stretch",
whiteSpace: "nowrap",
userSelect: "none",
"&-unit": {
display: "inline-block",
width: treeTitleHeight
}
},
// >>> Drag Handler
[`${treeCls}-draggable-icon`]: {
visibility: "hidden"
},
// >>> Switcher
[`${treeCls}-switcher`]: _extends(_extends({}, getSwitchStyle(prefixCls, token)), {
position: "relative",
flex: "none",
alignSelf: "stretch",
width: treeTitleHeight,
margin: 0,
lineHeight: `${treeTitleHeight}px`,
textAlign: "center",
cursor: "pointer",
userSelect: "none",
"&-noop": {
cursor: "default"
},
"&_close": {
[`${treeCls}-switcher-icon`]: {
svg: {
transform: "rotate(-90deg)"
}
}
},
"&-loading-icon": {
color: token.colorPrimary
},
"&-leaf-line": {
position: "relative",
zIndex: 1,
display: "inline-block",
width: "100%",
height: "100%",
// https://github.com/ant-design/ant-design/issues/31884
"&:before": {
position: "absolute",
top: 0,
insetInlineEnd: treeTitleHeight / 2,
bottom: -treeNodePadding,
marginInlineStart: -1,
borderInlineEnd: `1px solid ${token.colorBorder}`,
content: '""'
},
"&:after": {
position: "absolute",
width: treeTitleHeight / 2 * 0.8,
height: treeTitleHeight / 2,
borderBottom: `1px solid ${token.colorBorder}`,
content: '""'
}
}
}),
// >>> Checkbox
[`${treeCls}-checkbox`]: {
top: "initial",
marginInlineEnd: treeCheckBoxMarginHorizontal,
marginBlockStart: treeCheckBoxMarginVertical
},
// >>> Title
// add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
[`${treeCls}-node-content-wrapper, ${treeCls}-checkbox + span`]: {
position: "relative",
zIndex: "auto",
minHeight: treeTitleHeight,
margin: 0,
padding: `0 ${token.paddingXS / 2}px`,
color: "inherit",
lineHeight: `${treeTitleHeight}px`,
background: "transparent",
borderRadius: token.borderRadius,
cursor: "pointer",
transition: `all ${token.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`,
"&:hover": {
backgroundColor: token.controlItemBgHover
},
[`&${treeCls}-node-selected`]: {
backgroundColor: token.controlItemBgActive
},
// Icon
[`${treeCls}-iconEle`]: {
display: "inline-block",
width: treeTitleHeight,
height: treeTitleHeight,
lineHeight: `${treeTitleHeight}px`,
textAlign: "center",
verticalAlign: "top",
"&:empty": {
display: "none"
}
}
},
// https://github.com/ant-design/ant-design/issues/28217
[`${treeCls}-unselectable ${treeCls}-node-content-wrapper:hover`]: {
backgroundColor: "transparent"
},
// ==================== Draggable =====================
[`${treeCls}-node-content-wrapper`]: _extends({
lineHeight: `${treeTitleHeight}px`,
userSelect: "none"
}, getDropIndicatorStyle(prefixCls, token)),
[`${treeNodeCls}.drop-container`]: {
"> [draggable]": {
boxShadow: `0 0 0 2px ${token.colorPrimary}`
}
},
// ==================== Show Line =====================
"&-show-line": {
// ================ Indent lines ================
[`${treeCls}-indent`]: {
"&-unit": {
position: "relative",
height: "100%",
"&:before": {
position: "absolute",
top: 0,
insetInlineEnd: treeTitleHeight / 2,
bottom: -treeNodePadding,
borderInlineEnd: `1px solid ${token.colorBorder}`,
content: '""'
},
"&-end": {
"&:before": {
display: "none"
}
}
}
},
// ============== Cover Background ==============
[`${treeCls}-switcher`]: {
background: "transparent",
"&-line-icon": {
// https://github.com/ant-design/ant-design/issues/32813
verticalAlign: "-0.15em"
}
}
},
[`${treeNodeCls}-leaf-last`]: {
[`${treeCls}-switcher`]: {
"&-leaf-line": {
"&:before": {
top: "auto !important",
bottom: "auto !important",
height: `${treeTitleHeight / 2}px !important`
}
}
}
}
})
};
};
const genDirectoryStyle = (token) => {
const {
treeCls,
treeNodeCls,
treeNodePadding
} = token;
return {
[`${treeCls}${treeCls}-directory`]: {
// ================== TreeNode ==================
[treeNodeCls]: {
position: "relative",
// Hover color
"&:before": {
position: "absolute",
top: 0,
insetInlineEnd: 0,
bottom: treeNodePadding,
insetInlineStart: 0,
transition: `background-color ${token.motionDurationMid}`,
content: '""',
pointerEvents: "none"
},
"&:hover": {
"&:before": {
background: token.controlItemBgHover
}
},
// Elements
"> *": {
zIndex: 1
},
// >>> Switcher
[`${treeCls}-switcher`]: {
transition: `color ${token.motionDurationMid}`
},
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
borderRadius: 0,
userSelect: "none",
"&:hover": {
background: "transparent"
},
[`&${treeCls}-node-selected`]: {
color: token.colorTextLightSolid,
background: "transparent"
}
},
// ============= Selected =============
"&-selected": {
[`
&:hover::before,
&::before
`]: {
background: token.colorPrimary
},
// >>> Switcher
[`${treeCls}-switcher`]: {
color: token.colorTextLightSolid
},
// >>> Title
[`${treeCls}-node-content-wrapper`]: {
color: token.colorTextLightSolid,
background: "transparent"
}
}
}
}
};
};
const genTreeStyle = (prefixCls, token) => {
const treeCls = `.${prefixCls}`;
const treeNodeCls = `${treeCls}-treenode`;
const treeNodePadding = token.paddingXS / 2;
const treeTitleHeight = token.controlHeightSM;
const treeToken = merge(token, {
treeCls,
treeNodeCls,
treeNodePadding,
treeTitleHeight
});
return [
// Basic
genBaseStyle$4(prefixCls, treeToken),
// Directory
genDirectoryStyle(treeToken)
];
};
const useStyle$a = genComponentStyleHook("Tree", (token, _ref) => {
let {
prefixCls
} = _ref;
return [{
[token.componentCls]: getStyle$2(`${prefixCls}-checkbox`, token)
}, genTreeStyle(prefixCls, token), genCollapseMotion(token)];
});
const treeProps = () => {
const baseTreeProps = treeProps$1();
return _extends(_extends({}, baseTreeProps), {
showLine: someType([Boolean, Object]),
/** 是否支持多选 */
multiple: booleanType(),
/** 是否自动展开父节点 */
autoExpandParent: booleanType(),
/** checkable状态下节点选择完全受控(父子节点选中状态不再关联)*/
checkStrictly: booleanType(),
/** 是否支持选中 */
checkable: booleanType(),
/** 是否禁用树 */
disabled: booleanType(),
/** 默认展开所有树节点 */
defaultExpandAll: booleanType(),
/** 默认展开对应树节点 */
defaultExpandParent: booleanType(),
/** 默认展开指定的树节点 */
defaultExpandedKeys: arrayType(),
/** (受控)展开指定的树节点 */
expandedKeys: arrayType(),
/** (受控)选中复选框的树节点 */
checkedKeys: someType([Array, Object]),
/** 默认选中复选框的树节点 */
defaultCheckedKeys: arrayType(),
/** (受控)设置选中的树节点 */
selectedKeys: arrayType(),
/** 默认选中的树节点 */
defaultSelectedKeys: arrayType(),
selectable: booleanType(),
loadedKeys: arrayType(),
draggable: booleanType(),
showIcon: booleanType(),
icon: functionType(),
switcherIcon: PropTypes.any,
prefixCls: String,
/**
* @default{title,key,children}
* deprecated, please use `fieldNames` instead
* 替换treeNode中 title,key,children字段为treeData中对应的字段
*/
replaceFields: objectType(),
blockNode: booleanType(),
openAnimation: PropTypes.any,
onDoubleclick: baseTreeProps.onDblclick,
"onUpdate:selectedKeys": functionType(),
"onUpdate:checkedKeys": functionType(),
"onUpdate:expandedKeys": functionType()
});
};
const Tree$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATree",
inheritAttrs: false,
props: initDefaultProps(treeProps(), {
checkable: false,
selectable: true,
showIcon: false,
blockNode: false
}),
slots: Object,
setup(props2, _ref) {
let {
attrs,
expose,
emit,
slots
} = _ref;
warning$1(!(props2.treeData === void 0 && slots.default));
const {
prefixCls,
direction,
virtual
} = useConfigInject("tree", props2);
const [wrapSSR, hashId] = useStyle$a(prefixCls);
const treeRef = ref();
const scrollTo2 = (scroll) => {
var _a;
(_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(scroll);
};
expose({
treeRef,
onNodeExpand: function() {
var _a;
(_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.onNodeExpand(...arguments);
},
scrollTo: scrollTo2,
selectedKeys: computed(() => {
var _a;
return (_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.selectedKeys;
}),
checkedKeys: computed(() => {
var _a;
return (_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.checkedKeys;
}),
halfCheckedKeys: computed(() => {
var _a;
return (_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.halfCheckedKeys;
}),
loadedKeys: computed(() => {
var _a;
return (_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.loadedKeys;
}),
loadingKeys: computed(() => {
var _a;
return (_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.loadingKeys;
}),
expandedKeys: computed(() => {
var _a;
return (_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.expandedKeys;
})
});
watchEffect(() => {
devWarning(props2.replaceFields === void 0, "Tree", "`replaceFields` is deprecated, please use fieldNames instead");
});
const handleCheck = (checkedObjOrKeys, eventObj) => {
emit("update:checkedKeys", checkedObjOrKeys);
emit("check", checkedObjOrKeys, eventObj);
};
const handleExpand = (expandedKeys, eventObj) => {
emit("update:expandedKeys", expandedKeys);
emit("expand", expandedKeys, eventObj);
};
const handleSelect = (selectedKeys, eventObj) => {
emit("update:selectedKeys", selectedKeys);
emit("select", selectedKeys, eventObj);
};
return () => {
const {
showIcon,
showLine,
switcherIcon = slots.switcherIcon,
icon = slots.icon,
blockNode,
checkable,
selectable,
fieldNames = props2.replaceFields,
motion = props2.openAnimation,
itemHeight = 28,
onDoubleclick,
onDblclick
} = props2;
const newProps = _extends(_extends(_extends({}, attrs), omit(props2, ["onUpdate:checkedKeys", "onUpdate:expandedKeys", "onUpdate:selectedKeys", "onDoubleclick"])), {
showLine: Boolean(showLine),
dropIndicatorRender,
fieldNames,
icon,
itemHeight
});
const children = slots.default ? filterEmpty(slots.default()) : void 0;
return wrapSSR(createVNode(Tree$2, _objectSpread$W(_objectSpread$W({}, newProps), {}, {
"virtual": virtual.value,
"motion": motion,
"ref": treeRef,
"prefixCls": prefixCls.value,
"class": classNames({
[`${prefixCls.value}-icon-hide`]: !showIcon,
[`${prefixCls.value}-block-node`]: blockNode,
[`${prefixCls.value}-unselectable`]: !selectable,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value),
"direction": direction.value,
"checkable": checkable,
"selectable": selectable,
"switcherIcon": (nodeProps) => renderSwitcherIcon(prefixCls.value, switcherIcon, nodeProps, slots.leafIcon, showLine),
"onCheck": handleCheck,
"onExpand": handleExpand,
"onSelect": handleSelect,
"onDblclick": onDblclick || onDoubleclick,
"children": children
}), _extends(_extends({}, slots), {
checkable: () => createVNode("span", {
"class": `${prefixCls.value}-checkbox-inner`
}, null)
})));
};
}
});
var Record;
(function(Record2) {
Record2[Record2["None"] = 0] = "None";
Record2[Record2["Start"] = 1] = "Start";
Record2[Record2["End"] = 2] = "End";
})(Record || (Record = {}));
function traverseNodesKey(treeData, fieldNames, callback) {
function processNode(dataNode) {
const key2 = dataNode[fieldNames.key];
const children = dataNode[fieldNames.children];
if (callback(key2, dataNode) !== false) {
traverseNodesKey(children || [], fieldNames, callback);
}
}
treeData.forEach(processNode);
}
function calcRangeKeys(_ref) {
let {
treeData,
expandedKeys,
startKey,
endKey,
fieldNames = {
title: "title",
key: "key",
children: "children"
}
} = _ref;
const keys = [];
let record = Record.None;
if (startKey && startKey === endKey) {
return [startKey];
}
if (!startKey || !endKey) {
return [];
}
function matchKey(key2) {
return key2 === startKey || key2 === endKey;
}
traverseNodesKey(treeData, fieldNames, (key2) => {
if (record === Record.End) {
return false;
}
if (matchKey(key2)) {
keys.push(key2);
if (record === Record.None) {
record = Record.Start;
} else if (record === Record.Start) {
record = Record.End;
return false;
}
} else if (record === Record.Start) {
keys.push(key2);
}
return expandedKeys.includes(key2);
});
return keys;
}
function convertDirectoryKeysToNodes(treeData, keys, fieldNames) {
const restKeys = [...keys];
const nodes = [];
traverseNodesKey(treeData, fieldNames, (key2, node) => {
const index2 = restKeys.indexOf(key2);
if (index2 !== -1) {
nodes.push(node);
restKeys.splice(index2, 1);
}
return !!restKeys.length;
});
return nodes;
}
var __rest$c = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const directoryTreeProps = () => _extends(_extends({}, treeProps()), {
expandAction: someType([Boolean, String])
});
function getIcon(props2) {
const {
isLeaf: isLeaf2,
expanded
} = props2;
if (isLeaf2) {
return createVNode(FileOutlined, null, null);
}
return expanded ? createVNode(FolderOpenOutlined, null, null) : createVNode(FolderOutlined, null, null);
}
const DirectoryTree = defineComponent({
compatConfig: {
MODE: 3
},
name: "ADirectoryTree",
inheritAttrs: false,
props: initDefaultProps(directoryTreeProps(), {
showIcon: true,
expandAction: "click"
}),
slots: Object,
// emits: [
// 'update:selectedKeys',
// 'update:checkedKeys',
// 'update:expandedKeys',
// 'expand',
// 'select',
// 'check',
// 'doubleclick',
// 'dblclick',
// 'click',
// ],
setup(props2, _ref) {
let {
attrs,
slots,
emit,
expose
} = _ref;
var _a;
const treeData = ref(props2.treeData || convertTreeToData(filterEmpty((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))));
watch(() => props2.treeData, () => {
treeData.value = props2.treeData;
});
const lastSelectedKey = ref();
const cachedSelectedKeys = ref();
const fieldNames = computed(() => fillFieldNames$1(props2.fieldNames));
const treeRef = ref();
const scrollTo2 = (scroll) => {
var _a2;
(_a2 = treeRef.value) === null || _a2 === void 0 ? void 0 : _a2.scrollTo(scroll);
};
expose({
scrollTo: scrollTo2,
selectedKeys: computed(() => {
var _a2;
return (_a2 = treeRef.value) === null || _a2 === void 0 ? void 0 : _a2.selectedKeys;
}),
checkedKeys: computed(() => {
var _a2;
return (_a2 = treeRef.value) === null || _a2 === void 0 ? void 0 : _a2.checkedKeys;
}),
halfCheckedKeys: computed(() => {
var _a2;
return (_a2 = treeRef.value) === null || _a2 === void 0 ? void 0 : _a2.halfCheckedKeys;
}),
loadedKeys: computed(() => {
var _a2;
return (_a2 = treeRef.value) === null || _a2 === void 0 ? void 0 : _a2.loadedKeys;
}),
loadingKeys: computed(() => {
var _a2;
return (_a2 = treeRef.value) === null || _a2 === void 0 ? void 0 : _a2.loadingKeys;
}),
expandedKeys: computed(() => {
var _a2;
return (_a2 = treeRef.value) === null || _a2 === void 0 ? void 0 : _a2.expandedKeys;
})
});
const getInitExpandedKeys = () => {
const {
keyEntities
} = convertDataToEntities(treeData.value, {
fieldNames: fieldNames.value
});
let initExpandedKeys;
if (props2.defaultExpandAll) {
initExpandedKeys = Object.keys(keyEntities);
} else if (props2.defaultExpandParent) {
initExpandedKeys = conductExpandParent(props2.expandedKeys || props2.defaultExpandedKeys || [], keyEntities);
} else {
initExpandedKeys = props2.expandedKeys || props2.defaultExpandedKeys;
}
return initExpandedKeys;
};
const selectedKeys = ref(props2.selectedKeys || props2.defaultSelectedKeys || []);
const expandedKeys = ref(getInitExpandedKeys());
watch(() => props2.selectedKeys, () => {
if (props2.selectedKeys !== void 0) {
selectedKeys.value = props2.selectedKeys;
}
}, {
immediate: true
});
watch(() => props2.expandedKeys, () => {
if (props2.expandedKeys !== void 0) {
expandedKeys.value = props2.expandedKeys;
}
}, {
immediate: true
});
const expandFolderNode = (event, node) => {
const {
isLeaf: isLeaf2
} = node;
if (isLeaf2 || event.shiftKey || event.metaKey || event.ctrlKey) {
return;
}
treeRef.value.onNodeExpand(event, node);
};
const onDebounceExpand = debounce$1(expandFolderNode, 200, {
leading: true
});
const onExpand = (keys, info) => {
if (props2.expandedKeys === void 0) {
expandedKeys.value = keys;
}
emit("update:expandedKeys", keys);
emit("expand", keys, info);
};
const onClick = (event, node) => {
const {
expandAction
} = props2;
if (expandAction === "click") {
onDebounceExpand(event, node);
}
emit("click", event, node);
};
const onDoubleClick = (event, node) => {
const {
expandAction
} = props2;
if (expandAction === "dblclick" || expandAction === "doubleclick") {
onDebounceExpand(event, node);
}
emit("doubleclick", event, node);
emit("dblclick", event, node);
};
const onSelect = (keys, event) => {
const {
multiple
} = props2;
const {
node,
nativeEvent
} = event;
const key2 = node[fieldNames.value.key];
const newEvent = _extends(_extends({}, event), {
selected: true
});
const ctrlPick = (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.ctrlKey) || (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.metaKey);
const shiftPick = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey;
let newSelectedKeys;
if (multiple && ctrlPick) {
newSelectedKeys = keys;
lastSelectedKey.value = key2;
cachedSelectedKeys.value = newSelectedKeys;
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData.value, newSelectedKeys, fieldNames.value);
} else if (multiple && shiftPick) {
newSelectedKeys = Array.from(/* @__PURE__ */ new Set([...cachedSelectedKeys.value || [], ...calcRangeKeys({
treeData: treeData.value,
expandedKeys: expandedKeys.value,
startKey: key2,
endKey: lastSelectedKey.value,
fieldNames: fieldNames.value
})]));
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData.value, newSelectedKeys, fieldNames.value);
} else {
newSelectedKeys = [key2];
lastSelectedKey.value = key2;
cachedSelectedKeys.value = newSelectedKeys;
newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData.value, newSelectedKeys, fieldNames.value);
}
emit("update:selectedKeys", newSelectedKeys);
emit("select", newSelectedKeys, newEvent);
if (props2.selectedKeys === void 0) {
selectedKeys.value = newSelectedKeys;
}
};
const onCheck = (checkedObjOrKeys, eventObj) => {
emit("update:checkedKeys", checkedObjOrKeys);
emit("check", checkedObjOrKeys, eventObj);
};
const {
prefixCls,
direction
} = useConfigInject("tree", props2);
return () => {
const connectClassName = classNames(`${prefixCls.value}-directory`, {
[`${prefixCls.value}-directory-rtl`]: direction.value === "rtl"
}, attrs.class);
const {
icon = slots.icon,
blockNode = true
} = props2, otherProps = __rest$c(props2, ["icon", "blockNode"]);
return createVNode(Tree$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), {}, {
"icon": icon || getIcon,
"ref": treeRef,
"blockNode": blockNode
}, otherProps), {}, {
"prefixCls": prefixCls.value,
"class": connectClassName,
"expandedKeys": expandedKeys.value,
"selectedKeys": selectedKeys.value,
"onSelect": onSelect,
"onClick": onClick,
"onDblclick": onDoubleClick,
"onExpand": onExpand,
"onCheck": onCheck
}), slots);
};
}
});
const TreeNode$1 = VcTreeNode;
const Tree = _extends(Tree$1, {
DirectoryTree,
TreeNode: TreeNode$1,
install: (app) => {
app.component(Tree$1.name, Tree$1);
app.component(TreeNode$1.name, TreeNode$1);
app.component(DirectoryTree.name, DirectoryTree);
return app;
}
});
function isEqual(obj1, obj2) {
let shallow = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
const refSet = /* @__PURE__ */ new Set();
function deepEqual(a, b) {
let level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
const circular = refSet.has(a);
warningOnce(!circular, "Warning: There may be circular references");
if (circular) {
return false;
}
if (a === b) {
return true;
}
if (shallow && level > 1) {
return false;
}
refSet.add(a);
const newLevel = level + 1;
if (Array.isArray(a)) {
if (!Array.isArray(b) || a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (!deepEqual(a[i], b[i], newLevel)) {
return false;
}
}
return true;
}
if (a && b && typeof a === "object" && typeof b === "object") {
const keys = Object.keys(a);
if (keys.length !== Object.keys(b).length) {
return false;
}
return keys.every((key2) => deepEqual(a[key2], b[key2], newLevel));
}
return false;
}
return deepEqual(obj1, obj2);
}
const {
SubMenu,
Item: MenuItem
} = Menu;
function hasSubMenu(filters) {
return filters.some((_ref) => {
let {
children
} = _ref;
return children && children.length > 0;
});
}
function searchValueMatched(searchValue, text) {
if (typeof text === "string" || typeof text === "number") {
return text === null || text === void 0 ? void 0 : text.toString().toLowerCase().includes(searchValue.trim().toLowerCase());
}
return false;
}
function renderFilterItems(_ref2) {
let {
filters,
prefixCls,
filteredKeys,
filterMultiple,
searchValue,
filterSearch
} = _ref2;
return filters.map((filter, index2) => {
const key2 = String(filter.value);
if (filter.children) {
return createVNode(SubMenu, {
"key": key2 || index2,
"title": filter.text,
"popupClassName": `${prefixCls}-dropdown-submenu`
}, {
default: () => [renderFilterItems({
filters: filter.children,
prefixCls,
filteredKeys,
filterMultiple,
searchValue,
filterSearch
})]
});
}
const Component = filterMultiple ? Checkbox : Radio;
const item = createVNode(MenuItem, {
"key": filter.value !== void 0 ? key2 : index2
}, {
default: () => [createVNode(Component, {
"checked": filteredKeys.includes(key2)
}, null), createVNode("span", null, [filter.text])]
});
if (searchValue.trim()) {
if (typeof filterSearch === "function") {
return filterSearch(searchValue, filter) ? item : void 0;
}
return searchValueMatched(searchValue, filter.text) ? item : void 0;
}
return item;
});
}
const FilterDropdown = defineComponent({
name: "FilterDropdown",
props: ["tablePrefixCls", "prefixCls", "dropdownPrefixCls", "column", "filterState", "filterMultiple", "filterMode", "filterSearch", "columnKey", "triggerFilter", "locale", "getPopupContainer"],
setup(props2, _ref3) {
let {
slots
} = _ref3;
const contextSlots = useInjectSlots();
const filterMode = computed(() => {
var _a;
return (_a = props2.filterMode) !== null && _a !== void 0 ? _a : "menu";
});
const filterSearch = computed(() => {
var _a;
return (_a = props2.filterSearch) !== null && _a !== void 0 ? _a : false;
});
const filterDropdownOpen = computed(() => props2.column.filterDropdownOpen || props2.column.filterDropdownVisible);
const onFilterDropdownOpenChange = computed(() => props2.column.onFilterDropdownOpenChange || props2.column.onFilterDropdownVisibleChange);
const visible = shallowRef(false);
const filtered = computed(() => {
var _a;
return !!(props2.filterState && (((_a = props2.filterState.filteredKeys) === null || _a === void 0 ? void 0 : _a.length) || props2.filterState.forceFiltered));
});
const filterFlattenKeys = computed(() => {
var _a;
return flattenKeys((_a = props2.column) === null || _a === void 0 ? void 0 : _a.filters);
});
const filterDropdownRef = computed(() => {
const {
filterDropdown,
slots: slots2 = {},
customFilterDropdown
} = props2.column;
return filterDropdown || slots2.filterDropdown && contextSlots.value[slots2.filterDropdown] || customFilterDropdown && contextSlots.value.customFilterDropdown;
});
const filterIconRef = computed(() => {
const {
filterIcon,
slots: slots2 = {}
} = props2.column;
return filterIcon || slots2.filterIcon && contextSlots.value[slots2.filterIcon] || contextSlots.value.customFilterIcon;
});
const triggerVisible = (newVisible) => {
var _a;
visible.value = newVisible;
(_a = onFilterDropdownOpenChange.value) === null || _a === void 0 ? void 0 : _a.call(onFilterDropdownOpenChange, newVisible);
};
const mergedVisible = computed(() => typeof filterDropdownOpen.value === "boolean" ? filterDropdownOpen.value : visible.value);
const propFilteredKeys = computed(() => {
var _a;
return (_a = props2.filterState) === null || _a === void 0 ? void 0 : _a.filteredKeys;
});
const filteredKeys = shallowRef([]);
const onSelectKeys = (_ref5) => {
let {
selectedKeys
} = _ref5;
filteredKeys.value = selectedKeys;
};
const onCheck = (keys, _ref6) => {
let {
node,
checked
} = _ref6;
if (!props2.filterMultiple) {
onSelectKeys({
selectedKeys: checked && node.key ? [node.key] : []
});
} else {
onSelectKeys({
selectedKeys: keys
});
}
};
watch(propFilteredKeys, () => {
if (!visible.value) {
return;
}
onSelectKeys({
selectedKeys: propFilteredKeys.value || []
});
}, {
immediate: true
});
const openKeys = shallowRef([]);
const openRef = shallowRef();
const onOpenChange = (keys) => {
openRef.value = setTimeout(() => {
openKeys.value = keys;
});
};
const onMenuClick = () => {
clearTimeout(openRef.value);
};
const searchValue = shallowRef("");
const onSearch = (e) => {
const {
value
} = e.target;
searchValue.value = value;
};
watch(visible, () => {
if (!visible.value) {
searchValue.value = "";
}
});
const internalTriggerFilter = (keys) => {
const {
column,
columnKey,
filterState
} = props2;
const mergedKeys = keys && keys.length ? keys : null;
if (mergedKeys === null && (!filterState || !filterState.filteredKeys)) {
return null;
}
if (isEqual(mergedKeys, filterState === null || filterState === void 0 ? void 0 : filterState.filteredKeys, true)) {
return null;
}
props2.triggerFilter({
column,
key: columnKey,
filteredKeys: mergedKeys
});
};
const onConfirm = () => {
triggerVisible(false);
internalTriggerFilter(filteredKeys.value);
};
const onReset = function() {
let {
confirm: confirm2,
closeDropdown
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
confirm: false,
closeDropdown: false
};
if (confirm2) {
internalTriggerFilter([]);
}
if (closeDropdown) {
triggerVisible(false);
}
searchValue.value = "";
if (props2.column.filterResetToDefaultFilteredValue) {
filteredKeys.value = (props2.column.defaultFilteredValue || []).map((key2) => String(key2));
} else {
filteredKeys.value = [];
}
};
const doFilter = function() {
let {
closeDropdown
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
closeDropdown: true
};
if (closeDropdown) {
triggerVisible(false);
}
internalTriggerFilter(filteredKeys.value);
};
const onVisibleChange = (newVisible) => {
if (newVisible && propFilteredKeys.value !== void 0) {
filteredKeys.value = propFilteredKeys.value || [];
}
triggerVisible(newVisible);
if (!newVisible && !filterDropdownRef.value) {
onConfirm();
}
};
const {
direction
} = useConfigInject("", props2);
const onCheckAll = (e) => {
if (e.target.checked) {
const allFilterKeys = filterFlattenKeys.value;
filteredKeys.value = allFilterKeys;
} else {
filteredKeys.value = [];
}
};
const getTreeData = (_ref7) => {
let {
filters
} = _ref7;
return (filters || []).map((filter, index2) => {
const key2 = String(filter.value);
const item = {
title: filter.text,
key: filter.value !== void 0 ? key2 : index2
};
if (filter.children) {
item.children = getTreeData({
filters: filter.children
});
}
return item;
});
};
const getFilterData2 = (node) => {
var _a;
return _extends(_extends({}, node), {
text: node.title,
value: node.key,
children: ((_a = node.children) === null || _a === void 0 ? void 0 : _a.map((item) => getFilterData2(item))) || []
});
};
const treeData = computed(() => getTreeData({
filters: props2.column.filters
}));
const dropdownMenuClass = computed(() => classNames({
[`${props2.dropdownPrefixCls}-menu-without-submenu`]: !hasSubMenu(props2.column.filters || [])
}));
const getFilterComponent = () => {
const selectedKeys = filteredKeys.value;
const {
column,
locale: locale2,
tablePrefixCls,
filterMultiple,
dropdownPrefixCls,
getPopupContainer,
prefixCls
} = props2;
if ((column.filters || []).length === 0) {
return createVNode(Empty$1, {
"image": Empty$1.PRESENTED_IMAGE_SIMPLE,
"description": locale2.filterEmptyText,
"imageStyle": {
height: 24
},
"style": {
margin: 0,
padding: "16px 0"
}
}, null);
}
if (filterMode.value === "tree") {
return createVNode(Fragment, null, [createVNode(FilterSearch, {
"filterSearch": filterSearch.value,
"value": searchValue.value,
"onChange": onSearch,
"tablePrefixCls": tablePrefixCls,
"locale": locale2
}, null), createVNode("div", {
"class": `${tablePrefixCls}-filter-dropdown-tree`
}, [filterMultiple ? createVNode(Checkbox, {
"class": `${tablePrefixCls}-filter-dropdown-checkall`,
"onChange": onCheckAll,
"checked": selectedKeys.length === filterFlattenKeys.value.length,
"indeterminate": selectedKeys.length > 0 && selectedKeys.length < filterFlattenKeys.value.length
}, {
default: () => [locale2.filterCheckall]
}) : null, createVNode(Tree, {
"checkable": true,
"selectable": false,
"blockNode": true,
"multiple": filterMultiple,
"checkStrictly": !filterMultiple,
"class": `${dropdownPrefixCls}-menu`,
"onCheck": onCheck,
"checkedKeys": selectedKeys,
"selectedKeys": selectedKeys,
"showIcon": false,
"treeData": treeData.value,
"autoExpandParent": true,
"defaultExpandAll": true,
"filterTreeNode": searchValue.value.trim() ? (node) => {
if (typeof filterSearch.value === "function") {
return filterSearch.value(searchValue.value, getFilterData2(node));
}
return searchValueMatched(searchValue.value, node.title);
} : void 0
}, null)])]);
}
return createVNode(Fragment, null, [createVNode(FilterSearch, {
"filterSearch": filterSearch.value,
"value": searchValue.value,
"onChange": onSearch,
"tablePrefixCls": tablePrefixCls,
"locale": locale2
}, null), createVNode(Menu, {
"multiple": filterMultiple,
"prefixCls": `${dropdownPrefixCls}-menu`,
"class": dropdownMenuClass.value,
"onClick": onMenuClick,
"onSelect": onSelectKeys,
"onDeselect": onSelectKeys,
"selectedKeys": selectedKeys,
"getPopupContainer": getPopupContainer,
"openKeys": openKeys.value,
"onOpenChange": onOpenChange
}, {
default: () => renderFilterItems({
filters: column.filters || [],
filterSearch: filterSearch.value,
prefixCls,
filteredKeys: filteredKeys.value,
filterMultiple,
searchValue: searchValue.value
})
})]);
};
const resetDisabled = computed(() => {
const selectedKeys = filteredKeys.value;
if (props2.column.filterResetToDefaultFilteredValue) {
return isEqual((props2.column.defaultFilteredValue || []).map((key2) => String(key2)), selectedKeys, true);
}
return selectedKeys.length === 0;
});
return () => {
var _a;
const {
tablePrefixCls,
prefixCls,
column,
dropdownPrefixCls,
locale: locale2,
getPopupContainer
} = props2;
let dropdownContent;
if (typeof filterDropdownRef.value === "function") {
dropdownContent = filterDropdownRef.value({
prefixCls: `${dropdownPrefixCls}-custom`,
setSelectedKeys: (selectedKeys) => onSelectKeys({
selectedKeys
}),
selectedKeys: filteredKeys.value,
confirm: doFilter,
clearFilters: onReset,
filters: column.filters,
visible: mergedVisible.value,
column: column.__originColumn__,
close: () => {
triggerVisible(false);
}
});
} else if (filterDropdownRef.value) {
dropdownContent = filterDropdownRef.value;
} else {
dropdownContent = createVNode(Fragment, null, [getFilterComponent(), createVNode("div", {
"class": `${prefixCls}-dropdown-btns`
}, [createVNode(Button, {
"type": "link",
"size": "small",
"disabled": resetDisabled.value,
"onClick": () => onReset()
}, {
default: () => [locale2.filterReset]
}), createVNode(Button, {
"type": "primary",
"size": "small",
"onClick": onConfirm
}, {
default: () => [locale2.filterConfirm]
})])]);
}
const menu = createVNode(FilterDropdownMenuWrapper, {
"class": `${prefixCls}-dropdown`
}, {
default: () => [dropdownContent]
});
let filterIcon;
if (typeof filterIconRef.value === "function") {
filterIcon = filterIconRef.value({
filtered: filtered.value,
column: column.__originColumn__
});
} else if (filterIconRef.value) {
filterIcon = filterIconRef.value;
} else {
filterIcon = createVNode(FilterFilled, null, null);
}
return createVNode("div", {
"class": `${prefixCls}-column`
}, [createVNode("span", {
"class": `${tablePrefixCls}-column-title`
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]), createVNode(Dropdown, {
"overlay": menu,
"trigger": ["click"],
"open": mergedVisible.value,
"onOpenChange": onVisibleChange,
"getPopupContainer": getPopupContainer,
"placement": direction.value === "rtl" ? "bottomLeft" : "bottomRight"
}, {
default: () => [createVNode("span", {
"role": "button",
"tabindex": -1,
"class": classNames(`${prefixCls}-trigger`, {
active: filtered.value
}),
"onClick": (e) => {
e.stopPropagation();
}
}, [filterIcon])]
})]);
};
}
});
function collectFilterStates(columns, init, pos) {
let filterStates = [];
(columns || []).forEach((column, index2) => {
var _a, _b;
const columnPos = getColumnPos(index2, pos);
const hasFilterDropdown = column.filterDropdown || ((_a = column === null || column === void 0 ? void 0 : column.slots) === null || _a === void 0 ? void 0 : _a.filterDropdown) || column.customFilterDropdown;
if (column.filters || hasFilterDropdown || "onFilter" in column) {
if ("filteredValue" in column) {
let filteredValues = column.filteredValue;
if (!hasFilterDropdown) {
filteredValues = (_b = filteredValues === null || filteredValues === void 0 ? void 0 : filteredValues.map(String)) !== null && _b !== void 0 ? _b : filteredValues;
}
filterStates.push({
column,
key: getColumnKey(column, columnPos),
filteredKeys: filteredValues,
forceFiltered: column.filtered
});
} else {
filterStates.push({
column,
key: getColumnKey(column, columnPos),
filteredKeys: init && column.defaultFilteredValue ? column.defaultFilteredValue : void 0,
forceFiltered: column.filtered
});
}
}
if ("children" in column) {
filterStates = [...filterStates, ...collectFilterStates(column.children, init, columnPos)];
}
});
return filterStates;
}
function injectFilter(prefixCls, dropdownPrefixCls, columns, filterStates, locale2, triggerFilter, getPopupContainer, pos) {
return columns.map((column, index2) => {
var _a;
const columnPos = getColumnPos(index2, pos);
const {
filterMultiple = true,
filterMode,
filterSearch
} = column;
let newColumn = column;
const hasFilterDropdown = column.filterDropdown || ((_a = column === null || column === void 0 ? void 0 : column.slots) === null || _a === void 0 ? void 0 : _a.filterDropdown) || column.customFilterDropdown;
if (newColumn.filters || hasFilterDropdown) {
const columnKey = getColumnKey(newColumn, columnPos);
const filterState = filterStates.find((_ref) => {
let {
key: key2
} = _ref;
return columnKey === key2;
});
newColumn = _extends(_extends({}, newColumn), {
title: (renderProps) => createVNode(FilterDropdown, {
"tablePrefixCls": prefixCls,
"prefixCls": `${prefixCls}-filter`,
"dropdownPrefixCls": dropdownPrefixCls,
"column": newColumn,
"columnKey": columnKey,
"filterState": filterState,
"filterMultiple": filterMultiple,
"filterMode": filterMode,
"filterSearch": filterSearch,
"triggerFilter": triggerFilter,
"locale": locale2,
"getPopupContainer": getPopupContainer
}, {
default: () => [renderColumnTitle(column.title, renderProps)]
})
});
}
if ("children" in newColumn) {
newColumn = _extends(_extends({}, newColumn), {
children: injectFilter(prefixCls, dropdownPrefixCls, newColumn.children, filterStates, locale2, triggerFilter, getPopupContainer, columnPos)
});
}
return newColumn;
});
}
function flattenKeys(filters) {
let keys = [];
(filters || []).forEach((_ref2) => {
let {
value,
children
} = _ref2;
keys.push(value);
if (children) {
keys = [...keys, ...flattenKeys(children)];
}
});
return keys;
}
function generateFilterInfo(filterStates) {
const currentFilters = {};
filterStates.forEach((_ref3) => {
let {
key: key2,
filteredKeys,
column
} = _ref3;
var _a;
const hasFilterDropdown = column.filterDropdown || ((_a = column === null || column === void 0 ? void 0 : column.slots) === null || _a === void 0 ? void 0 : _a.filterDropdown) || column.customFilterDropdown;
const {
filters
} = column;
if (hasFilterDropdown) {
currentFilters[key2] = filteredKeys || null;
} else if (Array.isArray(filteredKeys)) {
const keys = flattenKeys(filters);
currentFilters[key2] = keys.filter((originKey) => filteredKeys.includes(String(originKey)));
} else {
currentFilters[key2] = null;
}
});
return currentFilters;
}
function getFilterData(data, filterStates) {
return filterStates.reduce((currentData, filterState) => {
const {
column: {
onFilter,
filters
},
filteredKeys
} = filterState;
if (onFilter && filteredKeys && filteredKeys.length) {
return currentData.filter((record) => filteredKeys.some((key2) => {
const keys = flattenKeys(filters);
const keyIndex2 = keys.findIndex((k) => String(k) === String(key2));
const realKey = keyIndex2 !== -1 ? keys[keyIndex2] : key2;
return onFilter(realKey, record);
}));
}
return currentData;
}, data);
}
function getMergedColumns(rawMergedColumns) {
return rawMergedColumns.flatMap((column) => {
if ("children" in column) {
return [column, ...getMergedColumns(column.children || [])];
}
return [column];
});
}
function useFilter(_ref4) {
let {
prefixCls,
dropdownPrefixCls,
mergedColumns: rawMergedColumns,
locale: locale2,
onFilterChange,
getPopupContainer
} = _ref4;
const mergedColumns = computed(() => getMergedColumns(rawMergedColumns.value));
const [filterStates, setFilterStates] = useState$1(collectFilterStates(mergedColumns.value, true));
const mergedFilterStates = computed(() => {
const collectedStates = collectFilterStates(mergedColumns.value, false);
if (collectedStates.length === 0) {
return collectedStates;
}
let filteredKeysIsAllNotControlled = true;
let filteredKeysIsAllControlled = true;
collectedStates.forEach((_ref5) => {
let {
filteredKeys
} = _ref5;
if (filteredKeys !== void 0) {
filteredKeysIsAllNotControlled = false;
} else {
filteredKeysIsAllControlled = false;
}
});
if (filteredKeysIsAllNotControlled) {
const keyList = (mergedColumns.value || []).map((column, index2) => getColumnKey(column, getColumnPos(index2)));
return filterStates.value.filter((_ref6) => {
let {
key: key2
} = _ref6;
return keyList.includes(key2);
}).map((item) => {
const col = mergedColumns.value[keyList.findIndex((key2) => key2 === item.key)];
return _extends(_extends({}, item), {
column: _extends(_extends({}, item.column), col),
forceFiltered: col.filtered
});
});
}
devWarning(filteredKeysIsAllControlled, "Table", "Columns should all contain `filteredValue` or not contain `filteredValue`.");
return collectedStates;
});
const filters = computed(() => generateFilterInfo(mergedFilterStates.value));
const triggerFilter = (filterState) => {
const newFilterStates = mergedFilterStates.value.filter((_ref7) => {
let {
key: key2
} = _ref7;
return key2 !== filterState.key;
});
newFilterStates.push(filterState);
setFilterStates(newFilterStates);
onFilterChange(generateFilterInfo(newFilterStates), newFilterStates);
};
const transformColumns = (innerColumns) => {
return injectFilter(prefixCls.value, dropdownPrefixCls.value, innerColumns, mergedFilterStates.value, locale2.value, triggerFilter, getPopupContainer.value);
};
return [transformColumns, mergedFilterStates, filters];
}
function fillTitle(columns, columnTitleProps) {
return columns.map((column) => {
const cloneColumn = _extends({}, column);
cloneColumn.title = renderColumnTitle(cloneColumn.title, columnTitleProps);
if ("children" in cloneColumn) {
cloneColumn.children = fillTitle(cloneColumn.children, columnTitleProps);
}
return cloneColumn;
});
}
function useTitleColumns(columnTitleProps) {
const filledColumns = (columns) => fillTitle(columns, columnTitleProps.value);
return [filledColumns];
}
function renderExpandIcon(locale2) {
return function expandIcon(_ref) {
let {
prefixCls,
onExpand,
record,
expanded,
expandable
} = _ref;
const iconPrefix = `${prefixCls}-row-expand-icon`;
return createVNode("button", {
"type": "button",
"onClick": (e) => {
onExpand(record, e);
e.stopPropagation();
},
"class": classNames(iconPrefix, {
[`${iconPrefix}-spaced`]: !expandable,
[`${iconPrefix}-expanded`]: expandable && expanded,
[`${iconPrefix}-collapsed`]: expandable && !expanded
}),
"aria-label": expanded ? locale2.collapse : locale2.expand,
"aria-expanded": expanded
}, null);
};
}
function fillSlots(columns, contextSlots) {
const $slots = contextSlots.value;
return columns.map((column) => {
var _a;
if (column === SELECTION_COLUMN || column === EXPAND_COLUMN) return column;
const cloneColumn = _extends({}, column);
const {
slots = {}
} = cloneColumn;
cloneColumn.__originColumn__ = column;
devWarning(!("slots" in cloneColumn), "Table", "`column.slots` is deprecated. Please use `v-slot:headerCell` `v-slot:bodyCell` instead.");
Object.keys(slots).forEach((key2) => {
const name = slots[key2];
if (cloneColumn[key2] === void 0 && $slots[name]) {
cloneColumn[key2] = $slots[name];
}
});
if (contextSlots.value.headerCell && !((_a = column.slots) === null || _a === void 0 ? void 0 : _a.title)) {
cloneColumn.title = customRenderSlot(contextSlots.value, "headerCell", {
title: column.title,
column
}, () => [column.title]);
}
if ("children" in cloneColumn && Array.isArray(cloneColumn.children)) {
cloneColumn.children = fillSlots(cloneColumn.children, contextSlots);
}
return cloneColumn;
});
}
function useColumns(contextSlots) {
const filledColumns = (columns) => fillSlots(columns, contextSlots);
return [filledColumns];
}
const genBorderedStyle = (token) => {
const {
componentCls
} = token;
const tableBorder = `${token.lineWidth}px ${token.lineType} ${token.tableBorderColor}`;
const getSizeBorderStyle = (size, paddingVertical, paddingHorizontal) => ({
[`&${componentCls}-${size}`]: {
[`> ${componentCls}-container`]: {
[`> ${componentCls}-content, > ${componentCls}-body`]: {
"> table > tbody > tr > td": {
[`> ${componentCls}-expanded-row-fixed`]: {
margin: `-${paddingVertical}px -${paddingHorizontal + token.lineWidth}px`
}
}
}
}
}
});
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}${componentCls}-bordered`]: _extends(_extends(_extends({
// ============================ Title =============================
[`> ${componentCls}-title`]: {
border: tableBorder,
borderBottom: 0
},
// ============================ Content ============================
[`> ${componentCls}-container`]: {
borderInlineStart: tableBorder,
[`
> ${componentCls}-content,
> ${componentCls}-header,
> ${componentCls}-body,
> ${componentCls}-summary
`]: {
"> table": {
// ============================= Cell =============================
[`
> thead > tr > th,
> tbody > tr > td,
> tfoot > tr > th,
> tfoot > tr > td
`]: {
borderInlineEnd: tableBorder
},
// ============================ Header ============================
"> thead": {
"> tr:not(:last-child) > th": {
borderBottom: tableBorder
},
"> tr > th::before": {
backgroundColor: "transparent !important"
}
},
// Fixed right should provides additional border
[`
> thead > tr,
> tbody > tr,
> tfoot > tr
`]: {
[`> ${componentCls}-cell-fix-right-first::after`]: {
borderInlineEnd: tableBorder
}
},
// ========================== Expandable ==========================
"> tbody > tr > td": {
[`> ${componentCls}-expanded-row-fixed`]: {
margin: `-${token.tablePaddingVertical}px -${token.tablePaddingHorizontal + token.lineWidth}px`,
"&::after": {
position: "absolute",
top: 0,
insetInlineEnd: token.lineWidth,
bottom: 0,
borderInlineEnd: tableBorder,
content: '""'
}
}
}
}
},
[`
> ${componentCls}-content,
> ${componentCls}-header
`]: {
"> table": {
borderTop: tableBorder
}
}
},
// ============================ Scroll ============================
[`&${componentCls}-scroll-horizontal`]: {
[`> ${componentCls}-container > ${componentCls}-body`]: {
"> table > tbody": {
[`
> tr${componentCls}-expanded-row,
> tr${componentCls}-placeholder
`]: {
"> td": {
borderInlineEnd: 0
}
}
}
}
}
}, getSizeBorderStyle("middle", token.tablePaddingVerticalMiddle, token.tablePaddingHorizontalMiddle)), getSizeBorderStyle("small", token.tablePaddingVerticalSmall, token.tablePaddingHorizontalSmall)), {
// ============================ Footer ============================
[`> ${componentCls}-footer`]: {
border: tableBorder,
borderTop: 0
}
}),
// ============================ Nested ============================
[`${componentCls}-cell`]: {
[`${componentCls}-container:first-child`]: {
// :first-child to avoid the case when bordered and title is set
borderTop: 0
},
// https://github.com/ant-design/ant-design/issues/35577
"&-scrollbar:not([rowspan])": {
boxShadow: `0 ${token.lineWidth}px 0 ${token.lineWidth}px ${token.tableHeaderBg}`
}
}
}
};
};
const genEllipsisStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-cell-ellipsis`]: _extends(_extends({}, textEllipsis), {
wordBreak: "keep-all",
// Fixed first or last should special process
[`
&${componentCls}-cell-fix-left-last,
&${componentCls}-cell-fix-right-first
`]: {
overflow: "visible",
[`${componentCls}-cell-content`]: {
display: "block",
overflow: "hidden",
textOverflow: "ellipsis"
}
},
[`${componentCls}-column-title`]: {
overflow: "hidden",
textOverflow: "ellipsis",
wordBreak: "keep-all"
}
})
}
};
};
const genEmptyStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-tbody > tr${componentCls}-placeholder`]: {
textAlign: "center",
color: token.colorTextDisabled,
"&:hover > td": {
background: token.colorBgContainer
}
}
}
};
};
const genExpandStyle = (token) => {
const {
componentCls,
antCls,
controlInteractiveSize: checkboxSize,
motionDurationSlow,
lineWidth,
paddingXS,
lineType,
tableBorderColor,
tableExpandIconBg,
tableExpandColumnWidth,
borderRadius,
fontSize,
fontSizeSM,
lineHeight,
tablePaddingVertical,
tablePaddingHorizontal,
tableExpandedRowBg,
paddingXXS
} = token;
const halfInnerSize = checkboxSize / 2 - lineWidth;
const expandIconSize = halfInnerSize * 2 + lineWidth * 3;
const tableBorder = `${lineWidth}px ${lineType} ${tableBorderColor}`;
const expandIconLineOffset = paddingXXS - lineWidth;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-expand-icon-col`]: {
width: tableExpandColumnWidth
},
[`${componentCls}-row-expand-icon-cell`]: {
textAlign: "center",
[`${componentCls}-row-expand-icon`]: {
display: "inline-flex",
float: "none",
verticalAlign: "sub"
}
},
[`${componentCls}-row-indent`]: {
height: 1,
float: "left"
},
[`${componentCls}-row-expand-icon`]: _extends(_extends({}, operationUnit(token)), {
position: "relative",
float: "left",
boxSizing: "border-box",
width: expandIconSize,
height: expandIconSize,
padding: 0,
color: "inherit",
lineHeight: `${expandIconSize}px`,
background: tableExpandIconBg,
border: tableBorder,
borderRadius,
transform: `scale(${checkboxSize / expandIconSize})`,
transition: `all ${motionDurationSlow}`,
userSelect: "none",
[`&:focus, &:hover, &:active`]: {
borderColor: "currentcolor"
},
[`&::before, &::after`]: {
position: "absolute",
background: "currentcolor",
transition: `transform ${motionDurationSlow} ease-out`,
content: '""'
},
"&::before": {
top: halfInnerSize,
insetInlineEnd: expandIconLineOffset,
insetInlineStart: expandIconLineOffset,
height: lineWidth
},
"&::after": {
top: expandIconLineOffset,
bottom: expandIconLineOffset,
insetInlineStart: halfInnerSize,
width: lineWidth,
transform: "rotate(90deg)"
},
// Motion effect
"&-collapsed::before": {
transform: "rotate(-180deg)"
},
"&-collapsed::after": {
transform: "rotate(0deg)"
},
"&-spaced": {
"&::before, &::after": {
display: "none",
content: "none"
},
background: "transparent",
border: 0,
visibility: "hidden"
}
}),
[`${componentCls}-row-indent + ${componentCls}-row-expand-icon`]: {
marginTop: (fontSize * lineHeight - lineWidth * 3) / 2 - Math.ceil((fontSizeSM * 1.4 - lineWidth * 3) / 2),
marginInlineEnd: paddingXS
},
[`tr${componentCls}-expanded-row`]: {
"&, &:hover": {
"> td": {
background: tableExpandedRowBg
}
},
// https://github.com/ant-design/ant-design/issues/25573
[`${antCls}-descriptions-view`]: {
display: "flex",
table: {
flex: "auto",
width: "auto"
}
}
},
// With fixed
[`${componentCls}-expanded-row-fixed`]: {
position: "relative",
margin: `-${tablePaddingVertical}px -${tablePaddingHorizontal}px`,
padding: `${tablePaddingVertical}px ${tablePaddingHorizontal}px`
}
}
};
};
const genFilterStyle = (token) => {
const {
componentCls,
antCls,
iconCls,
tableFilterDropdownWidth,
tableFilterDropdownSearchWidth,
paddingXXS,
paddingXS,
colorText,
lineWidth,
lineType,
tableBorderColor,
tableHeaderIconColor,
fontSizeSM,
tablePaddingHorizontal,
borderRadius,
motionDurationSlow,
colorTextDescription,
colorPrimary,
tableHeaderFilterActiveBg,
colorTextDisabled,
tableFilterDropdownBg,
tableFilterDropdownHeight,
controlItemBgHover,
controlItemBgActive,
boxShadowSecondary
} = token;
const dropdownPrefixCls = `${antCls}-dropdown`;
const tableFilterDropdownPrefixCls = `${componentCls}-filter-dropdown`;
const treePrefixCls = `${antCls}-tree`;
const tableBorder = `${lineWidth}px ${lineType} ${tableBorderColor}`;
return [
{
[`${componentCls}-wrapper`]: {
[`${componentCls}-filter-column`]: {
display: "flex",
justifyContent: "space-between"
},
[`${componentCls}-filter-trigger`]: {
position: "relative",
display: "flex",
alignItems: "center",
marginBlock: -paddingXXS,
marginInline: `${paddingXXS}px ${-tablePaddingHorizontal / 2}px`,
padding: `0 ${paddingXXS}px`,
color: tableHeaderIconColor,
fontSize: fontSizeSM,
borderRadius,
cursor: "pointer",
transition: `all ${motionDurationSlow}`,
"&:hover": {
color: colorTextDescription,
background: tableHeaderFilterActiveBg
},
"&.active": {
color: colorPrimary
}
}
}
},
{
// Dropdown
[`${antCls}-dropdown`]: {
[tableFilterDropdownPrefixCls]: _extends(_extends({}, resetComponent(token)), {
minWidth: tableFilterDropdownWidth,
backgroundColor: tableFilterDropdownBg,
borderRadius,
boxShadow: boxShadowSecondary,
// Reset menu
[`${dropdownPrefixCls}-menu`]: {
// https://github.com/ant-design/ant-design/issues/4916
// https://github.com/ant-design/ant-design/issues/19542
maxHeight: tableFilterDropdownHeight,
overflowX: "hidden",
border: 0,
boxShadow: "none",
"&:empty::after": {
display: "block",
padding: `${paddingXS}px 0`,
color: colorTextDisabled,
fontSize: fontSizeSM,
textAlign: "center",
content: '"Not Found"'
}
},
[`${tableFilterDropdownPrefixCls}-tree`]: {
paddingBlock: `${paddingXS}px 0`,
paddingInline: paddingXS,
[treePrefixCls]: {
padding: 0
},
[`${treePrefixCls}-treenode ${treePrefixCls}-node-content-wrapper:hover`]: {
backgroundColor: controlItemBgHover
},
[`${treePrefixCls}-treenode-checkbox-checked ${treePrefixCls}-node-content-wrapper`]: {
"&, &:hover": {
backgroundColor: controlItemBgActive
}
}
},
[`${tableFilterDropdownPrefixCls}-search`]: {
padding: paddingXS,
borderBottom: tableBorder,
"&-input": {
input: {
minWidth: tableFilterDropdownSearchWidth
},
[iconCls]: {
color: colorTextDisabled
}
}
},
[`${tableFilterDropdownPrefixCls}-checkall`]: {
width: "100%",
marginBottom: paddingXXS,
marginInlineStart: paddingXXS
},
// Operation
[`${tableFilterDropdownPrefixCls}-btns`]: {
display: "flex",
justifyContent: "space-between",
padding: `${paddingXS - lineWidth}px ${paddingXS}px`,
overflow: "hidden",
backgroundColor: "inherit",
borderTop: tableBorder
}
})
}
},
// Dropdown Menu & SubMenu
{
// submenu of table filter dropdown
[`${antCls}-dropdown ${tableFilterDropdownPrefixCls}, ${tableFilterDropdownPrefixCls}-submenu`]: {
// Checkbox
[`${antCls}-checkbox-wrapper + span`]: {
paddingInlineStart: paddingXS,
color: colorText
},
[`> ul`]: {
maxHeight: "calc(100vh - 130px)",
overflowX: "hidden",
overflowY: "auto"
}
}
}
];
};
const genFixedStyle = (token) => {
const {
componentCls,
lineWidth,
colorSplit,
motionDurationSlow,
zIndexTableFixed,
tableBg,
zIndexTableSticky
} = token;
const shadowColor = colorSplit;
return {
[`${componentCls}-wrapper`]: {
[`
${componentCls}-cell-fix-left,
${componentCls}-cell-fix-right
`]: {
position: "sticky !important",
zIndex: zIndexTableFixed,
background: tableBg
},
[`
${componentCls}-cell-fix-left-first::after,
${componentCls}-cell-fix-left-last::after
`]: {
position: "absolute",
top: 0,
right: {
_skip_check_: true,
value: 0
},
bottom: -lineWidth,
width: 30,
transform: "translateX(100%)",
transition: `box-shadow ${motionDurationSlow}`,
content: '""',
pointerEvents: "none"
},
[`${componentCls}-cell-fix-left-all::after`]: {
display: "none"
},
[`
${componentCls}-cell-fix-right-first::after,
${componentCls}-cell-fix-right-last::after
`]: {
position: "absolute",
top: 0,
bottom: -lineWidth,
left: {
_skip_check_: true,
value: 0
},
width: 30,
transform: "translateX(-100%)",
transition: `box-shadow ${motionDurationSlow}`,
content: '""',
pointerEvents: "none"
},
[`${componentCls}-container`]: {
"&::before, &::after": {
position: "absolute",
top: 0,
bottom: 0,
zIndex: zIndexTableSticky + 1,
width: 30,
transition: `box-shadow ${motionDurationSlow}`,
content: '""',
pointerEvents: "none"
},
"&::before": {
insetInlineStart: 0
},
"&::after": {
insetInlineEnd: 0
}
},
[`${componentCls}-ping-left`]: {
[`&:not(${componentCls}-has-fix-left) ${componentCls}-container`]: {
position: "relative",
"&::before": {
boxShadow: `inset 10px 0 8px -8px ${shadowColor}`
}
},
[`
${componentCls}-cell-fix-left-first::after,
${componentCls}-cell-fix-left-last::after
`]: {
boxShadow: `inset 10px 0 8px -8px ${shadowColor}`
},
[`${componentCls}-cell-fix-left-last::before`]: {
backgroundColor: "transparent !important"
}
},
[`${componentCls}-ping-right`]: {
[`&:not(${componentCls}-has-fix-right) ${componentCls}-container`]: {
position: "relative",
"&::after": {
boxShadow: `inset -10px 0 8px -8px ${shadowColor}`
}
},
[`
${componentCls}-cell-fix-right-first::after,
${componentCls}-cell-fix-right-last::after
`]: {
boxShadow: `inset -10px 0 8px -8px ${shadowColor}`
}
}
}
};
};
const genPaginationStyle = (token) => {
const {
componentCls,
antCls
} = token;
return {
[`${componentCls}-wrapper`]: {
// ========================== Pagination ==========================
[`${componentCls}-pagination${antCls}-pagination`]: {
margin: `${token.margin}px 0`
},
[`${componentCls}-pagination`]: {
display: "flex",
flexWrap: "wrap",
rowGap: token.paddingXS,
"> *": {
flex: "none"
},
"&-left": {
justifyContent: "flex-start"
},
"&-center": {
justifyContent: "center"
},
"&-right": {
justifyContent: "flex-end"
}
}
}
};
};
const genRadiusStyle = (token) => {
const {
componentCls,
tableRadius
} = token;
return {
[`${componentCls}-wrapper`]: {
[componentCls]: {
// https://github.com/ant-design/ant-design/issues/39115#issuecomment-1362314574
[`${componentCls}-title, ${componentCls}-header`]: {
borderRadius: `${tableRadius}px ${tableRadius}px 0 0`
},
[`${componentCls}-title + ${componentCls}-container`]: {
borderStartStartRadius: 0,
borderStartEndRadius: 0,
table: {
borderRadius: 0,
"> thead > tr:first-child": {
"th:first-child": {
borderRadius: 0
},
"th:last-child": {
borderRadius: 0
}
}
}
},
"&-container": {
borderStartStartRadius: tableRadius,
borderStartEndRadius: tableRadius,
"table > thead > tr:first-child": {
"> *:first-child": {
borderStartStartRadius: tableRadius
},
"> *:last-child": {
borderStartEndRadius: tableRadius
}
}
},
"&-footer": {
borderRadius: `0 0 ${tableRadius}px ${tableRadius}px`
}
}
}
};
};
const genStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-wrapper-rtl`]: {
direction: "rtl",
table: {
direction: "rtl"
},
[`${componentCls}-pagination-left`]: {
justifyContent: "flex-end"
},
[`${componentCls}-pagination-right`]: {
justifyContent: "flex-start"
},
[`${componentCls}-row-expand-icon`]: {
"&::after": {
transform: "rotate(-90deg)"
},
"&-collapsed::before": {
transform: "rotate(180deg)"
},
"&-collapsed::after": {
transform: "rotate(0deg)"
}
}
}
};
};
const genSelectionStyle = (token) => {
const {
componentCls,
antCls,
iconCls,
fontSizeIcon,
paddingXS,
tableHeaderIconColor,
tableHeaderIconColorHover
} = token;
return {
[`${componentCls}-wrapper`]: {
// ========================== Selections ==========================
[`${componentCls}-selection-col`]: {
width: token.tableSelectionColumnWidth
},
[`${componentCls}-bordered ${componentCls}-selection-col`]: {
width: token.tableSelectionColumnWidth + paddingXS * 2
},
[`
table tr th${componentCls}-selection-column,
table tr td${componentCls}-selection-column
`]: {
paddingInlineEnd: token.paddingXS,
paddingInlineStart: token.paddingXS,
textAlign: "center",
[`${antCls}-radio-wrapper`]: {
marginInlineEnd: 0
}
},
[`table tr th${componentCls}-selection-column${componentCls}-cell-fix-left`]: {
zIndex: token.zIndexTableFixed + 1
},
[`table tr th${componentCls}-selection-column::after`]: {
backgroundColor: "transparent !important"
},
[`${componentCls}-selection`]: {
position: "relative",
display: "inline-flex",
flexDirection: "column"
},
[`${componentCls}-selection-extra`]: {
position: "absolute",
top: 0,
zIndex: 1,
cursor: "pointer",
transition: `all ${token.motionDurationSlow}`,
marginInlineStart: "100%",
paddingInlineStart: `${token.tablePaddingHorizontal / 4}px`,
[iconCls]: {
color: tableHeaderIconColor,
fontSize: fontSizeIcon,
verticalAlign: "baseline",
"&:hover": {
color: tableHeaderIconColorHover
}
}
}
}
};
};
const genSizeStyle = (token) => {
const {
componentCls
} = token;
const getSizeStyle = (size, paddingVertical, paddingHorizontal, fontSize) => ({
[`${componentCls}${componentCls}-${size}`]: {
fontSize,
[`
${componentCls}-title,
${componentCls}-footer,
${componentCls}-thead > tr > th,
${componentCls}-tbody > tr > td,
tfoot > tr > th,
tfoot > tr > td
`]: {
padding: `${paddingVertical}px ${paddingHorizontal}px`
},
[`${componentCls}-filter-trigger`]: {
marginInlineEnd: `-${paddingHorizontal / 2}px`
},
[`${componentCls}-expanded-row-fixed`]: {
margin: `-${paddingVertical}px -${paddingHorizontal}px`
},
[`${componentCls}-tbody`]: {
// ========================= Nest Table ===========================
[`${componentCls}-wrapper:only-child ${componentCls}`]: {
marginBlock: `-${paddingVertical}px`,
marginInline: `${token.tableExpandColumnWidth - paddingHorizontal}px -${paddingHorizontal}px`
}
},
// https://github.com/ant-design/ant-design/issues/35167
[`${componentCls}-selection-column`]: {
paddingInlineStart: `${paddingHorizontal / 4}px`
}
}
});
return {
[`${componentCls}-wrapper`]: _extends(_extends({}, getSizeStyle("middle", token.tablePaddingVerticalMiddle, token.tablePaddingHorizontalMiddle, token.tableFontSizeMiddle)), getSizeStyle("small", token.tablePaddingVerticalSmall, token.tablePaddingHorizontalSmall, token.tableFontSizeSmall))
};
};
const genResizeStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-wrapper ${componentCls}-resize-handle`]: {
position: "absolute",
top: 0,
height: "100% !important",
bottom: 0,
left: " auto !important",
right: " -8px",
cursor: "col-resize",
touchAction: "none",
userSelect: "auto",
width: "16px",
zIndex: 1,
[`&-line`]: {
display: "block",
width: "1px",
marginLeft: "7px",
height: "100% !important",
backgroundColor: token.colorPrimary,
opacity: 0
},
[`&:hover &-line`]: {
opacity: 1
}
},
[`${componentCls}-wrapper ${componentCls}-resize-handle.dragging`]: {
overflow: "hidden",
[`${componentCls}-resize-handle-line`]: {
opacity: 1
},
[`&:before`]: {
position: "absolute",
top: 0,
bottom: 0,
content: '" "',
width: "200vw",
transform: "translateX(-50%)",
opacity: 0
}
}
};
};
const genSorterStyle = (token) => {
const {
componentCls,
marginXXS,
fontSizeIcon,
tableHeaderIconColor,
tableHeaderIconColorHover
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-thead th${componentCls}-column-has-sorters`]: {
outline: "none",
cursor: "pointer",
transition: `all ${token.motionDurationSlow}`,
"&:hover": {
background: token.tableHeaderSortHoverBg,
"&::before": {
backgroundColor: "transparent !important"
}
},
"&:focus-visible": {
color: token.colorPrimary
},
// https://github.com/ant-design/ant-design/issues/30969
[`
&${componentCls}-cell-fix-left:hover,
&${componentCls}-cell-fix-right:hover
`]: {
background: token.tableFixedHeaderSortActiveBg
}
},
[`${componentCls}-thead th${componentCls}-column-sort`]: {
background: token.tableHeaderSortBg,
"&::before": {
backgroundColor: "transparent !important"
}
},
[`td${componentCls}-column-sort`]: {
background: token.tableBodySortBg
},
[`${componentCls}-column-title`]: {
position: "relative",
zIndex: 1,
flex: 1
},
[`${componentCls}-column-sorters`]: {
display: "flex",
flex: "auto",
alignItems: "center",
justifyContent: "space-between",
"&::after": {
position: "absolute",
inset: 0,
width: "100%",
height: "100%",
content: '""'
}
},
[`${componentCls}-column-sorter`]: {
marginInlineStart: marginXXS,
color: tableHeaderIconColor,
fontSize: 0,
transition: `color ${token.motionDurationSlow}`,
"&-inner": {
display: "inline-flex",
flexDirection: "column",
alignItems: "center"
},
"&-up, &-down": {
fontSize: fontSizeIcon,
"&.active": {
color: token.colorPrimary
}
},
[`${componentCls}-column-sorter-up + ${componentCls}-column-sorter-down`]: {
marginTop: "-0.3em"
}
},
[`${componentCls}-column-sorters:hover ${componentCls}-column-sorter`]: {
color: tableHeaderIconColorHover
}
}
};
};
const genStickyStyle = (token) => {
const {
componentCls,
opacityLoading,
tableScrollThumbBg,
tableScrollThumbBgHover,
tableScrollThumbSize,
tableScrollBg,
zIndexTableSticky
} = token;
const tableBorder = `${token.lineWidth}px ${token.lineType} ${token.tableBorderColor}`;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-sticky`]: {
"&-holder": {
position: "sticky",
zIndex: zIndexTableSticky,
background: token.colorBgContainer
},
"&-scroll": {
position: "sticky",
bottom: 0,
height: `${tableScrollThumbSize}px !important`,
zIndex: zIndexTableSticky,
display: "flex",
alignItems: "center",
background: tableScrollBg,
borderTop: tableBorder,
opacity: opacityLoading,
"&:hover": {
transformOrigin: "center bottom"
},
// fake scrollbar style of sticky
"&-bar": {
height: tableScrollThumbSize,
backgroundColor: tableScrollThumbBg,
borderRadius: 100,
transition: `all ${token.motionDurationSlow}, transform none`,
position: "absolute",
bottom: 0,
"&:hover, &-active": {
backgroundColor: tableScrollThumbBgHover
}
}
}
}
}
};
};
const genSummaryStyle = (token) => {
const {
componentCls,
lineWidth,
tableBorderColor
} = token;
const tableBorder = `${lineWidth}px ${token.lineType} ${tableBorderColor}`;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-summary`]: {
position: "relative",
zIndex: token.zIndexTableFixed,
background: token.tableBg,
"> tr": {
"> th, > td": {
borderBottom: tableBorder
}
}
},
[`div${componentCls}-summary`]: {
boxShadow: `0 -${lineWidth}px 0 ${tableBorderColor}`
}
}
};
};
const genTableStyle = (token) => {
const {
componentCls,
fontWeightStrong,
tablePaddingVertical,
tablePaddingHorizontal,
lineWidth,
lineType,
tableBorderColor,
tableFontSize,
tableBg,
tableRadius,
tableHeaderTextColor,
motionDurationMid,
tableHeaderBg,
tableHeaderCellSplitColor,
tableRowHoverBg,
tableSelectedRowBg,
tableSelectedRowHoverBg,
tableFooterTextColor,
tableFooterBg,
paddingContentVerticalLG
} = token;
const tableBorder = `${lineWidth}px ${lineType} ${tableBorderColor}`;
return {
[`${componentCls}-wrapper`]: _extends(_extends({
clear: "both",
maxWidth: "100%"
}, clearFix()), {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
fontSize: tableFontSize,
background: tableBg,
borderRadius: `${tableRadius}px ${tableRadius}px 0 0`
}),
// https://github.com/ant-design/ant-design/issues/17611
table: {
width: "100%",
textAlign: "start",
borderRadius: `${tableRadius}px ${tableRadius}px 0 0`,
borderCollapse: "separate",
borderSpacing: 0
},
// ============================= Cell =============================
[`
${componentCls}-thead > tr > th,
${componentCls}-tbody > tr > td,
tfoot > tr > th,
tfoot > tr > td
`]: {
position: "relative",
padding: `${paddingContentVerticalLG}px ${tablePaddingHorizontal}px`,
overflowWrap: "break-word"
},
// ============================ Title =============================
[`${componentCls}-title`]: {
padding: `${tablePaddingVertical}px ${tablePaddingHorizontal}px`
},
// ============================ Header ============================
[`${componentCls}-thead`]: {
[`
> tr > th,
> tr > td
`]: {
position: "relative",
color: tableHeaderTextColor,
fontWeight: fontWeightStrong,
textAlign: "start",
background: tableHeaderBg,
borderBottom: tableBorder,
transition: `background ${motionDurationMid} ease`,
"&[colspan]:not([colspan='1'])": {
textAlign: "center"
},
[`&:not(:last-child):not(${componentCls}-selection-column):not(${componentCls}-row-expand-icon-cell):not([colspan])::before`]: {
position: "absolute",
top: "50%",
insetInlineEnd: 0,
width: 1,
height: "1.6em",
backgroundColor: tableHeaderCellSplitColor,
transform: "translateY(-50%)",
transition: `background-color ${motionDurationMid}`,
content: '""'
}
},
"> tr:not(:last-child) > th[colspan]": {
borderBottom: 0
}
},
// ============================ Body ============================
// Borderless Table has unique hover style, which would be implemented with `borderTop`.
[`${componentCls}:not(${componentCls}-bordered)`]: {
[`${componentCls}-tbody`]: {
"> tr": {
"> td": {
borderTop: tableBorder,
borderBottom: "transparent"
},
"&:last-child > td": {
borderBottom: tableBorder
},
[`&:first-child > td,
&${componentCls}-measure-row + tr > td`]: {
borderTop: "none",
borderTopColor: "transparent"
}
}
}
},
// Bordered Table remains simple `borderBottom`.
// Ref issue: https://github.com/ant-design/ant-design/issues/38724
[`${componentCls}${componentCls}-bordered`]: {
[`${componentCls}-tbody`]: {
"> tr": {
"> td": {
borderBottom: tableBorder
}
}
}
},
[`${componentCls}-tbody`]: {
"> tr": {
"> td": {
transition: `background ${motionDurationMid}, border-color ${motionDurationMid}`,
// ========================= Nest Table ===========================
[`
> ${componentCls}-wrapper:only-child,
> ${componentCls}-expanded-row-fixed > ${componentCls}-wrapper:only-child
`]: {
[componentCls]: {
marginBlock: `-${tablePaddingVertical}px`,
marginInline: `${token.tableExpandColumnWidth - tablePaddingHorizontal}px -${tablePaddingHorizontal}px`,
[`${componentCls}-tbody > tr:last-child > td`]: {
borderBottom: 0,
"&:first-child, &:last-child": {
borderRadius: 0
}
}
}
}
},
[`
&${componentCls}-row:hover > td,
> td${componentCls}-cell-row-hover
`]: {
background: tableRowHoverBg
},
[`&${componentCls}-row-selected`]: {
"> td": {
background: tableSelectedRowBg
},
"&:hover > td": {
background: tableSelectedRowHoverBg
}
}
}
},
// ============================ Footer ============================
[`${componentCls}-footer`]: {
padding: `${tablePaddingVertical}px ${tablePaddingHorizontal}px`,
color: tableFooterTextColor,
background: tableFooterBg
}
})
};
};
const useStyle$9 = genComponentStyleHook("Table", (token) => {
const {
controlItemBgActive,
controlItemBgActiveHover,
colorTextPlaceholder,
colorTextHeading,
colorSplit,
colorBorderSecondary,
fontSize,
padding,
paddingXS,
paddingSM,
controlHeight,
colorFillAlter,
colorIcon,
colorIconHover,
opacityLoading,
colorBgContainer,
borderRadiusLG,
colorFillContent,
colorFillSecondary,
controlInteractiveSize: checkboxSize
} = token;
const baseColorAction = new TinyColor(colorIcon);
const baseColorActionHover = new TinyColor(colorIconHover);
const tableSelectedRowBg = controlItemBgActive;
const zIndexTableFixed = 2;
const colorFillSecondarySolid = new TinyColor(colorFillSecondary).onBackground(colorBgContainer).toHexString();
const colorFillContentSolid = new TinyColor(colorFillContent).onBackground(colorBgContainer).toHexString();
const colorFillAlterSolid = new TinyColor(colorFillAlter).onBackground(colorBgContainer).toHexString();
const tableToken = merge(token, {
tableFontSize: fontSize,
tableBg: colorBgContainer,
tableRadius: borderRadiusLG,
tablePaddingVertical: padding,
tablePaddingHorizontal: padding,
tablePaddingVerticalMiddle: paddingSM,
tablePaddingHorizontalMiddle: paddingXS,
tablePaddingVerticalSmall: paddingXS,
tablePaddingHorizontalSmall: paddingXS,
tableBorderColor: colorBorderSecondary,
tableHeaderTextColor: colorTextHeading,
tableHeaderBg: colorFillAlterSolid,
tableFooterTextColor: colorTextHeading,
tableFooterBg: colorFillAlterSolid,
tableHeaderCellSplitColor: colorBorderSecondary,
tableHeaderSortBg: colorFillSecondarySolid,
tableHeaderSortHoverBg: colorFillContentSolid,
tableHeaderIconColor: baseColorAction.clone().setAlpha(baseColorAction.getAlpha() * opacityLoading).toRgbString(),
tableHeaderIconColorHover: baseColorActionHover.clone().setAlpha(baseColorActionHover.getAlpha() * opacityLoading).toRgbString(),
tableBodySortBg: colorFillAlterSolid,
tableFixedHeaderSortActiveBg: colorFillSecondarySolid,
tableHeaderFilterActiveBg: colorFillContent,
tableFilterDropdownBg: colorBgContainer,
tableRowHoverBg: colorFillAlterSolid,
tableSelectedRowBg,
tableSelectedRowHoverBg: controlItemBgActiveHover,
zIndexTableFixed,
zIndexTableSticky: zIndexTableFixed + 1,
tableFontSizeMiddle: fontSize,
tableFontSizeSmall: fontSize,
tableSelectionColumnWidth: controlHeight,
tableExpandIconBg: colorBgContainer,
tableExpandColumnWidth: checkboxSize + 2 * token.padding,
tableExpandedRowBg: colorFillAlter,
// Dropdown
tableFilterDropdownWidth: 120,
tableFilterDropdownHeight: 264,
tableFilterDropdownSearchWidth: 140,
// Virtual Scroll Bar
tableScrollThumbSize: 8,
tableScrollThumbBg: colorTextPlaceholder,
tableScrollThumbBgHover: colorTextHeading,
tableScrollBg: colorSplit
});
return [genTableStyle(tableToken), genPaginationStyle(tableToken), genSummaryStyle(tableToken), genSorterStyle(tableToken), genFilterStyle(tableToken), genBorderedStyle(tableToken), genRadiusStyle(tableToken), genExpandStyle(tableToken), genSummaryStyle(tableToken), genEmptyStyle(tableToken), genSelectionStyle(tableToken), genFixedStyle(tableToken), genStickyStyle(tableToken), genEllipsisStyle(tableToken), genSizeStyle(tableToken), genResizeStyle(tableToken), genStyle(tableToken)];
});
const EMPTY_LIST = [];
const tableProps = () => {
return {
prefixCls: stringType(),
columns: arrayType(),
rowKey: someType([String, Function]),
tableLayout: stringType(),
rowClassName: someType([String, Function]),
title: functionType(),
footer: functionType(),
id: stringType(),
showHeader: booleanType(),
components: objectType(),
customRow: functionType(),
customHeaderRow: functionType(),
direction: stringType(),
expandFixed: someType([Boolean, String]),
expandColumnWidth: Number,
expandedRowKeys: arrayType(),
defaultExpandedRowKeys: arrayType(),
expandedRowRender: functionType(),
expandRowByClick: booleanType(),
expandIcon: functionType(),
onExpand: functionType(),
onExpandedRowsChange: functionType(),
"onUpdate:expandedRowKeys": functionType(),
defaultExpandAllRows: booleanType(),
indentSize: Number,
/** @deprecated Please use `EXPAND_COLUMN` in `columns` directly */
expandIconColumnIndex: Number,
showExpandColumn: booleanType(),
expandedRowClassName: functionType(),
childrenColumnName: stringType(),
rowExpandable: functionType(),
sticky: someType([Boolean, Object]),
dropdownPrefixCls: String,
dataSource: arrayType(),
pagination: someType([Boolean, Object]),
loading: someType([Boolean, Object]),
size: stringType(),
bordered: booleanType(),
locale: objectType(),
onChange: functionType(),
onResizeColumn: functionType(),
rowSelection: objectType(),
getPopupContainer: functionType(),
scroll: objectType(),
sortDirections: arrayType(),
showSorterTooltip: someType([Boolean, Object], true),
transformCellText: functionType()
};
};
const InternalTable = defineComponent({
name: "InternalTable",
inheritAttrs: false,
props: initDefaultProps(_extends(_extends({}, tableProps()), {
contextSlots: objectType()
}), {
rowKey: "key"
}),
setup(props2, _ref) {
let {
attrs,
slots,
expose,
emit
} = _ref;
devWarning(!(typeof props2.rowKey === "function" && props2.rowKey.length > 1), "Table", "`index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected.");
useProvideSlots(computed(() => props2.contextSlots));
useProvideTableContext({
onResizeColumn: (w, col) => {
emit("resizeColumn", w, col);
}
});
const screens = useBreakpoint();
const mergedColumns = computed(() => {
const matched = new Set(Object.keys(screens.value).filter((m) => screens.value[m]));
return props2.columns.filter((c) => !c.responsive || c.responsive.some((r) => matched.has(r)));
});
const {
size: mergedSize,
renderEmpty: renderEmpty2,
direction,
prefixCls,
configProvider
} = useConfigInject("table", props2);
const [wrapSSR, hashId] = useStyle$9(prefixCls);
const transformCellText = computed(() => {
var _a;
return props2.transformCellText || ((_a = configProvider.transformCellText) === null || _a === void 0 ? void 0 : _a.value);
});
const [tableLocale] = useLocaleReceiver("Table", localeValues.Table, toRef(props2, "locale"));
const rawData = computed(() => props2.dataSource || EMPTY_LIST);
const dropdownPrefixCls = computed(() => configProvider.getPrefixCls("dropdown", props2.dropdownPrefixCls));
const childrenColumnName = computed(() => props2.childrenColumnName || "children");
const expandType = computed(() => {
if (rawData.value.some((item) => item === null || item === void 0 ? void 0 : item[childrenColumnName.value])) {
return "nest";
}
if (props2.expandedRowRender) {
return "row";
}
return null;
});
const internalRefs = reactive({
body: null
});
const updateInternalRefs = (refs) => {
_extends(internalRefs, refs);
};
const getRowKey = computed(() => {
if (typeof props2.rowKey === "function") {
return props2.rowKey;
}
return (record) => record === null || record === void 0 ? void 0 : record[props2.rowKey];
});
const [getRecordByKey] = useLazyKVMap(rawData, childrenColumnName, getRowKey);
const changeEventInfo = {};
const triggerOnChange = function(info, action) {
let reset = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
const {
pagination,
scroll,
onChange
} = props2;
const changeInfo = _extends(_extends({}, changeEventInfo), info);
if (reset) {
changeEventInfo.resetPagination();
if (changeInfo.pagination.current) {
changeInfo.pagination.current = 1;
}
if (pagination && pagination.onChange) {
pagination.onChange(1, changeInfo.pagination.pageSize);
}
}
if (scroll && scroll.scrollToFirstRowOnChange !== false && internalRefs.body) {
scrollTo$1(0, {
getContainer: () => internalRefs.body
});
}
onChange === null || onChange === void 0 ? void 0 : onChange(changeInfo.pagination, changeInfo.filters, changeInfo.sorter, {
currentDataSource: getFilterData(getSortData(rawData.value, changeInfo.sorterStates, childrenColumnName.value), changeInfo.filterStates),
action
});
};
const onSorterChange = (sorter, sorterStates) => {
triggerOnChange({
sorter,
sorterStates
}, "sort", false);
};
const [transformSorterColumns, sortStates, sorterTitleProps, sorters] = useFilterSorter({
prefixCls,
mergedColumns,
onSorterChange,
sortDirections: computed(() => props2.sortDirections || ["ascend", "descend"]),
tableLocale,
showSorterTooltip: toRef(props2, "showSorterTooltip")
});
const sortedData = computed(() => getSortData(rawData.value, sortStates.value, childrenColumnName.value));
const onFilterChange = (filters2, filterStates2) => {
triggerOnChange({
filters: filters2,
filterStates: filterStates2
}, "filter", true);
};
const [transformFilterColumns, filterStates, filters] = useFilter({
prefixCls,
locale: tableLocale,
dropdownPrefixCls,
mergedColumns,
onFilterChange,
getPopupContainer: toRef(props2, "getPopupContainer")
});
const mergedData = computed(() => getFilterData(sortedData.value, filterStates.value));
const [transformBasicColumns] = useColumns(toRef(props2, "contextSlots"));
const columnTitleProps = computed(() => {
const mergedFilters = {};
const filtersValue = filters.value;
Object.keys(filtersValue).forEach((filterKey) => {
if (filtersValue[filterKey] !== null) {
mergedFilters[filterKey] = filtersValue[filterKey];
}
});
return _extends(_extends({}, sorterTitleProps.value), {
filters: mergedFilters
});
});
const [transformTitleColumns] = useTitleColumns(columnTitleProps);
const onPaginationChange = (current, pageSize) => {
triggerOnChange({
pagination: _extends(_extends({}, changeEventInfo.pagination), {
current,
pageSize
})
}, "paginate");
};
const [mergedPagination, resetPagination] = usePagination(computed(() => mergedData.value.length), toRef(props2, "pagination"), onPaginationChange);
watchEffect(() => {
changeEventInfo.sorter = sorters.value;
changeEventInfo.sorterStates = sortStates.value;
changeEventInfo.filters = filters.value;
changeEventInfo.filterStates = filterStates.value;
changeEventInfo.pagination = props2.pagination === false ? {} : getPaginationParam(mergedPagination.value, props2.pagination);
changeEventInfo.resetPagination = resetPagination;
});
const pageData = computed(() => {
if (props2.pagination === false || !mergedPagination.value.pageSize) {
return mergedData.value;
}
const {
current = 1,
total,
pageSize = DEFAULT_PAGE_SIZE
} = mergedPagination.value;
devWarning(current > 0, "Table", "`current` should be positive number.");
if (mergedData.value.length < total) {
if (mergedData.value.length > pageSize) {
return mergedData.value.slice((current - 1) * pageSize, current * pageSize);
}
return mergedData.value;
}
return mergedData.value.slice((current - 1) * pageSize, current * pageSize);
});
watchEffect(() => {
nextTick(() => {
const {
total,
pageSize = DEFAULT_PAGE_SIZE
} = mergedPagination.value;
if (mergedData.value.length < total) {
if (mergedData.value.length > pageSize) {
devWarning(false, "Table", "`dataSource` length is less than `pagination.total` but large than `pagination.pageSize`. Please make sure your config correct data with async mode.");
}
}
});
}, {
flush: "post"
});
const expandIconColumnIndex = computed(() => {
if (props2.showExpandColumn === false) return -1;
if (expandType.value === "nest" && props2.expandIconColumnIndex === void 0) {
return props2.rowSelection ? 1 : 0;
} else if (props2.expandIconColumnIndex > 0 && props2.rowSelection) {
return props2.expandIconColumnIndex - 1;
}
return props2.expandIconColumnIndex;
});
const rowSelection = ref();
watch(() => props2.rowSelection, () => {
rowSelection.value = props2.rowSelection ? _extends({}, props2.rowSelection) : props2.rowSelection;
}, {
deep: true,
immediate: true
});
const [transformSelectionColumns, selectedKeySet] = useSelection(rowSelection, {
prefixCls,
data: mergedData,
pageData,
getRowKey,
getRecordByKey,
expandType,
childrenColumnName,
locale: tableLocale,
getPopupContainer: computed(() => props2.getPopupContainer)
});
const internalRowClassName = (record, index2, indent) => {
let mergedRowClassName;
const {
rowClassName
} = props2;
if (typeof rowClassName === "function") {
mergedRowClassName = classNames(rowClassName(record, index2, indent));
} else {
mergedRowClassName = classNames(rowClassName);
}
return classNames({
[`${prefixCls.value}-row-selected`]: selectedKeySet.value.has(getRowKey.value(record, index2))
}, mergedRowClassName);
};
expose({
selectedKeySet
});
const indentSize = computed(() => {
return typeof props2.indentSize === "number" ? props2.indentSize : 15;
});
const transformColumns = (innerColumns) => {
const res = transformTitleColumns(transformSelectionColumns(transformFilterColumns(transformSorterColumns(transformBasicColumns(innerColumns)))));
return res;
};
return () => {
var _a;
const {
expandIcon = slots.expandIcon || renderExpandIcon(tableLocale.value),
pagination,
loading: loading2,
bordered
} = props2;
let topPaginationNode;
let bottomPaginationNode;
if (pagination !== false && ((_a = mergedPagination.value) === null || _a === void 0 ? void 0 : _a.total)) {
let paginationSize;
if (mergedPagination.value.size) {
paginationSize = mergedPagination.value.size;
} else {
paginationSize = mergedSize.value === "small" || mergedSize.value === "middle" ? "small" : void 0;
}
const renderPagination = (position2) => createVNode(Pagination, _objectSpread$W(_objectSpread$W({}, mergedPagination.value), {}, {
"class": [`${prefixCls.value}-pagination ${prefixCls.value}-pagination-${position2}`, mergedPagination.value.class],
"size": paginationSize
}), null);
const defaultPosition = direction.value === "rtl" ? "left" : "right";
const {
position
} = mergedPagination.value;
if (position !== null && Array.isArray(position)) {
const topPos = position.find((p) => p.includes("top"));
const bottomPos = position.find((p) => p.includes("bottom"));
const isDisable = position.every((p) => `${p}` === "none");
if (!topPos && !bottomPos && !isDisable) {
bottomPaginationNode = renderPagination(defaultPosition);
}
if (topPos) {
topPaginationNode = renderPagination(topPos.toLowerCase().replace("top", ""));
}
if (bottomPos) {
bottomPaginationNode = renderPagination(bottomPos.toLowerCase().replace("bottom", ""));
}
} else {
bottomPaginationNode = renderPagination(defaultPosition);
}
}
let spinProps2;
if (typeof loading2 === "boolean") {
spinProps2 = {
spinning: loading2
};
} else if (typeof loading2 === "object") {
spinProps2 = _extends({
spinning: true
}, loading2);
}
const wrapperClassNames = classNames(`${prefixCls.value}-wrapper`, {
[`${prefixCls.value}-wrapper-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value);
const tableProps2 = omit(props2, ["columns"]);
return wrapSSR(createVNode("div", {
"class": wrapperClassNames,
"style": attrs.style
}, [createVNode(Spin, _objectSpread$W({
"spinning": false
}, spinProps2), {
default: () => [topPaginationNode, createVNode(Table$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), tableProps2), {}, {
"expandedRowKeys": props2.expandedRowKeys,
"defaultExpandedRowKeys": props2.defaultExpandedRowKeys,
"expandIconColumnIndex": expandIconColumnIndex.value,
"indentSize": indentSize.value,
"expandIcon": expandIcon,
"columns": mergedColumns.value,
"direction": direction.value,
"prefixCls": prefixCls.value,
"class": classNames({
[`${prefixCls.value}-middle`]: mergedSize.value === "middle",
[`${prefixCls.value}-small`]: mergedSize.value === "small",
[`${prefixCls.value}-bordered`]: bordered,
[`${prefixCls.value}-empty`]: rawData.value.length === 0
}),
"data": pageData.value,
"rowKey": getRowKey.value,
"rowClassName": internalRowClassName,
"internalHooks": INTERNAL_HOOKS,
"internalRefs": internalRefs,
"onUpdateInternalRefs": updateInternalRefs,
"transformColumns": transformColumns,
"transformCellText": transformCellText.value
}), _extends(_extends({}, slots), {
emptyText: () => {
var _a2, _b;
return ((_a2 = slots.emptyText) === null || _a2 === void 0 ? void 0 : _a2.call(slots)) || ((_b = props2.locale) === null || _b === void 0 ? void 0 : _b.emptyText) || renderEmpty2("Table");
}
})), bottomPaginationNode]
})]));
};
}
});
const Table = defineComponent({
name: "ATable",
inheritAttrs: false,
props: initDefaultProps(tableProps(), {
rowKey: "key"
}),
slots: Object,
setup(props2, _ref2) {
let {
attrs,
slots,
expose
} = _ref2;
const table = ref();
expose({
table
});
return () => {
var _a;
const columns = props2.columns || convertChildrenToColumns((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
return createVNode(InternalTable, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": table
}, attrs), props2), {}, {
"columns": columns || [],
"expandedRowRender": slots.expandedRowRender || props2.expandedRowRender,
"contextSlots": _extends({}, slots)
}), slots);
};
}
});
const Column = defineComponent({
name: "ATableColumn",
slots: Object,
render() {
return null;
}
});
const ColumnGroup = defineComponent({
name: "ATableColumnGroup",
slots: Object,
__ANT_TABLE_COLUMN_GROUP: true,
render() {
return null;
}
});
const TableSummaryRow = SummaryRow;
const TableSummaryCell = SummaryCell;
const TableSummary = _extends(FooterComponents, {
Cell: TableSummaryCell,
Row: TableSummaryRow,
name: "ATableSummary"
});
const index$9 = _extends(Table, {
SELECTION_ALL,
SELECTION_INVERT,
SELECTION_NONE,
SELECTION_COLUMN,
EXPAND_COLUMN,
Column,
ColumnGroup,
Summary: TableSummary,
install: (app) => {
app.component(TableSummary.name, TableSummary);
app.component(TableSummaryCell.name, TableSummaryCell);
app.component(TableSummaryRow.name, TableSummaryRow);
app.component(Table.name, Table);
app.component(Column.name, Column);
app.component(ColumnGroup.name, ColumnGroup);
return app;
}
});
const transferSearchProps = {
prefixCls: String,
placeholder: String,
value: String,
handleClear: Function,
disabled: {
type: Boolean,
default: void 0
},
onChange: Function
};
const Search = defineComponent({
compatConfig: {
MODE: 3
},
name: "Search",
inheritAttrs: false,
props: initDefaultProps(transferSearchProps, {
placeholder: ""
}),
emits: ["change"],
setup(props2, _ref) {
let {
emit
} = _ref;
const handleChange = (e) => {
var _a;
emit("change", e);
if (e.target.value === "") {
(_a = props2.handleClear) === null || _a === void 0 ? void 0 : _a.call(props2);
}
};
return () => {
const {
placeholder,
value,
prefixCls,
disabled
} = props2;
return createVNode(Input, {
"placeholder": placeholder,
"class": prefixCls,
"value": value,
"onChange": handleChange,
"disabled": disabled,
"allowClear": true
}, {
prefix: () => createVNode(SearchOutlined, null, null)
});
};
}
});
function noop$1() {
}
const transferListItemProps = {
renderedText: PropTypes.any,
renderedEl: PropTypes.any,
item: PropTypes.any,
checked: booleanType(),
prefixCls: String,
disabled: booleanType(),
showRemove: booleanType(),
onClick: Function,
onRemove: Function
};
const ListItem$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "ListItem",
inheritAttrs: false,
props: transferListItemProps,
emits: ["click", "remove"],
setup(props2, _ref) {
let {
emit
} = _ref;
return () => {
const {
renderedText,
renderedEl,
item,
checked,
disabled,
prefixCls,
showRemove
} = props2;
const className = classNames({
[`${prefixCls}-content-item`]: true,
[`${prefixCls}-content-item-disabled`]: disabled || item.disabled
});
let title;
if (typeof renderedText === "string" || typeof renderedText === "number") {
title = String(renderedText);
}
return createVNode(LocaleReceiver, {
"componentName": "Transfer",
"defaultLocale": localeValues.Transfer
}, {
default: (transferLocale) => {
const labelNode = createVNode("span", {
"class": `${prefixCls}-content-item-text`
}, [renderedEl]);
if (showRemove) {
return createVNode("li", {
"class": className,
"title": title
}, [labelNode, createVNode(TransButton, {
"disabled": disabled || item.disabled,
"class": `${prefixCls}-content-item-remove`,
"aria-label": transferLocale.remove,
"onClick": () => {
emit("remove", item);
}
}, {
default: () => [createVNode(DeleteOutlined, null, null)]
})]);
}
return createVNode("li", {
"class": className,
"title": title,
"onClick": disabled || item.disabled ? noop$1 : () => {
emit("click", item);
}
}, [createVNode(Checkbox, {
"class": `${prefixCls}-checkbox`,
"checked": checked,
"disabled": disabled || item.disabled
}, null), labelNode]);
}
});
};
}
});
const transferListBodyProps = {
prefixCls: String,
filteredRenderItems: PropTypes.array.def([]),
selectedKeys: PropTypes.array,
disabled: booleanType(),
showRemove: booleanType(),
pagination: PropTypes.any,
onItemSelect: Function,
onScroll: Function,
onItemRemove: Function
};
function parsePagination(pagination) {
if (!pagination) {
return null;
}
const defaultPagination = {
pageSize: 10,
simple: true,
showSizeChanger: false,
showLessItems: false
};
if (typeof pagination === "object") {
return _extends(_extends({}, defaultPagination), pagination);
}
return defaultPagination;
}
const ListBody = defineComponent({
compatConfig: {
MODE: 3
},
name: "ListBody",
inheritAttrs: false,
props: transferListBodyProps,
emits: ["itemSelect", "itemRemove", "scroll"],
setup(props2, _ref) {
let {
emit,
expose
} = _ref;
const current = ref(1);
const handleItemSelect = (item) => {
const {
selectedKeys
} = props2;
const checked = selectedKeys.indexOf(item.key) >= 0;
emit("itemSelect", item.key, !checked);
};
const handleItemRemove = (item) => {
emit("itemRemove", [item.key]);
};
const handleScroll = (e) => {
emit("scroll", e);
};
const mergedPagination = computed(() => parsePagination(props2.pagination));
watch([mergedPagination, () => props2.filteredRenderItems], () => {
if (mergedPagination.value) {
const maxPageCount = Math.ceil(props2.filteredRenderItems.length / mergedPagination.value.pageSize);
current.value = Math.min(current.value, maxPageCount);
}
}, {
immediate: true
});
const items = computed(() => {
const {
filteredRenderItems
} = props2;
let displayItems = filteredRenderItems;
if (mergedPagination.value) {
displayItems = filteredRenderItems.slice((current.value - 1) * mergedPagination.value.pageSize, current.value * mergedPagination.value.pageSize);
}
return displayItems;
});
const onPageChange = (cur) => {
current.value = cur;
};
expose({
items
});
return () => {
const {
prefixCls,
filteredRenderItems,
selectedKeys,
disabled: globalDisabled,
showRemove
} = props2;
let paginationNode = null;
if (mergedPagination.value) {
paginationNode = createVNode(Pagination, {
"simple": mergedPagination.value.simple,
"showSizeChanger": mergedPagination.value.showSizeChanger,
"showLessItems": mergedPagination.value.showLessItems,
"size": "small",
"disabled": globalDisabled,
"class": `${prefixCls}-pagination`,
"total": filteredRenderItems.length,
"pageSize": mergedPagination.value.pageSize,
"current": current.value,
"onChange": onPageChange
}, null);
}
const itemsList = items.value.map((_ref2) => {
let {
renderedEl,
renderedText,
item
} = _ref2;
const {
disabled
} = item;
const checked = selectedKeys.indexOf(item.key) >= 0;
return createVNode(ListItem$1, {
"disabled": globalDisabled || disabled,
"key": item.key,
"item": item,
"renderedText": renderedText,
"renderedEl": renderedEl,
"checked": checked,
"prefixCls": prefixCls,
"onClick": handleItemSelect,
"onRemove": handleItemRemove,
"showRemove": showRemove
}, null);
});
return createVNode(Fragment, null, [createVNode("ul", {
"class": classNames(`${prefixCls}-content`, {
[`${prefixCls}-content-show-remove`]: showRemove
}),
"onScroll": handleScroll
}, [itemsList]), paginationNode]);
};
}
});
const groupKeysMap = (keys) => {
const map = /* @__PURE__ */ new Map();
keys.forEach((key2, index2) => {
map.set(key2, index2);
});
return map;
};
const groupDisabledKeysMap = (dataSource) => {
const map = /* @__PURE__ */ new Map();
dataSource.forEach((_ref, index2) => {
let {
disabled,
key: key2
} = _ref;
if (disabled) {
map.set(key2, index2);
}
});
return map;
};
const defaultRender = () => null;
function isRenderResultPlainObject(result) {
return !!(result && !isValidElement(result) && Object.prototype.toString.call(result) === "[object Object]");
}
function getEnabledItemKeys(items) {
return items.filter((data) => !data.disabled).map((data) => data.key);
}
const transferListProps = {
prefixCls: String,
dataSource: arrayType([]),
filter: String,
filterOption: Function,
checkedKeys: PropTypes.arrayOf(PropTypes.string),
handleFilter: Function,
handleClear: Function,
renderItem: Function,
showSearch: booleanType(false),
searchPlaceholder: String,
notFoundContent: PropTypes.any,
itemUnit: String,
itemsUnit: String,
renderList: PropTypes.any,
disabled: booleanType(),
direction: stringType(),
showSelectAll: booleanType(),
remove: String,
selectAll: String,
selectCurrent: String,
selectInvert: String,
removeAll: String,
removeCurrent: String,
selectAllLabel: PropTypes.any,
showRemove: booleanType(),
pagination: PropTypes.any,
onItemSelect: Function,
onItemSelectAll: Function,
onItemRemove: Function,
onScroll: Function
};
const List = defineComponent({
compatConfig: {
MODE: 3
},
name: "TransferList",
inheritAttrs: false,
props: transferListProps,
// emits: ['scroll', 'itemSelectAll', 'itemRemove', 'itemSelect'],
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const filterValue = ref("");
const transferNode = ref();
const defaultListBodyRef = ref();
const renderListBody = (renderList, props3) => {
let bodyContent = renderList ? renderList(props3) : null;
const customize = !!bodyContent && filterEmpty(bodyContent).length > 0;
if (!customize) {
bodyContent = createVNode(ListBody, _objectSpread$W(_objectSpread$W({}, props3), {}, {
"ref": defaultListBodyRef
}), null);
}
return {
customize,
bodyContent
};
};
const renderItemHtml = (item) => {
const {
renderItem = defaultRender
} = props2;
const renderResult = renderItem(item);
const isRenderResultPlain = isRenderResultPlainObject(renderResult);
return {
renderedText: isRenderResultPlain ? renderResult.value : renderResult,
renderedEl: isRenderResultPlain ? renderResult.label : renderResult,
item
};
};
const filteredItems = ref([]);
const filteredRenderItems = ref([]);
watchEffect(() => {
const fItems = [];
const fRenderItems = [];
props2.dataSource.forEach((item) => {
const renderedItem = renderItemHtml(item);
const {
renderedText
} = renderedItem;
if (filterValue.value && filterValue.value.trim() && !matchFilter(renderedText, item)) {
return null;
}
fItems.push(item);
fRenderItems.push(renderedItem);
});
filteredItems.value = fItems;
filteredRenderItems.value = fRenderItems;
});
const checkStatus2 = computed(() => {
const {
checkedKeys
} = props2;
if (checkedKeys.length === 0) {
return "none";
}
const checkedKeysMap = groupKeysMap(checkedKeys);
if (filteredItems.value.every((item) => checkedKeysMap.has(item.key) || !!item.disabled)) {
return "all";
}
return "part";
});
const enabledItemKeys = computed(() => {
return getEnabledItemKeys(filteredItems.value);
});
const getNewSelectKeys = (keys, unCheckedKeys) => {
return Array.from(/* @__PURE__ */ new Set([...keys, ...props2.checkedKeys])).filter((key2) => unCheckedKeys.indexOf(key2) === -1);
};
const getCheckBox = (_ref2) => {
let {
disabled,
prefixCls
} = _ref2;
var _a;
const checkedAll = checkStatus2.value === "all";
const checkAllCheckbox = createVNode(Checkbox, {
"disabled": ((_a = props2.dataSource) === null || _a === void 0 ? void 0 : _a.length) === 0 || disabled,
"checked": checkedAll,
"indeterminate": checkStatus2.value === "part",
"class": `${prefixCls}-checkbox`,
"onChange": () => {
const keys = enabledItemKeys.value;
props2.onItemSelectAll(getNewSelectKeys(!checkedAll ? keys : [], checkedAll ? props2.checkedKeys : []));
}
}, null);
return checkAllCheckbox;
};
const handleFilter = (e) => {
var _a;
const {
target: {
value: filter
}
} = e;
filterValue.value = filter;
(_a = props2.handleFilter) === null || _a === void 0 ? void 0 : _a.call(props2, e);
};
const handleClear = (e) => {
var _a;
filterValue.value = "";
(_a = props2.handleClear) === null || _a === void 0 ? void 0 : _a.call(props2, e);
};
const matchFilter = (text, item) => {
const {
filterOption: filterOption2
} = props2;
if (filterOption2) {
return filterOption2(filterValue.value, item);
}
return text.includes(filterValue.value);
};
const getSelectAllLabel = (selectedCount, totalCount) => {
const {
itemsUnit,
itemUnit,
selectAllLabel
} = props2;
if (selectAllLabel) {
return typeof selectAllLabel === "function" ? selectAllLabel({
selectedCount,
totalCount
}) : selectAllLabel;
}
const unit = totalCount > 1 ? itemsUnit : itemUnit;
return createVNode(Fragment, null, [(selectedCount > 0 ? `${selectedCount}/` : "") + totalCount, createTextVNode(" "), unit]);
};
const notFoundContentEle = computed(() => Array.isArray(props2.notFoundContent) ? props2.notFoundContent[props2.direction === "left" ? 0 : 1] : props2.notFoundContent);
const getListBody = (prefixCls, searchPlaceholder, checkedKeys, renderList, showSearch, disabled) => {
const search = showSearch ? createVNode("div", {
"class": `${prefixCls}-body-search-wrapper`
}, [createVNode(Search, {
"prefixCls": `${prefixCls}-search`,
"onChange": handleFilter,
"handleClear": handleClear,
"placeholder": searchPlaceholder,
"value": filterValue.value,
"disabled": disabled
}, null)]) : null;
let bodyNode;
const {
onEvents
} = splitAttrs(attrs);
const {
bodyContent,
customize
} = renderListBody(renderList, _extends(_extends(_extends({}, props2), {
filteredItems: filteredItems.value,
filteredRenderItems: filteredRenderItems.value,
selectedKeys: checkedKeys
}), onEvents));
if (customize) {
bodyNode = createVNode("div", {
"class": `${prefixCls}-body-customize-wrapper`
}, [bodyContent]);
} else {
bodyNode = filteredItems.value.length ? bodyContent : createVNode("div", {
"class": `${prefixCls}-body-not-found`
}, [notFoundContentEle.value]);
}
return createVNode("div", {
"class": showSearch ? `${prefixCls}-body ${prefixCls}-body-with-search` : `${prefixCls}-body`,
"ref": transferNode
}, [search, bodyNode]);
};
return () => {
var _a, _b;
const {
prefixCls,
checkedKeys,
disabled,
showSearch,
searchPlaceholder,
selectAll,
selectCurrent,
selectInvert,
removeAll,
removeCurrent,
renderList,
onItemSelectAll,
onItemRemove,
showSelectAll = true,
showRemove,
pagination
} = props2;
const footerDom = (_a = slots.footer) === null || _a === void 0 ? void 0 : _a.call(slots, _extends({}, props2));
const listCls = classNames(prefixCls, {
[`${prefixCls}-with-pagination`]: !!pagination,
[`${prefixCls}-with-footer`]: !!footerDom
});
const listBody = getListBody(prefixCls, searchPlaceholder, checkedKeys, renderList, showSearch, disabled);
const listFooter = footerDom ? createVNode("div", {
"class": `${prefixCls}-footer`
}, [footerDom]) : null;
const checkAllCheckbox = !showRemove && !pagination && getCheckBox({
disabled,
prefixCls
});
let menu = null;
if (showRemove) {
menu = createVNode(Menu, null, {
default: () => [pagination && createVNode(Menu.Item, {
"key": "removeCurrent",
"onClick": () => {
const pageKeys = getEnabledItemKeys((defaultListBodyRef.value.items || []).map((entity) => entity.item));
onItemRemove === null || onItemRemove === void 0 ? void 0 : onItemRemove(pageKeys);
}
}, {
default: () => [removeCurrent]
}), createVNode(Menu.Item, {
"key": "removeAll",
"onClick": () => {
onItemRemove === null || onItemRemove === void 0 ? void 0 : onItemRemove(enabledItemKeys.value);
}
}, {
default: () => [removeAll]
})]
});
} else {
menu = createVNode(Menu, null, {
default: () => [createVNode(Menu.Item, {
"key": "selectAll",
"onClick": () => {
const keys = enabledItemKeys.value;
onItemSelectAll(getNewSelectKeys(keys, []));
}
}, {
default: () => [selectAll]
}), pagination && createVNode(Menu.Item, {
"onClick": () => {
const pageKeys = getEnabledItemKeys((defaultListBodyRef.value.items || []).map((entity) => entity.item));
onItemSelectAll(getNewSelectKeys(pageKeys, []));
}
}, {
default: () => [selectCurrent]
}), createVNode(Menu.Item, {
"key": "selectInvert",
"onClick": () => {
let availableKeys;
if (pagination) {
availableKeys = getEnabledItemKeys((defaultListBodyRef.value.items || []).map((entity) => entity.item));
} else {
availableKeys = enabledItemKeys.value;
}
const checkedKeySet = new Set(checkedKeys);
const newCheckedKeys = [];
const newUnCheckedKeys = [];
availableKeys.forEach((key2) => {
if (checkedKeySet.has(key2)) {
newUnCheckedKeys.push(key2);
} else {
newCheckedKeys.push(key2);
}
});
onItemSelectAll(getNewSelectKeys(newCheckedKeys, newUnCheckedKeys));
}
}, {
default: () => [selectInvert]
})]
});
}
const dropdown = createVNode(Dropdown, {
"class": `${prefixCls}-header-dropdown`,
"overlay": menu,
"disabled": disabled
}, {
default: () => [createVNode(DownOutlined, null, null)]
});
return createVNode("div", {
"class": listCls,
"style": attrs.style
}, [createVNode("div", {
"class": `${prefixCls}-header`
}, [showSelectAll ? createVNode(Fragment, null, [checkAllCheckbox, dropdown]) : null, createVNode("span", {
"class": `${prefixCls}-header-selected`
}, [createVNode("span", null, [getSelectAllLabel(checkedKeys.length, filteredItems.value.length)]), createVNode("span", {
"class": `${prefixCls}-header-title`
}, [(_b = slots.titleText) === null || _b === void 0 ? void 0 : _b.call(slots)])])]), listBody, listFooter]);
};
}
});
function noop() {
}
const Operation = (props2) => {
const {
disabled,
moveToLeft = noop,
moveToRight = noop,
leftArrowText = "",
rightArrowText = "",
leftActive,
rightActive,
class: className,
style,
direction,
oneWay
} = props2;
return createVNode("div", {
"class": className,
"style": style
}, [createVNode(Button, {
"type": "primary",
"size": "small",
"disabled": disabled || !rightActive,
"onClick": moveToRight,
"icon": direction !== "rtl" ? createVNode(RightOutlined, null, null) : createVNode(LeftOutlined, null, null)
}, {
default: () => [rightArrowText]
}), !oneWay && createVNode(Button, {
"type": "primary",
"size": "small",
"disabled": disabled || !leftActive,
"onClick": moveToLeft,
"icon": direction !== "rtl" ? createVNode(LeftOutlined, null, null) : createVNode(RightOutlined, null, null)
}, {
default: () => [leftArrowText]
})]);
};
Operation.displayName = "Operation";
Operation.inheritAttrs = false;
const genTransferCustomizeStyle = (token) => {
const {
antCls,
componentCls,
listHeight,
controlHeightLG,
marginXXS,
margin
} = token;
const tableCls = `${antCls}-table`;
const inputCls = `${antCls}-input`;
return {
[`${componentCls}-customize-list`]: {
[`${componentCls}-list`]: {
flex: "1 1 50%",
width: "auto",
height: "auto",
minHeight: listHeight
},
// =================== Hook Components ===================
[`${tableCls}-wrapper`]: {
[`${tableCls}-small`]: {
border: 0,
borderRadius: 0,
[`${tableCls}-selection-column`]: {
width: controlHeightLG,
minWidth: controlHeightLG
}
},
[`${tableCls}-pagination${tableCls}-pagination`]: {
margin: `${margin}px 0 ${marginXXS}px`
}
},
[`${inputCls}[disabled]`]: {
backgroundColor: "transparent"
}
}
};
};
const genTransferStatusColor = (token, color) => {
const {
componentCls,
colorBorder
} = token;
return {
[`${componentCls}-list`]: {
borderColor: color,
"&-search:not([disabled])": {
borderColor: colorBorder
}
}
};
};
const genTransferStatusStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-status-error`]: _extends({}, genTransferStatusColor(token, token.colorError)),
[`${componentCls}-status-warning`]: _extends({}, genTransferStatusColor(token, token.colorWarning))
};
};
const genTransferListStyle = (token) => {
const {
componentCls,
colorBorder,
colorSplit,
lineWidth,
transferItemHeight,
transferHeaderHeight,
transferHeaderVerticalPadding,
transferItemPaddingVertical,
controlItemBgActive,
controlItemBgActiveHover,
colorTextDisabled,
listHeight,
listWidth,
listWidthLG,
fontSizeIcon,
marginXS,
paddingSM,
lineType,
iconCls,
motionDurationSlow
} = token;
return {
display: "flex",
flexDirection: "column",
width: listWidth,
height: listHeight,
border: `${lineWidth}px ${lineType} ${colorBorder}`,
borderRadius: token.borderRadiusLG,
"&-with-pagination": {
width: listWidthLG,
height: "auto"
},
"&-search": {
[`${iconCls}-search`]: {
color: colorTextDisabled
}
},
"&-header": {
display: "flex",
flex: "none",
alignItems: "center",
height: transferHeaderHeight,
// border-top is on the transfer dom. We should minus 1px for this
padding: `${transferHeaderVerticalPadding - lineWidth}px ${paddingSM}px ${transferHeaderVerticalPadding}px`,
color: token.colorText,
background: token.colorBgContainer,
borderBottom: `${lineWidth}px ${lineType} ${colorSplit}`,
borderRadius: `${token.borderRadiusLG}px ${token.borderRadiusLG}px 0 0`,
"> *:not(:last-child)": {
marginInlineEnd: 4
// This is magic and fixed number, DO NOT use token since it may change.
},
"> *": {
flex: "none"
},
"&-title": _extends(_extends({}, textEllipsis), {
flex: "auto",
textAlign: "end"
}),
"&-dropdown": _extends(_extends({}, resetIcon()), {
fontSize: fontSizeIcon,
transform: "translateY(10%)",
cursor: "pointer",
"&[disabled]": {
cursor: "not-allowed"
}
})
},
"&-body": {
display: "flex",
flex: "auto",
flexDirection: "column",
overflow: "hidden",
fontSize: token.fontSize,
"&-search-wrapper": {
position: "relative",
flex: "none",
padding: paddingSM
}
},
"&-content": {
flex: "auto",
margin: 0,
padding: 0,
overflow: "auto",
listStyle: "none",
"&-item": {
display: "flex",
alignItems: "center",
minHeight: transferItemHeight,
padding: `${transferItemPaddingVertical}px ${paddingSM}px`,
transition: `all ${motionDurationSlow}`,
"> *:not(:last-child)": {
marginInlineEnd: marginXS
},
"> *": {
flex: "none"
},
"&-text": _extends(_extends({}, textEllipsis), {
flex: "auto"
}),
"&-remove": {
position: "relative",
color: colorBorder,
cursor: "pointer",
transition: `all ${motionDurationSlow}`,
"&:hover": {
color: token.colorLinkHover
},
"&::after": {
position: "absolute",
insert: `-${transferItemPaddingVertical}px -50%`,
content: '""'
}
},
[`&:not(${componentCls}-list-content-item-disabled)`]: {
"&:hover": {
backgroundColor: token.controlItemBgHover,
cursor: "pointer"
},
[`&${componentCls}-list-content-item-checked:hover`]: {
backgroundColor: controlItemBgActiveHover
}
},
"&-checked": {
backgroundColor: controlItemBgActive
},
"&-disabled": {
color: colorTextDisabled,
cursor: "not-allowed"
}
},
// Do not change hover style when `oneWay` mode
[`&-show-remove ${componentCls}-list-content-item:not(${componentCls}-list-content-item-disabled):hover`]: {
background: "transparent",
cursor: "default"
}
},
"&-pagination": {
padding: `${token.paddingXS}px 0`,
textAlign: "end",
borderTop: `${lineWidth}px ${lineType} ${colorSplit}`
},
"&-body-not-found": {
flex: "none",
width: "100%",
margin: "auto 0",
color: colorTextDisabled,
textAlign: "center"
},
"&-footer": {
borderTop: `${lineWidth}px ${lineType} ${colorSplit}`
},
"&-checkbox": {
lineHeight: 1
}
};
};
const genTransferStyle = (token) => {
const {
antCls,
iconCls,
componentCls,
transferHeaderHeight,
marginXS,
marginXXS,
fontSizeIcon,
fontSize,
lineHeight
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
position: "relative",
display: "flex",
alignItems: "stretch",
[`${componentCls}-disabled`]: {
[`${componentCls}-list`]: {
background: token.colorBgContainerDisabled
}
},
[`${componentCls}-list`]: genTransferListStyle(token),
[`${componentCls}-operation`]: {
display: "flex",
flex: "none",
flexDirection: "column",
alignSelf: "center",
margin: `0 ${marginXS}px`,
verticalAlign: "middle",
[`${antCls}-btn`]: {
display: "block",
"&:first-child": {
marginBottom: marginXXS
},
[iconCls]: {
fontSize: fontSizeIcon
}
}
},
[`${antCls}-empty-image`]: {
maxHeight: transferHeaderHeight / 2 - Math.round(fontSize * lineHeight)
}
})
};
};
const genTransferRTLStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-rtl`]: {
direction: "rtl"
}
};
};
const useStyle$8 = genComponentStyleHook("Transfer", (token) => {
const {
fontSize,
lineHeight,
lineWidth,
controlHeightLG,
controlHeight
} = token;
const fontHeight = Math.round(fontSize * lineHeight);
const transferHeaderHeight = controlHeightLG;
const transferItemHeight = controlHeight;
const transferToken = merge(token, {
transferItemHeight,
transferHeaderHeight,
transferHeaderVerticalPadding: Math.ceil((transferHeaderHeight - lineWidth - fontHeight) / 2),
transferItemPaddingVertical: (transferItemHeight - fontHeight) / 2
});
return [genTransferStyle(transferToken), genTransferCustomizeStyle(transferToken), genTransferStatusStyle(transferToken), genTransferRTLStyle(transferToken)];
}, {
listWidth: 180,
listHeight: 200,
listWidthLG: 250
});
const transferProps = () => ({
id: String,
prefixCls: String,
dataSource: arrayType([]),
disabled: booleanType(),
targetKeys: arrayType(),
selectedKeys: arrayType(),
render: functionType(),
listStyle: someType([Function, Object], () => ({})),
operationStyle: objectType(void 0),
titles: arrayType(),
operations: arrayType(),
showSearch: booleanType(false),
filterOption: functionType(),
searchPlaceholder: String,
notFoundContent: PropTypes.any,
locale: objectType(),
rowKey: functionType(),
showSelectAll: booleanType(),
selectAllLabels: arrayType(),
children: functionType(),
oneWay: booleanType(),
pagination: someType([Object, Boolean]),
status: stringType(),
onChange: functionType(),
onSelectChange: functionType(),
onSearch: functionType(),
onScroll: functionType(),
"onUpdate:targetKeys": functionType(),
"onUpdate:selectedKeys": functionType()
});
const Transfer = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATransfer",
inheritAttrs: false,
props: transferProps(),
slots: Object,
// emits: ['update:targetKeys', 'update:selectedKeys', 'change', 'search', 'scroll', 'selectChange'],
setup(props2, _ref) {
let {
emit,
attrs,
slots,
expose
} = _ref;
const {
configProvider,
prefixCls,
direction
} = useConfigInject("transfer", props2);
const [wrapSSR, hashId] = useStyle$8(prefixCls);
const sourceSelectedKeys = ref([]);
const targetSelectedKeys = ref([]);
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
watch(() => props2.selectedKeys, () => {
var _a, _b;
sourceSelectedKeys.value = ((_a = props2.selectedKeys) === null || _a === void 0 ? void 0 : _a.filter((key2) => props2.targetKeys.indexOf(key2) === -1)) || [];
targetSelectedKeys.value = ((_b = props2.selectedKeys) === null || _b === void 0 ? void 0 : _b.filter((key2) => props2.targetKeys.indexOf(key2) > -1)) || [];
}, {
immediate: true
});
const getLocale = (transferLocale, renderEmpty2) => {
const oldLocale = {
notFoundContent: renderEmpty2("Transfer")
};
const notFoundContent = getPropsSlot(slots, props2, "notFoundContent");
if (notFoundContent) {
oldLocale.notFoundContent = notFoundContent;
}
if (props2.searchPlaceholder !== void 0) {
oldLocale.searchPlaceholder = props2.searchPlaceholder;
}
return _extends(_extends(_extends({}, transferLocale), oldLocale), props2.locale);
};
const moveTo = (direction2) => {
const {
targetKeys = [],
dataSource = []
} = props2;
const moveKeys = direction2 === "right" ? sourceSelectedKeys.value : targetSelectedKeys.value;
const dataSourceDisabledKeysMap = groupDisabledKeysMap(dataSource);
const newMoveKeys = moveKeys.filter((key2) => !dataSourceDisabledKeysMap.has(key2));
const newMoveKeysMap = groupKeysMap(newMoveKeys);
const newTargetKeys = direction2 === "right" ? newMoveKeys.concat(targetKeys) : targetKeys.filter((targetKey) => !newMoveKeysMap.has(targetKey));
const oppositeDirection = direction2 === "right" ? "left" : "right";
direction2 === "right" ? sourceSelectedKeys.value = [] : targetSelectedKeys.value = [];
emit("update:targetKeys", newTargetKeys);
handleSelectChange(oppositeDirection, []);
emit("change", newTargetKeys, direction2, newMoveKeys);
formItemContext.onFieldChange();
};
const moveToLeft = () => {
moveTo("left");
};
const moveToRight = () => {
moveTo("right");
};
const onItemSelectAll = (direction2, selectedKeys) => {
handleSelectChange(direction2, selectedKeys);
};
const onLeftItemSelectAll = (selectedKeys) => {
return onItemSelectAll("left", selectedKeys);
};
const onRightItemSelectAll = (selectedKeys) => {
return onItemSelectAll("right", selectedKeys);
};
const handleSelectChange = (direction2, holder) => {
if (direction2 === "left") {
if (!props2.selectedKeys) {
sourceSelectedKeys.value = holder;
}
emit("update:selectedKeys", [...holder, ...targetSelectedKeys.value]);
emit("selectChange", holder, toRaw(targetSelectedKeys.value));
} else {
if (!props2.selectedKeys) {
targetSelectedKeys.value = holder;
}
emit("update:selectedKeys", [...holder, ...sourceSelectedKeys.value]);
emit("selectChange", toRaw(sourceSelectedKeys.value), holder);
}
};
const handleFilter = (direction2, e) => {
const value = e.target.value;
emit("search", direction2, value);
};
const handleLeftFilter = (e) => {
handleFilter("left", e);
};
const handleRightFilter = (e) => {
handleFilter("right", e);
};
const handleClear = (direction2) => {
emit("search", direction2, "");
};
const handleLeftClear = () => {
handleClear("left");
};
const handleRightClear = () => {
handleClear("right");
};
const onItemSelect = (direction2, selectedKey, checked) => {
const holder = direction2 === "left" ? [...sourceSelectedKeys.value] : [...targetSelectedKeys.value];
const index2 = holder.indexOf(selectedKey);
if (index2 > -1) {
holder.splice(index2, 1);
}
if (checked) {
holder.push(selectedKey);
}
handleSelectChange(direction2, holder);
};
const onLeftItemSelect = (selectedKey, checked) => {
return onItemSelect("left", selectedKey, checked);
};
const onRightItemSelect = (selectedKey, checked) => {
return onItemSelect("right", selectedKey, checked);
};
const onRightItemRemove = (targetedKeys) => {
const {
targetKeys = []
} = props2;
const newTargetKeys = targetKeys.filter((key2) => !targetedKeys.includes(key2));
emit("update:targetKeys", newTargetKeys);
emit("change", newTargetKeys, "left", [...targetedKeys]);
};
const handleScroll = (direction2, e) => {
emit("scroll", direction2, e);
};
const handleLeftScroll = (e) => {
handleScroll("left", e);
};
const handleRightScroll = (e) => {
handleScroll("right", e);
};
const handleListStyle = (listStyle, direction2) => {
if (typeof listStyle === "function") {
return listStyle({
direction: direction2
});
}
return listStyle;
};
const leftDataSource = ref([]);
const rightDataSource = ref([]);
watchEffect(() => {
const {
dataSource,
rowKey,
targetKeys = []
} = props2;
const ld = [];
const rd = new Array(targetKeys.length);
const targetKeysMap = groupKeysMap(targetKeys);
dataSource.forEach((record) => {
if (rowKey) {
record.key = rowKey(record);
}
if (targetKeysMap.has(record.key)) {
rd[targetKeysMap.get(record.key)] = record;
} else {
ld.push(record);
}
});
leftDataSource.value = ld;
rightDataSource.value = rd;
});
expose({
handleSelectChange
});
const renderTransfer = (transferLocale) => {
var _a, _b, _c, _d, _e, _f;
const {
disabled,
operations = [],
showSearch,
listStyle,
operationStyle,
filterOption: filterOption2,
showSelectAll,
selectAllLabels = [],
oneWay,
pagination,
id = formItemContext.id.value
} = props2;
const {
class: className,
style
} = attrs;
const children = slots.children;
const mergedPagination = !children && pagination;
const renderEmpty2 = configProvider.renderEmpty;
const locale2 = getLocale(transferLocale, renderEmpty2);
const {
footer
} = slots;
const renderItem = props2.render || slots.render;
const leftActive = targetSelectedKeys.value.length > 0;
const rightActive = sourceSelectedKeys.value.length > 0;
const cls = classNames(prefixCls.value, className, {
[`${prefixCls.value}-disabled`]: disabled,
[`${prefixCls.value}-customize-list`]: !!children,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, getStatusClassNames(prefixCls.value, mergedStatus.value, formItemInputContext.hasFeedback), hashId.value);
const titles = props2.titles;
const leftTitle = (_c = (_a = titles && titles[0]) !== null && _a !== void 0 ? _a : (_b = slots.leftTitle) === null || _b === void 0 ? void 0 : _b.call(slots)) !== null && _c !== void 0 ? _c : (locale2.titles || ["", ""])[0];
const rightTitle = (_f = (_d = titles && titles[1]) !== null && _d !== void 0 ? _d : (_e = slots.rightTitle) === null || _e === void 0 ? void 0 : _e.call(slots)) !== null && _f !== void 0 ? _f : (locale2.titles || ["", ""])[1];
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": cls,
"style": style,
"id": id
}), [createVNode(List, _objectSpread$W({
"key": "leftList",
"prefixCls": `${prefixCls.value}-list`,
"dataSource": leftDataSource.value,
"filterOption": filterOption2,
"style": handleListStyle(listStyle, "left"),
"checkedKeys": sourceSelectedKeys.value,
"handleFilter": handleLeftFilter,
"handleClear": handleLeftClear,
"onItemSelect": onLeftItemSelect,
"onItemSelectAll": onLeftItemSelectAll,
"renderItem": renderItem,
"showSearch": showSearch,
"renderList": children,
"onScroll": handleLeftScroll,
"disabled": disabled,
"direction": direction.value === "rtl" ? "right" : "left",
"showSelectAll": showSelectAll,
"selectAllLabel": selectAllLabels[0] || slots.leftSelectAllLabel,
"pagination": mergedPagination
}, locale2), {
titleText: () => leftTitle,
footer
}), createVNode(Operation, {
"key": "operation",
"class": `${prefixCls.value}-operation`,
"rightActive": rightActive,
"rightArrowText": operations[0],
"moveToRight": moveToRight,
"leftActive": leftActive,
"leftArrowText": operations[1],
"moveToLeft": moveToLeft,
"style": operationStyle,
"disabled": disabled,
"direction": direction.value,
"oneWay": oneWay
}, null), createVNode(List, _objectSpread$W({
"key": "rightList",
"prefixCls": `${prefixCls.value}-list`,
"dataSource": rightDataSource.value,
"filterOption": filterOption2,
"style": handleListStyle(listStyle, "right"),
"checkedKeys": targetSelectedKeys.value,
"handleFilter": handleRightFilter,
"handleClear": handleRightClear,
"onItemSelect": onRightItemSelect,
"onItemSelectAll": onRightItemSelectAll,
"onItemRemove": onRightItemRemove,
"renderItem": renderItem,
"showSearch": showSearch,
"renderList": children,
"onScroll": handleRightScroll,
"disabled": disabled,
"direction": direction.value === "rtl" ? "left" : "right",
"showSelectAll": showSelectAll,
"selectAllLabel": selectAllLabels[1] || slots.rightSelectAllLabel,
"showRemove": oneWay,
"pagination": mergedPagination
}, locale2), {
titleText: () => rightTitle,
footer
})]);
};
return () => wrapSSR(createVNode(LocaleReceiver, {
"componentName": "Transfer",
"defaultLocale": localeValues.Transfer,
"children": renderTransfer
}, null));
}
});
const index$8 = withInstall(Transfer);
function toArray(value) {
if (Array.isArray(value)) {
return value;
}
return value !== void 0 ? [value] : [];
}
function fillFieldNames(fieldNames) {
const {
label,
value,
children
} = fieldNames || {};
const mergedValue = value || "value";
return {
_title: label ? [label] : ["title", "label"],
value: mergedValue,
key: mergedValue,
children: children || "children"
};
}
function isCheckDisabled(node) {
return node.disabled || node.disableCheckbox || node.checkable === false;
}
function getAllKeys(treeData, fieldNames) {
const keys = [];
function dig(list) {
list.forEach((item) => {
keys.push(item[fieldNames.value]);
const children = item[fieldNames.children];
if (children) {
dig(children);
}
});
}
dig(treeData);
return keys;
}
function isNil(val) {
return val === null || val === void 0;
}
const TreeSelectContextPropsKey = Symbol("TreeSelectContextPropsKey");
function useProvideSelectContext(props2) {
return provide(TreeSelectContextPropsKey, props2);
}
function useInjectSelectContext() {
return inject(TreeSelectContextPropsKey, {});
}
const HIDDEN_STYLE = {
width: 0,
height: 0,
display: "flex",
overflow: "hidden",
opacity: 0,
border: 0,
padding: 0,
margin: 0
};
const OptionList = defineComponent({
compatConfig: {
MODE: 3
},
name: "OptionList",
inheritAttrs: false,
setup(_, _ref) {
let {
slots,
expose
} = _ref;
const baseProps2 = useBaseProps();
const legacyContext = useInjectLegacySelectContext();
const context2 = useInjectSelectContext();
const treeRef = ref();
const memoTreeData = useMemo(() => context2.treeData, [() => baseProps2.open, () => context2.treeData], (next) => next[0]);
const mergedCheckedKeys = computed(() => {
const {
checkable,
halfCheckedKeys,
checkedKeys
} = legacyContext;
if (!checkable) {
return null;
}
return {
checked: checkedKeys,
halfChecked: halfCheckedKeys
};
});
watch(() => baseProps2.open, () => {
nextTick(() => {
var _a;
if (baseProps2.open && !baseProps2.multiple && legacyContext.checkedKeys.length) {
(_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo({
key: legacyContext.checkedKeys[0]
});
}
});
}, {
immediate: true,
flush: "post"
});
const lowerSearchValue = computed(() => String(baseProps2.searchValue).toLowerCase());
const filterTreeNode = (treeNode) => {
if (!lowerSearchValue.value) {
return false;
}
return String(treeNode[legacyContext.treeNodeFilterProp]).toLowerCase().includes(lowerSearchValue.value);
};
const expandedKeys = shallowRef(legacyContext.treeDefaultExpandedKeys);
const searchExpandedKeys = shallowRef(null);
watch(() => baseProps2.searchValue, () => {
if (baseProps2.searchValue) {
searchExpandedKeys.value = getAllKeys(toRaw(context2.treeData), toRaw(context2.fieldNames));
}
}, {
immediate: true
});
const mergedExpandedKeys = computed(() => {
if (legacyContext.treeExpandedKeys) {
return legacyContext.treeExpandedKeys.slice();
}
return baseProps2.searchValue ? searchExpandedKeys.value : expandedKeys.value;
});
const onInternalExpand = (keys) => {
var _a;
expandedKeys.value = keys;
searchExpandedKeys.value = keys;
(_a = legacyContext.onTreeExpand) === null || _a === void 0 ? void 0 : _a.call(legacyContext, keys);
};
const onListMouseDown = (event) => {
event.preventDefault();
};
const onInternalSelect = (_2, _ref2) => {
let {
node
} = _ref2;
var _a, _b;
const {
checkable,
checkedKeys
} = legacyContext;
if (checkable && isCheckDisabled(node)) {
return;
}
(_a = context2.onSelect) === null || _a === void 0 ? void 0 : _a.call(context2, node.key, {
selected: !checkedKeys.includes(node.key)
});
if (!baseProps2.multiple) {
(_b = baseProps2.toggleOpen) === null || _b === void 0 ? void 0 : _b.call(baseProps2, false);
}
};
const activeKey = ref(null);
const activeEntity = computed(() => legacyContext.keyEntities[activeKey.value]);
const setActiveKey = (key2) => {
activeKey.value = key2;
};
expose({
scrollTo: function() {
var _a, _b;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return (_b = (_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo) === null || _b === void 0 ? void 0 : _b.call(_a, ...args);
},
onKeydown: (event) => {
var _a;
const {
which
} = event;
switch (which) {
// >>> Arrow keys
case KeyCode.UP:
case KeyCode.DOWN:
case KeyCode.LEFT:
case KeyCode.RIGHT:
(_a = treeRef.value) === null || _a === void 0 ? void 0 : _a.onKeydown(event);
break;
// >>> Select item
case KeyCode.ENTER: {
if (activeEntity.value) {
const {
selectable,
value
} = activeEntity.value.node || {};
if (selectable !== false) {
onInternalSelect(null, {
node: {
key: activeKey.value
},
selected: !legacyContext.checkedKeys.includes(value)
});
}
}
break;
}
// >>> Close
case KeyCode.ESC: {
baseProps2.toggleOpen(false);
}
}
},
onKeyup: () => {
}
});
return () => {
var _a;
const {
prefixCls,
multiple,
searchValue,
open: open2,
notFoundContent = (_a = slots.notFoundContent) === null || _a === void 0 ? void 0 : _a.call(slots)
} = baseProps2;
const {
listHeight,
listItemHeight,
virtual,
dropdownMatchSelectWidth,
treeExpandAction
} = context2;
const {
checkable,
treeDefaultExpandAll,
treeIcon,
showTreeIcon,
switcherIcon,
treeLine,
loadData,
treeLoadedKeys,
treeMotion,
onTreeLoad,
checkedKeys
} = legacyContext;
if (memoTreeData.value.length === 0) {
return createVNode("div", {
"role": "listbox",
"class": `${prefixCls}-empty`,
"onMousedown": onListMouseDown
}, [notFoundContent]);
}
const treeProps2 = {
fieldNames: context2.fieldNames
};
if (treeLoadedKeys) {
treeProps2.loadedKeys = treeLoadedKeys;
}
if (mergedExpandedKeys.value) {
treeProps2.expandedKeys = mergedExpandedKeys.value;
}
return createVNode("div", {
"onMousedown": onListMouseDown
}, [activeEntity.value && open2 && createVNode("span", {
"style": HIDDEN_STYLE,
"aria-live": "assertive"
}, [activeEntity.value.node.value]), createVNode(Tree$2, _objectSpread$W(_objectSpread$W({
"ref": treeRef,
"focusable": false,
"prefixCls": `${prefixCls}-tree`,
"treeData": memoTreeData.value,
"height": listHeight,
"itemHeight": listItemHeight,
"virtual": virtual !== false && dropdownMatchSelectWidth !== false,
"multiple": multiple,
"icon": treeIcon,
"showIcon": showTreeIcon,
"switcherIcon": switcherIcon,
"showLine": treeLine,
"loadData": searchValue ? null : loadData,
"motion": treeMotion,
"activeKey": activeKey.value,
"checkable": checkable,
"checkStrictly": true,
"checkedKeys": mergedCheckedKeys.value,
"selectedKeys": !checkable ? checkedKeys : [],
"defaultExpandAll": treeDefaultExpandAll
}, treeProps2), {}, {
"onActiveChange": setActiveKey,
"onSelect": onInternalSelect,
"onCheck": onInternalSelect,
"onExpand": onInternalExpand,
"onLoad": onTreeLoad,
"filterTreeNode": filterTreeNode,
"expandAction": treeExpandAction
}), _extends(_extends({}, slots), {
checkable: legacyContext.customSlots.treeCheckable
}))]);
};
}
});
const SHOW_ALL = "SHOW_ALL";
const SHOW_PARENT = "SHOW_PARENT";
const SHOW_CHILD = "SHOW_CHILD";
function formatStrategyValues(values, strategy, keyEntities, fieldNames) {
const valueSet = new Set(values);
if (strategy === SHOW_CHILD) {
return values.filter((key2) => {
const entity = keyEntities[key2];
if (entity && entity.children && entity.children.some((_ref) => {
let {
node
} = _ref;
return valueSet.has(node[fieldNames.value]);
}) && entity.children.every((_ref2) => {
let {
node
} = _ref2;
return isCheckDisabled(node) || valueSet.has(node[fieldNames.value]);
})) {
return false;
}
return true;
});
}
if (strategy === SHOW_PARENT) {
return values.filter((key2) => {
const entity = keyEntities[key2];
const parent = entity ? entity.parent : null;
if (parent && !isCheckDisabled(parent.node) && valueSet.has(parent.key)) {
return false;
}
return true;
});
}
return values;
}
const TreeNode = () => null;
TreeNode.inheritAttrs = false;
TreeNode.displayName = "ATreeSelectNode";
TreeNode.isTreeSelectNode = true;
var __rest$b = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function isTreeSelectNode(node) {
return node && node.type && node.type.isTreeSelectNode;
}
function convertChildrenToData(rootNodes) {
function dig() {
let treeNodes = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
return filterEmpty(treeNodes).map((treeNode) => {
var _a, _b, _c;
if (!isTreeSelectNode(treeNode)) {
return null;
}
const slots = treeNode.children || {};
const key2 = treeNode.key;
const props2 = {};
for (const [k, v] of Object.entries(treeNode.props)) {
props2[camelize(k)] = v;
}
const {
isLeaf: isLeaf2,
checkable,
selectable,
disabled,
disableCheckbox
} = props2;
const newProps = {
isLeaf: isLeaf2 || isLeaf2 === "" || void 0,
checkable: checkable || checkable === "" || void 0,
selectable: selectable || selectable === "" || void 0,
disabled: disabled || disabled === "" || void 0,
disableCheckbox: disableCheckbox || disableCheckbox === "" || void 0
};
const slotsProps = _extends(_extends({}, props2), newProps);
const {
title = (_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots, slotsProps),
switcherIcon = (_b = slots.switcherIcon) === null || _b === void 0 ? void 0 : _b.call(slots, slotsProps)
} = props2, rest = __rest$b(props2, ["title", "switcherIcon"]);
const children = (_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots);
const dataNode = _extends(_extends(_extends({}, rest), {
title,
switcherIcon,
key: key2,
isLeaf: isLeaf2
}), newProps);
const parsedChildren = dig(children);
if (parsedChildren.length) {
dataNode.children = parsedChildren;
}
return dataNode;
});
}
return dig(rootNodes);
}
function fillLegacyProps(dataNode) {
if (!dataNode) {
return dataNode;
}
const cloneNode = _extends({}, dataNode);
if (!("props" in cloneNode)) {
Object.defineProperty(cloneNode, "props", {
get() {
return cloneNode;
}
});
}
return cloneNode;
}
function fillAdditionalInfo(extra, triggerValue, checkedValues, treeData, showPosition, fieldNames) {
let triggerNode = null;
let nodeList = null;
function generateMap() {
function dig(list) {
let level = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "0";
let parentIncluded = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
return list.map((option, index2) => {
const pos = `${level}-${index2}`;
const value = option[fieldNames.value];
const included = checkedValues.includes(value);
const children = dig(option[fieldNames.children] || [], pos, included);
const node = createVNode(TreeNode, option, {
default: () => [children.map((child) => child.node)]
});
if (triggerValue === value) {
triggerNode = node;
}
if (included) {
const checkedNode = {
pos,
node,
children
};
if (!parentIncluded) {
nodeList.push(checkedNode);
}
return checkedNode;
}
return null;
}).filter((node) => node);
}
if (!nodeList) {
nodeList = [];
dig(treeData);
nodeList.sort((_ref, _ref2) => {
let {
node: {
props: {
value: val1
}
}
} = _ref;
let {
node: {
props: {
value: val2
}
}
} = _ref2;
const index1 = checkedValues.indexOf(val1);
const index2 = checkedValues.indexOf(val2);
return index1 - index2;
});
}
}
Object.defineProperty(extra, "triggerNode", {
get() {
generateMap();
return triggerNode;
}
});
Object.defineProperty(extra, "allCheckedNodes", {
get() {
generateMap();
if (showPosition) {
return nodeList;
}
return nodeList.map((_ref3) => {
let {
node
} = _ref3;
return node;
});
}
});
}
function parseSimpleTreeData(treeData, _ref) {
let {
id,
pId,
rootPId
} = _ref;
const keyNodes = {};
const rootNodeList = [];
const nodeList = treeData.map((node) => {
const clone = _extends({}, node);
const key2 = clone[id];
keyNodes[key2] = clone;
clone.key = clone.key || key2;
return clone;
});
nodeList.forEach((node) => {
const parentKey = node[pId];
const parent = keyNodes[parentKey];
if (parent) {
parent.children = parent.children || [];
parent.children.push(node);
}
if (parentKey === rootPId || !parent && rootPId === null) {
rootNodeList.push(node);
}
});
return rootNodeList;
}
function useTreeData(treeData, children, simpleMode) {
const mergedTreeData = shallowRef();
watch([simpleMode, treeData, children], () => {
const simpleModeValue = simpleMode.value;
if (treeData.value) {
mergedTreeData.value = simpleMode.value ? parseSimpleTreeData(toRaw(treeData.value), _extends({
id: "id",
pId: "pId",
rootPId: null
}, simpleModeValue !== true ? simpleModeValue : {})) : toRaw(treeData.value).slice();
} else {
mergedTreeData.value = convertChildrenToData(toRaw(children.value));
}
}, {
immediate: true,
deep: true
});
return mergedTreeData;
}
const useCache = ((values) => {
const cacheRef = shallowRef({
valueLabels: /* @__PURE__ */ new Map()
});
const mergedValues = shallowRef();
watch(values, () => {
mergedValues.value = toRaw(values.value);
}, {
immediate: true
});
const newFilledValues = computed(() => {
const {
valueLabels
} = cacheRef.value;
const valueLabelsCache = /* @__PURE__ */ new Map();
const filledValues = mergedValues.value.map((item) => {
var _a;
const {
value
} = item;
const mergedLabel = (_a = item.label) !== null && _a !== void 0 ? _a : valueLabels.get(value);
valueLabelsCache.set(value, mergedLabel);
return _extends(_extends({}, item), {
label: mergedLabel
});
});
cacheRef.value.valueLabels = valueLabelsCache;
return filledValues;
});
return [newFilledValues];
});
const useDataEntities = ((treeData, fieldNames) => {
const valueEntities = shallowRef(/* @__PURE__ */ new Map());
const keyEntities = shallowRef({});
watchEffect(() => {
const fieldNamesValue = fieldNames.value;
const collection = convertDataToEntities(treeData.value, {
fieldNames: fieldNamesValue,
initWrapper: (wrapper) => _extends(_extends({}, wrapper), {
valueEntities: /* @__PURE__ */ new Map()
}),
processEntity: (entity, wrapper) => {
const val = entity.node[fieldNamesValue.value];
wrapper.valueEntities.set(val, entity);
}
});
valueEntities.value = collection.valueEntities;
keyEntities.value = collection.keyEntities;
});
return {
valueEntities,
keyEntities
};
});
const useCheckedKeys = ((rawLabeledValues, rawHalfCheckedValues, treeConduction, keyEntities, maxLevel, levelEntities) => {
const newRawCheckedValues = shallowRef([]);
const newRawHalfCheckedValues = shallowRef([]);
watchEffect(() => {
let checkedKeys = rawLabeledValues.value.map((_ref) => {
let {
value
} = _ref;
return value;
});
let halfCheckedKeys = rawHalfCheckedValues.value.map((_ref2) => {
let {
value
} = _ref2;
return value;
});
const missingValues = checkedKeys.filter((key2) => !keyEntities.value[key2]);
if (treeConduction.value) {
({
checkedKeys,
halfCheckedKeys
} = conductCheck(checkedKeys, true, keyEntities.value, maxLevel.value, levelEntities.value));
}
newRawCheckedValues.value = Array.from(/* @__PURE__ */ new Set([...missingValues, ...checkedKeys]));
newRawHalfCheckedValues.value = halfCheckedKeys;
});
return [newRawCheckedValues, newRawHalfCheckedValues];
});
const useFilterTreeData = ((treeData, searchValue, _ref) => {
let {
treeNodeFilterProp,
filterTreeNode,
fieldNames
} = _ref;
return computed(() => {
const {
children: fieldChildren
} = fieldNames.value;
const searchValueVal = searchValue.value;
const treeNodeFilterPropValue = treeNodeFilterProp === null || treeNodeFilterProp === void 0 ? void 0 : treeNodeFilterProp.value;
if (!searchValueVal || filterTreeNode.value === false) {
return treeData.value;
}
let filterOptionFunc;
if (typeof filterTreeNode.value === "function") {
filterOptionFunc = filterTreeNode.value;
} else {
const upperStr = searchValueVal.toUpperCase();
filterOptionFunc = (_, dataNode) => {
const value = dataNode[treeNodeFilterPropValue];
return String(value).toUpperCase().includes(upperStr);
};
}
function dig(list) {
let keepAll = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
const res = [];
for (let index2 = 0, len = list.length; index2 < len; index2++) {
const dataNode = list[index2];
const children = dataNode[fieldChildren];
const match2 = keepAll || filterOptionFunc(searchValueVal, fillLegacyProps(dataNode));
const childList = dig(children || [], match2);
if (match2 || childList.length) {
res.push(_extends(_extends({}, dataNode), {
[fieldChildren]: childList
}));
}
}
return res;
}
return dig(treeData.value);
});
});
function treeSelectProps$1() {
return _extends(_extends({}, omit(baseSelectPropsWithoutPrivate(), ["mode"])), {
prefixCls: String,
id: String,
value: {
type: [String, Number, Object, Array]
},
defaultValue: {
type: [String, Number, Object, Array]
},
onChange: {
type: Function
},
searchValue: String,
/** @deprecated Use `searchValue` instead */
inputValue: String,
onSearch: {
type: Function
},
autoClearSearchValue: {
type: Boolean,
default: void 0
},
filterTreeNode: {
type: [Boolean, Function],
default: void 0
},
treeNodeFilterProp: String,
// >>> Select
onSelect: Function,
onDeselect: Function,
showCheckedStrategy: {
type: String
},
treeNodeLabelProp: String,
fieldNames: {
type: Object
},
// >>> Mode
multiple: {
type: Boolean,
default: void 0
},
treeCheckable: {
type: Boolean,
default: void 0
},
treeCheckStrictly: {
type: Boolean,
default: void 0
},
labelInValue: {
type: Boolean,
default: void 0
},
// >>> Data
treeData: {
type: Array
},
treeDataSimpleMode: {
type: [Boolean, Object],
default: void 0
},
loadData: {
type: Function
},
treeLoadedKeys: {
type: Array
},
onTreeLoad: {
type: Function
},
// >>> Expanded
treeDefaultExpandAll: {
type: Boolean,
default: void 0
},
treeExpandedKeys: {
type: Array
},
treeDefaultExpandedKeys: {
type: Array
},
onTreeExpand: {
type: Function
},
// >>> Options
virtual: {
type: Boolean,
default: void 0
},
listHeight: Number,
listItemHeight: Number,
onDropdownVisibleChange: {
type: Function
},
// >>> Tree
treeLine: {
type: [Boolean, Object],
default: void 0
},
treeIcon: PropTypes.any,
showTreeIcon: {
type: Boolean,
default: void 0
},
switcherIcon: PropTypes.any,
treeMotion: PropTypes.any,
children: Array,
treeExpandAction: String,
showArrow: {
type: Boolean,
default: void 0
},
showSearch: {
type: Boolean,
default: void 0
},
open: {
type: Boolean,
default: void 0
},
defaultOpen: {
type: Boolean,
default: void 0
},
disabled: {
type: Boolean,
default: void 0
},
placeholder: PropTypes.any,
maxTagPlaceholder: {
type: Function
},
dropdownPopupAlign: PropTypes.any,
customSlots: Object
});
}
function isRawValue(value) {
return !value || typeof value !== "object";
}
const TreeSelect$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "TreeSelect",
inheritAttrs: false,
props: initDefaultProps(treeSelectProps$1(), {
treeNodeFilterProp: "value",
autoClearSearchValue: true,
showCheckedStrategy: SHOW_CHILD,
listHeight: 200,
listItemHeight: 20,
prefixCls: "vc-tree-select"
}),
setup(props2, _ref) {
let {
attrs,
expose,
slots
} = _ref;
const mergedId = useId$1(toRef(props2, "id"));
const treeConduction = computed(() => props2.treeCheckable && !props2.treeCheckStrictly);
const mergedCheckable = computed(() => props2.treeCheckable || props2.treeCheckStrictly);
const mergedLabelInValue = computed(() => props2.treeCheckStrictly || props2.labelInValue);
const mergedMultiple = computed(() => mergedCheckable.value || props2.multiple);
const mergedFieldNames = computed(() => fillFieldNames(props2.fieldNames));
const [mergedSearchValue, setSearchValue] = useMergedState("", {
value: computed(() => props2.searchValue !== void 0 ? props2.searchValue : props2.inputValue),
postState: (search) => search || ""
});
const onInternalSearch = (searchText) => {
var _a;
setSearchValue(searchText);
(_a = props2.onSearch) === null || _a === void 0 ? void 0 : _a.call(props2, searchText);
};
const mergedTreeData = useTreeData(toRef(props2, "treeData"), toRef(props2, "children"), toRef(props2, "treeDataSimpleMode"));
const {
keyEntities,
valueEntities
} = useDataEntities(mergedTreeData, mergedFieldNames);
const splitRawValues = (newRawValues) => {
const missingRawValues = [];
const existRawValues = [];
newRawValues.forEach((val) => {
if (valueEntities.value.has(val)) {
existRawValues.push(val);
} else {
missingRawValues.push(val);
}
});
return {
missingRawValues,
existRawValues
};
};
const filteredTreeData = useFilterTreeData(mergedTreeData, mergedSearchValue, {
fieldNames: mergedFieldNames,
treeNodeFilterProp: toRef(props2, "treeNodeFilterProp"),
filterTreeNode: toRef(props2, "filterTreeNode")
});
const getLabel = (item) => {
if (item) {
if (props2.treeNodeLabelProp) {
return item[props2.treeNodeLabelProp];
}
const {
_title: titleList
} = mergedFieldNames.value;
for (let i = 0; i < titleList.length; i += 1) {
const title = item[titleList[i]];
if (title !== void 0) {
return title;
}
}
}
};
const toLabeledValues = (draftValues) => {
const values = toArray(draftValues);
return values.map((val) => {
if (isRawValue(val)) {
return {
value: val
};
}
return val;
});
};
const convert2LabelValues = (draftValues) => {
const values = toLabeledValues(draftValues);
return values.map((item) => {
let {
label: rawLabel
} = item;
const {
value: rawValue,
halfChecked: rawHalfChecked
} = item;
let rawDisabled;
const entity = valueEntities.value.get(rawValue);
if (entity) {
rawLabel = rawLabel !== null && rawLabel !== void 0 ? rawLabel : getLabel(entity.node);
rawDisabled = entity.node.disabled;
}
return {
label: rawLabel,
value: rawValue,
halfChecked: rawHalfChecked,
disabled: rawDisabled
};
});
};
const [internalValue, setInternalValue] = useMergedState(props2.defaultValue, {
value: toRef(props2, "value")
});
const rawMixedLabeledValues = computed(() => toLabeledValues(internalValue.value));
const rawLabeledValues = shallowRef([]);
const rawHalfLabeledValues = shallowRef([]);
watchEffect(() => {
const fullCheckValues = [];
const halfCheckValues = [];
rawMixedLabeledValues.value.forEach((item) => {
if (item.halfChecked) {
halfCheckValues.push(item);
} else {
fullCheckValues.push(item);
}
});
rawLabeledValues.value = fullCheckValues;
rawHalfLabeledValues.value = halfCheckValues;
});
const rawValues = computed(() => rawLabeledValues.value.map((item) => item.value));
const {
maxLevel,
levelEntities
} = useMaxLevel(keyEntities);
const [rawCheckedValues, rawHalfCheckedValues] = useCheckedKeys(rawLabeledValues, rawHalfLabeledValues, treeConduction, keyEntities, maxLevel, levelEntities);
const displayValues = computed(() => {
const displayKeys = formatStrategyValues(rawCheckedValues.value, props2.showCheckedStrategy, keyEntities.value, mergedFieldNames.value);
const values = displayKeys.map((key2) => {
var _a, _b, _c;
return (_c = (_b = (_a = keyEntities.value[key2]) === null || _a === void 0 ? void 0 : _a.node) === null || _b === void 0 ? void 0 : _b[mergedFieldNames.value.value]) !== null && _c !== void 0 ? _c : key2;
});
const labeledValues = values.map((val) => {
const targetItem = rawLabeledValues.value.find((item) => item.value === val);
return {
value: val,
label: targetItem === null || targetItem === void 0 ? void 0 : targetItem.label
};
});
const rawDisplayValues = convert2LabelValues(labeledValues);
const firstVal = rawDisplayValues[0];
if (!mergedMultiple.value && firstVal && isNil(firstVal.value) && isNil(firstVal.label)) {
return [];
}
return rawDisplayValues.map((item) => {
var _a;
return _extends(_extends({}, item), {
label: (_a = item.label) !== null && _a !== void 0 ? _a : item.value
});
});
});
const [cachedDisplayValues] = useCache(displayValues);
const triggerChange = (newRawValues, extra, source) => {
const labeledValues = convert2LabelValues(newRawValues);
setInternalValue(labeledValues);
if (props2.autoClearSearchValue) {
setSearchValue("");
}
if (props2.onChange) {
let eventValues = newRawValues;
if (treeConduction.value) {
const formattedKeyList = formatStrategyValues(newRawValues, props2.showCheckedStrategy, keyEntities.value, mergedFieldNames.value);
eventValues = formattedKeyList.map((key2) => {
const entity = valueEntities.value.get(key2);
return entity ? entity.node[mergedFieldNames.value.value] : key2;
});
}
const {
triggerValue,
selected
} = extra || {
triggerValue: void 0,
selected: void 0
};
let returnRawValues = eventValues;
if (props2.treeCheckStrictly) {
const halfValues = rawHalfLabeledValues.value.filter((item) => !eventValues.includes(item.value));
returnRawValues = [...returnRawValues, ...halfValues];
}
const returnLabeledValues = convert2LabelValues(returnRawValues);
const additionalInfo = {
// [Legacy] Always return as array contains label & value
preValue: rawLabeledValues.value,
triggerValue
};
let showPosition = true;
if (props2.treeCheckStrictly || source === "selection" && !selected) {
showPosition = false;
}
fillAdditionalInfo(additionalInfo, triggerValue, newRawValues, mergedTreeData.value, showPosition, mergedFieldNames.value);
if (mergedCheckable.value) {
additionalInfo.checked = selected;
} else {
additionalInfo.selected = selected;
}
const returnValues = mergedLabelInValue.value ? returnLabeledValues : returnLabeledValues.map((item) => item.value);
props2.onChange(mergedMultiple.value ? returnValues : returnValues[0], mergedLabelInValue.value ? null : returnLabeledValues.map((item) => item.label), additionalInfo);
}
};
const onOptionSelect = (selectedKey, _ref2) => {
let {
selected,
source
} = _ref2;
var _a, _b, _c;
const keyEntitiesValue = toRaw(keyEntities.value);
const valueEntitiesValue = toRaw(valueEntities.value);
const entity = keyEntitiesValue[selectedKey];
const node = entity === null || entity === void 0 ? void 0 : entity.node;
const selectedValue = (_a = node === null || node === void 0 ? void 0 : node[mergedFieldNames.value.value]) !== null && _a !== void 0 ? _a : selectedKey;
if (!mergedMultiple.value) {
triggerChange([selectedValue], {
selected: true,
triggerValue: selectedValue
}, "option");
} else {
let newRawValues = selected ? [...rawValues.value, selectedValue] : rawCheckedValues.value.filter((v) => v !== selectedValue);
if (treeConduction.value) {
const {
missingRawValues,
existRawValues
} = splitRawValues(newRawValues);
const keyList = existRawValues.map((val) => valueEntitiesValue.get(val).key);
let checkedKeys;
if (selected) {
({
checkedKeys
} = conductCheck(keyList, true, keyEntitiesValue, maxLevel.value, levelEntities.value));
} else {
({
checkedKeys
} = conductCheck(keyList, {
halfCheckedKeys: rawHalfCheckedValues.value
}, keyEntitiesValue, maxLevel.value, levelEntities.value));
}
newRawValues = [...missingRawValues, ...checkedKeys.map((key2) => keyEntitiesValue[key2].node[mergedFieldNames.value.value])];
}
triggerChange(newRawValues, {
selected,
triggerValue: selectedValue
}, source || "option");
}
if (selected || !mergedMultiple.value) {
(_b = props2.onSelect) === null || _b === void 0 ? void 0 : _b.call(props2, selectedValue, fillLegacyProps(node));
} else {
(_c = props2.onDeselect) === null || _c === void 0 ? void 0 : _c.call(props2, selectedValue, fillLegacyProps(node));
}
};
const onInternalDropdownVisibleChange = (open2) => {
if (props2.onDropdownVisibleChange) {
const legacyParam = {};
Object.defineProperty(legacyParam, "documentClickClose", {
get() {
return false;
}
});
props2.onDropdownVisibleChange(open2, legacyParam);
}
};
const onDisplayValuesChange = (newValues, info) => {
const newRawValues = newValues.map((item) => item.value);
if (info.type === "clear") {
triggerChange(newRawValues, {}, "selection");
return;
}
if (info.values.length) {
onOptionSelect(info.values[0].value, {
selected: false,
source: "selection"
});
}
};
const {
treeNodeFilterProp,
// Data
loadData,
treeLoadedKeys,
onTreeLoad,
// Expanded
treeDefaultExpandAll,
treeExpandedKeys,
treeDefaultExpandedKeys,
onTreeExpand,
// Options
virtual,
listHeight,
listItemHeight,
// Tree
treeLine,
treeIcon,
showTreeIcon,
switcherIcon,
treeMotion,
customSlots,
dropdownMatchSelectWidth,
treeExpandAction
} = toRefs(props2);
useProvideLegacySelectContext(toReactive({
checkable: mergedCheckable,
loadData,
treeLoadedKeys,
onTreeLoad,
checkedKeys: rawCheckedValues,
halfCheckedKeys: rawHalfCheckedValues,
treeDefaultExpandAll,
treeExpandedKeys,
treeDefaultExpandedKeys,
onTreeExpand,
treeIcon,
treeMotion,
showTreeIcon,
switcherIcon,
treeLine,
treeNodeFilterProp,
keyEntities,
customSlots
}));
useProvideSelectContext(toReactive({
virtual,
listHeight,
listItemHeight,
treeData: filteredTreeData,
fieldNames: mergedFieldNames,
onSelect: onOptionSelect,
dropdownMatchSelectWidth,
treeExpandAction
}));
const selectRef = ref();
expose({
focus() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur() {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.blur();
},
scrollTo(arg) {
var _a;
(_a = selectRef.value) === null || _a === void 0 ? void 0 : _a.scrollTo(arg);
}
});
return () => {
var _a;
const restProps = omit(props2, [
"id",
"prefixCls",
"customSlots",
// Value
"value",
"defaultValue",
"onChange",
"onSelect",
"onDeselect",
// Search
"searchValue",
"inputValue",
"onSearch",
"autoClearSearchValue",
"filterTreeNode",
"treeNodeFilterProp",
// Selector
"showCheckedStrategy",
"treeNodeLabelProp",
// Mode
"multiple",
"treeCheckable",
"treeCheckStrictly",
"labelInValue",
// FieldNames
"fieldNames",
// Data
"treeDataSimpleMode",
"treeData",
"children",
"loadData",
"treeLoadedKeys",
"onTreeLoad",
// Expanded
"treeDefaultExpandAll",
"treeExpandedKeys",
"treeDefaultExpandedKeys",
"onTreeExpand",
// Options
"virtual",
"listHeight",
"listItemHeight",
"onDropdownVisibleChange",
// Tree
"treeLine",
"treeIcon",
"showTreeIcon",
"switcherIcon",
"treeMotion"
]);
return createVNode(BaseSelect, _objectSpread$W(_objectSpread$W(_objectSpread$W({
"ref": selectRef
}, attrs), restProps), {}, {
"id": mergedId,
"prefixCls": props2.prefixCls,
"mode": mergedMultiple.value ? "multiple" : void 0,
"displayValues": cachedDisplayValues.value,
"onDisplayValuesChange": onDisplayValuesChange,
"searchValue": mergedSearchValue.value,
"onSearch": onInternalSearch,
"OptionList": OptionList,
"emptyOptions": !mergedTreeData.value.length,
"onDropdownVisibleChange": onInternalDropdownVisibleChange,
"tagRender": props2.tagRender || slots.tagRender,
"dropdownMatchSelectWidth": (_a = props2.dropdownMatchSelectWidth) !== null && _a !== void 0 ? _a : true
}), slots);
};
}
});
const genBaseStyle$3 = (token) => {
const {
componentCls,
treePrefixCls,
colorBgElevated
} = token;
const treeCls = `.${treePrefixCls}`;
return [
// ======================================================
// == Dropdown ==
// ======================================================
{
[`${componentCls}-dropdown`]: [
{
padding: `${token.paddingXS}px ${token.paddingXS / 2}px`
},
// ====================== Tree ======================
genTreeStyle(treePrefixCls, merge(token, {
colorBgContainer: colorBgElevated
})),
{
[treeCls]: {
borderRadius: 0,
"&-list-holder-inner": {
alignItems: "stretch",
[`${treeCls}-treenode`]: {
[`${treeCls}-node-content-wrapper`]: {
flex: "auto"
}
}
}
}
},
// ==================== Checkbox ====================
getStyle$2(`${treePrefixCls}-checkbox`, token),
// ====================== RTL =======================
{
"&-rtl": {
direction: "rtl",
[`${treeCls}-switcher${treeCls}-switcher_close`]: {
[`${treeCls}-switcher-icon svg`]: {
transform: "rotate(90deg)"
}
}
}
}
]
}
];
};
function useTreeSelectStyle(prefixCls, treePrefixCls) {
return genComponentStyleHook("TreeSelect", (token) => {
const treeSelectToken = merge(token, {
treePrefixCls: treePrefixCls.value
});
return [genBaseStyle$3(treeSelectToken)];
})(prefixCls);
}
const getTransitionName = (rootPrefixCls, motion, transitionName2) => {
if (transitionName2 !== void 0) {
return transitionName2;
}
return `${rootPrefixCls}-${motion}`;
};
function treeSelectProps() {
return _extends(_extends({}, omit(treeSelectProps$1(), ["showTreeIcon", "treeMotion", "inputIcon", "getInputElement", "treeLine", "customSlots"])), {
suffixIcon: PropTypes.any,
size: stringType(),
bordered: booleanType(),
treeLine: someType([Boolean, Object]),
replaceFields: objectType(),
placement: stringType(),
status: stringType(),
popupClassName: String,
/** @deprecated Please use `popupClassName` instead */
dropdownClassName: String,
"onUpdate:value": functionType(),
"onUpdate:treeExpandedKeys": functionType(),
"onUpdate:searchValue": functionType()
});
}
const TreeSelect = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATreeSelect",
inheritAttrs: false,
props: initDefaultProps(treeSelectProps(), {
choiceTransitionName: "",
listHeight: 256,
treeIcon: false,
listItemHeight: 26,
bordered: true
}),
slots: Object,
setup(props2, _ref) {
let {
attrs,
slots,
expose,
emit
} = _ref;
warning$1(!(props2.treeData === void 0 && slots.default));
devWarning(props2.multiple !== false || !props2.treeCheckable, "TreeSelect", "`multiple` will always be `true` when `treeCheckable` is true");
devWarning(props2.replaceFields === void 0, "TreeSelect", "`replaceFields` is deprecated, please use fieldNames instead");
devWarning(!props2.dropdownClassName, "TreeSelect", "`dropdownClassName` is deprecated. Please use `popupClassName` instead.");
const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject();
const mergedStatus = computed(() => getMergedStatus(formItemInputContext.status, props2.status));
const {
prefixCls,
renderEmpty: renderEmpty2,
direction,
virtual,
dropdownMatchSelectWidth,
size: contextSize,
getPopupContainer,
getPrefixCls,
disabled
} = useConfigInject("select", props2);
const {
compactSize,
compactItemClassnames
} = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => compactSize.value || contextSize.value);
const contextDisabled = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a;
return (_a = disabled.value) !== null && _a !== void 0 ? _a : contextDisabled.value;
});
const rootPrefixCls = computed(() => getPrefixCls());
const placement = computed(() => {
if (props2.placement !== void 0) {
return props2.placement;
}
return direction.value === "rtl" ? "bottomRight" : "bottomLeft";
});
const transitionName2 = computed(() => getTransitionName(rootPrefixCls.value, getTransitionDirection(placement.value), props2.transitionName));
const choiceTransitionName = computed(() => getTransitionName(rootPrefixCls.value, "", props2.choiceTransitionName));
const treePrefixCls = computed(() => getPrefixCls("select-tree", props2.prefixCls));
const treeSelectPrefixCls = computed(() => getPrefixCls("tree-select", props2.prefixCls));
const [wrapSelectSSR, hashId] = useSelectStyle(prefixCls);
const [wrapTreeSelectSSR] = useTreeSelectStyle(treeSelectPrefixCls, treePrefixCls);
const mergedDropdownClassName = computed(() => classNames(props2.popupClassName || props2.dropdownClassName, `${treeSelectPrefixCls.value}-dropdown`, {
[`${treeSelectPrefixCls.value}-dropdown-rtl`]: direction.value === "rtl"
}, hashId.value));
const isMultiple2 = computed(() => !!(props2.treeCheckable || props2.multiple));
const mergedShowArrow = computed(() => props2.showArrow !== void 0 ? props2.showArrow : props2.loading || !isMultiple2.value);
const treeSelectRef = ref();
expose({
focus() {
var _a, _b;
(_b = (_a = treeSelectRef.value).focus) === null || _b === void 0 ? void 0 : _b.call(_a);
},
blur() {
var _a, _b;
(_b = (_a = treeSelectRef.value).blur) === null || _b === void 0 ? void 0 : _b.call(_a);
}
});
const handleChange = function() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
emit("update:value", args[0]);
emit("change", ...args);
formItemContext.onFieldChange();
};
const handleTreeExpand = (keys) => {
emit("update:treeExpandedKeys", keys);
emit("treeExpand", keys);
};
const handleSearch = (value) => {
emit("update:searchValue", value);
emit("search", value);
};
const handleBlur = (e) => {
emit("blur", e);
formItemContext.onFieldBlur();
};
return () => {
var _a, _b, _c;
const {
notFoundContent = (_a = slots.notFoundContent) === null || _a === void 0 ? void 0 : _a.call(slots),
prefixCls: customizePrefixCls,
bordered,
listHeight,
listItemHeight,
multiple,
treeIcon,
treeLine,
showArrow,
switcherIcon = (_b = slots.switcherIcon) === null || _b === void 0 ? void 0 : _b.call(slots),
fieldNames = props2.replaceFields,
id = formItemContext.id.value,
placeholder = (_c = slots.placeholder) === null || _c === void 0 ? void 0 : _c.call(slots)
} = props2;
const {
isFormItemInput,
hasFeedback,
feedbackIcon
} = formItemInputContext;
const {
suffixIcon,
removeIcon,
clearIcon
} = getIcons(_extends(_extends({}, props2), {
multiple: isMultiple2.value,
showArrow: mergedShowArrow.value,
hasFeedback,
feedbackIcon,
prefixCls: prefixCls.value
}), slots);
let mergedNotFound;
if (notFoundContent !== void 0) {
mergedNotFound = notFoundContent;
} else {
mergedNotFound = renderEmpty2("Select");
}
const selectProps2 = omit(props2, ["suffixIcon", "itemIcon", "removeIcon", "clearIcon", "switcherIcon", "bordered", "status", "onUpdate:value", "onUpdate:treeExpandedKeys", "onUpdate:searchValue"]);
const mergedClassName = classNames(!customizePrefixCls && treeSelectPrefixCls.value, {
[`${prefixCls.value}-lg`]: mergedSize.value === "large",
[`${prefixCls.value}-sm`]: mergedSize.value === "small",
[`${prefixCls.value}-rtl`]: direction.value === "rtl",
[`${prefixCls.value}-borderless`]: !bordered,
[`${prefixCls.value}-in-form-item`]: isFormItemInput
}, getStatusClassNames(prefixCls.value, mergedStatus.value, hasFeedback), compactItemClassnames.value, attrs.class, hashId.value);
const otherProps = {};
if (props2.treeData === void 0 && slots.default) {
otherProps.children = flattenChildren(slots.default());
}
return wrapSelectSSR(wrapTreeSelectSSR(createVNode(TreeSelect$1, _objectSpread$W(_objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), selectProps2), {}, {
"disabled": mergedDisabled.value,
"virtual": virtual.value,
"dropdownMatchSelectWidth": dropdownMatchSelectWidth.value,
"id": id,
"fieldNames": fieldNames,
"ref": treeSelectRef,
"prefixCls": prefixCls.value,
"class": mergedClassName,
"listHeight": listHeight,
"listItemHeight": listItemHeight,
"treeLine": !!treeLine,
"inputIcon": suffixIcon,
"multiple": multiple,
"removeIcon": removeIcon,
"clearIcon": clearIcon,
"switcherIcon": (nodeProps) => renderSwitcherIcon(treePrefixCls.value, switcherIcon, nodeProps, slots.leafIcon, treeLine),
"showTreeIcon": treeIcon,
"notFoundContent": mergedNotFound,
"getPopupContainer": getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.value,
"treeMotion": null,
"dropdownClassName": mergedDropdownClassName.value,
"choiceTransitionName": choiceTransitionName.value,
"onChange": handleChange,
"onBlur": handleBlur,
"onSearch": handleSearch,
"onTreeExpand": handleTreeExpand
}, otherProps), {}, {
"transitionName": transitionName2.value,
"customSlots": _extends(_extends({}, slots), {
treeCheckable: () => createVNode("span", {
"class": `${prefixCls.value}-tree-checkbox-inner`
}, null)
}),
"maxTagPlaceholder": props2.maxTagPlaceholder || slots.maxTagPlaceholder,
"placement": placement.value,
"showArrow": hasFeedback || showArrow,
"placeholder": placeholder
}), _extends(_extends({}, slots), {
treeCheckable: () => createVNode("span", {
"class": `${prefixCls.value}-tree-checkbox-inner`
}, null)
}))));
};
}
});
const TreeSelectNode = TreeNode;
const index$7 = _extends(TreeSelect, {
TreeNode,
SHOW_ALL,
SHOW_PARENT,
SHOW_CHILD,
install: (app) => {
app.component(TreeSelect.name, TreeSelect);
app.component(TreeSelectNode.displayName, TreeSelectNode);
return app;
}
});
const timePickerProps = () => ({
format: String,
showNow: booleanType(),
showHour: booleanType(),
showMinute: booleanType(),
showSecond: booleanType(),
use12Hours: booleanType(),
hourStep: Number,
minuteStep: Number,
secondStep: Number,
hideDisabledOptions: booleanType(),
popupClassName: String,
status: stringType()
});
function createTimePicker(generateConfig2) {
const DatePicker2 = generatePicker(generateConfig2, _extends(_extends({}, timePickerProps()), {
order: {
type: Boolean,
default: true
}
}));
const {
TimePicker: InternalTimePicker,
RangePicker: InternalRangePicker
} = DatePicker2;
const TimePicker2 = defineComponent({
name: "ATimePicker",
inheritAttrs: false,
props: _extends(_extends(_extends(_extends({}, commonProps()), datePickerProps()), timePickerProps()), {
addon: {
type: Function
}
}),
slots: Object,
setup(p, _ref) {
let {
slots,
expose,
emit,
attrs
} = _ref;
const props2 = p;
const formItemContext = useInjectFormItemContext();
devWarning(!(slots.addon || props2.addon), "TimePicker", "`addon` is deprecated. Please use `v-slot:renderExtraFooter` instead.");
const pickerRef = ref();
expose({
focus: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.blur();
}
});
const onChange = (value, dateString) => {
emit("update:value", value);
emit("change", value, dateString);
formItemContext.onFieldChange();
};
const onOpenChange = (open2) => {
emit("update:open", open2);
emit("openChange", open2);
};
const onFocus = (e) => {
emit("focus", e);
};
const onBlur = (e) => {
emit("blur", e);
formItemContext.onFieldBlur();
};
const onOk = (value) => {
emit("ok", value);
};
return () => {
const {
id = formItemContext.id.value
} = props2;
return createVNode(InternalTimePicker, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), omit(props2, ["onUpdate:value", "onUpdate:open"])), {}, {
"id": id,
"dropdownClassName": props2.popupClassName,
"mode": void 0,
"ref": pickerRef,
"renderExtraFooter": props2.addon || slots.addon || props2.renderExtraFooter || slots.renderExtraFooter,
"onChange": onChange,
"onOpenChange": onOpenChange,
"onFocus": onFocus,
"onBlur": onBlur,
"onOk": onOk
}), slots);
};
}
});
const TimeRangePicker2 = defineComponent({
name: "ATimeRangePicker",
inheritAttrs: false,
props: _extends(_extends(_extends(_extends({}, commonProps()), rangePickerProps()), timePickerProps()), {
order: {
type: Boolean,
default: true
}
}),
slots: Object,
setup(p, _ref2) {
let {
slots,
expose,
emit,
attrs
} = _ref2;
const props2 = p;
const pickerRef = ref();
const formItemContext = useInjectFormItemContext();
expose({
focus: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.focus();
},
blur: () => {
var _a;
(_a = pickerRef.value) === null || _a === void 0 ? void 0 : _a.blur();
}
});
const onChange = (values, dateStrings) => {
emit("update:value", values);
emit("change", values, dateStrings);
formItemContext.onFieldChange();
};
const onOpenChange = (open2) => {
emit("update:open", open2);
emit("openChange", open2);
};
const onFocus = (e) => {
emit("focus", e);
};
const onBlur = (e) => {
emit("blur", e);
formItemContext.onFieldBlur();
};
const onPanelChange = (values, modes) => {
emit("panelChange", values, modes);
};
const onOk = (values) => {
emit("ok", values);
};
const onCalendarChange = (values, dateStrings, info) => {
emit("calendarChange", values, dateStrings, info);
};
return () => {
const {
id = formItemContext.id.value
} = props2;
return createVNode(InternalRangePicker, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), omit(props2, ["onUpdate:open", "onUpdate:value"])), {}, {
"id": id,
"dropdownClassName": props2.popupClassName,
"picker": "time",
"mode": void 0,
"ref": pickerRef,
"onChange": onChange,
"onOpenChange": onOpenChange,
"onFocus": onFocus,
"onBlur": onBlur,
"onPanelChange": onPanelChange,
"onOk": onOk,
"onCalendarChange": onCalendarChange
}), slots);
};
}
});
return {
TimePicker: TimePicker2,
TimeRangePicker: TimeRangePicker2
};
}
const {
TimePicker,
TimeRangePicker
} = createTimePicker(generateConfig);
const TimePicker$1 = _extends(TimePicker, {
TimePicker,
TimeRangePicker,
install: (app) => {
app.component(TimePicker.name, TimePicker);
app.component(TimeRangePicker.name, TimeRangePicker);
return app;
}
});
const timelineItemProps = () => ({
prefixCls: String,
color: String,
dot: PropTypes.any,
pending: booleanType(),
position: PropTypes.oneOf(tuple$1("left", "right", "")).def(""),
label: PropTypes.any
});
const TimelineItem = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATimelineItem",
props: initDefaultProps(timelineItemProps(), {
color: "blue",
pending: false
}),
slots: Object,
setup(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls
} = useConfigInject("timeline", props2);
const itemClassName = computed(() => ({
[`${prefixCls.value}-item`]: true,
[`${prefixCls.value}-item-pending`]: props2.pending
}));
const customColor = computed(() => /blue|red|green|gray/.test(props2.color || "") ? void 0 : props2.color || "blue");
const dotClassName = computed(() => ({
[`${prefixCls.value}-item-head`]: true,
[`${prefixCls.value}-item-head-${props2.color || "blue"}`]: !customColor.value
}));
return () => {
var _a, _b, _c;
const {
label = (_a = slots.label) === null || _a === void 0 ? void 0 : _a.call(slots),
dot = (_b = slots.dot) === null || _b === void 0 ? void 0 : _b.call(slots)
} = props2;
return createVNode("li", {
"class": itemClassName.value
}, [label && createVNode("div", {
"class": `${prefixCls.value}-item-label`
}, [label]), createVNode("div", {
"class": `${prefixCls.value}-item-tail`
}, null), createVNode("div", {
"class": [dotClassName.value, !!dot && `${prefixCls.value}-item-head-custom`],
"style": {
borderColor: customColor.value,
color: customColor.value
}
}, [dot]), createVNode("div", {
"class": `${prefixCls.value}-item-content`
}, [(_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots)])]);
};
}
});
const genTimelineStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
margin: 0,
padding: 0,
listStyle: "none",
[`${componentCls}-item`]: {
position: "relative",
margin: 0,
paddingBottom: token.timeLineItemPaddingBottom,
fontSize: token.fontSize,
listStyle: "none",
"&-tail": {
position: "absolute",
insetBlockStart: token.timeLineItemHeadSize,
insetInlineStart: (token.timeLineItemHeadSize - token.timeLineItemTailWidth) / 2,
height: `calc(100% - ${token.timeLineItemHeadSize}px)`,
borderInlineStart: `${token.timeLineItemTailWidth}px ${token.lineType} ${token.colorSplit}`
},
"&-pending": {
[`${componentCls}-item-head`]: {
fontSize: token.fontSizeSM,
backgroundColor: "transparent"
},
[`${componentCls}-item-tail`]: {
display: "none"
}
},
"&-head": {
position: "absolute",
width: token.timeLineItemHeadSize,
height: token.timeLineItemHeadSize,
backgroundColor: token.colorBgContainer,
border: `${token.timeLineHeadBorderWidth}px ${token.lineType} transparent`,
borderRadius: "50%",
"&-blue": {
color: token.colorPrimary,
borderColor: token.colorPrimary
},
"&-red": {
color: token.colorError,
borderColor: token.colorError
},
"&-green": {
color: token.colorSuccess,
borderColor: token.colorSuccess
},
"&-gray": {
color: token.colorTextDisabled,
borderColor: token.colorTextDisabled
}
},
"&-head-custom": {
position: "absolute",
insetBlockStart: token.timeLineItemHeadSize / 2,
insetInlineStart: token.timeLineItemHeadSize / 2,
width: "auto",
height: "auto",
marginBlockStart: 0,
paddingBlock: token.timeLineItemCustomHeadPaddingVertical,
lineHeight: 1,
textAlign: "center",
border: 0,
borderRadius: 0,
transform: `translate(-50%, -50%)`
},
"&-content": {
position: "relative",
insetBlockStart: -(token.fontSize * token.lineHeight - token.fontSize) + token.lineWidth,
marginInlineStart: token.margin + token.timeLineItemHeadSize,
marginInlineEnd: 0,
marginBlockStart: 0,
marginBlockEnd: 0,
wordBreak: "break-word"
},
"&-last": {
[`> ${componentCls}-item-tail`]: {
display: "none"
},
[`> ${componentCls}-item-content`]: {
minHeight: token.controlHeightLG * 1.2
}
}
},
[`&${componentCls}-alternate,
&${componentCls}-right,
&${componentCls}-label`]: {
[`${componentCls}-item`]: {
"&-tail, &-head, &-head-custom": {
insetInlineStart: "50%"
},
"&-head": {
marginInlineStart: `-${token.marginXXS}px`,
"&-custom": {
marginInlineStart: token.timeLineItemTailWidth / 2
}
},
"&-left": {
[`${componentCls}-item-content`]: {
insetInlineStart: `calc(50% - ${token.marginXXS}px)`,
width: `calc(50% - ${token.marginSM}px)`,
textAlign: "start"
}
},
"&-right": {
[`${componentCls}-item-content`]: {
width: `calc(50% - ${token.marginSM}px)`,
margin: 0,
textAlign: "end"
}
}
}
},
[`&${componentCls}-right`]: {
[`${componentCls}-item-right`]: {
[`${componentCls}-item-tail,
${componentCls}-item-head,
${componentCls}-item-head-custom`]: {
insetInlineStart: `calc(100% - ${(token.timeLineItemHeadSize + token.timeLineItemTailWidth) / 2}px)`
},
[`${componentCls}-item-content`]: {
width: `calc(100% - ${token.timeLineItemHeadSize + token.marginXS}px)`
}
}
},
[`&${componentCls}-pending
${componentCls}-item-last
${componentCls}-item-tail`]: {
display: "block",
height: `calc(100% - ${token.margin}px)`,
borderInlineStart: `${token.timeLineItemTailWidth}px dotted ${token.colorSplit}`
},
[`&${componentCls}-reverse
${componentCls}-item-last
${componentCls}-item-tail`]: {
display: "none"
},
[`&${componentCls}-reverse ${componentCls}-item-pending`]: {
[`${componentCls}-item-tail`]: {
insetBlockStart: token.margin,
display: "block",
height: `calc(100% - ${token.margin}px)`,
borderInlineStart: `${token.timeLineItemTailWidth}px dotted ${token.colorSplit}`
},
[`${componentCls}-item-content`]: {
minHeight: token.controlHeightLG * 1.2
}
},
[`&${componentCls}-label`]: {
[`${componentCls}-item-label`]: {
position: "absolute",
insetBlockStart: -(token.fontSize * token.lineHeight - token.fontSize) + token.timeLineItemTailWidth,
width: `calc(50% - ${token.marginSM}px)`,
textAlign: "end"
},
[`${componentCls}-item-right`]: {
[`${componentCls}-item-label`]: {
insetInlineStart: `calc(50% + ${token.marginSM}px)`,
width: `calc(50% - ${token.marginSM}px)`,
textAlign: "start"
}
}
},
// ====================== RTL =======================
"&-rtl": {
direction: "rtl",
[`${componentCls}-item-head-custom`]: {
transform: `translate(50%, -50%)`
}
}
})
};
};
const useStyle$7 = genComponentStyleHook("Timeline", (token) => {
const timeLineToken = merge(token, {
timeLineItemPaddingBottom: token.padding * 1.25,
timeLineItemHeadSize: 10,
timeLineItemCustomHeadPaddingVertical: token.paddingXXS,
timeLinePaddingInlineEnd: 2,
timeLineItemTailWidth: token.lineWidthBold,
timeLineHeadBorderWidth: token.wireframe ? token.lineWidthBold : token.lineWidth * 3
});
return [genTimelineStyle(timeLineToken)];
});
const timelineProps = () => ({
prefixCls: String,
/** 指定最后一个幽灵节点是否存在或内容 */
pending: PropTypes.any,
pendingDot: PropTypes.any,
reverse: booleanType(),
mode: PropTypes.oneOf(tuple$1("left", "alternate", "right", ""))
});
const Timeline = defineComponent({
compatConfig: {
MODE: 3
},
name: "ATimeline",
inheritAttrs: false,
props: initDefaultProps(timelineProps(), {
reverse: false,
mode: ""
}),
slots: Object,
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("timeline", props2);
const [wrapSSR, hashId] = useStyle$7(prefixCls);
const getPositionCls = (ele, idx) => {
const eleProps = ele.props || {};
if (props2.mode === "alternate") {
if (eleProps.position === "right") return `${prefixCls.value}-item-right`;
if (eleProps.position === "left") return `${prefixCls.value}-item-left`;
return idx % 2 === 0 ? `${prefixCls.value}-item-left` : `${prefixCls.value}-item-right`;
}
if (props2.mode === "left") return `${prefixCls.value}-item-left`;
if (props2.mode === "right") return `${prefixCls.value}-item-right`;
if (eleProps.position === "right") return `${prefixCls.value}-item-right`;
return "";
};
return () => {
var _a, _b, _c;
const {
pending = (_a = slots.pending) === null || _a === void 0 ? void 0 : _a.call(slots),
pendingDot = (_b = slots.pendingDot) === null || _b === void 0 ? void 0 : _b.call(slots),
reverse,
mode
} = props2;
const pendingNode = typeof pending === "boolean" ? null : pending;
const children = filterEmpty((_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots));
const pendingItem = pending ? createVNode(TimelineItem, {
"pending": !!pending,
"dot": pendingDot || createVNode(LoadingOutlined, null, null)
}, {
default: () => [pendingNode]
}) : null;
if (pendingItem) {
children.push(pendingItem);
}
const timeLineItems = reverse ? children.reverse() : children;
const itemsCount = timeLineItems.length;
const lastCls = `${prefixCls.value}-item-last`;
const items = timeLineItems.map((ele, idx) => {
const pendingClass = idx === itemsCount - 2 ? lastCls : "";
const readyClass = idx === itemsCount - 1 ? lastCls : "";
return cloneVNode(ele, {
class: classNames([!reverse && !!pending ? pendingClass : readyClass, getPositionCls(ele, idx)])
});
});
const hasLabelItem = timeLineItems.some((item) => {
var _a2, _b2;
return !!(((_a2 = item.props) === null || _a2 === void 0 ? void 0 : _a2.label) || ((_b2 = item.children) === null || _b2 === void 0 ? void 0 : _b2.label));
});
const classString = classNames(prefixCls.value, {
[`${prefixCls.value}-pending`]: !!pending,
[`${prefixCls.value}-reverse`]: !!reverse,
[`${prefixCls.value}-${mode}`]: !!mode && !hasLabelItem,
[`${prefixCls.value}-label`]: hasLabelItem,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value);
return wrapSSR(createVNode("ul", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classString
}), [items]));
};
}
});
Timeline.Item = TimelineItem;
Timeline.install = function(app) {
app.component(Timeline.name, Timeline);
app.component(TimelineItem.name, TimelineItem);
return app;
};
const getTitleStyle = (fontSize, lineHeight, color, token) => {
const {
sizeMarginHeadingVerticalEnd,
fontWeightStrong
} = token;
return {
marginBottom: sizeMarginHeadingVerticalEnd,
color,
fontWeight: fontWeightStrong,
fontSize,
lineHeight
};
};
const getTitleStyles = (token) => {
const headings = [1, 2, 3, 4, 5];
const styles = {};
headings.forEach((headingLevel) => {
styles[`
h${headingLevel}&,
div&-h${headingLevel},
div&-h${headingLevel} > textarea,
h${headingLevel}
`] = getTitleStyle(token[`fontSizeHeading${headingLevel}`], token[`lineHeightHeading${headingLevel}`], token.colorTextHeading, token);
});
return styles;
};
const getLinkStyles = (token) => {
const {
componentCls
} = token;
return {
"a&, a": _extends(_extends({}, operationUnit(token)), {
textDecoration: token.linkDecoration,
"&:active, &:hover": {
textDecoration: token.linkHoverDecoration
},
[`&[disabled], &${componentCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: "not-allowed",
"&:active, &:hover": {
color: token.colorTextDisabled
},
"&:active": {
pointerEvents: "none"
}
}
})
};
};
const getResetStyles = () => ({
code: {
margin: "0 0.2em",
paddingInline: "0.4em",
paddingBlock: "0.2em 0.1em",
fontSize: "85%",
background: "rgba(150, 150, 150, 0.1)",
border: "1px solid rgba(100, 100, 100, 0.2)",
borderRadius: 3
},
kbd: {
margin: "0 0.2em",
paddingInline: "0.4em",
paddingBlock: "0.15em 0.1em",
fontSize: "90%",
background: "rgba(150, 150, 150, 0.06)",
border: "1px solid rgba(100, 100, 100, 0.2)",
borderBottomWidth: 2,
borderRadius: 3
},
mark: {
padding: 0,
// FIXME hardcode in v4
backgroundColor: gold[2]
},
"u, ins": {
textDecoration: "underline",
textDecorationSkipInk: "auto"
},
"s, del": {
textDecoration: "line-through"
},
strong: {
fontWeight: 600
},
// list
"ul, ol": {
marginInline: 0,
marginBlock: "0 1em",
padding: 0,
li: {
marginInline: "20px 0",
marginBlock: 0,
paddingInline: "4px 0",
paddingBlock: 0
}
},
ul: {
listStyleType: "circle",
ul: {
listStyleType: "disc"
}
},
ol: {
listStyleType: "decimal"
},
// pre & block
"pre, blockquote": {
margin: "1em 0"
},
pre: {
padding: "0.4em 0.6em",
whiteSpace: "pre-wrap",
wordWrap: "break-word",
background: "rgba(150, 150, 150, 0.1)",
border: "1px solid rgba(100, 100, 100, 0.2)",
borderRadius: 3,
// Compatible for marked
code: {
display: "inline",
margin: 0,
padding: 0,
fontSize: "inherit",
fontFamily: "inherit",
background: "transparent",
border: 0
}
},
blockquote: {
paddingInline: "0.6em 0",
paddingBlock: 0,
borderInlineStart: "4px solid rgba(100, 100, 100, 0.2)",
opacity: 0.85
}
});
const getEditableStyles = (token) => {
const {
componentCls
} = token;
const inputToken = initInputToken(token);
const inputShift = inputToken.inputPaddingVertical + 1;
return {
"&-edit-content": {
position: "relative",
"div&": {
insetInlineStart: -token.paddingSM,
marginTop: -inputShift,
marginBottom: `calc(1em - ${inputShift}px)`
},
[`${componentCls}-edit-content-confirm`]: {
position: "absolute",
insetInlineEnd: token.marginXS + 2,
insetBlockEnd: token.marginXS,
color: token.colorTextDescription,
// default style
fontWeight: "normal",
fontSize: token.fontSize,
fontStyle: "normal",
pointerEvents: "none"
},
textarea: {
margin: "0!important",
// Fix Editable Textarea flash in Firefox
MozTransition: "none",
height: "1em"
}
}
};
};
const getCopiableStyles = (token) => ({
"&-copy-success": {
[`
&,
&:hover,
&:focus`]: {
color: token.colorSuccess
}
}
});
const getEllipsisStyles = () => ({
[`
a&-ellipsis,
span&-ellipsis
`]: {
display: "inline-block",
maxWidth: "100%"
},
"&-single-line": {
whiteSpace: "nowrap"
},
"&-ellipsis-single-line": {
overflow: "hidden",
textOverflow: "ellipsis",
// https://blog.csdn.net/iefreer/article/details/50421025
"a&, span&": {
verticalAlign: "bottom"
}
},
"&-ellipsis-multiple-line": {
display: "-webkit-box",
overflow: "hidden",
WebkitLineClamp: 3,
WebkitBoxOrient: "vertical"
}
});
const genTypographyStyle = (token) => {
const {
componentCls,
sizeMarginHeadingVerticalStart
} = token;
return {
[componentCls]: _extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends(_extends({
color: token.colorText,
wordBreak: "break-word",
lineHeight: token.lineHeight,
[`&${componentCls}-secondary`]: {
color: token.colorTextDescription
},
[`&${componentCls}-success`]: {
color: token.colorSuccess
},
[`&${componentCls}-warning`]: {
color: token.colorWarning
},
[`&${componentCls}-danger`]: {
color: token.colorError,
"a&:active, a&:focus": {
color: token.colorErrorActive
},
"a&:hover": {
color: token.colorErrorHover
}
},
[`&${componentCls}-disabled`]: {
color: token.colorTextDisabled,
cursor: "not-allowed",
userSelect: "none"
},
[`
div&,
p
`]: {
marginBottom: "1em"
}
}, getTitleStyles(token)), {
[`
& + h1${componentCls},
& + h2${componentCls},
& + h3${componentCls},
& + h4${componentCls},
& + h5${componentCls}
`]: {
marginTop: sizeMarginHeadingVerticalStart
},
[`
div,
ul,
li,
p,
h1,
h2,
h3,
h4,
h5`]: {
[`
+ h1,
+ h2,
+ h3,
+ h4,
+ h5
`]: {
marginTop: sizeMarginHeadingVerticalStart
}
}
}), getResetStyles()), getLinkStyles(token)), {
// Operation
[`
${componentCls}-expand,
${componentCls}-edit,
${componentCls}-copy
`]: _extends(_extends({}, operationUnit(token)), {
marginInlineStart: token.marginXXS
})
}), getEditableStyles(token)), getCopiableStyles(token)), getEllipsisStyles()), {
"&-rtl": {
direction: "rtl"
}
})
};
};
const useStyle$6 = genComponentStyleHook("Typography", (token) => [genTypographyStyle(token)], {
sizeMarginHeadingVerticalStart: "1.2em",
sizeMarginHeadingVerticalEnd: "0.5em"
});
const editableProps = () => ({
prefixCls: String,
value: String,
maxlength: Number,
autoSize: {
type: [Boolean, Object]
},
onSave: Function,
onCancel: Function,
onEnd: Function,
onChange: Function,
originContent: String,
direction: String,
component: String
});
const Editable = defineComponent({
compatConfig: {
MODE: 3
},
name: "Editable",
inheritAttrs: false,
props: editableProps(),
// emits: ['save', 'cancel', 'end', 'change'],
setup(props2, _ref) {
let {
emit,
slots,
attrs
} = _ref;
const {
prefixCls
} = toRefs(props2);
const state = reactive({
current: props2.value || "",
lastKeyCode: void 0,
inComposition: false,
cancelFlag: false
});
watch(() => props2.value, (current) => {
state.current = current;
});
const textArea = ref();
function saveTextAreaRef(node) {
textArea.value = node;
}
function onChange(_ref2) {
let {
target: {
value
}
} = _ref2;
state.current = value.replace(/[\r\n]/g, "");
emit("change", state.current);
}
function onCompositionStart() {
state.inComposition = true;
}
function onCompositionEnd() {
state.inComposition = false;
}
function onKeyDown2(e) {
const {
keyCode
} = e;
if (keyCode === KeyCode.ENTER) {
e.preventDefault();
}
if (state.inComposition) return;
state.lastKeyCode = keyCode;
}
function onKeyUp(e) {
const {
keyCode,
ctrlKey,
altKey,
metaKey,
shiftKey
} = e;
if (state.lastKeyCode === keyCode && !state.inComposition && !ctrlKey && !altKey && !metaKey && !shiftKey) {
if (keyCode === KeyCode.ENTER) {
confirmChange();
emit("end");
} else if (keyCode === KeyCode.ESC) {
state.current = props2.originContent;
emit("cancel");
}
}
}
function onBlur() {
confirmChange();
}
function confirmChange() {
emit("save", state.current.trim());
}
const [wrapSSR, hashId] = useStyle$6(prefixCls);
return () => {
const textAreaClassName = classNames({
[`${prefixCls.value}`]: true,
[`${prefixCls.value}-edit-content`]: true,
[`${prefixCls.value}-rtl`]: props2.direction === "rtl",
[props2.component ? `${prefixCls.value}-${props2.component}` : ""]: true
}, attrs.class, hashId.value);
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": textAreaClassName
}), [createVNode(__nuxt_component_0$4, {
"ref": saveTextAreaRef,
"maxlength": props2.maxlength,
"value": state.current,
"onChange": onChange,
"onKeydown": onKeyDown2,
"onKeyup": onKeyUp,
"onCompositionstart": onCompositionStart,
"onCompositionend": onCompositionEnd,
"onBlur": onBlur,
"rows": 1,
"autoSize": props2.autoSize === void 0 || props2.autoSize
}, null), slots.enterIcon ? slots.enterIcon({
className: `${props2.prefixCls}-edit-content-confirm`
}) : createVNode(EnterOutlined, {
"class": `${props2.prefixCls}-edit-content-confirm`
}, null)]));
};
}
});
const TEXT_NODE = 3;
const COMMENT_NODE = 8;
let ellipsisContainer;
const wrapperStyle = {
padding: 0,
margin: 0,
display: "inline",
lineHeight: "inherit"
};
function resetDomStyles(target, origin) {
target.setAttribute("aria-hidden", "true");
const originStyle = (void 0).getComputedStyle(origin);
const originCSS = styleToString(originStyle);
target.setAttribute("style", originCSS);
target.style.position = "fixed";
target.style.left = "0";
target.style.height = "auto";
target.style.minHeight = "auto";
target.style.maxHeight = "auto";
target.style.paddingTop = "0";
target.style.paddingBottom = "0";
target.style.borderTopWidth = "0";
target.style.borderBottomWidth = "0";
target.style.top = "-999999px";
target.style.zIndex = "-1000";
target.style.textOverflow = "clip";
target.style.whiteSpace = "normal";
target.style.webkitLineClamp = "none";
}
function getRealLineHeight(originElement) {
const heightContainer = (void 0).createElement("div");
resetDomStyles(heightContainer, originElement);
heightContainer.appendChild((void 0).createTextNode("text"));
(void 0).body.appendChild(heightContainer);
const realHeight = heightContainer.getBoundingClientRect().height;
(void 0).body.removeChild(heightContainer);
return realHeight;
}
const measure = ((originElement, option, content, fixedContent, ellipsisStr) => {
if (!ellipsisContainer) {
ellipsisContainer = (void 0).createElement("div");
ellipsisContainer.setAttribute("aria-hidden", "true");
(void 0).body.appendChild(ellipsisContainer);
}
const {
rows,
suffix = ""
} = option;
const lineHeight = getRealLineHeight(originElement);
const maxHeight = Math.round(lineHeight * rows * 100) / 100;
resetDomStyles(ellipsisContainer, originElement);
const vm = createApp({
render() {
return createVNode("div", {
"style": wrapperStyle
}, [createVNode("span", {
"style": wrapperStyle
}, [content, suffix]), createVNode("span", {
"style": wrapperStyle
}, [fixedContent])]);
}
});
vm.mount(ellipsisContainer);
function inRange() {
const currentHeight = Math.round(ellipsisContainer.getBoundingClientRect().height * 100) / 100;
return currentHeight - 0.1 <= maxHeight;
}
if (inRange()) {
vm.unmount();
return {
content,
text: ellipsisContainer.innerHTML,
ellipsis: false
};
}
const childNodes = Array.prototype.slice.apply(ellipsisContainer.childNodes[0].childNodes[0].cloneNode(true).childNodes).filter((_ref) => {
let {
nodeType,
data
} = _ref;
return nodeType !== COMMENT_NODE && data !== "";
});
const fixedNodes = Array.prototype.slice.apply(ellipsisContainer.childNodes[0].childNodes[1].cloneNode(true).childNodes);
vm.unmount();
const ellipsisChildren = [];
ellipsisContainer.innerHTML = "";
const ellipsisContentHolder = (void 0).createElement("span");
ellipsisContainer.appendChild(ellipsisContentHolder);
const ellipsisTextNode = (void 0).createTextNode(ellipsisStr + suffix);
ellipsisContentHolder.appendChild(ellipsisTextNode);
fixedNodes.forEach((childNode) => {
ellipsisContainer.appendChild(childNode);
});
function appendChildNode(node) {
ellipsisContentHolder.insertBefore(node, ellipsisTextNode);
}
function measureText(textNode, fullText) {
let startLoc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
let endLoc = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : fullText.length;
let lastSuccessLoc = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
const midLoc = Math.floor((startLoc + endLoc) / 2);
const currentText = fullText.slice(0, midLoc);
textNode.textContent = currentText;
if (startLoc >= endLoc - 1) {
for (let step = endLoc; step >= startLoc; step -= 1) {
const currentStepText = fullText.slice(0, step);
textNode.textContent = currentStepText;
if (inRange() || !currentStepText) {
return step === fullText.length ? {
finished: false,
vNode: fullText
} : {
finished: true,
vNode: currentStepText
};
}
}
}
if (inRange()) {
return measureText(textNode, fullText, midLoc, endLoc, midLoc);
}
return measureText(textNode, fullText, startLoc, midLoc, lastSuccessLoc);
}
function measureNode(childNode) {
const type = childNode.nodeType;
if (type === TEXT_NODE) {
const fullText = childNode.textContent || "";
const textNode = (void 0).createTextNode(fullText);
appendChildNode(textNode);
return measureText(textNode, fullText);
}
return {
finished: false,
vNode: null
};
}
childNodes.some((childNode) => {
const {
finished,
vNode
} = measureNode(childNode);
if (vNode) {
ellipsisChildren.push(vNode);
}
return finished;
});
return {
content: ellipsisChildren,
text: ellipsisContainer.innerHTML,
ellipsis: true
};
});
var __rest$a = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const typographyProps = () => ({
prefixCls: String,
direction: String,
// Form Internal use
component: String
});
const Typography = defineComponent({
name: "ATypography",
inheritAttrs: false,
props: typographyProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("typography", props2);
const [wrapSSR, hashId] = useStyle$6(prefixCls);
return () => {
var _a;
const _b = _extends(_extends({}, props2), attrs), {
prefixCls: _prefixCls,
direction: _direction,
component: Component = "article"
} = _b, restProps = __rest$a(_b, ["prefixCls", "direction", "component"]);
return wrapSSR(createVNode(Component, _objectSpread$W(_objectSpread$W({}, restProps), {}, {
"class": classNames(prefixCls.value, {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value)
}), {
default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
}));
};
}
});
const deselectCurrent = () => {
const selection = (void 0).getSelection();
if (!selection.rangeCount) {
return function() {
};
}
let active = (void 0).activeElement;
const ranges = [];
for (let i = 0; i < selection.rangeCount; i++) {
ranges.push(selection.getRangeAt(i));
}
switch (active.tagName.toUpperCase()) {
case "INPUT":
case "TEXTAREA":
active.blur();
break;
default:
active = null;
break;
}
selection.removeAllRanges();
return function() {
selection.type === "Caret" && selection.removeAllRanges();
if (!selection.rangeCount) {
ranges.forEach(function(range) {
selection.addRange(range);
});
}
active && active.focus();
};
};
const clipboardToIE11Formatting = {
"text/plain": "Text",
"text/html": "Url",
default: "Text"
};
const defaultMessage = "Copy to clipboard: #{key}, Enter";
function format(message) {
const copyKey = (/mac os x/i.test((void 0).userAgent) ? "⌘" : "Ctrl") + "+C";
return message.replace(/#{\s*key\s*}/g, copyKey);
}
function copy(text, options) {
let message, reselectPrevious, range, selection, mark, success = false;
if (!options) {
options = {};
}
const debug = options.debug || false;
try {
reselectPrevious = deselectCurrent();
range = (void 0).createRange();
selection = (void 0).getSelection();
mark = (void 0).createElement("span");
mark.textContent = text;
mark.style.all = "unset";
mark.style.position = "fixed";
mark.style.top = 0;
mark.style.clip = "rect(0, 0, 0, 0)";
mark.style.whiteSpace = "pre";
mark.style.webkitUserSelect = "text";
mark.style.MozUserSelect = "text";
mark.style.msUserSelect = "text";
mark.style.userSelect = "text";
mark.addEventListener("copy", function(e) {
e.stopPropagation();
if (options.format) {
e.preventDefault();
if (typeof e.clipboardData === "undefined") {
debug && console.warn("unable to use e.clipboardData");
debug && console.warn("trying IE specific stuff");
(void 0).clipboardData.clearData();
const format2 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
(void 0).clipboardData.setData(format2, text);
} else {
e.clipboardData.clearData();
e.clipboardData.setData(options.format, text);
}
}
if (options.onCopy) {
e.preventDefault();
options.onCopy(e.clipboardData);
}
});
(void 0).body.appendChild(mark);
range.selectNodeContents(mark);
selection.addRange(range);
const successful = (void 0).execCommand("copy");
if (!successful) {
throw new Error("copy command was unsuccessful");
}
success = true;
} catch (err) {
debug && console.error("unable to copy using execCommand: ", err);
debug && console.warn("trying IE specific stuff");
try {
(void 0).clipboardData.setData(options.format || "text", text);
options.onCopy && options.onCopy((void 0).clipboardData);
success = true;
} catch (err2) {
debug && console.error("unable to copy using clipboardData: ", err2);
debug && console.error("falling back to prompt");
message = format("message" in options ? options.message : defaultMessage);
(void 0).prompt(message, text);
}
} finally {
if (selection) {
if (typeof selection.removeRange == "function") {
selection.removeRange(range);
} else {
selection.removeAllRanges();
}
}
if (mark) {
(void 0).body.removeChild(mark);
}
reselectPrevious();
}
return success;
}
var __rest$9 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const isLineClampSupport = isStyleSupport();
const isTextOverflowSupport = isStyleSupport();
const ELLIPSIS_STR = "...";
const baseProps = () => ({
editable: {
type: [Boolean, Object],
default: void 0
},
copyable: {
type: [Boolean, Object],
default: void 0
},
prefixCls: String,
component: String,
type: String,
disabled: {
type: Boolean,
default: void 0
},
ellipsis: {
type: [Boolean, Object],
default: void 0
},
code: {
type: Boolean,
default: void 0
},
mark: {
type: Boolean,
default: void 0
},
underline: {
type: Boolean,
default: void 0
},
delete: {
type: Boolean,
default: void 0
},
strong: {
type: Boolean,
default: void 0
},
keyboard: {
type: Boolean,
default: void 0
},
content: String,
"onUpdate:content": Function
});
const Base = defineComponent({
compatConfig: {
MODE: 3
},
name: "TypographyBase",
inheritAttrs: false,
props: baseProps(),
// emits: ['update:content'],
setup(props2, _ref) {
let {
slots,
attrs,
emit
} = _ref;
const {
prefixCls,
direction
} = useConfigInject("typography", props2);
const state = reactive({
copied: false,
ellipsisText: "",
ellipsisContent: null,
isEllipsis: false,
expanded: false,
clientRendered: false,
//locale
expandStr: "",
copyStr: "",
copiedStr: "",
editStr: "",
copyId: void 0,
rafId: void 0,
prevProps: void 0,
originContent: ""
});
const contentRef = ref();
const editIcon = ref();
const ellipsis = computed(() => {
const ellipsis2 = props2.ellipsis;
if (!ellipsis2) return {};
return _extends({
rows: 1,
expandable: false
}, typeof ellipsis2 === "object" ? ellipsis2 : null);
});
watch([() => ellipsis.value.rows, () => props2.content], () => {
nextTick(() => {
resizeOnNextFrame();
});
}, {
flush: "post",
deep: true
});
watchEffect(() => {
if (props2.content === void 0) {
warning(!props2.editable);
warning(!props2.ellipsis);
}
});
function getChildrenText() {
var _a;
return props2.ellipsis || props2.editable ? props2.content : (_a = findDOMNode(contentRef.value)) === null || _a === void 0 ? void 0 : _a.innerText;
}
function onExpandClick(e) {
const {
onExpand
} = ellipsis.value;
state.expanded = true;
onExpand === null || onExpand === void 0 ? void 0 : onExpand(e);
}
function onEditClick(e) {
e.preventDefault();
state.originContent = props2.content;
triggerEdit(true);
}
function onEditChange(value) {
onContentChange(value);
triggerEdit(false);
}
function onContentChange(value) {
const {
onChange
} = editable.value;
if (value !== props2.content) {
emit("update:content", value);
onChange === null || onChange === void 0 ? void 0 : onChange(value);
}
}
function onEditCancel() {
var _a, _b;
(_b = (_a = editable.value).onCancel) === null || _b === void 0 ? void 0 : _b.call(_a);
triggerEdit(false);
}
function onCopyClick(e) {
e.preventDefault();
e.stopPropagation();
const {
copyable
} = props2;
const copyConfig = _extends({}, typeof copyable === "object" ? copyable : null);
if (copyConfig.text === void 0) {
copyConfig.text = getChildrenText();
}
copy(copyConfig.text || "");
state.copied = true;
nextTick(() => {
if (copyConfig.onCopy) {
copyConfig.onCopy(e);
}
state.copyId = setTimeout(() => {
state.copied = false;
}, 3e3);
});
}
const editable = computed(() => {
const editable2 = props2.editable;
if (!editable2) return {
editing: false
};
return _extends({}, typeof editable2 === "object" ? editable2 : null);
});
const [editing, setEditing] = useMergedState(false, {
value: computed(() => {
return editable.value.editing;
})
});
function triggerEdit(edit) {
const {
onStart
} = editable.value;
if (edit && onStart) {
onStart();
}
setEditing(edit);
}
watch(editing, (val) => {
var _a;
if (!val) {
(_a = editIcon.value) === null || _a === void 0 ? void 0 : _a.focus();
}
}, {
flush: "post"
});
function resizeOnNextFrame(sizeInfo) {
if (sizeInfo) {
const {
width,
height
} = sizeInfo;
if (!width || !height) return;
}
wrapperRaf.cancel(state.rafId);
state.rafId = wrapperRaf(() => {
syncEllipsis();
});
}
const canUseCSSEllipsis = computed(() => {
const {
rows,
expandable,
suffix,
onEllipsis,
tooltip
} = ellipsis.value;
if (suffix || tooltip) return false;
if (props2.editable || props2.copyable || expandable || onEllipsis) {
return false;
}
if (rows === 1) {
return isTextOverflowSupport;
}
return isLineClampSupport;
});
const syncEllipsis = () => {
const {
ellipsisText,
isEllipsis
} = state;
const {
rows,
suffix,
onEllipsis
} = ellipsis.value;
if (!rows || rows < 0 || !findDOMNode(contentRef.value) || state.expanded || props2.content === void 0) return;
if (canUseCSSEllipsis.value) return;
const {
content,
text,
ellipsis: ell
} = measure(findDOMNode(contentRef.value), {
rows,
suffix
}, props2.content, renderOperations(true), ELLIPSIS_STR);
if (ellipsisText !== text || state.isEllipsis !== ell) {
state.ellipsisText = text;
state.ellipsisContent = content;
state.isEllipsis = ell;
if (isEllipsis !== ell && onEllipsis) {
onEllipsis(ell);
}
}
};
function wrapperDecorations(_ref2, content) {
let {
mark,
code,
underline,
delete: del,
strong,
keyboard
} = _ref2;
let currentContent = content;
function wrap(needed, Tag2) {
if (!needed) return;
const _currentContent = /* @__PURE__ */ (function() {
return currentContent;
})();
currentContent = createVNode(Tag2, null, {
default: () => [_currentContent]
});
}
wrap(strong, "strong");
wrap(underline, "u");
wrap(del, "del");
wrap(code, "code");
wrap(mark, "mark");
wrap(keyboard, "kbd");
return currentContent;
}
function renderExpand(forceRender) {
const {
expandable,
symbol
} = ellipsis.value;
if (!expandable) return null;
if (!forceRender && (state.expanded || !state.isEllipsis)) return null;
const expandContent = (slots.ellipsisSymbol ? slots.ellipsisSymbol() : symbol) || state.expandStr;
return createVNode("a", {
"key": "expand",
"class": `${prefixCls.value}-expand`,
"onClick": onExpandClick,
"aria-label": state.expandStr
}, [expandContent]);
}
function renderEdit() {
if (!props2.editable) return;
const {
tooltip,
triggerType = ["icon"]
} = props2.editable;
const icon = slots.editableIcon ? slots.editableIcon() : createVNode(EditOutlined, {
"role": "button"
}, null);
const title = slots.editableTooltip ? slots.editableTooltip() : state.editStr;
const ariaLabel = typeof title === "string" ? title : "";
return triggerType.indexOf("icon") !== -1 ? createVNode(__nuxt_component_2$4, {
"key": "edit",
"title": tooltip === false ? "" : title
}, {
default: () => [createVNode(TransButton, {
"ref": editIcon,
"class": `${prefixCls.value}-edit`,
"onClick": onEditClick,
"aria-label": ariaLabel
}, {
default: () => [icon]
})]
}) : null;
}
function renderCopy() {
if (!props2.copyable) return;
const {
tooltip
} = props2.copyable;
const defaultTitle2 = state.copied ? state.copiedStr : state.copyStr;
const title = slots.copyableTooltip ? slots.copyableTooltip({
copied: state.copied
}) : defaultTitle2;
const ariaLabel = typeof title === "string" ? title : "";
const defaultIcon = state.copied ? createVNode(CheckOutlined, null, null) : createVNode(CopyOutlined, null, null);
const icon = slots.copyableIcon ? slots.copyableIcon({
copied: !!state.copied
}) : defaultIcon;
return createVNode(__nuxt_component_2$4, {
"key": "copy",
"title": tooltip === false ? "" : title
}, {
default: () => [createVNode(TransButton, {
"class": [`${prefixCls.value}-copy`, {
[`${prefixCls.value}-copy-success`]: state.copied
}],
"onClick": onCopyClick,
"aria-label": ariaLabel
}, {
default: () => [icon]
})]
});
}
function renderEditInput() {
const {
class: className,
style
} = attrs;
const {
maxlength,
autoSize,
onEnd
} = editable.value;
return createVNode(Editable, {
"class": className,
"style": style,
"prefixCls": prefixCls.value,
"value": props2.content,
"originContent": state.originContent,
"maxlength": maxlength,
"autoSize": autoSize,
"onSave": onEditChange,
"onChange": onContentChange,
"onCancel": onEditCancel,
"onEnd": onEnd,
"direction": direction.value,
"component": props2.component
}, {
enterIcon: slots.editableEnterIcon
});
}
function renderOperations(forceRenderExpanded) {
return [renderExpand(forceRenderExpanded), renderEdit(), renderCopy()].filter((node) => node);
}
return () => {
var _a;
const {
triggerType = ["icon"]
} = editable.value;
const children = props2.ellipsis || props2.editable ? props2.content !== void 0 ? props2.content : (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots) : slots.default ? slots.default() : props2.content;
if (editing.value) {
return renderEditInput();
}
return createVNode(LocaleReceiver, {
"componentName": "Text",
"children": (locale2) => {
const _a2 = _extends(_extends({}, props2), attrs), {
type,
disabled,
content,
class: className,
style
} = _a2, restProps = __rest$9(_a2, ["type", "disabled", "content", "class", "style"]);
const {
rows,
suffix,
tooltip
} = ellipsis.value;
const {
edit,
copy: copyStr,
copied,
expand
} = locale2;
state.editStr = edit;
state.copyStr = copyStr;
state.copiedStr = copied;
state.expandStr = expand;
const textProps2 = omit(restProps, ["prefixCls", "editable", "copyable", "ellipsis", "mark", "code", "delete", "underline", "strong", "keyboard", "onUpdate:content"]);
const cssEllipsis = canUseCSSEllipsis.value;
const cssTextOverflow = rows === 1 && cssEllipsis;
const cssLineClamp = rows && rows > 1 && cssEllipsis;
let textNode = children;
let ariaLabel;
if (rows && state.isEllipsis && !state.expanded && !cssEllipsis) {
const {
title: title2
} = restProps;
let restContent = title2 || "";
if (!title2 && (typeof children === "string" || typeof children === "number")) {
restContent = String(children);
}
restContent = restContent === null || restContent === void 0 ? void 0 : restContent.slice(String(state.ellipsisContent || "").length);
textNode = createVNode(Fragment, null, [toRaw(state.ellipsisContent), createVNode("span", {
"title": restContent,
"aria-hidden": "true"
}, [ELLIPSIS_STR]), suffix]);
} else {
textNode = createVNode(Fragment, null, [children, suffix]);
}
textNode = wrapperDecorations(props2, textNode);
const showTooltip = tooltip && rows && state.isEllipsis && !state.expanded && !cssEllipsis;
const title = slots.ellipsisTooltip ? slots.ellipsisTooltip() : tooltip;
return createVNode(ResizeObserver$1, {
"onResize": resizeOnNextFrame,
"disabled": !rows
}, {
default: () => [createVNode(Typography, _objectSpread$W({
"ref": contentRef,
"class": [{
[`${prefixCls.value}-${type}`]: type,
[`${prefixCls.value}-disabled`]: disabled,
[`${prefixCls.value}-ellipsis`]: rows,
[`${prefixCls.value}-single-line`]: rows === 1 && !state.isEllipsis,
[`${prefixCls.value}-ellipsis-single-line`]: cssTextOverflow,
[`${prefixCls.value}-ellipsis-multiple-line`]: cssLineClamp
}, className],
"style": _extends(_extends({}, style), {
WebkitLineClamp: cssLineClamp ? rows : void 0
}),
"aria-label": ariaLabel,
"direction": direction.value,
"onClick": triggerType.indexOf("text") !== -1 ? onEditClick : () => {
}
}, textProps2), {
default: () => [showTooltip ? createVNode(__nuxt_component_2$4, {
"title": tooltip === true ? children : title
}, {
default: () => [createVNode("span", null, [textNode])]
}) : textNode, renderOperations()]
})]
});
}
}, null);
};
}
});
var __rest$8 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const linkProps = () => omit(_extends(_extends({}, baseProps()), {
ellipsis: {
type: Boolean,
default: void 0
}
}), ["component"]);
const Link = (props2, _ref) => {
let {
slots,
attrs
} = _ref;
const _a = _extends(_extends({}, props2), attrs), {
ellipsis,
rel
} = _a, restProps = __rest$8(_a, ["ellipsis", "rel"]);
const mergedProps = _extends(_extends({}, restProps), {
rel: rel === void 0 && restProps.target === "_blank" ? "noopener noreferrer" : rel,
ellipsis: !!ellipsis,
component: "a"
});
delete mergedProps.navigate;
return createVNode(Base, mergedProps, slots);
};
Link.displayName = "ATypographyLink";
Link.inheritAttrs = false;
Link.props = linkProps();
const paragraphProps = () => omit(baseProps(), ["component"]);
const Paragraph = (props2, _ref) => {
let {
slots,
attrs
} = _ref;
const paragraphProps2 = _extends(_extends(_extends({}, props2), {
component: "div"
}), attrs);
return createVNode(Base, paragraphProps2, slots);
};
Paragraph.displayName = "ATypographyParagraph";
Paragraph.inheritAttrs = false;
Paragraph.props = paragraphProps();
const textProps = () => _extends(_extends({}, omit(baseProps(), ["component"])), {
ellipsis: {
type: [Boolean, Object],
default: void 0
}
});
const Text = (props2, _ref) => {
let {
slots,
attrs
} = _ref;
const {
ellipsis
} = props2;
const textProps2 = _extends(_extends(_extends({}, props2), {
ellipsis: ellipsis && typeof ellipsis === "object" ? omit(ellipsis, ["expandable", "rows"]) : ellipsis,
component: "span"
}), attrs);
return createVNode(Base, textProps2, slots);
};
Text.displayName = "ATypographyText";
Text.inheritAttrs = false;
Text.props = textProps();
var __rest$7 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const TITLE_ELE_LIST = tupleNum(1, 2, 3, 4, 5);
const titleProps = () => _extends(_extends({}, omit(baseProps(), ["component", "strong"])), {
level: Number
});
const Title = (props2, _ref) => {
let {
slots,
attrs
} = _ref;
const {
level = 1
} = props2, restProps = __rest$7(props2, ["level"]);
let component;
if (TITLE_ELE_LIST.includes(level)) {
component = `h${level}`;
} else {
component = "h1";
}
const titleProps2 = _extends(_extends(_extends({}, restProps), {
component
}), attrs);
return createVNode(Base, titleProps2, slots);
};
Title.displayName = "ATypographyTitle";
Title.inheritAttrs = false;
Title.props = titleProps();
Typography.Text = Text;
Typography.Title = Title;
Typography.Paragraph = Paragraph;
Typography.Link = Link;
Typography.Base = Base;
Typography.install = function(app) {
app.component(Typography.name, Typography);
app.component(Typography.Text.displayName, Text);
app.component(Typography.Title.displayName, Title);
app.component(Typography.Paragraph.displayName, Paragraph);
app.component(Typography.Link.displayName, Link);
return app;
};
const now = +/* @__PURE__ */ new Date();
let index$6 = 0;
function uid() {
return `vc-upload-${now}-${++index$6}`;
}
const attrAccept = ((file, acceptedFiles) => {
if (file && acceptedFiles) {
const acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(",");
const fileName = file.name || "";
const mimeType = file.type || "";
const baseMimeType = mimeType.replace(/\/.*$/, "");
return acceptedFilesArray.some((type) => {
const validType = type.trim();
if (/^\*(\/\*)?$/.test(type)) {
return true;
}
if (validType.charAt(0) === ".") {
const lowerFileName = fileName.toLowerCase();
const lowerType = validType.toLowerCase();
let affixList = [lowerType];
if (lowerType === ".jpg" || lowerType === ".jpeg") {
affixList = [".jpg", ".jpeg"];
}
return affixList.some((affix) => lowerFileName.endsWith(affix));
}
if (/\/\*$/.test(validType)) {
return baseMimeType === validType.replace(/\/.*$/, "");
}
if (mimeType === validType) {
return true;
}
if (/^\w+$/.test(validType)) {
return true;
}
return false;
});
}
return true;
});
function loopFiles(item, callback) {
const dirReader = item.createReader();
let fileList = [];
function sequence() {
dirReader.readEntries((entries) => {
const entryList = Array.prototype.slice.apply(entries);
fileList = fileList.concat(entryList);
const isFinished = !entryList.length;
if (isFinished) {
callback(fileList);
} else {
sequence();
}
});
}
sequence();
}
const traverseFileTree = (files, callback, isAccepted) => {
const _traverseFileTree = (item, path2) => {
item.path = path2 || "";
if (item.isFile) {
item.file((file) => {
if (isAccepted(file)) {
if (item.fullPath && !file.webkitRelativePath) {
Object.defineProperties(file, {
webkitRelativePath: {
writable: true
}
});
file.webkitRelativePath = item.fullPath.replace(/^\//, "");
Object.defineProperties(file, {
webkitRelativePath: {
writable: false
}
});
}
callback([file]);
}
});
} else if (item.isDirectory) {
loopFiles(item, (entries) => {
entries.forEach((entryItem) => {
_traverseFileTree(entryItem, `${path2}${item.name}/`);
});
});
}
};
files.forEach((file) => {
_traverseFileTree(file.webkitGetAsEntry());
});
};
const uploadProps$1 = () => {
return {
capture: [Boolean, String],
multipart: {
type: Boolean,
default: void 0
},
name: String,
disabled: {
type: Boolean,
default: void 0
},
componentTag: String,
action: [String, Function],
method: String,
directory: {
type: Boolean,
default: void 0
},
data: [Object, Function],
headers: Object,
accept: String,
multiple: {
type: Boolean,
default: void 0
},
onBatchStart: Function,
onReject: Function,
onStart: Function,
onError: Function,
onSuccess: Function,
onProgress: Function,
beforeUpload: Function,
customRequest: Function,
withCredentials: {
type: Boolean,
default: void 0
},
openFileDialogOnClick: {
type: Boolean,
default: void 0
},
prefixCls: String,
id: String,
onMouseenter: Function,
onMouseleave: Function,
onClick: Function
};
};
var __awaiter$1 = function(thisArg, _arguments, P, generator2) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator2.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator2["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator2 = generator2.apply(thisArg, [])).next());
});
};
var __rest$6 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const AjaxUpload = defineComponent({
compatConfig: {
MODE: 3
},
name: "AjaxUploader",
inheritAttrs: false,
props: uploadProps$1(),
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
const uid$1 = ref(uid());
const reqs = {};
const fileInput = ref();
const processFile = (file, fileList) => __awaiter$1(this, void 0, void 0, function* () {
const {
beforeUpload
} = props2;
let transformedFile = file;
if (beforeUpload) {
try {
transformedFile = yield beforeUpload(file, fileList);
} catch (e) {
transformedFile = false;
}
if (transformedFile === false) {
return {
origin: file,
parsedFile: null,
action: null,
data: null
};
}
}
const {
action
} = props2;
let mergedAction;
if (typeof action === "function") {
mergedAction = yield action(file);
} else {
mergedAction = action;
}
const {
data
} = props2;
let mergedData;
if (typeof data === "function") {
mergedData = yield data(file);
} else {
mergedData = data;
}
const parsedData = (
// string type is from legacy `transformFile`.
// Not sure if this will work since no related test case works with it
(typeof transformedFile === "object" || typeof transformedFile === "string") && transformedFile ? transformedFile : file
);
let parsedFile;
if (parsedData instanceof File) {
parsedFile = parsedData;
} else {
parsedFile = new File([parsedData], file.name, {
type: file.type
});
}
const mergedParsedFile = parsedFile;
mergedParsedFile.uid = file.uid;
return {
origin: file,
data: mergedData,
parsedFile: mergedParsedFile,
action: mergedAction
};
});
const post = (_ref2) => {
let {
data,
origin,
action,
parsedFile
} = _ref2;
{
return;
}
};
const reset = () => {
uid$1.value = uid();
};
const abort = (file) => {
if (file) {
const uid2 = file.uid ? file.uid : file;
if (reqs[uid2] && reqs[uid2].abort) {
reqs[uid2].abort();
}
delete reqs[uid2];
} else {
Object.keys(reqs).forEach((uid2) => {
if (reqs[uid2] && reqs[uid2].abort) {
reqs[uid2].abort();
}
delete reqs[uid2];
});
}
};
const uploadFiles = (files) => {
const originFiles = [...files];
const postFiles = originFiles.map((file) => {
file.uid = uid();
return processFile(file, originFiles);
});
Promise.all(postFiles).then((fileList) => {
const {
onBatchStart
} = props2;
onBatchStart === null || onBatchStart === void 0 ? void 0 : onBatchStart(fileList.map((_ref3) => {
let {
origin,
parsedFile
} = _ref3;
return {
file: origin,
parsedFile
};
}));
fileList.filter((file) => file.parsedFile !== null).forEach((file) => {
post(file);
});
});
};
const onChange = (e) => {
const {
accept,
directory
} = props2;
const {
files
} = e.target;
const acceptedFiles = [...files].filter((file) => !directory || attrAccept(file, accept));
uploadFiles(acceptedFiles);
reset();
};
const onClick = (e) => {
const el = fileInput.value;
if (!el) {
return;
}
const {
onClick: onClick2
} = props2;
el.click();
if (onClick2) {
onClick2(e);
}
};
const onKeyDown2 = (e) => {
if (e.key === "Enter") {
onClick(e);
}
};
const onFileDrop = (e) => {
const {
multiple
} = props2;
e.preventDefault();
if (e.type === "dragover") {
return;
}
if (props2.directory) {
traverseFileTree(Array.prototype.slice.call(e.dataTransfer.items), uploadFiles, (_file) => attrAccept(_file, props2.accept));
} else {
const files = partition(Array.prototype.slice.call(e.dataTransfer.files), (file) => attrAccept(file, props2.accept));
let successFiles = files[0];
const errorFiles = files[1];
if (multiple === false) {
successFiles = successFiles.slice(0, 1);
}
uploadFiles(successFiles);
if (errorFiles.length && props2.onReject) props2.onReject(errorFiles);
}
};
expose({
abort
});
return () => {
var _a;
const {
componentTag: Tag2,
prefixCls,
disabled,
id,
multiple,
accept,
capture,
directory,
openFileDialogOnClick,
onMouseenter,
onMouseleave
} = props2, otherProps = __rest$6(props2, ["componentTag", "prefixCls", "disabled", "id", "multiple", "accept", "capture", "directory", "openFileDialogOnClick", "onMouseenter", "onMouseleave"]);
const cls = {
[prefixCls]: true,
[`${prefixCls}-disabled`]: disabled,
[attrs.class]: !!attrs.class
};
const dirProps = directory ? {
directory: "directory",
webkitdirectory: "webkitdirectory"
} : {};
const events2 = disabled ? {} : {
onClick: openFileDialogOnClick ? onClick : () => {
},
onKeydown: openFileDialogOnClick ? onKeyDown2 : () => {
},
onMouseenter,
onMouseleave,
onDrop: onFileDrop,
onDragover: onFileDrop,
tabindex: "0"
};
return createVNode(Tag2, _objectSpread$W(_objectSpread$W({}, events2), {}, {
"class": cls,
"role": "button",
"style": attrs.style
}), {
default: () => [createVNode("input", _objectSpread$W(_objectSpread$W(_objectSpread$W({}, pickAttrs(otherProps, {
aria: true,
data: true
})), {}, {
"id": id,
"type": "file",
"ref": fileInput,
"onClick": (e) => e.stopPropagation(),
"onCancel": (e) => e.stopPropagation(),
"key": uid$1.value,
"style": {
display: "none"
},
"accept": accept
}, dirProps), {}, {
"multiple": multiple,
"onChange": onChange
}, capture != null ? {
capture
} : {}), null), (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
});
};
}
});
function empty() {
}
const Upload$1 = defineComponent({
compatConfig: {
MODE: 3
},
name: "Upload",
inheritAttrs: false,
props: initDefaultProps(uploadProps$1(), {
componentTag: "span",
prefixCls: "rc-upload",
data: {},
headers: {},
name: "file",
multipart: false,
onStart: empty,
onError: empty,
onSuccess: empty,
multiple: false,
beforeUpload: null,
customRequest: null,
withCredentials: false,
openFileDialogOnClick: true
}),
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
const uploader = ref();
const abort = (file) => {
var _a;
(_a = uploader.value) === null || _a === void 0 ? void 0 : _a.abort(file);
};
expose({
abort
});
return () => {
return createVNode(AjaxUpload, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, props2), attrs), {}, {
"ref": uploader
}), slots);
};
}
});
function uploadProps() {
return {
capture: someType([Boolean, String]),
type: stringType(),
name: String,
defaultFileList: arrayType(),
fileList: arrayType(),
action: someType([String, Function]),
directory: booleanType(),
data: someType([Object, Function]),
method: stringType(),
headers: objectType(),
showUploadList: someType([Boolean, Object]),
multiple: booleanType(),
accept: String,
beforeUpload: functionType(),
onChange: functionType(),
"onUpdate:fileList": functionType(),
onDrop: functionType(),
listType: stringType(),
onPreview: functionType(),
onDownload: functionType(),
onReject: functionType(),
onRemove: functionType(),
/** @deprecated Please use `onRemove` directly */
remove: functionType(),
supportServerRender: booleanType(),
disabled: booleanType(),
prefixCls: String,
customRequest: functionType(),
withCredentials: booleanType(),
openFileDialogOnClick: booleanType(),
locale: objectType(),
id: String,
previewFile: functionType(),
/** @deprecated Please use `beforeUpload` directly */
transformFile: functionType(),
iconRender: functionType(),
isImageUrl: functionType(),
progress: objectType(),
itemRender: functionType(),
/** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
maxCount: Number,
height: someType([Number, String]),
removeIcon: functionType(),
downloadIcon: functionType(),
previewIcon: functionType()
};
}
function uploadListProps() {
return {
listType: stringType(),
onPreview: functionType(),
onDownload: functionType(),
onRemove: functionType(),
items: arrayType(),
progress: objectType(),
prefixCls: stringType(),
showRemoveIcon: booleanType(),
showDownloadIcon: booleanType(),
showPreviewIcon: booleanType(),
removeIcon: functionType(),
downloadIcon: functionType(),
previewIcon: functionType(),
locale: objectType(void 0),
previewFile: functionType(),
iconRender: functionType(),
isImageUrl: functionType(),
appendAction: functionType(),
appendActionVisible: booleanType(),
itemRender: functionType()
};
}
function file2Obj(file) {
return _extends(_extends({}, file), {
lastModified: file.lastModified,
lastModifiedDate: file.lastModifiedDate,
name: file.name,
size: file.size,
type: file.type,
uid: file.uid,
percent: 0,
originFileObj: file
});
}
function updateFileList(file, fileList) {
const nextFileList = [...fileList];
const fileIndex = nextFileList.findIndex((_ref) => {
let {
uid: uid2
} = _ref;
return uid2 === file.uid;
});
if (fileIndex === -1) {
nextFileList.push(file);
} else {
nextFileList[fileIndex] = file;
}
return nextFileList;
}
function getFileItem(file, fileList) {
const matchKey = file.uid !== void 0 ? "uid" : "name";
return fileList.filter((item) => item[matchKey] === file[matchKey])[0];
}
function removeFileItem(file, fileList) {
const matchKey = file.uid !== void 0 ? "uid" : "name";
const removed = fileList.filter((item) => item[matchKey] !== file[matchKey]);
if (removed.length === fileList.length) {
return null;
}
return removed;
}
const extname = function() {
let url = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
const temp = url.split("/");
const filename = temp[temp.length - 1];
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [""])[0];
};
const isImageFileType = (type) => type.indexOf("image/") === 0;
const isImageUrl = (file) => {
if (file.type && !file.thumbUrl) {
return isImageFileType(file.type);
}
const url = file.thumbUrl || file.url || "";
const extension = extname(url);
if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(extension)) {
return true;
}
if (/^data:/.test(url)) {
return false;
}
if (extension) {
return false;
}
return true;
};
const MEASURE_SIZE = 200;
function previewImage(file) {
return new Promise((resolve) => {
if (!file.type || !isImageFileType(file.type)) {
resolve("");
return;
}
const canvas = (void 0).createElement("canvas");
canvas.width = MEASURE_SIZE;
canvas.height = MEASURE_SIZE;
canvas.style.cssText = `position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE}px; height: ${MEASURE_SIZE}px; z-index: 9999; display: none;`;
(void 0).body.appendChild(canvas);
const ctx = canvas.getContext("2d");
const img = new Image();
img.onload = () => {
const {
width,
height
} = img;
let drawWidth = MEASURE_SIZE;
let drawHeight = MEASURE_SIZE;
let offsetX = 0;
let offsetY = 0;
if (width > height) {
drawHeight = height * (MEASURE_SIZE / width);
offsetY = -(drawHeight - drawWidth) / 2;
} else {
drawWidth = width * (MEASURE_SIZE / height);
offsetX = -(drawWidth - drawHeight) / 2;
}
ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight);
const dataURL = canvas.toDataURL();
(void 0).body.removeChild(canvas);
resolve(dataURL);
};
img.crossOrigin = "anonymous";
if (file.type.startsWith("image/svg+xml")) {
const reader = new FileReader();
reader.addEventListener("load", () => {
if (reader.result) img.src = reader.result;
});
reader.readAsDataURL(file);
} else {
img.src = (void 0).URL.createObjectURL(file);
}
});
}
const listItemProps = () => {
return {
prefixCls: String,
locale: objectType(void 0),
file: objectType(),
items: arrayType(),
listType: stringType(),
isImgUrl: functionType(),
showRemoveIcon: booleanType(),
showDownloadIcon: booleanType(),
showPreviewIcon: booleanType(),
removeIcon: functionType(),
downloadIcon: functionType(),
previewIcon: functionType(),
iconRender: functionType(),
actionIconRender: functionType(),
itemRender: functionType(),
onPreview: functionType(),
onClose: functionType(),
onDownload: functionType(),
progress: objectType()
};
};
const ListItem = defineComponent({
compatConfig: {
MODE: 3
},
name: "ListItem",
inheritAttrs: false,
props: listItemProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
var _a;
const showProgress = shallowRef(false);
shallowRef();
const mergedStatus = shallowRef((_a = props2.file) === null || _a === void 0 ? void 0 : _a.status);
watch(() => {
var _a2;
return (_a2 = props2.file) === null || _a2 === void 0 ? void 0 : _a2.status;
}, (status) => {
if (status !== "removed") {
mergedStatus.value = status;
}
});
const {
rootPrefixCls
} = useConfigInject("upload", props2);
const transitionProps = computed(() => getTransitionProps(`${rootPrefixCls.value}-fade`));
return () => {
var _a2, _b;
const {
prefixCls,
locale: locale2,
listType,
file,
items,
progress: progressProps2,
iconRender = slots.iconRender,
actionIconRender = slots.actionIconRender,
itemRender = slots.itemRender,
isImgUrl,
showPreviewIcon,
showRemoveIcon,
showDownloadIcon,
previewIcon: customPreviewIcon = slots.previewIcon,
removeIcon: customRemoveIcon = slots.removeIcon,
downloadIcon: customDownloadIcon = slots.downloadIcon,
onPreview,
onDownload,
onClose
} = props2;
const {
class: className,
style
} = attrs;
const iconNode = iconRender({
file
});
let icon = createVNode("div", {
"class": `${prefixCls}-text-icon`
}, [iconNode]);
if (listType === "picture" || listType === "picture-card") {
if (mergedStatus.value === "uploading" || !file.thumbUrl && !file.url) {
const uploadingClassName = {
[`${prefixCls}-list-item-thumbnail`]: true,
[`${prefixCls}-list-item-file`]: mergedStatus.value !== "uploading"
};
icon = createVNode("div", {
"class": uploadingClassName
}, [iconNode]);
} else {
const thumbnail = (isImgUrl === null || isImgUrl === void 0 ? void 0 : isImgUrl(file)) ? createVNode("img", {
"src": file.thumbUrl || file.url,
"alt": file.name,
"class": `${prefixCls}-list-item-image`,
"crossorigin": file.crossOrigin
}, null) : iconNode;
const aClassName = {
[`${prefixCls}-list-item-thumbnail`]: true,
[`${prefixCls}-list-item-file`]: isImgUrl && !isImgUrl(file)
};
icon = createVNode("a", {
"class": aClassName,
"onClick": (e) => onPreview(file, e),
"href": file.url || file.thumbUrl,
"target": "_blank",
"rel": "noopener noreferrer"
}, [thumbnail]);
}
}
const infoUploadingClass = {
[`${prefixCls}-list-item`]: true,
[`${prefixCls}-list-item-${mergedStatus.value}`]: true
};
const linkProps2 = typeof file.linkProps === "string" ? JSON.parse(file.linkProps) : file.linkProps;
const removeIcon = showRemoveIcon ? actionIconRender({
customIcon: customRemoveIcon ? customRemoveIcon({
file
}) : createVNode(DeleteOutlined, null, null),
callback: () => onClose(file),
prefixCls,
title: locale2.removeFile
}) : null;
const downloadIcon = showDownloadIcon && mergedStatus.value === "done" ? actionIconRender({
customIcon: customDownloadIcon ? customDownloadIcon({
file
}) : createVNode(DownloadOutlined, null, null),
callback: () => onDownload(file),
prefixCls,
title: locale2.downloadFile
}) : null;
const downloadOrDelete = listType !== "picture-card" && createVNode("span", {
"key": "download-delete",
"class": [`${prefixCls}-list-item-actions`, {
picture: listType === "picture"
}]
}, [downloadIcon, removeIcon]);
const listItemNameClass = `${prefixCls}-list-item-name`;
const fileName = file.url ? [createVNode("a", _objectSpread$W(_objectSpread$W({
"key": "view",
"target": "_blank",
"rel": "noopener noreferrer",
"class": listItemNameClass,
"title": file.name
}, linkProps2), {}, {
"href": file.url,
"onClick": (e) => onPreview(file, e)
}), [file.name]), downloadOrDelete] : [createVNode("span", {
"key": "view",
"class": listItemNameClass,
"onClick": (e) => onPreview(file, e),
"title": file.name
}, [file.name]), downloadOrDelete];
const previewStyle = {
pointerEvents: "none",
opacity: 0.5
};
const previewIcon = showPreviewIcon ? createVNode("a", {
"href": file.url || file.thumbUrl,
"target": "_blank",
"rel": "noopener noreferrer",
"style": file.url || file.thumbUrl ? void 0 : previewStyle,
"onClick": (e) => onPreview(file, e),
"title": locale2.previewFile
}, [customPreviewIcon ? customPreviewIcon({
file
}) : createVNode(EyeOutlined, null, null)]) : null;
const pictureCardActions = listType === "picture-card" && mergedStatus.value !== "uploading" && createVNode("span", {
"class": `${prefixCls}-list-item-actions`
}, [previewIcon, mergedStatus.value === "done" && downloadIcon, removeIcon]);
const dom = createVNode("div", {
"class": infoUploadingClass
}, [icon, fileName, pictureCardActions, showProgress.value && createVNode(Transition, transitionProps.value, {
default: () => [withDirectives(createVNode("div", {
"class": `${prefixCls}-list-item-progress`
}, ["percent" in file ? createVNode(__nuxt_component_1$2, _objectSpread$W(_objectSpread$W({}, progressProps2), {}, {
"type": "line",
"percent": file.percent
}), null) : null]), [[vShow, mergedStatus.value === "uploading"]])]
})]);
const listContainerNameClass = {
[`${prefixCls}-list-item-container`]: true,
[`${className}`]: !!className
};
const message = file.response && typeof file.response === "string" ? file.response : ((_a2 = file.error) === null || _a2 === void 0 ? void 0 : _a2.statusText) || ((_b = file.error) === null || _b === void 0 ? void 0 : _b.message) || locale2.uploadError;
const item = mergedStatus.value === "error" ? createVNode(__nuxt_component_2$4, {
"title": message,
"getPopupContainer": (node) => node.parentNode
}, {
default: () => [dom]
}) : dom;
return createVNode("div", {
"class": listContainerNameClass,
"style": style
}, [itemRender ? itemRender({
originNode: item,
file,
fileList: items,
actions: {
download: onDownload.bind(null, file),
preview: onPreview.bind(null, file),
remove: onClose.bind(null, file)
}
}) : item]);
};
}
});
const HackSlot = (_, _ref) => {
let {
slots
} = _ref;
var _a;
return filterEmpty((_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots))[0];
};
const UploadList = defineComponent({
compatConfig: {
MODE: 3
},
name: "AUploadList",
props: initDefaultProps(uploadListProps(), {
listType: "text",
progress: {
strokeWidth: 2,
showInfo: false
},
showRemoveIcon: true,
showDownloadIcon: false,
showPreviewIcon: true,
previewFile: previewImage,
isImageUrl,
items: [],
appendActionVisible: true
}),
setup(props2, _ref2) {
let {
slots,
expose
} = _ref2;
const motionAppear = shallowRef(false);
const mergedItems = shallowRef([]);
watch(() => props2.items, function() {
let val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
mergedItems.value = val.slice();
}, {
immediate: true,
deep: true
});
watchEffect(() => {
if (props2.listType !== "picture" && props2.listType !== "picture-card") {
return;
}
(props2.items || []).forEach((file, index2) => {
{
return;
}
});
});
const onInternalPreview = (file, e) => {
if (!props2.onPreview) {
return;
}
e === null || e === void 0 ? void 0 : e.preventDefault();
return props2.onPreview(file);
};
const onInternalDownload = (file) => {
if (typeof props2.onDownload === "function") {
props2.onDownload(file);
} else if (file.url) {
(void 0).open(file.url);
}
};
const onInternalClose = (file) => {
var _a;
(_a = props2.onRemove) === null || _a === void 0 ? void 0 : _a.call(props2, file);
};
const internalIconRender = (_ref3) => {
let {
file
} = _ref3;
const iconRender = props2.iconRender || slots.iconRender;
if (iconRender) {
return iconRender({
file,
listType: props2.listType
});
}
const isLoading = file.status === "uploading";
const fileIcon = props2.isImageUrl && props2.isImageUrl(file) ? createVNode(PictureTwoTone, null, null) : createVNode(FileTwoTone, null, null);
let icon = isLoading ? createVNode(LoadingOutlined, null, null) : createVNode(PaperClipOutlined, null, null);
if (props2.listType === "picture") {
icon = isLoading ? createVNode(LoadingOutlined, null, null) : fileIcon;
} else if (props2.listType === "picture-card") {
icon = isLoading ? props2.locale.uploading : fileIcon;
}
return icon;
};
const actionIconRender = (opt) => {
const {
customIcon,
callback,
prefixCls: prefixCls2,
title
} = opt;
const btnProps = {
type: "text",
size: "small",
title,
onClick: () => {
callback();
},
class: `${prefixCls2}-list-item-action`
};
if (isValidElement(customIcon)) {
return createVNode(Button, btnProps, {
icon: () => customIcon
});
}
return createVNode(Button, btnProps, {
default: () => [createVNode("span", null, [customIcon])]
});
};
expose({
handlePreview: onInternalPreview,
handleDownload: onInternalDownload
});
const {
prefixCls,
rootPrefixCls
} = useConfigInject("upload", props2);
const listClassNames = computed(() => ({
[`${prefixCls.value}-list`]: true,
[`${prefixCls.value}-list-${props2.listType}`]: true
}));
const transitionGroupProps = computed(() => {
const motion = _extends({}, collapseMotion(`${rootPrefixCls.value}-motion-collapse`));
delete motion.onAfterAppear;
delete motion.onAfterEnter;
delete motion.onAfterLeave;
const motionConfig = _extends(_extends({}, getTransitionGroupProps(`${prefixCls.value}-${props2.listType === "picture-card" ? "animate-inline" : "animate"}`)), {
class: listClassNames.value,
appear: motionAppear.value
});
return props2.listType !== "picture-card" ? _extends(_extends({}, motion), motionConfig) : motionConfig;
});
return () => {
const {
listType,
locale: locale2,
isImageUrl: isImgUrl,
showPreviewIcon,
showRemoveIcon,
showDownloadIcon,
removeIcon,
previewIcon,
downloadIcon,
progress,
appendAction,
itemRender,
appendActionVisible
} = props2;
const appendActionDom = appendAction === null || appendAction === void 0 ? void 0 : appendAction();
const items = mergedItems.value;
return createVNode(TransitionGroup, _objectSpread$W(_objectSpread$W({}, transitionGroupProps.value), {}, {
"tag": "div"
}), {
default: () => [items.map((file) => {
const {
uid: key2
} = file;
return createVNode(ListItem, {
"key": key2,
"locale": locale2,
"prefixCls": prefixCls.value,
"file": file,
"items": items,
"progress": progress,
"listType": listType,
"isImgUrl": isImgUrl,
"showPreviewIcon": showPreviewIcon,
"showRemoveIcon": showRemoveIcon,
"showDownloadIcon": showDownloadIcon,
"onPreview": onInternalPreview,
"onDownload": onInternalDownload,
"onClose": onInternalClose,
"removeIcon": removeIcon,
"previewIcon": previewIcon,
"downloadIcon": downloadIcon,
"itemRender": itemRender
}, _extends(_extends({}, slots), {
iconRender: internalIconRender,
actionIconRender
}));
}), appendAction ? withDirectives(createVNode(HackSlot, {
"key": "__ant_upload_appendAction"
}, {
default: () => appendActionDom
}), [[vShow, !!appendActionVisible]]) : null]
});
};
}
});
const genDraggerStyle = (token) => {
const {
componentCls,
iconCls
} = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-drag`]: {
position: "relative",
width: "100%",
height: "100%",
textAlign: "center",
background: token.colorFillAlter,
border: `${token.lineWidth}px dashed ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
cursor: "pointer",
transition: `border-color ${token.motionDurationSlow}`,
[componentCls]: {
padding: `${token.padding}px 0`
},
[`${componentCls}-btn`]: {
display: "table",
width: "100%",
height: "100%",
outline: "none"
},
[`${componentCls}-drag-container`]: {
display: "table-cell",
verticalAlign: "middle"
},
[`&:not(${componentCls}-disabled):hover`]: {
borderColor: token.colorPrimaryHover
},
[`p${componentCls}-drag-icon`]: {
marginBottom: token.margin,
[iconCls]: {
color: token.colorPrimary,
fontSize: token.uploadThumbnailSize
}
},
[`p${componentCls}-text`]: {
margin: `0 0 ${token.marginXXS}px`,
color: token.colorTextHeading,
fontSize: token.fontSizeLG
},
[`p${componentCls}-hint`]: {
color: token.colorTextDescription,
fontSize: token.fontSize
},
// ===================== Disabled =====================
[`&${componentCls}-disabled`]: {
cursor: "not-allowed",
[`p${componentCls}-drag-icon ${iconCls},
p${componentCls}-text,
p${componentCls}-hint
`]: {
color: token.colorTextDisabled
}
}
}
}
};
};
const genListStyle = (token) => {
const {
componentCls,
antCls,
iconCls,
fontSize,
lineHeight
} = token;
const itemCls = `${componentCls}-list-item`;
const actionsCls = `${itemCls}-actions`;
const actionCls = `${itemCls}-action`;
const listItemHeightSM = Math.round(fontSize * lineHeight);
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-list`]: _extends(_extends({}, clearFix()), {
lineHeight: token.lineHeight,
[itemCls]: {
position: "relative",
height: token.lineHeight * fontSize,
marginTop: token.marginXS,
fontSize,
display: "flex",
alignItems: "center",
transition: `background-color ${token.motionDurationSlow}`,
"&:hover": {
backgroundColor: token.controlItemBgHover
},
[`${itemCls}-name`]: _extends(_extends({}, textEllipsis), {
padding: `0 ${token.paddingXS}px`,
lineHeight,
flex: "auto",
transition: `all ${token.motionDurationSlow}`
}),
[actionsCls]: {
[actionCls]: {
opacity: 0
},
[`${actionCls}${antCls}-btn-sm`]: {
height: listItemHeightSM,
border: 0,
lineHeight: 1,
// FIXME: should not override small button
"> span": {
transform: "scale(1)"
}
},
[`
${actionCls}:focus,
&.picture ${actionCls}
`]: {
opacity: 1
},
[iconCls]: {
color: token.colorTextDescription,
transition: `all ${token.motionDurationSlow}`
},
[`&:hover ${iconCls}`]: {
color: token.colorText
}
},
[`${componentCls}-icon ${iconCls}`]: {
color: token.colorTextDescription,
fontSize
},
[`${itemCls}-progress`]: {
position: "absolute",
bottom: -token.uploadProgressOffset,
width: "100%",
paddingInlineStart: fontSize + token.paddingXS,
fontSize,
lineHeight: 0,
pointerEvents: "none",
"> div": {
margin: 0
}
}
},
[`${itemCls}:hover ${actionCls}`]: {
opacity: 1,
color: token.colorText
},
[`${itemCls}-error`]: {
color: token.colorError,
[`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
color: token.colorError
},
[actionsCls]: {
[`${iconCls}, ${iconCls}:hover`]: {
color: token.colorError
},
[actionCls]: {
opacity: 1
}
}
},
[`${componentCls}-list-item-container`]: {
transition: `opacity ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
// For smooth removing animation
"&::before": {
display: "table",
width: 0,
height: 0,
content: '""'
}
}
})
}
};
};
const uploadAnimateInlineIn = new Keyframe("uploadAnimateInlineIn", {
from: {
width: 0,
height: 0,
margin: 0,
padding: 0,
opacity: 0
}
});
const uploadAnimateInlineOut = new Keyframe("uploadAnimateInlineOut", {
to: {
width: 0,
height: 0,
margin: 0,
padding: 0,
opacity: 0
}
});
const genMotionStyle = (token) => {
const {
componentCls
} = token;
const inlineCls = `${componentCls}-animate-inline`;
return [{
[`${componentCls}-wrapper`]: {
[`${inlineCls}-appear, ${inlineCls}-enter, ${inlineCls}-leave`]: {
animationDuration: token.motionDurationSlow,
animationTimingFunction: token.motionEaseInOutCirc,
animationFillMode: "forwards"
},
[`${inlineCls}-appear, ${inlineCls}-enter`]: {
animationName: uploadAnimateInlineIn
},
[`${inlineCls}-leave`]: {
animationName: uploadAnimateInlineOut
}
}
}, uploadAnimateInlineIn, uploadAnimateInlineOut];
};
const genPictureStyle = (token) => {
const {
componentCls,
iconCls,
uploadThumbnailSize,
uploadProgressOffset
} = token;
const listCls = `${componentCls}-list`;
const itemCls = `${listCls}-item`;
return {
[`${componentCls}-wrapper`]: {
// ${listCls} 增加优先级
[`${listCls}${listCls}-picture, ${listCls}${listCls}-picture-card`]: {
[itemCls]: {
position: "relative",
height: uploadThumbnailSize + token.lineWidth * 2 + token.paddingXS * 2,
padding: token.paddingXS,
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
"&:hover": {
background: "transparent"
},
[`${itemCls}-thumbnail`]: _extends(_extends({}, textEllipsis), {
width: uploadThumbnailSize,
height: uploadThumbnailSize,
lineHeight: `${uploadThumbnailSize + token.paddingSM}px`,
textAlign: "center",
flex: "none",
[iconCls]: {
fontSize: token.fontSizeHeading2,
color: token.colorPrimary
},
img: {
display: "block",
width: "100%",
height: "100%",
overflow: "hidden"
}
}),
[`${itemCls}-progress`]: {
bottom: uploadProgressOffset,
width: `calc(100% - ${token.paddingSM * 2}px)`,
marginTop: 0,
paddingInlineStart: uploadThumbnailSize + token.paddingXS
}
},
[`${itemCls}-error`]: {
borderColor: token.colorError,
// Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
[`${itemCls}-thumbnail ${iconCls}`]: {
[`svg path[fill='#e6f7ff']`]: {
fill: token.colorErrorBg
},
[`svg path[fill='#1890ff']`]: {
fill: token.colorError
}
}
},
[`${itemCls}-uploading`]: {
borderStyle: "dashed",
[`${itemCls}-name`]: {
marginBottom: uploadProgressOffset
}
}
}
}
};
};
const genPictureCardStyle = (token) => {
const {
componentCls,
iconCls,
fontSizeLG,
colorTextLightSolid
} = token;
const listCls = `${componentCls}-list`;
const itemCls = `${listCls}-item`;
const uploadPictureCardSize = token.uploadPicCardSize;
return {
[`${componentCls}-wrapper${componentCls}-picture-card-wrapper`]: _extends(_extends({}, clearFix()), {
display: "inline-block",
width: "100%",
[`${componentCls}${componentCls}-select`]: {
width: uploadPictureCardSize,
height: uploadPictureCardSize,
marginInlineEnd: token.marginXS,
marginBottom: token.marginXS,
textAlign: "center",
verticalAlign: "top",
backgroundColor: token.colorFillAlter,
border: `${token.lineWidth}px dashed ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
cursor: "pointer",
transition: `border-color ${token.motionDurationSlow}`,
[`> ${componentCls}`]: {
display: "flex",
alignItems: "center",
justifyContent: "center",
height: "100%",
textAlign: "center"
},
[`&:not(${componentCls}-disabled):hover`]: {
borderColor: token.colorPrimary
}
},
// list
[`${listCls}${listCls}-picture-card`]: {
[`${listCls}-item-container`]: {
display: "inline-block",
width: uploadPictureCardSize,
height: uploadPictureCardSize,
marginBlock: `0 ${token.marginXS}px`,
marginInline: `0 ${token.marginXS}px`,
verticalAlign: "top"
},
"&::after": {
display: "none"
},
[itemCls]: {
height: "100%",
margin: 0,
"&::before": {
position: "absolute",
zIndex: 1,
width: `calc(100% - ${token.paddingXS * 2}px)`,
height: `calc(100% - ${token.paddingXS * 2}px)`,
backgroundColor: token.colorBgMask,
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
content: '" "'
}
},
[`${itemCls}:hover`]: {
[`&::before, ${itemCls}-actions`]: {
opacity: 1
}
},
[`${itemCls}-actions`]: {
position: "absolute",
insetInlineStart: 0,
zIndex: 10,
width: "100%",
whiteSpace: "nowrap",
textAlign: "center",
opacity: 0,
transition: `all ${token.motionDurationSlow}`,
[`${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
zIndex: 10,
width: fontSizeLG,
margin: `0 ${token.marginXXS}px`,
fontSize: fontSizeLG,
cursor: "pointer",
transition: `all ${token.motionDurationSlow}`
}
},
[`${itemCls}-actions, ${itemCls}-actions:hover`]: {
[`${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
color: new TinyColor(colorTextLightSolid).setAlpha(0.65).toRgbString(),
"&:hover": {
color: colorTextLightSolid
}
}
},
[`${itemCls}-thumbnail, ${itemCls}-thumbnail img`]: {
position: "static",
display: "block",
width: "100%",
height: "100%",
objectFit: "contain"
},
[`${itemCls}-name`]: {
display: "none",
textAlign: "center"
},
[`${itemCls}-file + ${itemCls}-name`]: {
position: "absolute",
bottom: token.margin,
display: "block",
width: `calc(100% - ${token.paddingXS * 2}px)`
},
[`${itemCls}-uploading`]: {
[`&${itemCls}`]: {
backgroundColor: token.colorFillAlter
},
[`&::before, ${iconCls}-eye, ${iconCls}-download, ${iconCls}-delete`]: {
display: "none"
}
},
[`${itemCls}-progress`]: {
bottom: token.marginXL,
width: `calc(100% - ${token.paddingXS * 2}px)`,
paddingInlineStart: 0
}
}
})
};
};
const genRtlStyle = (token) => {
const {
componentCls
} = token;
return {
[`${componentCls}-rtl`]: {
direction: "rtl"
}
};
};
const genBaseStyle$2 = (token) => {
const {
componentCls,
colorTextDisabled
} = token;
return {
[`${componentCls}-wrapper`]: _extends(_extends({}, resetComponent(token)), {
[componentCls]: {
outline: 0,
"input[type='file']": {
cursor: "pointer"
}
},
[`${componentCls}-select`]: {
display: "inline-block"
},
[`${componentCls}-disabled`]: {
color: colorTextDisabled,
cursor: "not-allowed"
}
})
};
};
const useStyle$5 = genComponentStyleHook("Upload", (token) => {
const {
fontSizeHeading3,
fontSize,
lineHeight,
lineWidth,
controlHeightLG
} = token;
const listItemHeightSM = Math.round(fontSize * lineHeight);
const uploadToken = merge(token, {
uploadThumbnailSize: fontSizeHeading3 * 2,
uploadProgressOffset: listItemHeightSM / 2 + lineWidth,
uploadPicCardSize: controlHeightLG * 2.55
});
return [genBaseStyle$2(uploadToken), genDraggerStyle(uploadToken), genPictureStyle(uploadToken), genPictureCardStyle(uploadToken), genListStyle(uploadToken), genMotionStyle(uploadToken), genRtlStyle(uploadToken), genCollapseMotion(uploadToken)];
});
var __awaiter = function(thisArg, _arguments, P, generator2) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator2.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator2["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator2 = generator2.apply(thisArg, [])).next());
});
};
var __rest$5 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
const Upload = defineComponent({
compatConfig: {
MODE: 3
},
name: "AUpload",
inheritAttrs: false,
props: initDefaultProps(uploadProps(), {
type: "select",
multiple: false,
action: "",
data: {},
accept: "",
showUploadList: true,
listType: "text",
supportServerRender: true
}),
setup(props2, _ref) {
let {
slots,
attrs,
expose
} = _ref;
const formItemContext = useInjectFormItemContext();
const {
prefixCls,
direction,
disabled
} = useConfigInject("upload", props2);
const [wrapSSR, hashId] = useStyle$5(prefixCls);
const disabledContext = useInjectDisabled();
const mergedDisabled = computed(() => {
var _a;
return (_a = disabled.value) !== null && _a !== void 0 ? _a : disabledContext.value;
});
const [mergedFileList, setMergedFileList] = useMergedState(props2.defaultFileList || [], {
value: toRef(props2, "fileList"),
postState: (list) => {
const timestamp = Date.now();
return (list !== null && list !== void 0 ? list : []).map((file, index2) => {
if (!file.uid && !Object.isFrozen(file)) {
file.uid = `__AUTO__${timestamp}_${index2}__`;
}
return file;
});
}
});
const dragState = ref("drop");
const upload = ref(null);
const onInternalChange = (file, changedFileList, event) => {
var _a, _b;
let cloneList = [...changedFileList];
if (props2.maxCount === 1) {
cloneList = cloneList.slice(-1);
} else if (props2.maxCount) {
cloneList = cloneList.slice(0, props2.maxCount);
}
setMergedFileList(cloneList);
const changeInfo = {
file,
fileList: cloneList
};
if (event) {
changeInfo.event = event;
}
(_a = props2["onUpdate:fileList"]) === null || _a === void 0 ? void 0 : _a.call(props2, changeInfo.fileList);
(_b = props2.onChange) === null || _b === void 0 ? void 0 : _b.call(props2, changeInfo);
formItemContext.onFieldChange();
};
const mergedBeforeUpload = (file, fileListArgs) => __awaiter(this, void 0, void 0, function* () {
const {
beforeUpload,
transformFile
} = props2;
let parsedFile = file;
if (beforeUpload) {
const result = yield beforeUpload(file, fileListArgs);
if (result === false) {
return false;
}
delete file[LIST_IGNORE];
if (result === LIST_IGNORE) {
Object.defineProperty(file, LIST_IGNORE, {
value: true,
configurable: true
});
return false;
}
if (typeof result === "object" && result) {
parsedFile = result;
}
}
if (transformFile) {
parsedFile = yield transformFile(parsedFile);
}
return parsedFile;
});
const onBatchStart = (batchFileInfoList) => {
const filteredFileInfoList = batchFileInfoList.filter((info) => !info.file[LIST_IGNORE]);
if (!filteredFileInfoList.length) {
return;
}
const objectFileList = filteredFileInfoList.map((info) => file2Obj(info.file));
let newFileList = [...mergedFileList.value];
objectFileList.forEach((fileObj) => {
newFileList = updateFileList(fileObj, newFileList);
});
objectFileList.forEach((fileObj, index2) => {
let triggerFileObj = fileObj;
if (!filteredFileInfoList[index2].parsedFile) {
const {
originFileObj
} = fileObj;
let clone;
try {
clone = new File([originFileObj], originFileObj.name, {
type: originFileObj.type
});
} catch (e) {
clone = new Blob([originFileObj], {
type: originFileObj.type
});
clone.name = originFileObj.name;
clone.lastModifiedDate = /* @__PURE__ */ new Date();
clone.lastModified = (/* @__PURE__ */ new Date()).getTime();
}
clone.uid = fileObj.uid;
triggerFileObj = clone;
} else {
fileObj.status = "uploading";
}
onInternalChange(triggerFileObj, newFileList);
});
};
const onSuccess = (response, file, xhr) => {
try {
if (typeof response === "string") {
response = JSON.parse(response);
}
} catch (e) {
}
if (!getFileItem(file, mergedFileList.value)) {
return;
}
const targetItem = file2Obj(file);
targetItem.status = "done";
targetItem.percent = 100;
targetItem.response = response;
targetItem.xhr = xhr;
const nextFileList = updateFileList(targetItem, mergedFileList.value);
onInternalChange(targetItem, nextFileList);
};
const onProgress = (e, file) => {
if (!getFileItem(file, mergedFileList.value)) {
return;
}
const targetItem = file2Obj(file);
targetItem.status = "uploading";
targetItem.percent = e.percent;
const nextFileList = updateFileList(targetItem, mergedFileList.value);
onInternalChange(targetItem, nextFileList, e);
};
const onError = (error, response, file) => {
if (!getFileItem(file, mergedFileList.value)) {
return;
}
const targetItem = file2Obj(file);
targetItem.error = error;
targetItem.response = response;
targetItem.status = "error";
const nextFileList = updateFileList(targetItem, mergedFileList.value);
onInternalChange(targetItem, nextFileList);
};
const handleRemove = (file) => {
let currentFile;
const mergedRemove = props2.onRemove || props2.remove;
Promise.resolve(typeof mergedRemove === "function" ? mergedRemove(file) : mergedRemove).then((ret) => {
var _a, _b;
if (ret === false) {
return;
}
const removedFileList = removeFileItem(file, mergedFileList.value);
if (removedFileList) {
currentFile = _extends(_extends({}, file), {
status: "removed"
});
(_a = mergedFileList.value) === null || _a === void 0 ? void 0 : _a.forEach((item) => {
const matchKey = currentFile.uid !== void 0 ? "uid" : "name";
if (item[matchKey] === currentFile[matchKey] && !Object.isFrozen(item)) {
item.status = "removed";
}
});
(_b = upload.value) === null || _b === void 0 ? void 0 : _b.abort(currentFile);
onInternalChange(currentFile, removedFileList);
}
});
};
const onFileDrop = (e) => {
var _a;
dragState.value = e.type;
if (e.type === "drop") {
(_a = props2.onDrop) === null || _a === void 0 ? void 0 : _a.call(props2, e);
}
};
expose({
onBatchStart,
onSuccess,
onProgress,
onError,
fileList: mergedFileList,
upload
});
const [locale2] = useLocaleReceiver("Upload", localeValues.Upload, computed(() => props2.locale));
const renderUploadList = (button, buttonVisible) => {
const {
removeIcon,
previewIcon,
downloadIcon,
previewFile,
onPreview,
onDownload,
isImageUrl: isImageUrl2,
progress,
itemRender,
iconRender,
showUploadList
} = props2;
const {
showDownloadIcon,
showPreviewIcon,
showRemoveIcon
} = typeof showUploadList === "boolean" ? {} : showUploadList;
return showUploadList ? createVNode(UploadList, {
"prefixCls": prefixCls.value,
"listType": props2.listType,
"items": mergedFileList.value,
"previewFile": previewFile,
"onPreview": onPreview,
"onDownload": onDownload,
"onRemove": handleRemove,
"showRemoveIcon": !mergedDisabled.value && showRemoveIcon,
"showPreviewIcon": showPreviewIcon,
"showDownloadIcon": showDownloadIcon,
"removeIcon": removeIcon,
"previewIcon": previewIcon,
"downloadIcon": downloadIcon,
"iconRender": iconRender,
"locale": locale2.value,
"isImageUrl": isImageUrl2,
"progress": progress,
"itemRender": itemRender,
"appendActionVisible": buttonVisible,
"appendAction": button
}, _extends({}, slots)) : button === null || button === void 0 ? void 0 : button();
};
return () => {
var _a, _b, _c;
const {
listType,
type
} = props2;
const {
class: className,
style: styleName
} = attrs, transAttrs = __rest$5(attrs, ["class", "style"]);
const rcUploadProps = _extends(_extends(_extends({
onBatchStart,
onError,
onProgress,
onSuccess
}, transAttrs), props2), {
id: (_a = props2.id) !== null && _a !== void 0 ? _a : formItemContext.id.value,
prefixCls: prefixCls.value,
beforeUpload: mergedBeforeUpload,
onChange: void 0,
disabled: mergedDisabled.value
});
delete rcUploadProps.remove;
if (!slots.default || mergedDisabled.value) {
delete rcUploadProps.id;
}
const rtlCls = {
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
};
if (type === "drag") {
const dragCls = classNames(prefixCls.value, {
[`${prefixCls.value}-drag`]: true,
[`${prefixCls.value}-drag-uploading`]: mergedFileList.value.some((file) => file.status === "uploading"),
[`${prefixCls.value}-drag-hover`]: dragState.value === "dragover",
[`${prefixCls.value}-disabled`]: mergedDisabled.value,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, attrs.class, hashId.value);
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(`${prefixCls.value}-wrapper`, rtlCls, className, hashId.value)
}), [createVNode("div", {
"class": dragCls,
"onDrop": onFileDrop,
"onDragover": onFileDrop,
"onDragleave": onFileDrop,
"style": attrs.style
}, [createVNode(Upload$1, _objectSpread$W(_objectSpread$W({}, rcUploadProps), {}, {
"ref": upload,
"class": `${prefixCls.value}-btn`
}), _objectSpread$W({
default: () => [createVNode("div", {
"class": `${prefixCls.value}-drag-container`
}, [(_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots)])]
}, slots))]), renderUploadList()]));
}
const uploadButtonCls = classNames(prefixCls.value, {
[`${prefixCls.value}-select`]: true,
[`${prefixCls.value}-select-${listType}`]: true,
[`${prefixCls.value}-disabled`]: mergedDisabled.value,
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
});
const children = flattenChildren((_c = slots.default) === null || _c === void 0 ? void 0 : _c.call(slots));
const renderUploadButton = (uploadButtonStyle) => createVNode("div", {
"class": uploadButtonCls,
"style": uploadButtonStyle
}, [createVNode(Upload$1, _objectSpread$W(_objectSpread$W({}, rcUploadProps), {}, {
"ref": upload
}), slots)]);
if (listType === "picture-card") {
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(`${prefixCls.value}-wrapper`, `${prefixCls.value}-picture-card-wrapper`, rtlCls, attrs.class, hashId.value)
}), [renderUploadList(renderUploadButton, !!(children && children.length))]));
}
return wrapSSR(createVNode("span", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(`${prefixCls.value}-wrapper`, rtlCls, attrs.class, hashId.value)
}), [renderUploadButton(children && children.length ? void 0 : {
display: "none"
}), renderUploadList()]));
};
}
});
var __rest$4 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Dragger = defineComponent({
compatConfig: {
MODE: 3
},
name: "AUploadDragger",
inheritAttrs: false,
props: uploadProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
return () => {
const {
height
} = props2, restProps = __rest$4(props2, ["height"]);
const {
style
} = attrs, restAttrs = __rest$4(attrs, ["style"]);
const draggerProps = _extends(_extends(_extends({}, restProps), restAttrs), {
type: "drag",
style: _extends(_extends({}, style), {
height: typeof height === "number" ? `${height}px` : height
})
});
return createVNode(Upload, draggerProps, slots);
};
}
});
const UploadDragger = Dragger;
const __nuxt_component_0$1 = _extends(Upload, {
Dragger,
LIST_IGNORE,
install(app) {
app.component(Upload.name, Upload);
app.component(Dragger.name, Dragger);
return app;
}
});
function toLowercaseSeparator(key2) {
return key2.replace(/([A-Z])/g, "-$1").toLowerCase();
}
function getStyleStr(style) {
return Object.keys(style).map((key2) => `${toLowercaseSeparator(key2)}: ${style[key2]};`).join(" ");
}
function getPixelRatio() {
return (void 0).devicePixelRatio || 1;
}
function rotateWatermark(ctx, rotateX, rotateY, rotate) {
ctx.translate(rotateX, rotateY);
ctx.rotate(Math.PI / 180 * Number(rotate));
ctx.translate(-rotateX, -rotateY);
}
const reRendering = (mutation, watermarkElement) => {
let flag = false;
if (mutation.removedNodes.length) {
flag = Array.from(mutation.removedNodes).some((node) => node === watermarkElement);
}
if (mutation.type === "attributes" && mutation.target === watermarkElement) {
flag = true;
}
return flag;
};
var __rest$3 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
function useMutationObserver(target, callback) {
let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
const {
window = defaultWindow
} = options, mutationOptions = __rest$3(options, ["window"]);
let observer;
const isSupported = useSupported(() => window && "MutationObserver" in window);
const cleanup2 = () => {
if (observer) {
observer.disconnect();
observer = void 0;
}
};
const stopWatch = watch(() => unrefElement(target), (el) => {
cleanup2();
if (isSupported.value && window && el) {
observer = new MutationObserver(callback);
observer.observe(el, mutationOptions);
}
}, {
immediate: true
});
const stop = () => {
cleanup2();
stopWatch();
};
tryOnScopeDispose(stop);
return {
isSupported,
stop
};
}
const BaseSize = 2;
const FontGap = 3;
const watermarkProps = () => ({
zIndex: Number,
rotate: Number,
width: Number,
height: Number,
image: String,
content: someType([String, Array]),
font: objectType(),
rootClassName: String,
gap: arrayType(),
offset: arrayType()
});
const Watermark = defineComponent({
name: "AWatermark",
inheritAttrs: false,
props: initDefaultProps(watermarkProps(), {
zIndex: 9,
rotate: -22,
font: {},
gap: [100, 100]
}),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const [, token] = useToken();
const containerRef = shallowRef();
const watermarkRef = shallowRef();
const stopObservation = shallowRef(false);
const gapX = computed(() => {
var _a, _b;
return (_b = (_a = props2.gap) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : 100;
});
const gapY = computed(() => {
var _a, _b;
return (_b = (_a = props2.gap) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 100;
});
const gapXCenter = computed(() => gapX.value / 2);
const gapYCenter = computed(() => gapY.value / 2);
const offsetLeft = computed(() => {
var _a, _b;
return (_b = (_a = props2.offset) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : gapXCenter.value;
});
const offsetTop = computed(() => {
var _a, _b;
return (_b = (_a = props2.offset) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : gapYCenter.value;
});
const fontSize = computed(() => {
var _a, _b;
return (_b = (_a = props2.font) === null || _a === void 0 ? void 0 : _a.fontSize) !== null && _b !== void 0 ? _b : token.value.fontSizeLG;
});
const fontWeight = computed(() => {
var _a, _b;
return (_b = (_a = props2.font) === null || _a === void 0 ? void 0 : _a.fontWeight) !== null && _b !== void 0 ? _b : "normal";
});
const fontStyle = computed(() => {
var _a, _b;
return (_b = (_a = props2.font) === null || _a === void 0 ? void 0 : _a.fontStyle) !== null && _b !== void 0 ? _b : "normal";
});
const fontFamily = computed(() => {
var _a, _b;
return (_b = (_a = props2.font) === null || _a === void 0 ? void 0 : _a.fontFamily) !== null && _b !== void 0 ? _b : "sans-serif";
});
const color = computed(() => {
var _a, _b;
return (_b = (_a = props2.font) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : token.value.colorFill;
});
const markStyle = computed(() => {
var _a;
const markStyle2 = {
zIndex: (_a = props2.zIndex) !== null && _a !== void 0 ? _a : 9,
position: "absolute",
left: 0,
top: 0,
width: "100%",
height: "100%",
pointerEvents: "none",
backgroundRepeat: "repeat"
};
let positionLeft = offsetLeft.value - gapXCenter.value;
let positionTop = offsetTop.value - gapYCenter.value;
if (positionLeft > 0) {
markStyle2.left = `${positionLeft}px`;
markStyle2.width = `calc(100% - ${positionLeft}px)`;
positionLeft = 0;
}
if (positionTop > 0) {
markStyle2.top = `${positionTop}px`;
markStyle2.height = `calc(100% - ${positionTop}px)`;
positionTop = 0;
}
markStyle2.backgroundPosition = `${positionLeft}px ${positionTop}px`;
return markStyle2;
});
const destroyWatermark = () => {
if (watermarkRef.value) {
watermarkRef.value.remove();
watermarkRef.value = void 0;
}
};
const appendWatermark = (base64Url, markWidth) => {
var _a;
if (containerRef.value && watermarkRef.value) {
stopObservation.value = true;
watermarkRef.value.setAttribute("style", getStyleStr(_extends(_extends({}, markStyle.value), {
backgroundImage: `url('${base64Url}')`,
backgroundSize: `${(gapX.value + markWidth) * BaseSize}px`
})));
(_a = containerRef.value) === null || _a === void 0 ? void 0 : _a.append(watermarkRef.value);
setTimeout(() => {
stopObservation.value = false;
});
}
};
const getMarkSize = (ctx) => {
let defaultWidth = 120;
let defaultHeight = 64;
const content = props2.content;
const image = props2.image;
const width = props2.width;
const height = props2.height;
if (!image && ctx.measureText) {
ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
const contents = Array.isArray(content) ? content : [content];
const widths = contents.map((item) => ctx.measureText(item).width);
defaultWidth = Math.ceil(Math.max(...widths));
defaultHeight = Number(fontSize.value) * contents.length + (contents.length - 1) * FontGap;
}
return [width !== null && width !== void 0 ? width : defaultWidth, height !== null && height !== void 0 ? height : defaultHeight];
};
const fillTexts = (ctx, drawX, drawY, drawWidth, drawHeight) => {
const ratio = getPixelRatio();
const content = props2.content;
const mergedFontSize = Number(fontSize.value) * ratio;
ctx.font = `${fontStyle.value} normal ${fontWeight.value} ${mergedFontSize}px/${drawHeight}px ${fontFamily.value}`;
ctx.fillStyle = color.value;
ctx.textAlign = "center";
ctx.textBaseline = "top";
ctx.translate(drawWidth / 2, 0);
const contents = Array.isArray(content) ? content : [content];
contents === null || contents === void 0 ? void 0 : contents.forEach((item, index2) => {
ctx.fillText(item !== null && item !== void 0 ? item : "", drawX, drawY + index2 * (mergedFontSize + FontGap * ratio));
});
};
const renderWatermark = () => {
var _a;
const canvas = (void 0).createElement("canvas");
const ctx = canvas.getContext("2d");
const image = props2.image;
const rotate = (_a = props2.rotate) !== null && _a !== void 0 ? _a : -22;
if (ctx) {
if (!watermarkRef.value) {
watermarkRef.value = (void 0).createElement("div");
}
const ratio = getPixelRatio();
const [markWidth, markHeight] = getMarkSize(ctx);
const canvasWidth = (gapX.value + markWidth) * ratio;
const canvasHeight = (gapY.value + markHeight) * ratio;
canvas.setAttribute("width", `${canvasWidth * BaseSize}px`);
canvas.setAttribute("height", `${canvasHeight * BaseSize}px`);
const drawX = gapX.value * ratio / 2;
const drawY = gapY.value * ratio / 2;
const drawWidth = markWidth * ratio;
const drawHeight = markHeight * ratio;
const rotateX = (drawWidth + gapX.value * ratio) / 2;
const rotateY = (drawHeight + gapY.value * ratio) / 2;
const alternateDrawX = drawX + canvasWidth;
const alternateDrawY = drawY + canvasHeight;
const alternateRotateX = rotateX + canvasWidth;
const alternateRotateY = rotateY + canvasHeight;
ctx.save();
rotateWatermark(ctx, rotateX, rotateY, rotate);
if (image) {
const img = new Image();
img.onload = () => {
ctx.drawImage(img, drawX, drawY, drawWidth, drawHeight);
ctx.restore();
rotateWatermark(ctx, alternateRotateX, alternateRotateY, rotate);
ctx.drawImage(img, alternateDrawX, alternateDrawY, drawWidth, drawHeight);
appendWatermark(canvas.toDataURL(), markWidth);
};
img.crossOrigin = "anonymous";
img.referrerPolicy = "no-referrer";
img.src = image;
} else {
fillTexts(ctx, drawX, drawY, drawWidth, drawHeight);
ctx.restore();
rotateWatermark(ctx, alternateRotateX, alternateRotateY, rotate);
fillTexts(ctx, alternateDrawX, alternateDrawY, drawWidth, drawHeight);
appendWatermark(canvas.toDataURL(), markWidth);
}
}
};
watch(() => [props2, token.value.colorFill, token.value.fontSizeLG], () => {
renderWatermark();
}, {
deep: true,
flush: "post"
});
const onMutate = (mutations) => {
if (stopObservation.value) {
return;
}
mutations.forEach((mutation) => {
if (reRendering(mutation, watermarkRef.value)) {
destroyWatermark();
renderWatermark();
}
});
};
useMutationObserver(containerRef, onMutate, {
attributes: true,
subtree: true,
childList: true,
attributeFilter: ["style", "class"]
});
return () => {
var _a;
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"ref": containerRef,
"class": [attrs.class, props2.rootClassName],
"style": [{
position: "relative"
}, attrs.style]
}), [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]);
};
}
});
const index$5 = withInstall(Watermark);
function getItemDisabledStyle(cls, token) {
return {
[`${cls}, ${cls}:hover, ${cls}:focus`]: {
color: token.colorTextDisabled,
cursor: "not-allowed"
}
};
}
function getItemSelectedStyle(token) {
return {
backgroundColor: token.bgColorSelected,
boxShadow: token.boxShadow
};
}
const segmentedTextEllipsisCss = _extends({
overflow: "hidden"
}, textEllipsis);
const genSegmentedStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: _extends(_extends(_extends(_extends(_extends({}, resetComponent(token)), {
display: "inline-block",
padding: token.segmentedContainerPadding,
color: token.labelColor,
backgroundColor: token.bgColor,
borderRadius: token.borderRadius,
transition: `all ${token.motionDurationMid} ${token.motionEaseInOut}`,
[`${componentCls}-group`]: {
position: "relative",
display: "flex",
alignItems: "stretch",
justifyItems: "flex-start",
width: "100%"
},
// RTL styles
[`&${componentCls}-rtl`]: {
direction: "rtl"
},
// block styles
[`&${componentCls}-block`]: {
display: "flex"
},
[`&${componentCls}-block ${componentCls}-item`]: {
flex: 1,
minWidth: 0
},
// item styles
[`${componentCls}-item`]: {
position: "relative",
textAlign: "center",
cursor: "pointer",
transition: `color ${token.motionDurationMid} ${token.motionEaseInOut}`,
borderRadius: token.borderRadiusSM,
"&-selected": _extends(_extends({}, getItemSelectedStyle(token)), {
color: token.labelColorHover
}),
"&::after": {
content: '""',
position: "absolute",
width: "100%",
height: "100%",
top: 0,
insetInlineStart: 0,
borderRadius: "inherit",
transition: `background-color ${token.motionDurationMid}`,
pointerEvents: "none"
},
[`&:hover:not(${componentCls}-item-selected):not(${componentCls}-item-disabled)`]: {
color: token.labelColorHover,
"&::after": {
backgroundColor: token.bgColorHover
}
},
"&-label": _extends({
minHeight: token.controlHeight - token.segmentedContainerPadding * 2,
lineHeight: `${token.controlHeight - token.segmentedContainerPadding * 2}px`,
padding: `0 ${token.segmentedPaddingHorizontal}px`
}, segmentedTextEllipsisCss),
// syntactic sugar to add `icon` for Segmented Item
"&-icon + *": {
marginInlineStart: token.marginSM / 2
},
"&-input": {
position: "absolute",
insetBlockStart: 0,
insetInlineStart: 0,
width: 0,
height: 0,
opacity: 0,
pointerEvents: "none"
}
},
// thumb styles
[`${componentCls}-thumb`]: _extends(_extends({}, getItemSelectedStyle(token)), {
position: "absolute",
insetBlockStart: 0,
insetInlineStart: 0,
width: 0,
height: "100%",
padding: `${token.paddingXXS}px 0`,
borderRadius: token.borderRadiusSM,
[`& ~ ${componentCls}-item:not(${componentCls}-item-selected):not(${componentCls}-item-disabled)::after`]: {
backgroundColor: "transparent"
}
}),
// size styles
[`&${componentCls}-lg`]: {
borderRadius: token.borderRadiusLG,
[`${componentCls}-item-label`]: {
minHeight: token.controlHeightLG - token.segmentedContainerPadding * 2,
lineHeight: `${token.controlHeightLG - token.segmentedContainerPadding * 2}px`,
padding: `0 ${token.segmentedPaddingHorizontal}px`,
fontSize: token.fontSizeLG
},
[`${componentCls}-item, ${componentCls}-thumb`]: {
borderRadius: token.borderRadius
}
},
[`&${componentCls}-sm`]: {
borderRadius: token.borderRadiusSM,
[`${componentCls}-item-label`]: {
minHeight: token.controlHeightSM - token.segmentedContainerPadding * 2,
lineHeight: `${token.controlHeightSM - token.segmentedContainerPadding * 2}px`,
padding: `0 ${token.segmentedPaddingHorizontalSM}px`
},
[`${componentCls}-item, ${componentCls}-thumb`]: {
borderRadius: token.borderRadiusXS
}
}
}), getItemDisabledStyle(`&-disabled ${componentCls}-item`, token)), getItemDisabledStyle(`${componentCls}-item-disabled`, token)), {
// transition effect when `appear-active`
[`${componentCls}-thumb-motion-appear-active`]: {
transition: `transform ${token.motionDurationSlow} ${token.motionEaseInOut}, width ${token.motionDurationSlow} ${token.motionEaseInOut}`,
willChange: "transform, width"
}
})
};
};
const useStyle$4 = genComponentStyleHook("Segmented", (token) => {
const {
lineWidthBold,
lineWidth,
colorTextLabel,
colorText,
colorFillSecondary,
colorBgLayout,
colorBgElevated
} = token;
const segmentedToken = merge(token, {
segmentedPaddingHorizontal: token.controlPaddingHorizontal - lineWidth,
segmentedPaddingHorizontalSM: token.controlPaddingHorizontalSM - lineWidth,
segmentedContainerPadding: lineWidthBold,
labelColor: colorTextLabel,
labelColorHover: colorText,
bgColor: colorBgLayout,
bgColorHover: colorFillSecondary,
bgColorSelected: colorBgElevated
});
return [genSegmentedStyle(segmentedToken)];
});
const calcThumbStyle = (targetElement) => targetElement ? {
left: targetElement.offsetLeft,
right: targetElement.parentElement.clientWidth - targetElement.clientWidth - targetElement.offsetLeft,
width: targetElement.clientWidth
} : null;
const toPX = (value) => value !== void 0 ? `${value}px` : void 0;
const MotionThumb = defineComponent({
props: {
value: anyType(),
getValueIndex: anyType(),
prefixCls: anyType(),
motionName: anyType(),
onMotionStart: anyType(),
onMotionEnd: anyType(),
direction: anyType(),
containerRef: anyType()
},
emits: ["motionStart", "motionEnd"],
setup(props2, _ref) {
let {
emit
} = _ref;
const thumbRef = ref();
const findValueElement = (val) => {
var _a;
const index2 = props2.getValueIndex(val);
const ele = (_a = props2.containerRef.value) === null || _a === void 0 ? void 0 : _a.querySelectorAll(`.${props2.prefixCls}-item`)[index2];
return (ele === null || ele === void 0 ? void 0 : ele.offsetParent) && ele;
};
const prevStyle = ref(null);
const nextStyle = ref(null);
watch(() => props2.value, (value, prevValue) => {
const prev = findValueElement(prevValue);
const next = findValueElement(value);
const calcPrevStyle = calcThumbStyle(prev);
const calcNextStyle = calcThumbStyle(next);
prevStyle.value = calcPrevStyle;
nextStyle.value = calcNextStyle;
if (prev && next) {
emit("motionStart");
} else {
emit("motionEnd");
}
}, {
flush: "post"
});
const thumbStart = computed(() => {
var _a, _b;
return props2.direction === "rtl" ? toPX(-((_a = prevStyle.value) === null || _a === void 0 ? void 0 : _a.right)) : toPX((_b = prevStyle.value) === null || _b === void 0 ? void 0 : _b.left);
});
const thumbActive = computed(() => {
var _a, _b;
return props2.direction === "rtl" ? toPX(-((_a = nextStyle.value) === null || _a === void 0 ? void 0 : _a.right)) : toPX((_b = nextStyle.value) === null || _b === void 0 ? void 0 : _b.left);
});
let timeid;
const onAppearStart = (el) => {
clearTimeout(timeid);
nextTick(() => {
if (el) {
el.style.transform = `translateX(var(--thumb-start-left))`;
el.style.width = `var(--thumb-start-width)`;
}
});
};
const onAppearActive = (el) => {
timeid = setTimeout(() => {
if (el) {
addClass(el, `${props2.motionName}-appear-active`);
el.style.transform = `translateX(var(--thumb-active-left))`;
el.style.width = `var(--thumb-active-width)`;
}
});
};
const onAppearEnd = (el) => {
prevStyle.value = null;
nextStyle.value = null;
if (el) {
el.style.transform = null;
el.style.width = null;
removeClass(el, `${props2.motionName}-appear-active`);
}
emit("motionEnd");
};
const mergedStyle = computed(() => {
var _a, _b;
return {
"--thumb-start-left": thumbStart.value,
"--thumb-start-width": toPX((_a = prevStyle.value) === null || _a === void 0 ? void 0 : _a.width),
"--thumb-active-left": thumbActive.value,
"--thumb-active-width": toPX((_b = nextStyle.value) === null || _b === void 0 ? void 0 : _b.width)
};
});
return () => {
const motionProps = {
ref: thumbRef,
style: mergedStyle.value,
class: [`${props2.prefixCls}-thumb`]
};
return createVNode(Transition, {
"appear": true,
"onBeforeEnter": onAppearStart,
"onEnter": onAppearActive,
"onAfterEnter": onAppearEnd
}, {
default: () => [!prevStyle.value || !nextStyle.value ? null : createVNode("div", motionProps, null)]
});
};
}
});
function normalizeOptions(options) {
return options.map((option) => {
if (typeof option === "object" && option !== null) {
return option;
}
return {
label: option === null || option === void 0 ? void 0 : option.toString(),
title: option === null || option === void 0 ? void 0 : option.toString(),
value: option
};
});
}
const segmentedProps = () => {
return {
prefixCls: String,
options: arrayType(),
block: booleanType(),
disabled: booleanType(),
size: stringType(),
value: _extends(_extends({}, someType([String, Number])), {
required: true
}),
motionName: String,
onChange: functionType(),
"onUpdate:value": functionType()
};
};
const SegmentedOption = (props2, _ref) => {
let {
slots,
emit
} = _ref;
const {
value,
disabled,
payload,
title,
prefixCls,
label = slots.label,
checked,
className
} = props2;
const handleChange = (event) => {
if (disabled) {
return;
}
emit("change", event, value);
};
return createVNode("label", {
"class": classNames({
[`${prefixCls}-item-disabled`]: disabled
}, className)
}, [createVNode("input", {
"class": `${prefixCls}-item-input`,
"type": "radio",
"disabled": disabled,
"checked": checked,
"onChange": handleChange
}, null), createVNode("div", {
"class": `${prefixCls}-item-label`,
"title": typeof title === "string" ? title : ""
}, [typeof label === "function" ? label({
value,
disabled,
payload,
title
}) : label !== null && label !== void 0 ? label : value])]);
};
SegmentedOption.inheritAttrs = false;
const Segmented = defineComponent({
name: "ASegmented",
inheritAttrs: false,
props: initDefaultProps(segmentedProps(), {
options: [],
motionName: "thumb-motion"
}),
slots: Object,
setup(props2, _ref2) {
let {
emit,
slots,
attrs
} = _ref2;
const {
prefixCls,
direction,
size
} = useConfigInject("segmented", props2);
const [wrapSSR, hashId] = useStyle$4(prefixCls);
const rootRef = shallowRef();
const thumbShow = shallowRef(false);
const segmentedOptions = computed(() => normalizeOptions(props2.options));
const handleChange = (_event, val) => {
if (props2.disabled) {
return;
}
emit("update:value", val);
emit("change", val);
};
return () => {
const pre = prefixCls.value;
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(pre, {
[hashId.value]: true,
[`${pre}-block`]: props2.block,
[`${pre}-disabled`]: props2.disabled,
[`${pre}-lg`]: size.value == "large",
[`${pre}-sm`]: size.value == "small",
[`${pre}-rtl`]: direction.value === "rtl"
}, attrs.class),
"ref": rootRef
}), [createVNode("div", {
"class": `${pre}-group`
}, [createVNode(MotionThumb, {
"containerRef": rootRef,
"prefixCls": pre,
"value": props2.value,
"motionName": `${pre}-${props2.motionName}`,
"direction": direction.value,
"getValueIndex": (val) => segmentedOptions.value.findIndex((n) => n.value === val),
"onMotionStart": () => {
thumbShow.value = true;
},
"onMotionEnd": () => {
thumbShow.value = false;
}
}, null), segmentedOptions.value.map((segmentedOption) => createVNode(SegmentedOption, _objectSpread$W(_objectSpread$W({
"key": segmentedOption.value,
"prefixCls": pre,
"checked": segmentedOption.value === props2.value,
"onChange": handleChange
}, segmentedOption), {}, {
"className": classNames(segmentedOption.className, `${pre}-item`, {
[`${pre}-item-selected`]: segmentedOption.value === props2.value && !thumbShow.value
}),
"disabled": !!props2.disabled || !!segmentedOption.disabled
}), slots))])]));
};
}
});
const index$4 = withInstall(Segmented);
const genQRCodeStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: _extends(_extends({}, resetComponent(token)), {
display: "flex",
justifyContent: "center",
alignItems: "center",
padding: token.paddingSM,
backgroundColor: token.colorWhite,
borderRadius: token.borderRadiusLG,
border: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
position: "relative",
width: "100%",
height: "100%",
overflow: "hidden",
[`& > ${componentCls}-mask`]: {
position: "absolute",
insetBlockStart: 0,
insetInlineStart: 0,
zIndex: 10,
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
width: "100%",
height: "100%",
color: token.colorText,
lineHeight: token.lineHeight,
background: token.QRCodeMaskBackgroundColor,
textAlign: "center",
[`& > ${componentCls}-expired , & > ${componentCls}-scanned`]: {
color: token.QRCodeTextColor
}
},
"&-icon": {
marginBlockEnd: token.marginXS,
fontSize: token.controlHeight
}
}),
[`${componentCls}-borderless`]: {
borderColor: "transparent"
}
};
};
const useStyle$3 = genComponentStyleHook("QRCode", (token) => genQRCodeStyle(merge(token, {
QRCodeTextColor: "rgba(0, 0, 0, 0.88)",
QRCodeMaskBackgroundColor: "rgba(255, 255, 255, 0.96)"
})));
const qrProps = () => {
return {
size: {
type: Number,
default: 160
},
value: {
type: String,
required: true
},
type: stringType("canvas"),
color: String,
bgColor: String,
includeMargin: Boolean,
imageSettings: objectType()
};
};
const qrcodeProps = () => {
return _extends(_extends({}, qrProps()), {
errorLevel: stringType("M"),
icon: String,
iconSize: {
type: Number,
default: 40
},
status: stringType("active"),
bordered: {
type: Boolean,
default: true
}
});
};
/**
* @license QR Code generator library (TypeScript)
* Copyright (c) Project Nayuki.
* SPDX-License-Identifier: MIT
*/
var qrcodegen;
(function(qrcodegen2) {
class QrCode {
/*-- Static factory functions (high level) --*/
// Returns a QR Code representing the given Unicode text string at the given error correction level.
// As a conservative upper bound, this function is guaranteed to succeed for strings that have 738 or fewer
// Unicode code points (not UTF-16 code units) if the low error correction level is used. The smallest possible
// QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the
// ecl argument if it can be done without increasing the version.
static encodeText(text, ecl) {
const segs = qrcodegen2.QrSegment.makeSegments(text);
return QrCode.encodeSegments(segs, ecl);
}
// Returns a QR Code representing the given binary data at the given error correction level.
// This function always encodes using the binary segment mode, not any text mode. The maximum number of
// bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
// The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
static encodeBinary(data, ecl) {
const seg = qrcodegen2.QrSegment.makeBytes(data);
return QrCode.encodeSegments([seg], ecl);
}
/*-- Static factory functions (mid level) --*/
// Returns a QR Code representing the given segments with the given encoding parameters.
// The smallest possible QR Code version within the given range is automatically
// chosen for the output. Iff boostEcl is true, then the ECC level of the result
// may be higher than the ecl argument if it can be done without increasing the
// version. The mask number is either between 0 to 7 (inclusive) to force that
// mask, or -1 to automatically choose an appropriate mask (which may be slow).
// This function allows the user to create a custom sequence of segments that switches
// between modes (such as alphanumeric and byte) to encode text in less space.
// This is a mid-level API; the high-level API is encodeText() and encodeBinary().
static encodeSegments(segs, ecl) {
let minVersion = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
let maxVersion = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 40;
let mask = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
let boostEcl = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
if (!(QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= QrCode.MAX_VERSION) || mask < -1 || mask > 7) throw new RangeError("Invalid value");
let version2;
let dataUsedBits;
for (version2 = minVersion; ; version2++) {
const dataCapacityBits2 = QrCode.getNumDataCodewords(version2, ecl) * 8;
const usedBits = QrSegment.getTotalBits(segs, version2);
if (usedBits <= dataCapacityBits2) {
dataUsedBits = usedBits;
break;
}
if (version2 >= maxVersion)
throw new RangeError("Data too long");
}
for (const newEcl of [QrCode.Ecc.MEDIUM, QrCode.Ecc.QUARTILE, QrCode.Ecc.HIGH]) {
if (boostEcl && dataUsedBits <= QrCode.getNumDataCodewords(version2, newEcl) * 8) ecl = newEcl;
}
const bb = [];
for (const seg of segs) {
appendBits(seg.mode.modeBits, 4, bb);
appendBits(seg.numChars, seg.mode.numCharCountBits(version2), bb);
for (const b of seg.getData()) bb.push(b);
}
assert(bb.length == dataUsedBits);
const dataCapacityBits = QrCode.getNumDataCodewords(version2, ecl) * 8;
assert(bb.length <= dataCapacityBits);
appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);
appendBits(0, (8 - bb.length % 8) % 8, bb);
assert(bb.length % 8 == 0);
for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17) appendBits(padByte, 8, bb);
const dataCodewords = [];
while (dataCodewords.length * 8 < bb.length) dataCodewords.push(0);
bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));
return new QrCode(version2, ecl, dataCodewords, mask);
}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code with the given version number,
// error correction level, data codeword bytes, and mask number.
// This is a low-level API that most users should not use directly.
// A mid-level API is the encodeSegments() function.
constructor(version2, errorCorrectionLevel, dataCodewords, msk) {
this.version = version2;
this.errorCorrectionLevel = errorCorrectionLevel;
this.modules = [];
this.isFunction = [];
if (version2 < QrCode.MIN_VERSION || version2 > QrCode.MAX_VERSION) throw new RangeError("Version value out of range");
if (msk < -1 || msk > 7) throw new RangeError("Mask value out of range");
this.size = version2 * 4 + 17;
const row = [];
for (let i = 0; i < this.size; i++) row.push(false);
for (let i = 0; i < this.size; i++) {
this.modules.push(row.slice());
this.isFunction.push(row.slice());
}
this.drawFunctionPatterns();
const allCodewords = this.addEccAndInterleave(dataCodewords);
this.drawCodewords(allCodewords);
if (msk == -1) {
let minPenalty = 1e9;
for (let i = 0; i < 8; i++) {
this.applyMask(i);
this.drawFormatBits(i);
const penalty = this.getPenaltyScore();
if (penalty < minPenalty) {
msk = i;
minPenalty = penalty;
}
this.applyMask(i);
}
}
assert(0 <= msk && msk <= 7);
this.mask = msk;
this.applyMask(msk);
this.drawFormatBits(msk);
this.isFunction = [];
}
/*-- Accessor methods --*/
// Returns the color of the module (pixel) at the given coordinates, which is false
// for light or true for dark. The top left corner has the coordinates (x=0, y=0).
// If the given coordinates are out of bounds, then false (light) is returned.
getModule(x, y) {
return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];
}
// Modified to expose modules for easy access
getModules() {
return this.modules;
}
/*-- Private helper methods for constructor: Drawing function modules --*/
// Reads this object's version field, and draws and marks all function modules.
drawFunctionPatterns() {
for (let i = 0; i < this.size; i++) {
this.setFunctionModule(6, i, i % 2 == 0);
this.setFunctionModule(i, 6, i % 2 == 0);
}
this.drawFinderPattern(3, 3);
this.drawFinderPattern(this.size - 4, 3);
this.drawFinderPattern(3, this.size - 4);
const alignPatPos = this.getAlignmentPatternPositions();
const numAlign = alignPatPos.length;
for (let i = 0; i < numAlign; i++) {
for (let j = 0; j < numAlign; j++) {
if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0)) this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
}
}
this.drawFormatBits(0);
this.drawVersion();
}
// Draws two copies of the format bits (with its own error correction code)
// based on the given mask and this object's error correction level field.
drawFormatBits(mask) {
const data = this.errorCorrectionLevel.formatBits << 3 | mask;
let rem = data;
for (let i = 0; i < 10; i++) rem = rem << 1 ^ (rem >>> 9) * 1335;
const bits = (data << 10 | rem) ^ 21522;
assert(bits >>> 15 == 0);
for (let i = 0; i <= 5; i++) this.setFunctionModule(8, i, getBit(bits, i));
this.setFunctionModule(8, 7, getBit(bits, 6));
this.setFunctionModule(8, 8, getBit(bits, 7));
this.setFunctionModule(7, 8, getBit(bits, 8));
for (let i = 9; i < 15; i++) this.setFunctionModule(14 - i, 8, getBit(bits, i));
for (let i = 0; i < 8; i++) this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
for (let i = 8; i < 15; i++) this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
this.setFunctionModule(8, this.size - 8, true);
}
// Draws two copies of the version bits (with its own error correction code),
// based on this object's version field, iff 7 <= version <= 40.
drawVersion() {
if (this.version < 7) return;
let rem = this.version;
for (let i = 0; i < 12; i++) rem = rem << 1 ^ (rem >>> 11) * 7973;
const bits = this.version << 12 | rem;
assert(bits >>> 18 == 0);
for (let i = 0; i < 18; i++) {
const color = getBit(bits, i);
const a = this.size - 11 + i % 3;
const b = Math.floor(i / 3);
this.setFunctionModule(a, b, color);
this.setFunctionModule(b, a, color);
}
}
// Draws a 9*9 finder pattern including the border separator,
// with the center module at (x, y). Modules can be out of bounds.
drawFinderPattern(x, y) {
for (let dy = -4; dy <= 4; dy++) {
for (let dx = -4; dx <= 4; dx++) {
const dist = Math.max(Math.abs(dx), Math.abs(dy));
const xx = x + dx;
const yy = y + dy;
if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size) this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
}
}
}
// Draws a 5*5 alignment pattern, with the center module
// at (x, y). All modules must be in bounds.
drawAlignmentPattern(x, y) {
for (let dy = -2; dy <= 2; dy++) {
for (let dx = -2; dx <= 2; dx++) this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
}
}
// Sets the color of a module and marks it as a function module.
// Only used by the constructor. Coordinates must be in bounds.
setFunctionModule(x, y, isDark) {
this.modules[y][x] = isDark;
this.isFunction[y][x] = true;
}
/*-- Private helper methods for constructor: Codewords and masking --*/
// Returns a new byte string representing the given data with the appropriate error correction
// codewords appended to it, based on this object's version and error correction level.
addEccAndInterleave(data) {
const ver = this.version;
const ecl = this.errorCorrectionLevel;
if (data.length != QrCode.getNumDataCodewords(ver, ecl)) throw new RangeError("Invalid argument");
const numBlocks = QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
const blockEccLen = QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
const rawCodewords = Math.floor(QrCode.getNumRawDataModules(ver) / 8);
const numShortBlocks = numBlocks - rawCodewords % numBlocks;
const shortBlockLen = Math.floor(rawCodewords / numBlocks);
const blocks = [];
const rsDiv = QrCode.reedSolomonComputeDivisor(blockEccLen);
for (let i = 0, k = 0; i < numBlocks; i++) {
const dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
k += dat.length;
const ecc = QrCode.reedSolomonComputeRemainder(dat, rsDiv);
if (i < numShortBlocks) dat.push(0);
blocks.push(dat.concat(ecc));
}
const result = [];
for (let i = 0; i < blocks[0].length; i++) {
blocks.forEach((block, j) => {
if (i != shortBlockLen - blockEccLen || j >= numShortBlocks) result.push(block[i]);
});
}
assert(result.length == rawCodewords);
return result;
}
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
// data area of this QR Code. Function modules need to be marked off before this is called.
drawCodewords(data) {
if (data.length != Math.floor(QrCode.getNumRawDataModules(this.version) / 8)) throw new RangeError("Invalid argument");
let i = 0;
for (let right = this.size - 1; right >= 1; right -= 2) {
if (right == 6) right = 5;
for (let vert = 0; vert < this.size; vert++) {
for (let j = 0; j < 2; j++) {
const x = right - j;
const upward = (right + 1 & 2) == 0;
const y = upward ? this.size - 1 - vert : vert;
if (!this.isFunction[y][x] && i < data.length * 8) {
this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
i++;
}
}
}
}
assert(i == data.length * 8);
}
// XORs the codeword modules in this QR Code with the given mask pattern.
// The function modules must be marked and the codeword bits must be drawn
// before masking. Due to the arithmetic of XOR, calling applyMask() with
// the same mask value a second time will undo the mask. A final well-formed
// QR Code needs exactly one (not zero, two, etc.) mask applied.
applyMask(mask) {
if (mask < 0 || mask > 7) throw new RangeError("Mask value out of range");
for (let y = 0; y < this.size; y++) {
for (let x = 0; x < this.size; x++) {
let invert;
switch (mask) {
case 0:
invert = (x + y) % 2 == 0;
break;
case 1:
invert = y % 2 == 0;
break;
case 2:
invert = x % 3 == 0;
break;
case 3:
invert = (x + y) % 3 == 0;
break;
case 4:
invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;
break;
case 5:
invert = x * y % 2 + x * y % 3 == 0;
break;
case 6:
invert = (x * y % 2 + x * y % 3) % 2 == 0;
break;
case 7:
invert = ((x + y) % 2 + x * y % 3) % 2 == 0;
break;
default:
throw new Error("Unreachable");
}
if (!this.isFunction[y][x] && invert) this.modules[y][x] = !this.modules[y][x];
}
}
}
// Calculates and returns the penalty score based on state of this QR Code's current modules.
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
getPenaltyScore() {
let result = 0;
for (let y = 0; y < this.size; y++) {
let runColor = false;
let runX = 0;
const runHistory = [0, 0, 0, 0, 0, 0, 0];
for (let x = 0; x < this.size; x++) {
if (this.modules[y][x] == runColor) {
runX++;
if (runX == 5) result += QrCode.PENALTY_N1;
else if (runX > 5) result++;
} else {
this.finderPenaltyAddHistory(runX, runHistory);
if (!runColor) result += this.finderPenaltyCountPatterns(runHistory) * QrCode.PENALTY_N3;
runColor = this.modules[y][x];
runX = 1;
}
}
result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * QrCode.PENALTY_N3;
}
for (let x = 0; x < this.size; x++) {
let runColor = false;
let runY = 0;
const runHistory = [0, 0, 0, 0, 0, 0, 0];
for (let y = 0; y < this.size; y++) {
if (this.modules[y][x] == runColor) {
runY++;
if (runY == 5) result += QrCode.PENALTY_N1;
else if (runY > 5) result++;
} else {
this.finderPenaltyAddHistory(runY, runHistory);
if (!runColor) result += this.finderPenaltyCountPatterns(runHistory) * QrCode.PENALTY_N3;
runColor = this.modules[y][x];
runY = 1;
}
}
result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * QrCode.PENALTY_N3;
}
for (let y = 0; y < this.size - 1; y++) {
for (let x = 0; x < this.size - 1; x++) {
const color = this.modules[y][x];
if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1]) result += QrCode.PENALTY_N2;
}
}
let dark = 0;
for (const row of this.modules) dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);
const total = this.size * this.size;
const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
assert(0 <= k && k <= 9);
result += k * QrCode.PENALTY_N4;
assert(0 <= result && result <= 2568888);
return result;
}
/*-- Private helper functions --*/
// Returns an ascending list of positions of alignment patterns for this version number.
// Each position is in the range [0,177), and are used on both the x and y axes.
// This could be implemented as lookup table of 40 variable-length lists of integers.
getAlignmentPatternPositions() {
if (this.version == 1) return [];
else {
const numAlign = Math.floor(this.version / 7) + 2;
const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
const result = [6];
for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos);
return result;
}
}
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
static getNumRawDataModules(ver) {
if (ver < QrCode.MIN_VERSION || ver > QrCode.MAX_VERSION) throw new RangeError("Version number out of range");
let result = (16 * ver + 128) * ver + 64;
if (ver >= 2) {
const numAlign = Math.floor(ver / 7) + 2;
result -= (25 * numAlign - 10) * numAlign - 55;
if (ver >= 7) result -= 36;
}
assert(208 <= result && result <= 29648);
return result;
}
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
// QR Code of the given version number and error correction level, with remainder bits discarded.
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
static getNumDataCodewords(ver, ecl) {
return Math.floor(QrCode.getNumRawDataModules(ver) / 8) - QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
}
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
static reedSolomonComputeDivisor(degree) {
if (degree < 1 || degree > 255) throw new RangeError("Degree out of range");
const result = [];
for (let i = 0; i < degree - 1; i++) result.push(0);
result.push(1);
let root = 1;
for (let i = 0; i < degree; i++) {
for (let j = 0; j < result.length; j++) {
result[j] = QrCode.reedSolomonMultiply(result[j], root);
if (j + 1 < result.length) result[j] ^= result[j + 1];
}
root = QrCode.reedSolomonMultiply(root, 2);
}
return result;
}
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
static reedSolomonComputeRemainder(data, divisor) {
const result = divisor.map((_) => 0);
for (const b of data) {
const factor = b ^ result.shift();
result.push(0);
divisor.forEach((coef, i) => result[i] ^= QrCode.reedSolomonMultiply(coef, factor));
}
return result;
}
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
static reedSolomonMultiply(x, y) {
if (x >>> 8 != 0 || y >>> 8 != 0) throw new RangeError("Byte out of range");
let z = 0;
for (let i = 7; i >= 0; i--) {
z = z << 1 ^ (z >>> 7) * 285;
z ^= (y >>> i & 1) * x;
}
assert(z >>> 8 == 0);
return z;
}
// Can only be called immediately after a light run is added, and
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
finderPenaltyCountPatterns(runHistory) {
const n = runHistory[1];
assert(n <= this.size * 3);
const core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
}
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {
if (currentRunColor) {
this.finderPenaltyAddHistory(currentRunLength, runHistory);
currentRunLength = 0;
}
currentRunLength += this.size;
this.finderPenaltyAddHistory(currentRunLength, runHistory);
return this.finderPenaltyCountPatterns(runHistory);
}
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
finderPenaltyAddHistory(currentRunLength, runHistory) {
if (runHistory[0] == 0) currentRunLength += this.size;
runHistory.pop();
runHistory.unshift(currentRunLength);
}
}
QrCode.MIN_VERSION = 1;
QrCode.MAX_VERSION = 40;
QrCode.PENALTY_N1 = 3;
QrCode.PENALTY_N2 = 3;
QrCode.PENALTY_N3 = 40;
QrCode.PENALTY_N4 = 10;
QrCode.ECC_CODEWORDS_PER_BLOCK = [
// Version: (note that index 0 is for padding, and is set to an illegal value)
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
[-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
[-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
[-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
[-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
// High
];
QrCode.NUM_ERROR_CORRECTION_BLOCKS = [
// Version: (note that index 0 is for padding, and is set to an illegal value)
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
[-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
[-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
[-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
// High
];
qrcodegen2.QrCode = QrCode;
function appendBits(val, len, bb) {
if (len < 0 || len > 31 || val >>> len != 0) throw new RangeError("Value out of range");
for (let i = len - 1; i >= 0; i--) bb.push(val >>> i & 1);
}
function getBit(x, i) {
return (x >>> i & 1) != 0;
}
function assert(cond) {
if (!cond) throw new Error("Assertion error");
}
class QrSegment {
/*-- Static factory functions (mid level) --*/
// Returns a segment representing the given binary data encoded in
// byte mode. All input byte arrays are acceptable. Any text string
// can be converted to UTF-8 bytes and encoded as a byte mode segment.
static makeBytes(data) {
const bb = [];
for (const b of data) appendBits(b, 8, bb);
return new QrSegment(QrSegment.Mode.BYTE, data.length, bb);
}
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
static makeNumeric(digits) {
if (!QrSegment.isNumeric(digits)) throw new RangeError("String contains non-numeric characters");
const bb = [];
for (let i = 0; i < digits.length; ) {
const n = Math.min(digits.length - i, 3);
appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);
i += n;
}
return new QrSegment(QrSegment.Mode.NUMERIC, digits.length, bb);
}
// Returns a segment representing the given text string encoded in alphanumeric mode.
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
static makeAlphanumeric(text) {
if (!QrSegment.isAlphanumeric(text)) throw new RangeError("String contains unencodable characters in alphanumeric mode");
const bb = [];
let i;
for (i = 0; i + 2 <= text.length; i += 2) {
let temp = QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;
temp += QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));
appendBits(temp, 11, bb);
}
if (i < text.length)
appendBits(QrSegment.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);
return new QrSegment(QrSegment.Mode.ALPHANUMERIC, text.length, bb);
}
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
static makeSegments(text) {
if (text == "") return [];
else if (QrSegment.isNumeric(text)) return [QrSegment.makeNumeric(text)];
else if (QrSegment.isAlphanumeric(text)) return [QrSegment.makeAlphanumeric(text)];
else return [QrSegment.makeBytes(QrSegment.toUtf8ByteArray(text))];
}
// Returns a segment representing an Extended Channel Interpretation
// (ECI) designator with the given assignment value.
static makeEci(assignVal) {
const bb = [];
if (assignVal < 0) throw new RangeError("ECI assignment value out of range");
else if (assignVal < 1 << 7) appendBits(assignVal, 8, bb);
else if (assignVal < 1 << 14) {
appendBits(2, 2, bb);
appendBits(assignVal, 14, bb);
} else if (assignVal < 1e6) {
appendBits(6, 3, bb);
appendBits(assignVal, 21, bb);
} else throw new RangeError("ECI assignment value out of range");
return new QrSegment(QrSegment.Mode.ECI, 0, bb);
}
// Tests whether the given string can be encoded as a segment in numeric mode.
// A string is encodable iff each character is in the range 0 to 9.
static isNumeric(text) {
return QrSegment.NUMERIC_REGEX.test(text);
}
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
static isAlphanumeric(text) {
return QrSegment.ALPHANUMERIC_REGEX.test(text);
}
/*-- Constructor (low level) and fields --*/
// Creates a new QR Code segment with the given attributes and data.
// The character count (numChars) must agree with the mode and the bit buffer length,
// but the constraint isn't checked. The given bit buffer is cloned and stored.
constructor(mode, numChars, bitData) {
this.mode = mode;
this.numChars = numChars;
this.bitData = bitData;
if (numChars < 0) throw new RangeError("Invalid argument");
this.bitData = bitData.slice();
}
/*-- Methods --*/
// Returns a new copy of the data bits of this segment.
getData() {
return this.bitData.slice();
}
// (Package-private) Calculates and returns the number of bits needed to encode the given segments at
// the given version. The result is infinity if a segment has too many characters to fit its length field.
static getTotalBits(segs, version2) {
let result = 0;
for (const seg of segs) {
const ccbits = seg.mode.numCharCountBits(version2);
if (seg.numChars >= 1 << ccbits) return Infinity;
result += 4 + ccbits + seg.bitData.length;
}
return result;
}
// Returns a new array of bytes representing the given string encoded in UTF-8.
static toUtf8ByteArray(str) {
str = encodeURI(str);
const result = [];
for (let i = 0; i < str.length; i++) {
if (str.charAt(i) != "%") result.push(str.charCodeAt(i));
else {
result.push(parseInt(str.substring(i + 1, i + 3), 16));
i += 2;
}
}
return result;
}
}
QrSegment.NUMERIC_REGEX = /^[0-9]*$/;
QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
qrcodegen2.QrSegment = QrSegment;
})(qrcodegen || (qrcodegen = {}));
(function(qrcodegen2) {
(function(QrCode) {
class Ecc {
/*-- Constructor and fields --*/
constructor(ordinal, formatBits) {
this.ordinal = ordinal;
this.formatBits = formatBits;
}
}
Ecc.LOW = new Ecc(0, 1);
Ecc.MEDIUM = new Ecc(1, 0);
Ecc.QUARTILE = new Ecc(2, 3);
Ecc.HIGH = new Ecc(3, 2);
QrCode.Ecc = Ecc;
})(qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));
})(qrcodegen || (qrcodegen = {}));
(function(qrcodegen2) {
(function(QrSegment) {
class Mode {
/*-- Constructor and fields --*/
constructor(modeBits, numBitsCharCount) {
this.modeBits = modeBits;
this.numBitsCharCount = numBitsCharCount;
}
/*-- Method --*/
// (Package-private) Returns the bit width of the character count field for a segment in
// this mode in a QR Code at the given version number. The result is in the range [0, 16].
numCharCountBits(ver) {
return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
}
}
Mode.NUMERIC = new Mode(1, [10, 12, 14]);
Mode.ALPHANUMERIC = new Mode(2, [9, 11, 13]);
Mode.BYTE = new Mode(4, [8, 16, 16]);
Mode.KANJI = new Mode(8, [8, 10, 12]);
Mode.ECI = new Mode(7, [0, 0, 0]);
QrSegment.Mode = Mode;
})(qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));
})(qrcodegen || (qrcodegen = {}));
const ERROR_LEVEL_MAP = {
L: qrcodegen.QrCode.Ecc.LOW,
M: qrcodegen.QrCode.Ecc.MEDIUM,
Q: qrcodegen.QrCode.Ecc.QUARTILE,
H: qrcodegen.QrCode.Ecc.HIGH
};
const DEFAULT_SIZE = 128;
const DEFAULT_LEVEL = "L";
const DEFAULT_BGCOLOR = "#FFFFFF";
const DEFAULT_FGCOLOR = "#000000";
const DEFAULT_INCLUDEMARGIN = false;
const SPEC_MARGIN_SIZE = 4;
const DEFAULT_MARGIN_SIZE = 0;
const DEFAULT_IMG_SCALE = 0.1;
function generatePath(modules) {
let margin = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
const ops = [];
modules.forEach(function(row, y) {
let start = null;
row.forEach(function(cell, x) {
if (!cell && start !== null) {
ops.push(`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`);
start = null;
return;
}
if (x === row.length - 1) {
if (!cell) {
return;
}
if (start === null) {
ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);
} else {
ops.push(`M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`);
}
return;
}
if (cell && start === null) {
start = x;
}
});
});
return ops.join("");
}
function excavateModules(modules, excavation) {
return modules.slice().map((row, y) => {
if (y < excavation.y || y >= excavation.y + excavation.h) {
return row;
}
return row.map((cell, x) => {
if (x < excavation.x || x >= excavation.x + excavation.w) {
return cell;
}
return false;
});
});
}
function getImageSettings(cells, size, margin, imageSettings) {
if (imageSettings == null) {
return null;
}
const numCells = cells.length + margin * 2;
const defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);
const scale = numCells / size;
const w = (imageSettings.width || defaultSize) * scale;
const h2 = (imageSettings.height || defaultSize) * scale;
const x = imageSettings.x == null ? cells.length / 2 - w / 2 : imageSettings.x * scale;
const y = imageSettings.y == null ? cells.length / 2 - h2 / 2 : imageSettings.y * scale;
let excavation = null;
if (imageSettings.excavate) {
const floorX = Math.floor(x);
const floorY = Math.floor(y);
const ceilW = Math.ceil(w + x - floorX);
const ceilH = Math.ceil(h2 + y - floorY);
excavation = {
x: floorX,
y: floorY,
w: ceilW,
h: ceilH
};
}
return {
x,
y,
h: h2,
w,
excavation
};
}
function getMarginSize(includeMargin, marginSize) {
if (marginSize != null) {
return Math.floor(marginSize);
}
return includeMargin ? SPEC_MARGIN_SIZE : DEFAULT_MARGIN_SIZE;
}
const SUPPORTS_PATH2D = (function() {
try {
new Path2D().addPath(new Path2D());
} catch (e) {
return false;
}
return true;
})();
const QRCodeCanvas = defineComponent({
name: "QRCodeCanvas",
inheritAttrs: false,
props: _extends(_extends({}, qrProps()), {
level: String,
bgColor: String,
fgColor: String,
marginSize: Number
}),
setup(props2, _ref) {
let {
attrs,
expose
} = _ref;
const imgSrc = computed(() => {
var _a;
return (_a = props2.imageSettings) === null || _a === void 0 ? void 0 : _a.src;
});
const _canvas = shallowRef(null);
const _image = shallowRef(null);
const isImgLoaded = shallowRef(false);
expose({
toDataURL: (type, quality) => {
var _a;
return (_a = _canvas.value) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality);
}
});
watchEffect(() => {
const {
value,
size = DEFAULT_SIZE,
level = DEFAULT_LEVEL,
bgColor = DEFAULT_BGCOLOR,
fgColor = DEFAULT_FGCOLOR,
includeMargin = DEFAULT_INCLUDEMARGIN,
marginSize,
imageSettings
} = props2;
if (_canvas.value != null) {
const canvas = _canvas.value;
const ctx = canvas.getContext("2d");
if (!ctx) {
return;
}
let cells = qrcodegen.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
const margin = getMarginSize(includeMargin, marginSize);
const numCells = cells.length + margin * 2;
const calculatedImageSettings = getImageSettings(cells, size, margin, imageSettings);
const image = _image.value;
const haveImageToRender = isImgLoaded.value && calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
if (haveImageToRender) {
if (calculatedImageSettings.excavation != null) {
cells = excavateModules(cells, calculatedImageSettings.excavation);
}
}
const pixelRatio = (void 0).devicePixelRatio || 1;
canvas.height = canvas.width = size * pixelRatio;
const scale = size / numCells * pixelRatio;
ctx.scale(scale, scale);
ctx.fillStyle = bgColor;
ctx.fillRect(0, 0, numCells, numCells);
ctx.fillStyle = fgColor;
if (SUPPORTS_PATH2D) {
ctx.fill(new Path2D(generatePath(cells, margin)));
} else {
cells.forEach(function(row, rdx) {
row.forEach(function(cell, cdx) {
if (cell) {
ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
}
});
});
}
if (haveImageToRender) {
ctx.drawImage(image, calculatedImageSettings.x + margin, calculatedImageSettings.y + margin, calculatedImageSettings.w, calculatedImageSettings.h);
}
}
}, {
flush: "post"
});
watch(imgSrc, () => {
isImgLoaded.value = false;
});
return () => {
var _a;
const size = (_a = props2.size) !== null && _a !== void 0 ? _a : DEFAULT_SIZE;
const canvasStyle = {
height: `${size}px`,
width: `${size}px`
};
let img = null;
if (imgSrc.value != null) {
img = createVNode("img", {
"src": imgSrc.value,
"key": imgSrc.value,
"style": {
display: "none"
},
"onLoad": () => {
isImgLoaded.value = true;
},
"ref": _image
}, null);
}
return createVNode(Fragment, null, [createVNode("canvas", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"style": [canvasStyle, attrs.style],
"ref": _canvas
}), null), img]);
};
}
});
const QRCodeSVG = defineComponent({
name: "QRCodeSVG",
inheritAttrs: false,
props: _extends(_extends({}, qrProps()), {
color: String,
level: String,
bgColor: String,
fgColor: String,
marginSize: Number,
title: String
}),
setup(props2) {
let cells = null;
let margin = null;
let numCells = null;
let calculatedImageSettings = null;
let fgPath = null;
let image = null;
watchEffect(() => {
const {
value,
size = DEFAULT_SIZE,
level = DEFAULT_LEVEL,
includeMargin = DEFAULT_INCLUDEMARGIN,
marginSize,
imageSettings
} = props2;
cells = qrcodegen.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
margin = getMarginSize(includeMargin, marginSize);
numCells = cells.length + margin * 2;
calculatedImageSettings = getImageSettings(cells, size, margin, imageSettings);
if (imageSettings != null && calculatedImageSettings != null) {
if (calculatedImageSettings.excavation != null) {
cells = excavateModules(cells, calculatedImageSettings.excavation);
}
image = createVNode("image", {
"xlink:href": imageSettings.src,
"height": calculatedImageSettings.h,
"width": calculatedImageSettings.w,
"x": calculatedImageSettings.x + margin,
"y": calculatedImageSettings.y + margin,
"preserveAspectRatio": "none"
}, null);
}
fgPath = generatePath(cells, margin);
});
return () => {
const bgColor = props2.bgColor && DEFAULT_BGCOLOR;
const fgColor = props2.fgColor && DEFAULT_FGCOLOR;
return createVNode("svg", {
"height": props2.size,
"width": props2.size,
"viewBox": `0 0 ${numCells} ${numCells}`
}, [!!props2.title && createVNode("title", null, [props2.title]), createVNode("path", {
"fill": bgColor,
"d": `M0,0 h${numCells}v${numCells}H0z`,
"shape-rendering": "crispEdges"
}, null), createVNode("path", {
"fill": fgColor,
"d": fgPath,
"shape-rendering": "crispEdges"
}, null), image]);
};
}
});
const QRCode = defineComponent({
name: "AQrcode",
inheritAttrs: false,
props: qrcodeProps(),
emits: ["refresh"],
setup(props2, _ref) {
let {
emit,
attrs,
expose
} = _ref;
const [locale2] = useLocaleReceiver("QRCode");
const {
prefixCls
} = useConfigInject("qrcode", props2);
const [wrapSSR, hashId] = useStyle$3(prefixCls);
const [, token] = useToken();
const qrCodeCanvas = ref();
expose({
toDataURL: (type, quality) => {
var _a;
return (_a = qrCodeCanvas.value) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality);
}
});
const qrCodeProps = computed(() => {
const {
value,
icon = "",
size = 160,
iconSize = 40,
color = token.value.colorText,
bgColor = "transparent",
errorLevel = "M"
} = props2;
const imageSettings = {
src: icon,
x: void 0,
y: void 0,
height: iconSize,
width: iconSize,
excavate: true
};
return {
value,
size: size - (token.value.paddingSM + token.value.lineWidth) * 2,
level: errorLevel,
bgColor,
fgColor: color,
imageSettings: icon ? imageSettings : void 0
};
});
return () => {
const pre = prefixCls.value;
return wrapSSR(createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"style": [attrs.style, {
width: `${props2.size}px`,
height: `${props2.size}px`,
backgroundColor: qrCodeProps.value.bgColor
}],
"class": [hashId.value, pre, {
[`${pre}-borderless`]: !props2.bordered
}]
}), [props2.status !== "active" && createVNode("div", {
"class": `${pre}-mask`
}, [props2.status === "loading" && createVNode(Spin, null, null), props2.status === "expired" && createVNode(Fragment, null, [createVNode("p", {
"class": `${pre}-expired`
}, [locale2.value.expired]), createVNode(Button, {
"type": "link",
"onClick": (e) => emit("refresh", e)
}, {
default: () => [locale2.value.refresh],
icon: () => createVNode(ReloadOutlined, null, null)
})]), props2.status === "scanned" && createVNode("p", {
"class": `${pre}-scanned`
}, [locale2.value.scanned])]), props2.type === "canvas" ? createVNode(QRCodeCanvas, _objectSpread$W({
"ref": qrCodeCanvas
}, qrCodeProps.value), null) : createVNode(QRCodeSVG, qrCodeProps.value, null)]));
};
}
});
const index$3 = withInstall(QRCode);
function useTarget(target, open2, gap, scrollIntoViewOptions) {
const [targetElement, setTargetElement] = useState$1(void 0);
watchEffect(() => {
const nextElement = typeof target.value === "function" ? target.value() : target.value;
setTargetElement(nextElement || null);
}, {
flush: "post"
});
const [posInfo, setPosInfo] = useState$1(null);
const mergedPosInfo = computed(() => {
var _a, _b;
if (!posInfo.value) {
return posInfo.value;
}
const gapOffset = ((_a = gap.value) === null || _a === void 0 ? void 0 : _a.offset) || 6;
const gapRadius = ((_b = gap.value) === null || _b === void 0 ? void 0 : _b.radius) || 2;
return {
left: posInfo.value.left - gapOffset,
top: posInfo.value.top - gapOffset,
width: posInfo.value.width + gapOffset * 2,
height: posInfo.value.height + gapOffset * 2,
radius: gapRadius
};
});
return [mergedPosInfo, targetElement];
}
const tourStepInfo = () => ({
arrow: someType([Boolean, Object]),
target: someType([String, Function, Object]),
title: someType([String, Object]),
description: someType([String, Object]),
placement: stringType(),
mask: someType([Object, Boolean], true),
className: {
type: String
},
style: objectType(),
scrollIntoViewOptions: someType([Boolean, Object])
});
const tourStepProps$1 = () => _extends(_extends({}, tourStepInfo()), {
prefixCls: {
type: String
},
total: {
type: Number
},
current: {
type: Number
},
onClose: functionType(),
onFinish: functionType(),
renderPanel: functionType(),
onPrev: functionType(),
onNext: functionType()
});
const DefaultPanel = defineComponent({
name: "DefaultPanel",
inheritAttrs: false,
props: tourStepProps$1(),
setup(props2, _ref) {
let {
attrs
} = _ref;
return () => {
const {
prefixCls,
current,
total,
title,
description,
onClose,
onPrev,
onNext,
onFinish
} = props2;
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(`${prefixCls}-content`, attrs.class)
}), [createVNode("div", {
"class": `${prefixCls}-inner`
}, [createVNode("button", {
"type": "button",
"onClick": onClose,
"aria-label": "Close",
"class": `${prefixCls}-close`
}, [createVNode("span", {
"class": `${prefixCls}-close-x`
}, [createTextVNode("×")])]), createVNode("div", {
"class": `${prefixCls}-header`
}, [createVNode("div", {
"class": `${prefixCls}-title`
}, [title])]), createVNode("div", {
"class": `${prefixCls}-description`
}, [description]), createVNode("div", {
"class": `${prefixCls}-footer`
}, [createVNode("div", {
"class": `${prefixCls}-sliders`
}, [total > 1 ? [...Array.from({
length: total
}).keys()].map((item, index2) => {
return createVNode("span", {
"key": item,
"class": index2 === current ? "active" : ""
}, null);
}) : null]), createVNode("div", {
"class": `${prefixCls}-buttons`
}, [current !== 0 ? createVNode("button", {
"class": `${prefixCls}-prev-btn`,
"onClick": onPrev
}, [createTextVNode("Prev")]) : null, current === total - 1 ? createVNode("button", {
"class": `${prefixCls}-finish-btn`,
"onClick": onFinish
}, [createTextVNode("Finish")]) : createVNode("button", {
"class": `${prefixCls}-next-btn`,
"onClick": onNext
}, [createTextVNode("Next")])])])])]);
};
}
});
const TourStep = defineComponent({
name: "TourStep",
inheritAttrs: false,
props: tourStepProps$1(),
setup(props2, _ref) {
let {
attrs
} = _ref;
return () => {
const {
current,
renderPanel
} = props2;
return createVNode(Fragment, null, [typeof renderPanel === "function" ? renderPanel(_extends(_extends({}, attrs), props2), current) : createVNode(DefaultPanel, _objectSpread$W(_objectSpread$W({}, attrs), props2), null)]);
};
}
});
function getUUID() {
let retId;
{
retId = "TEST_OR_SSR";
}
return retId;
}
function useId() {
let id = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ref("");
const innerId = `vc_unique_${getUUID()}`;
return id.value || innerId;
}
const COVER_PROPS = {
fill: "transparent",
"pointer-events": "auto"
};
const Mask = defineComponent({
name: "TourMask",
props: {
prefixCls: {
type: String
},
pos: objectType(),
rootClassName: {
type: String
},
showMask: booleanType(),
fill: {
type: String,
default: "rgba(0,0,0,0.5)"
},
open: booleanType(),
animated: someType([Boolean, Object]),
zIndex: {
type: Number
}
},
setup(props2, _ref) {
let {
attrs
} = _ref;
const id = useId();
return () => {
const {
prefixCls,
open: open2,
rootClassName,
pos,
showMask,
fill,
animated,
zIndex
} = props2;
const maskId = `${prefixCls}-mask-${id}`;
const mergedAnimated = typeof animated === "object" ? animated === null || animated === void 0 ? void 0 : animated.placeholder : animated;
return createVNode(Portal, {
"visible": open2,
"autoLock": true
}, {
default: () => open2 && createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(`${prefixCls}-mask`, rootClassName, attrs.class),
"style": [{
position: "fixed",
left: 0,
right: 0,
top: 0,
bottom: 0,
zIndex,
pointerEvents: "none"
}, attrs.style]
}), [showMask ? createVNode("svg", {
"style": {
width: "100%",
height: "100%"
}
}, [createVNode("defs", null, [createVNode("mask", {
"id": maskId
}, [createVNode("rect", {
"x": "0",
"y": "0",
"width": "100vw",
"height": "100vh",
"fill": "white"
}, null), pos && createVNode("rect", {
"x": pos.left,
"y": pos.top,
"rx": pos.radius,
"width": pos.width,
"height": pos.height,
"fill": "black",
"class": mergedAnimated ? `${prefixCls}-placeholder-animated` : ""
}, null)])]), createVNode("rect", {
"x": "0",
"y": "0",
"width": "100%",
"height": "100%",
"fill": fill,
"mask": `url(#${maskId})`
}, null), pos && createVNode(Fragment, null, [createVNode("rect", _objectSpread$W(_objectSpread$W({}, COVER_PROPS), {}, {
"x": "0",
"y": "0",
"width": "100%",
"height": pos.top
}), null), createVNode("rect", _objectSpread$W(_objectSpread$W({}, COVER_PROPS), {}, {
"x": "0",
"y": "0",
"width": pos.left,
"height": "100%"
}), null), createVNode("rect", _objectSpread$W(_objectSpread$W({}, COVER_PROPS), {}, {
"x": "0",
"y": pos.top + pos.height,
"width": "100%",
"height": `calc(100vh - ${pos.top + pos.height}px)`
}), null), createVNode("rect", _objectSpread$W(_objectSpread$W({}, COVER_PROPS), {}, {
"x": pos.left + pos.width,
"y": "0",
"width": `calc(100vw - ${pos.left + pos.width}px)`,
"height": "100%"
}), null)])]) : null])
});
};
}
});
const targetOffset = [0, 0];
const basePlacements = {
left: {
points: ["cr", "cl"],
offset: [-8, 0]
},
right: {
points: ["cl", "cr"],
offset: [8, 0]
},
top: {
points: ["bc", "tc"],
offset: [0, -8]
},
bottom: {
points: ["tc", "bc"],
offset: [0, 8]
},
topLeft: {
points: ["bl", "tl"],
offset: [0, -8]
},
leftTop: {
points: ["tr", "tl"],
offset: [-8, 0]
},
topRight: {
points: ["br", "tr"],
offset: [0, -8]
},
rightTop: {
points: ["tl", "tr"],
offset: [8, 0]
},
bottomRight: {
points: ["tr", "br"],
offset: [0, 8]
},
rightBottom: {
points: ["bl", "br"],
offset: [8, 0]
},
bottomLeft: {
points: ["tl", "bl"],
offset: [0, 8]
},
leftBottom: {
points: ["br", "bl"],
offset: [-8, 0]
}
};
function getPlacements() {
let arrowPointAtCenter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
const placements2 = {};
Object.keys(basePlacements).forEach((key2) => {
placements2[key2] = _extends(_extends({}, basePlacements[key2]), {
autoArrow: arrowPointAtCenter,
targetOffset
});
});
return placements2;
}
getPlacements();
var __rest$2 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const CENTER_PLACEHOLDER = {
left: "50%",
top: "50%",
width: "1px",
height: "1px"
};
const tourProps$1 = () => {
const {
builtinPlacements,
popupAlign
} = triggerProps();
return {
builtinPlacements,
popupAlign,
steps: arrayType(),
open: booleanType(),
defaultCurrent: {
type: Number
},
current: {
type: Number
},
onChange: functionType(),
onClose: functionType(),
onFinish: functionType(),
mask: someType([Boolean, Object], true),
arrow: someType([Boolean, Object], true),
rootClassName: {
type: String
},
placement: stringType("bottom"),
prefixCls: {
type: String,
default: "rc-tour"
},
renderPanel: functionType(),
gap: objectType(),
animated: someType([Boolean, Object]),
scrollIntoViewOptions: someType([Boolean, Object], true),
zIndex: {
type: Number,
default: 1001
}
};
};
const Tour$1 = defineComponent({
name: "Tour",
inheritAttrs: false,
props: initDefaultProps(tourProps$1(), {}),
setup(props2) {
const {
defaultCurrent,
placement,
mask,
scrollIntoViewOptions,
open: open2,
gap,
arrow
} = toRefs(props2);
const triggerRef2 = ref();
const [mergedCurrent, setMergedCurrent] = useMergedState(0, {
value: computed(() => props2.current),
defaultValue: defaultCurrent.value
});
const [mergedOpen, setMergedOpen] = useMergedState(void 0, {
value: computed(() => props2.open),
postState: (origin) => mergedCurrent.value < 0 || mergedCurrent.value >= props2.steps.length ? false : origin !== null && origin !== void 0 ? origin : true
});
const openRef = shallowRef(mergedOpen.value);
watchEffect(() => {
if (mergedOpen.value && !openRef.value) {
setMergedCurrent(0);
}
openRef.value = mergedOpen.value;
});
const curStep = computed(() => props2.steps[mergedCurrent.value] || {});
const mergedPlacement = computed(() => {
var _a;
return (_a = curStep.value.placement) !== null && _a !== void 0 ? _a : placement.value;
});
const mergedMask = computed(() => {
var _a;
return mergedOpen.value && ((_a = curStep.value.mask) !== null && _a !== void 0 ? _a : mask.value);
});
computed(() => {
var _a;
return (_a = curStep.value.scrollIntoViewOptions) !== null && _a !== void 0 ? _a : scrollIntoViewOptions.value;
});
const [posInfo, targetElement] = useTarget(computed(() => curStep.value.target), open2, gap);
const mergedArrow = computed(() => targetElement.value ? typeof curStep.value.arrow === "undefined" ? arrow.value : curStep.value.arrow : false);
const arrowPointAtCenter = computed(() => typeof mergedArrow.value === "object" ? mergedArrow.value.pointAtCenter : false);
watch(arrowPointAtCenter, () => {
var _a;
(_a = triggerRef2.value) === null || _a === void 0 ? void 0 : _a.forcePopupAlign();
});
watch(mergedCurrent, () => {
var _a;
(_a = triggerRef2.value) === null || _a === void 0 ? void 0 : _a.forcePopupAlign();
});
const onInternalChange = (nextCurrent) => {
var _a;
setMergedCurrent(nextCurrent);
(_a = props2.onChange) === null || _a === void 0 ? void 0 : _a.call(props2, nextCurrent);
};
return () => {
var _a;
const {
prefixCls,
steps,
onClose,
onFinish,
rootClassName,
renderPanel,
animated,
zIndex
} = props2, restProps = __rest$2(props2, ["prefixCls", "steps", "onClose", "onFinish", "rootClassName", "renderPanel", "animated", "zIndex"]);
if (targetElement.value === void 0) {
return null;
}
const handleClose = () => {
setMergedOpen(false);
onClose === null || onClose === void 0 ? void 0 : onClose(mergedCurrent.value);
};
const mergedShowMask = typeof mergedMask.value === "boolean" ? mergedMask.value : !!mergedMask.value;
const mergedMaskStyle = typeof mergedMask.value === "boolean" ? void 0 : mergedMask.value;
const getTriggerDOMNode = () => {
return targetElement.value || (void 0).body;
};
const getPopupElement = () => createVNode(TourStep, _objectSpread$W({
"arrow": mergedArrow.value,
"key": "content",
"prefixCls": prefixCls,
"total": steps.length,
"renderPanel": renderPanel,
"onPrev": () => {
onInternalChange(mergedCurrent.value - 1);
},
"onNext": () => {
onInternalChange(mergedCurrent.value + 1);
},
"onClose": handleClose,
"current": mergedCurrent.value,
"onFinish": () => {
handleClose();
onFinish === null || onFinish === void 0 ? void 0 : onFinish();
}
}, curStep.value), null);
const posInfoStyle = computed(() => {
const info = posInfo.value || CENTER_PLACEHOLDER;
const style = {};
Object.keys(info).forEach((key2) => {
if (typeof info[key2] === "number") {
style[key2] = `${info[key2]}px`;
} else {
style[key2] = info[key2];
}
});
return style;
});
return mergedOpen.value ? createVNode(Fragment, null, [createVNode(Mask, {
"zIndex": zIndex,
"prefixCls": prefixCls,
"pos": posInfo.value,
"showMask": mergedShowMask,
"style": mergedMaskStyle === null || mergedMaskStyle === void 0 ? void 0 : mergedMaskStyle.style,
"fill": mergedMaskStyle === null || mergedMaskStyle === void 0 ? void 0 : mergedMaskStyle.color,
"open": mergedOpen.value,
"animated": animated,
"rootClassName": rootClassName
}, null), createVNode(Trigger, _objectSpread$W(_objectSpread$W({}, restProps), {}, {
"arrow": !!restProps.arrow,
"builtinPlacements": !curStep.value.target ? void 0 : (_a = restProps.builtinPlacements) !== null && _a !== void 0 ? _a : getPlacements(arrowPointAtCenter.value),
"ref": triggerRef2,
"popupStyle": !curStep.value.target ? _extends(_extends({}, curStep.value.style), {
position: "fixed",
left: CENTER_PLACEHOLDER.left,
top: CENTER_PLACEHOLDER.top,
transform: "translate(-50%, -50%)"
}) : curStep.value.style,
"popupPlacement": mergedPlacement.value,
"popupVisible": mergedOpen.value,
"popupClassName": classNames(rootClassName, curStep.value.className),
"prefixCls": prefixCls,
"popup": getPopupElement,
"forceRender": false,
"destroyPopupOnHide": true,
"zIndex": zIndex,
"mask": false,
"getTriggerDOMNode": getTriggerDOMNode
}), {
default: () => [createVNode(Portal, {
"visible": mergedOpen.value,
"autoLock": true
}, {
default: () => [createVNode("div", {
"class": classNames(rootClassName, `${prefixCls}-target-placeholder`),
"style": _extends(_extends({}, posInfoStyle.value), {
position: "fixed",
pointerEvents: "none"
})
}, null)]
})]
})]) : null;
};
}
});
const tourProps = () => _extends(_extends({}, tourProps$1()), {
steps: {
type: Array
},
prefixCls: {
type: String
},
current: {
type: Number
},
type: {
type: String
},
"onUpdate:current": Function
});
const tourStepProps = () => _extends(_extends({}, tourStepProps$1()), {
cover: {
type: Object
},
nextButtonProps: {
type: Object
},
prevButtonProps: {
type: Object
},
current: {
type: Number
},
type: {
type: String
}
});
const panelRender = defineComponent({
name: "ATourPanel",
inheritAttrs: false,
props: tourStepProps(),
setup(props2, _ref) {
let {
attrs,
slots
} = _ref;
const {
current,
total
} = toRefs(props2);
const isLastStep = computed(() => current.value === total.value - 1);
const prevBtnClick = (e) => {
var _a;
const prevButtonProps = props2.prevButtonProps;
(_a = props2.onPrev) === null || _a === void 0 ? void 0 : _a.call(props2, e);
if (typeof (prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.onClick) === "function") {
prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.onClick();
}
};
const nextBtnClick = (e) => {
var _a, _b;
const nextButtonProps = props2.nextButtonProps;
if (isLastStep.value) {
(_a = props2.onFinish) === null || _a === void 0 ? void 0 : _a.call(props2, e);
} else {
(_b = props2.onNext) === null || _b === void 0 ? void 0 : _b.call(props2, e);
}
if (typeof (nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.onClick) === "function") {
nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.onClick();
}
};
return () => {
const {
prefixCls,
title,
onClose,
cover,
description,
type: stepType,
arrow
} = props2;
const prevButtonProps = props2.prevButtonProps;
const nextButtonProps = props2.nextButtonProps;
let headerNode;
if (title) {
headerNode = createVNode("div", {
"class": `${prefixCls}-header`
}, [createVNode("div", {
"class": `${prefixCls}-title`
}, [title])]);
}
let descriptionNode;
if (description) {
descriptionNode = createVNode("div", {
"class": `${prefixCls}-description`
}, [description]);
}
let coverNode;
if (cover) {
coverNode = createVNode("div", {
"class": `${prefixCls}-cover`
}, [cover]);
}
let mergeIndicatorNode;
if (slots.indicatorsRender) {
mergeIndicatorNode = slots.indicatorsRender({
current: current.value,
total
});
} else {
mergeIndicatorNode = [...Array.from({
length: total.value
}).keys()].map((stepItem, index2) => createVNode("span", {
"key": stepItem,
"class": classNames(index2 === current.value && `${prefixCls}-indicator-active`, `${prefixCls}-indicator`)
}, null));
}
const mainBtnType = stepType === "primary" ? "default" : "primary";
const secondaryBtnProps = {
type: "default",
ghost: stepType === "primary"
};
return createVNode(LocaleReceiver, {
"componentName": "Tour",
"defaultLocale": localeValues.Tour
}, {
default: (contextLocale) => {
var _a;
return createVNode("div", _objectSpread$W(_objectSpread$W({}, attrs), {}, {
"class": classNames(stepType === "primary" ? `${prefixCls}-primary` : "", attrs.class, `${prefixCls}-content`)
}), [arrow && createVNode("div", {
"class": `${prefixCls}-arrow`,
"key": "arrow"
}, null), createVNode("div", {
"class": `${prefixCls}-inner`
}, [createVNode(CloseOutlined, {
"class": `${prefixCls}-close`,
"onClick": onClose
}, null), coverNode, headerNode, descriptionNode, createVNode("div", {
"class": `${prefixCls}-footer`
}, [total.value > 1 && createVNode("div", {
"class": `${prefixCls}-indicators`
}, [mergeIndicatorNode]), createVNode("div", {
"class": `${prefixCls}-buttons`
}, [current.value !== 0 ? createVNode(Button, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, secondaryBtnProps), prevButtonProps), {}, {
"onClick": prevBtnClick,
"size": "small",
"class": classNames(`${prefixCls}-prev-btn`, prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.className)
}), {
default: () => [isFunction(prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.children) ? prevButtonProps.children() : (_a = prevButtonProps === null || prevButtonProps === void 0 ? void 0 : prevButtonProps.children) !== null && _a !== void 0 ? _a : contextLocale.Previous]
}) : null, createVNode(Button, _objectSpread$W(_objectSpread$W({
"type": mainBtnType
}, nextButtonProps), {}, {
"onClick": nextBtnClick,
"size": "small",
"class": classNames(`${prefixCls}-next-btn`, nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.className)
}), {
default: () => [isFunction(nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.children) ? nextButtonProps === null || nextButtonProps === void 0 ? void 0 : nextButtonProps.children() : isLastStep.value ? contextLocale.Finish : contextLocale.Next]
})])])])]);
}
});
};
}
});
const useMergedType = (_ref) => {
let {
defaultType,
steps,
current,
defaultCurrent
} = _ref;
const innerCurrent = ref(defaultCurrent === null || defaultCurrent === void 0 ? void 0 : defaultCurrent.value);
const mergedCurrent = computed(() => current === null || current === void 0 ? void 0 : current.value);
watch(mergedCurrent, (val) => {
innerCurrent.value = val !== null && val !== void 0 ? val : defaultCurrent === null || defaultCurrent === void 0 ? void 0 : defaultCurrent.value;
}, {
immediate: true
});
const updateInnerCurrent = (val) => {
innerCurrent.value = val;
};
const innerType = computed(() => {
var _a, _b;
return typeof innerCurrent.value === "number" ? steps && ((_b = (_a = steps.value) === null || _a === void 0 ? void 0 : _a[innerCurrent.value]) === null || _b === void 0 ? void 0 : _b.type) : defaultType === null || defaultType === void 0 ? void 0 : defaultType.value;
});
const currentMergedType = computed(() => {
var _a;
return (_a = innerType.value) !== null && _a !== void 0 ? _a : defaultType === null || defaultType === void 0 ? void 0 : defaultType.value;
});
return {
currentMergedType,
updateInnerCurrent
};
};
const genBaseStyle$1 = (token) => {
const {
componentCls,
lineHeight,
padding,
paddingXS,
borderRadius,
borderRadiusXS,
colorPrimary,
colorText,
colorFill,
indicatorHeight,
indicatorWidth,
boxShadowTertiary,
tourZIndexPopup,
fontSize,
colorBgContainer,
fontWeightStrong,
marginXS,
colorTextLightSolid,
tourBorderRadius,
colorWhite,
colorBgTextHover,
tourCloseSize,
motionDurationSlow,
antCls
} = token;
return [
{
[componentCls]: _extends(_extends({}, resetComponent(token)), {
color: colorText,
position: "absolute",
zIndex: tourZIndexPopup,
display: "block",
visibility: "visible",
fontSize,
lineHeight,
width: 520,
"--antd-arrow-background-color": colorBgContainer,
"&-pure": {
maxWidth: "100%",
position: "relative"
},
[`&${componentCls}-hidden`]: {
display: "none"
},
// ============================= panel content ============================
[`${componentCls}-content`]: {
position: "relative"
},
[`${componentCls}-inner`]: {
textAlign: "start",
textDecoration: "none",
borderRadius: tourBorderRadius,
boxShadow: boxShadowTertiary,
position: "relative",
backgroundColor: colorBgContainer,
border: "none",
backgroundClip: "padding-box",
[`${componentCls}-close`]: {
position: "absolute",
top: padding,
insetInlineEnd: padding,
color: token.colorIcon,
outline: "none",
width: tourCloseSize,
height: tourCloseSize,
borderRadius: token.borderRadiusSM,
transition: `background-color ${token.motionDurationMid}, color ${token.motionDurationMid}`,
display: "flex",
alignItems: "center",
justifyContent: "center",
"&:hover": {
color: token.colorIconHover,
backgroundColor: token.wireframe ? "transparent" : token.colorFillContent
}
},
[`${componentCls}-cover`]: {
textAlign: "center",
padding: `${padding + tourCloseSize + paddingXS}px ${padding}px 0`,
img: {
width: "100%"
}
},
[`${componentCls}-header`]: {
padding: `${padding}px ${padding}px ${paddingXS}px`,
[`${componentCls}-title`]: {
lineHeight,
fontSize,
fontWeight: fontWeightStrong
}
},
[`${componentCls}-description`]: {
padding: `0 ${padding}px`,
lineHeight,
wordWrap: "break-word"
},
[`${componentCls}-footer`]: {
padding: `${paddingXS}px ${padding}px ${padding}px`,
textAlign: "end",
borderRadius: `0 0 ${borderRadiusXS}px ${borderRadiusXS}px`,
display: "flex",
[`${componentCls}-indicators`]: {
display: "inline-block",
[`${componentCls}-indicator`]: {
width: indicatorWidth,
height: indicatorHeight,
display: "inline-block",
borderRadius: "50%",
background: colorFill,
"&:not(:last-child)": {
marginInlineEnd: indicatorHeight
},
"&-active": {
background: colorPrimary
}
}
},
[`${componentCls}-buttons`]: {
marginInlineStart: "auto",
[`${antCls}-btn`]: {
marginInlineStart: marginXS
}
}
}
},
// ============================= primary type ===========================
// `$` for panel, `&$` for pure panel
[`${componentCls}-primary, &${componentCls}-primary`]: {
"--antd-arrow-background-color": colorPrimary,
[`${componentCls}-inner`]: {
color: colorTextLightSolid,
textAlign: "start",
textDecoration: "none",
backgroundColor: colorPrimary,
borderRadius,
boxShadow: boxShadowTertiary,
[`${componentCls}-close`]: {
color: colorTextLightSolid
},
[`${componentCls}-indicators`]: {
[`${componentCls}-indicator`]: {
background: new TinyColor(colorTextLightSolid).setAlpha(0.15).toRgbString(),
"&-active": {
background: colorTextLightSolid
}
}
},
[`${componentCls}-prev-btn`]: {
color: colorTextLightSolid,
borderColor: new TinyColor(colorTextLightSolid).setAlpha(0.15).toRgbString(),
backgroundColor: colorPrimary,
"&:hover": {
backgroundColor: new TinyColor(colorTextLightSolid).setAlpha(0.15).toRgbString(),
borderColor: "transparent"
}
},
[`${componentCls}-next-btn`]: {
color: colorPrimary,
borderColor: "transparent",
background: colorWhite,
"&:hover": {
background: new TinyColor(colorBgTextHover).onBackground(colorWhite).toRgbString()
}
}
}
}
}),
// ============================= mask ===========================
[`${componentCls}-mask`]: {
[`${componentCls}-placeholder-animated`]: {
transition: `all ${motionDurationSlow}`
}
},
// =========== Limit left and right placement radius ==============
[["&-placement-left", "&-placement-leftTop", "&-placement-leftBottom", "&-placement-right", "&-placement-rightTop", "&-placement-rightBottom"].join(",")]: {
[`${componentCls}-inner`]: {
borderRadius: Math.min(tourBorderRadius, MAX_VERTICAL_CONTENT_RADIUS)
}
}
},
// ============================= Arrow ===========================
getArrowStyle(token, {
colorBg: "var(--antd-arrow-background-color)",
contentRadius: tourBorderRadius,
limitVerticalRadius: true
})
];
};
const useStyle$2 = genComponentStyleHook("Tour", (token) => {
const {
borderRadiusLG,
fontSize,
lineHeight
} = token;
const TourToken = merge(token, {
tourZIndexPopup: token.zIndexPopupBase + 70,
indicatorWidth: 6,
indicatorHeight: 6,
tourBorderRadius: borderRadiusLG,
tourCloseSize: fontSize * lineHeight
});
return [genBaseStyle$1(TourToken)];
});
var __rest$1 = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const Tour = defineComponent({
name: "ATour",
inheritAttrs: false,
props: tourProps(),
setup(props2, _ref) {
let {
attrs,
emit,
slots
} = _ref;
const {
current,
type,
steps,
defaultCurrent
} = toRefs(props2);
const {
prefixCls,
direction
} = useConfigInject("tour", props2);
const [wrapSSR, hashId] = useStyle$2(prefixCls);
const {
currentMergedType,
updateInnerCurrent
} = useMergedType({
defaultType: type,
steps,
current,
defaultCurrent
});
return () => {
const {
steps: steps2,
current: current2,
type: type2,
rootClassName
} = props2, restProps = __rest$1(props2, ["steps", "current", "type", "rootClassName"]);
const customClassName = classNames({
[`${prefixCls.value}-primary`]: currentMergedType.value === "primary",
[`${prefixCls.value}-rtl`]: direction.value === "rtl"
}, hashId.value, rootClassName);
const mergedRenderPanel = (stepProps, stepCurrent) => {
return createVNode(panelRender, _objectSpread$W(_objectSpread$W({}, stepProps), {}, {
"type": type2,
"current": stepCurrent
}), {
indicatorsRender: slots.indicatorsRender
});
};
const onStepChange = (stepCurrent) => {
updateInnerCurrent(stepCurrent);
emit("update:current", stepCurrent);
emit("change", stepCurrent);
};
const builtinPlacements = computed(() => getPlacements$1({
arrowPointAtCenter: true,
autoAdjustOverflow: true
}));
return wrapSSR(createVNode(Tour$1, _objectSpread$W(_objectSpread$W(_objectSpread$W({}, attrs), restProps), {}, {
"rootClassName": customClassName,
"prefixCls": prefixCls.value,
"current": current2,
"defaultCurrent": props2.defaultCurrent,
"animated": true,
"renderPanel": mergedRenderPanel,
"onChange": onStepChange,
"steps": steps2,
"builtinPlacements": builtinPlacements.value
}), null));
};
}
});
const index$2 = withInstall(Tour);
const AppConfigContextKey = Symbol("appConfigContext");
const useProvideAppConfigContext = (appConfigContext) => {
return provide(AppConfigContextKey, appConfigContext);
};
const useInjectAppConfigContext = () => {
return inject(AppConfigContextKey, {});
};
const AppContextKey = Symbol("appContext");
const useProvideAppContext = (appContext) => {
return provide(AppContextKey, appContext);
};
const defaultAppContext = reactive({
message: {},
notification: {},
modal: {}
});
const useInjectAppContext = () => {
return inject(AppContextKey, defaultAppContext);
};
const genBaseStyle = (token) => {
const {
componentCls,
colorText,
fontSize,
lineHeight,
fontFamily
} = token;
return {
[componentCls]: {
color: colorText,
fontSize,
lineHeight,
fontFamily
}
};
};
const useStyle$1 = genComponentStyleHook("App", (token) => [genBaseStyle(token)]);
const AppProps = () => {
return {
rootClassName: String,
message: objectType(),
notification: objectType()
};
};
const useApp = () => {
return useInjectAppContext();
};
const App = defineComponent({
name: "AApp",
props: initDefaultProps(AppProps(), {}),
setup(props2, _ref) {
let {
slots
} = _ref;
const {
prefixCls
} = useConfigInject("app", props2);
const [wrapSSR, hashId] = useStyle$1(prefixCls);
const customClassName = computed(() => {
return classNames(hashId.value, prefixCls.value, props2.rootClassName);
});
const appConfig = useInjectAppConfigContext();
const mergedAppConfig = computed(() => ({
message: _extends(_extends({}, appConfig.message), props2.message),
notification: _extends(_extends({}, appConfig.notification), props2.notification)
}));
useProvideAppConfigContext(mergedAppConfig.value);
const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.value.message);
const [notificationApi, notificationContextHolder] = useNotification(mergedAppConfig.value.notification);
const [ModalApi, ModalContextHolder] = useModal();
const memoizedContextValue = computed(() => ({
message: messageApi,
notification: notificationApi,
modal: ModalApi
}));
useProvideAppContext(memoizedContextValue.value);
return () => {
var _a;
return wrapSSR(createVNode("div", {
"class": customClassName.value
}, [ModalContextHolder(), messageContextHolder(), notificationContextHolder(), (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]));
};
}
});
App.useApp = useApp;
App.install = function(app) {
app.component(App.name, App);
};
const flexWrapValues = ["wrap", "nowrap", "wrap-reverse"];
const justifyContentValues = ["flex-start", "flex-end", "start", "end", "center", "space-between", "space-around", "space-evenly", "stretch", "normal", "left", "right"];
const alignItemsValues = ["center", "start", "end", "flex-start", "flex-end", "self-start", "self-end", "baseline", "normal", "stretch"];
const genClsWrap = (prefixCls, props2) => {
const wrapCls = {};
flexWrapValues.forEach((cssKey) => {
wrapCls[`${prefixCls}-wrap-${cssKey}`] = props2.wrap === cssKey;
});
return wrapCls;
};
const genClsAlign = (prefixCls, props2) => {
const alignCls = {};
alignItemsValues.forEach((cssKey) => {
alignCls[`${prefixCls}-align-${cssKey}`] = props2.align === cssKey;
});
alignCls[`${prefixCls}-align-stretch`] = !props2.align && !!props2.vertical;
return alignCls;
};
const genClsJustify = (prefixCls, props2) => {
const justifyCls = {};
justifyContentValues.forEach((cssKey) => {
justifyCls[`${prefixCls}-justify-${cssKey}`] = props2.justify === cssKey;
});
return justifyCls;
};
function createFlexClassNames(prefixCls, props2) {
return classNames(_extends(_extends(_extends({}, genClsWrap(prefixCls, props2)), genClsAlign(prefixCls, props2)), genClsJustify(prefixCls, props2)));
}
const genFlexStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: {
display: "flex",
"&-vertical": {
flexDirection: "column"
},
"&-rtl": {
direction: "rtl"
},
"&:empty": {
display: "none"
}
}
};
};
const genFlexGapStyle = (token) => {
const {
componentCls
} = token;
return {
[componentCls]: {
"&-gap-small": {
gap: token.flexGapSM
},
"&-gap-middle": {
gap: token.flexGap
},
"&-gap-large": {
gap: token.flexGapLG
}
}
};
};
const genFlexWrapStyle = (token) => {
const {
componentCls
} = token;
const wrapStyle = {};
flexWrapValues.forEach((value) => {
wrapStyle[`${componentCls}-wrap-${value}`] = {
flexWrap: value
};
});
return wrapStyle;
};
const genAlignItemsStyle = (token) => {
const {
componentCls
} = token;
const alignStyle = {};
alignItemsValues.forEach((value) => {
alignStyle[`${componentCls}-align-${value}`] = {
alignItems: value
};
});
return alignStyle;
};
const genJustifyContentStyle = (token) => {
const {
componentCls
} = token;
const justifyStyle = {};
justifyContentValues.forEach((value) => {
justifyStyle[`${componentCls}-justify-${value}`] = {
justifyContent: value
};
});
return justifyStyle;
};
const useStyle = genComponentStyleHook("Flex", (token) => {
const flexToken = merge(token, {
flexGapSM: token.paddingXS,
flexGap: token.padding,
flexGapLG: token.paddingLG
});
return [genFlexStyle(flexToken), genFlexGapStyle(flexToken), genFlexWrapStyle(flexToken), genAlignItemsStyle(flexToken), genJustifyContentStyle(flexToken)];
});
function isPresetSize(size) {
return ["small", "middle", "large"].includes(size);
}
const flexProps = () => ({
prefixCls: stringType(),
vertical: booleanType(),
wrap: stringType(),
justify: stringType(),
align: stringType(),
flex: someType([Number, String]),
gap: someType([Number, String]),
component: anyType()
});
var __rest = function(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
const AFlex = defineComponent({
name: "AFlex",
inheritAttrs: false,
props: flexProps(),
setup(props2, _ref) {
let {
slots,
attrs
} = _ref;
const {
flex: ctxFlex,
direction: ctxDirection
} = useConfigContextInject();
const {
prefixCls
} = useConfigInject("flex", props2);
const [wrapSSR, hashId] = useStyle(prefixCls);
const mergedCls = computed(() => {
var _a;
return [prefixCls.value, hashId.value, createFlexClassNames(prefixCls.value, props2), {
[`${prefixCls.value}-rtl`]: ctxDirection.value === "rtl",
[`${prefixCls.value}-gap-${props2.gap}`]: isPresetSize(props2.gap),
[`${prefixCls.value}-vertical`]: (_a = props2.vertical) !== null && _a !== void 0 ? _a : ctxFlex === null || ctxFlex === void 0 ? void 0 : ctxFlex.value.vertical
}];
});
return () => {
var _a;
const {
flex,
gap,
component: Component = "div"
} = props2, othersProps = __rest(props2, ["flex", "gap", "component"]);
const mergedStyle = {};
if (flex) {
mergedStyle.flex = flex;
}
if (gap && !isPresetSize(gap)) {
mergedStyle.gap = `${gap}px`;
}
return wrapSSR(createVNode(Component, _objectSpread$W({
"class": [attrs.class, mergedCls.value],
"style": [attrs.style, mergedStyle]
}, omit(othersProps, ["justify", "wrap", "align", "vertical"])), {
default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
}));
};
}
});
const index$1 = withInstall(AFlex);
const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
Affix: Affix$1,
Alert: index$m,
Anchor,
AnchorLink,
App,
AutoComplete: index$n,
AutoCompleteOptGroup,
AutoCompleteOption,
Avatar,
AvatarGroup: Group$2,
BackTop,
Badge,
BadgeRibbon: Ribbon,
Breadcrumb,
BreadcrumbItem,
BreadcrumbSeparator,
Button,
ButtonGroup: ButtonGroup$1,
Calendar: Calendar$1,
Card,
CardGrid: Grid,
CardMeta: Meta,
Carousel: index$l,
Cascader: index$k,
CheckableTag,
Checkbox,
CheckboxGroup,
Col: index$i,
Collapse,
CollapsePanel: __nuxt_component_6,
Comment: index$h,
Compact,
ConfigProvider,
DatePicker: DatePicker$1,
Descriptions,
DescriptionsItem,
DirectoryTree,
Divider: __nuxt_component_4,
Drawer: __nuxt_component_2$1,
Dropdown,
DropdownButton,
Empty: Empty$1,
Flex: index$1,
FloatButton,
FloatButtonGroup,
Form,
FormItem: __nuxt_component_1$3,
FormItemRest,
Grid: index$j,
Image: Image$1,
ImagePreviewGroup: InternalPreviewGroup,
Input,
InputGroup: Group$1,
InputNumber: index$g,
InputPassword: __nuxt_component_0$3,
InputSearch: Search$1,
Layout: index$f,
LayoutContent,
LayoutFooter,
LayoutHeader,
LayoutSider,
List: List$1,
ListItem: Item,
ListItemMeta: ItemMeta,
LocaleProvider: locale,
Mentions: __nuxt_component_0$2,
MentionsOption,
Menu,
MenuDivider: Divider$1,
MenuItem: __nuxt_component_1$5,
MenuItemGroup: ItemGroup,
Modal,
MonthPicker,
PageHeader: index$e,
Pagination,
Popconfirm: index$d,
Popover: __nuxt_component_1$6,
Progress: __nuxt_component_1$2,
QRCode: index$3,
QuarterPicker,
Radio,
RadioButton: __nuxt_component_2$3,
RadioGroup: __nuxt_component_1$4,
RangePicker,
Rate: index$c,
Result,
Row: index$b,
Segmented: index$4,
Select,
SelectOptGroup,
SelectOption,
Skeleton,
SkeletonAvatar,
SkeletonButton,
SkeletonImage,
SkeletonInput,
SkeletonTitle,
Slider: Slider$1,
Space,
Spin,
Statistic,
StatisticCountdown,
Step,
Steps: __nuxt_component_1$1,
SubMenu: SubMenu$1,
Switch: index$a,
TabPane: __nuxt_component_2$2,
Table: index$9,
TableColumn: Column,
TableColumnGroup: ColumnGroup,
TableSummary,
TableSummaryCell,
TableSummaryRow,
Tabs,
Tag,
Textarea: __nuxt_component_0$4,
TimePicker: TimePicker$1,
TimeRangePicker,
Timeline,
TimelineItem,
Tooltip: __nuxt_component_2$4,
Tour: index$2,
Transfer: index$8,
Tree,
TreeNode: TreeNode$1,
TreeSelect: index$7,
TreeSelectNode,
Typography,
TypographyLink: Link,
TypographyParagraph: Paragraph,
TypographyText: Text,
TypographyTitle: Title,
Upload: __nuxt_component_0$1,
UploadDragger,
Watermark: index$5,
WeekPicker,
message: api$1,
notification: api
}, Symbol.toStringTag, { value: "Module" }));
const install = function(app) {
Object.keys(components).forEach((key2) => {
const component = components[key2];
if (component.install) {
app.use(component);
}
});
app.use(cssinjs.StyleProvider);
app.config.globalProperties.$message = api$1;
app.config.globalProperties.$notification = api;
app.config.globalProperties.$info = Modal.info;
app.config.globalProperties.$success = Modal.success;
app.config.globalProperties.$error = Modal.error;
app.config.globalProperties.$warning = Modal.warning;
app.config.globalProperties.$confirm = Modal.confirm;
app.config.globalProperties.$destroyAll = Modal.destroyAll;
return app;
};
const Antd = {
version,
install
};
const SUPABASE_URL = "https://supa.newinsta.ir";
const SUPABASE_KEY = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE3NTMyMDcxOTcsImV4cCI6MjAwNTY2Nzk5NywiYXVkIjoid3d3LmV4YW1wbGUuY29tIiwic3ViIjoianJvY2tldEBleGFtcGxlLmNvbSIsIlJvbGUiOiJhbm9uIn0.NiMFrNO1avuHxQLynHY2IfDA-IuQaNNJduPSJYqlW04";
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
const baseImageUrl = "https://supa.newinsta.ir/storage/v1/object/public";
const getSupabaseStorageUrl = (url) => {
return `${baseImageUrl}/${url}`;
};
const uploadFile = async (file, busket = "productimg") => {
const uniqueFileName = `${Date.now()}-${file.name}`;
return await supabase.storage.from(busket).upload(uniqueFileName, file, {
cacheControl: "3600",
upsert: false
});
};
const supabaseService = {
// Generic fetch method for CRUD operations
async fetch(table, method, query = {}, customErrorMessage, order) {
try {
let result;
switch (method) {
case "select": {
let queryBuilder = supabase.from(table);
let selectQuery = queryBuilder.select(query.columns || "*");
if (query.field && query.value) {
if (Array.isArray(query.field) && Array.isArray(query.value)) {
query.field.forEach((f, i) => {
selectQuery = selectQuery.eq(f, query.value[i]);
});
} else {
selectQuery = selectQuery.eq(query.field, query.value);
}
}
if (order?.column) {
selectQuery = selectQuery.order(order.column, { ascending: order.ascending });
}
result = await selectQuery;
break;
}
case "select_group":
result = await supabase.from(table).select(query.columns || "*").in(query.field ?? "", query.value);
break;
case "insert":
result = await supabase.from(table).insert(query.data).select("*");
break;
case "update":
result = await supabase.from(table).update(query.data).eq(query.field ?? "", query.value).select();
break;
case "delete": {
let deleteQuery = supabase.from(table).delete();
if (Array.isArray(query.field) && Array.isArray(query.value)) {
query.field.forEach((f, i) => {
deleteQuery = deleteQuery.eq(f, query.value[i]);
});
} else {
deleteQuery = deleteQuery.eq(query.field ?? "", query.value);
}
result = await deleteQuery;
break;
}
default:
throw new Error("Unsupported method");
}
if (result.error) {
throw result.error;
} else {
return result.data;
}
} catch (err) {
console.error(customErrorMessage || "Unexpected Supabase Error:", err);
errorMessage(err.message);
throw err;
}
},
async updateUserDetails(email, phone, password) {
try {
const res = await supabase.auth.updateUser({
email,
phone,
password
});
if (res.error) {
throw res.error;
} else {
return res.data.user;
}
} catch (err) {
console.error("Unexpected error while updating user:", err);
errorMessage(err.message);
throw err;
}
},
async createUser(params) {
try {
return await supabase.auth.admin.createUser(params);
} catch (err) {
console.error("Unexpected Error:", err);
errorMessage(err);
throw err;
}
},
// Authentication methods
async login(params) {
try {
const res = await supabase.auth.signInWithPassword(params);
if (res.error) {
throw res.error;
} else {
return res.data.user;
}
} catch (err) {
console.error("Unexpected Login Error:", err);
errorMessage(err.message);
throw err;
}
},
async deleteUser(user_id) {
try {
return await supabase.auth.admin.deleteUser(user_id);
} catch (err) {
console.error("Unexpected Login Error:", err);
errorMessage(err);
throw err;
}
},
async signup(email, password) {
try {
const { user, session, error } = await supabase.auth.signUp({
email,
password
});
if (error) {
console.error("Signup Error:", error.message);
errorMessage(error.message);
return null;
}
return { user, session };
} catch (err) {
console.error("Unexpected Signup Error:", err);
return null;
}
},
async logout() {
try {
const { error } = await supabase.auth.signOut();
if (error) {
console.error("Logout Error:", error.message);
return false;
}
return true;
} catch (err) {
console.error("Unexpected Logout Error:", err);
return false;
}
},
getUser() {
return supabase.auth.getUser();
},
onAuthStateChange(callback) {
supabase.auth.onAuthStateChange(callback);
}
};
function errorMessage(msg) {
api$1.error(msg).then((r) => "");
}
const strings = (val) => {
return {
helloworld: {
"fa": "سلام دنیا",
"en": "hello word"
},
montech: {
"fa": "منتک",
"en": "Montech"
},
version: {
"fa": "نسخه",
"en": "Version"
},
welcome: {
"fa": `به ${appName.fa} خوش آمدید!`,
"en": `Welcome to ${appName.en}!`
},
welcomePleaseInputPhone: {
"fa": "لطفا برای ورود یا ثبت نام شماره موبایل خود را وارد کنید.",
"en": "Please input your phone for login or register."
},
phone: {
"fa": "شماره تلفن",
"en": "Phone number"
},
placeHolderPhone: {
"fa": "شماره تلفن، نام کاربری یا ایمیل",
"en": "Phone number, username, or email"
},
placeHolderPassword: {
"fa": "گذرواژه",
"en": "Password"
},
or: {
"fa": "یا",
"en": "OR"
},
forgetPassword: {
"fa": "گذرواژه خود را فراموش کرده اید؟",
"en": "Forgot password?"
},
noAccount: {
"fa": "حساب کاربری ندارید؟",
"en": "Don't have an account?"
},
signUp: {
"fa": "ثبت نام",
"en": "Sign up"
},
loginButton: {
"fa": "ورود",
"en": "Log in"
},
registerAgree: {
"fa": "با شرایط و سیاست های اینستاگرام موافقت کنید",
"en": "Agree to instagram's terms and policies"
},
registerBirthday: {
"fa": "تولدت کیه؟",
"en": "What's your birthday?"
},
registerName: {
"fa": "اسمت چیه؟",
"en": "What's your name?"
},
registerPassword: {
"fa": "رمز عبور ایجاد کنید",
"en": "Create a password"
},
registerOtp: {
"fa": "کد تایید را وارد کنید",
"en": "Enter the confirmation code"
},
registerMobile: {
"fa": "شماره موبایلت چنده؟",
"en": "What's your mobile number?"
},
registerAgreeDescription: {
"fa": "با ضربه زدن روی موافقم، با ایجاد یک حساب کاربری و شرایط اینستاگرام، خط مشی رازداری و خط مشی کوکی ها موافقت می کنید. خطمشی رازداری روشهایی را توضیح میدهد که ما میتوانیم از اطلاعاتی که هنگام ایجاد حساب جمعآوری میکنیم استفاده کنیم. به عنوان مثال، ما از این اطلاعات برای ارائه، شخصی سازی و بهبود محصولات خود از جمله تبلیغات استفاده می کنیم.",
"en": " By tapping I agree, you agree to create an account and to Instagram's Terms, Privacy Policy and Cookies Policy. The Privacy Policy describes the ways we can use the information we collect when you create an account. For example, we use this information to provide, personalize and improve our products, including ads."
},
registerBirthdayDescription: {
"fa": "از تاریخ تولد خود استفاده کنید، حتی اگر این حساب برای یک تجارت، یک حیوان خانگی یا چیز دیگری باشد. هیچ کس این را نخواهد دید مگر اینکه شما آن را به اشتراک بگذارید.",
"en": "Use your own birthday, even if this account is for a business, a pet or something else. No one will see this unless you choose to share it."
},
registerNameDescription: {
"fa": "نامی که میخواهید به کاربران نمایش داده شود را وارد کنید.",
"en": "Input the name that you want to show users."
},
firstNamePlaceholder: {
"fa": "نام خود را وارد کنید",
"en": "Please input your first name"
},
lastNamePlaceholder: {
"fa": "نام خانوادگی خود را وارد کنید",
"en": "Please input your last name"
},
notExitUser: {
"fa": "کاربری با این اطلاعات وجود ندارد",
"en": "Not Exist user with this info."
},
invalidLogin: {
"fa": "اطلاعات وارد شده صحیح نمیباشد.",
"en": "Invalid login credentials"
},
registerPasswordDescription: {
"fa": "یک رمز عبور با حداقل 6 حرف یا عدد ایجاد کنید. باید چیزی باشد که دیگران نمی توانند حدس بزنند.",
"en": "Create a password with at least 6 letters or numbers. It should be something others can't guess."
},
registerOtpDescription: {
"fa": `برای تأیید حساب خود، کد 5 رقمی را که از طریق پیامک به ${val} ارسال کردیم وارد کنید.`,
"en": `To confirm your account, enter the 5-digit code we sent via SMS to ${val}`
},
registerMobileDescription2: {
"fa": "ممکن است برای اهداف امنیتی و ورود به سیستم اعلان های پیامکی از ما دریافت کنید.",
"en": "You may receive SMS notifications from us for security and login purposes."
},
registerMobileDescription1: {
"fa": "شماره موبایلی که می توان با شما تماس گرفت را وارد کنید. هیچ کس شماره شما را را در نمایه شما نخواهد دید.",
"en": "Enter the mobile number where you can be contacted. No one will see this on your profile."
},
iHaveAccount: {
"fa": "حساب کاربری دارم",
"en": "I already have an account"
},
password: {
"fa": "پسورد",
"en": "Password"
},
next: {
"fa": "بعدی",
"en": "Next"
},
iAgree: {
"fa": "قبول میکنم",
"en": "I agree"
},
confirmButton: {
"fa": "ثبت کد",
"en": "Submit code"
},
required: {
"fa": "پر کردن مورد بالا الزامی است",
"en": "Please input required field"
},
requiredTitle: {
"fa": `پر کردن ${val} الزامی است`,
"en": `Field ${val} is required`
},
requiredLenTitle: {
"fa": ` تعداد کاراکتر ${val[0]}باید ${val[1]} عدد باشد`,
"en": `The count of ${val[0]} must be ${val[1]} characters`
},
requiredLen: {
"fa": `تعداد کاراکتر باید ${val} عدد باشد`,
"en": `The count of characters must be ${val}`
},
registerInApp: {
"fa": ` ثبت نام در ${appName.fa} `,
"en": ` Register in ${appName.en} `
},
confirmCode1: {
"fa": ` کد تایید ارسال شده به شماره "`,
"en": `Please input confirmation code sent to "`
},
confirmCode2: {
"fa": `" را وارد کنید.`,
"en": `".`
},
editPhone: {
"fa": `ویرایش شماره موبایل`,
"en": `Edit phone number`
},
allUsers: {
"fa": `همه کاربران`,
"en": `All users`
},
resendCode1: {
"fa": `ارسال مجدد کد در `,
"en": `Resend code in `
},
resendCode2: {
"fa": ` دیگر`,
"en": ``
},
detail: {
"fa": `جزئیات`,
"en": `Detail`
},
resendCodeButton: {
"fa": ` ارسال مجدد`,
"en": `Resend code`
},
explainName: {
"fa": `برای استفاده از نام کاربر، کافیست به جای نام %name بگذارید.`,
"en": `For using name of user, please add %name instead of user's name.`
},
explainNameAttention: {
"fa": `توجه کنید برای کاربر هایی که شماره آنها وارد شده است، به عنوان پیشفرض از واژه (کاربر) استفاده خواهد شد.`,
"en": `Note that for users whose numbers have been entered, the word (کاربر) will be used as the default.`
},
confirmInformation: {
"fa": `تکمیل اطلاعات`,
"en": `Complete profile`
},
selectDate: {
"fa": `انتخاب تاریخ`,
"en": `Select date`
},
inputInformationPls: {
"fa": `لطفا برای تکمیل ثبت نام اطلاعات زیر را وارد کنید`,
"en": `Please enter the following information to complete the registration.`
},
sendMessage: {
"fa": `ارسال پیام`,
"en": `Send message`
},
comments: {
"fa": `نظرات`,
"en": `Comments`
},
comment: {
"fa": `نظر`,
"en": `Comment`
},
less: {
"fa": `کمتر`,
"en": `less`
},
more: {
"fa": `بیشتر`,
"en": `more`
},
post: {
"fa": `پست`,
"en": `Post`
},
story: {
"fa": `استوری`,
"en": `Story`
},
story2: {
"fa": `استوری`,
"en": `STORY`
},
productExcel: {
"fa": `اکسل محصولات`,
"en": `PRODUCT EXCEL`
},
newPost: {
"fa": `پست جدید`,
"en": `New post`
},
tapPlusToAdd: {
"fa": `لطفا برای وارد کردن عکس بر روی + بزنید.`,
"en": `Please tap + to add.`
},
addAtLeastOneMedia: {
"fa": `لطفا حداقل یک عکس یا فیلم وارد کنید.`,
"en": `Please input at least one media.`
},
addACaption: {
"fa": `زیرنویس را اضافه کنید...`,
"en": `Add a caption...`
},
productInformation: {
"fa": `اطلاعات محصول`,
"en": `Product information`
},
selectAnOption: {
"fa": `یک مورد را انتخاب کنید`,
"en": `Please select an item`
},
selectUsers: {
"fa": `لطفا کاربران را انتخاب کنید`,
"en": `Please select users`
},
addMessage: {
"fa": `افزودن پیام`,
"en": `Add message`
},
productCode: {
"fa": `کد محصول`,
"en": `Product Code`
},
users: {
"fa": `کاربران`,
"en": `Users`
},
messagesList: {
"fa": `لیست پیام ها`,
"en": `Messages list`
},
FaName: {
"fa": `نام فارسی`,
"en": `Fa name`
},
EnName: {
"fa": `نام انگلیسی`,
"en": `En name`
},
brand: {
"fa": `برند`,
"en": `Brand`
},
brands: {
"fa": `برندها`,
"en": `Brands`
},
category: {
"fa": `دسته بندی`,
"en": `Category`
},
categories: {
"fa": `دسته بندی ها`,
"en": `Categories`
},
pricing: {
"fa": `قیمت گذاری`,
"en": `Pricing`
},
userHaveAccount: {
"fa": `در حال حاظر شما بااین شماره حساب کاربری دارید.`,
"en": `You already have account with this phone`
},
userNotHaveAccount: {
"fa": `حسابی با این اطلاعات وجود ندارد.`,
"en": `Dont found account with this info`
},
minPassIs6: {
"fa": `حداقل 6 کاراکتر برای رمز عبور لازم است.`,
"en": `A minimum of 6 characters is required for the password.`
},
pricingType: {
"fa": `نوع قیمت گذاری`,
"en": `Pricing type`
},
easy: {
"fa": `ساده`,
"en": `Easy`
},
easyDes: {
"fa": `اگر این محصول بدون تنوع می باشد`,
"en": `if this product is without variety`
},
variant: {
"fa": `متغیر`,
"en": `Variant`
},
variantDes: {
"fa": `اگر این محصول دارای تنوع رنگبندی، سایزبندی و... می باشد`,
"en": `If this product has a variety of colors, sizes, etc.`
},
price: {
"fa": `قیمت`,
"en": `Price`
},
count: {
"fa": `تعداد`,
"en": `Count`
},
pack: {
"fa": `بسته بندی`,
"en": `Pack`
},
single: {
"fa": `تکی`,
"en": `Single`
},
box: {
"fa": `کارتنی`,
"en": `box`
},
numberInCarton: {
"fa": `عدد در کارتون`,
"en": `number in carton`
},
seo: {
"fa": `سئو`,
"en": `SEO`
},
seoTitle: {
"fa": `عنوان سئو`,
"en": `SEO title`
},
meta: {
"fa": `متا`,
"en": `Meta`
},
aboutProduct: {
"fa": `درباره محصول`,
"en": `About product`
},
attributes: {
"fa": `ویژگی ها`,
"en": `Attributes`
},
productAttributes: {
"fa": `ویژگی های محصول`,
"en": `Product Attributes`
},
introducingAttributes: {
"fa": `با معرفی ویژگیهای محصول، محصولات خود را به همراه تنوعها در سایت نمایش دهید
و با ایجاد انتخابهای بیشتر برای بازدیدکنندگان شانس فروش از سایت را افزایش دهید.`,
"en": `By introducing product features,
display your products along with variations on the site and increase
the chances of sales from the site by creating more choices for visitors.`
},
pleaseSelectAtLeastOneOption: {
"fa": `لطفا حداقل یک مورد وارد کنید`,
"en": `Please select at least one option`
},
selectAttribute: {
"fa": `انتخاب صفت`,
"en": `Select attribute`
},
storeOrders: {
"fa": `سفارشات فروشگاه`,
"en": `Store orders`
},
selectFeature: {
"fa": `انتخاب ویژگی`,
"en": `Select Feature`
},
featureName: {
"fa": `نام ویژگی`,
"en": `Feature name`
},
newFeature: {
"fa": `ویژگی جدید`,
"en": `New feature`
},
pleaseEnter: {
"fa": `ویژگی جدید`,
"en": `New feature`
},
searchFeatureOrAddNewInList: {
"fa": `ویژگی را جستجو کنید یا داخل لیست اضافه کنید`,
"en": `Search feature or add new in list`
},
items: {
"fa": `مقادیر`,
"en": `Items`
},
pleaseSelectItems: {
"fa": `لطفا مقادیر را وارد کنید`,
"en": `Please select items`
},
showInProductPage: {
"fa": `نشان دادن در صفحه محصول`,
"en": `Show in product page`
},
showInVariants: {
"fa": `نشان دادن در متغیر ها`,
"en": `Show in variants`
},
variants: {
"fa": `متغیر ها`,
"en": `Variants`
},
addVariant: {
"fa": `افزودن متغیر`,
"en": `Add variant`
},
chooseDefaultVariant: {
"fa": `انتخاب متغیر پیشفرض`,
"en": `Choose default variant`
},
pleaseSelectAnOption: {
"fa": `یک مورد را انتخاب کنید`,
"en": `Please select an option`
},
code: {
"fa": `کد`,
"en": `Code`
},
stock: {
"fa": `موجودی`,
"en": `Stock `
},
toman: {
"fa": `تومان`,
"en": `Toman `
},
rial: {
"fa": `ریال`,
"en": `Rials `
},
product: {
"fa": `محصول`,
"en": `Product `
},
product2: {
"fa": `محصول`,
"en": `PRODUCT `
},
newProduct: {
"fa": `محصول جدید`,
"en": `New product `
},
newStory: {
"fa": `استوری جدید`,
"en": `New story `
},
language: {
"fa": `زبان`,
"en": `Language`
},
persian: {
"fa": `فارسی`,
"en": `Persian`
},
english: {
"fa": `انگلیسی`,
"en": `English`
},
selectYourLanguage: {
"fa": `لطفا زبان خود را انتخاب کنید`,
"en": `Select your language`
},
products: {
"fa": `محصولات`,
"en": `Products`
},
orders: {
"fa": `سفارشات`,
"en": `Orders`
},
customers: {
"fa": `مشتریان`,
"en": `Customers`
},
editProfile: {
"fa": `ویرایش پروفایل`,
"en": `Edit profile`
},
shareStore: {
"fa": `اشتراک گذاری پروفایل`,
"en": `Share store`
},
new: {
"fa": `جدید`,
"en": `New`
},
details: {
"fa": `جزئیات`,
"en": `Details`
},
caption: {
"fa": `توضیحات`,
"en": `Caption`
},
addToCart: {
"fa": `افزودن به سبد خرید`,
"en": `Add to cart`
},
inStock: {
"fa": `موجود`,
"en": `In stock`
},
outOfStock: {
"fa": `ناموجود`,
"en": `Out of Stock`
},
pleaseCompleteAllSelects: {
"fa": `لطفا ویژگی درخواستی را تکمیل کنید`,
"en": `Please complete all selects`
},
information: {
"fa": `اطلاعات`,
"en": `Information`
},
cart: {
"fa": `سبد خرید`,
"en": `Cart`
},
address: {
"fa": `آدرس`,
"en": `Address`
},
payment: {
"fa": `پرداخت`,
"en": `Payment`
},
mainImage: {
"fa": `عکس اصلی`,
"en": `Main image`
},
subImage: {
"fa": `عکس فرعی`,
"en": `Sub image`
},
sumOfCart: {
"fa": `جمع سبد خرید`,
"en": `Sum of cart`
},
completeOrder: {
"fa": `تکمیل سفارش`,
"en": `Complete order`
},
submitOrder: {
"fa": `ثبت سفارش`,
"en": `Submit order`
},
selectAddress: {
"fa": `آدرس تحویل را انتخاب نمایید`,
"en": `Select delivery address`
},
orderSubmitted: {
"fa": `سفارش شما با موفقیت ثبت شد`,
"en": `Order submitted successfully`
},
productAddedToCart: {
"fa": `محصول به سبد خرید اضافه شد`,
"en": `Product added to cart`
},
pleaseCompleteLastCart: {
"fa": `لطفا سبد خرید خود با فروشگاه دیگر را تکمیل کنید`,
"en": `Please complete your cart with other store`
},
cartIsEmpty: {
"fa": `سبد خرید خالی است`,
"en": `Cart is empty`
},
orderDeliveryAddress: {
"fa": `آدرس تحویل سفارش`,
"en": `Order delivery address`
},
addressNotFound: {
"fa": `آدرس یافت نشد`,
"en": `Address not found`
},
changeAddress: {
"fa": ` تغییر آدرس`,
"en": `Change address`
},
paymentType: {
"fa": `شیوه پرداخت`,
"en": `Payment type`
},
onTheSpot: {
"fa": `در محل`,
"en": `On the spot`
},
online: {
"fa": `آنلاین`,
"en": `Online`
},
chooseAddress: {
"fa": `انتخاب آدرس`,
"en": `Choose address`
},
orderItems: {
"fa": `اقلام سفارش`,
"en": `Order items`
},
shippingCost: {
"fa": `هزینه ارسال`,
"en": `Shipping cost`
},
consumerPrice: {
"fa": `قیمت مصرف کننده`,
"en": `Consumer price`
},
totalItems: {
"fa": `تعداد کل اجناس`,
"en": `Total items`
},
totalWeight: {
"fa": `وزن کل`,
"en": `Total weight`
},
totalGoldWeight: {
"fa": `وزن کل طلا`,
"en": `Total gold weight`
},
totalSilverWeight: {
"fa": `وزن کل نقره`,
"en": `Total silver weight`
},
yourProfit: {
"fa": `سود شما`,
"en": `Your profit`
},
payable: {
"fa": `مبلغ قابل پرداخت`,
"en": `Payable`
},
default: {
"fa": `پیش فرض`,
"en": `Default`
},
defaultAddress: {
"fa": `آدرس پیش فرض`,
"en": `Default address`
},
edit: {
"fa": `ویرایش`,
"en": `Edit`
},
delete: {
"fa": `حذف`,
"en": `Delete`
},
example: {
"fa": `مثال`,
"en": `Example`
},
areYouSureToDeleteTheAddress: {
"fa": `آیا مطمئن به حذف آدرس هستید ؟`,
"en": `Are you sure to delete the address?`
},
areYouSureToDeleteThisStory: {
"fa": `آیا مطمئن به حذف استوری هستید ؟`,
"en": `Are you sure to delete this story?`
},
storyAddedSuccessfully: {
"fa": `استوری با موفقیت بارگذاری شد.`,
"en": `Story added successfully.`
},
yes: {
"fa": `بله`,
"en": `Yes`
},
no: {
"fa": `خیر`,
"en": `No`
},
noItems: {
"fa": `بدون مورد`,
"en": `No items`
},
submitNewAddress: {
"fa": `ثبت آدرس جدید`,
"en": `Submit new address`
},
expireTime: {
"fa": `تاریخ انقضا`,
"en": `Expire time`
},
search: {
"fa": `جستجو`,
"en": `Search`
},
phones: {
"fa": `جستجو`,
"en": `Phones`
},
addPhones: {
"fa": `لطفا شماره تلفن را ثبت کنید`,
"en": `Please add phones`
},
inventory: {
"fa": `موجودی`,
"en": `Inventory`
},
variantCode: {
"fa": `کد ویژگی`,
"en": `Variant code`
},
message: {
"fa": `پیام`,
"en": `Message`
},
notifications: {
"fa": `اعلان ها `,
"en": `Notifications`
},
startFollow: {
"fa": `شما را دنبال کرد `,
"en": `started following you`
},
likedPost: {
"fa": `پست شما را پسندید.`,
"en": `liked your post.`
},
follow: {
"fa": `دنبال کردن`,
"en": `follow`
},
followed: {
"fa": `دنبال می کنید`,
"en": `followed`
},
setting: {
"fa": `تنظیمات`,
"en": `Setting`
},
settingAndActivity: {
"fa": `تنظیمات`,
"en": `Setting and activity`
},
manager: {
"fa": `مدیر`,
"en": `Manager`
},
managers: {
"fa": `مدیران`,
"en": `Managers`
},
logout: {
"fa": `خروج`,
"en": `Logout`
},
howYouUseInstagram: {
"fa": `چگونگی استفاده از اینستاگرام`,
"en": `How you use instagram`
},
howOthersCanInteractWithYou: {
"fa": `چگونگی تعامل دیگران با شما`,
"en": `How others can interact with you`
},
theme: {
"fa": `نمایه`,
"en": `Theme`
},
priceUnit: {
"fa": `واحد پول`,
"en": `Price unit`
},
night: {
"fa": `شب`,
"en": `Night`
},
light: {
"fa": `روز`,
"en": `Light`
},
image: {
"fa": `تصویر`,
"en": `Image`
},
title: {
"fa": `عنوان`,
"en": `Title`
},
submit: {
"fa": `ثبت`,
"en": `Submit`
},
addBrand: {
"fa": `افزودن برند`,
"en": `Add brand`
},
sms: {
"fa": `پیامک`,
"en": `SMS`
},
notification: {
"fa": `نوتیفیکیشن`,
"en": `Notification`
},
editBrand: {
"fa": `ویرایش برند`,
"en": `Edit brand`
},
editedSuccessfully: {
"fa": `با موفقیت ویرایش شد`,
"en": `Edited successfully`
},
doneMessage: {
"fa": `با موفقیت انجام شد`,
"en": `Done successfully`
},
addedSuccessfully: {
"fa": `با موفقیت افزوده شد`,
"en": `Added successfully`
},
deletedSuccessfully: {
"fa": `با موفقیت حذف شد`,
"en": `Deleted successfully`
},
errorInAction: {
"fa": `عملیات ناموفق`,
"en": `Unsuccessful action`
},
updatedSuccessfully: {
"fa": `با موفقیت ویرایش شد`,
"en": `Updated successfully`
},
errorInSubmittingData: {
"fa": `خطا در ثبت اطلاعات`,
"en": `Error in submitting data`
},
areYouSureToDeleteThisBrand: {
"fa": `آیا از حذف دسته بندی اطمینان دارید؟`,
"en": `Are you sure to delete this brand?`
},
areYouSureToDeleteThisCategory: {
"fa": `آیا از حذف دسته بندی اطمینان دارید؟`,
"en": `Are you sure to delete this category?`
},
areYouSureToDeleteThisProduct: {
"fa": `آیا از حذف این محصول اطمینان دارید؟`,
"en": `Are you sure to delete this product?`
},
addCategory: {
"fa": `افزودن دسته بندی`,
"en": `Add category`
},
editCategory: {
"fa": `ویرایش دسته بندی`,
"en": `Edit category`
},
description: {
"fa": `توضیحات`,
"en": `Description`
},
chooseParentCategory: {
"fa": `انتخاب دسته بندی والد`,
"en": `Choose parent category`
},
addAttribute: {
"fa": `افزودن ویژگی`,
"en": `Add attribute`
},
desAttribute: {
"fa": `این محصول تنوع رنگبندی و سایزبندی و ... دارد؟ از این بخش میتونید آنها را اضافه کنید.`,
"en": `Does this product have a variety of colors, sizes, etc? You can add them from this section.`
},
editAttribute: {
"fa": `ویرایش ویژگی`,
"en": `Edit attribute`
},
add: {
"fa": `افزودن`,
"en": `Add`
},
noAttribute: {
"fa": `بدون ویژگی`,
"en": `No attribute`
},
update: {
"fa": `به روزرسانی کنید`,
"en": `Update`
},
pleaseLoginOrRegister: {
"fa": `برای استفاده از تمامی ویژگی های نرم افزار، لطفا وارد شوید یا ثبت نام کنید.`,
"en": `For using all features, please login or register.`
},
loginOrRegister: {
"fa": `ورود یا ثبت نام`,
"en": `Login or register`
},
confirmLogout: {
"fa": `آیا مطمئنید که میخواهید از اکانت خارج شوید؟`,
"en": `Do you want to log out of your account?`
},
create: {
"fa": `ایجاد`,
"en": `Create`
},
isNumber: {
"fa": `لطفا عدد وارد کنید`,
"en": `Please input number`
},
outSideRange: {
"fa": `لطفا عدد را بین 0 تا100 انتخاب کنید`,
"en": `Outside the range of 0 to 100`
},
discountAmountIsGreater: {
"fa": `مبلغ تخفیف از مبلغ اصلی بیشتر است.`,
"en": `The discount amount is greater than the original amount.`
},
province: {
"fa": `استان`,
"en": `Province`
},
amount: {
"fa": `مقدار`,
"en": `amount`
},
city: {
"fa": `شهر`,
"en": `City`
},
fullAddress: {
"fa": `آدرس کامل`,
"en": `Full address`
},
addAddress: {
"fa": `افزودن آدرس`,
"en": `Add address`
},
editAddress: {
"fa": `ویرایش آدرس`,
"en": `Edit address`
},
zip: {
"fa": `کد پستی`,
"en": `Zip`
},
bio: {
"fa": `مشخصات`,
"en": `Bio`
},
writeYourBio: {
"fa": `مشخصات خود را بنویسید`,
"en": `Write your bio`
},
name: {
"fa": `نام`,
"en": `Name`
},
birthdate: {
"fa": `تاریخ تولد`,
"en": `Birthdate`
},
imageUploader: {
"fa": `بارگذاری عکس`,
"en": `Image uploader`
},
email: {
"fa": `ایمیل`,
"en": `Email`
},
website: {
"fa": `وبسایت`,
"en": `Website`
},
viewProduct: {
"fa": `نمایش محصول`,
"en": `View product`
},
newVersionRelease: {
"fa": `نسخه جدید منتشر شد!`,
"en": `New version released!`
},
saved: {
"fa": `ذخیره شده`,
"en": `Saved`
},
orderNumber: {
"fa": `شماره سفارش`,
"en": `Order number`
},
totalPrice: {
"fa": `جمع مبلغ`,
"en": `Total price`
},
date: {
"fa": `تاریخ`,
"en": `Date`
},
goToHomePage: {
"fa": `رفتن به صفحه اصلی`,
"en": `Go to home page`
},
sendYourMessageHere: {
"fa": `پیام خود را بنویسید`,
"en": `Write your message here`
},
ok: {
"fa": `تایید`,
"en": `Ok`
},
cancel: {
"fa": `انصراف`,
"en": `Cancel`
},
login: {
"fa": `ورود`,
"en": `Login`
},
yourAccount: {
"fa": `حساب کاربری شما`,
"en": `Your account`
},
profile: {
"fa": `حساب کاربری`,
"en": `Profile`
},
filterProducts: {
"fa": `فیلتر محصولات`,
"en": `Filter products`
},
newest: {
"fa": `جدید ترین`,
"en": `Newest`
},
popular: {
"fa": `محبوب ترین`,
"en": `Popular`
},
bestSeller: {
"fa": `پرفروش ترین`,
"en": `Best seller`
},
mostVisited: {
"fa": `پر بازدید ترین`,
"en": `Most visited`
},
cheapest: {
"fa": `ارزان ترین`,
"en": `Cheapest`
},
mostExpensive: {
"fa": `گران ترین`,
"en": `Most expensive`
},
countProducts: {
"fa": `کالا`,
"en": `items`
},
theProductImageDidNotLoadCorrectly: {
"fa": `عکس محصول به درستی بارگزاری نشد`,
"en": `The product image did not load correctly.`
},
messageSeller: {
"fa": `ارسال پیام به فروشنده`,
"en": `Message seller`
},
addToCartWillPlaceYourOrderIntoCartAndYouCanCompleteOrderInCartMenu: {
"fa": `با کلیک بر روی افزودن به سبد خرید، سفارش شما در سبد خرید ثبت خواهد شد و سپس شما میتوانید سفارش خود را در منو سبد خرید تکمیل کنید.`,
"en": `Add to cart will place your order into cart and you can complete order in cart menu.`
},
aboutSeller: {
"fa": `درباره فروشنده`,
"en": `About seller`
},
showOrder: {
"fa": `برو به سفارش`,
"en": `Show order`
},
placeOrder: {
"fa": `ثبت سفارش`,
"en": `Place order`
},
followedByNUsers: {
"fa": `دنبال شده توسط ${val} کاربر `,
"en": `Followed by ${val} users`
},
seller: {
"fa": `فروشنده`,
"en": `Seller`
},
orderDetail: {
"fa": `جزئیات سفارش`,
"en": `Order detail`
},
orderSummery: {
"fa": `خلاصه سفارش`,
"en": `Order summery`
},
status: {
"fa": `وضعیت`,
"en": `Status`
},
sortProduct: {
"fa": `مرتب سازی محصولات`,
"en": `Sort product`
},
filter: {
"fa": `فیلتر`,
"en": `Filter`
},
reset: {
"fa": `بازنشانی`,
"en": `Reset`
},
totalAmountPurchased: {
"fa": `جمع مبلغ خریداری شده`,
"en": `Total amount purchased`
},
writeAnyThingAboutProduct: {
"fa": `مطلبی درباره محصول بنویسید`,
"en": `Write any thing about product`
},
storeConfirmation: {
"fa": `تایید فروشگاه`,
"en": `Store confirmation`
},
send: {
"fa": `ارسال`,
"en": `Send`
},
delivery: {
"fa": `تحویل`,
"en": `Delivery`
},
item2: {
"fa": `کالا`,
"en": `Items`
},
paymentDetail: {
"fa": `جزئیات پرداخت`,
"en": `Payment detail`
},
profit: {
"fa": `سود`,
"en": `Profit`
},
amountPaid: {
"fa": `مبلغ پرداخت شده`,
"en": `Amount paid`
},
addStatus: {
"fa": `افزودن وضعیت`,
"en": `Add status`
},
editStatus: {
"fa": `ویرایش وضعیت`,
"en": `Edit status`
},
IUnderstand: {
"fa": `متوجه شدم`,
"en": `I understand`
},
discount: {
"fa": `تخفیف`,
"en": `Discount`
},
discountType: {
"fa": `نوع تخفیف`,
"en": `Discount type`
},
simple: {
"fa": `ساده`,
"en": `Simple`
},
percent: {
"fa": `درصد`,
"en": `Percent`
},
resetDiscount: {
"fa": `بازنشانی تخفیف`,
"en": `Reset discount`
},
disable: {
"fa": `غیرفعال`,
"en": `Disable`
},
enable: {
"fa": `فعال`,
"en": `Enable`
},
yourOrders: {
"fa": `سفارشات شما`,
"en": `Your orders`
},
firstName: {
"fa": `نام`,
"en": `First name`
},
lastName: {
"fa": `نام خانوادگی`,
"en": `Last name`
},
pleaseChooseAddress: {
"fa": `لطفا آدرس را انتخاب کنید`,
"en": `Please choose address`
},
customer: {
"fa": `مشتری`,
"en": `Customer`
},
newMessage: {
"fa": `پیام جدید`,
"en": `New message`
},
YouHaveNewMessageFrom: {
"fa": `شما پیام جدید دارید از`,
"en": `You have new message from`
},
show: {
"fa": `نمایش`,
"en": `Show`
},
addStory: {
"fa": `افزودن استوری`,
"en": `Add story`
},
orderListIsEmpty: {
"fa": `سفارشی یافت نشد`,
"en": `Order list is empty`
},
productSavedListIsEmpty: {
"fa": `محصول ذخیره شده ای یافت نشد`,
"en": `Product saved list is empty`
},
customerListIsEmpty: {
"fa": `محصول ذخیره شده ای یافت نشد`,
"en": `Customer list is empty`
},
findYourAccount: {
"fa": `بازیابی اکانت شما`,
"en": `Find your account`
},
enterYourPhone: {
"fa": `شماره تلفن خود را وارد کنید.`,
"en": `Enter your phone.`
},
findAccount: {
"fa": `بازیابی اکانت`,
"en": `Find account`
},
verifyCode: {
"fa": `اعتبار سنجی کد`,
"en": `Verify code`
},
createNewPassword: {
"fa": `پسورد جدید بسازید`,
"en": `Create new password`
},
updatePassword: {
"fa": `ویرایش پسورد`,
"en": `Update password`
},
today: {
"fa": `امروز`,
"en": `Today`
},
older: {
"fa": `قدیمی تر`,
"en": `Older`
},
yesterday: {
"fa": `دیروز`,
"en": `Yesterday`
},
last7Days: {
"fa": `7 روز پیش`,
"en": `Last 7 days`
},
last30Days: {
"fa": `30 روز پیش`,
"en": `Last 30 days`
},
likeText: {
"fa": ` پست شما را پسندید.`,
"en": ` liked your post.`
},
commentText: {
"fa": ` درباره پست شما نظر داد.`,
"en": ` commented on your post.`
},
orderText: {
"fa": ` سفارش جدیدی ثبت کرد.`,
"en": ` submitted new order.`
},
statusText: {
"fa": ` در وضعیت سفارش شما تغییر ایجاد کرد.`,
"en": ` changed your order status.`
},
createNewAccount: {
"fa": `ساخت پروفایل جدید`,
"en": `Create new account`
},
yourComment: {
"fa": `نظر شما`,
"en": `Your comment`
},
newHighLight: {
"fa": `هایلایت جدید`,
"en": `New highlight`
},
done: {
"fa": "ثبت",
"en": "Done"
},
productType: {
"fa": `نوع محصول`,
"en": `Product type`
},
weight: {
"fa": `وزن`,
"en": `Weight`
},
rialFee: {
"fa": `اجرت ریالی`,
"en": `Rial fee`
},
fee: {
"fa": `سود`,
"en": `Fee`
},
percentFee: {
"fa": `اجرت درصدی`,
"en": `Percent fee`
},
productOption: {
"fa": `ویژگی محصول`,
"en": `Product option`
},
gram: {
"fa": `گرم`,
"en": `Gram`
},
PleaseEnterAtLeastOneVariable: {
"fa": `لطفا حداقل یک متغیر وارد کنید.`,
"en": `Please enter at least one variable.`
},
PleaseRemoveTheVariableWithDuplicateAttributeInformation: {
"fa": `لطفا متغیر با اطلاعات ویژگی تکراری را حذف کنید.`,
"en": `Please remove the variable with duplicate attribute information.`
},
PleaseSelectAllVariableAttributeInformation: {
"fa": `لطفا تمامی اطلاعات ویژگی متغیر را انتخاب کنید.`,
"en": `Please select all variable attribute information.`
},
pleaseEnterAllVariablePriceAndInventoryInformation: {
"fa": `لطفا تمامی اطلاعات قیمت و موجودی متغیرها را وارد کنید.`,
"en": `Please enter all variable price and inventory information.`
},
taxAndProfit: {
"fa": `سود و مالیات`,
"en": `Tax and profit`
},
hasTax: {
"fa": `محاسبه مالیات`,
"en": `Calculate Tax`
},
specifyTaxAndProfit: {
"fa": `محاسبه مالیات`,
"en": `Specify tax and profit`
},
auto: {
"fa": `اتوماتیک`,
"en": `Auto`
},
manual: {
"fa": `دستی`,
"en": `Manual`
},
selectsStory: {
"fa": `انتخاب استوری`,
"en": `Select Story`
},
reply: {
"fa": `پاسخ`,
"en": `Reply`
},
replyingTo: {
"fa": `پاسخ به`,
"en": `Replying to`
},
addProfile: {
"fa": `افزودن کاربر`,
"en": `Add profile`
},
addItem: {
"fa": `افزودن مورد`,
"en": `Add item`
},
pleaseEnterAttribute: {
"fa": `لطفا صفت را وارد کنید`,
"en": `Please enter attribute`
},
pleaseEnterFeature: {
"fa": `لطفا ویژگی را وارد کنید`,
"en": `Please enter feature`
},
viewMoreReplies: {
"fa": `دیدن ${val} پاسخ بیشتر`,
"en": `View ${val} more replies`
},
convertStore: {
"fa": `فروشنده شو`,
"en": `Convert Store`
},
requestWasNotApproved: {
"fa": `درخواست فروشندگی مورد تایید قرار نگرفت`,
"en": `The seller request was not approved.`
},
registeredSalesRequest: {
"fa": `درخواست فروشندگی ثبت شده`,
"en": `Registered sales request`
},
registeredSalesRequestConfirmed: {
"fa": `درخواست فروشندگی تایید شده`,
"en": `Registered sales request Confirmed`
},
highlight: {
"fa": `برجسته کردن`,
"en": `Highlight`
},
addFeatureValue: {
"fa": `افزودن صفات ویژگی`,
"en": `Add feature value`
},
submitChanges: {
"fa": `ثبت تغییرات`,
"en": `Submit changes`
},
allCollection: {
"fa": `همه دسته ها`,
"en": `All collection`
},
storeName: {
"fa": `نام فروشگاه`,
"en": `Store Name`
},
idCartPic: {
"fa": `عکس کارت ملی`,
"en": `Id Cart pic`
},
telephone: {
"fa": `شماره ثابت`,
"en": `Store Phone`
},
confirm: {
"fa": `تایید`,
"en": `Confirm`
},
storeRequest: {
"fa": `درخواست های فروشگاه`,
"en": `Store Requests`
},
storeRequestSubmit: {
"fa": `درخواست ساخت فروشکاه شما دریافت شد، منتظر تایید مدیر سیستم بمانید!`,
"en": `Your request to create a shop has been received, wait for approval from the system administrator!`
},
storeRequestOk: {
"fa": `تبریک، فروشگاه شما فعال شد. هم اکنون میتوانید با ورود به نرم افزار محصولات خود را اضافه نمایید`,
"en": `Congratulations, your store is activated. You can now log in to the software and add your products.`
},
created: {
"fa": `ایجاد شده`,
"en": `Created`
},
deleteVariant: {
"fa": `حذف متغیر`,
"en": `Delete variant`
},
editProduct: {
"fa": `ویرایش محصول`,
"en": `Edit product`
},
selectProductExcel: {
"fa": `انتخاب فایل اکسل`,
"en": `Select product excel`
},
selectedFile: {
"fa": `فایل انتخاب شده`,
"en": `Selected file`
},
addOneSheetAtLeast: {
"fa": `لطفا فایل اکسل محصولات را بارگذاری کنید`,
"en": `please import an product excel file`
},
setColumns: {
"fa": `تعیین ستون ها`,
"en": `Set columns`
},
newProducts: {
"fa": `محصولات جدید`,
"en": `New products`
},
pleaseInputNamePriceCount: {
"fa": `فیلد های نام، قیمت و تعداد اجباری می باشند.`,
"en": `Name, price and count inputs is required.`
},
selectSkill: {
"fa": `حوزه فعالیت را انتخاب کنید`,
"en": `Select skill`
},
skill: {
"fa": `حوزه فعالیت`,
"en": `skill`
},
close: {
"fa": `بستن`,
"en": `Close`
},
highlights: {
"fa": `هایلایت ها`,
"en": `Highlights`
},
editCover: {
"fa": `ویرایش کاور`,
"en": `Edit cover`
},
stories: {
"fa": `استوری ها`,
"en": `Stories`
},
areYouSureToDeleteThisHighlight: {
"fa": `آیا از حذف این هایلایت اطمینان دارید؟`,
"en": `Are you sure to delete this highlight`
},
areYouSureToDeleteThisUser: {
"fa": `آیا از حذف این کاربر اطمینان دارید؟`,
"en": `Are you sure to delete this user`
},
username: {
"fa": `نام کاربری`,
"en": `Username`
}
};
};
const module$1 = () => {
return {
productTypeField: ["montify"].includes(moduleProject()),
productWeightField: ["montify"].includes(moduleProject()),
productRialFeeField: ["montify"].includes(moduleProject()),
productPercentFeeField: ["montify"].includes(moduleProject())
};
};
const headers = {
"Content-Type": "application/json",
Accept: "application/json"
};
const _axios = axios.create({
baseURL,
headers
});
_axios.interceptors.request.use(
(config) => {
if (config.headers) {
const token = getToken();
if (token) {
config.headers["Authorization"] = "Bearer " + token;
}
}
return config;
},
(error) => {
Promise.reject(error);
}
);
_axios.interceptors.response.use(
(response) => {
return response.data;
},
function(error) {
if (error.response.data && error.response.data.code) {
checkStatus(error.response.data, error.config);
}
if (error.response && (error.response.status == 401 || error.response.status == 400)) {
const router = useRouter$1();
router.push({ name: "auth-login" });
}
return Promise.reject(error);
}
);
function checkStatus(data, config) {
const errorMessage2 = get$1(config, "meta.errorMessage", "message");
console.log("this is config", config);
if (errorMessage2 == "none") return;
switch (errorMessage2) {
case "message":
api$1.error(data.message);
break;
default:
api$1.error(data.message);
}
}
const myAxios = {
//AxiosResponse
post(url, data, config) {
return _axios.post(url, data, config);
},
request(config) {
return _axios.request(config);
},
//AxiosResponse
get(url, config) {
return _axios.get(url, config);
},
//AxiosResponse
delete(url, config) {
return _axios.delete(url, config);
},
//AxiosResponse
head(url, config) {
return _axios.head(url, config);
},
//AxiosResponse
options(url, config) {
return _axios.options(url, config);
},
//AxiosResponse
put(url, data, config) {
return _axios.put(url, data, config);
},
//AxiosResponse
patch(url, data, config) {
return _axios.patch(url, data, config);
},
//AxiosResponse
postForm(url, data, config) {
return _axios.postForm(url, data, config);
},
//AxiosResponse
putForm(url, data, config) {
return _axios.putForm(url, data, config);
},
//AxiosResponse
patchForm(url, data, config) {
return _axios.patchForm(url, data, config);
}
};
const getSellerConfig = async () => {
return await $fetch(`${baseURL}/config`, { method: "POST" });
};
const subscribeUserSever = async (subscription, userId) => await myAxios.post(`/notification/subscribe`, { subscription, userId });
const sendPublic = async (title, body) => await myAxios.post(`/notification/send-public`, { title, body });
const sendPrivate = async (title, body, user_id) => await myAxios.post(`/notification/send-private`, { title, body, user_id });
const APP_TYPE = "single";
const APP_Milady_Date = false;
const useConfigStore = defineStore("setting", () => {
const langMode = ref("fa");
const themeMode = ref("light");
const priceUnit = ref();
const isSeller = ref(false);
const config = ref();
const isNightStore = ref(false);
const isRTL = ref(false);
const sellerConfig = ref();
async function getConfig() {
try {
sellerConfig.value = await getSellerConfig();
} catch (e) {
console.log(e);
}
}
function setLocalConfig() {
config.value = {
themeMode: themeMode.value,
langMode: langMode.value
};
localStorage.setItem("config", JSON.stringify(config.value));
}
function useString(value, ...val) {
switch (langMode.value) {
case "fa":
return get$1(strings(val), `${value}.fa`);
case "en":
return get$1(strings(val), `${value}.en`);
}
}
function useModule(value) {
return get$1(module$1(), value) ?? false;
}
watch(themeMode, () => {
setNight();
});
watch(langMode, () => {
setLocalConfig();
setRtl();
priceUnit.value = useString("rial");
});
watch(/* @__PURE__ */ usePreferredDark(), () => {
setNight();
});
function setRtl() {
isRTL.value = ["fa"].includes(langMode.value);
(void 0).dir = isRTL.value ? "rtl" : "ltr";
}
function setNight() {
switch (themeMode.value) {
case "default":
isNight.value = (/* @__PURE__ */ usePreferredDark()).value;
isNightStore.value = (/* @__PURE__ */ usePreferredDark()).value;
break;
case "light":
isNight.value = false;
isNightStore.value = false;
break;
case "night":
isNight.value = true;
isNightStore.value = true;
break;
}
setLocalConfig();
}
function reset() {
isSeller.value = false;
}
return { useString, getConfig, lang: langMode, isNightStore, priceUnit, isSeller, isRTL, themeMode, reset, sellerConfig, useModule };
});
const getMe = async () => {
return await myAxios.get("/auth/me");
};
const login = async (email, password) => {
return await myAxios.post("/auth/login", { email, password });
};
const generateOtp = async (phone, type = "login") => {
return await myAxios.post("/auth/generate-otp", { phone, type });
};
const verifyOtp = async (phone, otp) => {
return await myAxios.post("/auth/verify-otp", { phone, otp });
};
const setPassword = async (password) => {
return await myAxios.post("/auth/set-password", { password });
};
const forgetPassword = async (phone, otp, new_password) => {
return await myAxios.post("/auth/forget-password", { phone, otp, new_password });
};
const setBirthday = async (birthday) => {
return await myAxios.post("/auth/set-birthday", { birthday });
};
const setNames = async (first_name, last_name) => {
return await myAxios.post("/auth/set-names", { first_name, last_name });
};
const updateUserTable = async (obj) => supabaseService.fetch("users", "update", {
data: obj,
field: "id",
value: obj.id ?? ""
});
const updateAuthUser = async (obj) => {
return supabaseService.updateUserDetails(
obj?.email ?? void 0,
void 0,
obj?.password ?? void 0
);
};
const updateUser = async (obj) => {
delete obj?.email;
await updateAuthUser(obj);
delete obj?.password;
console.log(obj);
await updateUserTable(obj);
};
async function baseConfirm(title, actionFunction) {
const config = useConfigStore();
Modal.confirm({
title,
icon: createVNode(ExclamationCircleOutlined$2),
okText: config.useString("ok"),
okType: "danger",
centered: true,
cancelText: config.useString("cancel"),
async onOk() {
try {
await actionFunction();
} catch (e) {
console.error(e);
}
},
onCancel() {
console.log("Cancel");
}
});
}
async function baseConfirmWithId(title, id, actionFunction, refreshTable) {
const config = useConfigStore();
Modal.confirm({
title,
icon: createVNode(ExclamationCircleOutlined$2),
okText: config.useString("ok"),
okType: "danger",
centered: true,
cancelText: config.useString("cancel"),
async onOk() {
try {
await actionFunction(id);
if (refreshTable) {
await refreshTable();
}
} catch (e) {
console.error(e);
}
},
onCancel() {
console.log("Cancel");
}
});
}
const usePriceStore = defineStore("price", () => {
const prices = ref([]);
const getList = async () => {
const res = await supabaseService.fetch("prices", "select");
setItems(res);
};
const setItem = (_item) => {
const index2 = prices.value.findIndex((item) => item.id === _item.id);
if (index2 >= 0) {
Object.assign(prices.value[index2], {
..._item
});
} else {
prices.value.push(_item);
}
};
const setItems = (_items) => {
_items.map((item) => setItem(item));
};
const runWebsocket = () => {
supabase.channel("realtime:prices").on(
"postgres_changes",
{
event: "*",
schema: "public",
table: "prices"
},
async (payload) => {
if (payload.eventType === "INSERT") {
setItem(payload.new);
} else if (payload.eventType === "UPDATE") {
setItem(payload.new);
}
}
).subscribe();
};
return {
prices,
getList,
runWebsocket,
getPriceItemPrice
};
});
const getPriceItemPrice = (id) => {
const priceStore = usePriceStore();
return priceStore.prices.find((item) => item.id_key === id);
};
function useProduct(product, variantSelected) {
const cartStore = useCartStore();
const onlinePrices = usePriceStore();
const config = useConfigStore();
const tala18 = ref(onlinePrices.prices.find((x) => x.name === "tgju 18")?.price);
const silver999 = ref(onlinePrices.prices.find((x) => x.name === "tgju silver_999")?.price);
const title = computed(() => {
return get$1(unref(product), "title_fa", "");
});
computed(() => {
return get$1(unref(product), "id", null);
});
const seoTitle = computed(() => {
let temp = title.value;
if (unref(product).seo_title) {
temp = unref(product).seo_title;
}
return temp;
});
const seoMeta = computed(() => {
return get$1(unref(product), "meta", "");
});
const weight = computed(() => {
return get$1(unref(product), "weight", "");
});
const weightPriceCalculator = (w = 0) => {
if (unref(product).collection_id === 1) {
return (w * tala18.value + w * tala18.value * (unref(product).percent_fee ?? 0) / 100 + w * tala18.value * (config.sellerConfig?.store?.tax_profit ?? 0) / 100 + (config.sellerConfig?.store?.has_tax ? w * tala18.value * (((unref(product).percent_fee ?? 0) + (config.sellerConfig?.store?.tax_profit ?? 0)) / 100) * 0.09 : 0) + (unref(product).rial_fee ?? 0))?.toFixed(0);
} else if (unref(product).collection_id === 2) {
return (w * silver999.value + w * silver999.value * (unref(product).percent_fee ?? 0) / 100 + w * silver999.value * (config.sellerConfig?.store?.tax_profit ?? 0) / 100 + (config.sellerConfig?.store?.has_tax ? w * silver999.value * (((unref(product).percent_fee ?? 0) + (config.sellerConfig?.store?.tax_profit ?? 0)) / 100) * 0.09 : 0) + (unref(product).rial_fee ?? 0))?.toFixed(0);
}
};
const originalPrice = computed(() => {
if (unref(product)?.collection_id === 1 || unref(product)?.collection_id === 2) {
if (unref(variantSelected)) {
if (unref(variantSelected)?.weight) return unref(variantSelected)?.auto_calculate ? weightPriceCalculator(unref(variantSelected)?.weight) : unref(variantSelected)?.price;
} else {
if (unref(product)?.weight) return unref(product)?.auto_calculate ? weightPriceCalculator(unref(product)?.weight) : unref(product)?.price;
}
} else {
if (unref(variantSelected)) {
if (unref(variantSelected)?.price) return unref(variantSelected)?.price;
} else {
if (unref(product)?.price) return unref(product)?.price;
}
return 0;
}
});
const price = computed(() => {
if (hasDiscount.value) {
return displayPrice.value?.toFixed(0);
}
return parseInt(originalPrice.value ?? "0")?.toFixed(0);
});
const displayPrice = computed(() => {
if (unref(variantSelected)) {
if (unref(variantSelected)?.auto_calculate && (unref(product)?.collection_id === 1 || unref(product)?.collection_id === 2)) {
const discountType = ref(unref(variantSelected)?.discount_type);
const weight2 = ref(unref(variantSelected)?.weight);
const discountValue = ref(unref(variantSelected)?.discount);
switch (discountType.value) {
case "percent":
return weightPriceCalculator(weight2.value) - weightPriceCalculator(weight2.value) * (discountValue.value ?? 0) / 100;
case "simple":
return weightPriceCalculator(weight2.value) - (discountValue.value ?? 0);
default:
return weightPriceCalculator(weight2.value);
}
} else {
if (unref(variantSelected)?.display_price) return unref(variantSelected)?.display_price;
else return unref(variantSelected)?.discount_type == "simple" ? unref(variantSelected)?.price - unref(variantSelected)?.discount : unref(variantSelected)?.price * ((100 - unref(variantSelected)?.discount) / 100);
}
} else {
if (unref(product)?.auto_calculate && (unref(product)?.collection_id === 1 || unref(product)?.collection_id === 2)) {
const discountType = ref(unref(product)?.discount_type);
const weight2 = ref(unref(product)?.weight);
const discountValue = ref(unref(product)?.discount);
switch (discountType.value) {
case "percent":
return weightPriceCalculator(weight2.value) - weightPriceCalculator(weight2.value) * (discountValue.value ?? 0) / 100;
case "simple":
return weightPriceCalculator(weight2.value) - (discountValue.value ?? 0);
default:
return weightPriceCalculator(weight2.value);
}
} else {
if (unref(product)?.display_price) return unref(product)?.display_price;
}
}
return 0;
});
const hasDiscount = computed(() => {
return discount.value !== 0 && discount.value !== null;
});
const discount = computed(() => {
if (unref(variantSelected)) {
if (unref(variantSelected)?.discount)
return unref(variantSelected)?.discount;
}
return get$1(unref(product), "discount", "");
});
const brand = computed(() => {
return get$1(unref(product), "brand.title", "-");
});
const isVariant = computed(() => {
const type = get$1(unref(product), "type", "simple");
return type === "variant";
});
const isBox = computed(() => {
const type = get$1(unref(product), "sell_type", "numeric");
return type === "box";
});
const gallery = computed(() => {
const temp = get$1(unref(product), "gallery", []);
return temp.map((item) => get$1(item, "file.src"));
});
const body = computed(() => {
const temp = get$1(unref(product), "body", "");
return temp ? temp : "";
});
const originalImage = computed(() => {
return getSupabaseStorageUrl(get$1(unref(product), "files[0].url", null));
});
computed(() => {
return get$1(unref(product), "banner_image.src", null);
});
const collection = computed(() => {
return get$1(unref(product), "collection.title", "-");
});
const count = computed(() => {
return get$1(unref(product), "count", "-");
});
const variants = computed(() => {
return get$1(unref(product), "variants", []);
});
const attributes2 = computed(() => {
return get$1(unref(product), "product_attributes", []);
});
const description = computed(() => {
return get$1(unref(product), "description", "-");
});
const attributesUsedInVariants = computed(() => {
const allVariantIds = [];
variants.value?.forEach((x) => x.variant_attribute_values?.forEach((y) => {
if (!allVariantIds.includes(y.attribute_values.id)) {
allVariantIds.push(y.attribute_values.id);
}
}));
const usedInVariants = attributes2?.value.filter((x) => x.use_in_variant) ?? [];
return usedInVariants.map((x) => {
return {
attribute_id: x.attribute_id,
attribute: x.attributes,
attribute_values_arr: x.attribute_values_arr?.filter((y) => allVariantIds.includes(y.id)),
attribute_values: x.attribute_values?.filter((y) => allVariantIds.includes(y)),
use_in_product_page: x.use_in_product_page
};
});
});
const qty = computed({
set(val) {
cartStore.addToCart(unref(product), val, variantSelected);
},
get() {
let index2;
if (unref(variantSelected)) {
index2 = cartStore.list.findIndex((item) => item.product.id == unref(product).id && item.variant?.id === unref(variantSelected).id);
} else {
index2 = cartStore.list.findIndex((item) => item.product.id == unref(product).id);
}
if (index2 > -1) return cartStore.list[index2].qty;
else return 0;
}
});
const hasProfit = computed(() => {
return price.value < originalPrice.value;
});
const discountPercent = computed(() => {
if (hasProfit.value) {
const diff = originalPrice.value - price.value;
return Math.floor(diff / (originalPrice.value / 100));
}
return 0;
});
const profit = computed(() => {
if (hasProfit.value) {
return originalPrice.value - price.value;
}
return 0;
});
return {
title,
price,
brand,
gallery,
variants,
body,
originalImage,
collection,
qty,
priceWithDiscount: displayPrice,
hasDiscount,
originalPrice,
// profitPercent,
hasProfit,
displayPrice,
// profit,
discountPercent,
seoTitle,
seoMeta,
attributes: attributes2,
isVariant,
description,
attributesUsedInVariants,
count,
profit,
discount,
isBox,
weight
};
}
const getProducts = async (page = 1, limit = 10) => {
return await myAxios.post("/products/table", { page, limit });
};
const createProduct = async (formField) => {
return await myAxios.post("/products", formField);
};
const updateProduct = async (formField, id) => {
return await myAxios.put(`/products/${id}`, formField);
};
const getOneProduct = async (id) => await myAxios.get(`/products/${id}`);
const getProductsWithIds = async (ids) => await supabaseService.fetch("products", "select_group", {
field: "id",
value: ids,
columns: `*,variants(*,variant_attribute_values(*,attribute_values(*)))`
});
const deleteProductById = async (id) => await supabaseService.fetch("products", "delete", {
field: "id",
value: id
});
const useCartStore = defineStore("cart", () => {
const list = ref([]);
const config = useConfigStore();
const payment_type = ref(3);
const address = ref(null);
function addToCart(product, qty, variant) {
if (list.value?.length) {
const owner_id = list.value[0].product?.owner_id;
if (owner_id?.length && product.owner_id && owner_id !== product.owner_id) {
list.value = [];
}
}
let index2;
if (variant) {
index2 = list.value.findIndex((item) => item.product.id == product.id && item.variant.id === variant.id);
} else {
index2 = list.value.findIndex((item) => item.product.id == product.id);
}
if (index2 > -1) {
if (qty > 0) {
list.value[index2].qty = qty;
} else {
list.value.splice(index2, 1);
}
} else {
if (qty > 0) {
list.value.push({ product, qty, variant });
api$1.success(config.useString("productAddedToCart"));
}
}
saveToLocal();
}
const count = computed(() => {
let sum = 0;
list.value.forEach((item) => {
sum += parseInt(item.qty.toString());
});
return sum;
});
const sumCart = computed(() => {
let sum = 0;
list.value.forEach((item) => {
const { price } = useProduct(item.product, item.variant);
sum += price.value * item.qty;
});
return sum;
});
const sumOriginalPrice = computed(() => {
let sum = 0;
list.value.forEach((item) => {
const { originalPrice } = useProduct(item.product, item.variant);
sum += originalPrice.value * item.qty;
});
return sum;
});
const sumSilverPrice = computed(() => {
let sum = 0;
list.value.forEach((item) => {
if (item.product.collection_id === 2) {
const { weight } = useProduct(item.product, item.variant);
sum += weight.value * item.qty;
}
});
return sum;
});
const sumGoldPrice = computed(() => {
let sum = 0;
list.value.forEach((item) => {
if (item.product.collection_id === 1) {
const { weight } = useProduct(item.product, item.variant);
sum += weight.value * item.qty;
}
});
return sum;
});
const sumDisplayPrice = computed(() => {
let sum = 0;
list.value.forEach((item) => {
const { displayPrice } = useProduct(item.product, item.variant);
sum += displayPrice.value * item.qty;
});
return sum;
});
const sumDiscountCart = computed(() => {
let sum = 0;
list.value.forEach((item) => {
const { profit } = useProduct(item.product, item.variant);
sum += profit.value * item.qty;
});
return sum;
});
const sumPercentProfit = computed(() => {
let sum = 0;
list.value.forEach((item) => {
const { discountPercent } = useProduct(item.product, item.variant);
sum += discountPercent.value;
});
return sum;
});
const sumItem = (cart_item) => {
const { priceWithDiscount } = useProduct(cart_item.product, cart_item.variant);
return cart_item.qty * priceWithDiscount.value;
};
const sumDiscount = computed(() => {
let sum = 0;
list.value.forEach((item) => {
const { discount } = useProduct(item.product, item.variant);
sum += discount.value;
});
return sum;
});
function removeProduct(product_id, variant_id) {
let index2;
if (variant_id) {
index2 = list.value.findIndex((item) => item.product.id == product_id && item.variant.id === variant_id);
} else {
index2 = list.value.findIndex((item) => item.product.id == product_id);
}
if (index2 > -1) {
list.value.splice(index2, 1);
}
saveToLocal();
}
function reset() {
list.value = [];
payment_type.value = 3;
saveToLocal();
}
async function getAddress() {
}
async function getFormLocal() {
const temp = localStorage.getItem("cart");
if (temp) {
const data = JSON.parse(temp);
if (Array.isArray(data)) {
const ids = data.map((item) => item.product.id);
if (ids.length) {
let products;
try {
loading.value = true;
const res = await getProductsWithIds(ids);
products = res;
} catch (e) {
console.log(e);
} finally {
loading.value = false;
}
list.value = [];
data.forEach((cartItem) => {
const productItem = products.find((product) => product?.id === cartItem.product.id);
let variantItem;
let productCount;
if (productItem) {
if (productItem.type === "variant") {
variantItem = productItem?.variants?.find((x) => cartItem.variant?.id === x.id);
productCount = variantItem?.stock;
} else {
productCount = productItem?.count;
}
if (cartItem.qty > productCount) {
cartItem.qty = productCount;
}
list.value.push({ product: cloneDeep$1(productItem), qty: cartItem.qty, variant: variantItem });
}
});
}
}
}
}
function saveToLocal() {
localStorage.setItem("cart", JSON.stringify(list.value));
}
return {
list,
addToCart,
count,
sumCart,
removeProduct,
address,
reset,
sumItem,
saveToLocal,
getFormLocal,
getAddress,
sumDiscount,
sumOriginalPrice,
sumDiscountCart,
sumPercentProfit,
sumDisplayPrice,
payment_type,
sumGoldPrice,
sumSilverPrice
};
});
const vapidKeys = {
"publicKey": "BPxLE03XsLqyrcfv_EsO7p7iR9GS5oN4jV5q6V_UuF2yLPDIFlUWc8XfSqY9926_W6IoHSmSeOxWTjnhANqG938",
"privateKey": "1k4YIoy5JgwSLuP-s5UuntfvXK_0OLEJyH6ei0lHnKE"
};
const isPushSupported = () => {
return "serviceWorker" in void 0 && "PushManager" in void 0;
};
const registerServiceWorker = async () => {
};
const requestNotificationPermission = async () => {
try {
const permission = await Notification.requestPermission();
return permission === "granted";
} catch (err) {
console.error("Error requesting permission:", err);
return false;
}
};
const subscribeUser = async (userId) => {
try {
console.log("userId", userId);
const registration = await (void 0).serviceWorker.ready;
console.log("hiregistration", registration);
const subscription = await registration.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array(vapidKeys.publicKey)
});
console.log("hi", subscription);
await subscribeUserSever(subscription, userId);
return subscription;
} catch (err) {
console.log("err ===>", err);
if (Notification.permission === "denied") {
console.warn("Permission for notifications was denied");
} else {
console.error("Failed to subscribe the user:", err);
}
throw err;
}
};
const sendPublicNotification = async (title, body) => {
try {
const response = await sendPublic(title, body);
return response;
} catch (err) {
console.error("Error sending public notification:", err);
throw err;
}
};
const sendPrivateNotification = async (userId, title, body) => {
try {
const response = await sendPrivate(title, body, userId);
return response;
} catch (err) {
console.error("Error sending private notification:", err);
throw err;
}
};
function urlBase64ToUint8Array(base64String) {
const padding = "=".repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding).replace(/-/g, "+").replace(/_/g, "/");
const rawData = (void 0).atob(base64);
const outputArray = new Uint8Array(rawData.length);
for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}
function useNotifications() {
const initializePushNotifications = async (userId) => {
if (!isPushSupported()) {
console.warn("Push notifications not supported");
return false;
}
try {
await registerServiceWorker();
const hasPermission = await requestNotificationPermission();
console.log("hasPermission ===>", hasPermission);
console.log("userId ===>", userId);
if (hasPermission && userId) {
await subscribeUser(userId);
return true;
}
return false;
} catch (err) {
console.error("Push notification initialization failed:", err);
return false;
}
};
const sendPublicNotification$1 = async (title, body) => {
return await sendPublicNotification(title, body);
};
const sendPrivateNotification$1 = async (userId, title, body) => {
return await sendPrivateNotification(userId, title, body);
};
return {
initializePushNotifications,
sendPublicNotification: sendPublicNotification$1,
sendPrivateNotification: sendPrivateNotification$1
};
}
async function fetchUserChats(userId, page = 1, limit = 10) {
const start = (page - 1) * limit;
const end = start + limit - 1;
const { data, error } = await supabase.from("chats").select(`
*,
user1:user1_id (id, name, avatar),
user2:user2_id (id, name, avatar)`).or(`user1_id.eq.${userId},user2_id.eq.${userId}`).order("updated_at", { ascending: false }).range(start, end);
if (error) {
console.error("Error fetching chats:", error);
return;
}
return data;
}
async function fetchOneChat(chatId) {
const { data, error } = await supabase.from("chats").select(`
*,
user1:user1_id (id, name, avatar),
user2:user2_id (id, name, avatar)`).eq("chat_id", chatId).single();
if (error) {
console.error("Error fetching chats:", error);
return;
}
console.log("fetchOnChat === ", data);
return data;
}
async function fetchChatMessages(chatId, page = 1, limit = 10) {
const { data, error } = await supabase.from("chat_messages").select(`
*,
media(*),
products(id,title_fa,files,users(id,name,avatar))
`).eq("chat_id", chatId).order("created_at", { ascending: true });
if (error) {
console.error("Error fetching messages:", error);
return;
}
console.log("Chat messages:", data);
return data;
}
async function getUnReadMessage(userId) {
const { data, error } = await supabase.from("chats").select().or(`user1_id.eq.${userId},user2_id.eq.${userId}`).not("last_message", "is", null).neq("last_message->>sender_id", userId).eq("last_message->>is_read", false);
if (error) {
console.error("Error fetching chats:", error);
return;
}
return data;
}
const getOneUser = async (id) => {
return await myAxios.get(`/users/profile/${id}`);
};
const getCustomerList = async (id, page = 1, limit = 10, search) => {
return await myAxios.post(`/users/customers/${id}`, { page, limit, search });
};
const getUserStoreRequest = async (user_id) => {
return await supabaseService.fetch("user_store_request", "select", { field: "user_id", value: user_id });
};
const getStoreCollections = async () => {
return await supabaseService.fetch("collections_store", "select");
};
const checkUsername = async (val) => {
return await supabaseService.fetch("users", "select", {
columns: "*",
field: "username",
value: val
});
};
const deleteUser = async (id) => {
try {
return await myAxios.post(`/auth/delete-user/${id}`);
} catch (e) {
console.log(e);
}
};
const useUserStore = defineStore("user", () => {
const user = ref(void 0);
const storeList = ref([]);
const unReadMessage = ref([]);
const userConvertStoreRequests = ref([]);
const myDataLoaded = ref(false);
const router = useRouter$1();
const activeStore = ref(null);
const config = useConfigStore();
const cart = useCartStore();
const { initializePushNotifications } = useNotifications();
async function getUserInfo() {
try {
loading.value = true;
const res = await getMe();
user.value = res.user;
config.isSeller = res.user.type === "store";
console.log("user.value.id", user.value.id);
initializePushNotifications(user.value.id);
getUnReadMessage(user.value.id).then((res2) => {
unReadMessage.value = res2 ?? [];
});
getUserStoreRequest(user.value.id).then((res2) => {
userConvertStoreRequests.value = res2;
});
} catch (e) {
console.log(e);
} finally {
loading.value = false;
}
}
const hasUserName = computed(() => {
});
const subscription = computed(() => {
});
const remainingSubscription = computed(() => {
if (subscription.value == null) {
return 0;
}
});
const isSeller = computed(() => {
return user.value.type == "seller" || !user.value.type;
});
const isIUser = computed(() => {
return user.value.type == "IUser";
});
async function logout() {
user.value = {};
cart.reset();
config.reset();
unReadMessage.value = [];
await router.push({ name: "home" });
}
async function confirmLogout() {
await baseConfirm(config.useString("confirmLogout"), logout);
}
return {
user,
unReadMessage,
getUserInfo,
hasUserName,
confirmLogout,
logout,
myDataLoaded,
/* store,
fullName,
avatar,*/
isSeller,
isIUser,
storeList,
subscription,
remainingSubscription,
activeStore,
userConvertStoreRequests
};
});
const isNight = ref(false);
const loading = ref(false);
ref(false);
ref(false);
ref(false);
function setToken(token) {
return localStorage.setItem(tokenName, token);
}
function getToken() {
}
function removeToken() {
}
function hotSelect(e) {
e.target?.select();
}
function goToProfile() {
const router = useRouter$1();
useConfigStore();
useUserStore();
router.push({ name: "user" });
}
const auth_45global = /* @__PURE__ */ defineNuxtRouteMiddleware((to, from) => {
});
const manifest_45route_45rule = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
{
return;
}
});
const globalMiddleware = [
validate,
auth_45global,
manifest_45route_45rule
];
const namedMiddleware = {};
const plugin$1 = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:router",
enforce: "pre",
async setup(nuxtApp) {
let __temp, __restore;
let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL;
const history = routerOptions.history?.(routerBase) ?? createMemoryHistory(routerBase);
const routes = routerOptions.routes ? ([__temp, __restore] = executeAsync(() => routerOptions.routes(_routes)), __temp = await __temp, __restore(), __temp) ?? _routes : _routes;
let startPosition;
const router = createRouter({
...routerOptions,
scrollBehavior: (to, from, savedPosition) => {
if (from === START_LOCATION_NORMALIZED) {
startPosition = savedPosition;
return;
}
if (routerOptions.scrollBehavior) {
router.options.scrollBehavior = routerOptions.scrollBehavior;
if ("scrollRestoration" in (void 0).history) {
const unsub = router.beforeEach(() => {
unsub();
(void 0).history.scrollRestoration = "manual";
});
}
return routerOptions.scrollBehavior(to, START_LOCATION_NORMALIZED, startPosition || savedPosition);
}
},
history,
routes
});
nuxtApp.vueApp.use(router);
const previousRoute = shallowRef(router.currentRoute.value);
router.afterEach((_to, from) => {
previousRoute.value = from;
});
Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", {
get: () => previousRoute.value
});
const initialURL = nuxtApp.ssrContext.url;
const _route = shallowRef(router.currentRoute.value);
const syncCurrentRoute = () => {
_route.value = router.currentRoute.value;
};
nuxtApp.hook("page:finish", syncCurrentRoute);
router.afterEach((to, from) => {
if (to.matched[0]?.components?.default === from.matched[0]?.components?.default) {
syncCurrentRoute();
}
});
const route = {};
for (const key2 in _route.value) {
Object.defineProperty(route, key2, {
get: () => _route.value[key2],
enumerable: true
});
}
nuxtApp._route = shallowReactive(route);
nuxtApp._middleware ||= {
global: [],
named: {}
};
useError();
if (!nuxtApp.ssrContext?.islandContext) {
router.afterEach(async (to, _from, failure) => {
delete nuxtApp._processingMiddleware;
if (failure) {
await nuxtApp.callHook("page:loading:end");
}
if (failure?.type === 4) {
return;
}
if (to.redirectedFrom && to.fullPath !== initialURL) {
await nuxtApp.runWithContext(() => navigateTo(to.fullPath || "/"));
}
});
}
try {
if (true) {
;
[__temp, __restore] = executeAsync(() => router.push(initialURL)), await __temp, __restore();
;
}
;
[__temp, __restore] = executeAsync(() => router.isReady()), await __temp, __restore();
;
} catch (error2) {
[__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(() => showError(error2))), await __temp, __restore();
}
const resolvedInitialRoute = router.currentRoute.value;
syncCurrentRoute();
if (nuxtApp.ssrContext?.islandContext) {
return { provide: { router } };
}
const initialLayout = nuxtApp.payload.state._layout;
router.beforeEach(async (to, from) => {
await nuxtApp.callHook("page:loading:start");
to.meta = reactive(to.meta);
if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) {
to.meta.layout = initialLayout;
}
nuxtApp._processingMiddleware = true;
if (!nuxtApp.ssrContext?.islandContext) {
const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]);
for (const component of to.matched) {
const componentMiddleware = component.meta.middleware;
if (!componentMiddleware) {
continue;
}
for (const entry2 of toArray$9(componentMiddleware)) {
middlewareEntries.add(entry2);
}
}
{
const routeRules = await nuxtApp.runWithContext(() => getRouteRules({ path: to.path }));
if (routeRules.appMiddleware) {
for (const key2 in routeRules.appMiddleware) {
if (routeRules.appMiddleware[key2]) {
middlewareEntries.add(key2);
} else {
middlewareEntries.delete(key2);
}
}
}
}
for (const entry2 of middlewareEntries) {
const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await namedMiddleware[entry2]?.().then((r) => r.default || r) : entry2;
if (!middleware) {
throw new Error(`Unknown route middleware: '${entry2}'.`);
}
try {
const result = await nuxtApp.runWithContext(() => middleware(to, from));
if (true) {
if (result === false || result instanceof Error) {
const error2 = result || createError({
statusCode: 404,
statusMessage: `Page Not Found: ${initialURL}`
});
await nuxtApp.runWithContext(() => showError(error2));
return false;
}
}
if (result === true) {
continue;
}
if (result === false) {
return result;
}
if (result) {
if (isNuxtError(result) && result.fatal) {
await nuxtApp.runWithContext(() => showError(result));
}
return result;
}
} catch (err) {
const error2 = createError(err);
if (error2.fatal) {
await nuxtApp.runWithContext(() => showError(error2));
}
return error2;
}
}
}
});
router.onError(async () => {
delete nuxtApp._processingMiddleware;
await nuxtApp.callHook("page:loading:end");
});
router.afterEach(async (to, _from) => {
if (to.matched.length === 0) {
await nuxtApp.runWithContext(() => showError(createError({
statusCode: 404,
fatal: false,
statusMessage: `Page not found: ${to.fullPath}`,
data: {
path: to.fullPath
}
})));
}
});
nuxtApp.hooks.hookOnce("app:created", async () => {
try {
if ("name" in resolvedInitialRoute) {
resolvedInitialRoute.name = void 0;
}
await router.replace({
...resolvedInitialRoute,
force: true
});
router.options.scrollBehavior = routerOptions.scrollBehavior;
} catch (error2) {
await nuxtApp.runWithContext(() => showError(error2));
}
});
return { provide: { router } };
}
});
defineComponent({
name: "ServerPlaceholder",
render() {
return createElementBlock("div");
}
});
const clientOnlySymbol = Symbol.for("nuxt:client-only");
const __nuxt_component_0 = defineComponent({
name: "ClientOnly",
inheritAttrs: false,
props: ["fallback", "placeholder", "placeholderTag", "fallbackTag"],
...false,
setup(props2, { slots, attrs }) {
const mounted = shallowRef(false);
const vm = getCurrentInstance();
if (vm) {
vm._nuxtClientOnly = true;
}
provide(clientOnlySymbol, true);
return () => {
if (mounted.value) {
const vnodes = slots.default?.();
if (vnodes && vnodes.length === 1) {
return [cloneVNode(vnodes[0], attrs)];
}
return vnodes;
}
const slot = slots.fallback || slots.placeholder;
if (slot) {
return h(slot);
}
const fallbackStr = props2.fallback || props2.placeholder || "";
const fallbackTag = props2.fallbackTag || props2.placeholderTag || "span";
return createElementBlock(fallbackTag, attrs, fallbackStr);
};
}
});
const useStateKeyPrefix = "$s";
function useState(...args) {
const autoKey = typeof args[args.length - 1] === "string" ? args.pop() : void 0;
if (typeof args[0] !== "string") {
args.unshift(autoKey);
}
const [_key, init] = args;
if (!_key || typeof _key !== "string") {
throw new TypeError("[nuxt] [useState] key must be a string: " + _key);
}
if (init !== void 0 && typeof init !== "function") {
throw new Error("[nuxt] [useState] init must be a function: " + init);
}
const key2 = useStateKeyPrefix + _key;
const nuxtApp = useNuxtApp();
const state = toRef(nuxtApp.payload.state, key2);
if (state.value === void 0 && init) {
const initialValue = init();
if (isRef(initialValue)) {
nuxtApp.payload.state[key2] = initialValue;
return initialValue;
}
state.value = initialValue;
}
return state;
}
function useRequestEvent(nuxtApp) {
nuxtApp ||= useNuxtApp();
return nuxtApp.ssrContext?.event;
}
const _0_siteConfig_tU0SxKrPeVRXWcGu2sOnIfhNDbYiKNfDCvYZhRueG0Q = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt-site-config:init",
enforce: "pre",
async setup(nuxtApp) {
const stack = useRequestEvent()?.context?.siteConfig;
const state = useState("site-config");
{
nuxtApp.hooks.hook("app:rendered", () => {
state.value = stack?.get({
debug: (/* @__PURE__ */ useRuntimeConfig())["nuxt-site-config"].debug,
resolveRefs: true
});
});
}
return {
provide: {
nuxtSiteConfig: stack
}
};
}
});
const reducers = [
["NuxtError", (data) => isNuxtError(data) && data.toJSON()],
["EmptyShallowRef", (data) => isRef(data) && isShallow(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
["EmptyRef", (data) => isRef(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
["ShallowRef", (data) => isRef(data) && isShallow(data) && data.value],
["ShallowReactive", (data) => isReactive(data) && isShallow(data) && toRaw(data)],
["Ref", (data) => isRef(data) && data.value],
["Reactive", (data) => isReactive(data) && toRaw(data)]
];
const revive_payload_server_MVtmlZaQpj6ApFmshWfUWl5PehCebzaBf2NuRMiIbms = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:revive-payload:server",
setup() {
for (const [reducer, fn] of reducers) {
definePayloadReducer(reducer, fn);
}
}
});
const plugin = /* @__PURE__ */ defineNuxtPlugin({
name: "pinia",
setup(nuxtApp) {
const pinia = createPinia();
nuxtApp.vueApp.use(pinia);
setActivePinia(pinia);
{
nuxtApp.payload.pinia = toRaw(pinia.state.value);
}
return {
provide: {
pinia
}
};
}
});
const components_plugin_4kY4pyzJIYX99vmMAAIorFf3CnAaptHitJgf7JxiED8 = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:global-components"
});
dayjs.extend(updateLocale);
dayjs.extend(relativeTime);
dayjs.extend(utc);
const plugin_pctIVG_FA3ygvTkx4z_pYtRdHdDEZ_qPbl4DqvN9CMQ = /* @__PURE__ */ defineNuxtPlugin(async (nuxtApp) => nuxtApp.provide("dayjs", dayjs));
const pwa_icons_plugin_OtOZ6CGly_Vz5_PCGGLA9qHLz2Y5_d5czYAX7q_3Lug = /* @__PURE__ */ defineNuxtPlugin(() => {
return {
provide: {
pwaIcons: {
transparent: {},
maskable: {},
favicon: {},
apple: {},
appleSplashScreen: {}
}
}
};
});
const unocss_6Z4vW7S9aX_q2svWbGBc_X2b5QbQdkNmvzr_3kqqCd0 = /* @__PURE__ */ defineNuxtPlugin(() => {
});
const antd_wRk93usYsThixdRBlWDoxrWoXaF_47Ra1UYkDPDM8NA = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(Antd);
});
const critical_css_server_IwTFHgs4XvqzputuZGAoVvVfCnl9T_NvyGzDIxLJky8 = () => {
};
const init_config_LL47CEFmgpdYE9Cs_saNIOj0KSQjq_8az7e6qB2y3Ko = /* @__PURE__ */ defineNuxtPlugin({
name: "init-config",
dependsOn: ["pinia"],
// تضمین اجرای بعد از Pinia
async setup(nuxtApp) {
let __temp, __restore;
if (nuxtApp.$pinia) setActivePinia(nuxtApp.$pinia);
const configStore = useConfigStore();
[__temp, __restore] = executeAsync(() => configStore.getConfig()), await __temp, __restore();
}
});
var LifecycleEnum = /* @__PURE__ */ ((LifecycleEnum2) => {
LifecycleEnum2["LOADING"] = "loading";
LifecycleEnum2["LOADED"] = "loaded";
LifecycleEnum2["ERROR"] = "error";
return LifecycleEnum2;
})(LifecycleEnum || {});
const isEnumerable = Object.prototype.propertyIsEnumerable;
const getSymbols = Object.getOwnPropertySymbols;
function isObject(val) {
return typeof val === "function" || toString.call(val) === "[object Object]";
}
function isPrimitive(val) {
return typeof val === "object" ? val === null : typeof val !== "function";
}
function isValidKey(key2) {
return key2 !== "__proto__" && key2 !== "constructor" && key2 !== "prototype";
}
function assignSymbols(target, ...args) {
if (!isObject(target))
throw new TypeError("expected the first argument to be an object");
if (args.length === 0 || typeof Symbol !== "function" || typeof getSymbols !== "function")
return target;
for (const arg of args) {
const names = getSymbols(arg);
for (const key2 of names) {
if (isEnumerable.call(arg, key2))
target[key2] = arg[key2];
}
}
return target;
}
function assign(target, ...args) {
let i = 0;
if (isPrimitive(target))
target = args[i++];
if (!target)
target = {};
for (; i < args.length; i++) {
if (isObject(args[i])) {
for (const key2 of Object.keys(args[i])) {
if (isValidKey(key2)) {
if (isObject(target[key2]) && isObject(args[i][key2]))
assign(target[key2], args[i][key2]);
else
target[key2] = args[i][key2];
}
}
assignSymbols(target, args[i]);
}
}
return target;
}
const DEFAULT_LOADING = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
const DEFAULT_ERROR = "";
const DEFAULT_OBSERVER_OPTIONS = {
rootMargin: "0px",
threshold: 0
};
const TIMEOUT_ID_DATA_ATTR = "data-lazy-timeout-id";
class Lazy {
constructor(options) {
this.options = {
loading: DEFAULT_LOADING,
error: DEFAULT_ERROR,
observerOptions: DEFAULT_OBSERVER_OPTIONS,
log: true,
lifecycle: {},
logLevel: "error"
};
this._images = /* @__PURE__ */ new WeakMap();
this.config(options);
}
config(options = {}) {
assign(this.options, options);
}
mount(el, binding) {
if (!el)
return;
const { src, loading: loading2, error, lifecycle, delay } = this._valueFormatter(typeof binding === "string" ? binding : binding.value);
this._lifecycle(LifecycleEnum.LOADING, lifecycle, el);
el.setAttribute("src", loading2 || DEFAULT_LOADING);
{
this.loadImages(el, src, error, lifecycle);
this._log(() => {
this._logger("Not support IntersectionObserver!");
});
}
this._initIntersectionObserver(el, src, error, lifecycle, delay);
}
update(el, binding) {
if (!el)
return;
this._realObserver(el)?.unobserve(el);
const { src, error, lifecycle, delay } = this._valueFormatter(typeof binding === "string" ? binding : binding.value);
this._initIntersectionObserver(el, src, error, lifecycle, delay);
}
unmount(el) {
if (!el)
return;
this._realObserver(el)?.unobserve(el);
this._images.delete(el);
}
loadImages(el, src, error, lifecycle) {
this._setImageSrc(el, src, error, lifecycle);
}
_setImageSrc(el, src, error, lifecycle) {
if (el.tagName.toLowerCase() === "img") {
if (src) {
const preSrc = el.getAttribute("src");
if (preSrc !== src)
el.setAttribute("src", src);
}
this._listenImageStatus(el, () => {
this._lifecycle(LifecycleEnum.LOADED, lifecycle, el);
}, () => {
el.onload = null;
this._lifecycle(LifecycleEnum.ERROR, lifecycle, el);
this._realObserver(el)?.disconnect();
if (error) {
const newImageSrc = el.getAttribute("src");
if (newImageSrc !== error)
el.setAttribute("src", error);
}
this._log(() => {
this._logger(`Image failed to load!And failed src was: ${src} `);
});
});
} else {
el.style.backgroundImage = `url('${src}')`;
}
}
_initIntersectionObserver(el, src, error, lifecycle, delay) {
const observerOptions = this.options.observerOptions;
this._images.set(el, new IntersectionObserver((entries) => {
Array.prototype.forEach.call(entries, (entry2) => {
if (delay && delay > 0)
this._delayedIntersectionCallback(el, entry2, delay, src, error, lifecycle);
else
this._intersectionCallback(el, entry2, src, error, lifecycle);
});
}, observerOptions));
this._realObserver(el)?.observe(el);
}
_intersectionCallback(el, entry2, src, error, lifecycle) {
if (entry2.isIntersecting) {
this._realObserver(el)?.unobserve(entry2.target);
this._setImageSrc(el, src, error, lifecycle);
}
}
_delayedIntersectionCallback(el, entry2, delay, src, error, lifecycle) {
if (entry2.isIntersecting) {
if (entry2.target.hasAttribute(TIMEOUT_ID_DATA_ATTR))
return;
const timeoutId = setTimeout(() => {
this._intersectionCallback(el, entry2, src, error, lifecycle);
entry2.target.removeAttribute(TIMEOUT_ID_DATA_ATTR);
}, delay);
entry2.target.setAttribute(TIMEOUT_ID_DATA_ATTR, String(timeoutId));
} else {
if (entry2.target.hasAttribute(TIMEOUT_ID_DATA_ATTR)) {
clearTimeout(Number(entry2.target.getAttribute(TIMEOUT_ID_DATA_ATTR)));
entry2.target.removeAttribute(TIMEOUT_ID_DATA_ATTR);
}
}
}
_listenImageStatus(image, success, error) {
image.onload = success;
image.onerror = error;
}
_valueFormatter(value) {
let src = value;
let loading2 = this.options.loading;
let error = this.options.error;
let lifecycle = this.options.lifecycle;
let delay = this.options.delay;
if (isObject(value)) {
src = value.src;
loading2 = value.loading || this.options.loading;
error = value.error || this.options.error;
lifecycle = value.lifecycle || this.options.lifecycle;
delay = value.delay || this.options.delay;
}
return {
src,
loading: loading2,
error,
lifecycle,
delay
};
}
_log(callback) {
if (this.options.log)
callback();
}
_lifecycle(life, lifecycle, el) {
switch (life) {
case LifecycleEnum.LOADING:
el?.setAttribute("lazy", LifecycleEnum.LOADING);
if (lifecycle?.loading)
lifecycle.loading(el);
break;
case LifecycleEnum.LOADED:
el?.setAttribute("lazy", LifecycleEnum.LOADED);
if (lifecycle?.loaded)
lifecycle.loaded(el);
break;
case LifecycleEnum.ERROR:
el?.setAttribute("lazy", LifecycleEnum.ERROR);
if (lifecycle?.error)
lifecycle.error(el);
break;
}
}
_realObserver(el) {
return this._images.get(el);
}
_logger(message, ...optionalParams) {
let log = console.error;
switch (this.options.logLevel) {
case "error":
log = console.error;
break;
case "warn":
log = console.warn;
break;
case "info":
log = console.info;
break;
case "debug":
log = console.debug;
break;
}
log(message, optionalParams);
}
}
const index = {
install(Vue, options) {
const lazy = new Lazy(options);
Vue.config.globalProperties.$Lazyload = lazy;
Vue.provide("Lazyload", lazy);
Vue.directive("lazy", {
mounted: lazy.mount.bind(lazy),
updated: lazy.update.bind(lazy),
unmounted: lazy.unmount.bind(lazy)
});
}
};
const lazyload_oSWyYwB040EQqpSoyMv0a_ZGXlx9BlocjdtTjNacMzA = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(index, {
// تنظیمات پیشفرض (اختیاری)
loading: "/preview/default-loading.gif",
error: "/preview/default-error.png"
});
});
function isToken() {
const token = getToken();
return !!token;
}
const ready_IqyLfQWq1SSkVA81KGdfnfHuL__bWsFsa22wVAACDFQ = /* @__PURE__ */ defineNuxtPlugin(async () => {
let __temp, __restore;
const userStore = useUserStore();
if (isToken()) {
[__temp, __restore] = executeAsync(() => userStore.getUserInfo()), await __temp, __restore();
}
});
const plugins = [
payloadPlugin,
unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU,
plugin$1,
_0_siteConfig_tU0SxKrPeVRXWcGu2sOnIfhNDbYiKNfDCvYZhRueG0Q,
revive_payload_server_MVtmlZaQpj6ApFmshWfUWl5PehCebzaBf2NuRMiIbms,
plugin,
components_plugin_4kY4pyzJIYX99vmMAAIorFf3CnAaptHitJgf7JxiED8,
plugin_pctIVG_FA3ygvTkx4z_pYtRdHdDEZ_qPbl4DqvN9CMQ,
pwa_icons_plugin_OtOZ6CGly_Vz5_PCGGLA9qHLz2Y5_d5czYAX7q_3Lug,
unocss_6Z4vW7S9aX_q2svWbGBc_X2b5QbQdkNmvzr_3kqqCd0,
antd_wRk93usYsThixdRBlWDoxrWoXaF_47Ra1UYkDPDM8NA,
critical_css_server_IwTFHgs4XvqzputuZGAoVvVfCnl9T_NvyGzDIxLJky8,
init_config_LL47CEFmgpdYE9Cs_saNIOj0KSQjq_8az7e6qB2y3Ko,
lazyload_oSWyYwB040EQqpSoyMv0a_ZGXlx9BlocjdtTjNacMzA,
ready_IqyLfQWq1SSkVA81KGdfnfHuL__bWsFsa22wVAACDFQ
];
const layouts = {
default: defineAsyncComponent(() => import('./default-C9sBZYFd.mjs').then((m) => m.default || m))
};
const LayoutLoader = defineComponent({
name: "LayoutLoader",
inheritAttrs: false,
props: {
name: String,
layoutProps: Object
},
setup(props2, context2) {
return () => h(layouts[props2.name], props2.layoutProps, context2.slots);
}
});
const nuxtLayoutProps = {
name: {
type: [String, Boolean, Object],
default: null
},
fallback: {
type: [String, Object],
default: null
}
};
const __nuxt_component_1 = defineComponent({
name: "NuxtLayout",
inheritAttrs: false,
props: nuxtLayoutProps,
setup(props2, context2) {
const nuxtApp = useNuxtApp();
const injectedRoute = inject(PageRouteSymbol);
const shouldUseEagerRoute = !injectedRoute || injectedRoute === useRoute$1();
const route = shouldUseEagerRoute ? useRoute() : injectedRoute;
const layout = computed(() => {
let layout2 = unref(props2.name) ?? route?.meta.layout ?? "default";
if (layout2 && !(layout2 in layouts)) {
if (props2.fallback) {
layout2 = unref(props2.fallback);
}
}
return layout2;
});
const layoutRef = shallowRef();
context2.expose({ layoutRef });
const done = nuxtApp.deferHydration();
let lastLayout;
return () => {
const hasLayout = layout.value && layout.value in layouts;
const transitionProps = route?.meta.layoutTransition ?? appLayoutTransition;
const previouslyRenderedLayout = lastLayout;
lastLayout = layout.value;
return _wrapInTransition(hasLayout && transitionProps, {
default: () => h(Suspense, { suspensible: true, onResolve: () => {
nextTick(done);
} }, {
default: () => h(
LayoutProvider,
{
layoutProps: mergeProps(context2.attrs, { ref: layoutRef }),
key: layout.value || void 0,
name: layout.value,
shouldProvide: !props2.name,
isRenderingNewLayout: (name) => {
return name !== previouslyRenderedLayout && name === layout.value;
},
hasTransition: !!transitionProps
},
context2.slots
)
})
}).default();
};
}
});
const LayoutProvider = defineComponent({
name: "NuxtLayoutProvider",
inheritAttrs: false,
props: {
name: {
type: [String, Boolean]
},
layoutProps: {
type: Object
},
hasTransition: {
type: Boolean
},
shouldProvide: {
type: Boolean
},
isRenderingNewLayout: {
type: Function,
required: true
}
},
setup(props2, context2) {
const name = props2.name;
if (props2.shouldProvide) {
provide(LayoutMetaSymbol, {
isCurrent: (route) => name === (route.meta.layout ?? "default")
});
}
const injectedRoute = inject(PageRouteSymbol);
const isNotWithinNuxtPage = injectedRoute && injectedRoute === useRoute$1();
if (isNotWithinNuxtPage) {
const vueRouterRoute = useRoute();
const reactiveChildRoute = {};
for (const _key in vueRouterRoute) {
const key2 = _key;
Object.defineProperty(reactiveChildRoute, key2, {
enumerable: true,
get: () => {
return props2.isRenderingNewLayout(props2.name) ? vueRouterRoute[key2] : injectedRoute[key2];
}
});
}
provide(PageRouteSymbol, shallowReactive(reactiveChildRoute));
}
return () => {
if (!name || typeof name === "string" && !(name in layouts)) {
return context2.slots.default?.();
}
return h(
LayoutLoader,
{ key: name, layoutProps: props2.layoutProps, name },
context2.slots
);
};
}
});
const pwaInfo = { "webManifest": { "href": "/manifest.webmanifest" } };
const __nuxt_component_2 = defineComponent({
async setup() {
if (pwaInfo) {
const meta = ref({ link: [] });
useHead(meta);
const { webManifest } = pwaInfo;
if (webManifest) {
const { href } = webManifest;
{
meta.value.link.push({
rel: "manifest",
href
});
}
}
}
return () => null;
}
});
const defineRouteProvider = (name = "RouteProvider") => defineComponent({
name,
props: {
route: {
type: Object,
required: true
},
vnode: Object,
vnodeRef: Object,
renderKey: String,
trackRootNodes: Boolean
},
setup(props2) {
const previousKey = props2.renderKey;
const previousRoute = props2.route;
const route = {};
for (const key2 in props2.route) {
Object.defineProperty(route, key2, {
get: () => previousKey === props2.renderKey ? props2.route[key2] : previousRoute[key2],
enumerable: true
});
}
provide(PageRouteSymbol, shallowReactive(route));
return () => {
if (!props2.vnode) {
return props2.vnode;
}
return h(props2.vnode, { ref: props2.vnodeRef });
};
}
});
const RouteProvider = defineRouteProvider();
const __nuxt_component_3 = defineComponent({
name: "NuxtPage",
inheritAttrs: false,
props: {
name: {
type: String
},
transition: {
type: [Boolean, Object],
default: void 0
},
keepalive: {
type: [Boolean, Object],
default: void 0
},
route: {
type: Object
},
pageKey: {
type: [Function, String],
default: null
}
},
setup(props2, { attrs, slots, expose }) {
const nuxtApp = useNuxtApp();
const pageRef = ref();
inject(PageRouteSymbol, null);
expose({ pageRef });
inject(LayoutMetaSymbol, null);
nuxtApp.deferHydration();
return () => {
return h(RouterView, { name: props2.name, route: props2.route, ...attrs }, {
default: (routeProps) => {
return h(Suspense, { suspensible: true }, {
default() {
return h(RouteProvider, {
vnode: slots.default ? normalizeSlot(slots.default, routeProps) : routeProps.Component,
route: routeProps.route,
vnodeRef: pageRef
});
}
});
}
});
};
}
});
function normalizeSlot(slot, data) {
const slotContent = slot(data);
return slotContent.length === 1 ? h(slotContent[0]) : h(Fragment, void 0, slotContent);
}
const primary = "#0064e0";
const primaryDark = "#fff";
const secondary = "#abc2f7";
const tertiary = "#feb701";
const gray = { "50": "#f9fafd", "70": "#f9f9f9", "100": "#e8eaee", "200": "#caced8", "300": "#D1D5DB", "400": "#9CA3AF", "500": "#949db0", "700": "#374151", "900": "#656f87" };
const green = { "100": "#ecf5ef", "900": "#0f7f36" };
const black = "#1e2229";
const white = "#ffffff";
const red = { "100": "#fee2e2", "500": "#f4474d", "600": "#dc2626" };
const yellow = { "100": "#FFF6E1", "900": "#FEB701" };
const blue = { "100": "#ebf4fd", "600": "#0891B2", "900": "#0891B2" };
const cyan = { "50": "#ECFEFF", "300": "#67E8F9", "600": "#0891B2", "800": "#155E75" };
const colors = {
primary,
primaryDark,
"primary-rgba": "#0891B2",
secondary,
"secondary-rgba": "#0072e914",
tertiary,
"tertiary-rgba": "#fec94114",
gray,
green,
"green-rgba": "#ecf5ef",
black,
white,
red,
"red-rgba": "#fce6e6",
yellow,
blue,
cyan
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "app",
__ssrInlineRender: true,
setup(__props) {
const config = useConfigStore();
return (_ctx, _push, _parent, _attrs) => {
const _component_AConfigProvider = ConfigProvider;
const _component_NuxtLayout = __nuxt_component_1;
const _component_NuxtPwaManifest = __nuxt_component_2;
const _component_NuxtPage = __nuxt_component_3;
_push(``);
_push(ssrRenderComponent(_component_AConfigProvider, {
direction: "ltr",
theme: {
token: {
colorPrimary: unref(colors).primary,
colorLink: unref(colors).primary,
fontFamily: unref(config).isRTL ? "iran-sans" : "system",
colorLinkActive: unref(colors).primary,
colorLinkHover: unref(colors)["primary-rgba"]
}
}
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(_component_NuxtLayout, { name: "default" }, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(_component_NuxtPwaManifest, null, null, _parent3, _scopeId2));
_push3(ssrRenderComponent(_component_NuxtPage, null, null, _parent3, _scopeId2));
} else {
return [
createVNode(_component_NuxtPwaManifest),
createVNode(_component_NuxtPage)
];
}
}),
_: 1
}, _parent2, _scopeId));
} else {
return [
createVNode(_component_NuxtLayout, { name: "default" }, {
default: withCtx(() => [
createVNode(_component_NuxtPwaManifest),
createVNode(_component_NuxtPage)
]),
_: 1
})
];
}
}),
_: 1
}, _parent));
_push(`
`);
};
}
});
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props2, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("app.vue");
return _sfc_setup$2 ? _sfc_setup$2(props2, ctx) : void 0;
};
const _sfc_main$1 = {
__name: "nuxt-error-page",
__ssrInlineRender: true,
props: {
error: Object
},
setup(__props) {
const props2 = __props;
const _error = props2.error;
_error.stack ? _error.stack.split("\n").splice(1).map((line) => {
const text = line.replace("webpack:/", "").replace(".vue", ".js").trim();
return {
text,
internal: line.includes("node_modules") && !line.includes(".cache") || line.includes("internal") || line.includes("new Promise")
};
}).map((i) => `${i.text}`).join("\n") : "";
const statusCode = Number(_error.statusCode || 500);
const is404 = statusCode === 404;
const statusMessage = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
const description = _error.message || _error.toString();
const stack = void 0;
const _Error404 = defineAsyncComponent(() => import('./error-404-BQ7up_u4.mjs'));
const _Error = defineAsyncComponent(() => import('./error-500-D1hKD9Xd.mjs'));
const ErrorTemplate = is404 ? _Error404 : _Error;
return (_ctx, _push, _parent, _attrs) => {
_push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack) }, _attrs), null, _parent));
};
}
};
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props2, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-error-page.vue");
return _sfc_setup$1 ? _sfc_setup$1(props2, ctx) : void 0;
};
const _sfc_main = {
__name: "nuxt-root",
__ssrInlineRender: true,
setup(__props) {
const IslandRenderer = () => null;
const nuxtApp = useNuxtApp();
nuxtApp.deferHydration();
nuxtApp.ssrContext.url;
const SingleRenderer = false;
provide(PageRouteSymbol, useRoute$1());
nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup");
const error = useError();
const abortRender = error.value && !nuxtApp.ssrContext.error;
onErrorCaptured((err, target, info) => {
nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError));
{
const p = nuxtApp.runWithContext(() => showError(err));
onServerPrefetch(() => p);
return false;
}
});
const islandContext = nuxtApp.ssrContext.islandContext;
return (_ctx, _push, _parent, _attrs) => {
ssrRenderSuspense(_push, {
default: () => {
if (unref(abortRender)) {
_push(``);
} else if (unref(error)) {
_push(ssrRenderComponent(unref(_sfc_main$1), { error: unref(error) }, null, _parent));
} else if (unref(islandContext)) {
_push(ssrRenderComponent(unref(IslandRenderer), { context: unref(islandContext) }, null, _parent));
} else if (unref(SingleRenderer)) {
ssrRenderVNode(_push, createVNode(resolveDynamicComponent(unref(SingleRenderer)), null, null), _parent);
} else {
_push(ssrRenderComponent(unref(_sfc_main$2), null, null, _parent));
}
},
_: 1
});
};
}
};
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props2, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-root.vue");
return _sfc_setup ? _sfc_setup(props2, ctx) : void 0;
};
let entry;
{
entry = async function createNuxtAppServer(ssrContext) {
const vueApp = createApp(_sfc_main);
const nuxt = createNuxtApp({ vueApp, ssrContext });
try {
await applyPlugins(nuxt, plugins);
await nuxt.hooks.callHook("app:created", vueApp);
} catch (error) {
await nuxt.hooks.callHook("app:error", error);
nuxt.payload.error ||= createError(error);
}
if (ssrContext?._renderResponse) {
throw new Error("skipping render");
}
return vueApp;
};
}
const entry$1 = (ssrContext) => entry(ssrContext);
const server = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
__proto__: null,
$: __nuxt_component_0$2,
A: APP_Milady_Date,
B: __nuxt_component_0,
C: useState,
D: getProducts,
E: useRequestEvent,
F: Form,
G: useCartStore,
H: __nuxt_component_1$2,
I: getSupabaseStorageUrl,
J: reactiveProjectName,
K: useElementSize$1,
L: APP_TYPE,
M: Badge,
N: __nuxt_component_1$6,
O: __nuxt_component_0$3,
P: Input,
Q: Button,
R: Radio,
S: Spin,
T: myAxios,
U: unrefElement$1,
V: tryOnUnmounted,
W: isObject$3,
X: useEventListener,
Y: DatePicker$1,
Z: supabaseService,
_: __nuxt_component_1$4,
a: useNuxtApp,
a0: baseConfirm,
a1: deleteProductById,
a2: asyncDataDefaults,
a3: createError,
a4: uploadFile,
a5: updateProduct,
a6: createProduct,
a7: useSwipe,
a8: api,
a9: useRouter,
aA: Tag,
aB: getCustomerList,
aC: baseConfirmWithId,
aD: deleteUser,
aE: getOneProduct,
aF: Select,
aG: SelectOption,
aH: __nuxt_component_2$4,
aI: __nuxt_component_2$3,
aJ: FloatButton,
aK: hotSelect,
aL: fetchChatMessages,
aM: useBreakpoints,
aN: usePriceStore,
aO: useWindowSize,
aP: breakpointsTailwind,
aa: useRoute,
ab: fetchUserChats,
ac: fetchOneChat,
ad: __nuxt_component_0$1,
ae: Modal,
af: getStoreCollections,
ag: checkUsername,
ah: updateUser,
ai: __nuxt_component_0$4,
aj: useRoute$1,
ak: useProduct,
al: __nuxt_component_4,
am: __nuxt_component_1$1,
an: __nuxt_component_2$1,
ao: Tabs,
ap: __nuxt_component_2$2,
aq: getOneUser,
ar: tryOnScopeDispose$1,
as: Menu,
at: __nuxt_component_1$5,
au: __nuxt_component_6,
av: CheckboxGroup,
aw: Checkbox,
ax: watchDebounced,
ay: Collapse,
az: Slider$1,
b: useRuntimeConfig,
c: nuxtLinkDefaults,
d: useHead,
default: entry$1,
e: useConfigStore,
f: appName,
g: useUserStore,
h: setToken,
i: goToProfile,
j: api$1,
k: loading,
l: login,
m: forgetPassword,
n: navigateTo,
o: removeToken,
p: generateOtp,
q: __nuxt_component_1$3,
r: resolveRouteObject,
s: supabase,
t: setPassword,
u: useRouter$1,
v: verifyOtp,
w: setBirthday,
x: setNames,
y: useIntersectionObserver,
z: getToken
}, Symbol.toStringTag, { value: 'Module' }));
export { useSwipe as $, APP_Milady_Date as A, useElementSize$1 as B, getSupabaseStorageUrl as C, reactiveProjectName as D, APP_TYPE as E, Form as F, Badge as G, __nuxt_component_1$6 as H, unrefElement$1 as I, tryOnUnmounted as J, isObject$3 as K, useEventListener as L, __nuxt_component_0$3 as M, Input as N, Button as O, myAxios as P, supabaseService as Q, Radio as R, Spin as S, __nuxt_component_0$2 as T, baseConfirm as U, deleteProductById as V, dayjs as W, uploadFile as X, updateProduct as Y, createProduct as Z, __nuxt_component_1$4 as _, useConfigStore as a, useRouter as a0, useRoute as a1, api as a2, fetchUserChats as a3, fetchOneChat as a4, checkUsername as a5, updateUser as a6, getStoreCollections as a7, __nuxt_component_0$1 as a8, Modal as a9, __nuxt_component_2$3 as aA, FloatButton as aB, hotSelect as aC, fetchChatMessages as aD, useWindowSize as aE, useBreakpoints as aF, useNuxtApp as aG, usePriceStore as aH, useHead as aI, breakpointsTailwind as aJ, resolveRouteObject as aK, useRuntimeConfig as aL, navigateTo as aM, nuxtLinkDefaults as aN, asyncDataDefaults as aO, createError as aP, DatePicker$1 as aQ, server as aR, __nuxt_component_0$4 as aa, useRoute$1 as ab, __nuxt_component_4 as ac, __nuxt_component_1$1 as ad, useProduct as ae, getOneUser as af, __nuxt_component_2$1 as ag, Tabs as ah, __nuxt_component_2$2 as ai, watchDebounced as aj, tryOnScopeDispose$1 as ak, Menu as al, __nuxt_component_1$5 as am, getCustomerList as an, Collapse as ao, Slider$1 as ap, Tag as aq, CheckboxGroup as ar, Checkbox as as, __nuxt_component_6 as at, baseConfirmWithId as au, deleteUser as av, getOneProduct as aw, Select as ax, SelectOption as ay, __nuxt_component_2$4 as az, useUserStore as b, setToken as c, api$1 as d, appName as e, loading as f, goToProfile as g, generateOtp as h, forgetPassword as i, __nuxt_component_1$3 as j, setPassword as k, login as l, setBirthday as m, setNames as n, useIntersectionObserver as o, getToken as p, __nuxt_component_0 as q, removeToken as r, supabase as s, useCartStore as t, useRouter$1 as u, verifyOtp as v, __nuxt_component_1$2 as w, useState as x, useRequestEvent as y, getProducts as z };
//# sourceMappingURL=server.mjs.map