15386 lines
472 KiB
JavaScript
15386 lines
472 KiB
JavaScript
import { inject, ref, h, getCurrentInstance, nextTick, reactive, defineComponent, createVNode, computed, provide, Fragment, isVNode, shallowRef, watch, watchEffect, cloneVNode, createElementBlock, unref, toValue, hasInjectionContext, Comment, Text, Transition, getCurrentScope, onScopeDispose, TransitionGroup, render, toRaw, Teleport, withDirectives, vShow, defineAsyncComponent, shallowReactive, Suspense, useSSRContext, createApp, triggerRef, mergeProps, withCtx, toRef, onErrorCaptured, onServerPrefetch, resolveDynamicComponent, effectScope, isReadonly, isRef, isShallow, isReactive } from 'vue';
|
|
import { k as createError$1, h as hasProtocol, n as isScriptProtocol, j as joinURL, o as withQuery, s as sanitizeStatusCode, q as getContext, $ as $fetch$1, r as baseURL$1, t as createHooks, v as executeAsync, x as toRouteMatcher, y as createRouter$1, d as defu } from '../_/nitro.mjs';
|
|
import { defineStore, createPinia, setActivePinia, shouldHydrate } from 'pinia';
|
|
import { useRoute as useRoute$1, RouterView, createMemoryHistory, createRouter, START_LOCATION } from 'vue-router';
|
|
import { createClient } from '@supabase/supabase-js';
|
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
import _objectSpread$d from '@babel/runtime/helpers/esm/objectSpread2';
|
|
import { generate as generate$1, blue as blue$1 } from '@ant-design/colors';
|
|
import { TinyColor } from '@ctrl/tinycolor';
|
|
import { serialize, compile, stringify } from 'stylis';
|
|
import { createTypes } from 'vue-types';
|
|
import { isEmpty, get, cloneDeep } from 'lodash-es';
|
|
import axios from 'axios';
|
|
import { ExclamationCircleOutlined as ExclamationCircleOutlined$2 } from '@ant-design/icons-vue';
|
|
import VueLazyload from 'vue3-lazyload';
|
|
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 = Symbol('iconContext');
|
|
var useInjectIconContext = function useInjectIconContext() {
|
|
return inject(contextKey, {
|
|
prefixCls: ref('anticon'),
|
|
rootClassName: ref(''),
|
|
csp: ref()
|
|
});
|
|
};
|
|
|
|
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; }
|
|
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$c({
|
|
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$c({
|
|
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$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 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$b({}, twoToneColorPalette);
|
|
}
|
|
|
|
var IconBase = function IconBase(props, context) {
|
|
var _props$context$attrs = _objectSpread$b({}, 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$b({}, target, {
|
|
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
});
|
|
}
|
|
|
|
return generate(target.icon, "svg-".concat(target.name), _objectSpread$b({}, 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$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; }
|
|
|
|
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$a({}, 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$a(_classObj, rootClassName.value, !!rootClassName.value), _defineProperty$a(_classObj, prefixCls.value, true), _defineProperty$a(_classObj, "".concat(prefixCls.value, "-").concat(icon.name), Boolean(icon.name)), _defineProperty$a(_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$a({
|
|
"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$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 CheckCircleOutlined = function CheckCircleOutlined(props, context) {
|
|
var p = _objectSpread$9({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$9({}, 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$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 InfoCircleOutlined = function InfoCircleOutlined(props, context) {
|
|
var p = _objectSpread$8({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$8({}, 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$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 CloseCircleOutlined = function CloseCircleOutlined(props, context) {
|
|
var p = _objectSpread$7({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$7({}, 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$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 ExclamationCircleOutlined = function ExclamationCircleOutlined(props, context) {
|
|
var p = _objectSpread$6({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$6({}, 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$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 CloseOutlined = function CloseOutlined(props, context) {
|
|
var p = _objectSpread$5({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$5({}, 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$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 LoadingOutlined = function LoadingOutlined(props, context) {
|
|
var p = _objectSpread$4({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$4({}, 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$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 ExclamationCircleFilled = function ExclamationCircleFilled(props, context) {
|
|
var p = _objectSpread$3({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$3({}, 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$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 CloseCircleFilled = function CloseCircleFilled(props, context) {
|
|
var p = _objectSpread$2({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$2({}, 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$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 CheckCircleFilled = function CheckCircleFilled(props, context) {
|
|
var p = _objectSpread$1({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread$1({}, 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(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 InfoCircleFilled = function InfoCircleFilled(props, context) {
|
|
var p = _objectSpread({}, props, context.attrs);
|
|
|
|
return createVNode(Icon, _objectSpread({}, 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 = 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;
|
|
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(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(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;
|
|
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(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(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);
|
|
};
|
|
});
|
|
|
|
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 = { "value": null, "errorValue": null, "deep": true };
|
|
const appId = "nuxt-app";
|
|
function getNuxtAppCtx(id = appId) {
|
|
return getContext(id, {
|
|
asyncContext: false
|
|
});
|
|
}
|
|
const NuxtPluginIndicator = "__nuxt_plugin";
|
|
function createNuxtApp(options) {
|
|
var _a;
|
|
let hydratingCount = 0;
|
|
const nuxtApp = {
|
|
_id: options.id || appId || "nuxt-app",
|
|
_scope: effectScope(),
|
|
provide: void 0,
|
|
globalName: "nuxt",
|
|
versions: {
|
|
get nuxt() {
|
|
return "3.17.4";
|
|
},
|
|
get vue() {
|
|
return nuxtApp.vueApp.version;
|
|
}
|
|
},
|
|
payload: shallowReactive({
|
|
...((_a = options.ssrContext) == null ? void 0 : _a.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) {
|
|
var _a, _b, _c, _d;
|
|
const resolvedPlugins = /* @__PURE__ */ new Set();
|
|
const unresolvedPlugins = [];
|
|
const parallels = [];
|
|
const errors = [];
|
|
let promiseDepth = 0;
|
|
async function executePlugin(plugin2) {
|
|
var _a2;
|
|
const unresolvedPluginsForThisPlugin = ((_a2 = plugin2.dependsOn) == null ? void 0 : _a2.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);
|
|
}
|
|
}
|
|
}));
|
|
}
|
|
});
|
|
if (plugin2.parallel) {
|
|
parallels.push(promise.catch((e) => errors.push(e)));
|
|
} else {
|
|
await promise;
|
|
}
|
|
}
|
|
}
|
|
for (const plugin2 of plugins2) {
|
|
if (((_a = nuxtApp.ssrContext) == null ? void 0 : _a.islandContext) && ((_b = plugin2.env) == null ? void 0 : _b.islands) === false) {
|
|
continue;
|
|
}
|
|
registerPluginHooks(nuxtApp, plugin2);
|
|
}
|
|
for (const plugin2 of plugins2) {
|
|
if (((_c = nuxtApp.ssrContext) == null ? void 0 : _c.islandContext) && ((_d = plugin2.env) == null ? void 0 : _d.islands) === false) {
|
|
continue;
|
|
}
|
|
await executePlugin(plugin2);
|
|
}
|
|
await Promise.all(parallels);
|
|
if (promiseDepth) {
|
|
for (let i = 0; i < promiseDepth; i++) {
|
|
await Promise.all(parallels);
|
|
}
|
|
}
|
|
if (errors.length) {
|
|
throw errors[0];
|
|
}
|
|
}
|
|
// @__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) {
|
|
var _a;
|
|
let nuxtAppInstance;
|
|
if (hasInjectionContext()) {
|
|
nuxtAppInstance = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app.$nuxt;
|
|
}
|
|
nuxtAppInstance || (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 = () => {
|
|
var _a;
|
|
return (_a = useNuxtApp()) == null ? void 0 : _a.$router;
|
|
};
|
|
const useRoute = () => {
|
|
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 || (to = "/");
|
|
const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href;
|
|
const isExternalHost = hasProtocol(toPath, { acceptRelative: true });
|
|
const isExternal = (options == null ? void 0 : options.external) || isExternalHost;
|
|
if (isExternal) {
|
|
if (!(options == null ? void 0 : 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();
|
|
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 == null ? void 0 : options.redirectCode) || 302, 302),
|
|
body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
|
|
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 == null ? void 0 : 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 == null ? void 0 : 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 || (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) {
|
|
var _a;
|
|
const nuxt = nuxtApp || tryUseNuxtApp();
|
|
return ((_a = nuxt == null ? void 0 : nuxt.ssrContext) == null ? void 0 : _a.head) || (nuxt == null ? void 0 : nuxt.runWithContext(() => {
|
|
if (hasInjectionContext()) {
|
|
return inject(headSymbol);
|
|
}
|
|
}));
|
|
}
|
|
function useHead(input, options = {}) {
|
|
const head = injectHead(options.nuxt);
|
|
if (head) {
|
|
return useHead$1(input, { head, ...options });
|
|
}
|
|
}
|
|
async function getRouteRules(arg) {
|
|
const path = typeof arg === "string" ? arg : arg.path;
|
|
{
|
|
useNuxtApp().ssrContext._preloadManifest = true;
|
|
const _routeRulesMatcher = toRouteMatcher(
|
|
createRouter$1({ routes: (/* @__PURE__ */ useRuntimeConfig()).nitro.routeRules })
|
|
);
|
|
return defu({}, ..._routeRulesMatcher.matchAll(path).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 toArray$1(value) {
|
|
return Array.isArray(value) ? value : [value];
|
|
}
|
|
const __nuxt_page_meta$G = {
|
|
name: "auth",
|
|
redirect: { name: "auth-login" },
|
|
showMobileNavigationMenu: false
|
|
};
|
|
const __nuxt_page_meta$F = {
|
|
redirect: { name: "home" }
|
|
// layout: 'default'
|
|
};
|
|
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$G || {},
|
|
redirect: { "name": "auth-login" },
|
|
component: () => import('./auth-Cskx4MdT.mjs'),
|
|
children: [
|
|
{
|
|
name: "auth-login",
|
|
path: "login",
|
|
component: () => import('./index-CFu5GzAc.mjs')
|
|
},
|
|
{
|
|
name: "auth-forget",
|
|
path: "forget",
|
|
component: () => import('./index-IH4HJ8hC.mjs')
|
|
},
|
|
{
|
|
name: "auth-register",
|
|
path: "register",
|
|
component: () => import('./index-DaehYRYI.mjs')
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: "index",
|
|
path: "/",
|
|
meta: __nuxt_page_meta$F || {},
|
|
redirect: { "name": "home" },
|
|
component: () => import('./index-tiwnnOo4.mjs')
|
|
},
|
|
{
|
|
name: void 0 ,
|
|
path: "/posts",
|
|
component: () => import('./posts--tn1gQJC.mjs'),
|
|
children: [
|
|
{
|
|
name: "posts",
|
|
path: "",
|
|
component: () => import('./index-BjOkSfAb.mjs')
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: "user-add",
|
|
path: "/user/add",
|
|
meta: __nuxt_page_meta$D || {},
|
|
component: () => import('./add-BXfqa3c6.mjs')
|
|
},
|
|
{
|
|
name: "add",
|
|
path: "/add",
|
|
meta: __nuxt_page_meta$C || {},
|
|
component: () => import('./index-B_ddH6eq.mjs')
|
|
},
|
|
{
|
|
name: "cart-id",
|
|
path: "/cart/:id()",
|
|
meta: __nuxt_page_meta$B || {},
|
|
component: () => import('./_id_-CclpLXp-.mjs')
|
|
},
|
|
{
|
|
name: "fav",
|
|
path: "/fav",
|
|
meta: __nuxt_page_meta$A || {},
|
|
component: () => import('./index-Ce6bmViB.mjs')
|
|
},
|
|
{
|
|
name: "cart",
|
|
path: "/cart",
|
|
meta: __nuxt_page_meta$z || {},
|
|
component: () => import('./index-tonM27ll.mjs')
|
|
},
|
|
{
|
|
name: "edit",
|
|
path: "/edit",
|
|
meta: __nuxt_page_meta$y || {},
|
|
component: () => import('./index-C_uc_54j.mjs')
|
|
},
|
|
{
|
|
name: "home",
|
|
path: "/home",
|
|
component: () => import('./index-CsvEUoLt.mjs')
|
|
},
|
|
{
|
|
name: "user",
|
|
path: "/user",
|
|
component: () => import('./index-ZYGB3Ms9.mjs')
|
|
},
|
|
{
|
|
name: "saved-posts",
|
|
path: "/saved/posts",
|
|
meta: __nuxt_page_meta$x || {},
|
|
component: () => import('./posts-C0WilxUW.mjs')
|
|
},
|
|
{
|
|
name: "user-brands",
|
|
path: "/user/brands",
|
|
meta: __nuxt_page_meta$w || {},
|
|
component: () => import('./brands-DAiHlXpS.mjs')
|
|
},
|
|
{
|
|
name: "message-list",
|
|
path: "/message/list",
|
|
component: () => import('./list-DKLLNvpb.mjs')
|
|
},
|
|
{
|
|
name: "search",
|
|
path: "/search",
|
|
component: () => import('./index-CsJZDvEB.mjs')
|
|
},
|
|
{
|
|
name: "user-address",
|
|
path: "/user/address",
|
|
meta: __nuxt_page_meta$v || {},
|
|
component: () => import('./address-D_FJi9XZ.mjs')
|
|
},
|
|
{
|
|
name: "user-message",
|
|
path: "/user/message",
|
|
meta: __nuxt_page_meta$u || {},
|
|
component: () => import('./message-CCzMcQtu.mjs')
|
|
},
|
|
{
|
|
name: "user-profile",
|
|
path: "/user/profile",
|
|
meta: __nuxt_page_meta$t || {},
|
|
component: () => import('./profile-CUasYBtk.mjs')
|
|
},
|
|
{
|
|
name: "user-setting",
|
|
path: "/user/setting",
|
|
meta: __nuxt_page_meta$s || {},
|
|
component: () => import('./setting-Cei9KDXv.mjs')
|
|
},
|
|
{
|
|
name: "message",
|
|
path: "/message",
|
|
meta: __nuxt_page_meta$r || {},
|
|
component: () => import('./index-CDNx798N.mjs')
|
|
},
|
|
{
|
|
name: "user-managers",
|
|
path: "/user/managers",
|
|
meta: __nuxt_page_meta$q || {},
|
|
component: () => import('./managers-13LAiY0Q.mjs')
|
|
},
|
|
{
|
|
name: "user-edit-id",
|
|
path: "/user/edit/:id()",
|
|
component: () => import('./_id_-BH_ign-O.mjs')
|
|
},
|
|
{
|
|
name: "add-story",
|
|
path: "/add/story",
|
|
meta: __nuxt_page_meta$p || {},
|
|
redirect: { "name": "add-story-inputStory" },
|
|
component: () => import('./index-D_3vtC3O.mjs')
|
|
},
|
|
{
|
|
name: "user-attributes",
|
|
path: "/user/attributes",
|
|
meta: __nuxt_page_meta$o || {},
|
|
component: () => import('./attributes-CGHFag1k.mjs')
|
|
},
|
|
{
|
|
name: "user-categories",
|
|
path: "/user/categories",
|
|
meta: __nuxt_page_meta$n || {},
|
|
component: () => import('./categories-BapVRkON.mjs')
|
|
},
|
|
{
|
|
name: "user-edit",
|
|
path: "/user/edit",
|
|
component: () => import('./index-BldrjvTF.mjs')
|
|
},
|
|
{
|
|
name: "user-order-id",
|
|
path: "/user/order/:id()",
|
|
component: () => import('./_id_-C84AxPNF.mjs')
|
|
},
|
|
{
|
|
name: "highlight-create",
|
|
path: "/highlight/create",
|
|
meta: __nuxt_page_meta$m || {},
|
|
component: () => import('./create-BTsz38z1.mjs')
|
|
},
|
|
{
|
|
name: "user_detail-id",
|
|
path: "/user_detail/:id()",
|
|
component: () => import('./_id_-DpmJX7Sx.mjs')
|
|
},
|
|
{
|
|
name: "add-product",
|
|
path: "/add/product",
|
|
meta: __nuxt_page_meta$l || {},
|
|
redirect: { "name": "add-product-inputProduct" },
|
|
component: () => import('./index-B_yfh8ap.mjs')
|
|
},
|
|
{
|
|
name: "search-main",
|
|
path: "/search/main",
|
|
component: () => import('./index-DJGPmxdU.mjs')
|
|
},
|
|
{
|
|
name: "add-story-infStory",
|
|
path: "/add/story/infStory",
|
|
meta: __nuxt_page_meta$k || {},
|
|
component: () => import('./infStory-BMy0wXAf.mjs')
|
|
},
|
|
{
|
|
name: "user-store_request",
|
|
path: "/user/store_request",
|
|
meta: __nuxt_page_meta$j || {},
|
|
component: () => import('./store_request-3Fi4sbZa.mjs')
|
|
},
|
|
{
|
|
name: "highlight-edit-id",
|
|
path: "/highlight/edit/:id()",
|
|
meta: __nuxt_page_meta$i || {},
|
|
component: () => import('./_id_-DzdCcHrl.mjs')
|
|
},
|
|
{
|
|
name: "product_detail-id",
|
|
path: "/product_detail/:id()",
|
|
component: () => import('./_id_-B9OXtrWF.mjs')
|
|
},
|
|
{
|
|
name: "add-story-inputStory",
|
|
path: "/add/story/inputStory",
|
|
meta: __nuxt_page_meta$h || {},
|
|
component: () => import('./inputStory-DdM8Ppg7.mjs')
|
|
},
|
|
{
|
|
name: "user-statistics_list",
|
|
path: "/user/statistics_list",
|
|
meta: __nuxt_page_meta$c || {},
|
|
component: () => import('./statistics_list-C-lUdB5A.mjs'),
|
|
children: [
|
|
{
|
|
name: "user-statistics_list-saved",
|
|
path: "saved",
|
|
meta: __nuxt_page_meta$g || {},
|
|
component: () => import('./saved-LLumwai8.mjs')
|
|
},
|
|
{
|
|
name: "user-statistics_list-orders",
|
|
path: "orders",
|
|
meta: __nuxt_page_meta$f || {},
|
|
component: () => import('./orders-BebMARgj.mjs')
|
|
},
|
|
{
|
|
name: "user-statistics_list-customers",
|
|
path: "customers",
|
|
meta: __nuxt_page_meta$e || {},
|
|
component: () => import('./customers-Clfje2zJ.mjs')
|
|
},
|
|
{
|
|
name: "user-statistics_list-storeOrders",
|
|
path: "storeOrders",
|
|
meta: __nuxt_page_meta$d || {},
|
|
component: () => import('./storeOrders-CaaHoiGa.mjs')
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: "edit-story-id",
|
|
path: "/edit/story/:id()",
|
|
meta: __nuxt_page_meta$b || {},
|
|
component: () => import('./index-apSCvb8x.mjs')
|
|
},
|
|
{
|
|
name: "add-product-infProduct",
|
|
path: "/add/product/infProduct",
|
|
meta: __nuxt_page_meta$a || {},
|
|
component: () => import('./infProduct-BCBhK5w8.mjs')
|
|
},
|
|
{
|
|
name: "message-detail_message",
|
|
path: "/message/detail_message",
|
|
meta: __nuxt_page_meta$9 || {},
|
|
component: () => import('./detail_message-B39cxarX.mjs')
|
|
},
|
|
{
|
|
name: "add-product-excel",
|
|
path: "/add/product/excel",
|
|
meta: __nuxt_page_meta$8 || {},
|
|
redirect: { "name": "add-product-excel-inputProduct" },
|
|
component: () => import('./index-D5zp0IjH.mjs')
|
|
},
|
|
{
|
|
name: "edit-product-id",
|
|
path: "/edit/product/:id()",
|
|
meta: __nuxt_page_meta$7 || {},
|
|
component: () => import('./index-BKjJYiJE.mjs')
|
|
},
|
|
{
|
|
name: "add-product-inputProduct",
|
|
path: "/add/product/inputProduct",
|
|
meta: __nuxt_page_meta$6 || {},
|
|
component: () => import('./inputProduct-DDCUINwl.mjs')
|
|
},
|
|
{
|
|
name: "edit-story-id-infStory",
|
|
path: "/edit/story/:id()/infStory",
|
|
meta: __nuxt_page_meta$5 || {},
|
|
component: () => import('./infStory-DXDS9knF.mjs')
|
|
},
|
|
{
|
|
name: "edit-story-id-inputStory",
|
|
path: "/edit/story/:id()/inputStory",
|
|
meta: __nuxt_page_meta$4 || {},
|
|
component: () => import('./inputStory-Bfbea1VP.mjs')
|
|
},
|
|
{
|
|
name: "edit-product-id-infProduct",
|
|
path: "/edit/product/:id()/infProduct",
|
|
meta: __nuxt_page_meta$3 || {},
|
|
component: () => import('./infProduct-Bappj5wt.mjs')
|
|
},
|
|
{
|
|
name: "edit-product-id-inputProduct",
|
|
path: "/edit/product/:id()/inputProduct",
|
|
meta: __nuxt_page_meta$2 || {},
|
|
component: () => import('./inputProduct-BM309r3Z.mjs')
|
|
},
|
|
{
|
|
name: "add-product-excel-infProductExcel",
|
|
path: "/add/product/excel/infProductExcel",
|
|
meta: __nuxt_page_meta$1 || {},
|
|
component: () => import('./infProductExcel-CcpiUkSv.mjs')
|
|
},
|
|
{
|
|
name: "add-product-excel-inputProductExcel",
|
|
path: "/add/product/excel/inputProductExcel",
|
|
meta: __nuxt_page_meta || {},
|
|
component: () => import('./inputProductExcel-CVML9lzA.mjs')
|
|
}
|
|
];
|
|
const _wrapInTransition = (props, children) => {
|
|
return { default: () => {
|
|
var _a;
|
|
return (_a = children.default) == null ? void 0 : _a.call(children);
|
|
} };
|
|
};
|
|
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 == null ? void 0 : route.meta.key) ?? route.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r) => {
|
|
var _a;
|
|
return ((_a = route.params[r.slice(1)]) == null ? void 0 : _a.toString()) || "";
|
|
});
|
|
return typeof source === "function" ? source(route) : source;
|
|
}
|
|
function isChangingPage(to, from) {
|
|
if (to === from || from === START_LOCATION) {
|
|
return false;
|
|
}
|
|
if (generateRouteKey(to) !== generateRouteKey(from)) {
|
|
return true;
|
|
}
|
|
const areComponentsSame = to.matched.every(
|
|
(comp, index) => {
|
|
var _a, _b;
|
|
return comp.components && comp.components.default === ((_b = (_a = from.matched[index]) == null ? void 0 : _a.components) == null ? void 0 : _b.default);
|
|
}
|
|
);
|
|
if (areComponentsSame) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
const routerOptions0 = {
|
|
scrollBehavior(to, from, savedPosition) {
|
|
var _a;
|
|
const nuxtApp = useNuxtApp();
|
|
const behavior = ((_a = useRouter().options) == null ? void 0 : _a.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 };
|
|
}
|
|
return false;
|
|
}
|
|
const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from) : to.meta.scrollToTop;
|
|
if (routeAllowsScrollToTop === false) {
|
|
return false;
|
|
}
|
|
let position = savedPosition || void 0;
|
|
if (!position && isChangingPage(to, from)) {
|
|
position = { left: 0, top: 0 };
|
|
}
|
|
const hookToWait = nuxtApp._runningTransition ? "page:transition:finish" : "page:loading:end";
|
|
return new Promise((resolve) => {
|
|
if (from === START_LOCATION) {
|
|
resolve(_calculatePosition(to, "instant", position));
|
|
return;
|
|
}
|
|
nuxtApp.hooks.hookOnce(hookToWait, () => {
|
|
requestAnimationFrame(() => resolve(_calculatePosition(to, "instant", position)));
|
|
});
|
|
});
|
|
}
|
|
};
|
|
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, scrollBehaviorType, position) {
|
|
if (position) {
|
|
return position;
|
|
}
|
|
if (to.hash) {
|
|
return {
|
|
el: to.hash,
|
|
top: _getHashElementScrollMarginTop(to.hash),
|
|
behavior: scrollBehaviorType
|
|
};
|
|
}
|
|
return { left: 0, top: 0, behavior: scrollBehaviorType };
|
|
}
|
|
const configRouterOptions = {
|
|
hashMode: false,
|
|
scrollBehaviorType: "auto"
|
|
};
|
|
const routerOptions = {
|
|
...configRouterOptions,
|
|
...routerOptions0
|
|
};
|
|
const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to, from) => {
|
|
var _a;
|
|
let __temp, __restore;
|
|
if (!((_a = to.meta) == null ? void 0 : _a.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(fn) {
|
|
if (getCurrentScope()) {
|
|
onScopeDispose(fn);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
const injectLocal = (...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 = Object.prototype.toString;
|
|
const isObject$1 = (val) => toString.call(val) === "[object Object]";
|
|
const noop$2 = () => {
|
|
};
|
|
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$2;
|
|
const _clearTimeout = (timer2) => {
|
|
clearTimeout(timer2);
|
|
lastRejector();
|
|
lastRejector = noop$2;
|
|
};
|
|
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 = null;
|
|
}
|
|
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 = null;
|
|
resolve(lastInvoker());
|
|
}, maxDuration);
|
|
}
|
|
timer = setTimeout(() => {
|
|
if (maxTimer)
|
|
_clearTimeout(maxTimer);
|
|
maxTimer = null;
|
|
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(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(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 = 0,
|
|
maxWait = void 0,
|
|
...watchOptions
|
|
} = options;
|
|
return watchWithFilter(
|
|
source,
|
|
cb,
|
|
{
|
|
...watchOptions,
|
|
eventFilter: debounceFilter(debounce, { maxWait })
|
|
}
|
|
);
|
|
}
|
|
function watchImmediate(source, cb, options) {
|
|
return watch(
|
|
source,
|
|
cb,
|
|
{
|
|
...options,
|
|
immediate: true
|
|
}
|
|
);
|
|
}
|
|
const defaultWindow = void 0;
|
|
function unrefElement(elRef) {
|
|
var _a;
|
|
const plain = toValue(elRef);
|
|
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
}
|
|
function useEventListener(...args) {
|
|
const cleanups = [];
|
|
const cleanup = () => {
|
|
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(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(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
|
|
toArray(toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
toArray(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]) => {
|
|
cleanup();
|
|
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$1(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();
|
|
cleanup();
|
|
};
|
|
tryOnScopeDispose(cleanup);
|
|
return stop;
|
|
}
|
|
function useMounted() {
|
|
const isMounted = shallowRef(false);
|
|
getCurrentInstance();
|
|
return isMounted;
|
|
}
|
|
function useSupported(callback) {
|
|
const isMounted = useMounted();
|
|
return computed(() => {
|
|
isMounted.value;
|
|
return Boolean(callback());
|
|
});
|
|
}
|
|
const ssrWidthSymbol = Symbol("vueuse-ssr-width");
|
|
function useSSRWidth() {
|
|
const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;
|
|
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
}
|
|
function useMediaQuery(query, options = {}) {
|
|
const { window: window2 = defaultWindow, ssrWidth = useSSRWidth() } = options;
|
|
const isSupported = useSupported(() => window2 && "matchMedia" in window2 && typeof window2.matchMedia === "function");
|
|
const ssrSupport = shallowRef(typeof ssrWidth === "number");
|
|
const mediaQuery = shallowRef();
|
|
const matches = shallowRef(false);
|
|
const handler = (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", handler, { passive: true });
|
|
return computed(() => matches.value);
|
|
}
|
|
const breakpointsTailwind = {
|
|
"sm": 640,
|
|
"md": 768,
|
|
"lg": 1024,
|
|
"xl": 1280,
|
|
"2xl": 1536
|
|
};
|
|
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, strategy = "min-width", ssrWidth = useSSRWidth() } = options;
|
|
const ssrSupport = typeof ssrWidth === "number";
|
|
const mounted = ssrSupport ? shallowRef(false) : { value: true };
|
|
if (ssrSupport) {
|
|
tryOnMounted(() => 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));
|
|
}
|
|
});
|
|
}
|
|
function usePreferredDark(options) {
|
|
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
}
|
|
function useResizeObserver(target, callback, options = {}) {
|
|
const { window: window2 = defaultWindow, ...observerOptions } = options;
|
|
let observer;
|
|
const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
|
|
const cleanup = () => {
|
|
if (observer) {
|
|
observer.disconnect();
|
|
observer = void 0;
|
|
}
|
|
};
|
|
const targets = computed(() => {
|
|
const _targets = toValue(target);
|
|
return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
|
|
});
|
|
const stopWatch = watch(
|
|
targets,
|
|
(els) => {
|
|
cleanup();
|
|
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 = () => {
|
|
cleanup();
|
|
stopWatch();
|
|
};
|
|
tryOnScopeDispose(stop);
|
|
return {
|
|
isSupported,
|
|
stop
|
|
};
|
|
}
|
|
function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
|
|
const { window: window2 = defaultWindow, box: box2 = "content-box" } = options;
|
|
const isSVG = computed(() => {
|
|
var _a, _b;
|
|
return (_b = (_a = unrefElement(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(
|
|
target,
|
|
([entry2]) => {
|
|
const boxSize = box2 === "border-box" ? entry2.borderBoxSize : box2 === "content-box" ? entry2.contentBoxSize : entry2.devicePixelContentBoxSize;
|
|
if (window2 && isSVG.value) {
|
|
const $elem = unrefElement(target);
|
|
if ($elem) {
|
|
const rect = $elem.getBoundingClientRect();
|
|
width.value = rect.width;
|
|
height.value = rect.height;
|
|
}
|
|
} else {
|
|
if (boxSize) {
|
|
const formatBoxSize = toArray(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(() => {
|
|
const ele = unrefElement(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(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,
|
|
immediate = true
|
|
} = options;
|
|
const isSupported = useSupported(() => window2 && "IntersectionObserver" in window2);
|
|
const targets = computed(() => {
|
|
const _target = toValue(target);
|
|
return toArray(_target).map(unrefElement).filter(notNullish);
|
|
});
|
|
let cleanup = noop$2;
|
|
const isActive = shallowRef(immediate);
|
|
const stopWatch = isSupported.value ? watch(
|
|
() => [targets.value, unrefElement(root), isActive.value],
|
|
([targets2, root2]) => {
|
|
cleanup();
|
|
if (!isActive.value)
|
|
return;
|
|
if (!targets2.length)
|
|
return;
|
|
const observer = new IntersectionObserver(
|
|
callback,
|
|
{
|
|
root: unrefElement(root2),
|
|
rootMargin,
|
|
threshold
|
|
}
|
|
);
|
|
targets2.forEach((el) => el && observer.observe(el));
|
|
cleanup = () => {
|
|
observer.disconnect();
|
|
cleanup = noop$2;
|
|
};
|
|
},
|
|
{ immediate, flush: "post" }
|
|
) : noop$2;
|
|
const stop = () => {
|
|
cleanup();
|
|
stopWatch();
|
|
isActive.value = false;
|
|
};
|
|
tryOnScopeDispose(stop);
|
|
return {
|
|
isSupported,
|
|
isActive,
|
|
pause() {
|
|
cleanup();
|
|
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
|
|
};
|
|
}
|
|
function useWindowSize(options = {}) {
|
|
const {
|
|
window: window2 = defaultWindow,
|
|
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(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: "Newinsta"
|
|
});
|
|
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 "liman";
|
|
}
|
|
};
|
|
const projectName = () => {
|
|
const domain = () => {
|
|
if (process) return process.env.VITE_DOMAIN;
|
|
else return "notLoad";
|
|
};
|
|
switch (domain) {
|
|
case "https://app.newinsta.ir/":
|
|
appName.value.en = "Newinsta";
|
|
appName.value.fa = "نیواینستا";
|
|
return "Newinsta";
|
|
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 = (val) => typeof val === "string";
|
|
const isObject = (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, props, 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(props, key2) && !hasDefault) {
|
|
value = false;
|
|
} else if (value === "") {
|
|
value = true;
|
|
}
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
function getDataAndAriaProps(props) {
|
|
return Object.keys(props).reduce((memo, key2) => {
|
|
if (key2.startsWith("data-") || key2.startsWith("aria-")) {
|
|
memo[key2] = props[key2];
|
|
}
|
|
return memo;
|
|
}, {});
|
|
}
|
|
function toPx(val) {
|
|
if (typeof val === "number") return `${val}px`;
|
|
return val;
|
|
}
|
|
function renderHelper(v) {
|
|
let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
let defaultV = arguments.length > 2 ? arguments[2] : void 0;
|
|
if (typeof v === "function") {
|
|
return v(props);
|
|
}
|
|
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(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(value)) {
|
|
for (const name in value) {
|
|
if (value[name]) {
|
|
classes.push(name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return classes.join(" ");
|
|
}
|
|
const isValid = (value) => {
|
|
return value !== void 0 && value !== null && value !== "";
|
|
};
|
|
const initDefaultProps = (types, defaultProps) => {
|
|
const propTypes = _extends({}, types);
|
|
Object.keys(defaultProps).forEach((k) => {
|
|
const prop = propTypes[k];
|
|
if (prop) {
|
|
if (prop.type || prop.default) {
|
|
prop.default = defaultProps[k];
|
|
} else if (prop.def) {
|
|
prop.def(defaultProps[k]);
|
|
} else {
|
|
propTypes[k] = {
|
|
type: prop,
|
|
default: defaultProps[k]
|
|
};
|
|
}
|
|
} else {
|
|
throw new Error(`not have ${k} prop`);
|
|
}
|
|
});
|
|
return propTypes;
|
|
};
|
|
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(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 props = instance.$.vnode.props || {};
|
|
Object.keys(instance.$props).forEach((k) => {
|
|
const v = instance.$props[k];
|
|
const hyphenateKey = hyphenate(k);
|
|
if (v !== void 0 || hyphenateKey in props) {
|
|
res[k] = v;
|
|
}
|
|
});
|
|
} else if (isVNode(instance) && typeof instance.type === "object") {
|
|
const originProps = instance.props || {};
|
|
const props = {};
|
|
Object.keys(originProps).forEach((key2) => {
|
|
props[camelize(key2)] = originProps[key2];
|
|
});
|
|
const options = instance.type.props || {};
|
|
Object.keys(options).forEach((k) => {
|
|
const v = resolvePropValue(options, props, k, props[k]);
|
|
if (v !== void 0 || k in props) {
|
|
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 props = {};
|
|
if (ele.$) {
|
|
props = _extends(_extends({}, props), ele.$attrs);
|
|
} else {
|
|
props = _extends(_extends({}, props), ele.props);
|
|
}
|
|
return splitAttrs(props)[on ? "onEvents" : "events"];
|
|
}
|
|
function getStyle$1(ele, camel) {
|
|
const props = (isVNode(ele) ? ele.props : ele.$attrs) || {};
|
|
let style = props.style || {};
|
|
if (typeof style === "string") {
|
|
style = parseStyleText(style, camel);
|
|
}
|
|
return style;
|
|
}
|
|
function isFragment(c) {
|
|
return c.length === 1 && c[0].type === Fragment;
|
|
}
|
|
function isEmptyElement(c) {
|
|
return c && (c.type === Comment || c.type === Fragment && c.children.length === 0 || c.type === Text && c.children.trim() === "");
|
|
}
|
|
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, props) {
|
|
let prop = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "default";
|
|
var _a, _b;
|
|
return (_a = props[prop]) !== null && _a !== void 0 ? _a : (_b = slots[prop]) === null || _b === void 0 ? void 0 : _b.call(slots);
|
|
}
|
|
const tuple = function() {
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
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 required ? type : 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);
|
|
}
|
|
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 = (props) => {
|
|
return provide(configProviderKey, props);
|
|
};
|
|
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 = "${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,
|
|
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: "${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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
const localeData = inject("localeData", {});
|
|
const locale2 = computed(() => {
|
|
const {
|
|
componentName = "global",
|
|
defaultLocale
|
|
} = props;
|
|
const locale3 = defaultLocale || localeValues[componentName || "global"];
|
|
const {
|
|
antLocale
|
|
} = localeData;
|
|
const localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
|
|
return _extends(_extends({}, typeof locale3 === "function" ? locale3() : locale3), localeFromContext || {});
|
|
});
|
|
const localeCode = computed(() => {
|
|
const {
|
|
antLocale
|
|
} = localeData;
|
|
const localeCode2 = antLocale && antLocale.locale;
|
|
if (antLocale && antLocale.exist && !localeCode2) {
|
|
return localeValues.locale;
|
|
}
|
|
return localeCode2;
|
|
});
|
|
return () => {
|
|
const children = props.children || slots.default;
|
|
const {
|
|
antLocale
|
|
} = localeData;
|
|
return children === null || children === void 0 ? void 0 : children(locale2.value, localeCode.value, antLocale);
|
|
};
|
|
}
|
|
});
|
|
function useLocaleReceiver(componentName, defaultLocale, propsLocale) {
|
|
const localeData = inject("localeData", {});
|
|
const componentLocale = computed(() => {
|
|
const {
|
|
antLocale
|
|
} = localeData;
|
|
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 path = Array.isArray(keys) ? keys.join(SPLIT) : keys;
|
|
const prevValue = this.cache.get(path);
|
|
const nextValue = valueFn(prevValue);
|
|
if (nextValue === null) {
|
|
this.cache.delete(path);
|
|
} else {
|
|
this.cache.set(path, 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 = (props) => {
|
|
const parentContext = useStyleInject();
|
|
const context = shallowRef(_extends(_extends({}, defaultStyleContext), {
|
|
cache: createCache()
|
|
}));
|
|
watch([() => unref(props), parentContext], () => {
|
|
const mergedContext = _extends({}, parentContext.value);
|
|
const propsValue = unref(props);
|
|
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;
|
|
context.value = mergedContext;
|
|
}, {
|
|
immediate: true
|
|
});
|
|
provide(StyleContextKey, context);
|
|
return context;
|
|
};
|
|
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 <style /> 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 `<style />` 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()
|
|
});
|
|
withInstall(defineComponent({
|
|
name: "AStyleProvider",
|
|
inheritAttrs: false,
|
|
props: styleProviderProps(),
|
|
setup(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
useStyleProvider(props);
|
|
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, index) => {
|
|
if (index === 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$1() {
|
|
}
|
|
let warning = noop$1;
|
|
let uuid$2 = 0;
|
|
class Theme {
|
|
constructor(derivatives) {
|
|
this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
|
|
this.id = uuid$2;
|
|
if (derivatives.length === 0) {
|
|
warning(derivatives.length > 0);
|
|
}
|
|
uuid$2 += 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, format) => {
|
|
const derivativeToken = theme.getDerivativeToken(originToken);
|
|
let mergedDerivativeToken = _extends(_extends({}, derivativeToken), overrideToken);
|
|
if (format) {
|
|
mergedDerivativeToken = format(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(path) {
|
|
prepare();
|
|
return !!cachePathMap[path];
|
|
}
|
|
function getStyleAndHash(path) {
|
|
const hash2 = cachePathMap[path];
|
|
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,
|
|
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 formatValue = cssValue;
|
|
if (!unitlessKeys[cssKey] && typeof formatValue === "number" && formatValue !== 0) {
|
|
formatValue = `${formatValue}px`;
|
|
}
|
|
if (cssKey === "animationName" && (cssValue === null || cssValue === void 0 ? void 0 : cssValue._keyframe)) {
|
|
parseKeyframes(cssValue);
|
|
formatValue = cssValue.getName(hashId);
|
|
}
|
|
styleStr += `${styleName}:${formatValue};`;
|
|
};
|
|
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(path, styleStr) {
|
|
return murmur2(`${path.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,
|
|
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: path.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 version = "4.2.6";
|
|
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((_, index) => {
|
|
const i = index - 1;
|
|
const baseSize = base * Math.pow(2.71828, i / 5);
|
|
const intSize = index > 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$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;
|
|
};
|
|
function formatToken(derivativeToken) {
|
|
const {
|
|
override
|
|
} = derivativeToken, restToken = __rest$7(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 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() {
|
|
}
|
|
function statisticToken(token) {
|
|
let tokenKeys2;
|
|
let proxy = token;
|
|
let flush = noop;
|
|
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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
useDesignTokenProvider(computed(() => props.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$7 = 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$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 emptyProps = () => ({
|
|
prefixCls: String,
|
|
imageStyle: objectType(),
|
|
image: anyType(),
|
|
description: anyType()
|
|
});
|
|
const Empty = defineComponent({
|
|
name: "AEmpty",
|
|
compatConfig: {
|
|
MODE: 3
|
|
},
|
|
inheritAttrs: false,
|
|
props: emptyProps(),
|
|
setup(props, _ref) {
|
|
let {
|
|
slots = {},
|
|
attrs
|
|
} = _ref;
|
|
const {
|
|
direction,
|
|
prefixCls: prefixClsRef
|
|
} = useConfigInject("empty", props);
|
|
const [wrapSSR, hashId] = useStyle$7(prefixClsRef);
|
|
return () => {
|
|
var _a, _b;
|
|
const prefixCls = prefixClsRef.value;
|
|
const _c = _extends(_extends({}, props), 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$6(_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$d({
|
|
"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 = (props) => {
|
|
const {
|
|
prefixCls
|
|
} = useConfigInject("empty", props);
|
|
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(props.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, props) => {
|
|
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, props.prefixCls));
|
|
const direction = computed(() => {
|
|
var _a, _b;
|
|
return (_a = props.direction) !== null && _a !== void 0 ? _a : (_b = configProvider.direction) === null || _b === void 0 ? void 0 : _b.value;
|
|
});
|
|
const iconPrefixCls = computed(() => {
|
|
var _a;
|
|
return (_a = props.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 = props.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 = props.getContainer) !== null && _a !== void 0 ? _a : props.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 = props.dropdownMatchSelectWidth) !== null && _a !== void 0 ? _a : (_b = configProvider.dropdownMatchSelectWidth) === null || _b === void 0 ? void 0 : _b.value;
|
|
});
|
|
const virtual = computed(() => {
|
|
var _a;
|
|
return (props.virtual === void 0 ? ((_a = configProvider.virtual) === null || _a === void 0 ? void 0 : _a.value) !== false : props.virtual !== false) && dropdownMatchSelectWidth.value !== false;
|
|
});
|
|
const size = computed(() => props.size || sizeContext.value);
|
|
const autocomplete = computed(() => {
|
|
var _a, _b, _c;
|
|
return (_a = props.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 = props.disabled) !== null && _a !== void 0 ? _a : disabledContext.value;
|
|
});
|
|
const csp = computed(() => {
|
|
var _a;
|
|
return (_a = props.csp) !== null && _a !== void 0 ? _a : configProvider.csp;
|
|
});
|
|
const wave = computed(() => {
|
|
var _a, _b;
|
|
return (_a = props.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 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 getMotion$1(_ref) {
|
|
let {
|
|
prefixCls,
|
|
animation,
|
|
transitionName: transitionName2
|
|
} = _ref;
|
|
if (animation) {
|
|
return {
|
|
name: `${prefixCls}-${animation}`
|
|
};
|
|
}
|
|
if (transitionName2) {
|
|
return {
|
|
name: transitionName2
|
|
};
|
|
}
|
|
return {};
|
|
}
|
|
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 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) return false;
|
|
if (child.type === Fragment && !ensureValidVNode(child.children)) return false;
|
|
return true;
|
|
}) ? slot : null;
|
|
};
|
|
function customRenderSlot(slots, name, props, fallback) {
|
|
var _a;
|
|
const slot = (_a = slots[name]) === null || _a === void 0 ? void 0 : _a.call(slots, props);
|
|
if (ensureValidVNode(slot)) {
|
|
return slot;
|
|
}
|
|
return fallback === null || fallback === void 0 ? void 0 : fallback();
|
|
}
|
|
tuple("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 = (rootPrefixCls, motion, transitionName2) => {
|
|
if (transitionName2 !== void 0) {
|
|
return transitionName2;
|
|
}
|
|
return `${rootPrefixCls}-${motion}`;
|
|
};
|
|
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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
let container;
|
|
const {
|
|
shouldRender
|
|
} = useInjectPortal();
|
|
const stopWatch = watch(shouldRender, () => {
|
|
if (shouldRender.value && !container) {
|
|
container = props.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 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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
shallowRef();
|
|
const componentRef = shallowRef();
|
|
shallowRef();
|
|
const triggerUpdate = shallowRef(1);
|
|
const getContainer2 = () => {
|
|
{
|
|
return null;
|
|
}
|
|
};
|
|
useScrollLocker(computed(() => {
|
|
return props.autoLock && props.visible && canUseDom();
|
|
}));
|
|
return () => {
|
|
const {
|
|
forceRender,
|
|
visible
|
|
} = props;
|
|
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": props.didUpdate
|
|
}, {
|
|
default: () => {
|
|
var _a;
|
|
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, childProps);
|
|
}
|
|
});
|
|
}
|
|
return portal;
|
|
};
|
|
}
|
|
});
|
|
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 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(props) {
|
|
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(props).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] = props[key2];
|
|
}
|
|
});
|
|
return attrs;
|
|
}
|
|
function useState$1(defaultStateValue) {
|
|
const initValue = typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
|
|
const innerValue = ref(initValue);
|
|
function triggerChange(newValue) {
|
|
innerValue.value = newValue;
|
|
}
|
|
return [innerValue, triggerChange];
|
|
}
|
|
function createContext(defaultValue) {
|
|
const contextKey = Symbol("contextKey");
|
|
const useProvide = (props, newProps) => {
|
|
const mergedProps = reactive({});
|
|
provide(contextKey, mergedProps);
|
|
watchEffect(() => {
|
|
_extends(mergedProps, props, newProps || {});
|
|
});
|
|
return mergedProps;
|
|
};
|
|
const useInject = () => {
|
|
return inject(contextKey, defaultValue) || {};
|
|
};
|
|
return {
|
|
useProvide,
|
|
useInject
|
|
};
|
|
}
|
|
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$6 = genComponentStyleHook("Space", (token) => [genSpaceStyle(token), genSpaceCompactStyle(token)]);
|
|
const spaceCompactItemProps = () => ({
|
|
compactSize: String,
|
|
compactDirection: PropTypes.oneOf(tuple("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(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("horizontal", "vertical")).def("horizontal"),
|
|
align: PropTypes.oneOf(tuple("start", "end", "center", "baseline")),
|
|
block: {
|
|
type: Boolean,
|
|
default: void 0
|
|
}
|
|
});
|
|
const CompactItem = defineComponent({
|
|
name: "CompactItem",
|
|
props: spaceCompactItemProps(),
|
|
setup(props, _ref2) {
|
|
let {
|
|
slots
|
|
} = _ref2;
|
|
SpaceCompactItemContext.useProvide(props);
|
|
return () => {
|
|
var _a;
|
|
return (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
|
|
};
|
|
}
|
|
});
|
|
defineComponent({
|
|
name: "ASpaceCompact",
|
|
inheritAttrs: false,
|
|
props: spaceCompactProps(),
|
|
setup(props, _ref3) {
|
|
let {
|
|
attrs,
|
|
slots
|
|
} = _ref3;
|
|
const {
|
|
prefixCls,
|
|
direction: directionConfig
|
|
} = useConfigInject("space-compact", props);
|
|
const compactItemContext = SpaceCompactItemContext.useInject();
|
|
const [wrapSSR, hashId] = useStyle$6(prefixCls);
|
|
const clx = computed(() => {
|
|
return classNames(prefixCls.value, hashId.value, {
|
|
[`${prefixCls.value}-rtl`]: directionConfig.value === "rtl",
|
|
[`${prefixCls.value}-block`]: props.block,
|
|
[`${prefixCls.value}-vertical`]: props.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$d(_objectSpread$d({}, 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(compactItemContext);
|
|
return createVNode(CompactItem, {
|
|
"key": key2,
|
|
"compactSize": (_a2 = props.size) !== null && _a2 !== void 0 ? _a2 : "middle",
|
|
"compactDirection": props.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 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
|
|
}
|
|
}];
|
|
};
|
|
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 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$5 = genComponentStyleHook("Wave", (token) => [genWaveStyle(token)]);
|
|
const WaveEffect = defineComponent({
|
|
props: {
|
|
target: objectType(),
|
|
className: String
|
|
},
|
|
setup(props) {
|
|
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": props.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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
getCurrentInstance();
|
|
const {
|
|
prefixCls,
|
|
wave
|
|
} = useConfigInject("wave", props);
|
|
const [, hashId] = useStyle$5(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(props) {
|
|
return () => {
|
|
const {
|
|
existIcon,
|
|
prefixCls,
|
|
loading: loading2
|
|
} = props;
|
|
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 = (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 = (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(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(token)), {
|
|
[`&${token.componentCls}:hover`]: _extends({}, genDisabledStyle(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$4 = 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(buttonToken),
|
|
// Space Compact
|
|
genCompactItemStyle(token, {
|
|
focus: false
|
|
}),
|
|
genCompactItemVerticalStyle(token)
|
|
];
|
|
});
|
|
const buttonGroupProps = () => ({
|
|
prefixCls: String,
|
|
size: {
|
|
type: String
|
|
}
|
|
});
|
|
const GroupSizeContext = createContext();
|
|
const ButtonGroup = defineComponent({
|
|
compatConfig: {
|
|
MODE: 3
|
|
},
|
|
name: "AButtonGroup",
|
|
props: buttonGroupProps(),
|
|
setup(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
const {
|
|
prefixCls,
|
|
direction
|
|
} = useConfigInject("btn-group", props);
|
|
const [, , hashId] = useToken();
|
|
GroupSizeContext.useProvide(reactive({
|
|
size: computed(() => props.size)
|
|
}));
|
|
const classes = computed(() => {
|
|
const {
|
|
size
|
|
} = props;
|
|
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(props, _ref) {
|
|
let {
|
|
slots,
|
|
attrs,
|
|
emit,
|
|
expose
|
|
} = _ref;
|
|
const {
|
|
prefixCls,
|
|
autoInsertSpaceInButton,
|
|
direction,
|
|
size
|
|
} = useConfigInject("btn", props);
|
|
const [wrapSSR, hashId] = useStyle$4(prefixCls);
|
|
const groupSizeContext = GroupSizeContext.useInject();
|
|
const disabledContext = useInjectDisabled();
|
|
const mergedDisabled = computed(() => {
|
|
var _a;
|
|
return (_a = props.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 props.loading === "object" && props.loading.delay ? props.loading.delay || true : !!props.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
|
|
} = props;
|
|
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) {
|
|
let text = child.children.trim();
|
|
if (isTwoCNChar(text)) {
|
|
text = text.split("").join(SPACE);
|
|
}
|
|
return createVNode("span", null, [text]);
|
|
}
|
|
return child;
|
|
};
|
|
watchEffect(() => {
|
|
devWarning(!(props.ghost && isUnBorderedButtonType(props.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)
|
|
} = props;
|
|
const children = flattenChildren((_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots));
|
|
isNeedInserted = children.length === 1 && !icon && !isUnBorderedButtonType(props.type);
|
|
const {
|
|
type,
|
|
htmlType,
|
|
href,
|
|
title,
|
|
target
|
|
} = props;
|
|
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$d(_objectSpread$d({}, buttonProps2), {}, {
|
|
"href": href,
|
|
"target": target,
|
|
"ref": buttonNodeRef
|
|
}), [iconNode, kids]));
|
|
}
|
|
let buttonNode = createVNode("button", _objectSpread$d(_objectSpread$d({}, 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;
|
|
Button.install = function(app) {
|
|
app.component(Button.name, Button);
|
|
app.component(ButtonGroup.name, ButtonGroup);
|
|
return app;
|
|
};
|
|
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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
warning(props.ANT_MARK__ === ANT_MARK);
|
|
const state = reactive({
|
|
antLocale: _extends(_extends({}, props.locale), {
|
|
exist: true
|
|
}),
|
|
ANT_MARK__: ANT_MARK
|
|
});
|
|
provide("localeData", state);
|
|
watch(() => props.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(props, _ref) {
|
|
let {
|
|
attrs,
|
|
slots
|
|
} = _ref;
|
|
let closeTimer;
|
|
const duration = computed(() => props.duration === void 0 ? 4.5 : props.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
|
|
} = props;
|
|
if (onClose) {
|
|
onClose(noticeKey);
|
|
}
|
|
};
|
|
const restartCloseTimer = () => {
|
|
clearCloseTimer();
|
|
startCloseTimer();
|
|
};
|
|
watch([duration, () => props.updateMark, () => props.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
|
|
} = props;
|
|
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$d({
|
|
"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$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;
|
|
};
|
|
let seed$1 = 0;
|
|
const now$1 = Date.now();
|
|
function getUuid$1() {
|
|
const id = seed$1;
|
|
seed$1 += 1;
|
|
return `rcNotification_${now$1}_${id}`;
|
|
}
|
|
const Notification$2 = defineComponent({
|
|
name: "Notification",
|
|
inheritAttrs: false,
|
|
props: ["prefixCls", "transitionName", "animation", "maxCount", "closeIcon", "hashId"],
|
|
setup(props, _ref) {
|
|
let {
|
|
attrs,
|
|
expose,
|
|
slots
|
|
} = _ref;
|
|
const hookRefs = /* @__PURE__ */ new Map();
|
|
const notices = ref([]);
|
|
const transitionProps = computed(() => {
|
|
const {
|
|
prefixCls,
|
|
animation = "fade"
|
|
} = props;
|
|
let name = props.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
|
|
} = props;
|
|
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
|
|
})
|
|
} = props;
|
|
const noticeNodes = notices.value.map((_ref3, index) => {
|
|
let {
|
|
notice: notice2,
|
|
holderCallback
|
|
} = _ref3;
|
|
const updateMark = index === 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$d(_objectSpread$d({}, noticeProps), {}, {
|
|
"class": classNames(noticeProps.class, props.hashId)
|
|
}), {
|
|
default: () => [typeof content === "function" ? content({
|
|
prefixCls
|
|
}) : content]
|
|
});
|
|
});
|
|
const className = {
|
|
[prefixCls]: 1,
|
|
[attrs.class]: !!attrs.class,
|
|
[props.hashId]: true
|
|
};
|
|
return createVNode("div", {
|
|
"class": className,
|
|
"style": attrs.style || {
|
|
top: "65px",
|
|
left: "50%"
|
|
}
|
|
}, [createVNode(TransitionGroup, _objectSpread$d({
|
|
"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, props = __rest$5(_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$d(_objectSpread$d({}, global), {}, {
|
|
"prefixCls": rootPrefixCls
|
|
}), {
|
|
default: () => [createVNode(Notification$2, _objectSpread$d(_objectSpread$d({
|
|
"ref": notiRef
|
|
}, attrs), {}, {
|
|
"prefixCls": prefixCls.value,
|
|
"transitionName": transitionName2,
|
|
"hashId": hashId.value
|
|
}), null)]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
const vm = createVNode(Wrapper, props);
|
|
vm.appContext = appContext || vm.appContext;
|
|
render(vm, div);
|
|
};
|
|
let seed = 0;
|
|
const now = Date.now();
|
|
function getUuid() {
|
|
const id = seed;
|
|
seed += 1;
|
|
return `rcNotification_${now}_${id}`;
|
|
}
|
|
const Notification$1 = defineComponent({
|
|
name: "HookNotification",
|
|
inheritAttrs: false,
|
|
props: ["prefixCls", "transitionName", "animation", "maxCount", "closeIcon", "hashId", "remove", "notices", "getStyles", "getClassName", "onAllRemoved", "getContainer"],
|
|
setup(props, _ref) {
|
|
let {
|
|
attrs,
|
|
slots
|
|
} = _ref;
|
|
const hookRefs = /* @__PURE__ */ new Map();
|
|
const notices = computed(() => props.notices);
|
|
const transitionProps = computed(() => {
|
|
let name = props.transitionName;
|
|
if (!name && props.animation) {
|
|
switch (typeof props.animation) {
|
|
case "string":
|
|
name = props.animation;
|
|
break;
|
|
case "function":
|
|
name = props.animation().name;
|
|
break;
|
|
case "object":
|
|
name = props.animation.name;
|
|
break;
|
|
default:
|
|
name = `${props.prefixCls}-fade`;
|
|
break;
|
|
}
|
|
}
|
|
return getTransitionGroupProps(name);
|
|
});
|
|
const remove = (key2) => props.remove(key2);
|
|
const placements = ref({});
|
|
watch(notices, () => {
|
|
const nextPlacements = {};
|
|
Object.keys(placements.value).forEach((placement) => {
|
|
nextPlacements[placement] = [];
|
|
});
|
|
props.notices.forEach((config) => {
|
|
const {
|
|
placement = "topRight"
|
|
} = config.notice;
|
|
if (placement) {
|
|
nextPlacements[placement] = nextPlacements[placement] || [];
|
|
nextPlacements[placement].push(config);
|
|
}
|
|
});
|
|
placements.value = nextPlacements;
|
|
});
|
|
const placementList = computed(() => Object.keys(placements.value));
|
|
return () => {
|
|
var _a;
|
|
const {
|
|
prefixCls,
|
|
closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots, {
|
|
prefixCls
|
|
})
|
|
} = props;
|
|
const noticeNodes = placementList.value.map((placement) => {
|
|
var _a2, _b;
|
|
const noticesForPlacement = placements.value[placement];
|
|
const classes = (_a2 = props.getClassName) === null || _a2 === void 0 ? void 0 : _a2.call(props, placement);
|
|
const styles = (_b = props.getStyles) === null || _b === void 0 ? void 0 : _b.call(props, placement);
|
|
const noticeNodesForPlacement = noticesForPlacement.map((_ref2, index) => {
|
|
let {
|
|
notice: notice2,
|
|
holderCallback
|
|
} = _ref2;
|
|
const updateMark = index === 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$d(_objectSpread$d({}, noticeProps), {}, {
|
|
"class": classNames(noticeProps.class, props.hashId)
|
|
}), {
|
|
default: () => [typeof content === "function" ? content({
|
|
prefixCls
|
|
}) : content]
|
|
});
|
|
});
|
|
const className = {
|
|
[prefixCls]: 1,
|
|
[`${prefixCls}-${placement}`]: 1,
|
|
[attrs.class]: !!attrs.class,
|
|
[props.hashId]: true,
|
|
[classes]: !!classes
|
|
};
|
|
function onAfterLeave() {
|
|
var _a3;
|
|
if (noticesForPlacement.length > 0) {
|
|
return;
|
|
}
|
|
Reflect.deleteProperty(placements.value, placement);
|
|
(_a3 = props.onAllRemoved) === null || _a3 === void 0 ? void 0 : _a3.call(props);
|
|
}
|
|
return createVNode("div", {
|
|
"key": placement,
|
|
"class": className,
|
|
"style": attrs.style || styles || {
|
|
top: "65px",
|
|
left: "50%"
|
|
}
|
|
}, [createVNode(TransitionGroup, _objectSpread$d(_objectSpread$d({
|
|
"tag": "div"
|
|
}, transitionProps.value), {}, {
|
|
"onAfterLeave": onAfterLeave
|
|
}), {
|
|
default: () => [noticeNodesForPlacement]
|
|
})]);
|
|
});
|
|
return createVNode(Portal$1, {
|
|
"getContainer": props.getContainer
|
|
}, {
|
|
default: () => [noticeNodes]
|
|
});
|
|
};
|
|
}
|
|
});
|
|
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 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$4(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$3 = 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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
return () => {
|
|
var _a;
|
|
return createVNode("div", {
|
|
"class": classNames(`${props.prefixCls}-custom-content`, `${props.prefixCls}-${props.type}`)
|
|
}, [props.icon || TypeIcon[props.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(props, _ref2) {
|
|
let {
|
|
slots,
|
|
attrs
|
|
} = _ref2;
|
|
var _a;
|
|
const {
|
|
getPrefixCls
|
|
} = useConfigContextInject();
|
|
const prefixCls = computed(() => props.prefixCls || getPrefixCls("message"));
|
|
const [, hashId] = useStyle$3(prefixCls);
|
|
return createVNode(Notice, _objectSpread$d(_objectSpread$d({}, 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": props.type,
|
|
"icon": props.icon
|
|
}, {
|
|
default: () => [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)]
|
|
})]
|
|
});
|
|
}
|
|
});
|
|
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;
|
|
};
|
|
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(props, _ref) {
|
|
let {
|
|
expose
|
|
} = _ref;
|
|
var _a, _b;
|
|
const {
|
|
getPrefixCls,
|
|
getPopupContainer
|
|
} = useConfigInject("message", props);
|
|
const prefixCls = computed(() => getPrefixCls("message", props.prefixCls));
|
|
const [, hashId] = useStyle$3(prefixCls);
|
|
const getStyles = () => {
|
|
var _a2;
|
|
const top = (_a2 = props.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, props.rtl ? `${prefixCls.value}-rtl` : "");
|
|
const getNotificationMotion = () => {
|
|
var _a2;
|
|
return getMotion$1({
|
|
prefixCls: prefixCls.value,
|
|
animation: (_a2 = props.animation) !== null && _a2 !== void 0 ? _a2 : `move-up`,
|
|
transitionName: props.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 = props.duration) !== null && _a !== void 0 ? _a : DEFAULT_DURATION$1,
|
|
getContainer: (_b = props.staticGetContainer) !== null && _b !== void 0 ? _b : getPopupContainer.value,
|
|
maxCount: props.maxCount,
|
|
onAllRemoved: props.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 open = (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$3(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,
|
|
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 open(mergedConfig);
|
|
};
|
|
wrapAPI[type] = typeOpen;
|
|
});
|
|
return [wrapAPI, () => createVNode(Holder$1, _objectSpread$d(_objectSpread$d({
|
|
"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$3
|
|
}, (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$2 = 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(props) {
|
|
const {
|
|
getPrefixCls
|
|
} = useConfigInject("notification", props);
|
|
const prefixCls = computed(() => props.prefixCls || getPrefixCls("notification"));
|
|
const noticePrefixCls = computed(() => `${prefixCls.value}-notice`);
|
|
const [, hashId] = useStyle$2(prefixCls);
|
|
return () => {
|
|
return createVNode(Notice, _objectSpread$d(_objectSpread$d({}, props), {}, {
|
|
"prefixCls": prefixCls.value,
|
|
"class": classNames(hashId.value, `${noticePrefixCls.value}-pure-panel`),
|
|
"noticeKey": "pure",
|
|
"duration": null,
|
|
"closable": props.closable,
|
|
"closeIcon": getCloseIcon(prefixCls.value, props.closeIcon)
|
|
}), {
|
|
default: () => [createVNode(PureContent, {
|
|
"prefixCls": noticePrefixCls.value,
|
|
"icon": props.icon,
|
|
"type": props.type,
|
|
"message": props.message,
|
|
"description": props.description,
|
|
"btn": props.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$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 DEFAULT_OFFSET = 24;
|
|
const DEFAULT_DURATION = 4.5;
|
|
const Holder = defineComponent({
|
|
name: "Holder",
|
|
inheritAttrs: false,
|
|
props: ["prefixCls", "class", "type", "icon", "content", "onAllRemoved"],
|
|
setup(props, _ref) {
|
|
let {
|
|
expose
|
|
} = _ref;
|
|
const {
|
|
getPrefixCls,
|
|
getPopupContainer
|
|
} = useConfigInject("notification", props);
|
|
const prefixCls = computed(() => props.prefixCls || getPrefixCls("notification"));
|
|
const getStyles = (placement) => {
|
|
var _a, _b;
|
|
return getPlacementStyle(placement, (_a = props.top) !== null && _a !== void 0 ? _a : DEFAULT_OFFSET, (_b = props.bottom) !== null && _b !== void 0 ? _b : DEFAULT_OFFSET);
|
|
};
|
|
const [, hashId] = useStyle$2(prefixCls);
|
|
const getClassName = () => classNames(hashId.value, {
|
|
[`${prefixCls.value}-rtl`]: props.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 = props.getPopupContainer) === null || _a === void 0 ? void 0 : _a.call(props)) || ((_b = getPopupContainer.value) === null || _b === void 0 ? void 0 : _b.call(getPopupContainer)) || (void 0).body;
|
|
},
|
|
maxCount: props.maxCount,
|
|
hashId: hashId.value,
|
|
onAllRemoved: props.onAllRemoved
|
|
});
|
|
expose(_extends(_extends({}, api2), {
|
|
prefixCls: prefixCls.value,
|
|
hashId
|
|
}));
|
|
return holder;
|
|
}
|
|
});
|
|
function useInternalNotification(notificationConfig) {
|
|
const holderRef = shallowRef(null);
|
|
const holderKey = Symbol("notificationHolderKey");
|
|
const open = (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$2(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,
|
|
destroy
|
|
};
|
|
const keys = ["success", "info", "warning", "error"];
|
|
keys.forEach((type) => {
|
|
wrapAPI[type] = (config) => open(_extends(_extends({}, config), {
|
|
type
|
|
}));
|
|
});
|
|
return [wrapAPI, () => createVNode(Holder, _objectSpread$d(_objectSpread$d({
|
|
"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$2,
|
|
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(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, index) => {
|
|
variables[`primary-${index + 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(globalPrefixCls, theme);
|
|
}
|
|
const useStyle$1 = (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$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 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(props, _ref) {
|
|
let {
|
|
slots
|
|
} = _ref;
|
|
const parentContext = useConfigContextInject();
|
|
const getPrefixCls = (suffixCls, customizePrefixCls) => {
|
|
const {
|
|
prefixCls = "ant"
|
|
} = props;
|
|
if (customizePrefixCls) return customizePrefixCls;
|
|
const mergedPrefixCls = prefixCls || parentContext.getPrefixCls("");
|
|
return suffixCls ? `${mergedPrefixCls}-${suffixCls}` : mergedPrefixCls;
|
|
};
|
|
const iconPrefixCls = computed(() => props.iconPrefixCls || parentContext.iconPrefixCls.value || defaultIconPrefixCls);
|
|
const shouldWrapSSR = computed(() => iconPrefixCls.value !== parentContext.iconPrefixCls.value);
|
|
const csp = computed(() => {
|
|
var _a;
|
|
return props.csp || ((_a = parentContext.csp) === null || _a === void 0 ? void 0 : _a.value);
|
|
});
|
|
const wrapSSR = useStyle$1(iconPrefixCls);
|
|
const mergedTheme = useTheme(computed(() => props.theme), computed(() => {
|
|
var _a;
|
|
return (_a = parentContext.theme) === null || _a === void 0 ? void 0 : _a.value;
|
|
}));
|
|
const renderEmptyComponent = (name) => {
|
|
const renderEmpty$1 = props.renderEmpty || slots.renderEmpty || parentContext.renderEmpty || renderEmpty;
|
|
return renderEmpty$1(name);
|
|
};
|
|
const autoInsertSpaceInButton = computed(() => {
|
|
var _a, _b;
|
|
return (_a = props.autoInsertSpaceInButton) !== null && _a !== void 0 ? _a : (_b = parentContext.autoInsertSpaceInButton) === null || _b === void 0 ? void 0 : _b.value;
|
|
});
|
|
const locale$12 = computed(() => {
|
|
var _a;
|
|
return props.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 props.direction || ((_a = parentContext.direction) === null || _a === void 0 ? void 0 : _a.value);
|
|
});
|
|
const space = computed(() => {
|
|
var _a, _b;
|
|
return (_a = props.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 = props.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 = props.dropdownMatchSelectWidth) !== null && _a !== void 0 ? _a : (_b = parentContext.dropdownMatchSelectWidth) === null || _b === void 0 ? void 0 : _b.value;
|
|
});
|
|
const getTargetContainer = computed(() => {
|
|
var _a;
|
|
return props.getTargetContainer !== void 0 ? props.getTargetContainer : (_a = parentContext.getTargetContainer) === null || _a === void 0 ? void 0 : _a.value;
|
|
});
|
|
const getPopupContainer = computed(() => {
|
|
var _a;
|
|
return props.getPopupContainer !== void 0 ? props.getPopupContainer : (_a = parentContext.getPopupContainer) === null || _a === void 0 ? void 0 : _a.value;
|
|
});
|
|
const pageHeader = computed(() => {
|
|
var _a;
|
|
return props.pageHeader !== void 0 ? props.pageHeader : (_a = parentContext.pageHeader) === null || _a === void 0 ? void 0 : _a.value;
|
|
});
|
|
const input = computed(() => {
|
|
var _a;
|
|
return props.input !== void 0 ? props.input : (_a = parentContext.input) === null || _a === void 0 ? void 0 : _a.value;
|
|
});
|
|
const pagination = computed(() => {
|
|
var _a;
|
|
return props.pagination !== void 0 ? props.pagination : (_a = parentContext.pagination) === null || _a === void 0 ? void 0 : _a.value;
|
|
});
|
|
const form = computed(() => {
|
|
var _a;
|
|
return props.form !== void 0 ? props.form : (_a = parentContext.form) === null || _a === void 0 ? void 0 : _a.value;
|
|
});
|
|
const select = computed(() => {
|
|
var _a;
|
|
return props.select !== void 0 ? props.select : (_a = parentContext.select) === null || _a === void 0 ? void 0 : _a.value;
|
|
});
|
|
const componentSize = computed(() => props.componentSize);
|
|
const componentDisabled = computed(() => props.componentDisabled);
|
|
const wave = computed(() => {
|
|
var _a, _b;
|
|
return (_a = props.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(() => props.transformCellText),
|
|
wave
|
|
};
|
|
const memoTheme = computed(() => {
|
|
const _a = mergedTheme.value || {}, {
|
|
algorithm,
|
|
token
|
|
} = _a, rest = __rest$1(_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 (props.form && props.form.validateMessages) {
|
|
validateMessages = _extends(_extends({}, validateMessages), props.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 (props.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);
|
|
};
|
|
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$1 = -1;
|
|
function getUUID() {
|
|
uuid$1 += 1;
|
|
return uuid$1;
|
|
}
|
|
function getScroll(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(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(w);
|
|
pos.top += getScroll(w, true);
|
|
return pos;
|
|
}
|
|
const sentinelStyle = {
|
|
width: 0,
|
|
height: 0,
|
|
overflow: "hidden",
|
|
outline: "none"
|
|
};
|
|
const entityStyle = {
|
|
outline: "none"
|
|
};
|
|
const Content = defineComponent({
|
|
compatConfig: {
|
|
MODE: 3
|
|
},
|
|
name: "DialogContent",
|
|
inheritAttrs: false,
|
|
props: _extends(_extends({}, dialogPropTypes()), {
|
|
motionName: String,
|
|
ariaId: String,
|
|
onVisibleChanged: Function,
|
|
onMousedown: Function,
|
|
onMouseup: Function
|
|
}),
|
|
setup(props, _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
|
|
} = props;
|
|
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(dialogRef.value);
|
|
transformOrigin.value = props.mousePosition ? `${props.mousePosition.x - elementOffset.left}px ${props.mousePosition.y - elementOffset.top}px` : "";
|
|
}
|
|
});
|
|
};
|
|
const onVisibleChanged = (visible) => {
|
|
props.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
|
|
} = props;
|
|
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$d({
|
|
"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$d(_objectSpread$d({}, transitionProps), {}, {
|
|
"onBeforeEnter": onPrepare,
|
|
"onAfterEnter": () => onVisibleChanged(true),
|
|
"onAfterLeave": () => onVisibleChanged(false)
|
|
}), {
|
|
default: () => [visible || !destroyOnClose ? withDirectives(createVNode("div", _objectSpread$d(_objectSpread$d({}, 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 = defineComponent({
|
|
compatConfig: {
|
|
MODE: 3
|
|
},
|
|
name: "DialogMask",
|
|
props: {
|
|
prefixCls: String,
|
|
visible: Boolean,
|
|
motionName: String,
|
|
maskProps: Object
|
|
},
|
|
setup(props, _ref) {
|
|
return () => {
|
|
const {
|
|
prefixCls,
|
|
visible,
|
|
maskProps,
|
|
motionName
|
|
} = props;
|
|
const transitionProps = getTransitionProps(motionName);
|
|
return createVNode(Transition, transitionProps, {
|
|
default: () => [withDirectives(createVNode("div", _objectSpread$d({
|
|
"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(props, _ref) {
|
|
let {
|
|
attrs,
|
|
slots
|
|
} = _ref;
|
|
const lastOutSideActiveElementRef = shallowRef();
|
|
const wrapperRef = shallowRef();
|
|
const contentRef = shallowRef();
|
|
const animatedVisible = shallowRef(props.visible);
|
|
const ariaIdRef = shallowRef(`vcDialogTitle${getUUID()}`);
|
|
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 (props.mask && lastOutSideActiveElementRef.value && props.focusTriggerAfterClose) {
|
|
try {
|
|
lastOutSideActiveElementRef.value.focus({
|
|
preventScroll: true
|
|
});
|
|
} catch (e) {
|
|
}
|
|
lastOutSideActiveElementRef.value = null;
|
|
}
|
|
if (preAnimatedVisible) {
|
|
(_b = props.afterClose) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
}
|
|
}
|
|
};
|
|
const onInternalClose = (e) => {
|
|
var _a;
|
|
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, 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 (!props.maskClosable) return null;
|
|
if (contentClickRef.value) {
|
|
contentClickRef.value = false;
|
|
} else if (wrapperRef.value === e.target) {
|
|
onInternalClose(e);
|
|
}
|
|
};
|
|
const onWrapperKeyDown = (e) => {
|
|
if (props.keyboard && e.keyCode === KeyCode.ESC) {
|
|
e.stopPropagation();
|
|
onInternalClose(e);
|
|
return;
|
|
}
|
|
if (props.visible) {
|
|
if (e.keyCode === KeyCode.TAB) {
|
|
contentRef.value.changeActive(!e.shiftKey);
|
|
}
|
|
}
|
|
};
|
|
watch(() => props.visible, () => {
|
|
if (props.visible) {
|
|
animatedVisible.value = true;
|
|
}
|
|
}, {
|
|
flush: "post"
|
|
});
|
|
watchEffect(() => {
|
|
var _a, _b;
|
|
(_a = props.scrollLocker) === null || _a === void 0 ? void 0 : _a.unLock();
|
|
if (animatedVisible.value) {
|
|
(_b = props.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
|
|
} = props;
|
|
const {
|
|
style,
|
|
class: className
|
|
} = attrs;
|
|
return createVNode("div", _objectSpread$d({
|
|
"class": [`${prefixCls}-root`, rootClassName]
|
|
}, pickAttrs(props, {
|
|
data: true
|
|
})), [createVNode(Mask, {
|
|
"prefixCls": prefixCls,
|
|
"visible": mask && visible,
|
|
"motionName": getMotionName(prefixCls, maskTransitionName, maskAnimation),
|
|
"style": _extends({
|
|
zIndex
|
|
}, maskStyle),
|
|
"maskProps": maskProps
|
|
}, null), createVNode("div", _objectSpread$d({
|
|
"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, _objectSpread$d(_objectSpread$d({}, omit(props, ["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(props, _ref) {
|
|
let {
|
|
attrs,
|
|
slots
|
|
} = _ref;
|
|
const animatedVisible = ref(props.visible);
|
|
useProvidePortal({}, {
|
|
inTriggerContext: false
|
|
});
|
|
watch(() => props.visible, () => {
|
|
if (props.visible) {
|
|
animatedVisible.value = true;
|
|
}
|
|
}, {
|
|
flush: "post"
|
|
});
|
|
return () => {
|
|
const {
|
|
visible,
|
|
getContainer: getContainer2,
|
|
forceRender,
|
|
destroyOnClose = false,
|
|
afterClose
|
|
} = props;
|
|
let dialogProps = _extends(_extends(_extends({}, props), attrs), {
|
|
ref: "_component",
|
|
key: "dialog"
|
|
});
|
|
if (getContainer2 === false) {
|
|
return createVNode(Dialog, _objectSpread$d(_objectSpread$d({}, 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 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 = 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")];
|
|
});
|
|
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;
|
|
};
|
|
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(props, _ref) {
|
|
let {
|
|
emit,
|
|
slots,
|
|
attrs
|
|
} = _ref;
|
|
const [locale2] = useLocaleReceiver("Modal");
|
|
const {
|
|
prefixCls,
|
|
rootPrefixCls,
|
|
direction,
|
|
getPopupContainer
|
|
} = useConfigInject("modal", props);
|
|
const [wrapSSR, hashId] = useStyle(prefixCls);
|
|
warning(props.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
|
|
} = props;
|
|
return createVNode(Fragment, null, [createVNode(Button, _objectSpread$d({
|
|
"onClick": handleCancel
|
|
}, props.cancelButtonProps), {
|
|
default: () => [cancelText || locale2.value.cancelText]
|
|
}), createVNode(Button, _objectSpread$d(_objectSpread$d({}, convertLegacyProps(okType)), {}, {
|
|
"loading": confirmLoading,
|
|
"onClick": handleOk
|
|
}, props.okButtonProps), {
|
|
default: () => [okText || locale2.value.okText]
|
|
})]);
|
|
};
|
|
return () => {
|
|
var _a, _b;
|
|
const {
|
|
prefixCls: customizePrefixCls,
|
|
visible,
|
|
open,
|
|
wrapClassName,
|
|
centered,
|
|
getContainer: getContainer2,
|
|
closeIcon = (_a = slots.closeIcon) === null || _a === void 0 ? void 0 : _a.call(slots),
|
|
focusTriggerAfterClose = true
|
|
} = props, restProps = __rest(props, ["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$d(_objectSpread$d(_objectSpread$d({}, 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": open !== null && open !== void 0 ? open : visible,
|
|
"onClose": handleCancel,
|
|
"focusTriggerAfterClose": focusTriggerAfterClose,
|
|
"transitionName": getTransitionName(rootPrefixCls.value, "zoom", props.transitionName),
|
|
"maskTransitionName": getTransitionName(rootPrefixCls.value, "fade", props.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(props, _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 = props.close) === null || _a === void 0 ? void 0 : _a.call(props, ...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
|
|
} = props;
|
|
if (clickedRef.value) {
|
|
return;
|
|
}
|
|
clickedRef.value = true;
|
|
if (!actionFn) {
|
|
onInternalClose();
|
|
return;
|
|
}
|
|
let returnValueOfOnOk;
|
|
if (props.emitEvent) {
|
|
returnValueOfOnOk = actionFn(e);
|
|
if (props.quitOnNullishReturnValue && !isThenable(returnValueOfOnOk)) {
|
|
clickedRef.value = false;
|
|
onInternalClose(e);
|
|
return;
|
|
}
|
|
} else if (actionFn.length) {
|
|
returnValueOfOnOk = actionFn(props.close);
|
|
clickedRef.value = false;
|
|
} else {
|
|
returnValueOfOnOk = actionFn();
|
|
if (!returnValueOfOnOk) {
|
|
onInternalClose();
|
|
return;
|
|
}
|
|
}
|
|
handlePromiseOnOk(returnValueOfOnOk);
|
|
};
|
|
return () => {
|
|
const {
|
|
type,
|
|
prefixCls,
|
|
buttonProps: buttonProps2
|
|
} = props;
|
|
return createVNode(Button, _objectSpread$d(_objectSpread$d(_objectSpread$d({}, 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(props, _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,
|
|
title,
|
|
content,
|
|
direction,
|
|
closeIcon,
|
|
modalRender,
|
|
focusTriggerAfterClose,
|
|
rootPrefixCls,
|
|
bodyStyle,
|
|
wrapClassName,
|
|
footer
|
|
} = props;
|
|
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 = props.okType || "primary";
|
|
const prefixCls = props.prefixCls || "ant-modal";
|
|
const contentPrefixCls = `${prefixCls}-confirm`;
|
|
const style = attrs.style || {};
|
|
const mergedOkCancel = okCancel !== null && okCancel !== void 0 ? okCancel : type === "confirm";
|
|
const autoFocusButton = props.autoFocusButton === null ? false : props.autoFocusButton || "ok";
|
|
const confirmPrefixCls = `${prefixCls}-confirm`;
|
|
const classString = classNames(confirmPrefixCls, `${confirmPrefixCls}-${props.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(props.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": open,
|
|
"title": "",
|
|
"footer": "",
|
|
"transitionName": getTransitionName(rootPrefixCls, "zoom", props.transitionName),
|
|
"maskTransitionName": getTransitionName(rootPrefixCls, "fade", props.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$d(_objectSpread$d({}, global), {}, {
|
|
"prefixCls": rootPrefixCls
|
|
}), {
|
|
default: () => [createVNode(ConfirmDialog, _objectSpread$d(_objectSpread$d({}, p), {}, {
|
|
"rootPrefixCls": rootPrefixCls,
|
|
"prefixCls": prefixCls,
|
|
"iconPrefixCls": iconPrefixCls,
|
|
"locale": runtimeLocale2,
|
|
"cancelText": p.cancelText || runtimeLocale2.cancelText
|
|
}), null)]
|
|
});
|
|
};
|
|
function render$1(props) {
|
|
const vm = createVNode(Wrapper, _extends({}, props));
|
|
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(props) {
|
|
return _extends(_extends({}, props), {
|
|
type: "warning"
|
|
});
|
|
}
|
|
function withInfo(props) {
|
|
return _extends(_extends({}, props), {
|
|
type: "info"
|
|
});
|
|
}
|
|
function withSuccess(props) {
|
|
return _extends(_extends({}, props), {
|
|
type: "success"
|
|
});
|
|
}
|
|
function withError(props) {
|
|
return _extends(_extends({}, props), {
|
|
type: "error"
|
|
});
|
|
}
|
|
function withConfirm(props) {
|
|
return _extends(_extends({}, props), {
|
|
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(props, _ref) {
|
|
let {
|
|
expose
|
|
} = _ref;
|
|
var _a;
|
|
const open = computed(() => props.open);
|
|
const innerConfig = computed(() => props.config);
|
|
const {
|
|
direction,
|
|
getPrefixCls
|
|
} = useConfigContextInject();
|
|
const prefixCls = getPrefixCls("modal");
|
|
const rootPrefixCls = getPrefixCls();
|
|
const afterClose = () => {
|
|
var _a2, _b;
|
|
props === null || props === void 0 ? void 0 : props.afterClose();
|
|
(_b = (_a2 = innerConfig.value).afterClose) === null || _b === void 0 ? void 0 : _b.call(_a2);
|
|
};
|
|
const close = function() {
|
|
props.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$d(_objectSpread$d({
|
|
"prefixCls": prefixCls,
|
|
"rootPrefixCls": rootPrefixCls
|
|
}, innerConfig.value), {}, {
|
|
"close": close,
|
|
"open": open.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 open = 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() {
|
|
open.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": open.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(props) {
|
|
return confirm(withWarn(props));
|
|
}
|
|
Modal.useModal = useModal;
|
|
Modal.info = function infoFn(props) {
|
|
return confirm(withInfo(props));
|
|
};
|
|
Modal.success = function successFn(props) {
|
|
return confirm(withSuccess(props));
|
|
};
|
|
Modal.error = function errorFn(props) {
|
|
return confirm(withError(props));
|
|
};
|
|
Modal.warning = modalWarn;
|
|
Modal.warn = modalWarn;
|
|
Modal.confirm = function confirmFn(props) {
|
|
return confirm(withConfirm(props));
|
|
};
|
|
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 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 == null ? void 0 : 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: ["liman"].includes(moduleProject()),
|
|
productWeightField: ["liman"].includes(moduleProject()),
|
|
productRialFeeField: ["liman"].includes(moduleProject()),
|
|
productPercentFeeField: ["liman"].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();
|
|
router.push({ name: "auth-login" });
|
|
}
|
|
return Promise.reject(error);
|
|
}
|
|
);
|
|
function checkStatus(data, config) {
|
|
const errorMessage2 = get(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<T>
|
|
post(url, data, config) {
|
|
return _axios.post(url, data, config);
|
|
},
|
|
request(config) {
|
|
return _axios.request(config);
|
|
},
|
|
//AxiosResponse<T>
|
|
get(url, config) {
|
|
return _axios.get(url, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
delete(url, config) {
|
|
return _axios.delete(url, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
head(url, config) {
|
|
return _axios.head(url, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
options(url, config) {
|
|
return _axios.options(url, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
put(url, data, config) {
|
|
return _axios.put(url, data, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
patch(url, data, config) {
|
|
return _axios.patch(url, data, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
postForm(url, data, config) {
|
|
return _axios.postForm(url, data, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
putForm(url, data, config) {
|
|
return _axios.putForm(url, data, config);
|
|
},
|
|
//AxiosResponse<T>
|
|
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("en");
|
|
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(strings(val), `${value}.fa`);
|
|
case "en":
|
|
return get(strings(val), `${value}.en`);
|
|
}
|
|
}
|
|
function useModule(value) {
|
|
return get(module$1(), value) ?? false;
|
|
}
|
|
watch(themeMode, () => {
|
|
setNight();
|
|
});
|
|
watch(langMode, () => {
|
|
setLocalConfig();
|
|
setRtl();
|
|
priceUnit.value = useString("rial");
|
|
});
|
|
watch(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 = usePreferredDark().value;
|
|
isNightStore.value = 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 == null ? void 0 : obj.email) ?? void 0,
|
|
void 0,
|
|
(obj == null ? void 0 : obj.password) ?? void 0
|
|
);
|
|
};
|
|
const updateUser = async (obj) => {
|
|
obj == null ? true : delete obj.email;
|
|
await updateAuthUser(obj);
|
|
obj == null ? true : 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 index = prices.value.findIndex((item) => item.id === _item.id);
|
|
if (index >= 0) {
|
|
Object.assign(prices.value[index], {
|
|
..._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) {
|
|
var _a, _b;
|
|
const cartStore = useCartStore();
|
|
const onlinePrices = usePriceStore();
|
|
const config = useConfigStore();
|
|
const tala18 = ref((_a = onlinePrices.prices.find((x) => x.name === "tgju 18")) == null ? void 0 : _a.price);
|
|
const silver999 = ref((_b = onlinePrices.prices.find((x) => x.name === "tgju silver_999")) == null ? void 0 : _b.price);
|
|
const title = computed(() => {
|
|
return get(unref(product), "title_fa", "");
|
|
});
|
|
computed(() => {
|
|
return get(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(unref(product), "meta", "");
|
|
});
|
|
const weight = computed(() => {
|
|
return get(unref(product), "weight", "");
|
|
});
|
|
const weightPriceCalculator = (w = 0) => {
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
if (unref(product).collection_id === 1) {
|
|
return (_g = w * tala18.value + w * tala18.value * (unref(product).percent_fee ?? 0) / 100 + w * tala18.value * (((_b2 = (_a2 = config.sellerConfig) == null ? void 0 : _a2.store) == null ? void 0 : _b2.tax_profit) ?? 0) / 100 + (((_d = (_c = config.sellerConfig) == null ? void 0 : _c.store) == null ? void 0 : _d.has_tax) ? w * tala18.value * (((unref(product).percent_fee ?? 0) + (((_f = (_e = config.sellerConfig) == null ? void 0 : _e.store) == null ? void 0 : _f.tax_profit) ?? 0)) / 100) * 0.09 : 0) + (unref(product).rial_fee ?? 0)) == null ? void 0 : _g.toFixed(0);
|
|
} else if (unref(product).collection_id === 2) {
|
|
return (_n = w * silver999.value + w * silver999.value * (unref(product).percent_fee ?? 0) / 100 + w * silver999.value * (((_i = (_h = config.sellerConfig) == null ? void 0 : _h.store) == null ? void 0 : _i.tax_profit) ?? 0) / 100 + (((_k = (_j = config.sellerConfig) == null ? void 0 : _j.store) == null ? void 0 : _k.has_tax) ? w * silver999.value * (((unref(product).percent_fee ?? 0) + (((_m = (_l = config.sellerConfig) == null ? void 0 : _l.store) == null ? void 0 : _m.tax_profit) ?? 0)) / 100) * 0.09 : 0) + (unref(product).rial_fee ?? 0)) == null ? void 0 : _n.toFixed(0);
|
|
}
|
|
};
|
|
const originalPrice = computed(() => {
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
if (((_a2 = unref(product)) == null ? void 0 : _a2.collection_id) === 1 || ((_b2 = unref(product)) == null ? void 0 : _b2.collection_id) === 2) {
|
|
if (unref(variantSelected)) {
|
|
if ((_c = unref(variantSelected)) == null ? void 0 : _c.weight) return ((_d = unref(variantSelected)) == null ? void 0 : _d.auto_calculate) ? weightPriceCalculator((_e = unref(variantSelected)) == null ? void 0 : _e.weight) : (_f = unref(variantSelected)) == null ? void 0 : _f.price;
|
|
} else {
|
|
if ((_g = unref(product)) == null ? void 0 : _g.weight) return ((_h = unref(product)) == null ? void 0 : _h.auto_calculate) ? weightPriceCalculator((_i = unref(product)) == null ? void 0 : _i.weight) : (_j = unref(product)) == null ? void 0 : _j.price;
|
|
}
|
|
} else {
|
|
if (unref(variantSelected)) {
|
|
if ((_k = unref(variantSelected)) == null ? void 0 : _k.price) return (_l = unref(variantSelected)) == null ? void 0 : _l.price;
|
|
} else {
|
|
if ((_m = unref(product)) == null ? void 0 : _m.price) return (_n = unref(product)) == null ? void 0 : _n.price;
|
|
}
|
|
return 0;
|
|
}
|
|
});
|
|
const price = computed(() => {
|
|
var _a2, _b2;
|
|
if (hasDiscount.value) {
|
|
return (_a2 = displayPrice.value) == null ? void 0 : _a2.toFixed(0);
|
|
}
|
|
return (_b2 = parseInt(originalPrice.value ?? "0")) == null ? void 0 : _b2.toFixed(0);
|
|
});
|
|
const displayPrice = computed(() => {
|
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
if (unref(variantSelected)) {
|
|
if (((_a2 = unref(variantSelected)) == null ? void 0 : _a2.auto_calculate) && (((_b2 = unref(product)) == null ? void 0 : _b2.collection_id) === 1 || ((_c = unref(product)) == null ? void 0 : _c.collection_id) === 2)) {
|
|
const discountType = ref((_d = unref(variantSelected)) == null ? void 0 : _d.discount_type);
|
|
const weight2 = ref((_e = unref(variantSelected)) == null ? void 0 : _e.weight);
|
|
const discountValue = ref((_f = unref(variantSelected)) == null ? void 0 : _f.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 ((_g = unref(variantSelected)) == null ? void 0 : _g.display_price) return (_h = unref(variantSelected)) == null ? void 0 : _h.display_price;
|
|
else return ((_i = unref(variantSelected)) == null ? void 0 : _i.discount_type) == "simple" ? ((_j = unref(variantSelected)) == null ? void 0 : _j.price) - ((_k = unref(variantSelected)) == null ? void 0 : _k.discount) : ((_l = unref(variantSelected)) == null ? void 0 : _l.price) * ((100 - ((_m = unref(variantSelected)) == null ? void 0 : _m.discount)) / 100);
|
|
}
|
|
} else {
|
|
if (((_n = unref(product)) == null ? void 0 : _n.auto_calculate) && (((_o = unref(product)) == null ? void 0 : _o.collection_id) === 1 || ((_p = unref(product)) == null ? void 0 : _p.collection_id) === 2)) {
|
|
const discountType = ref((_q = unref(product)) == null ? void 0 : _q.discount_type);
|
|
const weight2 = ref((_r = unref(product)) == null ? void 0 : _r.weight);
|
|
const discountValue = ref((_s = unref(product)) == null ? void 0 : _s.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 ((_t = unref(product)) == null ? void 0 : _t.display_price) return (_u = unref(product)) == null ? void 0 : _u.display_price;
|
|
}
|
|
}
|
|
return 0;
|
|
});
|
|
const hasDiscount = computed(() => {
|
|
return discount.value !== 0 && discount.value !== null;
|
|
});
|
|
const discount = computed(() => {
|
|
var _a2, _b2;
|
|
if (unref(variantSelected)) {
|
|
if ((_a2 = unref(variantSelected)) == null ? void 0 : _a2.discount)
|
|
return (_b2 = unref(variantSelected)) == null ? void 0 : _b2.discount;
|
|
}
|
|
return get(unref(product), "discount", "");
|
|
});
|
|
const brand = computed(() => {
|
|
return get(unref(product), "brand.title", "-");
|
|
});
|
|
const isVariant = computed(() => {
|
|
const type = get(unref(product), "type", "simple");
|
|
return type === "variant";
|
|
});
|
|
const isBox = computed(() => {
|
|
const type = get(unref(product), "sell_type", "numeric");
|
|
return type === "box";
|
|
});
|
|
const gallery = computed(() => {
|
|
const temp = get(unref(product), "gallery", []);
|
|
return temp.map((item) => get(item, "file.src"));
|
|
});
|
|
const body = computed(() => {
|
|
const temp = get(unref(product), "body", "");
|
|
return temp ? temp : "";
|
|
});
|
|
const originalImage = computed(() => {
|
|
return getSupabaseStorageUrl(get(unref(product), "files[0].url", null));
|
|
});
|
|
computed(() => {
|
|
return get(unref(product), "banner_image.src", null);
|
|
});
|
|
const collection = computed(() => {
|
|
return get(unref(product), "collection.title", "-");
|
|
});
|
|
const count = computed(() => {
|
|
return get(unref(product), "count", "-");
|
|
});
|
|
const variants = computed(() => {
|
|
return get(unref(product), "variants", []);
|
|
});
|
|
const attributes2 = computed(() => {
|
|
return get(unref(product), "product_attributes", []);
|
|
});
|
|
const description = computed(() => {
|
|
return get(unref(product), "description", "-");
|
|
});
|
|
const attributesUsedInVariants = computed(() => {
|
|
var _a2;
|
|
const allVariantIds = [];
|
|
(_a2 = variants.value) == null ? void 0 : _a2.forEach((x) => {
|
|
var _a3;
|
|
return (_a3 = x.variant_attribute_values) == null ? void 0 : _a3.forEach((y) => {
|
|
if (!allVariantIds.includes(y.attribute_values.id)) {
|
|
allVariantIds.push(y.attribute_values.id);
|
|
}
|
|
});
|
|
});
|
|
const usedInVariants = (attributes2 == null ? void 0 : attributes2.value.filter((x) => x.use_in_variant)) ?? [];
|
|
return usedInVariants.map((x) => {
|
|
var _a3, _b2;
|
|
return {
|
|
attribute_id: x.attribute_id,
|
|
attribute: x.attributes,
|
|
attribute_values_arr: (_a3 = x.attribute_values_arr) == null ? void 0 : _a3.filter((y) => allVariantIds.includes(y.id)),
|
|
attribute_values: (_b2 = x.attribute_values) == null ? void 0 : _b2.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 index;
|
|
if (unref(variantSelected)) {
|
|
index = cartStore.list.findIndex((item) => {
|
|
var _a2;
|
|
return item.product.id == unref(product).id && ((_a2 = item.variant) == null ? void 0 : _a2.id) === unref(variantSelected).id;
|
|
});
|
|
} else {
|
|
index = cartStore.list.findIndex((item) => item.product.id == unref(product).id);
|
|
}
|
|
if (index > -1) return cartStore.list[index].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) {
|
|
var _a, _b;
|
|
if ((_a = list.value) == null ? void 0 : _a.length) {
|
|
const owner_id = (_b = list.value[0].product) == null ? void 0 : _b.owner_id;
|
|
if ((owner_id == null ? void 0 : owner_id.length) && product.owner_id && owner_id !== product.owner_id) {
|
|
list.value = [];
|
|
}
|
|
}
|
|
let index;
|
|
if (variant) {
|
|
index = list.value.findIndex((item) => item.product.id == product.id && item.variant.id === variant.id);
|
|
} else {
|
|
index = list.value.findIndex((item) => item.product.id == product.id);
|
|
}
|
|
if (index > -1) {
|
|
if (qty > 0) {
|
|
list.value[index].qty = qty;
|
|
} else {
|
|
list.value.splice(index, 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 index;
|
|
if (variant_id) {
|
|
index = list.value.findIndex((item) => item.product.id == product_id && item.variant.id === variant_id);
|
|
} else {
|
|
index = list.value.findIndex((item) => item.product.id == product_id);
|
|
}
|
|
if (index > -1) {
|
|
list.value.splice(index, 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) => {
|
|
var _a;
|
|
const productItem = products.find((product) => (product == null ? void 0 : product.id) === cartItem.product.id);
|
|
let variantItem;
|
|
let productCount;
|
|
if (productItem) {
|
|
if (productItem.type === "variant") {
|
|
variantItem = (_a = productItem == null ? void 0 : productItem.variants) == null ? void 0 : _a.find((x) => cartItem.variant.id === x.id);
|
|
productCount = variantItem == null ? void 0 : variantItem.stock;
|
|
} else {
|
|
productCount = productItem == null ? void 0 : productItem.count;
|
|
}
|
|
if (cartItem.qty > productCount) {
|
|
cartItem.qty = productCount;
|
|
}
|
|
list.value.push({ product: cloneDeep(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 markMessageAsRead(chatId, user_id) {
|
|
const { data, error } = await supabase.from("chat_messages").update({ is_read: true, read_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("chat_id", chatId).neq("sender_id", user_id).eq("is_read", false);
|
|
if (error) {
|
|
console.error("Error marking message as read:", error);
|
|
return;
|
|
}
|
|
console.log("Message marked as read:", 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 {
|
|
await supabaseService.fetch("users", "delete", {
|
|
field: "id",
|
|
value: id
|
|
});
|
|
await supabaseService.deleteUser(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();
|
|
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) {
|
|
var _a;
|
|
(_a = e.target) == null ? void 0 : _a.select();
|
|
}
|
|
function goToProfile() {
|
|
const router = useRouter();
|
|
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) {
|
|
var _a, _b, _c;
|
|
let __temp, __restore;
|
|
let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL;
|
|
const history = ((_a = routerOptions.history) == null ? void 0 : _a.call(routerOptions, 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) {
|
|
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, 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) => {
|
|
var _a2, _b2, _c2, _d;
|
|
if (((_b2 = (_a2 = to.matched[0]) == null ? void 0 : _a2.components) == null ? void 0 : _b2.default) === ((_d = (_c2 = from.matched[0]) == null ? void 0 : _c2.components) == null ? void 0 : _d.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 || (nuxtApp._middleware = {
|
|
global: [],
|
|
named: {}
|
|
});
|
|
useError();
|
|
if (!((_b = nuxtApp.ssrContext) == null ? void 0 : _b.islandContext)) {
|
|
router.afterEach(async (to, _from, failure) => {
|
|
delete nuxtApp._processingMiddleware;
|
|
if (failure) {
|
|
await nuxtApp.callHook("page:loading:end");
|
|
}
|
|
if ((failure == null ? void 0 : 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 ((_c = nuxtApp.ssrContext) == null ? void 0 : _c.islandContext) {
|
|
return { provide: { router } };
|
|
}
|
|
const initialLayout = nuxtApp.payload.state._layout;
|
|
router.beforeEach(async (to, from) => {
|
|
var _a2, _b2;
|
|
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 (!((_a2 = nuxtApp.ssrContext) == null ? void 0 : _a2.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$1(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 ((_b2 = namedMiddleware[entry2]) == null ? void 0 : _b2.call(namedMiddleware).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"],
|
|
setup(props, { slots, attrs }) {
|
|
const mounted = shallowRef(false);
|
|
const vm = getCurrentInstance();
|
|
if (vm) {
|
|
vm._nuxtClientOnly = true;
|
|
}
|
|
provide(clientOnlySymbol, true);
|
|
return () => {
|
|
var _a;
|
|
if (mounted.value) {
|
|
const vnodes = (_a = slots.default) == null ? void 0 : _a.call(slots);
|
|
if (vnodes && vnodes.length === 1) {
|
|
return [cloneVNode(vnodes[0], attrs)];
|
|
}
|
|
return vnodes;
|
|
}
|
|
const slot = slots.fallback || slots.placeholder;
|
|
if (slot) {
|
|
return slot();
|
|
}
|
|
const fallbackStr = props.fallback || props.placeholder || "";
|
|
const fallbackTag = props.fallbackTag || props.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) {
|
|
var _a;
|
|
nuxtApp || (nuxtApp = useNuxtApp());
|
|
return (_a = nuxtApp.ssrContext) == null ? void 0 : _a.event;
|
|
}
|
|
const _0_siteConfig_tU0SxKrPeVRXWcGu2sOnIfhNDbYiKNfDCvYZhRueG0Q = /* @__PURE__ */ defineNuxtPlugin({
|
|
name: "nuxt-site-config:init",
|
|
enforce: "pre",
|
|
async setup(nuxtApp) {
|
|
var _a, _b;
|
|
const stack = (_b = (_a = useRequestEvent()) == null ? void 0 : _a.context) == null ? void 0 : _b.siteConfig;
|
|
const state = useState("site-config");
|
|
{
|
|
nuxtApp.hooks.hook("app:rendered", () => {
|
|
state.value = stack == null ? void 0 : 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_z4hgvsiddfKkfXTP6M8M4zG5Cb7sGnDhcryKVM45Di4 = /* @__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_C24GcIKjcI2zsa8A86om0L2LZjx1chWtzYxD11T7Txg = /* @__PURE__ */ defineNuxtPlugin(() => {
|
|
return {
|
|
provide: {
|
|
pwaIcons: {
|
|
transparent: {},
|
|
maskable: {},
|
|
favicon: {},
|
|
apple: {},
|
|
appleSplashScreen: {}
|
|
}
|
|
}
|
|
};
|
|
});
|
|
const unocss_vGb1_aULWT_QMA72v4pP_J70ltB9GmEtNEUl8vHsuII = /* @__PURE__ */ defineNuxtPlugin(() => {
|
|
});
|
|
const init_config_LL47CEFmgpdYE9Cs_saNIOj0KSQjq_8az7e6qB2y3Ko = /* @__PURE__ */ defineNuxtPlugin(async () => {
|
|
let __temp, __restore;
|
|
const configStore = useConfigStore();
|
|
[__temp, __restore] = executeAsync(() => configStore.getConfig()), await __temp, __restore();
|
|
});
|
|
const lazyload_oSWyYwB040EQqpSoyMv0a_ZGXlx9BlocjdtTjNacMzA = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
|
|
nuxtApp.vueApp.use(VueLazyload, {
|
|
// تنظیمات پیشفرض (اختیاری)
|
|
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_z4hgvsiddfKkfXTP6M8M4zG5Cb7sGnDhcryKVM45Di4,
|
|
plugin_pctIVG_FA3ygvTkx4z_pYtRdHdDEZ_qPbl4DqvN9CMQ,
|
|
pwa_icons_plugin_C24GcIKjcI2zsa8A86om0L2LZjx1chWtzYxD11T7Txg,
|
|
unocss_vGb1_aULWT_QMA72v4pP_J70ltB9GmEtNEUl8vHsuII,
|
|
init_config_LL47CEFmgpdYE9Cs_saNIOj0KSQjq_8az7e6qB2y3Ko,
|
|
lazyload_oSWyYwB040EQqpSoyMv0a_ZGXlx9BlocjdtTjNacMzA,
|
|
ready_IqyLfQWq1SSkVA81KGdfnfHuL__bWsFsa22wVAACDFQ
|
|
];
|
|
const layouts = {
|
|
default: defineAsyncComponent(() => import('./default-C1WDm6Yu.mjs').then((m) => m.default || m))
|
|
};
|
|
const LayoutLoader = defineComponent({
|
|
name: "LayoutLoader",
|
|
inheritAttrs: false,
|
|
props: {
|
|
name: String,
|
|
layoutProps: Object
|
|
},
|
|
setup(props, context) {
|
|
return () => h(layouts[props.name], props.layoutProps, context.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(props, context) {
|
|
const nuxtApp = useNuxtApp();
|
|
const injectedRoute = inject(PageRouteSymbol);
|
|
const shouldUseEagerRoute = !injectedRoute || injectedRoute === useRoute();
|
|
const route = shouldUseEagerRoute ? useRoute$1() : injectedRoute;
|
|
const layout = computed(() => {
|
|
let layout2 = unref(props.name) ?? (route == null ? void 0 : route.meta.layout) ?? "default";
|
|
if (layout2 && !(layout2 in layouts)) {
|
|
if (props.fallback) {
|
|
layout2 = unref(props.fallback);
|
|
}
|
|
}
|
|
return layout2;
|
|
});
|
|
const layoutRef = shallowRef();
|
|
context.expose({ layoutRef });
|
|
const done = nuxtApp.deferHydration();
|
|
let lastLayout;
|
|
return () => {
|
|
const hasLayout = layout.value && layout.value in layouts;
|
|
const transitionProps = (route == null ? void 0 : 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(context.attrs, { ref: layoutRef }),
|
|
key: layout.value || void 0,
|
|
name: layout.value,
|
|
shouldProvide: !props.name,
|
|
isRenderingNewLayout: (name) => {
|
|
return name !== previouslyRenderedLayout && name === layout.value;
|
|
},
|
|
hasTransition: !!transitionProps
|
|
},
|
|
context.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(props, context) {
|
|
const name = props.name;
|
|
if (props.shouldProvide) {
|
|
provide(LayoutMetaSymbol, {
|
|
isCurrent: (route) => name === (route.meta.layout ?? "default")
|
|
});
|
|
}
|
|
const injectedRoute = inject(PageRouteSymbol);
|
|
const isNotWithinNuxtPage = injectedRoute && injectedRoute === useRoute();
|
|
if (isNotWithinNuxtPage) {
|
|
const vueRouterRoute = useRoute$1();
|
|
const reactiveChildRoute = {};
|
|
for (const _key in vueRouterRoute) {
|
|
const key2 = _key;
|
|
Object.defineProperty(reactiveChildRoute, key2, {
|
|
enumerable: true,
|
|
get: () => {
|
|
return props.isRenderingNewLayout(props.name) ? vueRouterRoute[key2] : injectedRoute[key2];
|
|
}
|
|
});
|
|
}
|
|
provide(PageRouteSymbol, shallowReactive(reactiveChildRoute));
|
|
}
|
|
return () => {
|
|
var _a, _b;
|
|
if (!name || typeof name === "string" && !(name in layouts)) {
|
|
return (_b = (_a = context.slots).default) == null ? void 0 : _b.call(_a);
|
|
}
|
|
return h(
|
|
LayoutLoader,
|
|
{ key: name, layoutProps: props.layoutProps, name },
|
|
context.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: {
|
|
vnode: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
route: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
vnodeRef: Object,
|
|
renderKey: String,
|
|
trackRootNodes: Boolean
|
|
},
|
|
setup(props) {
|
|
const previousKey = props.renderKey;
|
|
const previousRoute = props.route;
|
|
const route = {};
|
|
for (const key2 in props.route) {
|
|
Object.defineProperty(route, key2, {
|
|
get: () => previousKey === props.renderKey ? props.route[key2] : previousRoute[key2],
|
|
enumerable: true
|
|
});
|
|
}
|
|
provide(PageRouteSymbol, shallowReactive(route));
|
|
return () => {
|
|
return h(props.vnode, { ref: props.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(props, { attrs, slots, expose }) {
|
|
const nuxtApp = useNuxtApp();
|
|
const pageRef = ref();
|
|
inject(PageRouteSymbol, null);
|
|
expose({ pageRef });
|
|
inject(LayoutMetaSymbol, null);
|
|
nuxtApp.deferHydration();
|
|
return () => {
|
|
return h(RouterView, { name: props.name, route: props.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(`<div${ssrRenderAttrs(mergeProps({ class: "desktopConfig" }, _attrs))}>`);
|
|
_push(ssrRenderComponent(_component_AConfigProvider, {
|
|
direction: "ltr",
|
|
theme: {
|
|
token: {
|
|
colorPrimary: unref(colors).primary,
|
|
colorLink: unref(colors).primary,
|
|
fontFamily: unref(config).isRTL ? "azar" : "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(`</div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
_sfc_main$2.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("app.vue");
|
|
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main$1 = {
|
|
__name: "nuxt-error-page",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
error: Object
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const _error = props.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) => `<span class="stack${i.internal ? " internal" : ""}">${i.text}</span>`).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-Ce4fuwdh.mjs'));
|
|
const _Error = defineAsyncComponent(() => import('./error-500-FbierELe.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 = (props, 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(props, 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());
|
|
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(`<div></div>`);
|
|
} 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 = (props, 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(props, ctx) : void 0;
|
|
};
|
|
let entry;
|
|
{
|
|
entry = async function createNuxtAppServer(ssrContext) {
|
|
var _a;
|
|
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);
|
|
(_a = nuxt.payload).error || (_a.error = createError(error));
|
|
}
|
|
if (ssrContext == null ? void 0 : ssrContext._renderResponse) {
|
|
throw new Error("skipping render");
|
|
}
|
|
return vueApp;
|
|
};
|
|
}
|
|
const entry$1 = (ssrContext) => entry(ssrContext);
|
|
|
|
const server = /*#__PURE__*/Object.freeze({
|
|
__proto__: null,
|
|
$: useProviderSize,
|
|
A: APP_Milady_Date,
|
|
B: useCartStore,
|
|
C: APP_TYPE,
|
|
D: reactiveProjectName,
|
|
E: arrayType,
|
|
F: tuple,
|
|
G: initDefaultProps,
|
|
H: omit,
|
|
I: classNames,
|
|
J: objectType,
|
|
K: KeyCode,
|
|
L: anyType,
|
|
M: genComponentStyleHook,
|
|
N: resetComponent,
|
|
O: textEllipsis,
|
|
P: PropTypes,
|
|
Q: devWarning,
|
|
R: flattenChildren,
|
|
S: useConfigInject,
|
|
T: getOptionProps,
|
|
U: warning,
|
|
V: getSupabaseStorageUrl,
|
|
W: useElementSize,
|
|
X: supabaseService,
|
|
Y: myAxios,
|
|
Z: Button,
|
|
_: __nuxt_component_0,
|
|
a: useNuxtApp,
|
|
a$: resetIcon,
|
|
a0: useProviderDisabled,
|
|
a1: useInjectGlobalForm,
|
|
a2: functionType,
|
|
a3: booleanType,
|
|
a4: stringType,
|
|
a5: someType,
|
|
a6: createContext,
|
|
a7: useToken,
|
|
a8: merge,
|
|
a9: warning$1,
|
|
aA: hasProp,
|
|
aB: getComponent,
|
|
aC: findDOMNode,
|
|
aD: useProvidePortal,
|
|
aE: initZoomMotion,
|
|
aF: isFragment,
|
|
aG: getTransitionName,
|
|
aH: getStyle$1,
|
|
aI: withInstall,
|
|
aJ: noteOnce,
|
|
aK: warningOnce,
|
|
aL: useState$1,
|
|
aM: locale$1,
|
|
aN: capitalize,
|
|
aO: Wave,
|
|
aP: initMotion,
|
|
aQ: fetchUserChats,
|
|
aR: api,
|
|
aS: fetchOneChat,
|
|
aT: baseConfirm,
|
|
aU: deleteProductById,
|
|
aV: asyncDataDefaults,
|
|
aW: createError,
|
|
aX: uploadFile,
|
|
aY: updateProduct,
|
|
aZ: createProduct,
|
|
a_: isValid,
|
|
aa: isValidElement,
|
|
ab: useLocaleReceiver,
|
|
ac: localeValues,
|
|
ad: zoomIn,
|
|
ae: getTransitionGroupProps,
|
|
af: getTransitionProps,
|
|
ag: filterEmpty,
|
|
ah: cloneElement,
|
|
ai: eventType,
|
|
aj: useCompactItemContext,
|
|
ak: useInjectDisabled,
|
|
al: NoCompactStyle,
|
|
am: Keyframe,
|
|
an: getPropsSlot,
|
|
ao: unrefElement,
|
|
ap: tryOnUnmounted,
|
|
aq: isObject$1,
|
|
ar: useEventListener,
|
|
as: genFocusOutline,
|
|
at: genCompactItemStyle,
|
|
au: clearFix,
|
|
av: getMotion$1,
|
|
aw: contains,
|
|
ax: getSlot,
|
|
ay: getEvents,
|
|
az: Portal,
|
|
b: useRuntimeConfig,
|
|
b0: useSwipe,
|
|
b1: pickAttrs,
|
|
b2: Modal,
|
|
b3: getStoreCollections,
|
|
b4: checkUsername,
|
|
b5: updateUser,
|
|
b6: useRoute,
|
|
b7: withUndefined,
|
|
b8: useProduct,
|
|
b9: getOneUser,
|
|
ba: skipFlattenKey,
|
|
bb: toPx,
|
|
bc: genFocusStyle,
|
|
bd: camelize,
|
|
be: watchDebounced,
|
|
bf: getCustomerList,
|
|
bg: baseConfirmWithId,
|
|
bh: deleteUser,
|
|
bi: getDataAndAriaProps,
|
|
bj: isEmptyElement,
|
|
bk: filterEmptyWithUndefined,
|
|
bl: customRenderSlot,
|
|
bm: vNodeType,
|
|
bn: getOneProduct,
|
|
bo: canUseDom,
|
|
bp: getTransitionDirection,
|
|
bq: DefaultRenderEmpty,
|
|
br: initFadeMotion,
|
|
bs: hotSelect,
|
|
bt: markMessageAsRead,
|
|
bu: fetchChatMessages,
|
|
bv: useWindowSize,
|
|
bw: useBreakpoints,
|
|
bx: usePriceStore,
|
|
by: breakpointsTailwind,
|
|
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: setPassword,
|
|
r: resolveRouteObject,
|
|
s: supabase,
|
|
t: setBirthday,
|
|
u: useRouter,
|
|
v: verifyOtp,
|
|
w: setNames,
|
|
x: useIntersectionObserver,
|
|
y: getToken,
|
|
z: getProducts
|
|
});
|
|
|
|
export { Keyframe as $, APP_Milady_Date as A, myAxios as B, useConfigInject as C, genComponentStyleHook as D, omit as E, classNames as F, arrayType as G, flattenChildren as H, getOptionProps as I, initDefaultProps as J, objectType as K, anyType as L, tuple as M, resetComponent as N, textEllipsis as O, PropTypes as P, KeyCode as Q, unrefElement as R, tryOnUnmounted as S, isObject$1 as T, useEventListener as U, functionType as V, stringType as W, booleanType as X, useInjectDisabled as Y, merge as Z, __nuxt_component_0 as _, useConfigStore as a, useBreakpoints as a$, genFocusOutline as a0, Button as a1, createContext as a2, filterEmpty as a3, getPropsSlot as a4, findDOMNode as a5, genCompactItemStyle as a6, clearFix as a7, withInstall as a8, isValidElement as a9, someType as aA, devWarning as aB, CloseCircleFilled as aC, CheckCircleFilled as aD, warning as aE, api as aF, fetchUserChats as aG, fetchOneChat as aH, useRoute as aI, useProduct as aJ, useToken as aK, withUndefined as aL, getOneUser as aM, NoCompactStyle as aN, watchDebounced as aO, getCustomerList as aP, baseConfirmWithId as aQ, deleteUser as aR, getOneProduct as aS, filterEmptyWithUndefined as aT, customRenderSlot as aU, isEmptyElement as aV, vNodeType as aW, hotSelect as aX, markMessageAsRead as aY, fetchChatMessages as aZ, useWindowSize as a_, isFragment as aa, getTransitionName as ab, cloneElement as ac, getStyle$1 as ad, initZoomMotion as ae, getSlot as af, getEvents as ag, contains as ah, Portal as ai, hasProp as aj, getComponent as ak, useProvidePortal as al, getMotion$1 as am, getTransitionProps as an, eventType as ao, Wave as ap, CloseOutlined as aq, capitalize as ar, initMotion as as, baseConfirm as at, deleteProductById as au, dayjs as av, uploadFile as aw, updateProduct as ax, createProduct as ay, useSwipe as az, useUserStore as b, breakpointsTailwind as b0, useNuxtApp as b1, usePriceStore as b2, useHead as b3, resolveRouteObject as b4, useRuntimeConfig as b5, navigateTo as b6, nuxtLinkDefaults as b7, Icon as b8, asyncDataDefaults as b9, Modal as bA, getStoreCollections as bB, D as bC, Y as bD, W as bE, MS as bF, Q as bG, M as bH, FORMAT_DEFAULT as bI, locale$1 as bJ, warningOnce as bK, noteOnce as bL, server as bM, createError as ba, useProviderSize as bb, useProviderDisabled as bc, useInjectGlobalForm as bd, warning$1 as be, LoadingOutlined as bf, ExclamationCircleFilled as bg, zoomIn as bh, useLocaleReceiver as bi, localeValues as bj, getTransitionGroupProps as bk, isValid as bl, resetIcon as bm, camelize as bn, useState$1 as bo, toPx as bp, genFocusStyle as bq, skipFlattenKey as br, getDataAndAriaProps as bs, useCompactItemContext as bt, getTransitionDirection as bu, DefaultRenderEmpty as bv, pickAttrs as bw, initFadeMotion as bx, checkUsername as by, updateUser as bz, appName as c, setToken as d, api$1 as e, loading as f, goToProfile as g, generateOtp as h, forgetPassword as i, setPassword as j, setBirthday as k, login as l, setNames as m, useIntersectionObserver as n, getToken as o, useCartStore as p, APP_TYPE as q, removeToken as r, supabase as s, reactiveProjectName as t, useRouter as u, verifyOtp as v, getProducts as w, getSupabaseStorageUrl as x, supabaseService as y, useElementSize as z };
|
|
//# sourceMappingURL=server.mjs.map
|